@loopstack/core 0.0.5 → 0.1.1
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 +19 -0
- package/dist/config/core.yaml +1 -0
- package/dist/modules/common/services/context.service.d.ts +2 -2
- package/dist/modules/common/services/context.service.js +7 -7
- package/dist/modules/common/services/context.service.js.map +1 -1
- package/dist/modules/common/services/document-helper.service.d.ts +56 -32
- package/dist/modules/common/services/schema-validator.service.d.ts +2 -0
- package/dist/modules/common/services/schema-validator.service.js +14 -11
- package/dist/modules/common/services/schema-validator.service.js.map +1 -1
- package/dist/modules/common/services/value-parser.service.d.ts +2 -6
- package/dist/modules/common/services/value-parser.service.js +0 -3
- package/dist/modules/common/services/value-parser.service.js.map +1 -1
- package/dist/modules/configuration/commands/generate-schema.command.d.ts +8 -0
- package/dist/modules/configuration/commands/generate-schema.command.js +34 -0
- package/dist/modules/configuration/commands/generate-schema.command.js.map +1 -0
- package/dist/modules/configuration/commands/generate-schemas.command.js +1 -1
- package/dist/modules/configuration/commands/generate-schemas.command.js.map +1 -1
- package/dist/modules/configuration/configuration.module.js +4 -5
- package/dist/modules/configuration/configuration.module.js.map +1 -1
- package/dist/modules/configuration/services/configuration.service.d.ts +5 -7
- package/dist/modules/configuration/services/configuration.service.js +38 -44
- package/dist/modules/configuration/services/configuration.service.js.map +1 -1
- package/dist/modules/configuration/services/dynamic-schema-generator.service.d.ts +8 -8
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js +15 -18
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js.map +1 -1
- package/dist/modules/configuration/services/index.d.ts +1 -2
- package/dist/modules/configuration/services/index.js +1 -2
- package/dist/modules/configuration/services/index.js.map +1 -1
- package/dist/modules/configuration/services/service-registry.service.d.ts +20 -0
- package/dist/modules/configuration/services/{adapter-registry.service.js → service-registry.service.js} +31 -16
- package/dist/modules/configuration/services/service-registry.service.js.map +1 -0
- package/dist/modules/persistence/__tests__/database-entities-utils.d.ts +2 -2
- package/dist/modules/persistence/__tests__/database-entities-utils.js +5 -5
- package/dist/modules/persistence/__tests__/database-entities-utils.js.map +1 -1
- package/dist/modules/persistence/persistence.module.js +3 -3
- package/dist/modules/persistence/persistence.module.js.map +1 -1
- package/dist/modules/persistence/services/document.service.d.ts +3 -3
- package/dist/modules/persistence/services/document.service.js +6 -6
- package/dist/modules/persistence/services/document.service.js.map +1 -1
- package/dist/modules/persistence/services/index.d.ts +1 -1
- package/dist/modules/persistence/services/index.js +1 -1
- package/dist/modules/persistence/services/index.js.map +1 -1
- package/dist/modules/persistence/services/namespace.service.d.ts +2 -2
- package/dist/modules/persistence/services/namespace.service.js +9 -9
- package/dist/modules/persistence/services/namespace.service.js.map +1 -1
- package/dist/modules/persistence/services/pipeline.service.d.ts +8 -0
- package/dist/modules/persistence/services/{project.service.js → pipeline.service.js} +13 -13
- package/dist/modules/persistence/services/pipeline.service.js.map +1 -0
- package/dist/modules/persistence/services/workflow.service.d.ts +1 -0
- package/dist/modules/persistence/services/workflow.service.js +8 -1
- package/dist/modules/persistence/services/workflow.service.js.map +1 -1
- package/dist/modules/persistence/subscriber/workflow.subscriber.js +2 -2
- package/dist/modules/persistence/subscriber/workflow.subscriber.js.map +1 -1
- package/dist/modules/workflow-processor/services/index.d.ts +2 -1
- package/dist/modules/workflow-processor/services/index.js +2 -1
- package/dist/modules/workflow-processor/services/index.js.map +1 -1
- package/dist/modules/workflow-processor/services/namespace-processor.service.js +1 -1
- package/dist/modules/workflow-processor/services/namespace-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/pipeline-processor.service.d.ts +15 -0
- package/dist/modules/workflow-processor/services/{project-processor.service.js → pipeline-processor.service.js} +24 -24
- package/dist/modules/workflow-processor/services/pipeline-processor.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/state-machine-config.service.d.ts +8 -7
- package/dist/modules/workflow-processor/services/state-machine-config.service.js +0 -4
- 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 +3 -1
- package/dist/modules/workflow-processor/services/state-machine-processor.service.js +50 -40
- 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 +9 -0
- package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js +50 -0
- package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/tool-execution.service.d.ts +19 -12
- package/dist/modules/workflow-processor/services/tool-execution.service.js +39 -44
- package/dist/modules/workflow-processor/services/tool-execution.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.d.ts +2 -2
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.js +3 -3
- package/dist/modules/workflow-processor/services/tool-schema-validator.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/workflow-processor.service.js +10 -4
- package/dist/modules/workflow-processor/services/workflow-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/tool-services/add-namespace.service.d.ts +20 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/add-namespace.service.js +16 -13
- package/dist/modules/workflow-processor/tool-services/add-namespace.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.d.ts +33 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/batch-create-documents.service.js +39 -42
- package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/create-document.service.d.ts +223 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/create-document.service.js +35 -41
- package/dist/modules/workflow-processor/tool-services/create-document.service.js.map +1 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/index.d.ts +2 -2
- package/dist/modules/workflow-processor/{tools → tool-services}/index.js +2 -2
- package/dist/modules/workflow-processor/tool-services/index.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/load-document.service.d.ts +68 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/load-document.service.js +14 -12
- package/dist/modules/workflow-processor/tool-services/load-document.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/mock.service.d.ts +20 -0
- package/dist/modules/workflow-processor/tool-services/mock.service.js +51 -0
- package/dist/modules/workflow-processor/tool-services/mock.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/set-context.service.d.ts +18 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/set-context.service.js +20 -17
- package/dist/modules/workflow-processor/tool-services/set-context.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.d.ts +14 -0
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.js +48 -0
- package/dist/modules/workflow-processor/tool-services/set-target-place.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/transition-selector.service.d.ts +29 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/transition-selector.service.js +22 -19
- package/dist/modules/workflow-processor/tool-services/transition-selector.service.js.map +1 -0
- package/dist/modules/workflow-processor/tool-services/update-document.service.d.ts +117 -0
- package/dist/modules/workflow-processor/{tools → tool-services}/update-document.service.js +22 -19
- package/dist/modules/workflow-processor/tool-services/update-document.service.js.map +1 -0
- package/dist/modules/workflow-processor/workflow-processor.module.js +13 -12
- package/dist/modules/workflow-processor/workflow-processor.module.js.map +1 -1
- package/package.json +2 -2
- package/dist/config/documents/assistant-message.yaml +0 -13
- package/dist/config/documents/info-message.yaml +0 -9
- package/dist/config/documents/internal-message.yaml +0 -14
- package/dist/config/documents/loading-message.yaml +0 -10
- package/dist/config/documents/user-message.yaml +0 -13
- package/dist/config/templates/user-input-template.yaml +0 -29
- package/dist/config/tools/creat-error-message.yaml +0 -9
- package/dist/config/tools/create-assistant-message.yaml +0 -9
- package/dist/config/tools/create-chat-message.tool.yaml +0 -7
- package/dist/config/tools/create-template-document-user-update.yaml +0 -7
- package/dist/config/tools/create-template-document.yaml +0 -5
- package/dist/config/tools/create-user-message.tool.yaml +0 -9
- package/dist/modules/configuration/services/adapter-registry.service.d.ts +0 -12
- package/dist/modules/configuration/services/adapter-registry.service.js.map +0 -1
- package/dist/modules/configuration/services/tool.registry.d.ts +0 -13
- package/dist/modules/configuration/services/tool.registry.js +0 -59
- package/dist/modules/configuration/services/tool.registry.js.map +0 -1
- package/dist/modules/persistence/services/project.service.d.ts +0 -8
- package/dist/modules/persistence/services/project.service.js.map +0 -1
- package/dist/modules/workflow-processor/services/project-processor.service.d.ts +0 -15
- package/dist/modules/workflow-processor/services/project-processor.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/add-namespace.service.d.ts +0 -29
- package/dist/modules/workflow-processor/tools/add-namespace.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/batch-create-documents.service.d.ts +0 -42
- package/dist/modules/workflow-processor/tools/batch-create-documents.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/create-document.service.d.ts +0 -378
- package/dist/modules/workflow-processor/tools/create-document.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/debug.service.d.ts +0 -20
- package/dist/modules/workflow-processor/tools/debug.service.js +0 -37
- package/dist/modules/workflow-processor/tools/debug.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/index.js.map +0 -1
- package/dist/modules/workflow-processor/tools/load-document.service.d.ts +0 -242
- package/dist/modules/workflow-processor/tools/load-document.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/set-context.service.d.ts +0 -27
- package/dist/modules/workflow-processor/tools/set-context.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/tool-call.service.d.ts +0 -29
- package/dist/modules/workflow-processor/tools/tool-call.service.js +0 -55
- package/dist/modules/workflow-processor/tools/tool-call.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/transition-selector.service.d.ts +0 -50
- package/dist/modules/workflow-processor/tools/transition-selector.service.js.map +0 -1
- package/dist/modules/workflow-processor/tools/update-document.service.d.ts +0 -198
- package/dist/modules/workflow-processor/tools/update-document.service.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ContextImportInterface, ContextInterface, ServiceInterface, ServiceCallResult, TransitionMetadataInterface } from '@loopstack/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ExpressionEvaluatorService } from '../../common';
|
|
4
|
+
import { DocumentEntity, WorkflowEntity } from '@loopstack/shared';
|
|
5
|
+
import { DocumentService, WorkflowService } from '../../persistence';
|
|
6
|
+
declare const schema: z.ZodObject<{
|
|
7
|
+
where: any;
|
|
8
|
+
map: z.ZodOptional<z.ZodString>;
|
|
9
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
10
|
+
sort: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
sortBy: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
iteratees: z.ZodArray<z.ZodString, "many">;
|
|
13
|
+
orders: z.ZodArray<z.ZodEnum<["asc", "desc"]>, "many">;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
iteratees: string[];
|
|
16
|
+
orders: ("asc" | "desc")[];
|
|
17
|
+
}, {
|
|
18
|
+
iteratees: string[];
|
|
19
|
+
orders: ("asc" | "desc")[];
|
|
20
|
+
}>>;
|
|
21
|
+
many: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
flat: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
ignoreChanges: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
global: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
map?: string | undefined;
|
|
28
|
+
filter?: string | undefined;
|
|
29
|
+
flat?: boolean | undefined;
|
|
30
|
+
sort?: boolean | undefined;
|
|
31
|
+
many?: boolean | undefined;
|
|
32
|
+
where?: any;
|
|
33
|
+
sortBy?: {
|
|
34
|
+
iteratees: string[];
|
|
35
|
+
orders: ("asc" | "desc")[];
|
|
36
|
+
} | undefined;
|
|
37
|
+
ignoreChanges?: boolean | undefined;
|
|
38
|
+
global?: boolean | undefined;
|
|
39
|
+
optional?: boolean | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
map?: string | undefined;
|
|
42
|
+
filter?: string | undefined;
|
|
43
|
+
flat?: boolean | undefined;
|
|
44
|
+
sort?: boolean | undefined;
|
|
45
|
+
many?: boolean | undefined;
|
|
46
|
+
where?: any;
|
|
47
|
+
sortBy?: {
|
|
48
|
+
iteratees: string[];
|
|
49
|
+
orders: ("asc" | "desc")[];
|
|
50
|
+
} | undefined;
|
|
51
|
+
ignoreChanges?: boolean | undefined;
|
|
52
|
+
global?: boolean | undefined;
|
|
53
|
+
optional?: boolean | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare class LoadDocumentService implements ServiceInterface {
|
|
56
|
+
private documentService;
|
|
57
|
+
private workflowService;
|
|
58
|
+
private functionCallService;
|
|
59
|
+
private readonly logger;
|
|
60
|
+
constructor(documentService: DocumentService, workflowService: WorkflowService, functionCallService: ExpressionEvaluatorService);
|
|
61
|
+
applyFilters(props: z.infer<typeof schema>, items: DocumentEntity[]): DocumentEntity<any>[];
|
|
62
|
+
applyModifiers(props: z.infer<typeof schema>, entities: DocumentEntity[]): any[];
|
|
63
|
+
getDocumentsByQuery(props: z.infer<typeof schema>, pipelineId: string, workspaceId: string, workflow: WorkflowEntity): Promise<DocumentEntity[]>;
|
|
64
|
+
updateWorkflowDependenciesHash(workflow: WorkflowEntity): void;
|
|
65
|
+
createImportItem(options: z.infer<typeof schema>, currentEntities: DocumentEntity[], prevImport: ContextImportInterface | undefined): ContextImportInterface;
|
|
66
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface, meta: TransitionMetadataInterface): Promise<ServiceCallResult>;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -20,7 +20,7 @@ const shared_1 = require("@loopstack/shared");
|
|
|
20
20
|
const zod_1 = require("zod");
|
|
21
21
|
const common_2 = require("../../common");
|
|
22
22
|
const persistence_1 = require("../../persistence");
|
|
23
|
-
const
|
|
23
|
+
const config = zod_1.z
|
|
24
24
|
.object({
|
|
25
25
|
where: persistence_1.WhereCondition,
|
|
26
26
|
map: zod_1.z.string().optional(),
|
|
@@ -39,13 +39,12 @@ const LoadDocumentArgsSchema = zod_1.z
|
|
|
39
39
|
optional: zod_1.z.boolean().optional(),
|
|
40
40
|
})
|
|
41
41
|
.strict();
|
|
42
|
+
const schema = config;
|
|
42
43
|
let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
43
44
|
documentService;
|
|
44
45
|
workflowService;
|
|
45
46
|
functionCallService;
|
|
46
47
|
logger = new common_1.Logger(LoadDocumentService_1.name);
|
|
47
|
-
configSchema = LoadDocumentArgsSchema;
|
|
48
|
-
schema = LoadDocumentArgsSchema;
|
|
49
48
|
constructor(documentService, workflowService, functionCallService) {
|
|
50
49
|
this.documentService = documentService;
|
|
51
50
|
this.workflowService = workflowService;
|
|
@@ -72,8 +71,8 @@ let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
|
72
71
|
}
|
|
73
72
|
return documents;
|
|
74
73
|
}
|
|
75
|
-
async getDocumentsByQuery(props,
|
|
76
|
-
const query = this.documentService.createDocumentsQuery(
|
|
74
|
+
async getDocumentsByQuery(props, pipelineId, workspaceId, workflow) {
|
|
75
|
+
const query = this.documentService.createDocumentsQuery(pipelineId, workspaceId, props.where, {
|
|
77
76
|
isGlobal: !!props.global,
|
|
78
77
|
ltWorkflowIndex: workflow.index,
|
|
79
78
|
});
|
|
@@ -107,15 +106,14 @@ let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
|
107
106
|
options,
|
|
108
107
|
};
|
|
109
108
|
}
|
|
110
|
-
async apply(props, workflow, context,
|
|
109
|
+
async apply(props, workflow, context, meta) {
|
|
111
110
|
if (!workflow) {
|
|
112
111
|
throw new Error('Workflow is undefined');
|
|
113
112
|
}
|
|
114
|
-
this.logger.debug(`Load document ${
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
if (!validProps.ignoreChanges) {
|
|
113
|
+
this.logger.debug(`Load document ${meta.transition}`);
|
|
114
|
+
const currentEntities = await this.getDocumentsByQuery(props, context.pipelineId, context.workspaceId, workflow);
|
|
115
|
+
const prevImport = workflow.prevData?.imports?.[meta.transition];
|
|
116
|
+
if (!props.ignoreChanges) {
|
|
119
117
|
if (!workflow.dependencies) {
|
|
120
118
|
workflow.dependencies = [];
|
|
121
119
|
}
|
|
@@ -129,6 +127,7 @@ let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
|
129
127
|
}
|
|
130
128
|
const importItem = this.createImportItem(props, currentEntities, prevImport);
|
|
131
129
|
return {
|
|
130
|
+
success: true,
|
|
132
131
|
workflow,
|
|
133
132
|
data: importItem,
|
|
134
133
|
};
|
|
@@ -137,7 +136,10 @@ let LoadDocumentService = LoadDocumentService_1 = class LoadDocumentService {
|
|
|
137
136
|
exports.LoadDocumentService = LoadDocumentService;
|
|
138
137
|
exports.LoadDocumentService = LoadDocumentService = LoadDocumentService_1 = __decorate([
|
|
139
138
|
(0, common_1.Injectable)(),
|
|
140
|
-
(0, shared_1.
|
|
139
|
+
(0, shared_1.Service)({
|
|
140
|
+
config,
|
|
141
|
+
schema,
|
|
142
|
+
}),
|
|
141
143
|
__metadata("design:paramtypes", [persistence_1.DocumentService,
|
|
142
144
|
persistence_1.WorkflowService,
|
|
143
145
|
common_2.ExpressionEvaluatorService])
|
|
@@ -0,0 +1 @@
|
|
|
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,oDAAuB;AACvB,8CAM2B;AAC3B,6BAAwB;AACxB,yCAA0D;AAE1D,mDAI2B;AAE3B,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,4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C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzE,MAAM,eAAe,GAAG,eAAe,CAAC,MAAM,CAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CACvD,CAAC;YACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;YAE/C,IAAI,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CACtC,KAAK,EACL,eAAe,EACf,UAAU,CACX,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,IAAI,EAAE,UAAU;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AAvLY,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK2B,6BAAe;QACf,6BAAe;QACX,mCAA0B;GAN9C,mBAAmB,CAuL/B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceInterface, ServiceCallResult } from '@loopstack/shared';
|
|
3
|
+
declare const schema: z.ZodObject<{
|
|
4
|
+
input: z.ZodOptional<z.ZodString>;
|
|
5
|
+
output: z.ZodOptional<z.ZodString>;
|
|
6
|
+
error: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
error?: string | undefined;
|
|
9
|
+
input?: string | undefined;
|
|
10
|
+
output?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
error?: string | undefined;
|
|
13
|
+
input?: string | undefined;
|
|
14
|
+
output?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare class MockService implements ServiceInterface {
|
|
17
|
+
private readonly logger;
|
|
18
|
+
apply(props: z.infer<typeof schema>): Promise<ServiceCallResult>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
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 MockService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MockService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const shared_1 = require("@loopstack/shared");
|
|
14
|
+
const config = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
input: zod_1.z.string().optional(),
|
|
17
|
+
output: zod_1.z.string().optional(),
|
|
18
|
+
error: zod_1.z.string().optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
const schema = zod_1.z
|
|
22
|
+
.object({
|
|
23
|
+
input: zod_1.z.string().optional(),
|
|
24
|
+
output: zod_1.z.string().optional(),
|
|
25
|
+
error: zod_1.z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
let MockService = MockService_1 = class MockService {
|
|
29
|
+
logger = new common_1.Logger(MockService_1.name);
|
|
30
|
+
async apply(props) {
|
|
31
|
+
if (props.input) {
|
|
32
|
+
this.logger.debug(`Received mock input ${props.input}`);
|
|
33
|
+
}
|
|
34
|
+
if (props.error) {
|
|
35
|
+
throw new Error(props.error);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
data: { content: props.output }
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.MockService = MockService;
|
|
44
|
+
exports.MockService = MockService = MockService_1 = __decorate([
|
|
45
|
+
(0, common_1.Injectable)(),
|
|
46
|
+
(0, shared_1.Service)({
|
|
47
|
+
config,
|
|
48
|
+
schema,
|
|
49
|
+
})
|
|
50
|
+
], MockService);
|
|
51
|
+
//# sourceMappingURL=mock.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,8CAAiF;AAEjF,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,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,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC;AAOL,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACL,MAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEvD,KAAK,CAAC,KAAK,CAAC,KAA6B;QAEvC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE;SAChC,CAAA;IACH,CAAC;CACF,CAAA;AAlBY,kCAAW;sBAAX,WAAW;IALvB,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;GACW,WAAW,CAkBvB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceInterface, ServiceCallResult } from '@loopstack/shared';
|
|
3
|
+
import { WorkflowEntity } from '@loopstack/shared';
|
|
4
|
+
declare const schema: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
value: z.ZodAny;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
key: string;
|
|
9
|
+
value?: any;
|
|
10
|
+
}, {
|
|
11
|
+
key: string;
|
|
12
|
+
value?: any;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class SetContextService implements ServiceInterface {
|
|
15
|
+
private readonly logger;
|
|
16
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined): Promise<ServiceCallResult>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -11,31 +11,31 @@ exports.SetContextService = void 0;
|
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
const shared_1 = require("@loopstack/shared");
|
|
14
|
+
const config = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
key: zod_1.z.string(),
|
|
17
|
+
value: zod_1.z.any(),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
const schema = zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
key: zod_1.z.string(),
|
|
23
|
+
value: zod_1.z.any(),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
14
26
|
let SetContextService = SetContextService_1 = class SetContextService {
|
|
15
27
|
logger = new common_1.Logger(SetContextService_1.name);
|
|
16
|
-
configSchema = zod_1.z
|
|
17
|
-
.object({
|
|
18
|
-
key: zod_1.z.string(),
|
|
19
|
-
value: zod_1.z.any(),
|
|
20
|
-
})
|
|
21
|
-
.strict();
|
|
22
|
-
schema = zod_1.z
|
|
23
|
-
.object({
|
|
24
|
-
key: zod_1.z.string(),
|
|
25
|
-
value: zod_1.z.any(),
|
|
26
|
-
})
|
|
27
|
-
.strict();
|
|
28
28
|
async apply(props, workflow) {
|
|
29
|
-
const validOptions = this.schema.parse(props);
|
|
30
29
|
if (!workflow) {
|
|
31
|
-
|
|
30
|
+
throw new Error('Workflow is undefined');
|
|
32
31
|
}
|
|
33
32
|
if (!workflow.contextUpdate) {
|
|
34
33
|
workflow.contextUpdate = {};
|
|
35
34
|
}
|
|
36
|
-
workflow.contextUpdate[
|
|
37
|
-
this.logger.debug(`Set context update key "${
|
|
35
|
+
workflow.contextUpdate[props.key] = props.value;
|
|
36
|
+
this.logger.debug(`Set context update key "${props.key}".`);
|
|
38
37
|
return {
|
|
38
|
+
success: true,
|
|
39
39
|
workflow,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -43,6 +43,9 @@ let SetContextService = SetContextService_1 = class SetContextService {
|
|
|
43
43
|
exports.SetContextService = SetContextService;
|
|
44
44
|
exports.SetContextService = SetContextService = SetContextService_1 = __decorate([
|
|
45
45
|
(0, common_1.Injectable)(),
|
|
46
|
-
(0, shared_1.
|
|
46
|
+
(0, shared_1.Service)({
|
|
47
|
+
config,
|
|
48
|
+
schema,
|
|
49
|
+
})
|
|
47
50
|
], SetContextService);
|
|
48
51
|
//# sourceMappingURL=set-context.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,8CAAiF;AAGjF,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;IACX,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAoC;QAEpC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC5B,QAAQ,CAAC,aAAa,GAAG,EAAE,CAAC;QAC9B,CAAC;QAED,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhD,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;AAxBY,8CAAiB;4BAAjB,iBAAiB;IAL7B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;GACW,iBAAiB,CAwB7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ContextInterface, ServiceInterface, ServiceCallResult, TransitionMetadataInterface, WorkflowEntity } from '@loopstack/shared';
|
|
3
|
+
declare const schema: z.ZodObject<{
|
|
4
|
+
target: z.ZodString;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
target: string;
|
|
7
|
+
}, {
|
|
8
|
+
target: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare class SetTargetPlaceService implements ServiceInterface {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity, context: ContextInterface, meta: TransitionMetadataInterface): Promise<ServiceCallResult>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
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 SetTargetPlaceService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SetTargetPlaceService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const shared_1 = require("@loopstack/shared");
|
|
14
|
+
const config = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
target: shared_1.ExpressionString,
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
const schema = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
target: shared_1.NonExpressionString,
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
let SetTargetPlaceService = SetTargetPlaceService_1 = class SetTargetPlaceService {
|
|
25
|
+
logger = new common_1.Logger(SetTargetPlaceService_1.name);
|
|
26
|
+
async apply(props, workflow, context, meta) {
|
|
27
|
+
if (!meta.transition) {
|
|
28
|
+
throw new Error('No transition available.');
|
|
29
|
+
}
|
|
30
|
+
if ((Array.isArray(meta.to) && !meta.to.includes(props.target))
|
|
31
|
+
|| (!Array.isArray(meta.to) && meta.to !== props.target)) {
|
|
32
|
+
throw new Error(`Transition to ${props.target} not allowed.`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
place: props.target,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.SetTargetPlaceService = SetTargetPlaceService;
|
|
41
|
+
exports.SetTargetPlaceService = SetTargetPlaceService = SetTargetPlaceService_1 = __decorate([
|
|
42
|
+
(0, common_1.Injectable)(),
|
|
43
|
+
(0, shared_1.Service)({
|
|
44
|
+
config,
|
|
45
|
+
schema,
|
|
46
|
+
})
|
|
47
|
+
], SetTargetPlaceService);
|
|
48
|
+
//# sourceMappingURL=set-target-place.service.js.map
|
|
@@ -0,0 +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,8CAO2B;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,4BAAmB;CAC5B,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,IAAiC;QAGjC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;eACtD,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,EACxD,CAAC;YACH,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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceInterface, ServiceCallResult } from '@loopstack/shared';
|
|
3
|
+
declare const schema: z.ZodObject<{
|
|
4
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
5
|
+
place: z.ZodString;
|
|
6
|
+
condition: z.ZodUnion<[z.ZodBoolean, z.ZodUndefined]>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
place: string;
|
|
9
|
+
condition?: boolean | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
place: string;
|
|
12
|
+
condition?: boolean | undefined;
|
|
13
|
+
}>, "many">;
|
|
14
|
+
}, "strict", z.ZodTypeAny, {
|
|
15
|
+
transitions: {
|
|
16
|
+
place: string;
|
|
17
|
+
condition?: boolean | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
}, {
|
|
20
|
+
transitions: {
|
|
21
|
+
place: string;
|
|
22
|
+
condition?: boolean | undefined;
|
|
23
|
+
}[];
|
|
24
|
+
}>;
|
|
25
|
+
export declare class TransitionSelectorService implements ServiceInterface {
|
|
26
|
+
private readonly logger;
|
|
27
|
+
apply(props: z.infer<typeof schema>): Promise<ServiceCallResult>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/dist/modules/workflow-processor/{tools → tool-services}/transition-selector.service.js
RENAMED
|
@@ -11,34 +11,34 @@ exports.TransitionSelectorService = void 0;
|
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
const shared_1 = require("@loopstack/shared");
|
|
14
|
+
const config = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
transitions: zod_1.z.array(zod_1.z.object({
|
|
17
|
+
place: shared_1.NonExpressionString,
|
|
18
|
+
condition: shared_1.ExpressionString.optional(),
|
|
19
|
+
})),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
const schema = zod_1.z
|
|
23
|
+
.object({
|
|
24
|
+
transitions: zod_1.z.array(zod_1.z.object({
|
|
25
|
+
place: shared_1.NonExpressionString,
|
|
26
|
+
condition: zod_1.z.union([zod_1.z.boolean(), zod_1.z.undefined()]),
|
|
27
|
+
})),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
14
30
|
let TransitionSelectorService = TransitionSelectorService_1 = class TransitionSelectorService {
|
|
15
31
|
logger = new common_1.Logger(TransitionSelectorService_1.name);
|
|
16
|
-
configSchema = zod_1.z
|
|
17
|
-
.object({
|
|
18
|
-
transitions: zod_1.z.array(zod_1.z.object({
|
|
19
|
-
place: shared_1.NonExpressionString,
|
|
20
|
-
condition: shared_1.ExpressionString.optional(),
|
|
21
|
-
})),
|
|
22
|
-
})
|
|
23
|
-
.strict();
|
|
24
|
-
schema = zod_1.z
|
|
25
|
-
.object({
|
|
26
|
-
transitions: zod_1.z.array(zod_1.z.object({
|
|
27
|
-
place: shared_1.NonExpressionString,
|
|
28
|
-
condition: zod_1.z.union([zod_1.z.boolean(), zod_1.z.undefined()]),
|
|
29
|
-
})),
|
|
30
|
-
})
|
|
31
|
-
.strict();
|
|
32
32
|
async apply(props) {
|
|
33
|
-
const validOptions = this.schema.parse(props);
|
|
34
33
|
let place;
|
|
35
|
-
for (const option of
|
|
34
|
+
for (const option of props.transitions) {
|
|
36
35
|
if (undefined === option.condition || option.condition) {
|
|
37
36
|
place = option.place;
|
|
38
37
|
break;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
return {
|
|
41
|
+
success: true,
|
|
42
42
|
place,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -46,6 +46,9 @@ let TransitionSelectorService = TransitionSelectorService_1 = class TransitionSe
|
|
|
46
46
|
exports.TransitionSelectorService = TransitionSelectorService;
|
|
47
47
|
exports.TransitionSelectorService = TransitionSelectorService = TransitionSelectorService_1 = __decorate([
|
|
48
48
|
(0, common_1.Injectable)(),
|
|
49
|
-
(0, shared_1.
|
|
49
|
+
(0, shared_1.Service)({
|
|
50
|
+
config,
|
|
51
|
+
schema,
|
|
52
|
+
})
|
|
50
53
|
], TransitionSelectorService);
|
|
51
54
|
//# sourceMappingURL=transition-selector.service.js.map
|
|
@@ -0,0 +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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opstack/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { WorkflowEntity } from '@loopstack/shared';
|
|
4
|
+
import { DocumentService } from '../../persistence';
|
|
5
|
+
declare const schema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
update: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
content: z.ZodOptional<z.ZodAny>;
|
|
11
|
+
schema: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
12
|
+
ui: z.ZodOptional<z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>>;
|
|
13
|
+
tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
14
|
+
meta: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
15
|
+
mimeType: z.ZodOptional<z.ZodEnum<["text/plain", "text/html", "text/css", "text/xml", "text/markdown", "application/javascript", "application/typescript", "application/json", "application/xml", "application/yaml"]>>;
|
|
16
|
+
invalidate: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
level: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"debug">, z.ZodLiteral<"info">, z.ZodLiteral<"warning">, z.ZodLiteral<"error">]>>;
|
|
18
|
+
enableTransitions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
|
+
enableAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
+
hideAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
24
|
+
invalidate?: boolean | undefined;
|
|
25
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
26
|
+
enableTransitions?: string[] | undefined;
|
|
27
|
+
enableAtPlaces?: string[] | undefined;
|
|
28
|
+
hideAtPlaces?: string[] | undefined;
|
|
29
|
+
data?: any;
|
|
30
|
+
}, {
|
|
31
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
32
|
+
invalidate?: boolean | undefined;
|
|
33
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
34
|
+
enableTransitions?: string[] | undefined;
|
|
35
|
+
enableAtPlaces?: string[] | undefined;
|
|
36
|
+
hideAtPlaces?: string[] | undefined;
|
|
37
|
+
data?: any;
|
|
38
|
+
}>>>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
content?: any;
|
|
43
|
+
schema?: any;
|
|
44
|
+
ui?: any;
|
|
45
|
+
tags?: string[] | undefined;
|
|
46
|
+
meta?: {
|
|
47
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
48
|
+
invalidate?: boolean | undefined;
|
|
49
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
50
|
+
enableTransitions?: string[] | undefined;
|
|
51
|
+
enableAtPlaces?: string[] | undefined;
|
|
52
|
+
hideAtPlaces?: string[] | undefined;
|
|
53
|
+
data?: any;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
name?: string | undefined;
|
|
57
|
+
description?: string | undefined;
|
|
58
|
+
content?: any;
|
|
59
|
+
schema?: any;
|
|
60
|
+
ui?: any;
|
|
61
|
+
tags?: string[] | undefined;
|
|
62
|
+
meta?: {
|
|
63
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
64
|
+
invalidate?: boolean | undefined;
|
|
65
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
66
|
+
enableTransitions?: string[] | undefined;
|
|
67
|
+
enableAtPlaces?: string[] | undefined;
|
|
68
|
+
hideAtPlaces?: string[] | undefined;
|
|
69
|
+
data?: any;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}>>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
id: string;
|
|
74
|
+
update?: {
|
|
75
|
+
name?: string | undefined;
|
|
76
|
+
description?: string | undefined;
|
|
77
|
+
content?: any;
|
|
78
|
+
schema?: any;
|
|
79
|
+
ui?: any;
|
|
80
|
+
tags?: string[] | undefined;
|
|
81
|
+
meta?: {
|
|
82
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
83
|
+
invalidate?: boolean | undefined;
|
|
84
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
85
|
+
enableTransitions?: string[] | undefined;
|
|
86
|
+
enableAtPlaces?: string[] | undefined;
|
|
87
|
+
hideAtPlaces?: string[] | undefined;
|
|
88
|
+
data?: any;
|
|
89
|
+
} | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
id: string;
|
|
93
|
+
update?: {
|
|
94
|
+
name?: string | undefined;
|
|
95
|
+
description?: string | undefined;
|
|
96
|
+
content?: any;
|
|
97
|
+
schema?: any;
|
|
98
|
+
ui?: any;
|
|
99
|
+
tags?: string[] | undefined;
|
|
100
|
+
meta?: {
|
|
101
|
+
mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
|
|
102
|
+
invalidate?: boolean | undefined;
|
|
103
|
+
level?: "debug" | "info" | "warning" | "error" | undefined;
|
|
104
|
+
enableTransitions?: string[] | undefined;
|
|
105
|
+
enableAtPlaces?: string[] | undefined;
|
|
106
|
+
hideAtPlaces?: string[] | undefined;
|
|
107
|
+
data?: any;
|
|
108
|
+
} | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
export declare class UpdateDocumentService implements ServiceInterface {
|
|
112
|
+
private documentService;
|
|
113
|
+
private readonly logger;
|
|
114
|
+
constructor(documentService: DocumentService);
|
|
115
|
+
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined): Promise<ServiceCallResult>;
|
|
116
|
+
}
|
|
117
|
+
export {};
|