@oomol-lab/open-flow 0.1.0-beta.1 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,7 +104,17 @@ function g(e, t, r, i, a) {
104
104
  method: "POST"
105
105
  });
106
106
  }
107
- function _(e, t, n, r, i) {
107
+ async function _(e, t, n, r) {
108
+ let o = await c(t, n, r), l = s(o.operationId, `${r} operationId`);
109
+ for (let t = 0; o.status == "pending" && t < 100; t += 1) await new Promise((e) => setTimeout(e, 10)), o = await c(await u(e, `/v1/flows/${s(o.flowId, `${r} flowId`)}/publish-operations/${l}`), 200, `${r} operation`);
110
+ i(o.status, "succeeded", `${r} terminal status`);
111
+ let d = s(o.publicationId, `${r} publicationId`), f = a((await c(await u(e, `/v1/flows/${s(o.flowId, `${r} flowId`)}/live`), 200, `${r} Live`)).publication, `${r} Publication`);
112
+ return i(f.publicationId, d, `${r} Live Publication`), {
113
+ operation: o,
114
+ publication: f
115
+ };
116
+ }
117
+ function v(e, t, n, r, i) {
108
118
  return u(e, `/v1/flows/${encodeURIComponent(t)}/publications/${encodeURIComponent(n)}/rollback`, {
109
119
  body: JSON.stringify({
110
120
  expectedLivePublicationId: r,
@@ -114,7 +124,7 @@ function _(e, t, n, r, i) {
114
124
  method: "POST"
115
125
  });
116
126
  }
117
- function v(e, t, n) {
127
+ function y(e, t, n) {
118
128
  return u(e, "/v1/runs", {
119
129
  body: JSON.stringify({
120
130
  inputs: {},
@@ -125,7 +135,7 @@ function v(e, t, n) {
125
135
  method: "POST"
126
136
  });
127
137
  }
128
- var y = [
138
+ var b = [
129
139
  {
130
140
  name: "manages deployment Variables with stable limits and exact-case identity",
131
141
  async verify(e) {
@@ -321,35 +331,35 @@ var y = [
321
331
  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");
322
332
  }
323
333
  }
324
- ], b = [{
334
+ ], x = [{
325
335
  name: "publishes one immutable Flow with idempotent Live CAS",
326
336
  async verify(e) {
327
337
  let t = await f(e, "Publication flow", "publication-flow"), n = s(t.flowId, "Publication Flow flowId"), r = s(t.draftRevisionId, "Publication Flow revisionId");
328
338
  i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read Live")).status, "not-published", "Initial Live status");
329
- let a = () => g(e, n, r, null, "publication-first"), o = await c(await a(), 201, "Publish Flow"), d = s(o.publicationId, "Publication id");
330
- 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");
331
- let p = await c(await u(e, `/v1/flows/${n}/publications?includeTotal=true`), 200, "List Publications");
332
- i(p.publications, [o], "Publication history"), i(p.total, 1, "Publication total"), await l(await u(e, `/v1/flows/${n}/revisions/${r}/publications`, {
339
+ let a = () => g(e, n, r, null, "publication-first"), o = await _(e, await a(), 202, "Publish Flow"), d = o.publication, p = s(d.publicationId, "Publication id");
340
+ i(await c(await a(), 202, "Replay Publish"), o.operation, "Replayed Publish operation"), await l(await g(e, n, r, p, "publication-first"), 409, "publication.conflict", "Conflicting replay"), i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read published Live")).publication, d, "Live Publication");
341
+ let m = await c(await u(e, `/v1/flows/${n}/publications?includeTotal=true`), 200, "List Publications");
342
+ i(m.publications, [d], "Publication history"), i(m.total, 1, "Publication total"), await l(await u(e, `/v1/flows/${n}/revisions/${r}/publications`, {
333
343
  body: JSON.stringify({
334
344
  engineContract: "unsupported-engine/v1",
335
- expectedLivePublicationId: d,
345
+ expectedLivePublicationId: p,
336
346
  version: 1
337
347
  }),
338
348
  headers: { "idempotency-key": "unsupported-publication" },
339
349
  method: "POST"
340
- }), 409, "engine.unsupported", "Publish unsupported Engine"), await l(await g(e, n, "00000000-0000-7000-8000-000000000002", d, "missing-revision-publication"), 404, "flow.not-found", "Publish missing Revision"), await l(await _(e, n, "00000000-0000-7000-8000-000000000004", d, "missing-rollback"), 404, "publication.not-found", "Rollback missing Publication"), await l(await v(e, "00000000-0000-7000-8000-000000000004", "missing-publication-run"), 404, "publication.not-found", "Run missing Publication");
350
+ }), 409, "engine.unsupported", "Publish unsupported Engine"), await l(await g(e, n, "00000000-0000-7000-8000-000000000002", p, "missing-revision-publication"), 404, "flow.not-found", "Publish missing Revision"), await l(await v(e, n, "00000000-0000-7000-8000-000000000004", p, "missing-rollback"), 404, "publication.not-found", "Rollback missing Publication"), await l(await y(e, "00000000-0000-7000-8000-000000000004", "missing-publication-run"), 404, "publication.not-found", "Run missing Publication");
341
351
  }
342
352
  }, {
343
353
  name: "rolls back immutable history and fixes a Live Run target",
344
354
  async verify(e) {
345
- 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");
346
- await l(await v(e, a, "stale-live-run"), 412, "live.conflict", "Run stale Publication");
347
- let d = () => _(e, n, a, o, "rollback-first"), p = await c(await d(), 201, "Rollback Flow"), y = s(p.publicationId, "Rollback Publication");
348
- i(p.operation, "rollback", "Rollback operation"), i(p.sourcePublicationId, a, "Rollback source"), i(await c(await d(), 200, "Replay Rollback"), p, "Replayed Rollback");
349
- let b = await c(await v(e, y, "rollback-run"), 202, "Create Live Run");
350
- 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");
355
+ let t = await f(e, "Rollback flow", "rollback-flow"), n = s(t.flowId, "Rollback Flow flowId"), r = s(t.draftRevisionId, "Rollback Flow revisionId"), a = (await _(e, await g(e, n, r, null, "publish-first"), 202, "Publish first Revision")).publication, o = s(a.publicationId, "First Publication"), d = (await _(e, await g(e, n, h(await c(await m(e, n, r), 200, "Change Draft"), "Second Revision"), o, "publish-second"), 202, "Publish second Revision")).publication, p = s(d.publicationId, "Second Publication");
356
+ await l(await y(e, o, "stale-live-run"), 412, "live.conflict", "Run stale Publication");
357
+ let b = () => v(e, n, o, p, "rollback-first"), x = await c(await b(), 201, "Rollback Flow"), S = s(x.publicationId, "Rollback Publication");
358
+ i(x.operation, "rollback", "Rollback operation"), i(x.sourcePublicationId, o, "Rollback source"), i(await c(await b(), 200, "Replay Rollback"), x, "Replayed Rollback");
359
+ let C = await c(await y(e, S, "rollback-run"), 202, "Create Live Run");
360
+ i(C.flowId, n, "Live Run flowId"), i(C.revisionId, r, "Live Run revisionId"), await c(await u(e, `/v1/flows/${n}`, { method: "DELETE" }), 202, "Retire Flow"), await l(await y(e, S, "retired-run"), 409, "flow.busy", "Run retired Flow");
351
361
  }
352
- }], x = [{
362
+ }], S = [{
353
363
  name: "exposes one deployment-scoped Trigger Key catalog",
354
364
  async verify(e) {
355
365
  let t = await c(await u(e, "/v1/trigger-keys"), 200, "List Trigger Keys"), n = await c(await u(e, "/v1/trigger-keys/catalog"), 200, "List Trigger definitions"), r = o(t.keys, "Trigger Keys").map((e) => a(e, "Trigger Key")), d = o(n.definitions, "Trigger definitions").map((e) => a(e, "Trigger definition"));
@@ -385,20 +395,20 @@ var y = [
385
395
  },
386
396
  nodeId: "webhook",
387
397
  target: { kind: "flow" }
388
- }]), 200, "Create Trigger nodes"), "Trigger Revision"), l = s((await c(await g(e, n, r, null, "trigger-publication"), 201, "Publish Trigger Flow")).publicationId, "Trigger Publication"), d = `/v1/flows/${n}/triggers`, m = o((await c(await u(e, d), 200, "List Trigger bindings")).bindings, "Trigger bindings").map((e) => a(e, "Trigger binding"));
389
- i(m.map((e) => e.triggerNodeId), ["cron", "webhook"], "Trigger binding order");
390
- for (let e of m) i(e.currentPublicationId, l, "Trigger Publication");
391
- let _ = `${d}/webhook`, v = s(a((await c(await u(e, _), 200, "Read Webhook")).binding, "Webhook").endpointUrl, "Webhook endpoint"), y = (t) => u(e, `${_}/${t}`, {
398
+ }]), 200, "Create Trigger nodes"), "Trigger Revision"), l = (await _(e, await g(e, n, r, null, "trigger-publication"), 202, "Publish Trigger Flow")).publication, d = s(l.publicationId, "Trigger Publication"), m = `/v1/flows/${n}/triggers`, v = o((await c(await u(e, m), 200, "List Trigger bindings")).bindings, "Trigger bindings").map((e) => a(e, "Trigger binding"));
399
+ i(v.map((e) => e.triggerNodeId), ["cron", "webhook"], "Trigger binding order");
400
+ for (let e of v) i(e.currentPublicationId, d, "Trigger Publication");
401
+ let y = `${m}/webhook`, b = s(a((await c(await u(e, y), 200, "Read Webhook")).binding, "Webhook").endpointUrl, "Webhook endpoint"), x = (t) => u(e, `${y}/${t}`, {
392
402
  body: JSON.stringify({ version: 1 }),
393
403
  method: "POST"
394
404
  });
395
- i((await c(await y("pause"), 200, "Pause Webhook")).operatorState, "paused", "Paused state"), i((await e.request(new Request(v, { method: "POST" }))).status, 404, "Paused callback"), i((await c(await y("resume"), 200, "Resume Webhook")).operatorState, "active", "Resumed state"), i((await e.request(new Request(v, { method: "POST" }))).status, 200, "Resumed callback"), await c(await g(e, n, h(await c(await p(e, n, r, [{
405
+ i((await c(await x("pause"), 200, "Pause Webhook")).operatorState, "paused", "Paused state"), i((await e.request(new Request(b, { method: "POST" }))).status, 404, "Paused callback"), i((await c(await x("resume"), 200, "Resume Webhook")).operatorState, "active", "Resumed state"), i((await e.request(new Request(b, { method: "POST" }))).status, 200, "Resumed callback"), await _(e, await g(e, n, h(await c(await p(e, n, r, [{
396
406
  kind: "graph.node.delete",
397
407
  nodeId: "webhook",
398
408
  target: { kind: "flow" }
399
- }]), 200, "Delete Webhook"), "Retired Trigger Revision"), l, "retire-trigger"), 201, "Publish retired Trigger"), i(a((await c(await u(e, _), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
409
+ }]), 200, "Delete Webhook"), "Retired Trigger Revision"), d, "retire-trigger"), 202, "Publish retired Trigger"), i(a((await c(await u(e, y), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
400
410
  }
401
- }], S = [{
411
+ }], C = [{
402
412
  name: "projects the deployment Connector catalog and authorized Connections",
403
413
  async verify(e) {
404
414
  let t = o((await c(await u(e, "/v1/connector/providers"), 200, "List Connector Providers")).providers, "Connector Providers").map((e) => a(e, "Connector Provider")), n = o((await c(await u(e, "/v1/connector/actions"), 200, "List Connector Actions")).actions, "Connector Actions").map((e) => a(e, "Connector Action"));
@@ -420,4 +430,4 @@ var y = [
420
430
  }
421
431
  }];
422
432
  //#endregion
423
- export { S as connectorControlApiConformanceCases, y as controlApiConformanceCases, b as publicationControlApiConformanceCases, x as triggerControlApiConformanceCases };
433
+ export { C as connectorControlApiConformanceCases, b as controlApiConformanceCases, x as publicationControlApiConformanceCases, S as triggerControlApiConformanceCases };
@@ -18,6 +18,8 @@ export declare const controlErrorCode: {
18
18
  readonly pageInvalidCursor: 'page.invalid-cursor';
19
19
  readonly publicationConflict: 'publication.conflict';
20
20
  readonly publicationNotFound: 'publication.not-found';
21
+ readonly publicationUnsupported: 'publication.unsupported';
22
+ readonly publishOperationNotFound: 'publication.operation-not-found';
21
23
  readonly routeNotFound: 'route.not-found';
22
24
  readonly runConflict: 'run.conflict';
23
25
  readonly runEventsExpired: 'run.events-expired';
@@ -91,6 +93,12 @@ export declare const controlErrorMetadata: {
91
93
  readonly "publication.not-found": {
92
94
  readonly status: 404;
93
95
  };
96
+ readonly "publication.unsupported": {
97
+ readonly status: 409;
98
+ };
99
+ readonly "publication.operation-not-found": {
100
+ readonly status: 404;
101
+ };
94
102
  readonly "route.not-found": {
95
103
  readonly status: 404;
96
104
  };
@@ -80,6 +80,7 @@ export interface ConnectorConnection {
80
80
  }
81
81
  export interface ConnectorAction {
82
82
  readonly actionId: string;
83
+ readonly authenticated: boolean;
83
84
  readonly defaultConnection?: ConnectorConnection;
84
85
  readonly description: string;
85
86
  readonly icon?: string;
@@ -137,6 +138,37 @@ export interface Publication {
137
138
  readonly sourcePublicationId?: string;
138
139
  readonly version: 1;
139
140
  }
141
+ export type PublishOperation = {
142
+ readonly createdAt: string;
143
+ readonly flowId: string;
144
+ readonly operationId: string;
145
+ readonly revisionId: string;
146
+ readonly status: 'pending';
147
+ readonly updatedAt: string;
148
+ readonly version: 1;
149
+ } | {
150
+ readonly createdAt: string;
151
+ readonly flowId: string;
152
+ readonly operationId: string;
153
+ readonly publicationId: string;
154
+ readonly revisionId: string;
155
+ readonly status: 'succeeded';
156
+ readonly updatedAt: string;
157
+ readonly version: 1;
158
+ } | {
159
+ readonly createdAt: string;
160
+ readonly flowId: string;
161
+ readonly issue: {
162
+ readonly code: string;
163
+ readonly message: string;
164
+ readonly nodeId?: string;
165
+ };
166
+ readonly operationId: string;
167
+ readonly revisionId: string;
168
+ readonly status: 'failed';
169
+ readonly updatedAt: string;
170
+ readonly version: 1;
171
+ };
140
172
  export interface Diagnostic {
141
173
  readonly code: string;
142
174
  readonly column: number;
@@ -315,7 +347,8 @@ export declare class ControlClient {
315
347
  }): Promise<PublicationPage>;
316
348
  createDraftRun(flowId: string, revisionId: string, options?: RunOptions): Promise<DraftRun>;
317
349
  createLiveRun(publicationId: string, options?: RunOptions): Promise<LiveRun>;
318
- publishFlow(flowId: string, revisionId: string, expectedLivePublicationId: string | null, options?: PublicationOptions): Promise<Publication>;
350
+ publishFlow(flowId: string, revisionId: string, expectedLivePublicationId: string | null, options?: PublicationOptions): Promise<PublishOperation>;
351
+ getPublishOperation(flowId: string, operationId: string): Promise<PublishOperation>;
319
352
  rollbackFlow(flowId: string, publicationId: string, expectedLivePublicationId: string, options?: PublicationOptions): Promise<Publication>;
320
353
  getRun(runId: string): Promise<RunDetails>;
321
354
  listRuns(flowId: string, options?: {