@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.4
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/dist/browser/DesignerIcon-DdfuH2jW.js +2066 -0
- package/dist/browser/createResourceDialog-4YQKl8lG.js +505 -0
- package/dist/browser/{esm-C2UUqIUP.js → esm-C9jQK70n.js} +1 -1
- package/dist/browser/flow-authoring-node.d.ts +3 -0
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +66 -46
- package/dist/browser/flow-change.d.ts +14 -1
- package/dist/browser/flow-notifications.d.ts +5 -0
- package/dist/browser/{diagnostics-SDCyFuxm.js → flowChanges-Bs-ZcJV8.js} +3963 -3591
- package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-BYa8zFLC.js} +1 -1
- package/dist/browser/{flowWorkspace-BZ_eiQNR.js → flowWorkspace-BewofPeU.js} +35223 -35041
- package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-qDxSDwzN.js} +1813 -2328
- package/dist/browser/icons-DRoMXL5h.js +521 -0
- package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-CwMPjseS.js} +1 -1
- package/dist/browser/waitNotificationInputs-DtrPBwA1.js +26 -0
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +1 -0
- package/dist/browser/workbench.js +611 -536
- package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-CX8KtT7L.js} +483 -482
- package/dist/common/control-api-conformance.d.ts +1 -0
- package/dist/common/control-api-conformance.js +59 -0
- package/dist/common/control-api-errors.d.ts +4 -0
- package/dist/common/control-api.d.ts +22 -3
- package/dist/common/control-api.js +134 -73
- package/dist/common/flow-encoding.js +20 -8
- package/dist/common/flow-notifications.d.ts +5 -0
- package/dist/common/flow-semantics.d.ts +1 -0
- package/dist/common/flow-semantics.js +467 -381
- package/dist/common/run-events.js +2 -1
- package/dist/common/run-lifecycle.d.ts +17 -2
- package/dist/common/run-lifecycle.js +53 -2
- package/dist/common/scheduler.d.ts +64 -3
- package/dist/common/scheduler.js +417 -142
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/browser/createResourceDialog-BkZns-oZ.js +0 -504
|
@@ -5,6 +5,7 @@ export interface ControlApiConformanceHarness {
|
|
|
5
5
|
}
|
|
6
6
|
export interface ControlApiConformanceCase {
|
|
7
7
|
readonly name: string;
|
|
8
|
+
readonly runtime?: true;
|
|
8
9
|
verify(harness: ControlApiConformanceHarness): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
export declare const controlApiConformanceCases: readonly ControlApiConformanceCase[];
|
|
@@ -290,6 +290,65 @@ var b = [
|
|
|
290
290
|
}), 200, "Cancel second Draft Run")).status, "canceled", "Second canceled Run status");
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
+
{
|
|
294
|
+
name: "pauses, resolves, resumes, and cancels waiting Draft Runs",
|
|
295
|
+
runtime: !0,
|
|
296
|
+
async verify(e) {
|
|
297
|
+
let t = await f(e, "Wait flow", "wait-flow"), d = s(t.flowId, "Wait Flow flowId"), m = `/v1/flows/${d}/revisions/${h(await c(await p(e, d, s(t.draftRevisionId, "Wait Flow revisionId"), [{
|
|
298
|
+
kind: "graph.node.create",
|
|
299
|
+
node: {
|
|
300
|
+
actions: ["approve", "reject"],
|
|
301
|
+
concurrency: 1,
|
|
302
|
+
inputs: { value: {
|
|
303
|
+
kind: "value",
|
|
304
|
+
value: { request: 1 }
|
|
305
|
+
} },
|
|
306
|
+
kind: "wait",
|
|
307
|
+
prompt: "Approve request 1?"
|
|
308
|
+
},
|
|
309
|
+
nodeId: "approval",
|
|
310
|
+
target: { kind: "flow" }
|
|
311
|
+
}]), 200, "Create Wait"), "Wait Revision")}/runs`, g = async (t, r) => c(await u(e, m, {
|
|
312
|
+
body: JSON.stringify({
|
|
313
|
+
engineContract: n,
|
|
314
|
+
inputs: {},
|
|
315
|
+
version: 1
|
|
316
|
+
}),
|
|
317
|
+
headers: { "idempotency-key": t },
|
|
318
|
+
method: "POST"
|
|
319
|
+
}), 202, r), _ = await g("wait-run", "Create Wait Run"), v = s(_.runId, "Wait Run runId"), y = _;
|
|
320
|
+
for (let t = 0; y.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), y = await c(await u(e, `/v1/runs/${v}`), 200, "Read Wait Run");
|
|
321
|
+
i(y.status, "waiting", "Wait Run status");
|
|
322
|
+
let b = a(y.waiting, "Active Wait");
|
|
323
|
+
i(b.actions, ["approve", "reject"], "Wait actions"), i(b.nodeId, "approval", "Wait node"), i(b.prompt, "Approve request 1?", "Wait prompt"), s(b.expiresAt, "Wait expiry"), s(b.waitingSince, "Wait start");
|
|
324
|
+
let x = s(b.waitId, "Wait id");
|
|
325
|
+
i(o((await c(await u(e, `/v1/flows/${d}/runs?status=waiting`), 200, "List waiting Runs")).runs, "Waiting Runs").map((e) => a(e, "Waiting Run").runId), [v], "Waiting Run list");
|
|
326
|
+
let S = await c(await u(e, `/v1/runs/${v}/events`), 200, "Read waiting Run events");
|
|
327
|
+
i(S.done, !1, "Waiting events done"), o(S.events, "Waiting events").some((e) => a(e, "Waiting event").kind == "run.waiting") || r("Waiting Run must contain run.waiting."), await l(await u(e, `/v1/runs/${v}/result`), 409, "run.not-terminal", "Read waiting Run result");
|
|
328
|
+
let C = `/v1/runs/${v}/waits/${x}/resolve`, w = (t) => u(e, C, {
|
|
329
|
+
body: JSON.stringify({
|
|
330
|
+
action: t,
|
|
331
|
+
version: 1
|
|
332
|
+
}),
|
|
333
|
+
method: "POST"
|
|
334
|
+
});
|
|
335
|
+
await l(await w("continue"), 400, "run.invalid", "Reject unsupported Wait action");
|
|
336
|
+
let T = await c(await w("approve"), 200, "Approve Wait");
|
|
337
|
+
i(T.action, "approve", "Approved action"), i(T.resolutionAccepted, !0, "Approved resolution"), i(T.status, "queued", "Resolved Run status"), s(T.resolvedAt, "Wait resolution time");
|
|
338
|
+
let E = await c(await w("reject"), 200, "Reject resolved Wait");
|
|
339
|
+
i(E.action, "approve", "Winning action"), i(E.resolutionAccepted, !1, "Competing resolution");
|
|
340
|
+
for (let t = 0; y.status != "completed" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), y = await c(await u(e, `/v1/runs/${v}`), 200, "Read resumed Run");
|
|
341
|
+
i(y.status, "completed", "Resumed Run status"), i(y.waiting, void 0, "Completed Wait projection");
|
|
342
|
+
let D = await c(await w("approve"), 200, "Replay approved Wait");
|
|
343
|
+
i(D.resolutionAccepted, !0, "Replayed resolution"), i(D.status, "completed", "Replayed terminal status"), i(o((await c(await u(e, `/v1/runs/${v}/events`), 200, "Read resumed Run events")).events, "Completed events").filter((e) => a(e, "Completed event").kind == "run.resolved").length, 1, "Resolved event count");
|
|
344
|
+
let O = await g("wait-run-cancel", "Create cancelable Wait Run"), k = s(O.runId, "Cancelable Wait Run id"), A = O;
|
|
345
|
+
for (let t = 0; A.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), A = await c(await u(e, `/v1/runs/${k}`), 200, "Read cancelable Wait Run");
|
|
346
|
+
i(A.status, "waiting", "Cancelable Wait status"), i((await c(await u(e, `/v1/runs/${k}/cancel`, {
|
|
347
|
+
body: JSON.stringify({ version: 1 }),
|
|
348
|
+
method: "POST"
|
|
349
|
+
}), 200, "Cancel waiting Run")).status, "canceled", "Canceled waiting Run status");
|
|
350
|
+
}
|
|
351
|
+
},
|
|
293
352
|
{
|
|
294
353
|
name: "rejects invalid and missing Flow control targets",
|
|
295
354
|
async verify(e) {
|
|
@@ -27,6 +27,7 @@ export declare const controlErrorCode: {
|
|
|
27
27
|
readonly runNotFound: 'run.not-found';
|
|
28
28
|
readonly runNotTerminal: 'run.not-terminal';
|
|
29
29
|
readonly runOverloaded: 'run.overloaded';
|
|
30
|
+
readonly runWaitNotFound: 'run.wait-not-found';
|
|
30
31
|
readonly triggerKeyInvalid: 'trigger-key.invalid';
|
|
31
32
|
readonly triggerKeyNotFound: 'trigger-key.not-found';
|
|
32
33
|
readonly triggerNotFound: 'trigger.not-found';
|
|
@@ -120,6 +121,9 @@ export declare const controlErrorMetadata: {
|
|
|
120
121
|
readonly "run.overloaded": {
|
|
121
122
|
readonly status: 429;
|
|
122
123
|
};
|
|
124
|
+
readonly "run.wait-not-found": {
|
|
125
|
+
readonly status: 404;
|
|
126
|
+
};
|
|
123
127
|
readonly "trigger-key.invalid": {
|
|
124
128
|
readonly status: 409;
|
|
125
129
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RunStatus } from './run-lifecycle.js';
|
|
2
|
-
import type { ChangeOperation, InputPortDefinition, JsonValue, PortDefinition, RevisionContent, TriggerKeySnapshot } from '../browser/flow-change.js';
|
|
3
|
-
export type { JsonValue, TriggerKeySnapshot } from '../browser/flow-change.js';
|
|
2
|
+
import type { ChangeOperation, InputPortDefinition, JsonValue, PortDefinition, RevisionContent, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
|
|
3
|
+
export type { JsonValue, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
|
|
4
4
|
export type { RunStatus } from './run-lifecycle.js';
|
|
5
5
|
export { controlErrorCode, controlErrorMetadata, type ControlErrorCode } from './control-api-errors.js';
|
|
6
6
|
export type { FlowCatalogEvent, FlowChangeEvent } from './flow-notifications.js';
|
|
@@ -83,6 +83,7 @@ export interface ConnectorAction {
|
|
|
83
83
|
readonly authenticated: boolean;
|
|
84
84
|
readonly defaultConnection?: ConnectorConnection;
|
|
85
85
|
readonly description: string;
|
|
86
|
+
readonly homepageUrl?: string;
|
|
86
87
|
readonly icon?: string;
|
|
87
88
|
readonly inputs: Readonly<Record<string, InputPortDefinition>>;
|
|
88
89
|
readonly name: string;
|
|
@@ -91,6 +92,7 @@ export interface ConnectorAction {
|
|
|
91
92
|
readonly serviceName: string;
|
|
92
93
|
}
|
|
93
94
|
export interface ConnectorProvider {
|
|
95
|
+
readonly homepageUrl?: string;
|
|
94
96
|
readonly icon?: string;
|
|
95
97
|
readonly serviceId: string;
|
|
96
98
|
readonly serviceName: string;
|
|
@@ -220,6 +222,14 @@ interface RunDetailsBase extends Run {
|
|
|
220
222
|
readonly eventsExpiresAt?: string;
|
|
221
223
|
readonly modelVersion: number;
|
|
222
224
|
readonly revisionDigest: string;
|
|
225
|
+
readonly waiting?: {
|
|
226
|
+
readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
|
|
227
|
+
readonly expiresAt: string;
|
|
228
|
+
readonly nodeId: string;
|
|
229
|
+
readonly prompt: string;
|
|
230
|
+
readonly waitId: string;
|
|
231
|
+
readonly waitingSince: string;
|
|
232
|
+
};
|
|
223
233
|
}
|
|
224
234
|
export type DraftRun = RunDetailsBase & {
|
|
225
235
|
readonly source: 'draft';
|
|
@@ -241,7 +251,7 @@ export interface RunPage {
|
|
|
241
251
|
readonly runs: readonly Run[];
|
|
242
252
|
readonly version: 1;
|
|
243
253
|
}
|
|
244
|
-
export type RunEventKind = 'node.artifact' | 'node.completed' | 'node.failed' | 'node.log' | 'node.output' | 'node.progress' | 'node.started' | 'run.canceled' | 'run.completed' | 'run.events-truncated' | 'run.failed' | 'run.indeterminate' | 'run.progress' | 'run.queued' | 'run.started';
|
|
254
|
+
export type RunEventKind = 'node.artifact' | 'node.completed' | 'node.failed' | 'node.log' | 'node.output' | 'node.progress' | 'node.started' | 'run.canceled' | 'run.completed' | 'run.events-truncated' | 'run.failed' | 'run.indeterminate' | 'run.progress' | 'run.queued' | 'run.resolved' | 'run.started' | 'run.waiting';
|
|
245
255
|
export interface RunEvent {
|
|
246
256
|
readonly createdAt: string;
|
|
247
257
|
readonly kind: RunEventKind;
|
|
@@ -362,6 +372,15 @@ export declare class ControlClient {
|
|
|
362
372
|
}): Promise<RunEvents>;
|
|
363
373
|
getRunResult(runId: string): Promise<RunResult>;
|
|
364
374
|
cancelRun(runId: string): Promise<RunCancellation>;
|
|
375
|
+
resolveRunWait(runId: string, waitId: string, action: WaitAction): Promise<{
|
|
376
|
+
readonly action: WaitAction | null;
|
|
377
|
+
readonly resolutionAccepted: boolean;
|
|
378
|
+
readonly resolvedAt: string | null;
|
|
379
|
+
readonly runId: string;
|
|
380
|
+
readonly status: RunStatus;
|
|
381
|
+
readonly version: 1;
|
|
382
|
+
readonly waitId: string;
|
|
383
|
+
}>;
|
|
365
384
|
private connectorActions;
|
|
366
385
|
protected request<Value = unknown>(path: string, init?: RequestInit): Promise<Value>;
|
|
367
386
|
}
|
|
@@ -28,6 +28,7 @@ var e = {
|
|
|
28
28
|
runNotFound: "run.not-found",
|
|
29
29
|
runNotTerminal: "run.not-terminal",
|
|
30
30
|
runOverloaded: "run.overloaded",
|
|
31
|
+
runWaitNotFound: "run.wait-not-found",
|
|
31
32
|
triggerKeyInvalid: "trigger-key.invalid",
|
|
32
33
|
triggerKeyNotFound: "trigger-key.not-found",
|
|
33
34
|
triggerNotFound: "trigger.not-found",
|
|
@@ -63,6 +64,7 @@ var e = {
|
|
|
63
64
|
[e.runNotFound]: { status: 404 },
|
|
64
65
|
[e.runNotTerminal]: { status: 409 },
|
|
65
66
|
[e.runOverloaded]: { status: 429 },
|
|
67
|
+
[e.runWaitNotFound]: { status: 404 },
|
|
66
68
|
[e.triggerKeyInvalid]: { status: 409 },
|
|
67
69
|
[e.triggerKeyNotFound]: { status: 404 },
|
|
68
70
|
[e.triggerNotFound]: { status: 404 },
|
|
@@ -76,7 +78,8 @@ var e = {
|
|
|
76
78
|
"indeterminate",
|
|
77
79
|
"queued",
|
|
78
80
|
"running",
|
|
79
|
-
"starting"
|
|
81
|
+
"starting",
|
|
82
|
+
"waiting"
|
|
80
83
|
], r = class extends Error {
|
|
81
84
|
constructor(e, t, n) {
|
|
82
85
|
super(n), this.code = t, this.name = "ApiError", this.status = e;
|
|
@@ -143,41 +146,45 @@ function p(e, t) {
|
|
|
143
146
|
return Object.fromEntries(Object.entries(a(e)).map(([e, n]) => [e, t(n)]));
|
|
144
147
|
}
|
|
145
148
|
function m(e) {
|
|
146
|
-
let t = a(e), n = t.
|
|
149
|
+
let t = a(e), n = t.homepageUrl, r = t.icon, c = t.defaultConnection != null;
|
|
147
150
|
if (s(t, [
|
|
148
151
|
"actionId",
|
|
149
152
|
"authenticated",
|
|
150
|
-
...
|
|
153
|
+
...c ? ["defaultConnection"] : [],
|
|
151
154
|
"description",
|
|
152
|
-
...n == null ? [] : ["
|
|
155
|
+
...n == null ? [] : ["homepageUrl"],
|
|
156
|
+
...r == null ? [] : ["icon"],
|
|
153
157
|
"inputs",
|
|
154
158
|
"name",
|
|
155
159
|
"outputs",
|
|
156
160
|
"serviceId",
|
|
157
161
|
"serviceName"
|
|
158
|
-
]), n != null && typeof n != "string") return i();
|
|
159
|
-
let
|
|
162
|
+
]), n != null && typeof n != "string" || r != null && typeof r != "string") return i();
|
|
163
|
+
let l = {
|
|
160
164
|
actionId: o(t.actionId),
|
|
161
165
|
authenticated: typeof t.authenticated == "boolean" ? t.authenticated : i(),
|
|
162
|
-
...
|
|
166
|
+
...c ? { defaultConnection: u(t.defaultConnection) } : {},
|
|
163
167
|
description: typeof t.description == "string" ? t.description : i(),
|
|
164
|
-
...n == null ? {} : {
|
|
168
|
+
...n == null ? {} : { homepageUrl: n },
|
|
169
|
+
...r == null ? {} : { icon: r },
|
|
165
170
|
inputs: p(t.inputs, f),
|
|
166
171
|
name: o(t.name),
|
|
167
172
|
outputs: p(t.outputs, d),
|
|
168
173
|
serviceId: o(t.serviceId),
|
|
169
174
|
serviceName: o(t.serviceName)
|
|
170
175
|
};
|
|
171
|
-
return
|
|
176
|
+
return l.defaultConnection != null && (l.defaultConnection.serviceId != l.serviceId || l.defaultConnection.status != "active") ? i() : l;
|
|
172
177
|
}
|
|
173
178
|
function h(e) {
|
|
174
|
-
let t = a(e), n = t.icon;
|
|
179
|
+
let t = a(e), n = t.homepageUrl, r = t.icon;
|
|
175
180
|
return s(t, [
|
|
176
181
|
"serviceId",
|
|
177
182
|
"serviceName",
|
|
178
|
-
...n == null ? [] : ["
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
...n == null ? [] : ["homepageUrl"],
|
|
184
|
+
...r == null ? [] : ["icon"]
|
|
185
|
+
]), n != null && typeof n != "string" || r != null && typeof r != "string" ? i() : {
|
|
186
|
+
...n == null ? {} : { homepageUrl: n },
|
|
187
|
+
...r == null ? {} : { icon: r },
|
|
181
188
|
serviceId: o(t.serviceId),
|
|
182
189
|
serviceName: o(t.serviceName)
|
|
183
190
|
};
|
|
@@ -554,29 +561,50 @@ function H(e) {
|
|
|
554
561
|
};
|
|
555
562
|
}
|
|
556
563
|
function U(e) {
|
|
564
|
+
let t = a(e);
|
|
565
|
+
s(t, [
|
|
566
|
+
"actions",
|
|
567
|
+
"expiresAt",
|
|
568
|
+
"nodeId",
|
|
569
|
+
"prompt",
|
|
570
|
+
"waitId",
|
|
571
|
+
"waitingSince"
|
|
572
|
+
]);
|
|
573
|
+
let n = t.actions;
|
|
574
|
+
return !Array.isArray(n) || !(n.length == 1 && n[0] == "continue" || n.length == 2 && n[0] == "approve" && n[1] == "reject") ? i() : {
|
|
575
|
+
actions: n,
|
|
576
|
+
expiresAt: o(t.expiresAt),
|
|
577
|
+
nodeId: o(t.nodeId),
|
|
578
|
+
prompt: o(t.prompt),
|
|
579
|
+
waitId: o(t.waitId),
|
|
580
|
+
waitingSince: o(t.waitingSince)
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function W(e) {
|
|
557
584
|
let t = a(e), n = H(t), r = t.eventsExpiresAt;
|
|
558
|
-
if (r != null && typeof r != "string") return i();
|
|
559
|
-
let s = {
|
|
585
|
+
if (r != null && typeof r != "string" || n.status != "waiting" && t.waiting !== void 0) return i();
|
|
586
|
+
let s = n.status == "waiting" ? U(t.waiting) : void 0, l = {
|
|
560
587
|
...n,
|
|
561
588
|
closureDigest: o(t.closureDigest),
|
|
562
589
|
engineContract: o(t.engineContract),
|
|
563
590
|
engineDigest: o(t.engineDigest),
|
|
564
591
|
...r == null ? {} : { eventsExpiresAt: r },
|
|
565
592
|
modelVersion: c(t.modelVersion),
|
|
566
|
-
revisionDigest: o(t.revisionDigest)
|
|
593
|
+
revisionDigest: o(t.revisionDigest),
|
|
594
|
+
...s == null ? {} : { waiting: s }
|
|
567
595
|
};
|
|
568
596
|
switch (n.source) {
|
|
569
597
|
case "draft": return {
|
|
570
|
-
...
|
|
598
|
+
...l,
|
|
571
599
|
source: "draft"
|
|
572
600
|
};
|
|
573
601
|
case "live": return {
|
|
574
|
-
...
|
|
602
|
+
...l,
|
|
575
603
|
publicationId: o(t.publicationId),
|
|
576
604
|
source: "live"
|
|
577
605
|
};
|
|
578
606
|
case "trigger": return {
|
|
579
|
-
...
|
|
607
|
+
...l,
|
|
580
608
|
occurrenceId: o(t.occurrenceId),
|
|
581
609
|
publicationId: o(t.publicationId),
|
|
582
610
|
source: "trigger",
|
|
@@ -584,7 +612,7 @@ function U(e) {
|
|
|
584
612
|
};
|
|
585
613
|
}
|
|
586
614
|
}
|
|
587
|
-
function
|
|
615
|
+
function G(e) {
|
|
588
616
|
let t = a(e), n = t.nextCursor;
|
|
589
617
|
return t.version != 1 || !Array.isArray(t.runs) || n != null && typeof n != "string" ? i() : {
|
|
590
618
|
flowId: o(t.flowId),
|
|
@@ -593,7 +621,7 @@ function W(e) {
|
|
|
593
621
|
version: 1
|
|
594
622
|
};
|
|
595
623
|
}
|
|
596
|
-
var
|
|
624
|
+
var K = /* @__PURE__ */ new Set([
|
|
597
625
|
"node.artifact",
|
|
598
626
|
"node.completed",
|
|
599
627
|
"node.failed",
|
|
@@ -608,11 +636,13 @@ var G = /* @__PURE__ */ new Set([
|
|
|
608
636
|
"run.indeterminate",
|
|
609
637
|
"run.progress",
|
|
610
638
|
"run.queued",
|
|
611
|
-
"run.
|
|
639
|
+
"run.resolved",
|
|
640
|
+
"run.started",
|
|
641
|
+
"run.waiting"
|
|
612
642
|
]);
|
|
613
|
-
function
|
|
643
|
+
function q(e) {
|
|
614
644
|
let t = a(e), n = t.kind, r = c(t.sequence), s = t.sourceSequence;
|
|
615
|
-
return typeof n != "string" || !
|
|
645
|
+
return typeof n != "string" || !K.has(n) || r < 0 || s != null && (!Number.isSafeInteger(s) || s < 0) ? i() : {
|
|
616
646
|
createdAt: o(t.createdAt),
|
|
617
647
|
kind: n,
|
|
618
648
|
payload: a(t.payload),
|
|
@@ -620,11 +650,11 @@ function K(e) {
|
|
|
620
650
|
...s == null ? {} : { sourceSequence: s }
|
|
621
651
|
};
|
|
622
652
|
}
|
|
623
|
-
function
|
|
653
|
+
function J(e) {
|
|
624
654
|
let t = a(e), n = t.eventsExpiresAt, r = c(t.nextAfter);
|
|
625
655
|
return t.version != 1 || !Array.isArray(t.events) || typeof t.done != "boolean" || typeof t.historyComplete != "boolean" || n != null && typeof n != "string" || r < 0 ? i() : {
|
|
626
656
|
done: t.done,
|
|
627
|
-
events: t.events.map(
|
|
657
|
+
events: t.events.map(q),
|
|
628
658
|
...n == null ? {} : { eventsExpiresAt: n },
|
|
629
659
|
historyComplete: t.historyComplete,
|
|
630
660
|
nextAfter: r,
|
|
@@ -632,16 +662,38 @@ function q(e) {
|
|
|
632
662
|
version: 1
|
|
633
663
|
};
|
|
634
664
|
}
|
|
635
|
-
function
|
|
665
|
+
function Y(e) {
|
|
636
666
|
let t = a(e), n = V(t.status);
|
|
637
|
-
return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" ? i() : {
|
|
667
|
+
return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" || n == "waiting" ? i() : {
|
|
638
668
|
cancelAccepted: t.cancelAccepted,
|
|
639
669
|
runId: o(t.runId),
|
|
640
670
|
status: n,
|
|
641
671
|
version: 1
|
|
642
672
|
};
|
|
643
673
|
}
|
|
644
|
-
function
|
|
674
|
+
function X(e) {
|
|
675
|
+
let t = a(e);
|
|
676
|
+
s(t, [
|
|
677
|
+
"action",
|
|
678
|
+
"resolutionAccepted",
|
|
679
|
+
"resolvedAt",
|
|
680
|
+
"runId",
|
|
681
|
+
"status",
|
|
682
|
+
"version",
|
|
683
|
+
"waitId"
|
|
684
|
+
]);
|
|
685
|
+
let n = t.action, r = t.resolvedAt;
|
|
686
|
+
return t.version != 1 || typeof t.resolutionAccepted != "boolean" || n !== null && n != "approve" && n != "continue" && n != "reject" || r !== null && typeof r != "string" || n === null != (r === null) || t.resolutionAccepted && n === null ? i() : {
|
|
687
|
+
action: n,
|
|
688
|
+
resolutionAccepted: t.resolutionAccepted,
|
|
689
|
+
resolvedAt: r,
|
|
690
|
+
runId: o(t.runId),
|
|
691
|
+
status: V(t.status),
|
|
692
|
+
version: 1,
|
|
693
|
+
waitId: o(t.waitId)
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function Z(e) {
|
|
645
697
|
let t = a(e), n = t.status;
|
|
646
698
|
if (t.version != 1) return i();
|
|
647
699
|
let r = {
|
|
@@ -682,11 +734,11 @@ function Y(e) {
|
|
|
682
734
|
}
|
|
683
735
|
return i();
|
|
684
736
|
}
|
|
685
|
-
var
|
|
686
|
-
function
|
|
737
|
+
var Q = encodeURIComponent;
|
|
738
|
+
function $(e) {
|
|
687
739
|
return `${e}-${crypto.randomUUID()}`;
|
|
688
740
|
}
|
|
689
|
-
var
|
|
741
|
+
var ee = class {
|
|
690
742
|
constructor(e) {
|
|
691
743
|
this.requestControl = e;
|
|
692
744
|
}
|
|
@@ -704,16 +756,16 @@ var Q = class {
|
|
|
704
756
|
};
|
|
705
757
|
}
|
|
706
758
|
async getVariable(e) {
|
|
707
|
-
return k(await this.request(`/v1/variables/${
|
|
759
|
+
return k(await this.request(`/v1/variables/${Q(e)}`));
|
|
708
760
|
}
|
|
709
761
|
async putVariable(e, t) {
|
|
710
|
-
return k(await this.request(`/v1/variables/${
|
|
762
|
+
return k(await this.request(`/v1/variables/${Q(e)}`, {
|
|
711
763
|
body: JSON.stringify({ value: t }),
|
|
712
764
|
method: "PUT"
|
|
713
765
|
}));
|
|
714
766
|
}
|
|
715
767
|
async deleteVariable(e) {
|
|
716
|
-
let t = a(await this.request(`/v1/variables/${
|
|
768
|
+
let t = a(await this.request(`/v1/variables/${Q(e)}`, { method: "DELETE" }));
|
|
717
769
|
if (s(t, ["version"]), t.version != 1) return i();
|
|
718
770
|
}
|
|
719
771
|
async createFlow(e, t = `flow-${crypto.randomUUID()}`) {
|
|
@@ -727,10 +779,10 @@ var Q = class {
|
|
|
727
779
|
}));
|
|
728
780
|
}
|
|
729
781
|
async getFlow(e) {
|
|
730
|
-
return D(await this.request(`/v1/flows/${
|
|
782
|
+
return D(await this.request(`/v1/flows/${Q(e)}`));
|
|
731
783
|
}
|
|
732
784
|
async renameFlow(e, t) {
|
|
733
|
-
return D(await this.request(`/v1/flows/${
|
|
785
|
+
return D(await this.request(`/v1/flows/${Q(e)}`, {
|
|
734
786
|
body: JSON.stringify({
|
|
735
787
|
name: t,
|
|
736
788
|
version: 1
|
|
@@ -739,7 +791,7 @@ var Q = class {
|
|
|
739
791
|
}));
|
|
740
792
|
}
|
|
741
793
|
async deleteFlow(e) {
|
|
742
|
-
return D(await this.request(`/v1/flows/${
|
|
794
|
+
return D(await this.request(`/v1/flows/${Q(e)}`, { method: "DELETE" }));
|
|
743
795
|
}
|
|
744
796
|
async listTriggerKeys(e) {
|
|
745
797
|
let t = a(await this.request("/v1/trigger-keys", { signal: e }));
|
|
@@ -750,52 +802,52 @@ var Q = class {
|
|
|
750
802
|
return t.version != 1 || !Array.isArray(t.definitions) ? i() : t.definitions.map(_);
|
|
751
803
|
}
|
|
752
804
|
async getTriggerKey(e, t) {
|
|
753
|
-
let n = a(await this.request(`/v1/trigger-keys/${
|
|
805
|
+
let n = a(await this.request(`/v1/trigger-keys/${Q(e)}`, { signal: t }));
|
|
754
806
|
return n.version == 1 ? _(n.definition) : i();
|
|
755
807
|
}
|
|
756
808
|
async listFlowTriggerBindings(e) {
|
|
757
|
-
let t = a(await this.request(`/v1/flows/${
|
|
809
|
+
let t = a(await this.request(`/v1/flows/${Q(e)}/triggers`));
|
|
758
810
|
return t.version != 1 || o(t.flowId) != e || !Array.isArray(t.bindings) ? i() : t.bindings.map(S);
|
|
759
811
|
}
|
|
760
812
|
async getFlowTriggerBinding(e, t) {
|
|
761
|
-
return C(await this.request(`/v1/flows/${
|
|
813
|
+
return C(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}`));
|
|
762
814
|
}
|
|
763
815
|
async listFlowTriggerActivities(e, t, n = {}) {
|
|
764
816
|
let r = new URLSearchParams();
|
|
765
817
|
n.cursor != null && r.set("cursor", n.cursor), n.limit != null && r.set("limit", String(n.limit));
|
|
766
818
|
let i = r.size == 0 ? "" : `?${r}`;
|
|
767
|
-
return T(await this.request(`/v1/flows/${
|
|
819
|
+
return T(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/activities${i}`));
|
|
768
820
|
}
|
|
769
821
|
async pauseFlowTrigger(e, t) {
|
|
770
|
-
return S(await this.request(`/v1/flows/${
|
|
822
|
+
return S(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/pause`, {
|
|
771
823
|
body: JSON.stringify({ version: 1 }),
|
|
772
824
|
method: "POST"
|
|
773
825
|
}));
|
|
774
826
|
}
|
|
775
827
|
async resumeFlowTrigger(e, t) {
|
|
776
|
-
return S(await this.request(`/v1/flows/${
|
|
828
|
+
return S(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/resume`, {
|
|
777
829
|
body: JSON.stringify({ version: 1 }),
|
|
778
830
|
method: "POST"
|
|
779
831
|
}));
|
|
780
832
|
}
|
|
781
833
|
async testFlowPollTrigger(e, t) {
|
|
782
|
-
return E(await this.request(`/v1/flows/${
|
|
834
|
+
return E(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/test`, {
|
|
783
835
|
body: JSON.stringify({ version: 1 }),
|
|
784
836
|
method: "POST"
|
|
785
837
|
}));
|
|
786
838
|
}
|
|
787
839
|
async getDraft(e) {
|
|
788
|
-
return j(await this.request(`/v1/flows/${
|
|
840
|
+
return j(await this.request(`/v1/flows/${Q(e)}/draft`));
|
|
789
841
|
}
|
|
790
842
|
async syncDraft(e, t) {
|
|
791
|
-
let n = t == null ? "" : `?fromRevisionId=${
|
|
792
|
-
return N(await this.request(`/v1/flows/${
|
|
843
|
+
let n = t == null ? "" : `?fromRevisionId=${Q(t)}`;
|
|
844
|
+
return N(await this.request(`/v1/flows/${Q(e)}/draft/sync${n}`));
|
|
793
845
|
}
|
|
794
846
|
async getRevision(e, t) {
|
|
795
|
-
return j(await this.request(`/v1/flows/${
|
|
847
|
+
return j(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}`));
|
|
796
848
|
}
|
|
797
849
|
async listConnectorProviders(e, t) {
|
|
798
|
-
let n = a(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${
|
|
850
|
+
let n = a(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${Q(t)}`}`, { signal: e }));
|
|
799
851
|
return s(n, ["providers", "version"]), n.version != 1 || !Array.isArray(n.providers) ? i() : n.providers.map(h);
|
|
800
852
|
}
|
|
801
853
|
async listConnectorActions(e, t, n) {
|
|
@@ -811,11 +863,11 @@ var Q = class {
|
|
|
811
863
|
}, t);
|
|
812
864
|
}
|
|
813
865
|
async getConnectorAction(e, t, n) {
|
|
814
|
-
let r = a(await this.request(`/v1/connector/actions/${
|
|
866
|
+
let r = a(await this.request(`/v1/connector/actions/${Q(e)}${n == null ? "" : `?flowId=${Q(n)}`}`, { signal: t }));
|
|
815
867
|
return s(r, ["action", "version"]), r.version == 1 ? m(r.action) : i();
|
|
816
868
|
}
|
|
817
869
|
async listConnectorConnections(e, t, n) {
|
|
818
|
-
let r = a(await this.request(`/v1/connector/connections/${
|
|
870
|
+
let r = a(await this.request(`/v1/connector/connections/${Q(e)}${n == null ? "" : `?flowId=${Q(n)}`}`, { signal: t }));
|
|
819
871
|
return s(r, [
|
|
820
872
|
"connections",
|
|
821
873
|
"serviceId",
|
|
@@ -823,7 +875,7 @@ var Q = class {
|
|
|
823
875
|
]), r.version != 1 || o(r.serviceId) != e || !Array.isArray(r.connections) ? i() : r.connections.map(u);
|
|
824
876
|
}
|
|
825
877
|
async createConnectorConnectionPage(e, t) {
|
|
826
|
-
let n = a(await this.request(`/v1/connector/connections/${
|
|
878
|
+
let n = a(await this.request(`/v1/connector/connections/${Q(e)}/page${t == null ? "" : `?flowId=${Q(t)}`}`, {
|
|
827
879
|
body: JSON.stringify({ version: 1 }),
|
|
828
880
|
method: "POST"
|
|
829
881
|
}));
|
|
@@ -836,7 +888,7 @@ var Q = class {
|
|
|
836
888
|
}
|
|
837
889
|
}
|
|
838
890
|
async changeDraft(e, t, n) {
|
|
839
|
-
return M(await this.request(`/v1/flows/${
|
|
891
|
+
return M(await this.request(`/v1/flows/${Q(e)}/draft/changes`, {
|
|
840
892
|
body: JSON.stringify({
|
|
841
893
|
expectedRevisionId: t,
|
|
842
894
|
operations: n,
|
|
@@ -846,7 +898,7 @@ var Q = class {
|
|
|
846
898
|
}));
|
|
847
899
|
}
|
|
848
900
|
async checkFlow(e, t) {
|
|
849
|
-
return L(await this.request(`/v1/flows/${
|
|
901
|
+
return L(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/check`, {
|
|
850
902
|
body: JSON.stringify({
|
|
851
903
|
engineContract: "open-flow-engine/v1",
|
|
852
904
|
version: 1
|
|
@@ -855,88 +907,97 @@ var Q = class {
|
|
|
855
907
|
}));
|
|
856
908
|
}
|
|
857
909
|
async getLive(e) {
|
|
858
|
-
return R(await this.request(`/v1/flows/${
|
|
910
|
+
return R(await this.request(`/v1/flows/${Q(e)}/live`));
|
|
859
911
|
}
|
|
860
912
|
async listPublications(e, t = {}) {
|
|
861
913
|
let n = new URLSearchParams();
|
|
862
914
|
t.cursor != null && n.set("cursor", t.cursor), t.limit != null && n.set("limit", String(t.limit)), t.includeTotal != null && n.set("includeTotal", String(t.includeTotal));
|
|
863
915
|
let r = n.size == 0 ? "" : `?${n}`;
|
|
864
|
-
return z(await this.request(`/v1/flows/${
|
|
916
|
+
return z(await this.request(`/v1/flows/${Q(e)}/publications${r}`));
|
|
865
917
|
}
|
|
866
918
|
async createDraftRun(e, t, n = {}) {
|
|
867
|
-
let r =
|
|
919
|
+
let r = W(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/runs`, {
|
|
868
920
|
body: JSON.stringify({
|
|
869
921
|
engineContract: "open-flow-engine/v1",
|
|
870
922
|
inputs: n.inputs ?? {},
|
|
871
923
|
version: 1
|
|
872
924
|
}),
|
|
873
|
-
headers: { "idempotency-key": n.idempotencyKey ??
|
|
925
|
+
headers: { "idempotency-key": n.idempotencyKey ?? $("run") },
|
|
874
926
|
method: "POST"
|
|
875
927
|
}));
|
|
876
928
|
return r.source == "draft" ? r : i();
|
|
877
929
|
}
|
|
878
930
|
async createLiveRun(e, t = {}) {
|
|
879
|
-
let n =
|
|
931
|
+
let n = W(await this.request("/v1/runs", {
|
|
880
932
|
body: JSON.stringify({
|
|
881
933
|
inputs: t.inputs ?? {},
|
|
882
934
|
publicationId: e,
|
|
883
935
|
version: 1
|
|
884
936
|
}),
|
|
885
|
-
headers: { "idempotency-key": t.idempotencyKey ??
|
|
937
|
+
headers: { "idempotency-key": t.idempotencyKey ?? $("run") },
|
|
886
938
|
method: "POST"
|
|
887
939
|
}));
|
|
888
940
|
return n.source == "live" ? n : i();
|
|
889
941
|
}
|
|
890
942
|
async publishFlow(e, t, n, r = {}) {
|
|
891
|
-
return F(await this.request(`/v1/flows/${
|
|
943
|
+
return F(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/publications`, {
|
|
892
944
|
body: JSON.stringify({
|
|
893
945
|
engineContract: "open-flow-engine/v1",
|
|
894
946
|
expectedLivePublicationId: n,
|
|
895
947
|
version: 1
|
|
896
948
|
}),
|
|
897
|
-
headers: { "idempotency-key": r.idempotencyKey ??
|
|
949
|
+
headers: { "idempotency-key": r.idempotencyKey ?? $("publication") },
|
|
898
950
|
method: "POST"
|
|
899
951
|
}));
|
|
900
952
|
}
|
|
901
953
|
async getPublishOperation(e, t) {
|
|
902
|
-
return F(await this.request(`/v1/flows/${
|
|
954
|
+
return F(await this.request(`/v1/flows/${Q(e)}/publish-operations/${Q(t)}`));
|
|
903
955
|
}
|
|
904
956
|
async rollbackFlow(e, t, n, r = {}) {
|
|
905
|
-
return P(await this.request(`/v1/flows/${
|
|
957
|
+
return P(await this.request(`/v1/flows/${Q(e)}/publications/${Q(t)}/rollback`, {
|
|
906
958
|
body: JSON.stringify({
|
|
907
959
|
expectedLivePublicationId: n,
|
|
908
960
|
version: 1
|
|
909
961
|
}),
|
|
910
|
-
headers: { "idempotency-key": r.idempotencyKey ??
|
|
962
|
+
headers: { "idempotency-key": r.idempotencyKey ?? $("publication") },
|
|
911
963
|
method: "POST"
|
|
912
964
|
}));
|
|
913
965
|
}
|
|
914
966
|
async getRun(e) {
|
|
915
|
-
return
|
|
967
|
+
return W(await this.request(`/v1/runs/${Q(e)}`));
|
|
916
968
|
}
|
|
917
969
|
async listRuns(e, t = {}) {
|
|
918
970
|
let n = new URLSearchParams();
|
|
919
971
|
t.cursor != null && n.set("cursor", t.cursor), t.limit != null && n.set("limit", String(t.limit)), t.status != null && n.set("status", t.status);
|
|
920
972
|
let r = n.size == 0 ? "" : `?${n}`;
|
|
921
|
-
return
|
|
973
|
+
return G(await this.request(`/v1/flows/${Q(e)}/runs${r}`));
|
|
922
974
|
}
|
|
923
975
|
async getRunEvents(e, t = {}) {
|
|
924
976
|
let n = new URLSearchParams();
|
|
925
977
|
t.after != null && n.set("after", String(t.after)), t.limit != null && n.set("limit", String(t.limit));
|
|
926
978
|
let r = n.size == 0 ? "" : `?${n}`;
|
|
927
|
-
return
|
|
979
|
+
return J(await this.request(`/v1/runs/${Q(e)}/events${r}`));
|
|
928
980
|
}
|
|
929
981
|
async getRunResult(e) {
|
|
930
|
-
return
|
|
982
|
+
return Z(await this.request(`/v1/runs/${Q(e)}/result`));
|
|
931
983
|
}
|
|
932
984
|
async cancelRun(e) {
|
|
933
|
-
return
|
|
985
|
+
return Y(await this.request(`/v1/runs/${Q(e)}/cancel`, {
|
|
934
986
|
body: JSON.stringify({ version: 1 }),
|
|
935
987
|
method: "POST"
|
|
936
988
|
}));
|
|
937
989
|
}
|
|
990
|
+
async resolveRunWait(e, t, n) {
|
|
991
|
+
return X(await this.request(`/v1/runs/${Q(e)}/waits/${Q(t)}/resolve`, {
|
|
992
|
+
body: JSON.stringify({
|
|
993
|
+
action: n,
|
|
994
|
+
version: 1
|
|
995
|
+
}),
|
|
996
|
+
method: "POST"
|
|
997
|
+
}));
|
|
998
|
+
}
|
|
938
999
|
async connectorActions(e, t) {
|
|
939
|
-
let n = Object.entries(e).map(([e, t]) => `${
|
|
1000
|
+
let n = Object.entries(e).map(([e, t]) => `${Q(e)}=${Q(t)}`).join("&"), r = n == "" ? "" : `?${n}`, o = a(await this.request(`/v1/connector/actions${r}`, { signal: t }));
|
|
940
1001
|
return s(o, ["actions", "version"]), o.version != 1 || !Array.isArray(o.actions) ? i() : o.actions.map(m);
|
|
941
1002
|
}
|
|
942
1003
|
async request(e, t = {}) {
|
|
@@ -959,4 +1020,4 @@ var Q = class {
|
|
|
959
1020
|
}
|
|
960
1021
|
};
|
|
961
1022
|
//#endregion
|
|
962
|
-
export { r as ApiError,
|
|
1023
|
+
export { r as ApiError, ee as ControlClient, e as controlErrorCode, t as controlErrorMetadata };
|