@loopstack/core 0.15.3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/loop-core.module.js +5 -1
- package/dist/loop-core.module.js.map +1 -1
- package/dist/persistence/persistence.module.js +3 -0
- package/dist/persistence/persistence.module.js.map +1 -1
- package/dist/persistence/services/event-subscriber.service.d.ts +17 -0
- package/dist/persistence/services/event-subscriber.service.js +75 -0
- package/dist/persistence/services/event-subscriber.service.js.map +1 -0
- package/dist/persistence/services/index.d.ts +1 -0
- package/dist/persistence/services/index.js +1 -0
- package/dist/persistence/services/index.js.map +1 -1
- package/dist/scheduler/scheduler.module.js +2 -0
- package/dist/scheduler/scheduler.module.js.map +1 -1
- package/dist/scheduler/services/event-processor.service.d.ts +15 -0
- package/dist/scheduler/services/event-processor.service.js +71 -0
- package/dist/scheduler/services/event-processor.service.js.map +1 -0
- package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.d.ts +3 -1
- package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.js +17 -3
- package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.js.map +1 -1
- package/dist/tools/execute-workflow-async.tool.d.ts +39 -0
- package/dist/tools/execute-workflow-async.tool.js +82 -0
- package/dist/tools/execute-workflow-async.tool.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/workflow-processor/abstract/block.abstract.d.ts +2 -0
- package/dist/workflow-processor/abstract/block.abstract.js +4 -0
- package/dist/workflow-processor/abstract/block.abstract.js.map +1 -1
- package/dist/workflow-processor/abstract/tool-base.abstract.d.ts +1 -1
- package/dist/workflow-processor/abstract/workflow-base.abstract.d.ts +2 -0
- package/dist/workflow-processor/abstract/workflow-base.abstract.js +1 -0
- package/dist/workflow-processor/abstract/workflow-base.abstract.js.map +1 -1
- package/dist/workflow-processor/services/processors/workflow-processor.service.js +1 -0
- package/dist/workflow-processor/services/processors/workflow-processor.service.js.map +1 -1
- package/dist/workflow-processor/services/state-machine-processor.service.js +4 -0
- package/dist/workflow-processor/services/state-machine-processor.service.js.map +1 -1
- package/dist/workflow-processor/services/state-machine-tool-call-processor.service.d.ts +2 -2
- package/dist/workflow-processor/services/state-machine-tool-call-processor.service.js +13 -3
- package/dist/workflow-processor/services/state-machine-tool-call-processor.service.js.map +1 -1
- package/package.json +2 -3
- package/dist/persistence/services/__backup__/document.service.d.ts +0 -0
- package/dist/persistence/services/__backup__/document.service.js +0 -1
- package/dist/persistence/services/__backup__/document.service.js.map +0 -1
- package/dist/persistence/services/__backup__/dynamic-repository.service.d.ts +0 -0
- package/dist/persistence/services/__backup__/dynamic-repository.service.js +0 -1
- package/dist/persistence/services/__backup__/dynamic-repository.service.js.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./scheduler"), exports);
|
|
|
21
21
|
__exportStar(require("./workflow-processor"), exports);
|
|
22
22
|
__exportStar(require("./loop-core.module"), exports);
|
|
23
23
|
__exportStar(require("./loop-core.module-definition"), exports);
|
|
24
|
+
__exportStar(require("./tools"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA0B;AAE1B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,uDAAqC;AAErC,qDAAmC;AACnC,gEAA8C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAA0B;AAE1B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,uDAAqC;AAErC,qDAAmC;AACnC,gEAA8C;AAC9C,0CAAwB"}
|
package/dist/loop-core.module.js
CHANGED
|
@@ -14,6 +14,7 @@ const common_2 = require("@loopstack/common");
|
|
|
14
14
|
const common_3 = require("./common");
|
|
15
15
|
const workflow_processor_1 = require("./workflow-processor");
|
|
16
16
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
17
|
+
const tools_1 = require("./tools");
|
|
17
18
|
let LoopCoreModule = class LoopCoreModule {
|
|
18
19
|
};
|
|
19
20
|
exports.LoopCoreModule = LoopCoreModule;
|
|
@@ -34,7 +35,10 @@ exports.LoopCoreModule = LoopCoreModule = __decorate([
|
|
|
34
35
|
workflow_processor_1.WorkflowProcessorModule,
|
|
35
36
|
scheduler_1.SchedulerModule,
|
|
36
37
|
],
|
|
37
|
-
|
|
38
|
+
providers: [
|
|
39
|
+
tools_1.ExecuteWorkflowAsync,
|
|
40
|
+
],
|
|
41
|
+
exports: [common_3.CommonModule, workflow_processor_1.WorkflowProcessorModule, scheduler_1.SchedulerModule, tools_1.ExecuteWorkflowAsync],
|
|
38
42
|
})
|
|
39
43
|
], LoopCoreModule);
|
|
40
44
|
//# sourceMappingURL=loop-core.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-core.module.js","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,yDAA2D;AAC3D,8CAM2B;AAC3B,qCAAwC;AACxC,6DAA+D;AAC/D,6CAAgD;
|
|
1
|
+
{"version":3,"file":"loop-core.module.js","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,yDAA2D;AAC3D,8CAM2B;AAC3B,qCAAwC;AACxC,6DAA+D;AAC/D,6CAAgD;AAChD,mCAA+C;AAuBxC,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IArB1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,uBAAc;gBACd,uBAAc;gBACd,uBAAc;gBACd,wBAAe;gBACf,wBAAe;aAChB,CAAC;YACF,kCAAkB,CAAC,OAAO,CAAC;gBACzB,MAAM,EAAE,IAAI;aACb,CAAC;YACF,qBAAY;YACZ,4CAAuB;YACvB,2BAAe;SAChB;QACD,SAAS,EAAE;YACT,4BAAoB;SACrB;QACD,OAAO,EAAE,CAAC,qBAAY,EAAE,4CAAuB,EAAE,2BAAe,EAAE,4BAAoB,CAAC;KACxF,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -24,6 +24,7 @@ exports.PersistenceModule = PersistenceModule = __decorate([
|
|
|
24
24
|
common_2.WorkspaceEntity,
|
|
25
25
|
common_2.PipelineEntity,
|
|
26
26
|
common_2.DocumentEntity,
|
|
27
|
+
common_2.EventSubscriberEntity,
|
|
27
28
|
]),
|
|
28
29
|
common_3.CommonModule,
|
|
29
30
|
],
|
|
@@ -34,6 +35,7 @@ exports.PersistenceModule = PersistenceModule = __decorate([
|
|
|
34
35
|
services_1.PipelineService,
|
|
35
36
|
services_1.DocumentService,
|
|
36
37
|
services_1.MigrationsService,
|
|
38
|
+
services_1.EventSubscriberService,
|
|
37
39
|
],
|
|
38
40
|
exports: [
|
|
39
41
|
services_1.WorkflowService,
|
|
@@ -41,6 +43,7 @@ exports.PersistenceModule = PersistenceModule = __decorate([
|
|
|
41
43
|
services_1.WorkspaceService,
|
|
42
44
|
services_1.PipelineService,
|
|
43
45
|
services_1.DocumentService,
|
|
46
|
+
services_1.EventSubscriberService,
|
|
44
47
|
],
|
|
45
48
|
})
|
|
46
49
|
], PersistenceModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../src/persistence/persistence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,8CAM2B;AAC3B,yCAOoB;AACpB,sCAAyC;
|
|
1
|
+
{"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../src/persistence/persistence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,8CAM2B;AAC3B,yCAOoB;AACpB,sCAAyC;AAgClC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IA9B7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,uBAAc;gBACd,wBAAe;gBACf,wBAAe;gBACf,uBAAc;gBACd,uBAAc;gBACd,8BAAqB;aACtB,CAAC;YACF,qBAAY;SACb;QACD,SAAS,EAAE;YACT,0BAAe;YACf,4BAAiB;YACjB,2BAAgB;YAChB,0BAAe;YACf,0BAAe;YACf,4BAAiB;YACjB,iCAAsB;SACvB;QACD,OAAO,EAAE;YACP,0BAAe;YACf,4BAAiB;YACjB,2BAAgB;YAChB,0BAAe;YACf,0BAAe;YACf,iCAAsB;SACvB;KACF,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { EventSubscriberEntity } from '@loopstack/common';
|
|
3
|
+
export interface PipelineEventPayload {
|
|
4
|
+
eventPipelineId: string;
|
|
5
|
+
eventName: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
data: any;
|
|
8
|
+
}
|
|
9
|
+
export declare class EventSubscriberService {
|
|
10
|
+
private entityRepository;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(entityRepository: Repository<EventSubscriberEntity>);
|
|
13
|
+
registerSubscriber(subscriberPipelineId: string, subscriberWorkflowId: string, subscriberTransition: string, eventPipelineId: string, eventName: string, userId: string, workspaceId?: string): Promise<EventSubscriberEntity>;
|
|
14
|
+
findSubscribers(eventPipelineId: string, eventName: string, workspaceId: string): Promise<EventSubscriberEntity[]>;
|
|
15
|
+
removeSubscribersByPipelineId(pipelineId: string): Promise<void>;
|
|
16
|
+
removeSubscriber(id: string): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var EventSubscriberService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.EventSubscriberService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const common_2 = require("@loopstack/common");
|
|
21
|
+
let EventSubscriberService = EventSubscriberService_1 = class EventSubscriberService {
|
|
22
|
+
entityRepository;
|
|
23
|
+
logger = new common_1.Logger(EventSubscriberService_1.name);
|
|
24
|
+
constructor(entityRepository) {
|
|
25
|
+
this.entityRepository = entityRepository;
|
|
26
|
+
}
|
|
27
|
+
async registerSubscriber(subscriberPipelineId, subscriberWorkflowId, subscriberTransition, eventPipelineId, eventName, userId, workspaceId) {
|
|
28
|
+
const existing = await this.entityRepository.findOne({
|
|
29
|
+
where: {
|
|
30
|
+
subscriberPipelineId,
|
|
31
|
+
subscriberWorkflowId,
|
|
32
|
+
subscriberTransition,
|
|
33
|
+
eventPipelineId,
|
|
34
|
+
eventName,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
if (existing) {
|
|
38
|
+
return existing;
|
|
39
|
+
}
|
|
40
|
+
const subscriber = this.entityRepository.create({
|
|
41
|
+
subscriberPipelineId,
|
|
42
|
+
subscriberWorkflowId,
|
|
43
|
+
subscriberTransition,
|
|
44
|
+
eventPipelineId,
|
|
45
|
+
eventName,
|
|
46
|
+
userId,
|
|
47
|
+
workspaceId,
|
|
48
|
+
});
|
|
49
|
+
return await this.entityRepository.save(subscriber);
|
|
50
|
+
}
|
|
51
|
+
async findSubscribers(eventPipelineId, eventName, workspaceId) {
|
|
52
|
+
return this.entityRepository.find({
|
|
53
|
+
where: {
|
|
54
|
+
eventPipelineId,
|
|
55
|
+
eventName,
|
|
56
|
+
workspaceId,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async removeSubscribersByPipelineId(pipelineId) {
|
|
61
|
+
await this.entityRepository.delete({
|
|
62
|
+
subscriberPipelineId: pipelineId,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async removeSubscriber(id) {
|
|
66
|
+
await this.entityRepository.delete({ id });
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.EventSubscriberService = EventSubscriberService;
|
|
70
|
+
exports.EventSubscriberService = EventSubscriberService = EventSubscriberService_1 = __decorate([
|
|
71
|
+
(0, common_1.Injectable)(),
|
|
72
|
+
__param(0, (0, typeorm_1.InjectRepository)(common_2.EventSubscriberEntity)),
|
|
73
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
74
|
+
], EventSubscriberService);
|
|
75
|
+
//# sourceMappingURL=event-subscriber.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-subscriber.service.js","sourceRoot":"","sources":["../../../src/persistence/services/event-subscriber.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6CAAmD;AACnD,qCAAqC;AACrC,8CAA0D;AAUnD,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAKvB;IAJO,MAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IAElE,YAEU,gBAAmD;QAAnD,qBAAgB,GAAhB,gBAAgB,CAAmC;IAC1D,CAAC;IAEJ,KAAK,CAAC,kBAAkB,CACtB,oBAA4B,EAC5B,oBAA4B,EAC5B,oBAA4B,EAC5B,eAAuB,EACvB,SAAiB,EACjB,MAAc,EACd,WAAoB;QAEpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YACnD,KAAK,EAAE;gBACL,oBAAoB;gBACpB,oBAAoB;gBACpB,oBAAoB;gBACpB,eAAe;gBACf,SAAS;aACV;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;YAC9C,oBAAoB;YACpB,oBAAoB;YACpB,oBAAoB;YACpB,eAAe;YACf,SAAS;YACT,MAAM;YACN,WAAW;SACZ,CAAC,CAAC;QAEH,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,eAAuB,EACvB,SAAiB,EACjB,WAAmB;QAEnB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAChC,KAAK,EAAE;gBACL,eAAe;gBACf,SAAS;gBACT,WAAW;aACZ;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,6BAA6B,CAAC,UAAkB;QACpD,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;YACjC,oBAAoB,EAAE,UAAU;SACjC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAU;QAC/B,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AAnEY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,0BAAgB,EAAC,8BAAqB,CAAC,CAAA;qCACd,oBAAU;GAL3B,sBAAsB,CAmElC"}
|
|
@@ -20,4 +20,5 @@ __exportStar(require("./workspace.service"), exports);
|
|
|
20
20
|
__exportStar(require("./pipeline.service"), exports);
|
|
21
21
|
__exportStar(require("./document.service"), exports);
|
|
22
22
|
__exportStar(require("./migrations.service"), exports);
|
|
23
|
+
__exportStar(require("./event-subscriber.service"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC;AACnC,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/persistence/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC;AACnC,uDAAqC;AACrC,6DAA2C"}
|
|
@@ -18,6 +18,7 @@ const create_workspace_task_processor_service_1 = require("./services/task-proce
|
|
|
18
18
|
const create_run_pipeline_task_processor_service_1 = require("./services/task-processor/create-run-pipeline-task-processor.service");
|
|
19
19
|
const workflow_processor_1 = require("../workflow-processor");
|
|
20
20
|
const persistence_1 = require("../persistence");
|
|
21
|
+
const event_processor_service_1 = require("./services/event-processor.service");
|
|
21
22
|
let SchedulerModule = class SchedulerModule {
|
|
22
23
|
};
|
|
23
24
|
exports.SchedulerModule = SchedulerModule;
|
|
@@ -57,6 +58,7 @@ exports.SchedulerModule = SchedulerModule = __decorate([
|
|
|
57
58
|
cleanup_pipeline_task_processor_service_1.CleanupPipelineTaskProcessorService,
|
|
58
59
|
create_workspace_task_processor_service_1.CreateWorkspaceTaskProcessorService,
|
|
59
60
|
services_1.RunService,
|
|
61
|
+
event_processor_service_1.EventProcessorService,
|
|
60
62
|
],
|
|
61
63
|
exports: [services_1.TaskSchedulerService, services_1.RunService],
|
|
62
64
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.module.js","sourceRoot":"","sources":["../../src/scheduler/scheduler.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA4C;AAC5C,yCAA8D;AAC9D,8EAAyE;AACzE,wFAAmF;AACnF,uHAAgH;AAChH,+HAAwH;AACxH,+HAAwH;AACxH,qIAA6H;AAC7H,8DAAgE;AAChE,gDAAmD;
|
|
1
|
+
{"version":3,"file":"scheduler.module.js","sourceRoot":"","sources":["../../src/scheduler/scheduler.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA4C;AAC5C,yCAA8D;AAC9D,8EAAyE;AACzE,wFAAmF;AACnF,uHAAgH;AAChH,+HAAwH;AACxH,+HAAwH;AACxH,qIAA6H;AAC7H,8DAAgE;AAChE,gDAAmD;AACnD,gFAA2E;AA6CpE,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IA3C3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,mBAAU,CAAC,OAAO,CAAC;gBACjB,UAAU,EAAE;oBACV,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,WAAW;oBAC3C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;wBAC1B,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,EAAE,CAAC,CAAC;wBAC/C,CAAC,CAAC,IAAI;oBACR,MAAM,EAAE,CAAC;iBAKV;aACF,CAAC;YACF,mBAAU,CAAC,aAAa,CAAC;gBACvB,IAAI,EAAE,YAAY;gBAClB,iBAAiB,EAAE;oBACjB,gBAAgB,EAAE,GAAG;oBACrB,YAAY,EAAE,EAAE;oBAChB,QAAQ,EAAE,CAAC;oBACX,OAAO,EAAE;wBACP,IAAI,EAAE,aAAa;wBACnB,KAAK,EAAE,IAAI;qBACZ;iBACF;aACF,CAAC;YACF,+BAAiB;YACjB,4CAAuB;SACxB;QACD,SAAS,EAAE;YACT,+BAAoB;YACpB,6CAAoB;YACpB,uDAAyB;YACzB,qEAA+B;YAC/B,kFAAqC;YACrC,6EAAmC;YACnC,6EAAmC;YACnC,qBAAU;YACV,+CAAqB;SACtB;QACD,OAAO,EAAE,CAAC,+BAAoB,EAAE,qBAAU,CAAC;KAC5C,CAAC;GACW,eAAe,CAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TaskSchedulerService } from '../../scheduler/services/task-scheduler.service';
|
|
2
|
+
import { EventSubscriberService } from 'src/persistence';
|
|
3
|
+
export interface PipelineEventPayload {
|
|
4
|
+
eventPipelineId: string;
|
|
5
|
+
eventName: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
data: any;
|
|
8
|
+
}
|
|
9
|
+
export declare class EventProcessorService {
|
|
10
|
+
private readonly eventSubscriberService;
|
|
11
|
+
private readonly taskSchedulerService;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
constructor(eventSubscriberService: EventSubscriberService, taskSchedulerService: TaskSchedulerService);
|
|
14
|
+
handlePipelineEvent(payload: PipelineEventPayload): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EventProcessorService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
15
|
+
const task_scheduler_service_1 = require("../../scheduler/services/task-scheduler.service");
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const persistence_1 = require("../../persistence");
|
|
18
|
+
let EventProcessorService = class EventProcessorService {
|
|
19
|
+
eventSubscriberService;
|
|
20
|
+
taskSchedulerService;
|
|
21
|
+
logger = new common_1.Logger(persistence_1.EventSubscriberService.name);
|
|
22
|
+
constructor(eventSubscriberService, taskSchedulerService) {
|
|
23
|
+
this.eventSubscriberService = eventSubscriberService;
|
|
24
|
+
this.taskSchedulerService = taskSchedulerService;
|
|
25
|
+
}
|
|
26
|
+
async handlePipelineEvent(payload) {
|
|
27
|
+
const { eventPipelineId, eventName, workspaceId, data } = payload;
|
|
28
|
+
const subscribers = await this.eventSubscriberService.findSubscribers(eventPipelineId, eventName, workspaceId);
|
|
29
|
+
for (const subscriber of subscribers) {
|
|
30
|
+
this.logger.log(`Matching subscriber found: pipeline=${subscriber.subscriberPipelineId}, ` +
|
|
31
|
+
`workflow=${subscriber.subscriberWorkflowId}, transition=${subscriber.subscriberTransition}`);
|
|
32
|
+
try {
|
|
33
|
+
await this.taskSchedulerService.addTask({
|
|
34
|
+
id: 'event_subscriber_execution-' + (0, node_crypto_1.randomUUID)(),
|
|
35
|
+
task: {
|
|
36
|
+
name: 'event_subscriber_execution',
|
|
37
|
+
type: 'run_pipeline',
|
|
38
|
+
payload: {
|
|
39
|
+
id: subscriber.subscriberPipelineId,
|
|
40
|
+
transition: {
|
|
41
|
+
id: subscriber.subscriberTransition,
|
|
42
|
+
workflowId: subscriber.subscriberWorkflowId,
|
|
43
|
+
payload: data,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
user: subscriber.userId,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (subscriber.once) {
|
|
50
|
+
await this.eventSubscriberService.removeSubscriber(subscriber.id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.logger.error(`Failed to add task for subscriber ${subscriber.id}: ${error}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.EventProcessorService = EventProcessorService;
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, event_emitter_1.OnEvent)('pipeline.event'),
|
|
62
|
+
__metadata("design:type", Function),
|
|
63
|
+
__metadata("design:paramtypes", [Object]),
|
|
64
|
+
__metadata("design:returntype", Promise)
|
|
65
|
+
], EventProcessorService.prototype, "handlePipelineEvent", null);
|
|
66
|
+
exports.EventProcessorService = EventProcessorService = __decorate([
|
|
67
|
+
(0, common_1.Injectable)(),
|
|
68
|
+
__metadata("design:paramtypes", [persistence_1.EventSubscriberService,
|
|
69
|
+
task_scheduler_service_1.TaskSchedulerService])
|
|
70
|
+
], EventProcessorService);
|
|
71
|
+
//# sourceMappingURL=event-processor.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-processor.service.js","sourceRoot":"","sources":["../../../src/scheduler/services/event-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AACpD,yDAAgD;AAChD,4FAAuF;AACvF,6CAAyC;AAEzC,mDAAyD;AAUlD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAIb;IACA;IAJF,MAAM,GAAG,IAAI,eAAM,CAAC,oCAAsB,CAAC,IAAI,CAAC,CAAC;IAElE,YACmB,sBAA8C,EAC9C,oBAA0C;QAD1C,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,yBAAoB,GAApB,oBAAoB,CAAsB;IAC1D,CAAC;IAGE,AAAN,KAAK,CAAC,mBAAmB,CAAC,OAA6B;QACrD,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAElE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CACnE,eAAe,EACf,SAAS,EACT,WAAW,CACZ,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,uCAAuC,UAAU,CAAC,oBAAoB,IAAI;gBACxE,YAAY,UAAU,CAAC,oBAAoB,gBAAgB,UAAU,CAAC,oBAAoB,EAAE,CAC/F,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;oBACtC,EAAE,EAAE,6BAA6B,GAAG,IAAA,wBAAU,GAAE;oBAChD,IAAI,EAAE;wBACJ,IAAI,EAAE,4BAA4B;wBAClC,IAAI,EAAE,cAAc;wBACpB,OAAO,EAAE;4BACP,EAAE,EAAE,UAAU,CAAC,oBAAoB;4BACnC,UAAU,EAAE;gCACV,EAAE,EAAE,UAAU,CAAC,oBAAoB;gCACnC,UAAU,EAAE,UAAU,CAAC,oBAAoB;gCAC3C,OAAO,EAAE,IAAI;6BACd;yBACF;wBACD,IAAI,EAAE,UAAU,CAAC,MAAM;qBACxB;iBACsB,CAAC,CAAC;gBAE3B,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;oBACpB,MAAM,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,qCAAqC,UAAU,CAAC,EAAE,KAAK,KAAK,EAAE,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AApDY,sDAAqB;AAS1B;IADL,IAAA,uBAAO,EAAC,gBAAgB,CAAC;;;;gEA2CzB;gCAnDU,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAKgC,oCAAsB;QACxB,6CAAoB;GALlD,qBAAqB,CAoDjC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { RunPipelineTask } from '@loopstack/contracts/types';
|
|
2
2
|
import { RootProcessorService } from '../../../workflow-processor';
|
|
3
3
|
import { PipelineService } from '../../../persistence';
|
|
4
|
+
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
4
5
|
export declare class RunPipelineTaskProcessorService {
|
|
5
6
|
private readonly pipelineService;
|
|
6
7
|
private readonly rootProcessorService;
|
|
8
|
+
private readonly eventEmitter;
|
|
7
9
|
private readonly logger;
|
|
8
|
-
constructor(pipelineService: PipelineService, rootProcessorService: RootProcessorService);
|
|
10
|
+
constructor(pipelineService: PipelineService, rootProcessorService: RootProcessorService, eventEmitter: EventEmitter2);
|
|
9
11
|
process(task: RunPipelineTask): Promise<void>;
|
|
10
12
|
}
|
|
@@ -14,13 +14,17 @@ exports.RunPipelineTaskProcessorService = void 0;
|
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const workflow_processor_1 = require("../../../workflow-processor");
|
|
16
16
|
const persistence_1 = require("../../../persistence");
|
|
17
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
18
|
+
const enums_1 = require("@loopstack/contracts/enums");
|
|
17
19
|
let RunPipelineTaskProcessorService = RunPipelineTaskProcessorService_1 = class RunPipelineTaskProcessorService {
|
|
18
20
|
pipelineService;
|
|
19
21
|
rootProcessorService;
|
|
22
|
+
eventEmitter;
|
|
20
23
|
logger = new common_1.Logger(RunPipelineTaskProcessorService_1.name);
|
|
21
|
-
constructor(pipelineService, rootProcessorService) {
|
|
24
|
+
constructor(pipelineService, rootProcessorService, eventEmitter) {
|
|
22
25
|
this.pipelineService = pipelineService;
|
|
23
26
|
this.rootProcessorService = rootProcessorService;
|
|
27
|
+
this.eventEmitter = eventEmitter;
|
|
24
28
|
}
|
|
25
29
|
async process(task) {
|
|
26
30
|
const pipeline = await this.pipelineService.getPipeline(task.payload.id, task.user, ['workspace']);
|
|
@@ -28,13 +32,23 @@ let RunPipelineTaskProcessorService = RunPipelineTaskProcessorService_1 = class
|
|
|
28
32
|
throw new Error(`Pipeline with id ${task.payload.id} not found.`);
|
|
29
33
|
}
|
|
30
34
|
this.logger.debug(`Pipeline for schedule task created with id ${pipeline.id}`);
|
|
31
|
-
await this.rootProcessorService.runPipeline(pipeline, task.payload);
|
|
35
|
+
const resultCtx = await this.rootProcessorService.runPipeline(pipeline, task.payload);
|
|
36
|
+
if (resultCtx.entity.status === enums_1.WorkflowState.Completed) {
|
|
37
|
+
this.logger.log(`Root pipeline execution completed.`);
|
|
38
|
+
this.eventEmitter.emit('pipeline.event', {
|
|
39
|
+
eventPipelineId: pipeline.id,
|
|
40
|
+
eventName: 'completed',
|
|
41
|
+
workspaceId: pipeline.workspaceId,
|
|
42
|
+
data: resultCtx.entity.result,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
32
45
|
}
|
|
33
46
|
};
|
|
34
47
|
exports.RunPipelineTaskProcessorService = RunPipelineTaskProcessorService;
|
|
35
48
|
exports.RunPipelineTaskProcessorService = RunPipelineTaskProcessorService = RunPipelineTaskProcessorService_1 = __decorate([
|
|
36
49
|
(0, common_1.Injectable)(),
|
|
37
50
|
__metadata("design:paramtypes", [persistence_1.PipelineService,
|
|
38
|
-
workflow_processor_1.RootProcessorService
|
|
51
|
+
workflow_processor_1.RootProcessorService,
|
|
52
|
+
event_emitter_1.EventEmitter2])
|
|
39
53
|
], RunPipelineTaskProcessorService);
|
|
40
54
|
//# sourceMappingURL=run-pipeline-task-processor.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-pipeline-task-processor.service.js","sourceRoot":"","sources":["../../../../src/scheduler/services/task-processor/run-pipeline-task-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAEpD,oEAAmE;AACnE,sDAAuD;
|
|
1
|
+
{"version":3,"file":"run-pipeline-task-processor.service.js","sourceRoot":"","sources":["../../../../src/scheduler/services/task-processor/run-pipeline-task-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAEpD,oEAAmE;AACnE,sDAAuD;AACvD,yDAAsD;AACtD,sDAA2D;AAIpD,IAAM,+BAA+B,uCAArC,MAAM,+BAA+B;IAIvB;IACA;IACA;IALF,MAAM,GAAG,IAAI,eAAM,CAAC,iCAA+B,CAAC,IAAI,CAAC,CAAC;IAE3E,YACmB,eAAgC,EAChC,oBAA0C,EAC1C,YAA2B;QAF3B,oBAAe,GAAf,eAAe,CAAiB;QAChC,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,iBAAY,GAAZ,YAAY,CAAe;IAC3C,CAAC;IAEG,KAAK,CAAC,OAAO,CAAC,IAAqB;QACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CACrD,IAAI,CAAC,OAAO,CAAC,EAAE,EACf,IAAI,CAAC,IAAI,EACT,CAAC,WAAW,CAAC,CACd,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,8CAA8C,QAAQ,CAAC,EAAE,EAAE,CAC5D,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAC3D,QAAQ,EACR,IAAI,CAAC,OAAO,CACb,CAAC;QACF,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,KAAK,qBAAa,CAAC,SAAS,EAAE,CAAC;YACxD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;YAEtD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACvC,eAAe,EAAE,QAAQ,CAAC,EAAE;gBAC5B,SAAS,EAAE,WAAW;gBACtB,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM;aACC,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF,CAAA;AAvCY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;qCAKyB,6BAAe;QACV,yCAAoB;QAC5B,6BAAa;GANnC,+BAA+B,CAuC3C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ToolResult } from '@loopstack/common';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Logger } from '@nestjs/common';
|
|
4
|
+
import { CreatePipelineService, ToolBase, WorkflowExecution } from '../workflow-processor';
|
|
5
|
+
import { TaskSchedulerService } from '../scheduler';
|
|
6
|
+
import { EventSubscriberService } from '../persistence/services/event-subscriber.service';
|
|
7
|
+
declare const ExecuteWorkflowAsyncArgsSchema: z.ZodObject<{
|
|
8
|
+
workflow: z.ZodString;
|
|
9
|
+
args: z.ZodOptional<z.ZodAny>;
|
|
10
|
+
callback: z.ZodObject<{
|
|
11
|
+
transition: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
transition: string;
|
|
14
|
+
}, {
|
|
15
|
+
transition: string;
|
|
16
|
+
}>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
workflow: string;
|
|
19
|
+
callback: {
|
|
20
|
+
transition: string;
|
|
21
|
+
};
|
|
22
|
+
args?: any;
|
|
23
|
+
}, {
|
|
24
|
+
workflow: string;
|
|
25
|
+
callback: {
|
|
26
|
+
transition: string;
|
|
27
|
+
};
|
|
28
|
+
args?: any;
|
|
29
|
+
}>;
|
|
30
|
+
type ExecuteWorkflowAsyncArgs = z.infer<typeof ExecuteWorkflowAsyncArgsSchema>;
|
|
31
|
+
export declare class ExecuteWorkflowAsync extends ToolBase<ExecuteWorkflowAsyncArgs> {
|
|
32
|
+
private readonly createPipelineService;
|
|
33
|
+
private readonly taskSchedulerService;
|
|
34
|
+
private readonly eventSubscriberService;
|
|
35
|
+
protected readonly logger: Logger;
|
|
36
|
+
constructor(createPipelineService: CreatePipelineService, taskSchedulerService: TaskSchedulerService, eventSubscriberService: EventSubscriberService);
|
|
37
|
+
execute(args: ExecuteWorkflowAsyncArgs, ctx: WorkflowExecution): Promise<ToolResult>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var ExecuteWorkflowAsync_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ExecuteWorkflowAsync = void 0;
|
|
14
|
+
const common_1 = require("@loopstack/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@nestjs/common");
|
|
17
|
+
const workflow_processor_1 = require("../workflow-processor");
|
|
18
|
+
const scheduler_1 = require("../scheduler");
|
|
19
|
+
const event_subscriber_service_1 = require("../persistence/services/event-subscriber.service");
|
|
20
|
+
const node_crypto_1 = require("node:crypto");
|
|
21
|
+
const ExecuteWorkflowAsyncArgsSchema = zod_1.z.object({
|
|
22
|
+
workflow: zod_1.z.string(),
|
|
23
|
+
args: zod_1.z.any().optional(),
|
|
24
|
+
callback: zod_1.z.object({
|
|
25
|
+
transition: zod_1.z.string(),
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
let ExecuteWorkflowAsync = ExecuteWorkflowAsync_1 = class ExecuteWorkflowAsync extends workflow_processor_1.ToolBase {
|
|
29
|
+
createPipelineService;
|
|
30
|
+
taskSchedulerService;
|
|
31
|
+
eventSubscriberService;
|
|
32
|
+
logger = new common_2.Logger(ExecuteWorkflowAsync_1.name);
|
|
33
|
+
constructor(createPipelineService, taskSchedulerService, eventSubscriberService) {
|
|
34
|
+
super();
|
|
35
|
+
this.createPipelineService = createPipelineService;
|
|
36
|
+
this.taskSchedulerService = taskSchedulerService;
|
|
37
|
+
this.eventSubscriberService = eventSubscriberService;
|
|
38
|
+
}
|
|
39
|
+
async execute(args, ctx) {
|
|
40
|
+
const pipeline = await this.createPipelineService.create({
|
|
41
|
+
id: ctx.context.workspaceId,
|
|
42
|
+
}, {
|
|
43
|
+
blockName: args.workflow,
|
|
44
|
+
workspaceId: ctx.context.workspaceId,
|
|
45
|
+
args: {
|
|
46
|
+
...args.args,
|
|
47
|
+
},
|
|
48
|
+
}, ctx.context.userId);
|
|
49
|
+
await this.eventSubscriberService.registerSubscriber(ctx.context.pipelineId, ctx.entity.id, args.callback.transition, pipeline.id, 'completed', ctx.context.userId, ctx.context.workspaceId);
|
|
50
|
+
const job = await this.taskSchedulerService.addTask({
|
|
51
|
+
id: 'sub_pipeline_execution-' + (0, node_crypto_1.randomUUID)(),
|
|
52
|
+
task: {
|
|
53
|
+
name: 'manual_execution',
|
|
54
|
+
type: 'run_pipeline',
|
|
55
|
+
payload: {
|
|
56
|
+
id: pipeline.id,
|
|
57
|
+
},
|
|
58
|
+
user: pipeline.createdBy,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
data: {
|
|
63
|
+
id: job?.id,
|
|
64
|
+
data: job?.data,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.ExecuteWorkflowAsync = ExecuteWorkflowAsync;
|
|
70
|
+
exports.ExecuteWorkflowAsync = ExecuteWorkflowAsync = ExecuteWorkflowAsync_1 = __decorate([
|
|
71
|
+
(0, common_2.Injectable)(),
|
|
72
|
+
(0, common_1.BlockConfig)({
|
|
73
|
+
config: {
|
|
74
|
+
description: '',
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
(0, common_1.WithArguments)(ExecuteWorkflowAsyncArgsSchema.strict()),
|
|
78
|
+
__metadata("design:paramtypes", [workflow_processor_1.CreatePipelineService,
|
|
79
|
+
scheduler_1.TaskSchedulerService,
|
|
80
|
+
event_subscriber_service_1.EventSubscriberService])
|
|
81
|
+
], ExecuteWorkflowAsync);
|
|
82
|
+
//# sourceMappingURL=execute-workflow-async.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-workflow-async.tool.js","sourceRoot":"","sources":["../../src/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AAG,CAAC,MAAM,CAAC,EAAE,EACb,IAAI,CAAC,QAAQ,CAAC,UAAU,EACxB,QAAQ,CAAC,EAAE,EACX,WAAW,EACX,GAAG,CAAC,OAAO,CAAC,MAAM,EAClB,GAAG,CAAC,OAAO,CAAC,WAAW,CACxB,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YAClD,EAAE,EAAE,yBAAyB,GAAG,IAAA,wBAAU,GAAE;YAC5C,IAAI,EAAE;gBACJ,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE;oBACP,EAAE,EAAE,QAAQ,CAAC,EAAE;iBAChB;gBACD,IAAI,EAAE,QAAQ,CAAC,SAAS;aACzB;SACsB,CAAC,CAAC;QAE3B,OAAO;YACL,IAAI,EAAE;gBACJ,EAAE,EAAE,GAAG,EAAE,EAAE;gBACX,IAAI,EAAE,GAAG,EAAE,IAAI;aAChB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1DY,oDAAoB;+BAApB,oBAAoB;IAPhC,IAAA,mBAAU,GAAE;IACZ,IAAA,oBAAW,EAAC;QACX,MAAM,EAAE;YACN,WAAW,EAAE,EAAE;SAChB;KACF,CAAC;IACD,IAAA,sBAAa,EAAC,8BAA8B,CAAC,MAAM,EAAE,CAAC;qCAKX,0CAAqB;QACtB,gCAAoB;QAClB,iDAAsB;GANtD,oBAAoB,CA0DhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './execute-workflow-async.tool';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./execute-workflow-async.tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C"}
|
|
@@ -14,6 +14,7 @@ export declare abstract class Block<TArgs extends object = any> implements Block
|
|
|
14
14
|
static readonly blockHelpers: string[];
|
|
15
15
|
static readonly argsSchema: z.ZodType | undefined;
|
|
16
16
|
static readonly stateSchema: z.ZodType | undefined;
|
|
17
|
+
static readonly resultSchema: z.ZodType | undefined;
|
|
17
18
|
get name(): string;
|
|
18
19
|
get config(): BlockConfigType;
|
|
19
20
|
get tools(): string[];
|
|
@@ -22,6 +23,7 @@ export declare abstract class Block<TArgs extends object = any> implements Block
|
|
|
22
23
|
get helpers(): string[];
|
|
23
24
|
get argsSchema(): z.ZodType | undefined;
|
|
24
25
|
get stateSchema(): z.ZodType | undefined;
|
|
26
|
+
get resultSchema(): z.ZodType | undefined;
|
|
25
27
|
getTemplateVars(args: any, ctx: WorkflowExecution): {
|
|
26
28
|
metadata: Readonly<import("../interfaces").WorkflowMetadataInterface>;
|
|
27
29
|
transition: import("../../common").WorkflowTransitionDto | undefined;
|
|
@@ -10,6 +10,7 @@ class Block {
|
|
|
10
10
|
static blockHelpers;
|
|
11
11
|
static argsSchema;
|
|
12
12
|
static stateSchema;
|
|
13
|
+
static resultSchema;
|
|
13
14
|
get name() {
|
|
14
15
|
return this.constructor.name;
|
|
15
16
|
}
|
|
@@ -34,6 +35,9 @@ class Block {
|
|
|
34
35
|
get stateSchema() {
|
|
35
36
|
return this.constructor.stateSchema;
|
|
36
37
|
}
|
|
38
|
+
get resultSchema() {
|
|
39
|
+
return this.constructor.resultSchema;
|
|
40
|
+
}
|
|
37
41
|
getTemplateVars(args, ctx) {
|
|
38
42
|
return {
|
|
39
43
|
...ctx.state.getAll(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.abstract.js","sourceRoot":"","sources":["../../../src/workflow-processor/abstract/block.abstract.ts"],"names":[],"mappings":";;;AAUA,MAAsB,KAAK;IAElB,IAAI,GAAW,WAAW,CAAC;IAElC,MAAM,CAAU,WAAW,CAAkB;IAE7C,MAAM,CAAU,UAAU,CAAW;IAErC,MAAM,CAAU,cAAc,CAAW;IAEzC,MAAM,CAAU,cAAc,CAAW;IAEzC,MAAM,CAAU,YAAY,CAAW;IAEvC,MAAM,CAAU,UAAU,CAAwB;IAElD,MAAM,CAAU,WAAW,CAAwB;IAEnD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM;QACR,OAAQ,IAAI,CAAC,WAA4B,CAAC,WAAW,CAAC;IACxD,CAAC;IAED,IAAI,KAAK;QACP,OAAQ,IAAI,CAAC,WAA4B,CAAC,UAAU,IAAI,EAAE,CAAC;IAC7D,CAAC;IAED,IAAI,SAAS;QACX,OAAQ,IAAI,CAAC,WAA4B,CAAC,cAAc,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,IAAI,SAAS;QACX,OAAQ,IAAI,CAAC,WAA4B,CAAC,cAAc,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,IAAI,OAAO;QACT,OAAQ,IAAI,CAAC,WAA4B,CAAC,YAAY,IAAI,EAAE,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,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"block.abstract.js","sourceRoot":"","sources":["../../../src/workflow-processor/abstract/block.abstract.ts"],"names":[],"mappings":";;;AAUA,MAAsB,KAAK;IAElB,IAAI,GAAW,WAAW,CAAC;IAElC,MAAM,CAAU,WAAW,CAAkB;IAE7C,MAAM,CAAU,UAAU,CAAW;IAErC,MAAM,CAAU,cAAc,CAAW;IAEzC,MAAM,CAAU,cAAc,CAAW;IAEzC,MAAM,CAAU,YAAY,CAAW;IAEvC,MAAM,CAAU,UAAU,CAAwB;IAElD,MAAM,CAAU,WAAW,CAAwB;IAEnD,MAAM,CAAU,YAAY,CAAwB;IAEpD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM;QACR,OAAQ,IAAI,CAAC,WAA4B,CAAC,WAAW,CAAC;IACxD,CAAC;IAED,IAAI,KAAK;QACP,OAAQ,IAAI,CAAC,WAA4B,CAAC,UAAU,IAAI,EAAE,CAAC;IAC7D,CAAC;IAED,IAAI,SAAS;QACX,OAAQ,IAAI,CAAC,WAA4B,CAAC,cAAc,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,IAAI,SAAS;QACX,OAAQ,IAAI,CAAC,WAA4B,CAAC,cAAc,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,IAAI,OAAO;QACT,OAAQ,IAAI,CAAC,WAA4B,CAAC,YAAY,IAAI,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,UAAU;QACZ,OAAQ,IAAI,CAAC,WAA4B,CAAC,UAAU,CAAC;IACvD,CAAC;IAED,IAAI,WAAW;QACb,OAAQ,IAAI,CAAC,WAA4B,CAAC,WAAW,CAAC;IACxD,CAAC;IAED,IAAI,YAAY;QACd,OAAQ,IAAI,CAAC,WAA4B,CAAC,YAAY,CAAC;IACzD,CAAC;IAEM,eAAe,CAAC,IAA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interfaces';
|
|
3
3
|
import { Block } from './block.abstract';
|
|
4
4
|
export declare abstract class ToolBase<TArgs extends object = any> extends Block {
|
|
5
5
|
type: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { BlockInterface } from '../../common';
|
|
2
2
|
import { Block } from './block.abstract';
|
|
3
3
|
import { WorkflowType } from '@loopstack/contracts/types';
|
|
4
|
+
import { WorkflowExecution } from '../interfaces';
|
|
4
5
|
export declare abstract class WorkflowBase extends Block implements BlockInterface {
|
|
5
6
|
type: string;
|
|
6
7
|
getConfig(): WorkflowType;
|
|
8
|
+
getResult(ctx: WorkflowExecution): any;
|
|
7
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-base.abstract.js","sourceRoot":"","sources":["../../../src/workflow-processor/abstract/workflow-base.abstract.ts"],"names":[],"mappings":";;;AAGA,qDAAyC;
|
|
1
|
+
{"version":3,"file":"workflow-base.abstract.js","sourceRoot":"","sources":["../../../src/workflow-processor/abstract/workflow-base.abstract.ts"],"names":[],"mappings":";;;AAGA,qDAAyC;AAIzC,MAAsB,YAAa,SAAQ,sBAAK;IACvC,IAAI,GAAW,UAAU,CAAC;IAEjC,SAAS;QACP,OAAO,IAAI,CAAC,MAAsB,CAAC;IACrC,CAAC;IAED,SAAS,CAAC,GAAsB,IAAQ,CAAC;CAC1C;AARD,oCAQC"}
|
|
@@ -76,6 +76,7 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
76
76
|
...(ctx.entity?.hashRecord ?? {}),
|
|
77
77
|
...validation.hashRecordUpdates,
|
|
78
78
|
};
|
|
79
|
+
ctx.entity.result = null;
|
|
79
80
|
if (ctx.state.getMetadata('place') !== 'start') {
|
|
80
81
|
ctx.state.setMetadata('place', 'start');
|
|
81
82
|
ctx.state.setMetadata('transition', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-processor.service.js","sourceRoot":"","sources":["../../../../src/workflow-processor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CAAC,MAAM,GAAG,qBAAiB,CAAC,OAAO,CAAC;QAE9C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG;gBACtB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE,CAAC;gBACjC,GAAG,UAAU,CAAC,iBAAiB;aAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-processor.service.js","sourceRoot":"","sources":["../../../../src/workflow-processor/services/processors/workflow-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAKpD,sDAAgF;AAChF,sEAAiE;AACjE,wFAAkF;AAClF,wFAAkF;AAElF,4DAAwD;AACxD,6BAAwB;AACxB,gFAA2E;AAC3E,oEAAgE;AAIzD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAIhB;IACA;IACA;IALF,MAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAEpE,YACmB,oBAA0C,EAC1C,4BAA0D,EAC1D,4BAA0D;QAF1D,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,iCAA4B,GAA5B,4BAA4B,CAA8B;QAC1D,iCAA4B,GAA5B,4BAA4B,CAA8B;IAC1E,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,QAAsB,EAAE,IAAS,EAAE,OAAiC;QAChF,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE1C,MAAM,cAAc,GAClB,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtE,OAAO,CAAC,UAAU,GAAG,cAAc,CAAC,EAAE,CAAC;QAEvC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,OAAC,CAAC,MAAM,CAAC,EAAE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1 = class StateM
|
|
|
137
137
|
}
|
|
138
138
|
else if (ctx.state.getMetadata('place') === 'end') {
|
|
139
139
|
ctx.entity.status = enums_1.WorkflowState.Completed;
|
|
140
|
+
if (block.resultSchema) {
|
|
141
|
+
const result = block.getResult(ctx);
|
|
142
|
+
ctx.entity.result = block.resultSchema.parse(result);
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
145
|
else {
|
|
142
146
|
ctx.entity.status = enums_1.WorkflowState.Waiting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-machine-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AASpD,sDAA2D;AAE3D,mCAAoC;AACpC,6BAAwB;AAExB,2GAAmG;AACnG,yCAIsB;AAEtB,qEAAgE;AAChE,0DAAwE;
|
|
1
|
+
{"version":3,"file":"state-machine-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AASpD,sDAA2D;AAE3D,mCAAoC;AACpC,6BAAwB;AAExB,2GAAmG;AACnG,yCAIsB;AAEtB,qEAAgE;AAChE,0DAAwE;AAIjE,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAIpB;IACA;IACA;IALF,MAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC,IAAI,CAAC,CAAC;IAExE,YACmB,oBAA0C,EAC1C,kCAAsE,EACtE,oCAA0E;QAF1E,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,uCAAkC,GAAlC,kCAAkC,CAAoC;QACtE,yCAAoC,GAApC,oCAAoC,CAAsC;IAC1F,CAAC;IAEJ,uBAAuB,CAAC,KAAmB,EAAE,IAAS,EAAE,GAAsB;QAC5E,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,6CAA6C,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,OA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G,CAAC,MAAM,CAAC,MAAM,GAAG,qBAAa,CAAC,SAAS,CAAC;YAC5C,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;gBACvB,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACpC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,qBAAa,CAAC,OAAO,CAAC;YAC1C,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAC1B,CAAC;QAED,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;IACb,CAAC;CAGF,CAAA;AA9NY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;qCAK8B,6CAAoB;QACN,2CAAkC;QAChC,gFAAoC;GANlF,4BAA4B,CA8NxC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentEntity, ToolResult } from '@loopstack/common';
|
|
2
2
|
import { AssignmentConfigType, ToolCallType } from '@loopstack/contracts/types';
|
|
3
3
|
import { WorkflowBase } from '../abstract';
|
|
4
|
-
import { TemplateExpressionEvaluatorService } from '../../common';
|
|
4
|
+
import { BlockInterface, TemplateExpressionEvaluatorService } from '../../common';
|
|
5
5
|
import { WorkflowExecution } from '../interfaces';
|
|
6
6
|
export declare class StateMachineToolCallProcessorService {
|
|
7
7
|
private readonly templateExpressionEvaluatorService;
|
|
@@ -11,5 +11,5 @@ export declare class StateMachineToolCallProcessorService {
|
|
|
11
11
|
addDocuments(ctx: WorkflowExecution, documents: DocumentEntity[]): void;
|
|
12
12
|
updateDocument(ctx: WorkflowExecution, index: number, document: DocumentEntity): void;
|
|
13
13
|
addDocument(ctx: WorkflowExecution, document: DocumentEntity): void;
|
|
14
|
-
assignToTargetBlock(assign: AssignmentConfigType | undefined, ctx: WorkflowExecution, result: ToolResult): void;
|
|
14
|
+
assignToTargetBlock(block: BlockInterface, assign: AssignmentConfigType | undefined, ctx: WorkflowExecution, result: ToolResult): void;
|
|
15
15
|
}
|
|
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.StateMachineToolCallProcessorService = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const common_2 = require("../../common");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const schemas_1 = require("@loopstack/contracts/schemas");
|
|
16
18
|
let StateMachineToolCallProcessorService = StateMachineToolCallProcessorService_1 = class StateMachineToolCallProcessorService {
|
|
17
19
|
templateExpressionEvaluatorService;
|
|
18
20
|
logger = new common_1.Logger(StateMachineToolCallProcessorService_1.name);
|
|
@@ -45,7 +47,7 @@ let StateMachineToolCallProcessorService = StateMachineToolCallProcessorService_
|
|
|
45
47
|
});
|
|
46
48
|
const parsedArgs = tool.validate(evaluatedArgs);
|
|
47
49
|
const toolCallResult = await tool.execute(parsedArgs, ctx, block);
|
|
48
|
-
this.assignToTargetBlock(toolCall.assign, ctx, toolCallResult);
|
|
50
|
+
this.assignToTargetBlock(block, toolCall.assign, ctx, toolCallResult);
|
|
49
51
|
if (toolCall.id) {
|
|
50
52
|
toolResults[toolCall.id] = toolCallResult;
|
|
51
53
|
}
|
|
@@ -117,12 +119,20 @@ let StateMachineToolCallProcessorService = StateMachineToolCallProcessorService_
|
|
|
117
119
|
ctx.state.setMetadata('documents', documents);
|
|
118
120
|
ctx.runtime.persistenceState.documentsUpdated = true;
|
|
119
121
|
}
|
|
120
|
-
assignToTargetBlock(assign, ctx, result) {
|
|
122
|
+
assignToTargetBlock(block, assign, ctx, result) {
|
|
121
123
|
if (assign) {
|
|
124
|
+
const templateHelpers = block.helpers.map((name) => ({
|
|
125
|
+
name,
|
|
126
|
+
fn: block[name]
|
|
127
|
+
}));
|
|
122
128
|
const update = {};
|
|
123
129
|
for (const [key, value] of Object.entries(assign)) {
|
|
124
130
|
update[key] =
|
|
125
|
-
this.templateExpressionEvaluatorService.evaluateTemplateRaw(value, { result }
|
|
131
|
+
this.templateExpressionEvaluatorService.evaluateTemplateRaw(value, { result }, {
|
|
132
|
+
cacheKey: block.name,
|
|
133
|
+
helpers: templateHelpers,
|
|
134
|
+
schema: zod_1.z.array(schemas_1.WorkflowTransitionSchema)
|
|
135
|
+
});
|
|
126
136
|
}
|
|
127
137
|
ctx.state.update(update);
|
|
128
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-machine-tool-call-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAIpD,
|
|
1
|
+
{"version":3,"file":"state-machine-tool-call-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAIpD,yCAIsB;AAEtB,6BAAwB;AACxB,0DAAwE;AAGjE,IAAM,oCAAoC,4CAA1C,MAAM,oCAAoC;IAM5B;IALF,MAAM,GAAG,IAAI,eAAM,CAClC,sCAAoC,CAAC,IAAI,CAC1C,CAAC;IAEF,YACmB,kCAAsE;QAAtE,uCAAkC,GAAlC,kCAAkC,CAAoC;IACtF,CAAC;IAEJ,KAAK,CAAC,gBAAgB,CACpB,KAAmB,EACnB,SAAqC,EACrC,IAAS,EACT,GAAsB;QAEtB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,UAAW,CAAC;QAE3C,IAAI,OAAO,GAAsB,EAAE,CAAC;QACpC,IAAI,WAAW,GAAwB,EAAE,CAAC;QAE1C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,CA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3
3
|
"displayName": "Loopstack Core Module",
|
|
4
4
|
"description": "The core module of the loopstack automation framework",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.16.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jakob Klippel",
|
|
8
8
|
"url": "https://www.linkedin.com/in/jakob-klippel//"
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "nest build",
|
|
19
19
|
"watch": "nest build --watch",
|
|
20
|
-
"prepare": "npm run build",
|
|
21
20
|
"compile": "tsc --noEmit",
|
|
22
21
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
23
22
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"typeorm": "^0.3.20"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@loopstack/common": "^0.
|
|
39
|
+
"@loopstack/common": "^0.16.0",
|
|
41
40
|
"@nestjs/bullmq": "^11.0.3",
|
|
42
41
|
"@nestjs/config": "^4.0.0",
|
|
43
42
|
"@nestjs/event-emitter": "^3.0.1",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=document.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../../src/persistence/services/__backup__/document.service.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=dynamic-repository.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-repository.service.js","sourceRoot":"","sources":["../../../../src/persistence/services/__backup__/dynamic-repository.service.ts"],"names":[],"mappings":""}
|