@dcupl/common 1.9.0 → 1.9.2

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.
@@ -0,0 +1,27 @@
1
+ import { ModelDefinition } from '../../model.types';
2
+ import { Workflow } from '../workflow.types';
3
+ export declare namespace _WorkflowStepDataMapper {
4
+ type WorkflowDataMapperType = 'manual' | 'model';
5
+ type MappingEntry = {
6
+ origin: string;
7
+ target: string;
8
+ };
9
+ type InputOptions = {
10
+ data: any;
11
+ };
12
+ type OutputOptions = {
13
+ contextVariable: string;
14
+ };
15
+ type StepOptions = {
16
+ input: InputOptions;
17
+ output: OutputOptions;
18
+ mappings?: MappingEntry[];
19
+ model?: ModelDefinition | string;
20
+ };
21
+ type Step = Workflow.WorkflowStepBase & {
22
+ type: 'data-mapper';
23
+ options: StepOptions;
24
+ };
25
+ type StepResultValue = any[];
26
+ type StepResult = Workflow.StepResultValueBase<StepResultValue>;
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data-mapper.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mapper.types.js","sourceRoot":"","sources":["../../../../../src/types/workflow/steps/data-mapper.types.ts"],"names":[],"mappings":""}
@@ -39,9 +39,14 @@ export declare namespace _WorkflowStepDcuplFiles {
39
39
  type: 'dcupl-files';
40
40
  options: StepOptions;
41
41
  };
42
- type StepVariableResult = {
42
+ type StepFileResult = {
43
43
  ok: boolean;
44
44
  status: number;
45
45
  data: any;
46
46
  };
47
+ type StepResultValue = {
48
+ ok: boolean;
49
+ files: StepFileResult[];
50
+ };
51
+ type StepResult = Workflow.StepResultValueBase<StepResultValue>;
47
52
  }
@@ -49,9 +49,14 @@ export declare namespace _WorkflowStepGitFiles {
49
49
  type: 'git-files';
50
50
  options: StepOptions;
51
51
  };
52
- type StepVariableResult = {
52
+ type StepFileResult = {
53
53
  ok: boolean;
54
54
  status: number;
55
55
  data: any;
56
56
  };
57
+ type StepResultValue = {
58
+ ok: boolean;
59
+ files: StepFileResult[];
60
+ };
61
+ type StepResult = Workflow.StepResultValueBase<StepResultValue>;
57
62
  }
@@ -0,0 +1,23 @@
1
+ import { AppLoaderConfiguration } from '../../app-loader.types';
2
+ import { DataContainer } from '../../data.types';
3
+ import { DcuplInitOptions } from '../../dcupl.types';
4
+ import { ModelDefinition } from '../../model.types';
5
+ import { Workflow } from '../workflow.types';
6
+ export declare namespace _WorkflowStepInstance {
7
+ type WorkflowDataContainer = Omit<DataContainer, 'data'> & {
8
+ data: any;
9
+ };
10
+ type StepOptions = {
11
+ script: string;
12
+ initOptions?: DcuplInitOptions;
13
+ loaderFetchOptions?: AppLoaderConfiguration.FetchOptions;
14
+ processOptions?: AppLoaderConfiguration.ProcessOptions;
15
+ dataContainers?: WorkflowDataContainer[];
16
+ models?: ModelDefinition[] | string[];
17
+ };
18
+ type Step = Workflow.WorkflowStepBase & {
19
+ type: 'dcupl-instance';
20
+ options: StepOptions;
21
+ };
22
+ type StepResult = Workflow.StepResultContextBase;
23
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=instance.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.types.js","sourceRoot":"","sources":["../../../../../src/types/workflow/steps/instance.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { Workflow } from '../workflow.types';
2
+ export declare namespace _WorkflowStepRequest {
3
+ type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
4
+ type StepOptions = {
5
+ url: string;
6
+ method: RequestMethod;
7
+ body?: string;
8
+ headers?: Record<string, string>;
9
+ contextVariable?: string;
10
+ };
11
+ type Step = Workflow.WorkflowStepBase & {
12
+ type: 'request';
13
+ options: StepOptions;
14
+ };
15
+ type StepResultValue = {
16
+ ok: boolean;
17
+ status: number;
18
+ data: any;
19
+ };
20
+ type StepResult = Workflow.StepResultValueBase<StepResultValue>;
21
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.types.js","sourceRoot":"","sources":["../../../../../src/types/workflow/steps/request.types.ts"],"names":[],"mappings":""}
@@ -41,9 +41,14 @@ export declare namespace _WorkflowStepS3Files {
41
41
  type: 's3-files';
42
42
  options: StepOptions;
43
43
  };
44
- type StepVariableResult = {
44
+ type StepFileResult = {
45
45
  ok: boolean;
46
46
  status: number;
47
47
  data: any;
48
48
  };
49
+ type StepResultValue = {
50
+ ok: boolean;
51
+ files: StepFileResult[];
52
+ };
53
+ type StepResult = Workflow.StepResultValueBase<StepResultValue>;
49
54
  }
@@ -0,0 +1,11 @@
1
+ import { Workflow } from '../workflow.types';
2
+ export declare namespace _WorkflowStepScript {
3
+ type StepOptions = {
4
+ script: string;
5
+ };
6
+ type Step = Workflow.WorkflowStepBase & {
7
+ type: 'script';
8
+ options: StepOptions;
9
+ };
10
+ type StepResult = Workflow.StepResultContextBase;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=script.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.types.js","sourceRoot":"","sources":["../../../../../src/types/workflow/steps/script.types.ts"],"names":[],"mappings":""}
@@ -1,10 +1,10 @@
1
- import { DataContainer } from '../data.types';
2
- import { ModelDefinition } from '../model.types';
3
- import { AppLoaderConfiguration } from '../app-loader.types';
4
- import { ListItem } from '../data.types';
5
1
  import { _WorkflowStepDcuplFiles } from './steps/dcupl-files.types';
6
2
  import { _WorkflowStepS3Files } from './steps/s3-files.types';
7
3
  import { _WorkflowStepGitFiles } from './steps/git-files.types';
4
+ import { _WorkflowStepScript } from './steps/script.types';
5
+ import { _WorkflowStepRequest } from './steps/request.types';
6
+ import { _WorkflowStepInstance } from './steps/instance.types';
7
+ import { _WorkflowStepDataMapper } from './steps/data-mapper.types';
8
8
  export declare namespace Workflow {
9
9
  type Template = {
10
10
  key: string;
@@ -27,11 +27,13 @@ export declare namespace Workflow {
27
27
  type WorkflowResponseType = 'script' | 'status' | 'debug';
28
28
  type WorkflowResponseConfigBase = {
29
29
  type: WorkflowResponseType;
30
- headers?: Record<string, string>;
31
30
  };
32
31
  type WorkflowResponseScript = WorkflowResponseConfigBase & {
33
32
  type: 'script';
34
- script: string;
33
+ options: {
34
+ script: string;
35
+ headers?: Record<string, string>;
36
+ };
35
37
  };
36
38
  type WorkflowResponseStatus = WorkflowResponseConfigBase & {
37
39
  type: 'status';
@@ -61,9 +63,6 @@ export declare namespace Workflow {
61
63
  type: 'request';
62
64
  path: string;
63
65
  methods: TriggerRequestMethod[];
64
- scripts?: {
65
- success?: string;
66
- };
67
66
  };
68
67
  type TriggerManual = TriggerBase & {
69
68
  type: 'manual';
@@ -91,214 +90,24 @@ export declare namespace Workflow {
91
90
  * Step
92
91
  *
93
92
  */
94
- type WorflowStepType = 'request' | 'script' | 'git-push' | 'git-pull' | 'git-files' | 'dcupl-files' | 'files-read' | 'files-write' | 's3-files' | 's3-read' | 's3-write' | 'data-mapping' | 'dcupl-instance';
93
+ type WorflowStepType = 'request' | 'script' | 'git-files' | 'dcupl-files' | 's3-files' | 'data-mapper' | 'dcupl-instance';
95
94
  type WorkflowStepBase = {
96
95
  key: string;
97
96
  name?: string;
98
97
  description?: string;
99
98
  skip?: boolean;
100
99
  };
101
- /**
102
- * Request
103
- */
104
- type WorkflowRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
105
- type WorkflowStepRequestOptions = {
106
- url: string;
107
- method: WorkflowRequestMethod;
108
- body?: any;
109
- headers?: Record<string, string>;
110
- };
111
- type WorkflowStepRequest = WorkflowStepBase & {
112
- type: 'request';
113
- options: WorkflowStepRequestOptions;
114
- scripts?: {
115
- error?: string;
116
- success?: string;
117
- };
118
- };
119
- /**
120
- * Script
121
- */
122
- type WorkflowStepScript = WorkflowStepBase & {
123
- type: 'script';
124
- script: string;
125
- };
126
100
  /**
127
101
  * Dcupl Instance
128
102
  */
129
- type WorkflowStepDcuplInstanceDataContainer = Omit<DataContainer, 'data'> & {
130
- data: string | ListItem[];
131
- };
132
- type WorkflowStepDcuplInstance = WorkflowStepBase & {
133
- type: 'dcupl-instance';
134
- apiKey: string;
135
- processOptions: AppLoaderConfiguration.ProcessOptions;
136
- fetchOptions?: AppLoaderConfiguration.FetchOptions;
137
- dataContainers?: WorkflowStepDcuplInstanceDataContainer[];
138
- models?: ModelDefinition[];
139
- loaderConfig?: AppLoaderConfiguration.ProjectConfiguration;
140
- scriptName?: string;
141
- script?: string;
142
- };
143
- /**
144
- * Git Push
145
- */
146
- type WorkflowGitPushStepFile = {
147
- path: string;
148
- content: string;
149
- message?: string;
150
- };
151
- type WorkflowGitPushStepOptions = {
152
- auth: {
153
- user: string;
154
- token: string;
155
- };
156
- repository: {
157
- user: string;
158
- repo: string;
159
- /**
160
- * default: main
161
- */
162
- branch?: string;
163
- };
164
- message?: string;
165
- files: WorkflowGitPushStepFile[];
166
- };
167
- type WorkflowStepGitPush = WorkflowStepBase & {
168
- type: 'git-push';
169
- options: WorkflowGitPushStepOptions;
170
- };
171
- /**
172
- * Git Pull
173
- */
174
- type WorkflowGitPullStepFile = {
175
- key: string;
176
- path: string;
177
- };
178
- type WorkflowGitPullStepOptions = {
179
- auth: {
180
- user: string;
181
- token: string;
182
- };
183
- repository: {
184
- user: string;
185
- repo: string;
186
- /**
187
- * default: main
188
- */
189
- branch?: string;
190
- };
191
- files: WorkflowGitPullStepFile[];
192
- };
193
- type WorkflowStepGitPull = WorkflowStepBase & {
194
- type: 'git-pull';
195
- options: WorkflowGitPullStepOptions;
196
- };
197
- /**
198
- * CDN Files Step
199
- */
200
- /**
201
- * Files Write
202
- */
203
- type WorkflowFilesWriteFile = {
204
- path: string;
205
- content: string;
206
- };
207
- type WorkflowFilesWriteStepOptions = {
208
- apiKey: string;
209
- version: string;
210
- files: WorkflowFilesWriteFile[];
211
- };
212
- type WorkflowStepFilesWrite = WorkflowStepBase & {
213
- type: 'files-write';
214
- options: WorkflowFilesWriteStepOptions;
215
- };
216
- /**
217
- * Files Read
218
- */
219
- type WorkflowFilesReadFile = {
220
- key: string;
221
- path: string;
222
- };
223
- type WorkflowFilesReadStepOptions = {
224
- apiKey: string;
225
- version: string;
226
- files: WorkflowFilesReadFile[];
227
- };
228
- type WorkflowStepFilesRead = WorkflowStepBase & {
229
- type: 'files-read';
230
- options: WorkflowFilesReadStepOptions;
231
- };
232
- /**
233
- * S3 Read
234
- */
235
- type WorkflowS3ReadFile = {
236
- key: string;
237
- path: string;
238
- };
239
- type WorkflowS3StepAuth = {
240
- accessKeyId: string;
241
- secretAccessKey: string;
242
- region: string;
243
- };
244
- type WorkflowS3ReadStepOptions = {
245
- auth: WorkflowS3StepAuth;
246
- bucket: string;
247
- files: WorkflowS3ReadFile[];
248
- };
249
- type WorkflowStepS3Read = WorkflowStepBase & {
250
- type: 's3-read';
251
- options: WorkflowS3ReadStepOptions;
252
- };
253
- /**
254
- * S3 Write
255
- */
256
- type WorkflowS3WriteFile = {
257
- path: string;
258
- content: string;
259
- };
260
- type WorkflowS3WriteStepOptions = {
261
- auth: WorkflowS3StepAuth;
262
- bucket: string;
263
- files: WorkflowS3WriteFile[];
264
- };
265
- type WorkflowStepS3Write = WorkflowStepBase & {
266
- type: 's3-write';
267
- options: WorkflowS3WriteStepOptions;
268
- };
269
- /**
270
- * Data Mapping Step
271
- */
272
- type WorkflowDataMappingType = 'manual' | 'model';
273
- type WorkflowStepDataMappingAttributeMap = {
274
- origin: string;
275
- target: string;
276
- };
277
- type WorkflowStepDataMappingOptionBase = {
278
- input: {
279
- data: any[];
280
- };
281
- output: {
282
- variable: string;
283
- };
284
- };
285
- type WorkflowStepDataMappingManual = WorkflowStepDataMappingOptionBase & {
286
- type: 'manual';
287
- mappings: WorkflowStepDataMappingAttributeMap[];
288
- };
289
- type WorkflowStepDataMappingModel = WorkflowStepDataMappingOptionBase & {
290
- type: 'model';
291
- model: ModelDefinition;
292
- };
293
- type WorkflowStepDataMappingOptions = WorkflowStepDataMappingModel | WorkflowStepDataMappingManual;
294
- type WorkflowStepDataMapping = WorkflowStepBase & {
295
- type: 'data-mapping';
296
- options: WorkflowStepDataMappingOptions;
297
- };
298
103
  export import StepDcuplFiles = _WorkflowStepDcuplFiles;
299
104
  export import StepS3Files = _WorkflowStepS3Files;
300
105
  export import StepGitFiles = _WorkflowStepGitFiles;
301
- type WorkflowStep = StepDcuplFiles.Step | StepS3Files.Step | StepGitFiles.Step | WorkflowStepRequest | WorkflowStepScript | WorkflowStepGitPush | WorkflowStepGitPull | WorkflowStepDcuplInstance | WorkflowStepFilesWrite | WorkflowStepFilesRead | WorkflowStepS3Read | WorkflowStepDataMapping | WorkflowStepS3Write;
106
+ export import StepScript = _WorkflowStepScript;
107
+ export import StepRequest = _WorkflowStepRequest;
108
+ export import StepInstance = _WorkflowStepInstance;
109
+ export import StepDataMapper = _WorkflowStepDataMapper;
110
+ type WorkflowStep = StepDcuplFiles.Step | StepS3Files.Step | StepGitFiles.Step | StepScript.Step | StepRequest.Step | StepInstance.Step | StepDataMapper.Step;
302
111
  /**
303
112
  * Server Config
304
113
  */
@@ -316,35 +125,53 @@ export declare namespace Workflow {
316
125
  type WorkflowRuntime = {
317
126
  workflowTimeout: number;
318
127
  scriptTimeout: number;
128
+ instanceScriptTimeout: number;
319
129
  requestTimeout: number;
320
130
  max_heap_size: number;
321
131
  scriptWorkers: number;
322
132
  workflowWorkers: number;
323
133
  };
324
- type WorkflowStepResultStatus = 'processing' | 'success' | 'error';
325
- type WorkflowStepResult = {
134
+ type StepResultType = 'value' | 'context';
135
+ type StepResultBase = {
136
+ error?: string;
137
+ };
138
+ type StepResultValueBase<T = any> = StepResultBase & {
139
+ type: 'value';
140
+ value?: T;
141
+ };
142
+ type StepResultContextBase = StepResultBase & {
143
+ type: 'context';
144
+ context?: RunContext;
145
+ };
146
+ type StepResult = StepResultValueBase | StepResultContextBase;
147
+ type WorkflowStepResultStatus = 'processing' | 'completed' | 'failed';
148
+ type WorkflowStepResult<Result = any> = {
326
149
  key: string;
327
150
  status: WorkflowStepResultStatus;
328
- result: any;
151
+ result?: Result;
152
+ error?: any;
329
153
  start: number;
330
154
  end: number;
155
+ duration: number;
331
156
  };
332
157
  type WorkflowContext = {
333
158
  runContext: RunContext;
334
159
  stepResults: WorkflowStepResult[];
335
160
  };
336
161
  type SimpleRequestObject = {
337
- body: any;
338
- params: any;
339
- query: any;
340
162
  method: string;
341
- headers: any;
163
+ body?: any;
164
+ params?: any;
165
+ query?: any;
166
+ headers?: any;
342
167
  };
343
168
  type RunContext = {
344
- runId: string;
169
+ run: {
170
+ id: string;
171
+ };
345
172
  workflow: Workflow.Workflow;
346
173
  request: SimpleRequestObject;
347
- variables: Record<string, any>;
174
+ variables?: Record<string, any>;
348
175
  [key: string]: any;
349
176
  };
350
177
  /**
@@ -419,8 +246,9 @@ export declare namespace Workflow {
419
246
  start: number;
420
247
  end: number;
421
248
  duration: number;
422
- startedAt: Date;
249
+ startedAt: Date | string;
423
250
  context?: Workflow.WorkflowContext;
251
+ result?: any;
424
252
  };
425
253
  type LogStatistics = {
426
254
  count: number;
@@ -437,7 +265,7 @@ export declare namespace Workflow {
437
265
  runId: string;
438
266
  status: WorkflowStatus;
439
267
  duration: number;
440
- startedAt: Date;
268
+ startedAt: string | Date;
441
269
  };
442
270
  type RunLogSummary = LogStatistics & {
443
271
  runs: RunLogSummaryRun[];
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.types.js","sourceRoot":"","sources":["../../../../src/types/workflow/workflow.types.ts"],"names":[],"mappings":"AAQA,MAAM,KAAW,QAAQ,CA+jBxB;AA/jBD,WAAiB,QAAQ;AA+jBzB,CAAC,EA/jBgB,QAAQ,KAAR,QAAQ,QA+jBxB"}
1
+ {"version":3,"file":"workflow.types.js","sourceRoot":"","sources":["../../../../src/types/workflow/workflow.types.ts"],"names":[],"mappings":"AAQA,MAAM,KAAW,QAAQ,CA6VxB;AA7VD,WAAiB,QAAQ;AA6VzB,CAAC,EA7VgB,QAAQ,KAAR,QAAQ,QA6VxB"}