UNPKG

@camunda8/sdk

Version:

[![NPM](https://nodei.co/npm/@camunda8/sdk.png)](https://www.npmjs.com/package/@camunda8/sdk)

33 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSpecializedCreateProcessInstanceResponseClass = void 0; const C8Dto_1 = require("./C8Dto"); const factory = createMemoizedSpecializedCreateProcessInstanceResponseClassFactory(); // Creates a specialized RestApiJob class that is cached based on output variables const createSpecializedCreateProcessInstanceResponseClass = (outputVariableDto) => { return factory(outputVariableDto); }; exports.createSpecializedCreateProcessInstanceResponseClass = createSpecializedCreateProcessInstanceResponseClass; function createMemoizedSpecializedCreateProcessInstanceResponseClassFactory() { const cache = new Map(); return function (outputVariableDto) { // Create a unique cache key based on the class and inputs const cacheKey = JSON.stringify({ outputVariableDto, }); // Check for cached result if (cache.has(cacheKey)) { return cache.get(cacheKey); } // Create a new class that extends the original class class CustomCreateProcessInstanceResponseClass extends C8Dto_1.CreateProcessInstanceResponse { } // Use Reflect to define the metadata on the new class's prototype Reflect.defineMetadata('child:class', outputVariableDto, CustomCreateProcessInstanceResponseClass.prototype, 'variables'); // Store the new class in cache cache.set(cacheKey, CustomCreateProcessInstanceResponseClass); // Return the new class return CustomCreateProcessInstanceResponseClass; }; } //# sourceMappingURL=RestApiProcessInstanceClassFactory.js.map