@loopstack/core 0.1.2 → 0.3.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/CHANGELOG.md +22 -0
- package/dist/modules/common/common.module.js +9 -15
- package/dist/modules/common/common.module.js.map +1 -1
- package/dist/modules/common/errors/object-expression.error.d.ts +4 -0
- package/dist/modules/common/errors/object-expression.error.js +13 -0
- package/dist/modules/common/errors/object-expression.error.js.map +1 -0
- package/dist/modules/common/errors/template-expression.error.d.ts +4 -0
- package/dist/modules/common/errors/template-expression.error.js +13 -0
- package/dist/modules/common/errors/template-expression.error.js.map +1 -0
- package/dist/modules/common/services/context.service.d.ts +1 -0
- package/dist/modules/common/services/context.service.js +4 -0
- package/dist/modules/common/services/context.service.js.map +1 -1
- package/dist/modules/common/services/expression-handler/object-expression.handler.d.ts +20 -0
- package/dist/modules/common/services/expression-handler/object-expression.handler.js +125 -0
- package/dist/modules/common/services/expression-handler/object-expression.handler.js.map +1 -0
- package/dist/modules/common/services/expression-handler/template-expression.handler.d.ts +12 -0
- package/dist/modules/common/services/expression-handler/template-expression.handler.js +63 -0
- package/dist/modules/common/services/expression-handler/template-expression.handler.js.map +1 -0
- package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.d.ts +9 -0
- package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.js +124 -0
- package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.js.map +1 -0
- package/dist/modules/common/services/handlebars-helpers/index.d.ts +1 -0
- package/dist/modules/common/services/handlebars-helpers/index.js +18 -0
- package/dist/modules/common/services/handlebars-helpers/index.js.map +1 -0
- package/dist/modules/common/services/handlebars-processor.service.d.ts +12 -0
- package/dist/modules/common/services/handlebars-processor.service.js +70 -0
- package/dist/modules/common/services/handlebars-processor.service.js.map +1 -0
- package/dist/modules/common/services/index.d.ts +6 -5
- package/dist/modules/common/services/index.js +6 -5
- package/dist/modules/common/services/index.js.map +1 -1
- package/dist/modules/common/services/template.service.d.ts +16 -0
- package/dist/modules/common/services/template.service.js +64 -0
- package/dist/modules/common/services/template.service.js.map +1 -0
- package/dist/modules/common/services/variable-sanitizer.service.d.ts +9 -0
- package/dist/modules/common/services/variable-sanitizer.service.js +84 -0
- package/dist/modules/common/services/variable-sanitizer.service.js.map +1 -0
- package/dist/modules/configuration/configuration.module.js +2 -1
- package/dist/modules/configuration/configuration.module.js.map +1 -1
- package/dist/modules/configuration/services/configuration.service.d.ts +15 -14
- package/dist/modules/configuration/services/configuration.service.js +97 -107
- package/dist/modules/configuration/services/configuration.service.js.map +1 -1
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js +3 -1
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js.map +1 -1
- package/dist/modules/configuration/services/index.d.ts +1 -0
- package/dist/modules/configuration/services/index.js +1 -0
- package/dist/modules/configuration/services/index.js.map +1 -1
- package/dist/modules/configuration/services/schema-registry.service.d.ts +9 -0
- package/dist/modules/configuration/services/schema-registry.service.js +41 -0
- package/dist/modules/configuration/services/schema-registry.service.js.map +1 -0
- package/dist/modules/configuration/services/service-registry.service.js +1 -1
- package/dist/modules/configuration/services/service-registry.service.js.map +1 -1
- package/dist/modules/persistence/services/document.service.d.ts +6 -2
- package/dist/modules/persistence/services/document.service.js +29 -17
- package/dist/modules/persistence/services/document.service.js.map +1 -1
- package/dist/modules/persistence/services/namespace.service.js.map +1 -1
- package/dist/modules/persistence/services/workflow.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/index.d.ts +4 -1
- package/dist/modules/workflow-processor/services/index.js +4 -1
- package/dist/modules/workflow-processor/services/index.js.map +1 -1
- package/dist/modules/workflow-processor/services/pipeline-processor.service.d.ts +15 -8
- package/dist/modules/workflow-processor/services/pipeline-processor.service.js +163 -29
- package/dist/modules/workflow-processor/services/pipeline-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/root-processor.service.d.ts +12 -0
- package/dist/modules/workflow-processor/services/root-processor.service.js +49 -0
- package/dist/modules/workflow-processor/services/root-processor.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/service-execution.service.d.ts +12 -0
- package/dist/modules/workflow-processor/services/service-execution.service.js +53 -0
- package/dist/modules/workflow-processor/services/service-execution.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/state-machine-config.service.d.ts +2 -17
- package/dist/modules/workflow-processor/services/state-machine-config.service.js +33 -17
- package/dist/modules/workflow-processor/services/state-machine-config.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/state-machine-processor.service.d.ts +11 -7
- package/dist/modules/workflow-processor/services/state-machine-processor.service.js +95 -30
- package/dist/modules/workflow-processor/services/state-machine-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/template-expression-evaluator.service.d.ts +24 -4
- package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js +90 -21
- package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/tool-execution.service.d.ts +8 -20
- package/dist/modules/workflow-processor/services/tool-execution.service.js +31 -55
- package/dist/modules/workflow-processor/services/tool-execution.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/workflow-context.service.d.ts +4 -0
- package/dist/modules/{common/services/template-engine.service.js → workflow-processor/services/workflow-context.service.js} +12 -15
- package/dist/modules/workflow-processor/services/workflow-context.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/workflow-processor.service.d.ts +5 -26
- package/dist/modules/workflow-processor/services/workflow-processor.service.js +18 -184
- package/dist/modules/workflow-processor/services/workflow-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/workflow-state.service.d.ts +8 -0
- package/dist/modules/workflow-processor/services/workflow-state.service.js +49 -0
- package/dist/modules/workflow-processor/services/workflow-state.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/add-namespace.service.js +4 -4
- package/dist/modules/workflow-processor/tool-services/add-namespace.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.d.ts +6 -10
- package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.js +39 -27
- package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/create-document.service.d.ts +7 -142
- package/dist/modules/workflow-processor/tool-services/create-document.service.js +91 -35
- package/dist/modules/workflow-processor/tool-services/create-document.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/load-document.service.d.ts +26 -51
- package/dist/modules/workflow-processor/tool-services/load-document.service.js +59 -81
- package/dist/modules/workflow-processor/tool-services/load-document.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/mock.service.d.ts +11 -8
- package/dist/modules/workflow-processor/tool-services/mock.service.js +41 -9
- package/dist/modules/workflow-processor/tool-services/mock.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/set-context.service.d.ts +3 -0
- package/dist/modules/workflow-processor/tool-services/set-context.service.js +11 -5
- package/dist/modules/workflow-processor/tool-services/set-context.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.d.ts +1 -1
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.js +6 -5
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/transition-selector.service.js +2 -2
- package/dist/modules/workflow-processor/tool-services/transition-selector.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/update-document.service.d.ts +32 -62
- package/dist/modules/workflow-processor/tool-services/update-document.service.js +92 -7
- package/dist/modules/workflow-processor/tool-services/update-document.service.js.map +1 -1
- package/dist/modules/workflow-processor/validators/workflow-option.validator.d.ts +1 -1
- package/dist/modules/workflow-processor/validators/workflow-option.validator.js +3 -3
- package/dist/modules/workflow-processor/validators/workflow-option.validator.js.map +1 -1
- package/dist/modules/workflow-processor/workflow-processor.module.js +9 -2
- package/dist/modules/workflow-processor/workflow-processor.module.js.map +1 -1
- package/dist/utils/load-configuration.js +5 -3
- package/dist/utils/load-configuration.js.map +1 -1
- package/package.json +5 -3
- package/dist/modules/common/services/document-helper.service.d.ts +0 -212
- package/dist/modules/common/services/document-helper.service.js +0 -53
- package/dist/modules/common/services/document-helper.service.js.map +0 -1
- package/dist/modules/common/services/expression-evaluator.service.d.ts +0 -5
- package/dist/modules/common/services/expression-evaluator.service.js +0 -44
- package/dist/modules/common/services/expression-evaluator.service.js.map +0 -1
- package/dist/modules/common/services/schema-validator.service.d.ts +0 -7
- package/dist/modules/common/services/schema-validator.service.js +0 -41
- package/dist/modules/common/services/schema-validator.service.js.map +0 -1
- package/dist/modules/common/services/template-engine.service.d.ts +0 -5
- package/dist/modules/common/services/template-engine.service.js.map +0 -1
- package/dist/modules/common/services/value-parser.service.d.ts +0 -19
- package/dist/modules/common/services/value-parser.service.js +0 -68
- package/dist/modules/common/services/value-parser.service.js.map +0 -1
- package/dist/modules/configuration/commands/generate-schemas.command.d.ts +0 -8
- package/dist/modules/configuration/commands/generate-schemas.command.js +0 -34
- package/dist/modules/configuration/commands/generate-schemas.command.js.map +0 -1
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.d.ts +0 -5
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.js +0 -41
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.js.map +0 -1
|
@@ -8,83 +8,70 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
var LoadDocumentService_1;
|
|
15
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
13
|
exports.LoadDocumentService = void 0;
|
|
17
14
|
const common_1 = require("@nestjs/common");
|
|
18
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
19
15
|
const shared_1 = require("@loopstack/shared");
|
|
20
16
|
const zod_1 = require("zod");
|
|
21
|
-
const common_2 = require("../../common");
|
|
22
17
|
const persistence_1 = require("../../persistence");
|
|
23
18
|
const config = zod_1.z
|
|
24
19
|
.object({
|
|
25
|
-
where: persistence_1.WhereCondition,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
iteratees: zod_1.z.array(zod_1.z.string()),
|
|
32
|
-
orders: zod_1.z.array(zod_1.z.enum(['asc', 'desc'])),
|
|
33
|
-
})
|
|
20
|
+
where: zod_1.z.union([persistence_1.WhereCondition, shared_1.ExpressionString]),
|
|
21
|
+
orderBy: zod_1.z
|
|
22
|
+
.union([
|
|
23
|
+
zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal('ASC'), zod_1.z.literal('DESC')])),
|
|
24
|
+
shared_1.ExpressionString,
|
|
25
|
+
])
|
|
34
26
|
.optional(),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
getMany: zod_1.z.union([zod_1.z.boolean(), shared_1.ExpressionString]).optional(),
|
|
28
|
+
take: zod_1.z.union([zod_1.z.number(), shared_1.ExpressionString]).optional(),
|
|
29
|
+
skip: zod_1.z.union([zod_1.z.number(), shared_1.ExpressionString]).optional(),
|
|
30
|
+
isDependency: zod_1.z.union([zod_1.z.boolean(), shared_1.ExpressionString]).optional(),
|
|
31
|
+
isGlobal: zod_1.z.union([zod_1.z.boolean(), shared_1.ExpressionString]).optional(),
|
|
32
|
+
strictMode: zod_1.z.union([zod_1.z.boolean(), shared_1.ExpressionString]).optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
const schema = zod_1.z
|
|
36
|
+
.object({
|
|
37
|
+
where: persistence_1.WhereCondition,
|
|
38
|
+
orderBy: zod_1.z
|
|
39
|
+
.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal('ASC'), zod_1.z.literal('DESC')]))
|
|
40
|
+
.default({
|
|
41
|
+
workflow_index: 'DESC',
|
|
42
|
+
}),
|
|
43
|
+
getMany: zod_1.z.boolean().optional().default(false),
|
|
44
|
+
take: zod_1.z.number().default(100),
|
|
45
|
+
skip: zod_1.z.number().default(0),
|
|
46
|
+
isDependency: zod_1.z.boolean().default(true),
|
|
47
|
+
isGlobal: zod_1.z.boolean().default(false),
|
|
48
|
+
strictMode: zod_1.z.boolean().default(true),
|
|
40
49
|
})
|
|
41
50
|
.strict();
|
|
42
|
-
const schema = config;
|
|
43
51
|
let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
44
52
|
documentService;
|
|
45
53
|
workflowService;
|
|
46
|
-
functionCallService;
|
|
47
54
|
logger = new common_1.Logger(LoadDocumentService_1.name);
|
|
48
|
-
constructor(documentService, workflowService
|
|
55
|
+
constructor(documentService, workflowService) {
|
|
49
56
|
this.documentService = documentService;
|
|
50
57
|
this.workflowService = workflowService;
|
|
51
|
-
this.functionCallService = functionCallService;
|
|
52
|
-
}
|
|
53
|
-
applyFilters(props, items) {
|
|
54
|
-
if (props.filter) {
|
|
55
|
-
return items.filter((item) => this.functionCallService.evaluate(props.filter, { item }));
|
|
56
|
-
}
|
|
57
|
-
return items;
|
|
58
|
-
}
|
|
59
|
-
applyModifiers(props, entities) {
|
|
60
|
-
const defaultMapFunction = '${ entity.content }';
|
|
61
|
-
const mapFunc = props.map ?? defaultMapFunction;
|
|
62
|
-
let documents = entities.map((entity) => this.functionCallService.evaluate(mapFunc, { entity }));
|
|
63
|
-
if (props.flat) {
|
|
64
|
-
documents = documents.flat();
|
|
65
|
-
}
|
|
66
|
-
if (props.sortBy) {
|
|
67
|
-
documents = lodash_1.default.orderBy(documents, props.sortBy.iteratees, props.sortBy.orders);
|
|
68
|
-
}
|
|
69
|
-
if (props.sort) {
|
|
70
|
-
documents = documents.sort();
|
|
71
|
-
}
|
|
72
|
-
return documents;
|
|
73
58
|
}
|
|
74
59
|
async getDocumentsByQuery(props, pipelineId, workspaceId, workflow) {
|
|
75
60
|
const query = this.documentService.createDocumentsQuery(pipelineId, workspaceId, props.where, {
|
|
76
|
-
|
|
61
|
+
take: props.getMany ? props.take : undefined,
|
|
62
|
+
skip: props.getMany ? props.skip : undefined,
|
|
63
|
+
orderBy: props.orderBy,
|
|
64
|
+
isValidOnly: true,
|
|
65
|
+
isGlobal: !!props.isGlobal,
|
|
77
66
|
ltWorkflowIndex: workflow.index,
|
|
78
67
|
});
|
|
79
68
|
this.logger.debug(query.getQuery());
|
|
80
69
|
this.logger.debug(query.getParameters());
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
: [await query.getOne()].filter((d) => !!d);
|
|
84
|
-
if (!entities.length && !props.optional) {
|
|
70
|
+
const result = props.getMany ? await query.getMany() : await query.getOne();
|
|
71
|
+
if (!result && props.strictMode) {
|
|
85
72
|
throw new Error(`Document(s) not found.`);
|
|
86
73
|
}
|
|
87
|
-
return
|
|
74
|
+
return result;
|
|
88
75
|
}
|
|
89
76
|
updateWorkflowDependenciesHash(workflow) {
|
|
90
77
|
const hash = this.workflowService.createDependenciesHash(workflow);
|
|
@@ -93,43 +80,35 @@ let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
|
93
80
|
dependencies: hash,
|
|
94
81
|
};
|
|
95
82
|
}
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
trackDependencies(workflow, transitionData, result) {
|
|
84
|
+
const prevImport = workflow.prevData?.imports?.[transitionData.transition];
|
|
85
|
+
if (!workflow.dependencies) {
|
|
86
|
+
workflow.dependencies = [];
|
|
87
|
+
}
|
|
88
|
+
if (prevImport) {
|
|
89
|
+
workflow.dependencies = workflow.dependencies.filter((dep) => !prevImport?.ids.includes(dep.id));
|
|
90
|
+
}
|
|
91
|
+
const existingDependencyIds = workflow.dependencies.map((dep) => dep.id);
|
|
92
|
+
const dependencyList = Array.isArray(result) ? result : [result];
|
|
93
|
+
const newDependencies = dependencyList.filter((entity) => !existingDependencyIds.includes(entity.id));
|
|
94
|
+
if (newDependencies.length) {
|
|
95
|
+
workflow.dependencies.push(...newDependencies);
|
|
96
|
+
this.updateWorkflowDependenciesHash(workflow);
|
|
97
|
+
}
|
|
108
98
|
}
|
|
109
|
-
async apply(props, workflow, context,
|
|
99
|
+
async apply(props, workflow, context, transitionData) {
|
|
110
100
|
if (!workflow) {
|
|
111
101
|
throw new Error('Workflow is undefined');
|
|
112
102
|
}
|
|
113
|
-
this.logger.debug(`Load document ${
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (!workflow.dependencies) {
|
|
118
|
-
workflow.dependencies = [];
|
|
119
|
-
}
|
|
120
|
-
if (prevImport) {
|
|
121
|
-
workflow.dependencies = workflow.dependencies.filter((dep) => !prevImport?.ids.includes(dep.id));
|
|
122
|
-
}
|
|
123
|
-
const existingDependencyIds = workflow.dependencies.map((dep) => dep.id);
|
|
124
|
-
const newDependencies = currentEntities.filter((entity) => !existingDependencyIds.includes(entity.id));
|
|
125
|
-
workflow.dependencies.push(...newDependencies);
|
|
126
|
-
this.updateWorkflowDependenciesHash(workflow);
|
|
103
|
+
this.logger.debug(`Load document ${transitionData.transition}`);
|
|
104
|
+
const result = await this.getDocumentsByQuery(props, context.pipelineId, context.workspaceId, workflow);
|
|
105
|
+
if (result && props.isDependency) {
|
|
106
|
+
this.trackDependencies(workflow, transitionData, result);
|
|
127
107
|
}
|
|
128
|
-
const importItem = this.createImportItem(props, currentEntities, prevImport);
|
|
129
108
|
return {
|
|
130
109
|
success: true,
|
|
131
110
|
workflow,
|
|
132
|
-
data:
|
|
111
|
+
data: result,
|
|
133
112
|
};
|
|
134
113
|
}
|
|
135
114
|
};
|
|
@@ -141,7 +120,6 @@ exports.LoadDocumentService = LoadDocumentService = LoadDocumentService_1 = __de
|
|
|
141
120
|
schema,
|
|
142
121
|
}),
|
|
143
122
|
__metadata("design:paramtypes", [persistence_1.DocumentService,
|
|
144
|
-
persistence_1.WorkflowService
|
|
145
|
-
common_2.ExpressionEvaluatorService])
|
|
123
|
+
persistence_1.WorkflowService])
|
|
146
124
|
], LoadDocumentService);
|
|
147
125
|
//# sourceMappingURL=load-document.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-document.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/load-document.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-document.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/load-document.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAQ2B;AAC3B,6BAAwB;AAExB,mDAI2B;AAE3B,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,4BAAc,EAAE,yBAAgB,CAAC,CAAC;IAClD,OAAO,EAAE,OAAC;SACP,KAAK,CAAC;QACL,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACpE,yBAAgB;KACjB,CAAC;SACD,QAAQ,EAAE;IACb,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,EAAE,EAAE,yBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5D,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,yBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxD,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,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Q,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;YAC/C,IAAI,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAOD,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAoC,EACpC,OAAyB,EACzB,cAA2C;QAE3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC;QAGhE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAC3C,KAAK,EACL,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,WAAW,EACnB,QAAQ,CACT,CAAC;QAGF,IAAI,MAAM,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACjC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;CACF,CAAA;AAvHY,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK2B,6BAAe;QACf,6BAAe;GAL/B,mBAAmB,CAuH/B"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ServiceInterface, ServiceCallResult } from '@loopstack/shared';
|
|
2
|
+
import { ServiceInterface, ServiceCallResult, WorkflowEntity, ContextInterface, TransitionMetadataInterface } from '@loopstack/shared';
|
|
3
|
+
import { TemplateExpressionEvaluatorService } from '../services';
|
|
3
4
|
declare const schema: z.ZodObject<{
|
|
4
|
-
input: z.ZodOptional<z.
|
|
5
|
-
output: z.ZodOptional<z.
|
|
5
|
+
input: z.ZodOptional<z.ZodAny>;
|
|
6
|
+
output: z.ZodOptional<z.ZodAny>;
|
|
6
7
|
error: z.ZodOptional<z.ZodString>;
|
|
7
8
|
}, "strict", z.ZodTypeAny, {
|
|
8
9
|
error?: string | undefined;
|
|
9
|
-
input?:
|
|
10
|
-
output?:
|
|
10
|
+
input?: any;
|
|
11
|
+
output?: any;
|
|
11
12
|
}, {
|
|
12
13
|
error?: string | undefined;
|
|
13
|
-
input?:
|
|
14
|
-
output?:
|
|
14
|
+
input?: any;
|
|
15
|
+
output?: any;
|
|
15
16
|
}>;
|
|
16
17
|
export declare class MockService implements ServiceInterface {
|
|
18
|
+
private templateExpressionEvaluatorService;
|
|
17
19
|
private readonly logger;
|
|
18
|
-
|
|
20
|
+
constructor(templateExpressionEvaluatorService: TemplateExpressionEvaluatorService);
|
|
21
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity, context: ContextInterface, transitionData: TransitionMetadataInterface, parentArguments: any): Promise<ServiceCallResult>;
|
|
19
22
|
}
|
|
20
23
|
export {};
|
|
@@ -5,38 +5,69 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
11
|
var MockService_1;
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.MockService = void 0;
|
|
11
14
|
const common_1 = require("@nestjs/common");
|
|
12
15
|
const zod_1 = require("zod");
|
|
13
16
|
const shared_1 = require("@loopstack/shared");
|
|
17
|
+
const services_1 = require("../services");
|
|
14
18
|
const config = zod_1.z
|
|
15
19
|
.object({
|
|
16
|
-
input: zod_1.z.
|
|
17
|
-
output: zod_1.z.
|
|
20
|
+
input: zod_1.z.any().optional(),
|
|
21
|
+
output: zod_1.z.any().optional(),
|
|
18
22
|
error: zod_1.z.string().optional(),
|
|
19
23
|
})
|
|
20
24
|
.strict();
|
|
21
25
|
const schema = zod_1.z
|
|
22
26
|
.object({
|
|
23
|
-
input: zod_1.z.
|
|
24
|
-
output: zod_1.z.
|
|
27
|
+
input: zod_1.z.any().optional(),
|
|
28
|
+
output: zod_1.z.any().optional(),
|
|
25
29
|
error: zod_1.z.string().optional(),
|
|
26
30
|
})
|
|
27
31
|
.strict();
|
|
28
32
|
let MockService = MockService_1 = class MockService {
|
|
33
|
+
templateExpressionEvaluatorService;
|
|
29
34
|
logger = new common_1.Logger(MockService_1.name);
|
|
30
|
-
|
|
35
|
+
constructor(templateExpressionEvaluatorService) {
|
|
36
|
+
this.templateExpressionEvaluatorService = templateExpressionEvaluatorService;
|
|
37
|
+
}
|
|
38
|
+
async apply(props, workflow, context, transitionData, parentArguments) {
|
|
31
39
|
if (props.input) {
|
|
32
|
-
this.
|
|
40
|
+
const input = this.templateExpressionEvaluatorService.parse(props.input, {
|
|
41
|
+
arguments: parentArguments,
|
|
42
|
+
context,
|
|
43
|
+
workflow,
|
|
44
|
+
transition: transitionData,
|
|
45
|
+
});
|
|
46
|
+
this.logger.debug(`Received mock input:`);
|
|
47
|
+
this.logger.debug(props.input);
|
|
48
|
+
this.logger.debug(parentArguments);
|
|
49
|
+
this.logger.debug(input);
|
|
33
50
|
}
|
|
51
|
+
const output = props.output
|
|
52
|
+
? this.templateExpressionEvaluatorService.parse(props.output, {
|
|
53
|
+
arguments: parentArguments,
|
|
54
|
+
context,
|
|
55
|
+
workflow,
|
|
56
|
+
transition: transitionData,
|
|
57
|
+
})
|
|
58
|
+
: null;
|
|
34
59
|
if (props.error) {
|
|
35
|
-
|
|
60
|
+
const error = this.templateExpressionEvaluatorService.parse(props.error, {
|
|
61
|
+
arguments: parentArguments,
|
|
62
|
+
context,
|
|
63
|
+
workflow,
|
|
64
|
+
transition: transitionData,
|
|
65
|
+
});
|
|
66
|
+
throw new Error(error);
|
|
36
67
|
}
|
|
37
68
|
return {
|
|
38
69
|
success: true,
|
|
39
|
-
data:
|
|
70
|
+
data: output,
|
|
40
71
|
};
|
|
41
72
|
}
|
|
42
73
|
};
|
|
@@ -46,6 +77,7 @@ exports.MockService = MockService = MockService_1 = __decorate([
|
|
|
46
77
|
(0, shared_1.Service)({
|
|
47
78
|
config,
|
|
48
79
|
schema,
|
|
49
|
-
})
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:paramtypes", [services_1.TemplateExpressionEvaluatorService])
|
|
50
82
|
], MockService);
|
|
51
83
|
//# sourceMappingURL=mock.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/mock.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/mock.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAQ2B;AAC3B,0CAAiE;AAEjE,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzB,MAAM,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC1B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzB,MAAM,EAAE,OAAC,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AAC,KAAK,CACzD,KAAK,CAAC,KAAK,EACX;gBACE,SAAS,EAAE,eAAe;gBAC1B,OAAO;gBACP,QAAQ;gBACR,UAAU,EAAE,cAAc;aAC3B,CACF,CAAC;YAEF,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;CACF,CAAA;AA9DY,kCAAW;sBAAX,WAAW;IALvB,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK8C,6CAAkC;GAJrE,WAAW,CA8DvB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ServiceInterface, ServiceCallResult } from '@loopstack/shared';
|
|
3
3
|
import { WorkflowEntity } from '@loopstack/shared';
|
|
4
|
+
import { WorkflowContextService } from '../services';
|
|
4
5
|
declare const schema: z.ZodObject<{
|
|
5
6
|
key: z.ZodString;
|
|
6
7
|
value: z.ZodAny;
|
|
@@ -12,7 +13,9 @@ declare const schema: z.ZodObject<{
|
|
|
12
13
|
value?: any;
|
|
13
14
|
}>;
|
|
14
15
|
export declare class SetContextService implements ServiceInterface {
|
|
16
|
+
private readonly workflowContextService;
|
|
15
17
|
private readonly logger;
|
|
18
|
+
constructor(workflowContextService: WorkflowContextService);
|
|
16
19
|
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined): Promise<ServiceCallResult>;
|
|
17
20
|
}
|
|
18
21
|
export {};
|
|
@@ -5,12 +5,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
11
|
var SetContextService_1;
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.SetContextService = void 0;
|
|
11
14
|
const common_1 = require("@nestjs/common");
|
|
12
15
|
const zod_1 = require("zod");
|
|
13
16
|
const shared_1 = require("@loopstack/shared");
|
|
17
|
+
const services_1 = require("../services");
|
|
14
18
|
const config = zod_1.z
|
|
15
19
|
.object({
|
|
16
20
|
key: zod_1.z.string(),
|
|
@@ -24,15 +28,16 @@ const schema = zod_1.z
|
|
|
24
28
|
})
|
|
25
29
|
.strict();
|
|
26
30
|
let SetContextService = SetContextService_1 = class SetContextService {
|
|
31
|
+
workflowContextService;
|
|
27
32
|
logger = new common_1.Logger(SetContextService_1.name);
|
|
33
|
+
constructor(workflowContextService) {
|
|
34
|
+
this.workflowContextService = workflowContextService;
|
|
35
|
+
}
|
|
28
36
|
async apply(props, workflow) {
|
|
29
37
|
if (!workflow) {
|
|
30
38
|
throw new Error('Workflow is undefined');
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
workflow.contextUpdate = {};
|
|
34
|
-
}
|
|
35
|
-
workflow.contextUpdate[props.key] = props.value;
|
|
40
|
+
workflow = this.workflowContextService.setWorkflowContextUpdate(workflow, props.key, props.value);
|
|
36
41
|
this.logger.debug(`Set context update key "${props.key}".`);
|
|
37
42
|
return {
|
|
38
43
|
success: true,
|
|
@@ -46,6 +51,7 @@ exports.SetContextService = SetContextService = SetContextService_1 = __decorate
|
|
|
46
51
|
(0, shared_1.Service)({
|
|
47
52
|
config,
|
|
48
53
|
schema,
|
|
49
|
-
})
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:paramtypes", [services_1.WorkflowContextService])
|
|
50
56
|
], SetContextService);
|
|
51
57
|
//# sourceMappingURL=set-context.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-context.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/set-context.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-context.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/set-context.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAI2B;AAE3B,0CAAqD;AAErD,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,OAAC,CAAC,GAAG,EAAE;CACf,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,OAAC,CAAC,GAAG,EAAE;CACf,CAAC;KACD,MAAM,EAAE,CAAC;AAOL,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAIT;IAHF,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YACmB,sBAA8C;QAA9C,2BAAsB,GAAtB,sBAAsB,CAAwB;IAC9D,CAAC;IAEJ,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAoC;QAEpC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAC7D,QAAQ,EACR,KAAK,CAAC,GAAG,EACT,KAAK,CAAC,KAAK,CACZ,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5D,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;CACF,CAAA;AA5BY,8CAAiB;4BAAjB,iBAAiB;IAL7B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK2C,iCAAsB;GAJtD,iBAAiB,CA4B7B"}
|
|
@@ -9,6 +9,6 @@ declare const schema: z.ZodObject<{
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare class SetTargetPlaceService implements ServiceInterface {
|
|
11
11
|
private readonly logger;
|
|
12
|
-
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity, context: ContextInterface,
|
|
12
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity, context: ContextInterface, transitionData: TransitionMetadataInterface): Promise<ServiceCallResult>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -18,17 +18,18 @@ const config = zod_1.z
|
|
|
18
18
|
.strict();
|
|
19
19
|
const schema = zod_1.z
|
|
20
20
|
.object({
|
|
21
|
-
target:
|
|
21
|
+
target: zod_1.z.string(),
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
24
|
let SetTargetPlaceService = SetTargetPlaceService_1 = class SetTargetPlaceService {
|
|
25
25
|
logger = new common_1.Logger(SetTargetPlaceService_1.name);
|
|
26
|
-
async apply(props, workflow, context,
|
|
27
|
-
if (!
|
|
26
|
+
async apply(props, workflow, context, transitionData) {
|
|
27
|
+
if (!transitionData.transition) {
|
|
28
28
|
throw new Error('No transition available.');
|
|
29
29
|
}
|
|
30
|
-
if ((Array.isArray(
|
|
31
|
-
|
|
30
|
+
if ((Array.isArray(transitionData.to) &&
|
|
31
|
+
!transitionData.to.includes(props.target)) ||
|
|
32
|
+
(!Array.isArray(transitionData.to) && transitionData.to !== props.target)) {
|
|
32
33
|
throw new Error(`Transition to ${props.target} not allowed.`);
|
|
33
34
|
}
|
|
34
35
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-target-place.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/set-target-place.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"set-target-place.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/set-target-place.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAQ2B;AAE3B,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,MAAM,EAAE,yBAAgB;CACzB,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;CACnB,CAAC;KACD,MAAM,EAAE,CAAC;AAOL,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IACf,MAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEjE,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAwB,EACxB,OAAyB,EACzB,cAA2C;QAE3C,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YAC/B,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC5C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,EACzE,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,MAAM,eAAe,CAAC,CAAC;QAChE,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,sDAAqB;gCAArB,qBAAqB;IALjC,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;GACW,qBAAqB,CA0BjC"}
|
|
@@ -14,7 +14,7 @@ const shared_1 = require("@loopstack/shared");
|
|
|
14
14
|
const config = zod_1.z
|
|
15
15
|
.object({
|
|
16
16
|
transitions: zod_1.z.array(zod_1.z.object({
|
|
17
|
-
place:
|
|
17
|
+
place: zod_1.z.string(),
|
|
18
18
|
condition: shared_1.ExpressionString.optional(),
|
|
19
19
|
})),
|
|
20
20
|
})
|
|
@@ -22,7 +22,7 @@ const config = zod_1.z
|
|
|
22
22
|
const schema = zod_1.z
|
|
23
23
|
.object({
|
|
24
24
|
transitions: zod_1.z.array(zod_1.z.object({
|
|
25
|
-
place:
|
|
25
|
+
place: zod_1.z.string(),
|
|
26
26
|
condition: zod_1.z.union([zod_1.z.boolean(), zod_1.z.undefined()]),
|
|
27
27
|
})),
|
|
28
28
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-selector.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/transition-selector.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"transition-selector.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/transition-selector.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAK2B;AAE3B,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,KAAK,CAClB,OAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;QACjB,SAAS,EAAE,yBAAgB,CAAC,QAAQ,EAAE;KACvC,CAAC,CACH;CACF,CAAC;KACD,MAAM,EAAE,CAAC;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