@oomol-lab/open-flow 0.1.0-alpha.3 → 0.1.0-alpha.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.
@@ -32,11 +32,12 @@ var J = {
32
32
  runInvalid: "run.invalid",
33
33
  runNotFound: "run.not-found",
34
34
  runNotTerminal: "run.not-terminal",
35
+ runOverloaded: "run.overloaded",
35
36
  triggerKeyInvalid: "trigger-key.invalid",
36
37
  triggerKeyNotFound: "trigger-key.not-found",
37
38
  triggerNotFound: "trigger.not-found"
38
39
  };
39
- J.authenticationRequired, J.authorizationDenied, J.bindingUnresolved, J.connectorActionNotFound, J.connectorUnavailable, J.engineUnavailable, J.engineUnsupported, J.flowInvalid, J.flowNotFound, J.liveConflict, J.liveNotFound, J.pageInvalidCursor, J.projectBusy, J.projectConflict, J.projectInvalid, J.projectNotFound, J.projectPresentationConflict, J.projectRevisionConflict, J.publicationConflict, J.publicationNotFound, J.routeNotFound, J.runConflict, J.runEventsExpired, J.runInvalid, J.runNotFound, J.runNotTerminal, J.triggerKeyInvalid, J.triggerKeyNotFound, J.triggerNotFound;
40
+ J.authenticationRequired, J.authorizationDenied, J.bindingUnresolved, J.connectorActionNotFound, J.connectorUnavailable, J.engineUnavailable, J.engineUnsupported, J.flowInvalid, J.flowNotFound, J.liveConflict, J.liveNotFound, J.pageInvalidCursor, J.projectBusy, J.projectConflict, J.projectInvalid, J.projectNotFound, J.projectPresentationConflict, J.projectRevisionConflict, J.publicationConflict, J.publicationNotFound, J.routeNotFound, J.runConflict, J.runEventsExpired, J.runInvalid, J.runNotFound, J.runNotTerminal, J.runOverloaded, J.triggerKeyInvalid, J.triggerKeyNotFound, J.triggerNotFound;
40
41
  var Ht = [
41
42
  "canceled",
42
43
  "completed",
@@ -725,17 +726,14 @@ var Ln = class {
725
726
  "version"
726
727
  ]), r.version != 1 || Z(r.projectId) != e || Z(r.serviceId) != t || !Array.isArray(r.connections) ? Y() : r.connections.map(Jt);
727
728
  }
728
- async createConnectorConnectionPage(e, t, n) {
729
- let r = X(await this.request(`/v1/projects/${Q(e)}/connector/connections/${Q(t)}/page`, {
730
- body: JSON.stringify({
731
- returnUrl: n,
732
- version: 1
733
- }),
729
+ async createConnectorConnectionPage(e, t) {
730
+ let n = X(await this.request(`/v1/projects/${Q(e)}/connector/connections/${Q(t)}/page`, {
731
+ body: JSON.stringify({ version: 1 }),
734
732
  method: "POST"
735
733
  }));
736
- if (Gt(r, ["url", "version"]), r.version != 1) return Y();
734
+ if (Gt(n, ["url", "version"]), n.version != 1) return Y();
737
735
  try {
738
- let e = new URL(Z(r.url));
736
+ let e = new URL(Z(n.url));
739
737
  return e.protocol != "http:" && e.protocol != "https:" ? Y() : e.href;
740
738
  } catch {
741
739
  return Y();
@@ -781,16 +779,17 @@ var Ln = class {
781
779
  }));
782
780
  return i.source == "draft" ? i : Y();
783
781
  }
784
- async createLiveRun(e, t, n = {}) {
785
- let r = kn(await this.request(`/v1/projects/${Q(e)}/flows/${Q(t)}/runs`, {
782
+ async createLiveRun(e, t = {}) {
783
+ let n = kn(await this.request("/v1/runs", {
786
784
  body: JSON.stringify({
787
- inputs: n.inputs ?? {},
785
+ inputs: t.inputs ?? {},
786
+ publicationId: e,
788
787
  version: 1
789
788
  }),
790
- headers: { "idempotency-key": n.idempotencyKey ?? In("run") },
789
+ headers: { "idempotency-key": t.idempotencyKey ?? In("run") },
791
790
  method: "POST"
792
791
  }));
793
- return r.source == "live" ? r : Y();
792
+ return n.source == "live" ? n : Y();
794
793
  }
795
794
  async publishFlow(e, t, n, r, i = {}) {
796
795
  return yn(await this.request(`/v1/projects/${Q(e)}/revisions/${Q(t)}/flows/${Q(n)}/publications`, {
@@ -813,8 +812,8 @@ var Ln = class {
813
812
  method: "POST"
814
813
  }));
815
814
  }
816
- async getRun(e, t) {
817
- return kn(await this.request(`/v1/projects/${Q(e)}/runs/${Q(t)}`));
815
+ async getRun(e) {
816
+ return kn(await this.request(`/v1/runs/${Q(e)}`));
818
817
  }
819
818
  async listRuns(e, t = {}) {
820
819
  let n = new URLSearchParams();
@@ -822,17 +821,17 @@ var Ln = class {
822
821
  let r = n.size == 0 ? "" : `?${n}`;
823
822
  return An(await this.request(`/v1/projects/${Q(e)}/runs${r}`));
824
823
  }
825
- async getRunEvents(e, t, n = {}) {
826
- let r = new URLSearchParams();
827
- n.after != null && r.set("after", String(n.after)), n.limit != null && r.set("limit", String(n.limit));
828
- let i = r.size == 0 ? "" : `?${r}`;
829
- return Nn(await this.request(`/v1/projects/${Q(e)}/runs/${Q(t)}/events${i}`));
824
+ async getRunEvents(e, t = {}) {
825
+ let n = new URLSearchParams();
826
+ t.after != null && n.set("after", String(t.after)), t.limit != null && n.set("limit", String(t.limit));
827
+ let r = n.size == 0 ? "" : `?${n}`;
828
+ return Nn(await this.request(`/v1/runs/${Q(e)}/events${r}`));
830
829
  }
831
- async getRunResult(e, t) {
832
- return Fn(await this.request(`/v1/projects/${Q(e)}/runs/${Q(t)}/result`));
830
+ async getRunResult(e) {
831
+ return Fn(await this.request(`/v1/runs/${Q(e)}/result`));
833
832
  }
834
- async cancelRun(e, t) {
835
- return Pn(await this.request(`/v1/projects/${Q(e)}/runs/${Q(t)}/cancel`, {
833
+ async cancelRun(e) {
834
+ return Pn(await this.request(`/v1/runs/${Q(e)}/cancel`, {
836
835
  body: JSON.stringify({ version: 1 }),
837
836
  method: "POST"
838
837
  }));
@@ -6288,7 +6287,7 @@ var Bo = class {
6288
6287
  let t = this.#e.begin();
6289
6288
  this.#a(void 0), this.#f({ cancelingRunId: e.runId });
6290
6289
  try {
6291
- let n = await this.#t.cancelRun(e.projectId, e.runId);
6290
+ let n = await this.#t.cancelRun(e.runId);
6292
6291
  if (!t()) return;
6293
6292
  let r = this.#o.value, i = r.run?.runId == e.runId ? {
6294
6293
  ...r.run,
@@ -6349,7 +6348,7 @@ var Bo = class {
6349
6348
  }
6350
6349
  async #l(e, t, n = 0) {
6351
6350
  try {
6352
- let r = this.#o.value.eventCursor, [i, a] = await Promise.allSettled([this.#t.getRun(e.projectId, e.runId), this.#t.getRunEvents(e.projectId, e.runId, {
6351
+ let r = this.#o.value.eventCursor, [i, a] = await Promise.allSettled([this.#t.getRun(e.runId), this.#t.getRunEvents(e.runId, {
6353
6352
  after: r,
6354
6353
  limit: Io
6355
6354
  })]);
@@ -6383,7 +6382,7 @@ var Bo = class {
6383
6382
  }
6384
6383
  async #u(e, t) {
6385
6384
  if (!Ut(e.status) || this.#o.value.result?.runId == e.runId) return;
6386
- let n = await this.#t.getRunResult(e.projectId, e.runId);
6385
+ let n = await this.#t.getRunResult(e.runId);
6387
6386
  t() && this.#o.value.run?.runId == e.runId && this.#f({ result: n });
6388
6387
  }
6389
6388
  #d() {
@@ -1,7 +1,7 @@
1
1
  import { i as e, o as t, t as n } from "./rolldown-runtime-CEFd7nDs.js";
2
2
  import { a as r, c as i, d as a, f as o, i as s, l as c, n as l, r as u, s as d, t as f, u as p } from "./dist-0lWKriL5.js";
3
3
  import { $ as m, $n as h, $t as g, A as _, An as v, Ar as y, At as b, B as x, Bn as S, Br as C, Bt as w, C as T, Ct as E, D, Dn as O, Dr as k, Dt as A, E as j, Er as M, Et as N, F as P, Ft as F, G as ee, Gn as I, Gr as L, Gt as te, H as ne, Hn as re, Hr as R, Ht as ie, I as ae, J as oe, Jn as se, Jt as ce, K as le, Kn as ue, Kt as de, L as fe, Lt as pe, M as me, Mn as he, Mt as ge, N as _e, Nn as ve, Nt as ye, O as be, On as xe, P as Se, Pn as Ce, Pt as we, Q as Te, Qn as Ee, Qt as De, R as Oe, Rr as ke, Rt as Ae, S as je, T as Me, Tn as Ne, Tt as Pe, U as Fe, Un as Ie, Ur as Le, Ut as Re, Vn as ze, Vr as Be, Vt as Ve, Wr as z, Wt as He, X as Ue, Xn as We, Xt as Ge, Y as Ke, Yn as qe, Yt as Je, Z as Ye, Zn as Xe, _r as Ze, _t as Qe, a as $e, ar as et, at as tt, bt as nt, c as rt, cr as it, ct as at, d as ot, dr as st, dt as ct, er as lt, et as ut, f as dt, fr as ft, ft as pt, g as mt, gr as ht, gt, h as _t, hr as vt, ht as yt, i as bt, ir as xt, it as St, j as Ct, jn as wt, jr as Tt, jt as Et, kr as Dt, lr as Ot, lt as kt, m as At, mr as jt, mt as Mt, n as Nt, nr as B, nt as V, o as Pt, or as Ft, ot as It, p as Lt, pr as Rt, pt as zt, q as Bt, qn as Vt, qt as Ht, r as Ut, rr as Wt, rt as Gt, s as Kt, sr as qt, st as Jt, t as Yt, tr as Xt, tt as Zt, u as Qt, ur as $t, ut as en, v as tn, vr as nn, vt as rn, w as an, wn as on, x as sn, xn as cn, xt as ln, y as un, yt as dn, z as fn, zn as pn, zr as mn, zt as hn } from "./createLucideIcon-MmUpJrIU.js";
4
- import { $ as gn, A as _n, B as vn, C as yn, D as bn, E as xn, F as Sn, G as Cn, H as wn, I as Tn, J as En, K as Dn, L as On, M as kn, N as An, O as jn, P as Mn, Q as Nn, R as Pn, S as Fn, T as In, U as Ln, V as Rn, W as zn, X as Bn, Y as Vn, Z as Hn, at as Un, b as Wn, ct as Gn, et as Kn, h as qn, it as Jn, j as Yn, k as Xn, lt as Zn, nt as Qn, ot as $n, q as er, r as tr, rt as nr, s as rr, tt as ir, w as ar, z as or } from "./addNodeOptions-B_d-Z5D3.js";
4
+ import { $ as gn, A as _n, B as vn, C as yn, D as bn, E as xn, F as Sn, G as Cn, H as wn, I as Tn, J as En, K as Dn, L as On, M as kn, N as An, O as jn, P as Mn, Q as Nn, R as Pn, S as Fn, T as In, U as Ln, V as Rn, W as zn, X as Bn, Y as Vn, Z as Hn, at as Un, b as Wn, ct as Gn, et as Kn, h as qn, it as Jn, j as Yn, k as Xn, lt as Zn, nt as Qn, ot as $n, q as er, r as tr, rt as nr, s as rr, tt as ir, w as ar, z as or } from "./addNodeOptions-CGyTkP99.js";
5
5
  import { a as sr, c as cr, d as lr, f as ur, i as dr, l as fr, n as pr, o as mr, p as hr, r as gr, s as _r, t as vr, u as yr } from "./field-runIpvMd.js";
6
6
  import { $ as br, $t as xr, A as Sr, At as Cr, B as wr, Bt as Tr, C as Er, Cn as Dr, Ct as Or, D as kr, Dt as Ar, E as jr, En as Mr, Et as Nr, F as Pr, Ft as Fr, G as Ir, Gt as Lr, H as Rr, Ht as zr, I as Br, It as Vr, J as Hr, Jt as Ur, K as Wr, Kt as Gr, L as Kr, Lt as qr, M as Jr, Mt as Yr, N as Xr, Nt as Zr, O as Qr, Ot as $r, P as ei, Pt as ti, Q as ni, Qt as ri, R as ii, Rt as ai, Sn as oi, St as si, T as ci, Tn as li, Tt as ui, U as di, Ut as fi, V as pi, Vt as mi, W as hi, Wt as gi, X as _i, Xt as vi, Y as yi, Yt as bi, Z as xi, Zt as Si, _ as Ci, _n as wi, _t as Ti, a as Ei, an as Di, at as Oi, b as ki, bn as Ai, bt as ji, c as Mi, cn as Ni, ct as Pi, d as Fi, dn as Ii, dt as Li, en as Ri, et as zi, f as Bi, fn as Vi, ft as Hi, g as Ui, gn as Wi, gt as Gi, h as Ki, hn as qi, ht as Ji, i as Yi, in as Xi, it as Zi, j as Qi, jt as $i, k as ea, kt as ta, l as na, ln as ra, lt as ia, m as aa, mn as oa, mt as sa, nn as ca, nt as la, o as ua, on as da, ot as fa, p as pa, pn as ma, pt as ha, q as ga, qt as _a, r as va, rn as ya, rt as ba, s as xa, sn as Sa, st as Ca, t as wa, tn as Ta, tt as Ea, u as Da, un as Oa, ut as ka, v as Aa, vn as ja, vt as Ma, w as Na, wn as Pa, wt as Fa, x as Ia, xn as La, y as Ra, yn as za, yt as Ba, z as Va, zt as Ha } from "./flowRunInputEditorStore-B49C0ZmK.js";
7
7
  import * as H from "react";
@@ -8,7 +8,6 @@ export interface WorkbenchNotification {
8
8
  readonly message: string;
9
9
  }
10
10
  export interface WorkbenchHost {
11
- readonly returnUrl: string;
12
11
  notify(notification: WorkbenchNotification | undefined): void;
13
12
  openExternalPage(resolveUrl: () => Promise<string>): Promise<boolean>;
14
13
  request(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import { a as e, f as t, i as n } from "./dist-0lWKriL5.js";
2
2
  import { Ir as r, Rr as i, Wr as a } from "./createLucideIcon-MmUpJrIU.js";
3
- import { _ as o, a as s, c, d as l, dt as u, f as d, g as f, i as p, l as m, m as h, n as g, o as _, p as v, st as y, t as b, u as x, ut as ee, v as S, x as te, y as ne } from "./addNodeOptions-B_d-Z5D3.js";
3
+ import { _ as o, a as s, c, d as l, dt as u, f as d, g as f, i as p, l as m, m as h, n as g, o as _, p as v, st as y, t as b, u as x, ut as ee, v as S, x as te, y as ne } from "./addNodeOptions-CGyTkP99.js";
4
4
  import { Suspense as re, lazy as ie, useEffect as C, useRef as ae, useState as oe } from "react";
5
5
  import { jsx as w, jsxs as se } from "react/jsx-runtime";
6
6
  //#region src/workbench/browser/runtime/navigation.ts
@@ -597,23 +597,25 @@ var ge = class {
597
597
  starting: !0,
598
598
  submitting: e
599
599
  });
600
- let c = JSON.stringify({
600
+ let c = e == "draft" ? {
601
601
  flowId: n.flowId,
602
- inputs: i,
603
602
  projectId: t,
604
- revisionId: r,
605
- source: e
606
- }), l = this.#c?.signature == c ? this.#c : {
603
+ revisionId: r
604
+ } : { publicationId: n.live.publication.publicationId }, l = JSON.stringify({
605
+ inputs: i,
606
+ source: e,
607
+ ...c
608
+ }), u = this.#c?.signature == l ? this.#c : {
607
609
  key: this.#t(),
608
- signature: c
610
+ signature: l
609
611
  };
610
- this.#c = l;
612
+ this.#c = u;
611
613
  try {
612
614
  let o = e == "draft" ? await this.#e.createDraftRun(t, r, n.flowId, {
613
- idempotencyKey: l.key,
615
+ idempotencyKey: u.key,
614
616
  inputs: i
615
- }) : await this.#e.createLiveRun(t, n.flowId, {
616
- idempotencyKey: l.key,
617
+ }) : await this.#e.createLiveRun(n.live.publication.publicationId, {
618
+ idempotencyKey: u.key,
617
619
  inputs: i
618
620
  });
619
621
  return !a() || !s() ? !1 : (this.#c = void 0, this.#a.follow(o, s));
@@ -839,7 +841,7 @@ var be = class {
839
841
  if (t == null) return;
840
842
  let n = this.#l.value.catalogs[e];
841
843
  try {
842
- if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(t, e, this.#n.returnUrl))) {
844
+ if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(t, e))) {
843
845
  this.#c({
844
846
  kind: "error",
845
847
  message: this.#t.t("notice.connectionPopupBlocked")
@@ -1126,7 +1128,7 @@ var Ce = class {
1126
1128
  async connect(e) {
1127
1129
  let t = this.#l.$.projectId.value;
1128
1130
  if (!(this.#u || t == null)) try {
1129
- if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(t, e, this.#r.returnUrl))) {
1131
+ if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(t, e))) {
1130
1132
  this.#s({
1131
1133
  kind: "error",
1132
1134
  message: this.#i.t("notice.connectionPopupBlocked")
@@ -3215,10 +3217,7 @@ function At(e, t, n, r, i) {
3215
3217
  return e.payload.scopeId == a && e.payload.flowId == t.id && typeof n == "string" && i.has(n) ? [[e.sequence, n]] : [];
3216
3218
  })) : /* @__PURE__ */ new Map();
3217
3219
  }
3218
- var jt = {
3219
- openExternalPage: async () => !1,
3220
- returnUrl: ""
3221
- }, Mt = class {
3220
+ var jt = { openExternalPage: async () => !1 }, Mt = class {
3222
3221
  #e;
3223
3222
  #t;
3224
3223
  #n;
@@ -3332,14 +3331,14 @@ var jt = {
3332
3331
  if (this.#r || this.runRequests.$.submitting.value != null || this.workspace.$.projectId.value != t.projectId || n?.kind != "flow" || n.id != t.flowId) return;
3333
3332
  let r = this.#e.begin();
3334
3333
  try {
3335
- let n = await e.getRun(t.projectId, t.runId), i = this.workspace.$.target.value;
3334
+ let n = await e.getRun(t.runId), i = this.workspace.$.target.value;
3336
3335
  if (!r() || this.#r || this.workspace.$.projectId.value != t.projectId || i?.kind != "flow" || i.id != t.flowId || n.projectId != t.projectId || n.flowId != t.flowId || n.runId != t.runId) return;
3337
3336
  this.runs.followExternal(n);
3338
3337
  } catch {
3339
3338
  return;
3340
3339
  }
3341
3340
  }
3342
- }, Nt = ie(() => import("./flowWorkspace-CRRe__mi.js"));
3341
+ }, Nt = ie(() => import("./flowWorkspace-CGsEHe2F.js"));
3343
3342
  function Pt({ host: e, store: t }) {
3344
3343
  let n = a(t.$.notice);
3345
3344
  return C(() => e.notify(n), [e, n]), C(() => () => e.notify(void 0), [e]), null;
@@ -164,13 +164,14 @@ function S(e, t, n, r, i, a) {
164
164
  method: "POST"
165
165
  });
166
166
  }
167
- function C(e, t, n, r, i = {}) {
168
- return m(e, `/v1/projects/${encodeURIComponent(t)}/flows/${encodeURIComponent(n)}/runs`, {
167
+ function C(e, t, n, r = {}) {
168
+ return m(e, "/v1/runs", {
169
169
  body: JSON.stringify({
170
- inputs: i,
170
+ inputs: r,
171
+ publicationId: t,
171
172
  version: 1
172
173
  }),
173
- headers: { "idempotency-key": r },
174
+ headers: { "idempotency-key": n },
174
175
  method: "POST"
175
176
  });
176
177
  }
@@ -266,14 +267,14 @@ var T = [
266
267
  method: "POST"
267
268
  }), d = await f(await u(), 202, "Create Draft Run"), h = s(d.runId, "Draft Run runId");
268
269
  i(d.projectId, r, "Draft Run projectId"), i(d.revisionId, c, "Draft Run revisionId"), i(d.flowId, "main", "Draft Run flowId"), i(d.source, "draft", "Draft Run source"), i(d.status, "queued", "Draft Run status"), i(await f(await u(), 200, "Replay Draft Run"), d, "Replayed Draft Run");
269
- let _ = `/v1/projects/${encodeURIComponent(r)}/runs/${encodeURIComponent(h)}`;
270
+ let _ = `/v1/runs/${encodeURIComponent(h)}`;
270
271
  i(await f(await m(e, _), 200, "Read Draft Run"), d, "Read Draft Run");
271
272
  let b = await f(await m(e, `/v1/projects/${encodeURIComponent(r)}/runs`), 200, "List Draft Runs");
272
273
  i(b.projectId, r, "Run list projectId"), i(o(b.runs, "Listed Runs").map((e) => a(e, "Listed Run").runId), [h], "Listed Run ids");
273
274
  let x = await f(await m(e, `${_}/events`), 200, "Read queued Run events"), [S] = o(x.events, "Queued Run events");
274
275
  i(a(S, "Queued Run event").kind, "run.queued", "Queued Run event kind"), i(x.done, !1, "Queued Run events done"), await p(await m(e, `${_}/result`), 409, "run.not-terminal", "Read pending Run result");
275
- let C = await g(e, "Other project", "other-run-project");
276
- await p(await m(e, `/v1/projects/${encodeURIComponent(s(C.projectId, "Other Project projectId"))}/runs/${encodeURIComponent(h)}`), 404, "run.not-found", "Read Run through another Project");
276
+ let C = s((await g(e, "Other project", "other-run-project")).projectId, "Other Project projectId");
277
+ i(o((await f(await m(e, `/v1/projects/${encodeURIComponent(C)}/runs`), 200, "List other Project Runs")).runs, "Other Project Runs"), [], "Run remains scoped to its fixed Project list");
277
278
  let w = () => m(e, `${_}/cancel`, {
278
279
  body: JSON.stringify({ version: 1 }),
279
280
  method: "POST"
@@ -300,7 +301,7 @@ var T = [
300
301
  name: "publishes one immutable Flow with idempotent Live CAS",
301
302
  async verify(e) {
302
303
  let t = await g(e, "Publication project", "publication-project"), r = s(t.projectId, "Publication Project projectId"), c = a((await v(e, r, s(t.draftRevisionId, "Publication Project Draft head"))).revision, "Publication Revision"), l = s(c.revisionId, "Publication Revision revisionId"), u = `/v1/projects/${encodeURIComponent(r)}/flows/main`, d = await f(await m(e, `${u}/live`), 200, "Read unpublished Live");
303
- i(d.projectId, r, "Unpublished Live projectId"), i(d.flowId, "main", "Unpublished Live flowId"), i(d.publication, null, "Unpublished Live Publication"), i(d.revision, 0, "Unpublished Live revision"), i(d.status, "not-published", "Unpublished Live status"), i(d.hasUnpublishedChanges, !0, "Unpublished Live Draft state"), await p(await C(e, r, "main", "missing-live-run"), 404, "live.not-found", "Run unpublished Live");
304
+ i(d.projectId, r, "Unpublished Live projectId"), i(d.flowId, "main", "Unpublished Live flowId"), i(d.publication, null, "Unpublished Live Publication"), i(d.revision, 0, "Unpublished Live revision"), i(d.status, "not-published", "Unpublished Live status"), i(d.hasUnpublishedChanges, !0, "Unpublished Live Draft state"), await p(await C(e, "publication_missing", "missing-live-run"), 404, "publication.not-found", "Run missing Publication");
304
305
  let h = () => x(e, r, l, "main", null, "publication-first"), _ = await f(await h(), 201, "Publish Flow"), y = w(_, "Published Flow");
305
306
  i(_.projectId, r, "Publication projectId"), i(_.flowId, "main", "Publication flowId"), i(_.revisionId, l, "Publication revisionId"), i(_.revisionDigest, c.digest, "Publication revision digest"), i(_.engineContract, n, "Publication Engine Contract"), i(_.modelVersion, 1, "Publication model version"), i(_.operation, "publish", "Publication operation"), i(_.sourcePublicationId, void 0, "Publication source"), i(_.version, 1, "Publication version"), s(_.actorId, "Publication actorId"), s(_.closureDigest, "Publication closure digest"), s(_.createdAt, "Publication createdAt"), i(await f(await h(), 200, "Replay Publish"), _, "Replayed Publication"), await p(await x(e, r, l, "main", y, "publication-first"), 409, "publication.conflict", "Conflicting Publish replay"), await p(await x(e, r, l, "main", null, "publication-stale-live"), 412, "live.conflict", "Stale Publish Live precondition");
306
307
  let b = await f(await m(e, `${u}/live`), 200, "Read published Live");
@@ -339,8 +340,8 @@ var T = [
339
340
  i(O.publications, [_, u], "First Publication page"), i(O.total, 3, "Publication page total");
340
341
  let k = s(O.nextCursor, "Publication next cursor"), A = await f(await m(e, `${E}/publications?cursor=${encodeURIComponent(k)}&limit=2`), 200, "List second Publication page");
341
342
  i(A.publications, [o], "Second Publication page"), i(A.nextCursor, void 0, "Final Publication cursor");
342
- let j = () => C(e, n, "main", "rollback-live-run"), M = await f(await j(), 202, "Create rolled back Live Run"), N = s(M.runId, "Rolled back Live Run runId");
343
- i(M.projectId, n, "Live Run projectId"), i(M.flowId, "main", "Live Run flowId"), i(M.publicationId, T, "Live Run Publication"), i(M.revisionId, a, "Live Run fixed Revision"), i(M.source, "live", "Live Run source"), i(M.status, "queued", "Live Run status"), i(await f(await j(), 200, "Replay Live Run"), M, "Replayed Live Run"), await p(await C(e, n, "main", "rollback-live-run", { changed: {} }), 409, "run.conflict", "Conflicting Live Run replay"), await f(await x(e, n, l, "main", T, "rollback-publish-current"), 201, "Move Live after Run admission"), i(await f(await m(e, `/v1/projects/${encodeURIComponent(n)}/runs/${encodeURIComponent(N)}`), 200, "Read fixed Live Run"), M, "Live Run after Live moved");
343
+ let j = () => C(e, T, "rollback-live-run"), M = await f(await j(), 202, "Create rolled back Live Run"), N = s(M.runId, "Rolled back Live Run runId");
344
+ i(M.projectId, n, "Live Run projectId"), i(M.flowId, "main", "Live Run flowId"), i(M.publicationId, T, "Live Run Publication"), i(M.revisionId, a, "Live Run fixed Revision"), i(M.source, "live", "Live Run source"), i(M.status, "queued", "Live Run status"), i(await f(await j(), 200, "Replay Live Run"), M, "Replayed Live Run"), await p(await C(e, T, "rollback-live-run", { changed: {} }), 409, "run.conflict", "Conflicting Live Run replay"), await f(await x(e, n, l, "main", T, "rollback-publish-current"), 201, "Move Live after Run admission"), i(await f(await m(e, `/v1/runs/${encodeURIComponent(N)}`), 200, "Read fixed Live Run"), M, "Live Run after Live moved");
344
345
  }
345
346
  },
346
347
  {
@@ -354,13 +355,13 @@ var T = [
354
355
  let o = `/v1/projects/${encodeURIComponent(n)}/flows/main`, c = await f(await m(e, `${o}/live`), 200, "Read deleted Flow Live");
355
356
  i(c.publication, null, "Deleted Flow Live Publication"), i(c.revision, 0, "Deleted Flow Live revision"), i(c.status, "not-published", "Deleted Flow Live status"), i(c.hasUnpublishedChanges, !1, "Deleted Flow unpublished state"), i((await f(await m(e, `/v1/projects/${encodeURIComponent(n)}/flows`), 200, "List deleted Flows")).flows, [], "Deleted Flow projection");
356
357
  let l = await f(await m(e, `${o}/publications?includeTotal=true`), 200, "List deleted Flow history");
357
- i(l.publications, [a], "Deleted Flow Publication history"), i(l.total, 1, "Deleted Flow Publication total"), await p(await C(e, n, "main", "deleted-flow-run"), 404, "live.not-found", "Run deleted Flow Live");
358
+ i(l.publications, [a], "Deleted Flow Publication history"), i(l.total, 1, "Deleted Flow Publication total"), await p(await C(e, w(a, "Deleted Flow Publication"), "deleted-flow-run"), 412, "live.conflict", "Run deleted Flow Publication");
358
359
  let u = await g(e, "Retired Live project", "retired-live-project"), d = s(u.projectId, "Retired Live Project projectId"), h = y(await v(e, d, s(u.draftRevisionId, "Retired Live Project Draft head")), "Retired Live Revision"), _ = await f(await x(e, d, h, "main", null, "retired-live-publish"), 201, "Publish retiring Project Flow"), T = w(_, "Retired Live Publication");
359
360
  await f(await m(e, `/v1/projects/${encodeURIComponent(d)}`, { method: "DELETE" }), 202, "Retire Live Project");
360
361
  let E = `/v1/projects/${encodeURIComponent(d)}/flows/main`, D = await f(await m(e, `${E}/live`), 200, "Read retired Project Live");
361
362
  i(D.publication, null, "Retired Project Live Publication"), i(D.revision, 0, "Retired Project Live revision"), i(D.status, "not-published", "Retired Project Live status");
362
363
  let O = await f(await m(e, `${E}/publications?includeTotal=true`), 200, "List retired Publication history");
363
- i(O.publications, [_], "Retired Publication history"), i(O.total, 1, "Retired Publication total"), await p(await C(e, d, "main", "retired-live-run"), 409, "project.busy", "Run retired Live"), await p(await x(e, d, h, "main", null, "retired-live-republish"), 409, "project.busy", "Publish retired Project"), await p(await S(e, d, "main", T, T, "retired-live-rollback"), 409, "project.busy", "Rollback retired Project");
364
+ i(O.publications, [_], "Retired Publication history"), i(O.total, 1, "Retired Publication total"), await p(await C(e, T, "retired-live-run"), 409, "project.busy", "Run retired Live"), await p(await x(e, d, h, "main", null, "retired-live-republish"), 409, "project.busy", "Publish retired Project"), await p(await S(e, d, "main", T, T, "retired-live-rollback"), 409, "project.busy", "Rollback retired Project");
364
365
  }
365
366
  }
366
367
  ], D = [{
@@ -490,10 +491,7 @@ var T = [
490
491
  let E = o(T.connections, "Connector Connections").map((e, t) => l(e, `Connector Connection ${t}`)), D = Object.hasOwn(v, "defaultConnection") ? l(v.defaultConnection, "Selected Connector Action default Connection") : void 0;
491
492
  D != null && !E.some((e) => e.connectionId == D.connectionId) && r("Connector Action default Connection must be present in the service Connection list.");
492
493
  let O = await f(await m(e, `${n}/connections/${encodeURIComponent(y)}/page`, {
493
- body: JSON.stringify({
494
- returnUrl: "https://workbench.example/projects/connector",
495
- version: 1
496
- }),
494
+ body: JSON.stringify({ version: 1 }),
497
495
  method: "POST"
498
496
  }), 200, "Create Connector Connection page");
499
497
  c(O, ["url", "version"], "Connector Connection external page");
@@ -507,7 +505,6 @@ var T = [
507
505
  await p(await m(e, `${n}/actions?service=mail&q=send`), 400, "project.invalid", "Conflicting Connector Action query"), await p(await m(e, `${n}/actions?q=%20%20`), 400, "project.invalid", "Empty Connector Action query"), await p(await m(e, `${n}/actions?q=${"a".repeat(257)}`), 400, "project.invalid", "Oversized Connector Action query"), await p(await m(e, `${n}/connections/${"a".repeat(257)}`), 400, "project.invalid", "Oversized Connector service"), await p(await m(e, `${n}/connections/mail/page`, {
508
506
  body: JSON.stringify({
509
507
  extra: !0,
510
- returnUrl: "https://workbench.example",
511
508
  version: 1
512
509
  }),
513
510
  method: "POST"
@@ -25,6 +25,7 @@ export declare const controlErrorCode: {
25
25
  readonly runInvalid: 'run.invalid';
26
26
  readonly runNotFound: 'run.not-found';
27
27
  readonly runNotTerminal: 'run.not-terminal';
28
+ readonly runOverloaded: 'run.overloaded';
28
29
  readonly triggerKeyInvalid: 'trigger-key.invalid';
29
30
  readonly triggerKeyNotFound: 'trigger-key.not-found';
30
31
  readonly triggerNotFound: 'trigger.not-found';
@@ -109,6 +110,9 @@ export declare const controlErrorMetadata: {
109
110
  readonly "run.not-terminal": {
110
111
  readonly status: 409;
111
112
  };
113
+ readonly "run.overloaded": {
114
+ readonly status: 429;
115
+ };
112
116
  readonly "trigger-key.invalid": {
113
117
  readonly status: 409;
114
118
  };
@@ -318,7 +318,7 @@ export declare class ControlClient {
318
318
  searchConnectorActions(projectId: string, query: string, signal?: AbortSignal): Promise<readonly ConnectorAction[]>;
319
319
  getConnectorAction(projectId: string, actionId: string, signal?: AbortSignal): Promise<ConnectorAction>;
320
320
  listConnectorConnections(projectId: string, serviceId: string, signal?: AbortSignal): Promise<readonly ConnectorConnection[]>;
321
- createConnectorConnectionPage(projectId: string, serviceId: string, returnUrl: string): Promise<string>;
321
+ createConnectorConnectionPage(projectId: string, serviceId: string): Promise<string>;
322
322
  changeDraft(projectId: string, expectedRevisionId: string, operations: readonly ChangeOperation[]): Promise<DraftChange>;
323
323
  checkFlow(projectId: string, revisionId: string, flowId: string): Promise<FlowCheck>;
324
324
  getLive(projectId: string, flowId: string): Promise<Live>;
@@ -328,22 +328,22 @@ export declare class ControlClient {
328
328
  readonly limit?: number;
329
329
  }): Promise<PublicationPage>;
330
330
  createDraftRun(projectId: string, revisionId: string, flowId: string, options?: RunOptions): Promise<DraftRun>;
331
- createLiveRun(projectId: string, flowId: string, options?: RunOptions): Promise<LiveRun>;
331
+ createLiveRun(publicationId: string, options?: RunOptions): Promise<LiveRun>;
332
332
  publishFlow(projectId: string, revisionId: string, flowId: string, expectedLivePublicationId: string | null, options?: PublicationOptions): Promise<Publication>;
333
333
  rollbackFlow(projectId: string, flowId: string, publicationId: string, expectedLivePublicationId: string, options?: PublicationOptions): Promise<Publication>;
334
- getRun(projectId: string, runId: string): Promise<RunDetails>;
334
+ getRun(runId: string): Promise<RunDetails>;
335
335
  listRuns(projectId: string, options?: {
336
336
  readonly cursor?: string;
337
337
  readonly flowId?: string;
338
338
  readonly limit?: number;
339
339
  readonly status?: RunStatus;
340
340
  }): Promise<RunPage>;
341
- getRunEvents(projectId: string, runId: string, options?: {
341
+ getRunEvents(runId: string, options?: {
342
342
  readonly after?: number;
343
343
  readonly limit?: number;
344
344
  }): Promise<RunEvents>;
345
- getRunResult(projectId: string, runId: string): Promise<RunResult>;
346
- cancelRun(projectId: string, runId: string): Promise<RunCancellation>;
345
+ getRunResult(runId: string): Promise<RunResult>;
346
+ cancelRun(runId: string): Promise<RunCancellation>;
347
347
  private connectorActions;
348
348
  protected request<Value = unknown>(path: string, init?: RequestInit): Promise<Value>;
349
349
  }
@@ -26,6 +26,7 @@ var e = {
26
26
  runInvalid: "run.invalid",
27
27
  runNotFound: "run.not-found",
28
28
  runNotTerminal: "run.not-terminal",
29
+ runOverloaded: "run.overloaded",
29
30
  triggerKeyInvalid: "trigger-key.invalid",
30
31
  triggerKeyNotFound: "trigger-key.not-found",
31
32
  triggerNotFound: "trigger.not-found"
@@ -56,6 +57,7 @@ var e = {
56
57
  [e.runInvalid]: { status: 400 },
57
58
  [e.runNotFound]: { status: 404 },
58
59
  [e.runNotTerminal]: { status: 409 },
60
+ [e.runOverloaded]: { status: 429 },
59
61
  [e.triggerKeyInvalid]: { status: 409 },
60
62
  [e.triggerKeyNotFound]: { status: 404 },
61
63
  [e.triggerNotFound]: { status: 404 }
@@ -741,17 +743,14 @@ var $ = class {
741
743
  "version"
742
744
  ]), r.version != 1 || o(r.projectId) != e || o(r.serviceId) != t || !Array.isArray(r.connections) ? i() : r.connections.map(u);
743
745
  }
744
- async createConnectorConnectionPage(e, t, n) {
745
- let r = a(await this.request(`/v1/projects/${Z(e)}/connector/connections/${Z(t)}/page`, {
746
- body: JSON.stringify({
747
- returnUrl: n,
748
- version: 1
749
- }),
746
+ async createConnectorConnectionPage(e, t) {
747
+ let n = a(await this.request(`/v1/projects/${Z(e)}/connector/connections/${Z(t)}/page`, {
748
+ body: JSON.stringify({ version: 1 }),
750
749
  method: "POST"
751
750
  }));
752
- if (s(r, ["url", "version"]), r.version != 1) return i();
751
+ if (s(n, ["url", "version"]), n.version != 1) return i();
753
752
  try {
754
- let e = new URL(o(r.url));
753
+ let e = new URL(o(n.url));
755
754
  return e.protocol != "http:" && e.protocol != "https:" ? i() : e.href;
756
755
  } catch {
757
756
  return i();
@@ -797,16 +796,17 @@ var $ = class {
797
796
  }));
798
797
  return a.source == "draft" ? a : i();
799
798
  }
800
- async createLiveRun(e, t, n = {}) {
801
- let r = W(await this.request(`/v1/projects/${Z(e)}/flows/${Z(t)}/runs`, {
799
+ async createLiveRun(e, t = {}) {
800
+ let n = W(await this.request("/v1/runs", {
802
801
  body: JSON.stringify({
803
- inputs: n.inputs ?? {},
802
+ inputs: t.inputs ?? {},
803
+ publicationId: e,
804
804
  version: 1
805
805
  }),
806
- headers: { "idempotency-key": n.idempotencyKey ?? Q("run") },
806
+ headers: { "idempotency-key": t.idempotencyKey ?? Q("run") },
807
807
  method: "POST"
808
808
  }));
809
- return r.source == "live" ? r : i();
809
+ return n.source == "live" ? n : i();
810
810
  }
811
811
  async publishFlow(e, t, n, r, i = {}) {
812
812
  return P(await this.request(`/v1/projects/${Z(e)}/revisions/${Z(t)}/flows/${Z(n)}/publications`, {
@@ -829,8 +829,8 @@ var $ = class {
829
829
  method: "POST"
830
830
  }));
831
831
  }
832
- async getRun(e, t) {
833
- return W(await this.request(`/v1/projects/${Z(e)}/runs/${Z(t)}`));
832
+ async getRun(e) {
833
+ return W(await this.request(`/v1/runs/${Z(e)}`));
834
834
  }
835
835
  async listRuns(e, t = {}) {
836
836
  let n = new URLSearchParams();
@@ -838,17 +838,17 @@ var $ = class {
838
838
  let r = n.size == 0 ? "" : `?${n}`;
839
839
  return G(await this.request(`/v1/projects/${Z(e)}/runs${r}`));
840
840
  }
841
- async getRunEvents(e, t, n = {}) {
842
- let r = new URLSearchParams();
843
- n.after != null && r.set("after", String(n.after)), n.limit != null && r.set("limit", String(n.limit));
844
- let i = r.size == 0 ? "" : `?${r}`;
845
- return J(await this.request(`/v1/projects/${Z(e)}/runs/${Z(t)}/events${i}`));
841
+ async getRunEvents(e, t = {}) {
842
+ let n = new URLSearchParams();
843
+ t.after != null && n.set("after", String(t.after)), t.limit != null && n.set("limit", String(t.limit));
844
+ let r = n.size == 0 ? "" : `?${n}`;
845
+ return J(await this.request(`/v1/runs/${Z(e)}/events${r}`));
846
846
  }
847
- async getRunResult(e, t) {
848
- return X(await this.request(`/v1/projects/${Z(e)}/runs/${Z(t)}/result`));
847
+ async getRunResult(e) {
848
+ return X(await this.request(`/v1/runs/${Z(e)}/result`));
849
849
  }
850
- async cancelRun(e, t) {
851
- return Y(await this.request(`/v1/projects/${Z(e)}/runs/${Z(t)}/cancel`, {
850
+ async cancelRun(e) {
851
+ return Y(await this.request(`/v1/runs/${Z(e)}/cancel`, {
852
852
  body: JSON.stringify({ version: 1 }),
853
853
  method: "POST"
854
854
  }));
@@ -39,6 +39,7 @@ export interface IntegrationReceiveContext {
39
39
  readonly now: Date;
40
40
  readonly payload: JsonValue;
41
41
  readonly query: (name: string) => string | undefined;
42
+ readonly rawBody: Uint8Array;
42
43
  readonly state?: IntegrationStateContext;
43
44
  }
44
45
  export interface IntegrationReconcileContext {