UNPKG

nestjs-temporal-core

Version:

Complete NestJS integration for Temporal.io with auto-discovery, declarative scheduling, enhanced monitoring, and enterprise-ready features

57 lines 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TaskQueue = exports.RunId = exports.WorkflowId = exports.WorkflowContext = exports.WorkflowParam = void 0; const common_1 = require("@nestjs/common"); const constants_1 = require("../constants"); exports.WorkflowParam = (0, common_1.createParamDecorator)((_index, _ctx) => { return undefined; }); const WorkflowContext = () => { return (target, propertyKey, parameterIndex) => { if (!propertyKey) return; const existingParams = Reflect.getMetadata(constants_1.WORKFLOW_PARAMS_METADATA, target, propertyKey) || []; existingParams[parameterIndex] = { type: 'context', }; Reflect.defineMetadata(constants_1.WORKFLOW_PARAMS_METADATA, existingParams, target, propertyKey); }; }; exports.WorkflowContext = WorkflowContext; const WorkflowId = () => { return (target, propertyKey, parameterIndex) => { if (!propertyKey) return; const existingParams = Reflect.getMetadata(constants_1.WORKFLOW_PARAMS_METADATA, target, propertyKey) || []; existingParams[parameterIndex] = { type: 'workflowId', }; Reflect.defineMetadata(constants_1.WORKFLOW_PARAMS_METADATA, existingParams, target, propertyKey); }; }; exports.WorkflowId = WorkflowId; const RunId = () => { return (target, propertyKey, parameterIndex) => { if (!propertyKey) return; const existingParams = Reflect.getMetadata(constants_1.WORKFLOW_PARAMS_METADATA, target, propertyKey) || []; existingParams[parameterIndex] = { type: 'runId', }; Reflect.defineMetadata(constants_1.WORKFLOW_PARAMS_METADATA, existingParams, target, propertyKey); }; }; exports.RunId = RunId; const TaskQueue = () => { return (target, propertyKey, parameterIndex) => { if (!propertyKey) return; const existingParams = Reflect.getMetadata(constants_1.WORKFLOW_PARAMS_METADATA, target, propertyKey) || []; existingParams[parameterIndex] = { type: 'taskQueue', }; Reflect.defineMetadata(constants_1.WORKFLOW_PARAMS_METADATA, existingParams, target, propertyKey); }; }; exports.TaskQueue = TaskQueue; //# sourceMappingURL=parameter.decorator.js.map