@reeve-iot/workflow-client 0.0.0-stage → 1.1.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/LICENSE +21 -0
- package/README.md +84 -2
- package/dist/client.d.ts +67 -0
- package/dist/client.js +85 -0
- package/dist/generate.d.ts +34 -0
- package/dist/generate.js +140 -0
- package/dist/generated/editor.d.ts +270 -0
- package/dist/generated/editor.js +13 -0
- package/dist/generated/types.d.ts +494 -0
- package/dist/generated/types.js +16 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/surface.d.ts +41 -0
- package/dist/surface.js +19 -0
- package/package.json +47 -4
- package/surface.editor.json +979 -0
- package/surface.json +1450 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
export interface BlockConfigFieldResponse {
|
|
2
|
+
readonly allowedValues: ReadonlyArray<string> | null;
|
|
3
|
+
readonly defaultValue: string | null;
|
|
4
|
+
readonly description: string | null;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly required: boolean;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BlockPortResponse {
|
|
11
|
+
readonly allowedValues: ReadonlyArray<string> | null;
|
|
12
|
+
readonly displayName: string;
|
|
13
|
+
readonly isRequired: boolean;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly scopeVariables: ReadonlyArray<BlockScopeVariableResponse>;
|
|
16
|
+
readonly secretValues: boolean;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
}
|
|
19
|
+
export interface BlockScopeVariableResponse {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly type: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BlockTypeParameterResponse {
|
|
24
|
+
readonly constraints: ReadonlyArray<string>;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CanvasPathSegment {
|
|
28
|
+
readonly branchName: string;
|
|
29
|
+
readonly nodeId: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CompilationDiagnostic {
|
|
32
|
+
readonly blockSource: string | null;
|
|
33
|
+
readonly canvasPath: ReadonlyArray<CanvasPathSegment>;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
readonly nodeId: string | null;
|
|
36
|
+
readonly portName: string | null;
|
|
37
|
+
readonly ruleId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CompilationProblemDetails {
|
|
40
|
+
readonly code: string | null;
|
|
41
|
+
readonly detail: string;
|
|
42
|
+
readonly diagnostics: ReadonlyArray<CompilationDiagnostic>;
|
|
43
|
+
readonly status: number;
|
|
44
|
+
readonly title: string;
|
|
45
|
+
readonly type: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ExecuteWorkflowRequest {
|
|
48
|
+
readonly debugMode: boolean;
|
|
49
|
+
readonly inputParameters: Readonly<Record<string, unknown>> | null;
|
|
50
|
+
}
|
|
51
|
+
export interface ExpressionPreviewErrorDto {
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly position: number;
|
|
54
|
+
readonly ruleId: string | null;
|
|
55
|
+
readonly suggestion: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface ExpressionPreviewRequest {
|
|
58
|
+
readonly contextScope: string | null;
|
|
59
|
+
readonly expression: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ExpressionPreviewResponse {
|
|
62
|
+
readonly elapsedMicroseconds: number;
|
|
63
|
+
readonly error: ExpressionPreviewErrorDto | null;
|
|
64
|
+
readonly ok: boolean;
|
|
65
|
+
readonly type: string | null;
|
|
66
|
+
readonly value: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface PagedWorkflowExecutionsResponse {
|
|
69
|
+
readonly items: ReadonlyArray<WorkflowExecutionResponse>;
|
|
70
|
+
readonly skip: number;
|
|
71
|
+
readonly take: number;
|
|
72
|
+
readonly totalCount: number;
|
|
73
|
+
}
|
|
74
|
+
export interface ProblemDetails {
|
|
75
|
+
readonly detail: string | null;
|
|
76
|
+
readonly instance: string | null;
|
|
77
|
+
readonly status: number | null;
|
|
78
|
+
readonly title: string | null;
|
|
79
|
+
readonly type: string | null;
|
|
80
|
+
}
|
|
81
|
+
export interface WorkflowBlockTypeResponse {
|
|
82
|
+
readonly blockTypeId: string;
|
|
83
|
+
readonly category: string;
|
|
84
|
+
readonly configurationSchema: ReadonlyArray<BlockConfigFieldResponse>;
|
|
85
|
+
readonly declaredOutputsCollect: boolean;
|
|
86
|
+
readonly description: string;
|
|
87
|
+
readonly displayName: string;
|
|
88
|
+
readonly hasDynamicPorts: boolean;
|
|
89
|
+
readonly inputs: ReadonlyArray<BlockPortResponse>;
|
|
90
|
+
readonly outputs: ReadonlyArray<BlockPortResponse>;
|
|
91
|
+
readonly runsWorkflowFrom: string | null;
|
|
92
|
+
readonly subCanvasInputs: Readonly<Record<string, ReadonlyArray<BlockPortResponse>>>;
|
|
93
|
+
readonly subCanvasNames: ReadonlyArray<string>;
|
|
94
|
+
readonly subCanvasOutputs: Readonly<Record<string, ReadonlyArray<BlockPortResponse>>>;
|
|
95
|
+
readonly supportsDeclaredOutputs: boolean;
|
|
96
|
+
readonly typeParameters: ReadonlyArray<BlockTypeParameterResponse>;
|
|
97
|
+
}
|
|
98
|
+
export interface WorkflowConcurrencyConflictResponse {
|
|
99
|
+
readonly message: string;
|
|
100
|
+
readonly mode: string;
|
|
101
|
+
readonly outcome: string;
|
|
102
|
+
readonly workflowId: string;
|
|
103
|
+
}
|
|
104
|
+
export interface WorkflowDiffCanvas {
|
|
105
|
+
readonly canvasPath: ReadonlyArray<WorkflowDiffCanvasStep>;
|
|
106
|
+
readonly changedFields: ReadonlyArray<string>;
|
|
107
|
+
}
|
|
108
|
+
export interface WorkflowDiffCanvasStep {
|
|
109
|
+
readonly nodeId: string;
|
|
110
|
+
readonly subCanvas: string;
|
|
111
|
+
}
|
|
112
|
+
export interface WorkflowDiffEdge {
|
|
113
|
+
readonly canvasPath: ReadonlyArray<WorkflowDiffCanvasStep>;
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly mappingsJson: string;
|
|
116
|
+
readonly sourceNodeId: string;
|
|
117
|
+
readonly targetNodeId: string;
|
|
118
|
+
}
|
|
119
|
+
export interface WorkflowDiffModifiedNode {
|
|
120
|
+
readonly canvasPath: ReadonlyArray<WorkflowDiffCanvasStep>;
|
|
121
|
+
readonly changedFields: ReadonlyArray<string>;
|
|
122
|
+
readonly configChanges: Readonly<Record<string, WorkflowDiffValueChange>>;
|
|
123
|
+
readonly errorPolicyChanged: boolean;
|
|
124
|
+
readonly id: string;
|
|
125
|
+
readonly retryPolicyChanged: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface WorkflowDiffNode {
|
|
128
|
+
readonly blockTypeId: string;
|
|
129
|
+
readonly canvasPath: ReadonlyArray<WorkflowDiffCanvasStep>;
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly name: string;
|
|
132
|
+
}
|
|
133
|
+
export interface WorkflowDiffParameters {
|
|
134
|
+
readonly added: ReadonlyArray<string>;
|
|
135
|
+
readonly modified: ReadonlyArray<string>;
|
|
136
|
+
readonly removed: ReadonlyArray<string>;
|
|
137
|
+
}
|
|
138
|
+
export interface WorkflowDiffResponse {
|
|
139
|
+
readonly addedEdges: ReadonlyArray<WorkflowDiffEdge>;
|
|
140
|
+
readonly addedNodes: ReadonlyArray<WorkflowDiffNode>;
|
|
141
|
+
readonly modifiedCanvases: ReadonlyArray<WorkflowDiffCanvas>;
|
|
142
|
+
readonly modifiedNodes: ReadonlyArray<WorkflowDiffModifiedNode>;
|
|
143
|
+
readonly outputParameterChanges: WorkflowDiffParameters;
|
|
144
|
+
readonly parameterChanges: WorkflowDiffParameters;
|
|
145
|
+
readonly removedEdges: ReadonlyArray<WorkflowDiffEdge>;
|
|
146
|
+
readonly removedNodes: ReadonlyArray<WorkflowDiffNode>;
|
|
147
|
+
}
|
|
148
|
+
export interface WorkflowDiffValueChange {
|
|
149
|
+
readonly from: unknown;
|
|
150
|
+
readonly to: unknown;
|
|
151
|
+
}
|
|
152
|
+
export interface WorkflowDroppedSecret {
|
|
153
|
+
readonly canvasPath: string;
|
|
154
|
+
readonly edgeId: string | null;
|
|
155
|
+
readonly input: string;
|
|
156
|
+
readonly key: string;
|
|
157
|
+
readonly nodeId: string;
|
|
158
|
+
readonly reason: string;
|
|
159
|
+
}
|
|
160
|
+
export interface WorkflowExecutionDetailResponse {
|
|
161
|
+
readonly automationId: string | null;
|
|
162
|
+
readonly completedAtUtc: string | null;
|
|
163
|
+
readonly durationMs: number | null;
|
|
164
|
+
readonly entries: ReadonlyArray<WorkflowExecutionLogEntryResponse>;
|
|
165
|
+
readonly errorMessage: string | null;
|
|
166
|
+
readonly failureReason: string | null;
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly outputsJson: string | null;
|
|
169
|
+
readonly startedAtUtc: string;
|
|
170
|
+
readonly status: string;
|
|
171
|
+
readonly steps: ReadonlyArray<WorkflowExecutionStepResponse>;
|
|
172
|
+
readonly triggerId: string | null;
|
|
173
|
+
readonly workflowId: string;
|
|
174
|
+
}
|
|
175
|
+
export interface WorkflowExecutionLogEntryResponse {
|
|
176
|
+
readonly blockTypeId: string;
|
|
177
|
+
readonly callStackJson: string | null;
|
|
178
|
+
readonly dataJson: string | null;
|
|
179
|
+
readonly id: string;
|
|
180
|
+
readonly iterationIndex: number | null;
|
|
181
|
+
readonly level: string;
|
|
182
|
+
readonly message: string;
|
|
183
|
+
readonly nodeId: string;
|
|
184
|
+
readonly timestamp: string;
|
|
185
|
+
}
|
|
186
|
+
export interface WorkflowExecutionResponse {
|
|
187
|
+
readonly automationId: string | null;
|
|
188
|
+
readonly completedAtUtc: string | null;
|
|
189
|
+
readonly durationMs: number | null;
|
|
190
|
+
readonly errorMessage: string | null;
|
|
191
|
+
readonly failureReason: string | null;
|
|
192
|
+
readonly id: string;
|
|
193
|
+
readonly startedAtUtc: string;
|
|
194
|
+
readonly status: string;
|
|
195
|
+
readonly triggerId: string | null;
|
|
196
|
+
readonly workflowId: string;
|
|
197
|
+
}
|
|
198
|
+
export interface WorkflowExecutionStepResponse {
|
|
199
|
+
readonly durationMs: number;
|
|
200
|
+
readonly endedAt: string;
|
|
201
|
+
readonly errorJson: string | null;
|
|
202
|
+
readonly errorMessage: string | null;
|
|
203
|
+
readonly errorStackTrace: string | null;
|
|
204
|
+
readonly id: string;
|
|
205
|
+
readonly inputsJson: string | null;
|
|
206
|
+
readonly nodeId: string;
|
|
207
|
+
readonly nodeType: string;
|
|
208
|
+
readonly outputsJson: string | null;
|
|
209
|
+
readonly sortOrder: number;
|
|
210
|
+
readonly startedAt: string;
|
|
211
|
+
readonly status: string;
|
|
212
|
+
}
|
|
213
|
+
export interface WorkflowExportDto {
|
|
214
|
+
readonly checkpointPolicyJson: string | null;
|
|
215
|
+
readonly definitionJson: string | null;
|
|
216
|
+
readonly description: string | null;
|
|
217
|
+
readonly executionTimeoutSeconds: number | null;
|
|
218
|
+
readonly exportedAtUtc: string;
|
|
219
|
+
readonly inputParametersJson: string | null;
|
|
220
|
+
readonly maxConcurrentRuns: number | null;
|
|
221
|
+
readonly maxQueuedRuns: number | null;
|
|
222
|
+
readonly mode: string | null;
|
|
223
|
+
readonly name: string;
|
|
224
|
+
readonly outputParametersJson: string | null;
|
|
225
|
+
readonly overflowBehavior: string | null;
|
|
226
|
+
readonly retryPolicyJson: string | null;
|
|
227
|
+
readonly schemaVersion: string;
|
|
228
|
+
}
|
|
229
|
+
export interface WorkflowImportValidationResult {
|
|
230
|
+
readonly definitionJson: string;
|
|
231
|
+
readonly droppedSecrets: ReadonlyArray<WorkflowDroppedSecret>;
|
|
232
|
+
readonly inputParametersJson: string | null;
|
|
233
|
+
readonly missingBlockTypeIds: ReadonlyArray<string>;
|
|
234
|
+
readonly missingWorkflowIds: ReadonlyArray<string>;
|
|
235
|
+
readonly outputParametersJson: string | null;
|
|
236
|
+
readonly referenceIdsByPortType: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
237
|
+
}
|
|
238
|
+
export interface WorkflowResponse {
|
|
239
|
+
readonly checkpointPolicyJson: string | null;
|
|
240
|
+
readonly createdAtUtc: string;
|
|
241
|
+
readonly createdByUserId: string;
|
|
242
|
+
readonly currentVersionId: string | null;
|
|
243
|
+
readonly currentVersionNumber: number | null;
|
|
244
|
+
readonly definitionJson: string;
|
|
245
|
+
readonly description: string | null;
|
|
246
|
+
readonly documentsFrom: string | null;
|
|
247
|
+
readonly draftVersionId: string | null;
|
|
248
|
+
readonly draftVersionNumber: number | null;
|
|
249
|
+
readonly executionTimeoutSeconds: number | null;
|
|
250
|
+
readonly hasImportWarnings: boolean;
|
|
251
|
+
readonly hostMetadata: Readonly<Record<string, string>> | null;
|
|
252
|
+
readonly id: string;
|
|
253
|
+
readonly importWarningsJson: string | null;
|
|
254
|
+
readonly inputParametersJson: string | null;
|
|
255
|
+
readonly maxConcurrentRuns: number;
|
|
256
|
+
readonly maxQueuedRuns: number;
|
|
257
|
+
readonly mode: string;
|
|
258
|
+
readonly name: string;
|
|
259
|
+
readonly outputParametersJson: string | null;
|
|
260
|
+
readonly overflowBehavior: string;
|
|
261
|
+
readonly retryPolicyJson: string | null;
|
|
262
|
+
readonly revision: number;
|
|
263
|
+
readonly updatedAtUtc: string;
|
|
264
|
+
}
|
|
265
|
+
export interface WorkflowSummaryResponse {
|
|
266
|
+
readonly currentVersionNumber: number | null;
|
|
267
|
+
readonly description: string | null;
|
|
268
|
+
readonly executionCount: number;
|
|
269
|
+
readonly hasImportWarnings: boolean;
|
|
270
|
+
readonly hasInputParameters: boolean;
|
|
271
|
+
readonly hasOutputParameters: boolean;
|
|
272
|
+
readonly hasUnpublishedChanges: boolean;
|
|
273
|
+
readonly hostMetadata: Readonly<Record<string, string>> | null;
|
|
274
|
+
readonly id: string;
|
|
275
|
+
readonly importWarningsJson: string | null;
|
|
276
|
+
readonly lastExecutedAtUtc: string | null;
|
|
277
|
+
readonly lastExecutionStatus: string | null;
|
|
278
|
+
readonly name: string;
|
|
279
|
+
readonly updatedAtUtc: string;
|
|
280
|
+
}
|
|
281
|
+
export interface WorkflowVersionResponse {
|
|
282
|
+
readonly changeMessage: string | null;
|
|
283
|
+
readonly createdAtUtc: string;
|
|
284
|
+
readonly createdByUserId: string;
|
|
285
|
+
readonly definitionJson: string;
|
|
286
|
+
readonly id: string;
|
|
287
|
+
readonly inputParametersJson: string | null;
|
|
288
|
+
readonly isPublished: boolean;
|
|
289
|
+
readonly outputParametersJson: string | null;
|
|
290
|
+
readonly publishedAtUtc: string | null;
|
|
291
|
+
readonly versionNumber: number;
|
|
292
|
+
readonly workflowId: string;
|
|
293
|
+
}
|
|
294
|
+
export interface WorkflowVersionSummaryResponse {
|
|
295
|
+
readonly changeMessage: string | null;
|
|
296
|
+
readonly createdAtUtc: string;
|
|
297
|
+
readonly createdByUserId: string;
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly isPublished: boolean;
|
|
300
|
+
readonly publishedAtUtc: string | null;
|
|
301
|
+
readonly versionNumber: number;
|
|
302
|
+
}
|
|
303
|
+
export interface WorkflowOperations {
|
|
304
|
+
readonly previewExpression: {
|
|
305
|
+
readonly method: 'POST';
|
|
306
|
+
readonly path: '/api/expressions/preview';
|
|
307
|
+
readonly query: never;
|
|
308
|
+
readonly args: {
|
|
309
|
+
readonly body: ExpressionPreviewRequest;
|
|
310
|
+
};
|
|
311
|
+
readonly result: ExpressionPreviewResponse;
|
|
312
|
+
};
|
|
313
|
+
readonly getBlockTypes: {
|
|
314
|
+
readonly method: 'GET';
|
|
315
|
+
readonly path: '/api/workflow-blocks';
|
|
316
|
+
readonly query: never;
|
|
317
|
+
readonly args: Record<never, never>;
|
|
318
|
+
readonly result: ReadonlyArray<WorkflowBlockTypeResponse>;
|
|
319
|
+
};
|
|
320
|
+
readonly getWorkflows: {
|
|
321
|
+
readonly method: 'GET';
|
|
322
|
+
readonly path: '/api/workflows';
|
|
323
|
+
readonly query: never;
|
|
324
|
+
readonly args: Record<never, never>;
|
|
325
|
+
readonly result: ReadonlyArray<WorkflowSummaryResponse>;
|
|
326
|
+
};
|
|
327
|
+
readonly validateImport: {
|
|
328
|
+
readonly method: 'POST';
|
|
329
|
+
readonly path: '/api/workflows/import/validate';
|
|
330
|
+
readonly query: never;
|
|
331
|
+
readonly args: {
|
|
332
|
+
readonly body: WorkflowExportDto;
|
|
333
|
+
};
|
|
334
|
+
readonly result: WorkflowImportValidationResult;
|
|
335
|
+
};
|
|
336
|
+
readonly getWorkflow: {
|
|
337
|
+
readonly method: 'GET';
|
|
338
|
+
readonly path: '/api/workflows/{id}';
|
|
339
|
+
readonly query: never;
|
|
340
|
+
readonly args: {
|
|
341
|
+
readonly id: string;
|
|
342
|
+
};
|
|
343
|
+
readonly result: WorkflowResponse;
|
|
344
|
+
};
|
|
345
|
+
readonly executeWorkflow: {
|
|
346
|
+
readonly method: 'POST';
|
|
347
|
+
readonly path: '/api/workflows/{id}/execute';
|
|
348
|
+
readonly query: never;
|
|
349
|
+
readonly args: {
|
|
350
|
+
readonly id: string;
|
|
351
|
+
readonly body?: ExecuteWorkflowRequest;
|
|
352
|
+
};
|
|
353
|
+
readonly result: Readonly<Record<string, unknown>>;
|
|
354
|
+
};
|
|
355
|
+
readonly getExecutions: {
|
|
356
|
+
readonly method: 'GET';
|
|
357
|
+
readonly path: '/api/workflows/{id}/executions';
|
|
358
|
+
readonly query: 'hasErrors' | 'skip' | 'status' | 'take';
|
|
359
|
+
readonly args: {
|
|
360
|
+
readonly id: string;
|
|
361
|
+
readonly hasErrors?: boolean | null;
|
|
362
|
+
readonly skip?: number;
|
|
363
|
+
readonly status?: string | null;
|
|
364
|
+
readonly take?: number;
|
|
365
|
+
};
|
|
366
|
+
readonly result: PagedWorkflowExecutionsResponse;
|
|
367
|
+
};
|
|
368
|
+
readonly getExecution: {
|
|
369
|
+
readonly method: 'GET';
|
|
370
|
+
readonly path: '/api/workflows/{id}/executions/{executionId}';
|
|
371
|
+
readonly query: never;
|
|
372
|
+
readonly args: {
|
|
373
|
+
readonly executionId: string;
|
|
374
|
+
readonly id: string;
|
|
375
|
+
};
|
|
376
|
+
readonly result: WorkflowExecutionDetailResponse;
|
|
377
|
+
};
|
|
378
|
+
readonly getExecutionReplay: {
|
|
379
|
+
readonly method: 'GET';
|
|
380
|
+
readonly path: '/api/workflows/{id}/executions/{executionId}/replay';
|
|
381
|
+
readonly query: never;
|
|
382
|
+
readonly args: {
|
|
383
|
+
readonly executionId: string;
|
|
384
|
+
readonly id: string;
|
|
385
|
+
};
|
|
386
|
+
readonly result: ReadonlyArray<WorkflowExecutionStepResponse>;
|
|
387
|
+
};
|
|
388
|
+
readonly getVersions: {
|
|
389
|
+
readonly method: 'GET';
|
|
390
|
+
readonly path: '/api/workflows/{id}/versions';
|
|
391
|
+
readonly query: 'page' | 'pageSize';
|
|
392
|
+
readonly args: {
|
|
393
|
+
readonly id: string;
|
|
394
|
+
readonly page?: number;
|
|
395
|
+
readonly pageSize?: number;
|
|
396
|
+
};
|
|
397
|
+
readonly result: ReadonlyArray<WorkflowVersionSummaryResponse>;
|
|
398
|
+
};
|
|
399
|
+
readonly diffVersions: {
|
|
400
|
+
readonly method: 'GET';
|
|
401
|
+
readonly path: '/api/workflows/{id}/versions/{versionA}/diff/{versionB}';
|
|
402
|
+
readonly query: never;
|
|
403
|
+
readonly args: {
|
|
404
|
+
readonly id: string;
|
|
405
|
+
readonly versionA: number;
|
|
406
|
+
readonly versionB: number;
|
|
407
|
+
};
|
|
408
|
+
readonly result: WorkflowDiffResponse;
|
|
409
|
+
};
|
|
410
|
+
readonly getVersion: {
|
|
411
|
+
readonly method: 'GET';
|
|
412
|
+
readonly path: '/api/workflows/{id}/versions/{versionNumber}';
|
|
413
|
+
readonly query: never;
|
|
414
|
+
readonly args: {
|
|
415
|
+
readonly id: string;
|
|
416
|
+
readonly versionNumber: number;
|
|
417
|
+
};
|
|
418
|
+
readonly result: WorkflowVersionResponse;
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
export declare const WORKFLOW_ROUTES: {
|
|
422
|
+
readonly previewExpression: {
|
|
423
|
+
readonly method: "POST";
|
|
424
|
+
readonly path: "/api/expressions/preview";
|
|
425
|
+
readonly query: readonly [];
|
|
426
|
+
readonly empty: false;
|
|
427
|
+
};
|
|
428
|
+
readonly getBlockTypes: {
|
|
429
|
+
readonly method: "GET";
|
|
430
|
+
readonly path: "/api/workflow-blocks";
|
|
431
|
+
readonly query: readonly [];
|
|
432
|
+
readonly empty: false;
|
|
433
|
+
};
|
|
434
|
+
readonly getWorkflows: {
|
|
435
|
+
readonly method: "GET";
|
|
436
|
+
readonly path: "/api/workflows";
|
|
437
|
+
readonly query: readonly [];
|
|
438
|
+
readonly empty: false;
|
|
439
|
+
};
|
|
440
|
+
readonly validateImport: {
|
|
441
|
+
readonly method: "POST";
|
|
442
|
+
readonly path: "/api/workflows/import/validate";
|
|
443
|
+
readonly query: readonly [];
|
|
444
|
+
readonly empty: false;
|
|
445
|
+
};
|
|
446
|
+
readonly getWorkflow: {
|
|
447
|
+
readonly method: "GET";
|
|
448
|
+
readonly path: "/api/workflows/{id}";
|
|
449
|
+
readonly query: readonly [];
|
|
450
|
+
readonly empty: false;
|
|
451
|
+
};
|
|
452
|
+
readonly executeWorkflow: {
|
|
453
|
+
readonly method: "POST";
|
|
454
|
+
readonly path: "/api/workflows/{id}/execute";
|
|
455
|
+
readonly query: readonly [];
|
|
456
|
+
readonly empty: false;
|
|
457
|
+
};
|
|
458
|
+
readonly getExecutions: {
|
|
459
|
+
readonly method: "GET";
|
|
460
|
+
readonly path: "/api/workflows/{id}/executions";
|
|
461
|
+
readonly query: readonly ["hasErrors", "skip", "status", "take"];
|
|
462
|
+
readonly empty: false;
|
|
463
|
+
};
|
|
464
|
+
readonly getExecution: {
|
|
465
|
+
readonly method: "GET";
|
|
466
|
+
readonly path: "/api/workflows/{id}/executions/{executionId}";
|
|
467
|
+
readonly query: readonly [];
|
|
468
|
+
readonly empty: false;
|
|
469
|
+
};
|
|
470
|
+
readonly getExecutionReplay: {
|
|
471
|
+
readonly method: "GET";
|
|
472
|
+
readonly path: "/api/workflows/{id}/executions/{executionId}/replay";
|
|
473
|
+
readonly query: readonly [];
|
|
474
|
+
readonly empty: false;
|
|
475
|
+
};
|
|
476
|
+
readonly getVersions: {
|
|
477
|
+
readonly method: "GET";
|
|
478
|
+
readonly path: "/api/workflows/{id}/versions";
|
|
479
|
+
readonly query: readonly ["page", "pageSize"];
|
|
480
|
+
readonly empty: false;
|
|
481
|
+
};
|
|
482
|
+
readonly diffVersions: {
|
|
483
|
+
readonly method: "GET";
|
|
484
|
+
readonly path: "/api/workflows/{id}/versions/{versionA}/diff/{versionB}";
|
|
485
|
+
readonly query: readonly [];
|
|
486
|
+
readonly empty: false;
|
|
487
|
+
};
|
|
488
|
+
readonly getVersion: {
|
|
489
|
+
readonly method: "GET";
|
|
490
|
+
readonly path: "/api/workflows/{id}/versions/{versionNumber}";
|
|
491
|
+
readonly query: readonly [];
|
|
492
|
+
readonly empty: false;
|
|
493
|
+
};
|
|
494
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated from surface.json by generateTypes(). Do not edit by hand.
|
|
2
|
+
// generated.test.ts writes types.ts.actual beside this file when the two disagree.
|
|
3
|
+
export const WORKFLOW_ROUTES = {
|
|
4
|
+
previewExpression: { method: 'POST', path: '/api/expressions/preview', query: [], empty: false },
|
|
5
|
+
getBlockTypes: { method: 'GET', path: '/api/workflow-blocks', query: [], empty: false },
|
|
6
|
+
getWorkflows: { method: 'GET', path: '/api/workflows', query: [], empty: false },
|
|
7
|
+
validateImport: { method: 'POST', path: '/api/workflows/import/validate', query: [], empty: false },
|
|
8
|
+
getWorkflow: { method: 'GET', path: '/api/workflows/{id}', query: [], empty: false },
|
|
9
|
+
executeWorkflow: { method: 'POST', path: '/api/workflows/{id}/execute', query: [], empty: false },
|
|
10
|
+
getExecutions: { method: 'GET', path: '/api/workflows/{id}/executions', query: ['hasErrors', 'skip', 'status', 'take'], empty: false },
|
|
11
|
+
getExecution: { method: 'GET', path: '/api/workflows/{id}/executions/{executionId}', query: [], empty: false },
|
|
12
|
+
getExecutionReplay: { method: 'GET', path: '/api/workflows/{id}/executions/{executionId}/replay', query: [], empty: false },
|
|
13
|
+
getVersions: { method: 'GET', path: '/api/workflows/{id}/versions', query: ['page', 'pageSize'], empty: false },
|
|
14
|
+
diffVersions: { method: 'GET', path: '/api/workflows/{id}/versions/{versionA}/diff/{versionB}', query: [], empty: false },
|
|
15
|
+
getVersion: { method: 'GET', path: '/api/workflows/{id}/versions/{versionNumber}', query: [], empty: false },
|
|
16
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createWorkflowClient, createWorkflowEditorClient, WorkflowApiError } from './client.js';
|
|
2
|
+
export type { ClientOf, WorkflowClient, WorkflowCallOptions, WorkflowClientOptions, WorkflowEditorClient, WorkflowEditorOperationName, WorkflowOperationName, } from './client.js';
|
|
3
|
+
export { generateTypes, successOf, templateOf, translate } from './generate.js';
|
|
4
|
+
export type { GeneratedNames } from './generate.js';
|
|
5
|
+
export { parseSurface, SUPPORTED_FORMAT_VERSION } from './surface.js';
|
|
6
|
+
export type { Surface, SurfaceEndpoint, SurfaceParameter, SurfaceType } from './surface.js';
|
|
7
|
+
export { WORKFLOW_ROUTES } from './generated/types.js';
|
|
8
|
+
export type * from './generated/types.js';
|
|
9
|
+
export { WORKFLOW_EDITOR_ROUTES } from './generated/editor.js';
|
|
10
|
+
export type * from './generated/editor.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createWorkflowClient, createWorkflowEditorClient, WorkflowApiError } from './client.js';
|
|
2
|
+
export { generateTypes, successOf, templateOf, translate } from './generate.js';
|
|
3
|
+
export { parseSurface, SUPPORTED_FORMAT_VERSION } from './surface.js';
|
|
4
|
+
export { WORKFLOW_ROUTES } from './generated/types.js';
|
|
5
|
+
export { WORKFLOW_EDITOR_ROUTES } from './generated/editor.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** The endpoint description the server publishes, as this package reads it. */
|
|
2
|
+
export interface Surface {
|
|
3
|
+
readonly formatVersion: number;
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly endpoints: readonly SurfaceEndpoint[];
|
|
6
|
+
readonly types: readonly SurfaceType[];
|
|
7
|
+
}
|
|
8
|
+
export interface SurfaceEndpoint {
|
|
9
|
+
readonly operation: string;
|
|
10
|
+
readonly method: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly pathParameters: readonly SurfaceParameter[];
|
|
13
|
+
readonly queryParameters: readonly SurfaceParameter[];
|
|
14
|
+
readonly requestBody?: {
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly required: boolean;
|
|
17
|
+
};
|
|
18
|
+
readonly responses: readonly {
|
|
19
|
+
readonly status: number;
|
|
20
|
+
readonly type?: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export interface SurfaceParameter {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly type: string;
|
|
26
|
+
readonly required: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface SurfaceType {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly properties: readonly {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly type: string;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
/** The format this package knows how to read. A document that predates it describes something else. */
|
|
36
|
+
export declare const SUPPORTED_FORMAT_VERSION = 1;
|
|
37
|
+
/**
|
|
38
|
+
* Reads an unvalidated document as a `Surface`, refusing anything that is not one. The generator is fed
|
|
39
|
+
* from a file written by another repository, so the shape has to be established before it is trusted.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseSurface(document: unknown): Surface;
|
package/dist/surface.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The format this package knows how to read. A document that predates it describes something else. */
|
|
2
|
+
export const SUPPORTED_FORMAT_VERSION = 1;
|
|
3
|
+
/**
|
|
4
|
+
* Reads an unvalidated document as a `Surface`, refusing anything that is not one. The generator is fed
|
|
5
|
+
* from a file written by another repository, so the shape has to be established before it is trusted.
|
|
6
|
+
*/
|
|
7
|
+
export function parseSurface(document) {
|
|
8
|
+
const surface = document;
|
|
9
|
+
if (typeof surface !== 'object' || surface === null)
|
|
10
|
+
throw new Error('Surface document is not an object');
|
|
11
|
+
if (surface.formatVersion !== SUPPORTED_FORMAT_VERSION)
|
|
12
|
+
throw new Error(`Surface format ${String(surface.formatVersion)} is not ${SUPPORTED_FORMAT_VERSION}; ` +
|
|
13
|
+
'this generator would read fields that may have changed meaning');
|
|
14
|
+
if (!Array.isArray(surface.endpoints) || surface.endpoints.length === 0)
|
|
15
|
+
throw new Error('Surface document declares no endpoints');
|
|
16
|
+
if (!Array.isArray(surface.types))
|
|
17
|
+
throw new Error('Surface document declares no types');
|
|
18
|
+
return surface;
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reeve-iot/workflow-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Typed HTTP client for the ReeveWorkflow endpoint surface. Generated from the surface the server publishes, so a signature change is a build error.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./surface.json": "./surface.json",
|
|
16
|
+
"./surface.editor.json": "./surface.editor.json",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"surface.json",
|
|
22
|
+
"surface.editor.json",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/reeve-iot/reeve-workflow.git",
|
|
29
|
+
"directory": "packages/client"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/reeve-iot/reeve-workflow/tree/main/packages/client#readme",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/reeve-iot/reeve-workflow/issues"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"workflow",
|
|
37
|
+
"client",
|
|
38
|
+
"http",
|
|
39
|
+
"typed",
|
|
40
|
+
"codegen"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -b",
|
|
44
|
+
"typecheck": "tsc -b"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|