@oomol-lab/open-flow 0.1.0-beta.17 → 0.1.0-beta.19

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.
@@ -1,9 +1,9 @@
1
1
  import { a as e, i as t, l as n } from "./dist-Dz6Nglsd.js";
2
2
  import { a as r, i, r as a, t as o } from "./main-BDnNHhkU.js";
3
- import { $ as s, $t as c, A as l, C as u, Ct as d, D as f, Dt as p, F as m, G as h, I as g, J as _, L as v, M as y, N as b, O as x, P as S, Q as C, Qt as w, R as T, S as E, St as D, T as O, Tt as ee, X as k, Zt as A, _ as j, _t as te, a as M, at as ne, b as re, bt as ie, c as ae, ct as oe, d as se, dt as ce, en as le, et as ue, f as de, ft as fe, g as pe, gt as me, h as he, ht as ge, it as _e, jt as ve, k as N, l as ye, lt as be, m as xe, mt as Se, o as Ce, ot as we, p as Te, pt as P, q as F, r as I, rt as Ee, s as De, st as Oe, t as ke, tn as L, tt as Ae, u as je, ut as Me, v as Ne, vt as Pe, w as Fe, x as Ie, xt as Le, y as Re, yt as ze, z as R } from "./flowChanges-BDLNaCWZ.js";
4
- import { Y as Be, c as z, i as B, q as V } from "./useValueChanged-DUuqLWPg.js";
5
- import { $t as Ve, An as He, C as Ue, Dn as We, E as Ge, Nt as Ke, On as qe, Pt as Je, Rt as Ye, S as Xe, T as Ze, Tn as Qe, b as $e, kn as et, l as H, t as tt, w as nt, x as rt, zt as U } from "./workbenchSelect-Bb3cewZj.js";
6
- import { t as W } from "./i18n-CNu41MKH.js";
3
+ import { $ as s, $t as c, A as l, C as u, Ct as d, D as f, Dt as p, F as m, G as h, I as g, J as _, L as v, M as y, N as b, O as x, P as S, Q as C, Qt as w, R as T, S as E, St as D, T as O, Tt as ee, X as k, Zt as A, _ as j, _t as te, a as M, at as ne, b as re, bt as ie, c as ae, ct as oe, d as se, dt as ce, en as le, et as ue, f as de, ft as fe, g as pe, gt as me, h as he, ht as ge, it as _e, jt as ve, k as N, l as ye, lt as be, m as xe, mt as Se, o as Ce, ot as we, p as Te, pt as P, q as F, r as I, rt as Ee, s as De, st as Oe, t as ke, tn as L, tt as Ae, u as je, ut as Me, v as Ne, vt as Pe, w as Fe, x as Ie, xt as Le, y as Re, yt as ze, z as R } from "./flowChanges-jX3KYcb0.js";
4
+ import { Y as Be, c as z, i as B, q as V } from "./useValueChanged-BY05Usw-.js";
5
+ import { $t as Ve, An as He, C as Ue, Dn as We, E as Ge, Nt as Ke, On as qe, Pt as Je, Rt as Ye, S as Xe, T as Ze, Tn as Qe, b as $e, kn as et, l as H, t as tt, w as nt, x as rt, zt as U } from "./workbenchSelect-CwP6rphY.js";
6
+ import { t as W } from "./i18n-CVBh0Ni1.js";
7
7
  import { i as it, n as at, r as ot, t as st } from "./languages-C0zQ4GSo.js";
8
8
  import { Suspense as ct, lazy as lt, useEffect as G, useRef as K, useState as q } from "react";
9
9
  import { Fragment as ut, jsx as J, jsxs as Y } from "react/jsx-runtime";
@@ -95,7 +95,7 @@ function ht(e, t) {
95
95
  }
96
96
  //#endregion
97
97
  //#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
98
- var gt = lt(() => import("./createResourceDialog-DOWv3Zj0.js")), _t = it.map((e) => ({
98
+ var gt = lt(() => import("./createResourceDialog-DlrAMxmo.js")), _t = it.map((e) => ({
99
99
  label: ot[e],
100
100
  value: e
101
101
  }));
@@ -1674,7 +1674,7 @@ function $t(e, t) {
1674
1674
  }
1675
1675
  function en(e, t) {
1676
1676
  return {
1677
- description: t.t("addNode.triggerNeedsConnection", { provider: e.provider }),
1677
+ description: e.description,
1678
1678
  group: t.t("addNode.integrationTriggers"),
1679
1679
  icon: R({
1680
1680
  serviceId: e.provider,
@@ -3510,7 +3510,7 @@ var Sn = { openExternalPage: async () => !1 }, Cn = class {
3510
3510
  return;
3511
3511
  }
3512
3512
  }
3513
- }, wn = lt(() => import("./flowWorkspace-BtNfkYuG.js").then((e) => e.t));
3513
+ }, wn = lt(() => import("./flowWorkspace-BIYwslVl.js").then((e) => e.t));
3514
3514
  function Tn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i, pending: a = !1, title: o, token: s, tokenLabel: c }) {
3515
3515
  let l = s != null && c != null && i != null, u = s ?? "", d = /* @__PURE__ */ Y(ut, { children: [
3516
3516
  /* @__PURE__ */ J("div", {
@@ -1,5 +1,5 @@
1
1
  import { o as e, t } from "./rolldown-runtime-CEFd7nDs.js";
2
- import { $ as n, A as r, At as i, B as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, G as p, H as m, I as h, K as g, L as _, M as v, N as y, O as b, Ot as x, P as S, Q as C, R as w, St as T, T as E, Tt as ee, U as D, V as O, W as k, X as A, Y as j, _ as M, _t as N, a as P, bt as F, ct as te, d as ne, dt as I, et as L, ft as R, g as re, gt as ie, h as ae, ht as oe, i as z, it as se, j as ce, jt as le, kt as B, l as ue, lt as V, m as H, mt as de, n as fe, nt as pe, o as me, p as he, pt as ge, q as _e, r as ve, rt as ye, s as be, st as xe, t as Se, tt as Ce, u as we, v as Te, vt as Ee, w as De, wt as Oe, xt as ke, y as Ae, yt as je, z as Me } from "./useValueChanged-DUuqLWPg.js";
2
+ import { $ as n, A as r, At as i, B as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, G as p, H as m, I as h, K as g, L as _, M as v, N as y, O as b, Ot as x, P as S, Q as C, R as w, St as T, T as E, Tt as ee, U as D, V as O, W as k, X as A, Y as j, _ as M, _t as N, a as P, bt as F, ct as te, d as ne, dt as I, et as L, ft as R, g as re, gt as ie, h as ae, ht as oe, i as z, it as se, j as ce, jt as le, kt as B, l as ue, lt as V, m as H, mt as de, n as fe, nt as pe, o as me, p as he, pt as ge, q as _e, r as ve, rt as ye, s as be, st as xe, t as Se, tt as Ce, u as we, v as Te, vt as Ee, w as De, wt as Oe, xt as ke, y as Ae, yt as je, z as Me } from "./useValueChanged-BY05Usw-.js";
3
3
  import * as U from "react";
4
4
  import { useLayoutEffect as Ne, useMemo as Pe } from "react";
5
5
  import { Fragment as Fe, jsx as W, jsxs as Ie } from "react/jsx-runtime";
@@ -49,6 +49,10 @@ export interface TriggerKeySummary {
49
49
  readonly type: TriggerKeySnapshot['type'];
50
50
  }
51
51
  export interface TriggerBinding {
52
+ readonly listener?: {
53
+ readonly health: 'healthy' | 'failed' | 'needs_reauth';
54
+ readonly lastErrorCode?: string;
55
+ };
52
56
  readonly currentPublicationId?: string;
53
57
  readonly currentRevisionId?: string;
54
58
  readonly endpointUrl?: string;
@@ -5610,17 +5610,23 @@ var dl = /* @__PURE__ */ new Set([
5610
5610
  "operator.resumed"
5611
5611
  ]);
5612
5612
  function ml(e) {
5613
- let t = W(e), n = t.health, r = t.kind, i = t.operatorState, a = q(t.runtimeVersion);
5614
- return t.version != 1 || typeof n != "string" || !fl.has(n) || typeof r != "string" || !dl.has(r) || i != "active" && i != "paused" || a <= 0 ? U() : {
5613
+ let t = W(e), n = t.health, r = t.listener == null ? void 0 : W(t.listener);
5614
+ if (r != null && r.health != "healthy" && r.health != "failed" && r.health != "needs_reauth") return U();
5615
+ let i = t.kind, a = t.operatorState, o = q(t.runtimeVersion);
5616
+ return t.version != 1 || typeof n != "string" || !fl.has(n) || typeof i != "string" || !dl.has(i) || a != "active" && a != "paused" || o <= 0 ? U() : {
5615
5617
  ...t.currentPublicationId == null ? {} : { currentPublicationId: G(t.currentPublicationId) },
5616
5618
  ...t.currentRevisionId == null ? {} : { currentRevisionId: G(t.currentRevisionId) },
5617
5619
  ...t.endpointUrl == null ? {} : { endpointUrl: G(t.endpointUrl) },
5620
+ ...r == null ? {} : { listener: {
5621
+ health: r.health,
5622
+ ...r.lastErrorCode == null ? {} : { lastErrorCode: G(r.lastErrorCode) }
5623
+ } },
5618
5624
  flowId: G(t.flowId),
5619
5625
  health: n,
5620
- kind: r,
5626
+ kind: i,
5621
5627
  ...t.lastErrorCode == null ? {} : { lastErrorCode: G(t.lastErrorCode) },
5622
- operatorState: i,
5623
- runtimeVersion: a,
5628
+ operatorState: a,
5629
+ runtimeVersion: o,
5624
5630
  triggerNodeId: G(t.triggerNodeId),
5625
5631
  updatedAt: G(t.updatedAt),
5626
5632
  version: 1
@@ -2,7 +2,27 @@ import type { ConnectorProxy } from './connector-proxy.js';
2
2
  import type { IntegrationEndpointMethod, JsonValue, TriggerKeySnapshot } from '../browser/flow-change.js';
3
3
  export declare const maximumIntegrationBodyBytes: number;
4
4
  export declare const maximumIntegrationDeliveryPages = 5;
5
+ export interface ListenerReadContext {
6
+ readonly checkpoint: JsonValue;
7
+ readonly config: Readonly<Record<string, JsonValue>>;
8
+ readonly connector: ConnectorProxy;
9
+ readonly now: Date;
10
+ readonly signal?: AbortSignal;
11
+ }
12
+ export interface ListenerPage {
13
+ readonly checkpoint: JsonValue;
14
+ readonly dedupeKey: string;
15
+ readonly hasMore: boolean;
16
+ readonly payload: Readonly<Record<string, JsonValue>> | null;
17
+ }
18
+ export interface ListenerSource {
19
+ readonly intervalMs: number;
20
+ readonly read: (context: ListenerReadContext) => Promise<ListenerPage>;
21
+ }
22
+ export declare function validateListenerPage(value: unknown): asserts value is ListenerPage;
5
23
  export type IntegrationReceiveResult = {
24
+ readonly outcome: 'wake';
25
+ } | {
6
26
  readonly checkpoint?: JsonValue;
7
27
  readonly continue?: boolean;
8
28
  readonly dedupeKey?: string;
@@ -58,6 +78,7 @@ export interface IntegrationReconcileResult {
58
78
  readonly outcome: 'pending' | 'ready';
59
79
  }
60
80
  export interface IntegrationDefinition {
81
+ readonly listener?: ListenerSource;
61
82
  readonly initialState?: {
62
83
  readonly checkpoint: JsonValue;
63
84
  readonly subscription: Readonly<Record<string, JsonValue>>;
@@ -83,7 +104,7 @@ export declare function integrationOccurrenceId(bindingId: string, runtimeVersio
83
104
  export interface IntegrationConformanceFixture {
84
105
  readonly config: Readonly<Record<string, JsonValue>>;
85
106
  readonly connectionId: string;
86
- readonly definition: Pick<IntegrationDefinition, 'initialState' | 'receive' | 'reconcile'>;
107
+ readonly definition: Pick<IntegrationDefinition, 'initialState' | 'listener' | 'receive' | 'reconcile'>;
87
108
  readonly publishedAt: string;
88
109
  }
89
110
  export interface IntegrationConformanceState {
@@ -112,3 +133,4 @@ export interface IntegrationConformanceCase {
112
133
  verify(harness: IntegrationConformanceHarness): Promise<void>;
113
134
  }
114
135
  export declare const integrationConformanceCases: readonly IntegrationConformanceCase[];
136
+ export declare const listenerConformanceCases: readonly IntegrationConformanceCase[];
@@ -18,32 +18,106 @@ function t(n, r) {
18
18
  return n !== n && r !== r;
19
19
  }
20
20
  //#endregion
21
+ //#region src/base/common/json.ts
22
+ function n(e) {
23
+ if (e === null || typeof e == "boolean" || typeof e == "string") return !0;
24
+ if (typeof e == "number") return Number.isFinite(e);
25
+ if (typeof e != "object") return !1;
26
+ let t = /* @__PURE__ */ new Set(), n = [], r = e;
27
+ traversal: for (;;) {
28
+ let e, i;
29
+ if (Array.isArray(r)) {
30
+ if (i = r.length, e = Reflect.ownKeys(r), e.length != i + 1) return !1;
31
+ } else {
32
+ let t = Reflect.getPrototypeOf(r);
33
+ if (t != Object.prototype && t != null) return !1;
34
+ e = Reflect.ownKeys(r), i = void 0;
35
+ }
36
+ t.add(r);
37
+ let a = 0;
38
+ for (;;) {
39
+ if (a >= e.length) {
40
+ t.delete(r);
41
+ let o = n.pop();
42
+ if (o === void 0) return !0;
43
+ r = o.value, e = o.keys, i = o.arrayLength, a = o.index;
44
+ continue;
45
+ }
46
+ let o = e[a++];
47
+ if (i !== void 0) {
48
+ if (o == "length") continue;
49
+ if (typeof o != "string") return !1;
50
+ let e = Number(o);
51
+ if (!Number.isSafeInteger(e) || e < 0 || e >= i || String(e) != o) return !1;
52
+ } else if (typeof o != "string") return !1;
53
+ let s = Reflect.getOwnPropertyDescriptor(r, o);
54
+ if (s?.enumerable != 1 || !Object.hasOwn(s, "value")) return !1;
55
+ let c = s.value;
56
+ if (c !== null && typeof c != "boolean" && typeof c != "string") {
57
+ if (typeof c == "number") {
58
+ if (!Number.isFinite(c)) return !1;
59
+ continue;
60
+ }
61
+ if (typeof c != "object" || t.has(c)) return !1;
62
+ n.push({
63
+ value: r,
64
+ keys: e,
65
+ arrayLength: i,
66
+ index: a
67
+ }), r = c;
68
+ continue traversal;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ function r(e) {
74
+ try {
75
+ return n(e);
76
+ } catch {
77
+ return !1;
78
+ }
79
+ }
80
+ function i(e) {
81
+ try {
82
+ return typeof e == "object" && !!e && !Array.isArray(e) && n(e);
83
+ } catch {
84
+ return !1;
85
+ }
86
+ }
87
+ //#endregion
21
88
  //#region src/trigger/common/integration.ts
22
- var n = 65536, r = 5, i = /^\/v1\/integrations\/(endpoint_[0-9a-f]{32})$/, a = new TextEncoder(), o = class extends Error {
89
+ var a = 65536, o = 5, s = /^\/v1\/integrations\/(endpoint_[0-9a-f]{32})$/, c = new TextEncoder();
90
+ function l(e) {
91
+ if (!i(e) || e.checkpoint == null || !r(e.checkpoint) || typeof e.hasMore != "boolean") throw TypeError("Listener page must contain a JSON checkpoint and a boolean hasMore.");
92
+ if (typeof e.dedupeKey != "string" || e.dedupeKey.length == 0 || c.encode(e.dedupeKey).byteLength > 1024) throw TypeError("Listener page identity must contain between 1 and 1024 bytes.");
93
+ if (e.payload !== null && !i(e.payload)) throw TypeError("Listener page payload must be an object or null.");
94
+ if (c.encode(JSON.stringify(e.checkpoint)).byteLength > 65536) throw TypeError("Listener checkpoint exceeds 64 KiB.");
95
+ }
96
+ var u = class extends Error {
23
97
  constructor(...e) {
24
98
  super(...e), this.name = "IntegrationConnectionError";
25
99
  }
26
- }, s = class extends Error {
100
+ }, d = class extends Error {
27
101
  constructor(...e) {
28
102
  super(...e), this.name = "PermanentIntegrationError";
29
103
  }
30
- }, c = class extends Error {
104
+ }, f = class extends Error {
31
105
  constructor(...e) {
32
106
  super(...e), this.name = "TransientIntegrationError";
33
107
  }
34
108
  };
35
- function l(e) {
36
- return i.exec(e.pathname)?.[1];
109
+ function p(e) {
110
+ return s.exec(e.pathname)?.[1];
37
111
  }
38
- async function u(e, t) {
112
+ async function m(e, t) {
39
113
  if (e == null || e.length == 0) throw TypeError("Integration callback key is required.");
40
- let n = await crypto.subtle.importKey("raw", a.encode(e), {
114
+ let n = await crypto.subtle.importKey("raw", c.encode(e), {
41
115
  hash: "SHA-256",
42
116
  name: "HMAC"
43
- }, !1, ["sign"]), r = new Uint8Array(await crypto.subtle.sign("HMAC", n, a.encode(`open-flow-integration/v1/${t}`)));
117
+ }, !1, ["sign"]), r = new Uint8Array(await crypto.subtle.sign("HMAC", n, c.encode(`open-flow-integration/v1/${t}`)));
44
118
  return btoa(String.fromCharCode(...r)).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
45
119
  }
46
- async function d(e, t, n, r) {
120
+ async function h(e, t, n, r) {
47
121
  if (r == null) return `integration_${crypto.randomUUID().replaceAll("-", "")}`;
48
122
  let i = JSON.stringify([
49
123
  1,
@@ -53,9 +127,9 @@ async function d(e, t, n, r) {
53
127
  n,
54
128
  r
55
129
  ]);
56
- return [...new Uint8Array(await crypto.subtle.digest("SHA-256", a.encode(i)))].map((e) => e.toString(16).padStart(2, "0")).join("");
130
+ return [...new Uint8Array(await crypto.subtle.digest("SHA-256", c.encode(i)))].map((e) => e.toString(16).padStart(2, "0")).join("");
57
131
  }
58
- var f = {
132
+ var g = {
59
133
  config: { source: "primary" },
60
134
  connectionId: "connection-primary",
61
135
  definition: {
@@ -70,7 +144,7 @@ var f = {
70
144
  outcome: "respond",
71
145
  status: 404
72
146
  };
73
- let t = _(e.payload);
147
+ let t = C(e.payload);
74
148
  if (t?.action == "handshake") return {
75
149
  body: "accepted",
76
150
  contentType: "text/plain",
@@ -83,7 +157,7 @@ var f = {
83
157
  reason: "Conformance delivery was ignored."
84
158
  };
85
159
  if (t?.action == "pages") {
86
- let n = _(e.state?.checkpoint), r = typeof n?.page == "number" ? n.page + 1 : 1, i = typeof t.pages == "number" ? t.pages : 1, a = typeof t.deliveryId == "string" ? t.deliveryId : "pages";
160
+ let n = C(e.state?.checkpoint), r = typeof n?.page == "number" ? n.page + 1 : 1, i = typeof t.pages == "number" ? t.pages : 1, a = typeof t.deliveryId == "string" ? t.deliveryId : "pages";
87
161
  return {
88
162
  checkpoint: { page: r },
89
163
  continue: r < i,
@@ -96,7 +170,7 @@ var f = {
96
170
  }
97
171
  };
98
172
  }
99
- let n = typeof t?.deliveryId == "string" ? t.deliveryId : "delivery", r = _(t?.body) ?? {};
173
+ let n = typeof t?.deliveryId == "string" ? t.deliveryId : "delivery", r = C(t?.body) ?? {};
100
174
  return {
101
175
  checkpoint: { deliveryId: n },
102
176
  dedupeKey: n,
@@ -109,24 +183,24 @@ var f = {
109
183
  };
110
184
  },
111
185
  async reconcile(e) {
112
- if (e.state == null) throw new s("Conformance Integration state is missing.");
186
+ if (e.state == null) throw new d("Conformance Integration state is missing.");
113
187
  return await e.state.saveSubscription(e.active ? { endpointUrl: e.endpointUrl } : {}, new Date(e.now.getTime() + 6e4)), { outcome: "ready" };
114
188
  }
115
189
  },
116
190
  publishedAt: "2026-08-21T00:00:30.000Z"
117
- }, p = [
191
+ }, _ = [
118
192
  {
119
- fixture: f,
193
+ fixture: g,
120
194
  name: "enforces callback routing, method, body, and handshake boundaries",
121
195
  async verify(e) {
122
196
  let t = new URL(e.endpointUrl);
123
- await v(await m(e, { url: new URL("/v1/integrations/not-an-endpoint", t).href }), { status: 404 }, "Malformed endpoint"), await v(await m(e, { url: new URL("/v1/integrations/endpoint_00000000000000000000000000000000", t).href }), { status: 404 }, "Unknown endpoint"), await v(await m(e, { method: "GET" }), {
197
+ await w(await b(e, { url: new URL("/v1/integrations/not-an-endpoint", t).href }), { status: 404 }, "Malformed endpoint"), await w(await b(e, { url: new URL("/v1/integrations/endpoint_00000000000000000000000000000000", t).href }), { status: 404 }, "Unknown endpoint"), await w(await b(e, { method: "GET" }), {
124
198
  headers: { allow: "POST" },
125
199
  status: 405
126
- }, "Method"), await v(await m(e, { body: "{" }), { status: 400 }, "Invalid JSON"), await v(await m(e, {
200
+ }, "Method"), await w(await b(e, { body: "{" }), { status: 400 }, "Invalid JSON"), await w(await b(e, {
127
201
  body: "a=1",
128
202
  headers: { "content-type": "application/x-www-form-urlencoded" }
129
- }), { status: 400 }, "Unsupported body format"), await v(await m(e, { body: "x".repeat(65537) }), { status: 413 }, "Oversized body"), await v(await h(e, { action: "handshake" }), {
203
+ }), { status: 400 }, "Unsupported body format"), await w(await b(e, { body: "x".repeat(65537) }), { status: 413 }, "Oversized body"), await w(await x(e, { action: "handshake" }), {
130
204
  body: "accepted",
131
205
  headers: {
132
206
  "content-type": "text/plain",
@@ -137,18 +211,18 @@ var f = {
137
211
  }
138
212
  },
139
213
  {
140
- fixture: f,
214
+ fixture: g,
141
215
  name: "verifies initializing callbacks before activating the subscription",
142
216
  async verify(e) {
143
- await v(await h(e, {
217
+ await w(await x(e, {
144
218
  action: "event",
145
219
  body: { value: "before" },
146
220
  deliveryId: "before"
147
- }, !1), { status: 404 }, "Secret"), await v(await h(e, {
221
+ }, !1), { status: 404 }, "Secret"), await w(await x(e, {
148
222
  action: "event",
149
223
  body: { value: "before" },
150
224
  deliveryId: "before"
151
- }), { status: 202 }, "Initializing delivery"), g(await e.state(), {
225
+ }), { status: 202 }, "Initializing delivery"), S(await e.state(), {
152
226
  checkpoint: null,
153
227
  health: "initializing",
154
228
  payloads: [],
@@ -156,7 +230,7 @@ var f = {
156
230
  reconcileCalls: 0,
157
231
  runtimeVersion: 1,
158
232
  subscription: {}
159
- }, "Initializing state"), await e.reconcile("2026-08-21T00:00:31.000Z"), g(await e.state(), {
233
+ }, "Initializing state"), await e.reconcile("2026-08-21T00:00:31.000Z"), S(await e.state(), {
160
234
  checkpoint: null,
161
235
  health: "healthy",
162
236
  payloads: [],
@@ -168,7 +242,7 @@ var f = {
168
242
  }
169
243
  },
170
244
  {
171
- fixture: f,
245
+ fixture: g,
172
246
  name: "deduplicates keyed events and rejects conflicting payloads",
173
247
  async verify(e) {
174
248
  await e.reconcile("2026-08-21T00:00:31.000Z");
@@ -177,12 +251,12 @@ var f = {
177
251
  body: { value: "first" },
178
252
  deliveryId: "delivery-1"
179
253
  };
180
- await v(await h(e, t), { status: 202 }, "Initial event"), await v(await h(e, t), { status: 202 }, "Repeated event"), await v(await h(e, {
254
+ await w(await x(e, t), { status: 202 }, "Initial event"), await w(await x(e, t), { status: 202 }, "Repeated event"), await w(await x(e, {
181
255
  ...t,
182
256
  body: { value: "changed" }
183
257
  }), { status: 409 }, "Conflicting event");
184
258
  let n = await e.state();
185
- g(n.checkpoint, { deliveryId: "delivery-1" }, "Event checkpoint"), g(n.payloads, [{
259
+ S(n.checkpoint, { deliveryId: "delivery-1" }, "Event checkpoint"), S(n.payloads, [{
186
260
  body: { value: "first" },
187
261
  deliveryId: "delivery-1",
188
262
  event: "conformance"
@@ -190,7 +264,7 @@ var f = {
190
264
  }
191
265
  },
192
266
  {
193
- fixture: f,
267
+ fixture: g,
194
268
  name: "bounds callback pages and resumes from the durable checkpoint",
195
269
  async verify(e) {
196
270
  await e.reconcile("2026-08-21T00:00:31.000Z");
@@ -199,26 +273,26 @@ var f = {
199
273
  deliveryId: "delivery-pages",
200
274
  pages: 7
201
275
  };
202
- await v(await h(e, t), { status: 202 }, "First page batch");
276
+ await w(await x(e, t), { status: 202 }, "First page batch");
203
277
  let n = await e.state();
204
- g(n.checkpoint, { page: 5 }, "Bounded checkpoint"), g(n.payloads.length, 5, "Bounded payload count"), await v(await h(e, t), { status: 202 }, "Resumed page batch"), n = await e.state(), g(n.checkpoint, { page: 7 }, "Resumed checkpoint"), g(n.payloads.length, 7, "Resumed payload count");
278
+ S(n.checkpoint, { page: 5 }, "Bounded checkpoint"), S(n.payloads.length, 5, "Bounded payload count"), await w(await x(e, t), { status: 202 }, "Resumed page batch"), n = await e.state(), S(n.checkpoint, { page: 7 }, "Resumed checkpoint"), S(n.payloads.length, 7, "Resumed payload count");
205
279
  }
206
280
  },
207
281
  {
208
- fixture: f,
282
+ fixture: g,
209
283
  name: "restores subscription state and callback admission after restart",
210
284
  async verify(e) {
211
- await e.reconcile("2026-08-21T00:00:31.000Z"), await h(e, {
285
+ await e.reconcile("2026-08-21T00:00:31.000Z"), await x(e, {
212
286
  action: "event",
213
287
  body: { value: "before" },
214
288
  deliveryId: "before"
215
- }), await e.restart(), await h(e, {
289
+ }), await e.restart(), await x(e, {
216
290
  action: "event",
217
291
  body: { value: "after" },
218
292
  deliveryId: "after"
219
293
  });
220
294
  let t = await e.state();
221
- g(t.checkpoint, { deliveryId: "after" }, "Restart checkpoint"), g(t.payloads, [{
295
+ S(t.checkpoint, { deliveryId: "after" }, "Restart checkpoint"), S(t.payloads, [{
222
296
  body: { value: "before" },
223
297
  deliveryId: "before",
224
298
  event: "conformance"
@@ -230,7 +304,7 @@ var f = {
230
304
  }
231
305
  },
232
306
  {
233
- fixture: f,
307
+ fixture: g,
234
308
  name: "retires the old runtime before activating a republished target",
235
309
  async verify(e) {
236
310
  await e.reconcile("2026-08-21T00:00:31.000Z");
@@ -239,28 +313,90 @@ var f = {
239
313
  body: { value: "event" },
240
314
  deliveryId: "same-delivery"
241
315
  };
242
- await h(e, t);
316
+ await x(e, t);
243
317
  let n = e.endpointUrl;
244
- await e.republish("2026-08-21T00:00:40.000Z"), g(e.endpointUrl, n, "Republished endpoint"), await v(await h(e, t), { status: 202 }, "Old runtime delivery"), g((await e.state()).payloads.length, 1, "Old runtime payload count"), await e.reconcile("2026-08-21T00:00:41.000Z"), await v(await h(e, t), { status: 202 }, "New runtime delivery");
318
+ await e.republish("2026-08-21T00:00:40.000Z"), S(e.endpointUrl, n, "Republished endpoint"), await w(await x(e, t), { status: 202 }, "Old runtime delivery"), S((await e.state()).payloads.length, 1, "Old runtime payload count"), await e.reconcile("2026-08-21T00:00:41.000Z"), await w(await x(e, t), { status: 202 }, "New runtime delivery");
245
319
  let r = await e.state();
246
- g(r.runtimeVersion, 2, "Republished runtime"), g(r.health, "healthy", "Republished health"), g(r.payloads.length, 2, "Republished payload count");
320
+ S(r.runtimeVersion, 2, "Republished runtime"), S(r.health, "healthy", "Republished health"), S(r.payloads.length, 2, "Republished payload count");
247
321
  }
248
322
  },
249
323
  {
250
- fixture: f,
324
+ fixture: g,
251
325
  name: "retires the remote subscription and rejects later callbacks",
252
326
  async verify(e) {
253
- await e.reconcile("2026-08-21T00:00:31.000Z"), await e.retire("2026-08-21T00:00:40.000Z"), await v(await h(e, {
327
+ await e.reconcile("2026-08-21T00:00:31.000Z"), await e.retire("2026-08-21T00:00:40.000Z"), await w(await x(e, {
254
328
  action: "event",
255
329
  deliveryId: "retired"
256
- }), { status: 404 }, "Retired callback"), await e.reconcile("2026-08-21T00:00:41.000Z"), await v(await h(e, {
330
+ }), { status: 404 }, "Retired callback"), await e.reconcile("2026-08-21T00:00:41.000Z"), await w(await x(e, {
257
331
  action: "event",
258
332
  deliveryId: "retired"
259
- }), { status: 404 }, "Reconciled retirement"), g((await e.state()).payloads, [], "Retired payloads");
333
+ }), { status: 404 }, "Reconciled retirement"), S((await e.state()).payloads, [], "Retired payloads");
334
+ }
335
+ }
336
+ ], v = {
337
+ ...g,
338
+ definition: {
339
+ initialState: {
340
+ checkpoint: null,
341
+ subscription: {}
342
+ },
343
+ async reconcile({ active: e, state: t, now: n }) {
344
+ return e && t?.checkpoint == null && await t.saveCheckpoint(0), e && await t.saveSubscription({}, new Date(n.getTime() + 36e5)), { outcome: "ready" };
345
+ },
346
+ receive(e) {
347
+ return e.header("x-integration-secret") == e.callbackSecret ? { outcome: "wake" } : {
348
+ outcome: "respond",
349
+ status: 404,
350
+ body: "",
351
+ contentType: "text/plain"
352
+ };
353
+ },
354
+ listener: {
355
+ intervalMs: 6e4,
356
+ async read({ checkpoint: e, now: t }) {
357
+ let n = Number(e), r = t.getTime() >= Date.parse("2026-08-21T00:01:31.000Z") ? 8 : 7;
358
+ return n < r ? {
359
+ checkpoint: n + 1,
360
+ dedupeKey: String(n),
361
+ hasMore: n + 1 < r,
362
+ payload: {
363
+ body: {},
364
+ deliveryId: String(n),
365
+ event: "change"
366
+ }
367
+ } : {
368
+ checkpoint: e,
369
+ dedupeKey: String(n),
370
+ hasMore: !1,
371
+ payload: null
372
+ };
373
+ }
374
+ }
375
+ }
376
+ }, y = [
377
+ {
378
+ fixture: v,
379
+ name: "drains listener pages without a callback and resumes periodic scanning after restart",
380
+ async verify(e) {
381
+ await e.reconcile("2026-08-21T00:00:31.000Z"), S((await e.state()).checkpoint, 7, "Drained cursor"), S((await e.state()).payloads.length, 7, "Drained pages"), await e.restart(), await e.reconcile("2026-08-21T00:01:31.000Z"), S((await e.state()).checkpoint, 8, "Periodic cursor"), S((await e.state()).payloads.length, 8, "Periodic pages");
382
+ }
383
+ },
384
+ {
385
+ fixture: v,
386
+ name: "persists verified listener wakes across restart without duplicating accepted pages",
387
+ async verify(e) {
388
+ await e.reconcile("2026-08-21T00:00:31.000Z"), await w(await x(e, {}, !1), { status: 404 }, "Invalid wake"), await w(await x(e, {}), { status: 202 }, "First wake"), await w(await x(e, {}), { status: 202 }, "Duplicate wake"), await e.restart(), await e.reconcile("2026-08-21T00:00:32.000Z"), S((await e.state()).checkpoint, 7, "Retained cursor"), S((await e.state()).payloads.length, 7, "Deduplicated pages");
389
+ }
390
+ },
391
+ {
392
+ fixture: v,
393
+ name: "preserves a listener cursor on unchanged publication and fences retirement",
394
+ async verify(e) {
395
+ await e.reconcile("2026-08-21T00:00:31.000Z"), await e.republish("2026-08-21T00:00:40.000Z"), S((await e.state()).checkpoint, 7, "Republished cursor"), await e.reconcile("2026-08-21T00:01:31.000Z"), S((await e.state()).payloads.length, 8, "Republished pages"), await e.retire("2026-08-21T00:01:40.000Z"), await w(await x(e, {}), { status: 404 }, "Retired wake"), await e.reconcile("2026-08-21T00:02:40.000Z"), S((await e.state()).payloads.length, 8, "Retired pages");
260
396
  }
261
397
  }
262
398
  ];
263
- function m(e, t = {}) {
399
+ function b(e, t = {}) {
264
400
  return e.request(new Request(t.url ?? e.endpointUrl, {
265
401
  ...t.body == null ? {} : { body: t.body },
266
402
  headers: {
@@ -270,21 +406,21 @@ function m(e, t = {}) {
270
406
  method: t.method ?? "POST"
271
407
  }));
272
408
  }
273
- function h(e, t, n = !0) {
274
- return m(e, {
409
+ function x(e, t, n = !0) {
410
+ return b(e, {
275
411
  body: JSON.stringify(t),
276
412
  headers: n ? { "x-integration-secret": e.callbackSecret } : {}
277
413
  });
278
414
  }
279
- function g(e, n, r) {
415
+ function S(e, n, r) {
280
416
  if (!t(e, n)) throw Error(`${r}: expected ${JSON.stringify(n)}, received ${JSON.stringify(e)}.`);
281
417
  }
282
- function _(e) {
418
+ function C(e) {
283
419
  return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
284
420
  }
285
- async function v(e, t, n) {
286
- g(e.status, t.status, `${n} status`), t.body != null && g(await e.text(), t.body, `${n} body`);
287
- for (let [r, i] of Object.entries(t.headers ?? {})) g(e.headers.get(r), i, `${n} header ${r}`);
421
+ async function w(e, t, n) {
422
+ S(e.status, t.status, `${n} status`), t.body != null && S(await e.text(), t.body, `${n} body`);
423
+ for (let [r, i] of Object.entries(t.headers ?? {})) S(e.headers.get(r), i, `${n} header ${r}`);
288
424
  }
289
425
  //#endregion
290
- export { o as IntegrationConnectionError, s as PermanentIntegrationError, c as TransientIntegrationError, u as integrationCallbackSecret, p as integrationConformanceCases, l as integrationEndpointId, d as integrationOccurrenceId, n as maximumIntegrationBodyBytes, r as maximumIntegrationDeliveryPages };
426
+ export { u as IntegrationConnectionError, d as PermanentIntegrationError, f as TransientIntegrationError, m as integrationCallbackSecret, _ as integrationConformanceCases, p as integrationEndpointId, h as integrationOccurrenceId, y as listenerConformanceCases, a as maximumIntegrationBodyBytes, o as maximumIntegrationDeliveryPages, l as validateListenerPage };
@@ -5618,17 +5618,23 @@ var Al = /* @__PURE__ */ new Set([
5618
5618
  "operator.resumed"
5619
5619
  ]);
5620
5620
  function Nl(e) {
5621
- let t = W(e), n = t.health, r = t.kind, i = t.operatorState, a = q(t.runtimeVersion);
5622
- return t.version != 1 || typeof n != "string" || !jl.has(n) || typeof r != "string" || !Al.has(r) || i != "active" && i != "paused" || a <= 0 ? U() : {
5621
+ let t = W(e), n = t.health, r = t.listener == null ? void 0 : W(t.listener);
5622
+ if (r != null && r.health != "healthy" && r.health != "failed" && r.health != "needs_reauth") return U();
5623
+ let i = t.kind, a = t.operatorState, o = q(t.runtimeVersion);
5624
+ return t.version != 1 || typeof n != "string" || !jl.has(n) || typeof i != "string" || !Al.has(i) || a != "active" && a != "paused" || o <= 0 ? U() : {
5623
5625
  ...t.currentPublicationId == null ? {} : { currentPublicationId: G(t.currentPublicationId) },
5624
5626
  ...t.currentRevisionId == null ? {} : { currentRevisionId: G(t.currentRevisionId) },
5625
5627
  ...t.endpointUrl == null ? {} : { endpointUrl: G(t.endpointUrl) },
5628
+ ...r == null ? {} : { listener: {
5629
+ health: r.health,
5630
+ ...r.lastErrorCode == null ? {} : { lastErrorCode: G(r.lastErrorCode) }
5631
+ } },
5626
5632
  flowId: G(t.flowId),
5627
5633
  health: n,
5628
- kind: r,
5634
+ kind: i,
5629
5635
  ...t.lastErrorCode == null ? {} : { lastErrorCode: G(t.lastErrorCode) },
5630
- operatorState: i,
5631
- runtimeVersion: a,
5636
+ operatorState: a,
5637
+ runtimeVersion: o,
5632
5638
  triggerNodeId: G(t.triggerNodeId),
5633
5639
  updatedAt: G(t.updatedAt),
5634
5640
  version: 1