@oomol-lab/open-flow 0.1.0-alpha.6 → 0.1.0-alpha.7
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/{addNodeOptions-C4wix0_u.js → addNodeOptions-DRndy4EK.js} +2080 -2022
- package/dist/browser/{createLucideIcon-ggJB9CTC.js → createLucideIcon-CqjqCezK.js} +829 -832
- package/dist/browser/{createResourceDialog-CESUCxOM.js → createResourceDialog-A64dDFCG.js} +140 -140
- package/dist/browser/{esm-CoE5_2w7.js → esm-YIGXG-Js.js} +1 -11
- package/dist/browser/{field-CIrv7Rez.js → field-CKGQHCIi.js} +88 -88
- package/dist/browser/flow-authoring.js +29 -19
- package/dist/browser/flow-change.d.ts +16 -10
- package/dist/browser/flow-change.js +62 -59
- package/dist/browser/{flowWorkspace-Bo0bz1Uz.js → flowWorkspace-D7-rBA1-.js} +16961 -12403
- package/dist/browser/licenses.md +514 -0
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +439 -388
- package/dist/common/control-api-conformance.js +106 -15
- package/dist/common/control-api.d.ts +1 -1
- package/dist/common/control-api.js +1 -1
- package/dist/common/flow-encoding.d.ts +3 -3
- package/dist/common/flow-encoding.js +11 -7
- package/dist/common/flow-semantics.js +514 -505
- package/dist/common/scheduler.js +156 -151
- package/package.json +1 -1
|
@@ -79,11 +79,12 @@ function m(e, t, n, r = "marker") {
|
|
|
79
79
|
concurrency: 1,
|
|
80
80
|
inputs: {},
|
|
81
81
|
kind: "value",
|
|
82
|
-
values: {
|
|
82
|
+
values: [{
|
|
83
|
+
handle: "ready",
|
|
83
84
|
jsonSchema: { type: "boolean" },
|
|
84
85
|
nullable: !1,
|
|
85
86
|
value: !0
|
|
86
|
-
}
|
|
87
|
+
}]
|
|
87
88
|
},
|
|
88
89
|
nodeId: r,
|
|
89
90
|
target: { kind: "flow" }
|
|
@@ -131,7 +132,11 @@ var y = [
|
|
|
131
132
|
let t = await f(e, "Control flow", "flow-lifecycle"), n = s(t.flowId, "Created Flow flowId"), r = s(t.draftRevisionId, "Created Flow draftRevisionId");
|
|
132
133
|
i(t.name, "Control flow", "Created Flow name"), i(t.status, "active", "Created Flow status"), i(await c(await d(e, "Control flow", "flow-lifecycle"), 200, "Replay Flow"), t, "Replayed Flow"), await l(await d(e, "Different flow", "flow-lifecycle"), 409, "flow.conflict", "Conflicting Flow"), i(await c(await u(e, `/v1/flows/${n}`), 200, "Read Flow"), t, "Read Flow");
|
|
133
134
|
let a = await c(await u(e, "/v1/flows?includeTotal=true"), 200, "List Flows");
|
|
134
|
-
i(a.flows, [t], "Listed Flows"), i(a.total, 1, "Flow total")
|
|
135
|
+
i(a.flows, [t], "Listed Flows"), i(a.total, 1, "Flow total");
|
|
136
|
+
let o = await f(e, "Second control flow", "flow-lifecycle-second"), p = await c(await u(e, "/v1/flows?limit=1"), 200, "List first Flow page");
|
|
137
|
+
i(p.flows, [t], "First Flow page");
|
|
138
|
+
let h = s(p.nextCursor, "Flow cursor");
|
|
139
|
+
i((await c(await u(e, `/v1/flows?limit=1&cursor=${encodeURIComponent(h)}`), 200, "List second Flow page")).flows, [o], "Second Flow page"), i((await c(await u(e, `/v1/flows/${n}`, {
|
|
135
140
|
body: JSON.stringify({
|
|
136
141
|
name: "Renamed flow",
|
|
137
142
|
version: 1
|
|
@@ -144,9 +149,24 @@ var y = [
|
|
|
144
149
|
name: "commits immutable Draft Revisions for one Flow",
|
|
145
150
|
async verify(e) {
|
|
146
151
|
let t = await f(e, "Draft flow", "draft-flow"), n = s(t.flowId, "Draft Flow flowId"), r = s(t.draftRevisionId, "Draft Flow revisionId"), o = await c(await m(e, n, r), 200, "Change Draft"), d = h(o, "Changed Draft");
|
|
147
|
-
i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), await l(await
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), await l(await p(e, n, d, [{
|
|
153
|
+
kind: "graph.node.replace",
|
|
154
|
+
node: {
|
|
155
|
+
concurrency: 1,
|
|
156
|
+
inputs: {},
|
|
157
|
+
kind: "value",
|
|
158
|
+
values: [{
|
|
159
|
+
handle: "ready",
|
|
160
|
+
jsonSchema: { type: "boolean" },
|
|
161
|
+
nullable: !1,
|
|
162
|
+
value: !0
|
|
163
|
+
}]
|
|
164
|
+
},
|
|
165
|
+
nodeId: "marker",
|
|
166
|
+
target: { kind: "flow" }
|
|
167
|
+
}]), 400, "flow.invalid", "No-op Draft change"), await l(await m(e, n, r, "stale"), 412, "flow.revision-conflict", "Stale Draft change"), i(a(a(a(a((await c(await u(e, `/v1/flows/${n}/revisions/${r}`), 200, "Read old Revision")).content, "Old content").document, "Old document").graph, "Old graph").nodes, "Old nodes"), {}, "Old Revision nodes"), i((await c(await u(e, `/v1/flows/${n}/draft`), 200, "Read Draft")).revisionId, d, "Draft revisionId");
|
|
168
|
+
let g = await c(await u(e, `/v1/flows/${n}/draft/sync?fromRevisionId=${r}`), 200, "Sync Draft");
|
|
169
|
+
i(g.kind, "snapshot", "Draft sync kind"), i(a(g.draft, "Draft snapshot").revisionId, d, "Draft snapshot revisionId");
|
|
150
170
|
}
|
|
151
171
|
},
|
|
152
172
|
{
|
|
@@ -170,21 +190,28 @@ var y = [
|
|
|
170
190
|
version: 1
|
|
171
191
|
}),
|
|
172
192
|
method: "PUT"
|
|
173
|
-
}), 412, "flow.presentation-conflict", "Stale Presentation update"), i((await c(await u(e, `/v1/flows/${n}
|
|
193
|
+
}), 412, "flow.presentation-conflict", "Stale Presentation update"), i((await c(await u(e, a), 200, "Read Presentation")).value, o, "Presentation value after conflict"), await c(await u(e, `/v1/flows/${n}`, { method: "DELETE" }), 202, "Retire Presentation Flow"), await l(await u(e, a, {
|
|
194
|
+
body: JSON.stringify({
|
|
195
|
+
expectedRevision: 2,
|
|
196
|
+
value: {},
|
|
197
|
+
version: 1
|
|
198
|
+
}),
|
|
199
|
+
method: "PUT"
|
|
200
|
+
}), 409, "flow.busy", "Update retired Presentation"), i((await c(await u(e, `/v1/flows/${n}`), 200, "Read Flow")).draftRevisionId, r, "Draft head");
|
|
174
201
|
}
|
|
175
202
|
},
|
|
176
203
|
{
|
|
177
204
|
name: "validates, admits, lists, and cancels one Draft Run",
|
|
178
205
|
async verify(e) {
|
|
179
|
-
let t = await f(e, "Run flow", "run-flow"), r = s(t.flowId, "Run Flow flowId"),
|
|
180
|
-
i((await c(await u(e, `/v1/flows/${r}/revisions/${
|
|
206
|
+
let t = await f(e, "Run flow", "run-flow"), r = s(t.flowId, "Run Flow flowId"), d = s(t.draftRevisionId, "Run Flow revisionId");
|
|
207
|
+
i((await c(await u(e, `/v1/flows/${r}/revisions/${d}/check`, {
|
|
181
208
|
body: JSON.stringify({
|
|
182
209
|
engineContract: n,
|
|
183
210
|
version: 1
|
|
184
211
|
}),
|
|
185
212
|
method: "POST"
|
|
186
213
|
}), 200, "Check Flow")).valid, !0, "Flow validity");
|
|
187
|
-
let
|
|
214
|
+
let p = `/v1/flows/${r}/revisions/${d}/runs`, m = () => u(e, p, {
|
|
188
215
|
body: JSON.stringify({
|
|
189
216
|
engineContract: n,
|
|
190
217
|
inputs: {},
|
|
@@ -192,11 +219,65 @@ var y = [
|
|
|
192
219
|
}),
|
|
193
220
|
headers: { "idempotency-key": "draft-run" },
|
|
194
221
|
method: "POST"
|
|
195
|
-
}),
|
|
196
|
-
i(await c(await
|
|
222
|
+
}), h = await c(await m(), 202, "Create Draft Run"), g = s(h.runId, "Draft Run runId");
|
|
223
|
+
i(await c(await m(), 200, "Replay Draft Run"), h, "Replayed Draft Run"), await l(await u(e, `/v1/runs/${g}/result`), 409, "run.not-terminal", "Read queued Run result");
|
|
224
|
+
let _ = await c(await u(e, p, {
|
|
225
|
+
body: JSON.stringify({
|
|
226
|
+
engineContract: n,
|
|
227
|
+
inputs: {},
|
|
228
|
+
version: 1
|
|
229
|
+
}),
|
|
230
|
+
headers: { "idempotency-key": "draft-run-second" },
|
|
231
|
+
method: "POST"
|
|
232
|
+
}), 202, "Create second Draft Run"), v = await c(await u(e, `/v1/flows/${r}/runs?limit=1`), 200, "List Runs");
|
|
233
|
+
i(o(v.runs, "Runs").map((e) => a(e, "Run").runId), [g], "Listed Runs"), s(v.nextCursor, "Run cursor"), i((await c(await u(e, `/v1/runs/${g}/cancel`, {
|
|
234
|
+
body: JSON.stringify({ version: 1 }),
|
|
235
|
+
method: "POST"
|
|
236
|
+
}), 200, "Cancel Run")).status, "canceled", "Canceled Run status"), i((await c(await u(e, `/v1/runs/${g}/result`), 200, "Read canceled Run result")).status, "canceled", "Canceled Run result"), i((await c(await u(e, `/v1/runs/${g}/events`), 200, "Read canceled Run events")).done, !0, "Canceled Run events"), i((await c(await u(e, `/v1/runs/${s(_.runId, "Second Draft Run")}/cancel`, {
|
|
237
|
+
body: JSON.stringify({ version: 1 }),
|
|
238
|
+
method: "POST"
|
|
239
|
+
}), 200, "Cancel second Draft Run")).status, "canceled", "Second canceled Run status");
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "rejects invalid and missing Flow control targets",
|
|
244
|
+
async verify(e) {
|
|
245
|
+
let t = "flow_missing", r = "revision_missing", i = "run_missing";
|
|
246
|
+
await l(await u(e, `/v1/flows/${t}`), 404, "flow.not-found", "Read missing Flow"), await l(await u(e, `/v1/flows/${t}`, {
|
|
247
|
+
body: JSON.stringify({
|
|
248
|
+
name: "Missing",
|
|
249
|
+
version: 1
|
|
250
|
+
}),
|
|
251
|
+
method: "PATCH"
|
|
252
|
+
}), 404, "flow.not-found", "Rename missing Flow"), await l(await u(e, `/v1/flows/${t}`, { method: "DELETE" }), 404, "flow.not-found", "Retire missing Flow"), await l(await u(e, `/v1/flows/${t}/draft`), 404, "flow.not-found", "Read missing Draft"), await l(await u(e, `/v1/flows/${t}/revisions/${r}`), 404, "flow.not-found", "Read missing Revision"), await l(await u(e, `/v1/flows/${t}/presentation`), 404, "flow.not-found", "Read missing Presentation"), await l(await u(e, `/v1/flows/${t}/presentation`, {
|
|
253
|
+
body: JSON.stringify({
|
|
254
|
+
expectedRevision: 1,
|
|
255
|
+
value: {},
|
|
256
|
+
version: 1
|
|
257
|
+
}),
|
|
258
|
+
method: "PUT"
|
|
259
|
+
}), 404, "flow.not-found", "Update missing Presentation"), await l(await u(e, `/v1/flows/${t}/runs`), 404, "flow.not-found", "List missing Flow Runs"), await l(await u(e, `/v1/runs/${i}`), 404, "run.not-found", "Read missing Run"), await l(await u(e, `/v1/runs/${i}/events`), 404, "run.not-found", "Read missing Run events"), await l(await u(e, `/v1/runs/${i}/result`), 404, "run.not-found", "Read missing Run result"), await l(await u(e, `/v1/runs/${i}/cancel`, {
|
|
197
260
|
body: JSON.stringify({ version: 1 }),
|
|
198
261
|
method: "POST"
|
|
199
|
-
}),
|
|
262
|
+
}), 404, "run.not-found", "Cancel missing Run");
|
|
263
|
+
let a = await f(e, "Invalid targets", "invalid-targets"), o = s(a.flowId, "Invalid targets Flow"), c = s(a.draftRevisionId, "Invalid targets Revision"), d = (t, n) => u(e, `/v1/flows/${o}/revisions/${t}/check`, {
|
|
264
|
+
body: JSON.stringify({
|
|
265
|
+
engineContract: n,
|
|
266
|
+
version: 1
|
|
267
|
+
}),
|
|
268
|
+
method: "POST"
|
|
269
|
+
});
|
|
270
|
+
await l(await d(c, "unsupported-engine/v1"), 409, "engine.unsupported", "Check unsupported Engine"), await l(await d(r, n), 404, "flow.not-found", "Check missing Revision");
|
|
271
|
+
let p = (t, n, r) => u(e, `/v1/flows/${o}/revisions/${t}/runs`, {
|
|
272
|
+
body: JSON.stringify({
|
|
273
|
+
engineContract: n,
|
|
274
|
+
inputs: {},
|
|
275
|
+
version: 1
|
|
276
|
+
}),
|
|
277
|
+
headers: { "idempotency-key": r },
|
|
278
|
+
method: "POST"
|
|
279
|
+
});
|
|
280
|
+
await l(await p(c, "unsupported-engine/v1", "unsupported-run"), 409, "engine.unsupported", "Run unsupported Engine"), await l(await p(r, n, "missing-revision-run"), 404, "flow.not-found", "Run missing Revision");
|
|
200
281
|
}
|
|
201
282
|
}
|
|
202
283
|
], b = [{
|
|
@@ -207,12 +288,22 @@ var y = [
|
|
|
207
288
|
let a = () => g(e, n, r, null, "publication-first"), o = await c(await a(), 201, "Publish Flow"), d = s(o.publicationId, "Publication id");
|
|
208
289
|
i(await c(await a(), 200, "Replay Publish"), o, "Replayed Publication"), await l(await g(e, n, r, d, "publication-first"), 409, "publication.conflict", "Conflicting replay"), i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read published Live")).publication, o, "Live Publication");
|
|
209
290
|
let p = await c(await u(e, `/v1/flows/${n}/publications?includeTotal=true`), 200, "List Publications");
|
|
210
|
-
i(p.publications, [o], "Publication history"), i(p.total, 1, "Publication total")
|
|
291
|
+
i(p.publications, [o], "Publication history"), i(p.total, 1, "Publication total"), await l(await u(e, `/v1/flows/${n}/revisions/${r}/publications`, {
|
|
292
|
+
body: JSON.stringify({
|
|
293
|
+
engineContract: "unsupported-engine/v1",
|
|
294
|
+
expectedLivePublicationId: d,
|
|
295
|
+
version: 1
|
|
296
|
+
}),
|
|
297
|
+
headers: { "idempotency-key": "unsupported-publication" },
|
|
298
|
+
method: "POST"
|
|
299
|
+
}), 409, "engine.unsupported", "Publish unsupported Engine"), await l(await g(e, n, "revision_missing", d, "missing-revision-publication"), 404, "flow.not-found", "Publish missing Revision"), await l(await _(e, n, "publication_missing", d, "missing-rollback"), 404, "publication.not-found", "Rollback missing Publication"), await l(await v(e, "publication_missing", "missing-publication-run"), 404, "publication.not-found", "Run missing Publication");
|
|
211
300
|
}
|
|
212
301
|
}, {
|
|
213
302
|
name: "rolls back immutable history and fixes a Live Run target",
|
|
214
303
|
async verify(e) {
|
|
215
|
-
let t = await f(e, "Rollback flow", "rollback-flow"), n = s(t.flowId, "Rollback Flow flowId"), r = s(t.draftRevisionId, "Rollback Flow revisionId"), a = s((await c(await g(e, n, r, null, "publish-first"), 201, "Publish first Revision")).publicationId, "First Publication"), o = s((await c(await g(e, n, h(await c(await m(e, n, r), 200, "Change Draft"), "Second Revision"), a, "publish-second"), 201, "Publish second Revision")).publicationId, "Second Publication")
|
|
304
|
+
let t = await f(e, "Rollback flow", "rollback-flow"), n = s(t.flowId, "Rollback Flow flowId"), r = s(t.draftRevisionId, "Rollback Flow revisionId"), a = s((await c(await g(e, n, r, null, "publish-first"), 201, "Publish first Revision")).publicationId, "First Publication"), o = s((await c(await g(e, n, h(await c(await m(e, n, r), 200, "Change Draft"), "Second Revision"), a, "publish-second"), 201, "Publish second Revision")).publicationId, "Second Publication");
|
|
305
|
+
await l(await v(e, a, "stale-live-run"), 412, "live.conflict", "Run stale Publication");
|
|
306
|
+
let d = () => _(e, n, a, o, "rollback-first"), p = await c(await d(), 201, "Rollback Flow"), y = s(p.publicationId, "Rollback Publication");
|
|
216
307
|
i(p.operation, "rollback", "Rollback operation"), i(p.sourcePublicationId, a, "Rollback source"), i(await c(await d(), 200, "Replay Rollback"), p, "Replayed Rollback");
|
|
217
308
|
let b = await c(await v(e, y, "rollback-run"), 202, "Create Live Run");
|
|
218
309
|
i(b.flowId, n, "Live Run flowId"), i(b.revisionId, r, "Live Run revisionId"), await c(await u(e, `/v1/flows/${n}`, { method: "DELETE" }), 202, "Retire Flow"), await l(await v(e, y, "retired-run"), 409, "flow.busy", "Run retired Flow");
|
|
@@ -254,8 +254,8 @@ interface PublicationOptions {
|
|
|
254
254
|
readonly idempotencyKey?: string;
|
|
255
255
|
}
|
|
256
256
|
export declare class ApiError extends Error {
|
|
257
|
-
readonly status: number;
|
|
258
257
|
readonly code: string;
|
|
258
|
+
readonly status: number;
|
|
259
259
|
constructor(status: number, code: string, message: string);
|
|
260
260
|
}
|
|
261
261
|
export declare class ControlClient {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { CodeModule, FlowDocument, Graph,
|
|
1
|
+
import type { CodeModule, FlowDocument, Graph, InputPort, JsonValue, OutputMapping, Port, RevisionContent } from '@oomol-lab/open-flow/flow-change';
|
|
2
2
|
export declare const maxJsonDepth = 64;
|
|
3
3
|
export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
|
|
4
4
|
export declare function digestBytes(bytes: Uint8Array): Promise<string>;
|
|
5
|
-
export declare function canonicalPorts(value:
|
|
6
|
-
export declare function canonicalOutputs(value:
|
|
5
|
+
export declare function canonicalPorts(value: readonly (InputPort | Port)[]): JsonValue;
|
|
6
|
+
export declare function canonicalOutputs(value: readonly (OutputMapping & Port)[]): JsonValue;
|
|
7
7
|
export declare function canonicalGraph(value: Graph): JsonValue;
|
|
8
8
|
export declare function canonicalTask(task: FlowDocument['tasks'][string]): JsonValue;
|
|
9
9
|
export declare function canonicalDocument(document: FlowDocument): JsonValue;
|
|
@@ -19,13 +19,14 @@ function a(e) {
|
|
|
19
19
|
function o(e) {
|
|
20
20
|
return {
|
|
21
21
|
...e.description == null ? {} : { description: e.description },
|
|
22
|
+
handle: e.handle,
|
|
22
23
|
jsonSchema: e.jsonSchema,
|
|
23
24
|
nullable: e.nullable,
|
|
24
25
|
...Object.hasOwn(e, "value") ? { value: e.value } : {}
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
function s(e) {
|
|
28
|
-
return
|
|
29
|
+
return e.map(o);
|
|
29
30
|
}
|
|
30
31
|
function c(e) {
|
|
31
32
|
switch (e.kind) {
|
|
@@ -43,18 +44,20 @@ function l(e) {
|
|
|
43
44
|
return Object.fromEntries(a(e).map(([e, t]) => [e, c(t)]));
|
|
44
45
|
}
|
|
45
46
|
function u(e) {
|
|
46
|
-
return
|
|
47
|
-
...
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
return e.map((e) => ({
|
|
48
|
+
...e.description == null ? {} : { description: e.description },
|
|
49
|
+
handle: e.handle,
|
|
50
|
+
jsonSchema: e.jsonSchema,
|
|
51
|
+
nullable: e.nullable,
|
|
52
|
+
sources: e.sources.map((e) => ({ ...e }))
|
|
53
|
+
}));
|
|
52
54
|
}
|
|
53
55
|
function d(e) {
|
|
54
56
|
if (!("inputs" in e)) return v(e);
|
|
55
57
|
let t = {
|
|
56
58
|
concurrency: e.concurrency,
|
|
57
59
|
...e.description == null ? {} : { description: e.description },
|
|
60
|
+
...e.icon == null ? {} : { icon: e.icon },
|
|
58
61
|
inputs: l(e.inputs),
|
|
59
62
|
...e.name == null ? {} : { name: e.name },
|
|
60
63
|
...e.timeoutMs == null ? {} : { timeoutMs: e.timeoutMs }
|
|
@@ -172,6 +175,7 @@ function _(e) {
|
|
|
172
175
|
function v(e) {
|
|
173
176
|
let t = (t) => ({
|
|
174
177
|
...e.description == null ? {} : { description: e.description },
|
|
178
|
+
...e.icon == null ? {} : { icon: e.icon },
|
|
175
179
|
kind: t,
|
|
176
180
|
name: e.name
|
|
177
181
|
});
|