nestjs-temporal-core
Version:
Complete NestJS integration for Temporal.io with auto-discovery, declarative scheduling, enhanced monitoring, and enterprise-ready features
47 lines • 1.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowProxy = void 0;
class WorkflowProxy {
constructor(clientService, config) {
this.clientService = clientService;
this.config = config;
}
async start(args, options) {
const handle = await this.clientService.startWorkflow(this.config.workflowType, args, this.mergeOptions(options));
return handle;
}
async getHandle(workflowId, runId) {
const handle = await this.clientService.getWorkflowHandle(workflowId, runId);
return handle;
}
async signal(workflowId, signalDef, ...args) {
return this.clientService.signalWorkflow(workflowId, signalDef.name, args);
}
async signalByName(workflowId, signalName, args) {
return this.clientService.signalWorkflow(workflowId, signalName, args);
}
async query(workflowId, queryDef, ...args) {
return this.clientService.queryWorkflow(workflowId, queryDef.name, args);
}
async queryByName(workflowId, queryName, args) {
return this.clientService.queryWorkflow(workflowId, queryName, args);
}
async update(workflowId, updateDef, ...args) {
return this.clientService.updateWorkflow(workflowId, updateDef.name, args);
}
async updateByName(workflowId, updateName, args) {
return this.clientService.updateWorkflow(workflowId, updateName, args);
}
async signalWithStart(signalDef, signalArgs, workflowArgs, options) {
const handle = await this.clientService.signalWithStart(this.config.workflowType, signalDef.name, signalArgs, workflowArgs, this.mergeOptions(options));
return handle;
}
mergeOptions(options) {
return {
...(this.config.taskQueue && { taskQueue: this.config.taskQueue }),
...options,
};
}
}
exports.WorkflowProxy = WorkflowProxy;
//# sourceMappingURL=workflow-proxy.js.map