@venturialstd/workflow 0.1.68 → 0.1.70
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/modules/session/services/save-context-by-key.service.d.ts +3 -1
- package/dist/modules/session/services/save-context-by-key.service.d.ts.map +1 -1
- package/dist/modules/session/services/save-context-by-key.service.js +18 -8
- package/dist/modules/session/services/save-context-by-key.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CacheService } from '@venturialstd/core';
|
|
2
|
+
import { WorkflowExecutionService } from '../../../services/workflow-execution.service';
|
|
2
3
|
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
3
4
|
export declare class SaveContextByKeyService implements IWorkflowActionService {
|
|
4
5
|
private readonly cacheService;
|
|
5
|
-
|
|
6
|
+
private readonly workflowExecutionService;
|
|
7
|
+
constructor(cacheService: CacheService, workflowExecutionService: WorkflowExecutionService);
|
|
6
8
|
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=save-context-by-key.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-context-by-key.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/session/services/save-context-by-key.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"save-context-by-key.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/session/services/save-context-by-key.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAW5E,qBACa,uBAAwB,YAAW,sBAAsB;IAElE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;gBADxB,YAAY,EAAE,YAAY,EAC1B,wBAAwB,EAAE,wBAAwB;IAG/D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAsCpC"}
|
|
@@ -12,10 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.SaveContextByKeyService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const core_1 = require("@venturialstd/core");
|
|
15
|
+
const workflow_execution_service_1 = require("../../../services/workflow-execution.service");
|
|
15
16
|
let SaveContextByKeyService = class SaveContextByKeyService {
|
|
16
17
|
cacheService;
|
|
17
|
-
|
|
18
|
+
workflowExecutionService;
|
|
19
|
+
constructor(cacheService, workflowExecutionService) {
|
|
18
20
|
this.cacheService = cacheService;
|
|
21
|
+
this.workflowExecutionService = workflowExecutionService;
|
|
19
22
|
}
|
|
20
23
|
async perform(inputs, context) {
|
|
21
24
|
const contextKey = inputs.contextKey;
|
|
@@ -23,19 +26,25 @@ let SaveContextByKeyService = class SaveContextByKeyService {
|
|
|
23
26
|
if (!contextKey) {
|
|
24
27
|
throw new Error('Context key is required');
|
|
25
28
|
}
|
|
29
|
+
if (!context.executionId) {
|
|
30
|
+
throw new Error('Execution ID is required in context');
|
|
31
|
+
}
|
|
32
|
+
const execution = await this.workflowExecutionService.findOne({
|
|
33
|
+
where: { id: context.executionId },
|
|
34
|
+
});
|
|
35
|
+
if (!execution) {
|
|
36
|
+
throw new Error(`Execution with ID "${context.executionId}" not found`);
|
|
37
|
+
}
|
|
26
38
|
const contextData = {
|
|
27
|
-
|
|
39
|
+
currentNodeId: execution.currentNodeId || '',
|
|
28
40
|
executionId: context.executionId,
|
|
29
|
-
|
|
30
|
-
context: context.context || {},
|
|
31
|
-
previousOutputs: context.previousOutputs || {},
|
|
32
|
-
savedAt: new Date().toISOString(),
|
|
41
|
+
data: context.previousOutputs || {},
|
|
33
42
|
};
|
|
34
43
|
await this.cacheService.set(contextKey, contextData, undefined, ttl);
|
|
35
44
|
return {
|
|
36
45
|
success: true,
|
|
37
46
|
contextKey,
|
|
38
|
-
savedAt:
|
|
47
|
+
savedAt: new Date().toISOString(),
|
|
39
48
|
message: `Context saved successfully with key "${contextKey}"`,
|
|
40
49
|
};
|
|
41
50
|
}
|
|
@@ -43,6 +52,7 @@ let SaveContextByKeyService = class SaveContextByKeyService {
|
|
|
43
52
|
exports.SaveContextByKeyService = SaveContextByKeyService;
|
|
44
53
|
exports.SaveContextByKeyService = SaveContextByKeyService = __decorate([
|
|
45
54
|
(0, common_1.Injectable)(),
|
|
46
|
-
__metadata("design:paramtypes", [core_1.CacheService
|
|
55
|
+
__metadata("design:paramtypes", [core_1.CacheService,
|
|
56
|
+
workflow_execution_service_1.WorkflowExecutionService])
|
|
47
57
|
], SaveContextByKeyService);
|
|
48
58
|
//# sourceMappingURL=save-context-by-key.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-context-by-key.service.js","sourceRoot":"","sources":["../../../../src/modules/session/services/save-context-by-key.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAkD;
|
|
1
|
+
{"version":3,"file":"save-context-by-key.service.js","sourceRoot":"","sources":["../../../../src/modules/session/services/save-context-by-key.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAkD;AAElD,6FAAwF;AAajF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEf;IACA;IAFnB,YACmB,YAA0B,EAC1B,wBAAkD;QADlD,iBAAY,GAAZ,YAAY,CAAc;QAC1B,6BAAwB,GAAxB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