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