@w6w/embed 0.2.32 → 0.2.34

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.
Files changed (34) hide show
  1. package/dist/{DocumentFormModal-Cw85R4wk.js → DocumentFormModal-B3OkvI5v.js} +2 -2
  2. package/dist/{DocumentFormModal-Cw85R4wk.js.map → DocumentFormModal-B3OkvI5v.js.map} +1 -1
  3. package/dist/{ImportSpecModal-fU5RsVTa.js → ImportSpecModal-SQvTwtcX.js} +2 -2
  4. package/dist/{ImportSpecModal-fU5RsVTa.js.map → ImportSpecModal-SQvTwtcX.js.map} +1 -1
  5. package/dist/WorkflowEditor-D2EfEP-U.js +1201 -0
  6. package/dist/WorkflowEditor-D2EfEP-U.js.map +1 -0
  7. package/dist/apps-CFWdgGst.js +106 -0
  8. package/dist/apps-CFWdgGst.js.map +1 -0
  9. package/dist/chrome/HistoryView.d.ts +3 -0
  10. package/dist/editor-apps-ShwCmvLY.js +178 -0
  11. package/dist/editor-apps-ShwCmvLY.js.map +1 -0
  12. package/dist/{editor-tools-Dn7TgCP4.js → editor-tools-rY9nddqr.js} +49 -49
  13. package/dist/{editor-tools-Dn7TgCP4.js.map → editor-tools-rY9nddqr.js.map} +1 -1
  14. package/dist/editor.mjs +1 -1
  15. package/dist/editors.mjs +8 -8
  16. package/dist/index.mjs +4 -4
  17. package/dist/lib/history-query.d.ts +22 -1
  18. package/dist/lib/run-log-nodes.d.ts +43 -0
  19. package/dist/lists.mjs +6 -6
  20. package/dist/rail.mjs +1 -1
  21. package/dist/repos/history.d.ts +5 -1
  22. package/dist/repos.mjs +304 -300
  23. package/dist/{spec-import-CGPqUUjN.js → spec-import-CPbDnnuv.js} +2 -2
  24. package/dist/{spec-import-CGPqUUjN.js.map → spec-import-CPbDnnuv.js.map} +1 -1
  25. package/dist/{workflows-Dz8LMjnt.js → workflows-RhR8kwt7.js} +255 -214
  26. package/dist/workflows-RhR8kwt7.js.map +1 -0
  27. package/package.json +3 -3
  28. package/dist/WorkflowEditor-C7oudiIb.js +0 -1169
  29. package/dist/WorkflowEditor-C7oudiIb.js.map +0 -1
  30. package/dist/apps-FMcQfyL2.js +0 -92
  31. package/dist/apps-FMcQfyL2.js.map +0 -1
  32. package/dist/editor-apps-HEOclsxL.js +0 -152
  33. package/dist/editor-apps-HEOclsxL.js.map +0 -1
  34. package/dist/workflows-Dz8LMjnt.js.map +0 -1
@@ -1,37 +1,37 @@
1
- import { useQueryClient as y, useMutation as w, useQuery as g } from "@tanstack/react-query";
2
- import { isTerminalRunStatus as I, path as h } from "@w6w/sdk";
3
- import { u as l } from "./client-context-CX61Bgw-.js";
1
+ import { useQueryClient as g, useMutation as w, useQuery as y } from "@tanstack/react-query";
2
+ import { isTerminalRunStatus as R, path as h } from "@w6w/sdk";
3
+ import { u as d } from "./client-context-CX61Bgw-.js";
4
4
  import { foldStateLog as C } from "@w6w/expr";
5
5
  function K(t) {
6
6
  return (t == null ? void 0 : t.nodes) ?? (t == null ? void 0 : t.steps) ?? void 0;
7
7
  }
8
- const v = "Node failed without reporting a reason.", M = "Run failed without reporting a reason.";
9
- function A(t) {
10
- return t === void 0 || !I(t);
8
+ const q = "Node failed without reporting a reason.", $ = "Run failed without reporting a reason.";
9
+ function T(t) {
10
+ return t === void 0 || !R(t);
11
11
  }
12
12
  function P(t, e) {
13
- return e || t === void 0 ? !1 : !I(t);
13
+ return e || t === void 0 ? !1 : !R(t);
14
14
  }
15
- const mt = [0, 1500];
16
- function St(t, e, n) {
17
- return t !== void 0 && I(t) && e === n;
15
+ const bt = [0, 1500];
16
+ function qt(t, e, n) {
17
+ return t !== void 0 && R(t) && e === n;
18
18
  }
19
- function kt(t, e) {
19
+ function vt(t, e) {
20
20
  return P(t, e) ? t === "queued" ? "Queued…" : "Running…" : "Run";
21
21
  }
22
- function qt(t) {
22
+ function It(t) {
23
23
  return t === "run_not_cancelable" ? "reconcile" : "surface";
24
24
  }
25
- function Q(t, e) {
25
+ function U(t, e) {
26
26
  if (!t) return [];
27
- const n = e ? U(e) : void 0;
27
+ const n = e ? W(e) : void 0;
28
28
  return Object.entries(t).map(([o, r]) => ({
29
- ...T(o, r),
29
+ ...A(o, r),
30
30
  ...N(r),
31
31
  ...(n == null ? void 0 : n.get(o)) ?? {}
32
32
  }));
33
33
  }
34
- function U(t) {
34
+ function W(t) {
35
35
  const e = [...t].sort((r, i) => r.seq - i.seq), n = /* @__PURE__ */ new Map();
36
36
  for (const r of e) {
37
37
  if (r.nodeId === null || r.nodeId === void 0) continue;
@@ -45,17 +45,17 @@ function U(t) {
45
45
  o.set(r, { stateWrites: i, stateAfter: C(e, a) });
46
46
  return o;
47
47
  }
48
- const W = /* @__PURE__ */ new Set([
48
+ const Q = /* @__PURE__ */ new Set([
49
49
  "not_on_path",
50
50
  "condition",
51
51
  "stopped",
52
52
  "disabled"
53
53
  ]);
54
- function T(t, e) {
54
+ function A(t, e) {
55
55
  return {
56
56
  id: t,
57
57
  status: e.status,
58
- ...e.status === "skipped" && W.has(e.skipReason) ? { skipReason: e.skipReason } : {},
58
+ ...e.status === "skipped" && Q.has(e.skipReason) ? { skipReason: e.skipReason } : {},
59
59
  startedAt: e.startedAt,
60
60
  finishedAt: e.finishedAt,
61
61
  input: e.input,
@@ -65,15 +65,15 @@ function T(t, e) {
65
65
  ...D(e)
66
66
  };
67
67
  }
68
- const $ = /* @__PURE__ */ new Set(["succeeded", "failed", "running"]);
68
+ const L = /* @__PURE__ */ new Set(["succeeded", "failed", "running"]);
69
69
  function N(t) {
70
70
  if (!t || !Array.isArray(t.iterations)) return {};
71
71
  const e = t.iterations.filter((o) => o !== null && typeof o == "object").map((o) => {
72
72
  var u;
73
- const r = o.nodes !== null && typeof o.nodes == "object" ? o.nodes : {}, i = Object.entries(r).map(([s, d]) => ({
74
- ...T(s, d),
75
- ...N(d)
76
- })), a = typeof o.failedNodeId == "string" && o.failedNodeId !== "" ? o.failedNodeId : (u = i.find((s) => s.status === "failed")) == null ? void 0 : u.id, c = $.has(o.status) ? o.status : i.some((s) => s.status === "failed") ? "failed" : i.some((s) => s.status === "running") ? "running" : "succeeded";
73
+ const r = o.nodes !== null && typeof o.nodes == "object" ? o.nodes : {}, i = Object.entries(r).map(([s, l]) => ({
74
+ ...A(s, l),
75
+ ...N(l)
76
+ })), a = typeof o.failedNodeId == "string" && o.failedNodeId !== "" ? o.failedNodeId : (u = i.find((s) => s.status === "failed")) == null ? void 0 : u.id, c = L.has(o.status) ? o.status : i.some((s) => s.status === "failed") ? "failed" : i.some((s) => s.status === "running") ? "running" : "succeeded";
77
77
  return {
78
78
  index: o.index,
79
79
  status: c,
@@ -89,14 +89,14 @@ function N(t) {
89
89
  };
90
90
  }
91
91
  function D(t) {
92
- const e = b(t.error);
93
- return e ? { error: e } : t.status === "failed" ? { error: { message: v } } : {};
92
+ const e = v(t.error);
93
+ return e ? { error: e } : t.status === "failed" ? { error: { message: q } } : {};
94
94
  }
95
- function b(t) {
95
+ function v(t) {
96
96
  if (t != null) {
97
97
  if (typeof t == "string" && t !== "") return { message: t };
98
98
  if (typeof t == "object") {
99
- const e = t, n = typeof e.code == "string" ? e.code : void 0, o = typeof e.message == "string" && e.message !== "" ? e.message : n || L(t);
99
+ const e = t, n = typeof e.code == "string" ? e.code : void 0, o = typeof e.message == "string" && e.message !== "" ? e.message : n || j(t);
100
100
  return {
101
101
  ...n !== void 0 ? { code: n } : {},
102
102
  message: o || "Unknown error.",
@@ -107,34 +107,34 @@ function b(t) {
107
107
  return { message: String(t) || "Unknown error." };
108
108
  }
109
109
  }
110
- function L(t) {
110
+ function j(t) {
111
111
  try {
112
112
  return JSON.stringify(t) ?? "";
113
113
  } catch {
114
114
  return "";
115
115
  }
116
116
  }
117
- function vt(t, e) {
117
+ function Rt(t, e) {
118
118
  if (!t) return {};
119
119
  const n = new Set(e.filter((s) => s.error !== void 0).map((s) => s.id)), o = new Set(
120
- e.filter((s) => s.error !== void 0 && s.error.message !== v).map((s) => s.id)
121
- ), r = (t.stepErrors ?? []).map((s) => ({ e: s, id: s.nodeId ?? s.stepId ?? "" })).filter(({ id: s }) => !o.has(s)).map(({ e: s, id: d }) => ({
122
- stepId: d,
123
- error: b(s.error) ?? { message: v }
124
- })), i = b(t.error), a = (s) => i !== void 0 && (s == null ? void 0 : s.message) === i.message && (s == null ? void 0 : s.code) === i.code;
120
+ e.filter((s) => s.error !== void 0 && s.error.message !== q).map((s) => s.id)
121
+ ), r = (t.stepErrors ?? []).map((s) => ({ e: s, id: s.nodeId ?? s.stepId ?? "" })).filter(({ id: s }) => !o.has(s)).map(({ e: s, id: l }) => ({
122
+ stepId: l,
123
+ error: v(s.error) ?? { message: q }
124
+ })), i = v(t.error), a = (s) => i !== void 0 && (s == null ? void 0 : s.message) === i.message && (s == null ? void 0 : s.code) === i.code;
125
125
  let u = e.some((s) => a(s.error)) || r.some((s) => a(s.error)) ? void 0 : i;
126
- return !u && t.status === "failed" && n.size === 0 && r.length === 0 && (u = { message: M }), {
126
+ return !u && t.status === "failed" && n.size === 0 && r.length === 0 && (u = { message: $ }), {
127
127
  ...u ? { runError: u } : {},
128
128
  ...r.length > 0 ? { stepErrors: r } : {}
129
129
  };
130
130
  }
131
- function j(t) {
131
+ function x(t) {
132
132
  var n;
133
133
  const e = (n = t == null ? void 0 : t[t.length - 1]) == null ? void 0 : n.with;
134
134
  if (!(e === null || typeof e != "object" || Array.isArray(e)))
135
135
  return e;
136
136
  }
137
- async function bt(t, e, n) {
137
+ async function Tt(t, e, n) {
138
138
  var o;
139
139
  if (t) {
140
140
  if (n)
@@ -147,13 +147,13 @@ async function bt(t, e, n) {
147
147
  } catch {
148
148
  }
149
149
  try {
150
- return j(await e(t));
150
+ return x(await e(t));
151
151
  } catch {
152
152
  return;
153
153
  }
154
154
  }
155
155
  }
156
- function Rt(t, e, n) {
156
+ function Et(t, e, n) {
157
157
  const o = t.find((i) => {
158
158
  var a;
159
159
  return !!((a = i.uses) != null && a.app) && e(i.uses.app);
@@ -167,75 +167,83 @@ function Rt(t, e, n) {
167
167
  );
168
168
  return r ? { id: r.id, manual: !1 } : void 0;
169
169
  }
170
- const x = /* @__PURE__ */ new Set(["succeeded", "failed", "canceled"]);
171
- function G(t) {
170
+ const G = /* @__PURE__ */ new Set(["succeeded", "failed", "canceled"]);
171
+ function H(t) {
172
172
  return new Promise((e) => setTimeout(e, t));
173
173
  }
174
- async function F(t, e = G) {
174
+ async function F(t, e = H) {
175
175
  for (let n = 0; n < 600; n++) {
176
176
  const o = await t();
177
- if (x.has(o.status)) return o;
177
+ if (G.has(o.status)) return o;
178
178
  await e(500);
179
179
  }
180
180
  return t();
181
181
  }
182
- const H = {
182
+ const Y = {
183
183
  status: "",
184
184
  kind: "",
185
185
  from: "",
186
186
  to: "",
187
187
  q: "",
188
+ trigger: "",
188
189
  offset: 0
189
- }, _ = 25, Y = /* @__PURE__ */ new Set([
190
+ }, _ = /^(entry|kind):.{1,200}$/;
191
+ function B(t) {
192
+ if (!_.test(t)) return {};
193
+ const e = t.slice(t.indexOf(":") + 1);
194
+ return t.startsWith("entry:") ? { entry: e } : { trigger: e };
195
+ }
196
+ const O = 25, J = /* @__PURE__ */ new Set([
190
197
  "queued",
191
198
  "running",
192
199
  "succeeded",
193
200
  "failed",
194
201
  "canceled"
195
- ]), B = /* @__PURE__ */ new Set(["function", "endpoint", "workflow"]), J = /^\d{4}-\d{2}-\d{2}$/;
202
+ ]), V = /* @__PURE__ */ new Set(["function", "endpoint", "workflow"]), z = /^\d{4}-\d{2}-\d{2}$/;
196
203
  function m(t) {
197
- if (!J.test(t)) return !1;
198
- const { y: e, m: n, d: o } = R(t), r = new Date(e, n - 1, o);
204
+ if (!z.test(t)) return !1;
205
+ const { y: e, m: n, d: o } = I(t), r = new Date(e, n - 1, o);
199
206
  return r.getFullYear() === e && r.getMonth() === n - 1 && r.getDate() === o;
200
207
  }
201
- function R(t) {
208
+ function I(t) {
202
209
  const [e, n, o] = t.split("-").map(Number);
203
210
  return { y: e, m: n, d: o };
204
211
  }
205
- function It(t) {
206
- const e = new URLSearchParams(t), n = e.get("status") ?? "", o = e.get("kind") ?? "", r = e.get("from") ?? "", i = e.get("to") ?? "", a = e.get("q") ?? "", c = e.get("offset");
207
- let u = 0;
208
- if (c !== null) {
209
- const s = Number(c);
210
- Number.isInteger(s) && s >= 0 && (u = s);
212
+ function At(t) {
213
+ const e = new URLSearchParams(t), n = e.get("status") ?? "", o = e.get("kind") ?? "", r = e.get("from") ?? "", i = e.get("to") ?? "", a = e.get("q") ?? "", c = e.get("trigger") ?? "", u = e.get("offset");
214
+ let s = 0;
215
+ if (u !== null) {
216
+ const l = Number(u);
217
+ Number.isInteger(l) && l >= 0 && (s = l);
211
218
  }
212
219
  return {
213
- status: Y.has(n) ? n : "",
214
- kind: B.has(o) ? o : "",
220
+ status: J.has(n) ? n : "",
221
+ kind: V.has(o) ? o : "",
215
222
  from: m(r) ? r : "",
216
223
  to: m(i) ? i : "",
217
224
  q: a,
218
- offset: u
225
+ trigger: _.test(c) ? c : "",
226
+ offset: s
219
227
  };
220
228
  }
221
- function At(t) {
229
+ function Nt(t) {
222
230
  const e = new URLSearchParams();
223
- t.status !== "" && e.set("status", t.status), t.kind !== "" && e.set("kind", t.kind), t.from !== "" && e.set("from", t.from), t.to !== "" && e.set("to", t.to), t.q !== "" && e.set("q", t.q), t.offset > 0 && e.set("offset", String(t.offset));
231
+ t.status !== "" && e.set("status", t.status), t.kind !== "" && e.set("kind", t.kind), t.from !== "" && e.set("from", t.from), t.to !== "" && e.set("to", t.to), t.q !== "" && e.set("q", t.q), t.trigger && e.set("trigger", t.trigger), t.offset > 0 && e.set("offset", String(t.offset));
224
232
  const n = e.toString();
225
233
  return n === "" ? "" : `?${n}`;
226
234
  }
227
- function O(t, e, n) {
235
+ function M(t, e, n) {
228
236
  const o = {};
229
237
  if ("project" in t ? (o.project = t.project, e.kind !== "" && (o.kind = e.kind)) : o.callable = t.callable, e.status !== "" && (o.status = e.status), e.from !== "" && m(e.from)) {
230
- const { y: i, m: a, d: c } = R(e.from);
238
+ const { y: i, m: a, d: c } = I(e.from);
231
239
  o.from = new Date(i, a - 1, c).toISOString();
232
240
  }
233
241
  if (e.to !== "" && m(e.to)) {
234
- const { y: i, m: a, d: c } = R(e.to);
242
+ const { y: i, m: a, d: c } = I(e.to);
235
243
  o.to = new Date(i, a - 1, c + 1).toISOString();
236
244
  }
237
245
  const r = e.q.trim();
238
- return r !== "" && (o.q = r), n.paged && (o.limit = String(n.limit ?? _), e.offset > 0 && (o.offset = String(e.offset))), o;
246
+ return r !== "" && (o.q = r), e.trigger && Object.assign(o, B(e.trigger)), n.paged && (o.limit = String(n.limit ?? O), e.offset > 0 && (o.offset = String(e.offset))), o;
239
247
  }
240
248
  const E = {
241
249
  root: ["history"],
@@ -250,23 +258,26 @@ const E = {
250
258
  },
251
259
  detail(t, e) {
252
260
  return ["history", "detail", t, e];
261
+ },
262
+ triggers(t) {
263
+ return ["history", "triggers", t];
253
264
  }
254
265
  };
255
- function V(t, e, n, o = _) {
266
+ function Z(t, e, n, o = O) {
256
267
  return t.request({
257
268
  method: "GET",
258
269
  path: "/history",
259
- query: O(e, n, { paged: !0, limit: o })
270
+ query: M(e, n, { paged: !0, limit: o })
260
271
  }).then((r) => r.body);
261
272
  }
262
- function Et(t, e, n) {
273
+ function Ft(t, e, n) {
263
274
  return t.request({
264
275
  method: "GET",
265
276
  path: "/history/stats",
266
- query: O(e, n, { paged: !1 })
277
+ query: M(e, n, { paged: !1 })
267
278
  }).then((o) => o.body.stats);
268
279
  }
269
- async function z(t, e) {
280
+ async function X(t, e) {
270
281
  var a, c, u;
271
282
  const n = /* @__PURE__ */ new Map();
272
283
  let o;
@@ -277,36 +288,63 @@ async function z(t, e) {
277
288
  return n;
278
289
  }
279
290
  for (const s of o) {
280
- const d = (a = s.uses) == null ? void 0 : a.app, f = (c = s.uses) == null ? void 0 : c.action;
281
- typeof s.id != "string" || typeof d != "string" || typeof f != "string" || n.set(s.id, { app: d, action: f, ...((u = s.uses) == null ? void 0 : u.trigger) === !0 ? { trigger: !0 } : {} });
291
+ const l = (a = s.uses) == null ? void 0 : a.app, f = (c = s.uses) == null ? void 0 : c.action;
292
+ typeof s.id != "string" || typeof l != "string" || typeof f != "string" || n.set(s.id, { app: l, action: f, ...((u = s.uses) == null ? void 0 : u.trigger) === !0 ? { trigger: !0 } : {} });
282
293
  }
283
294
  const r = [...new Set([...n.values()].map((s) => s.app))].filter(
284
295
  (s) => !s.startsWith("@w6w/")
285
296
  ), i = await Promise.all(
286
297
  r.map(async (s) => {
287
- const d = [...n.values()].some((p) => p.app === s && p.trigger), [f, k] = await Promise.all([
298
+ const l = [...n.values()].some((p) => p.app === s && p.trigger), [f, k] = await Promise.all([
288
299
  t.console.apps.get(s).catch(() => null),
289
- d ? t.console.apps.getTriggers(s).catch(() => []) : Promise.resolve([])
290
- ]), q = /* @__PURE__ */ new Map();
291
- for (const p of (f == null ? void 0 : f.actions) ?? []) q.set(`a:${p.key}`, p.title);
292
- for (const p of k) q.set(`t:${p.key}`, p.title);
293
- return { app: s, displayName: f == null ? void 0 : f.app.displayName, titles: q };
300
+ l ? t.console.apps.getTriggers(s).catch(() => []) : Promise.resolve([])
301
+ ]), b = /* @__PURE__ */ new Map();
302
+ for (const p of (f == null ? void 0 : f.actions) ?? []) b.set(`a:${p.key}`, p.title);
303
+ for (const p of k) b.set(`t:${p.key}`, p.title);
304
+ return { app: s, displayName: f == null ? void 0 : f.app.displayName, titles: b };
294
305
  })
295
306
  );
296
307
  for (const s of n.values()) {
297
- const d = i.find((k) => k.app === s.app);
298
- if (!d) continue;
299
- d.displayName && (s.appName = d.displayName);
300
- const f = d.titles.get(`${s.trigger ? "t" : "a"}:${s.action}`);
308
+ const l = i.find((k) => k.app === s.app);
309
+ if (!l) continue;
310
+ l.displayName && (s.appName = l.displayName);
311
+ const f = l.titles.get(`${s.trigger ? "t" : "a"}:${s.action}`);
301
312
  f && (s.actionName = f);
302
313
  }
303
314
  return n;
304
315
  }
305
- async function Tt(t, e) {
316
+ const tt = {
317
+ "@w6w/trigger": "Manual trigger",
318
+ "@w6w/webhook": "Webhook",
319
+ "@w6w/scheduler": "Schedule",
320
+ "@w6w/form": "Form"
321
+ };
322
+ function _t(t) {
323
+ const e = [];
324
+ for (const [o, r] of t) {
325
+ const i = tt[r.app];
326
+ if (!i && !r.trigger) continue;
327
+ const a = i ?? `${r.appName ?? r.app} · ${r.actionName ?? r.action}`;
328
+ e.push({ nodeId: o, label: a, app: r.app });
329
+ }
330
+ const n = /* @__PURE__ */ new Map();
331
+ for (const o of e) n.set(o.label, (n.get(o.label) ?? 0) + 1);
332
+ return e.map(
333
+ (o) => (n.get(o.label) ?? 0) > 1 ? { ...o, label: `${o.label} (${o.nodeId})` } : o
334
+ );
335
+ }
336
+ function Ot(t, e) {
337
+ if (t.triggerNodeId) {
338
+ const n = e.find((o) => o.nodeId === t.triggerNodeId);
339
+ if (n) return n.label;
340
+ }
341
+ return t.trigger ? t.trigger === "manual" ? "Manual run" : t.trigger.charAt(0).toUpperCase() + t.trigger.slice(1) : null;
342
+ }
343
+ async function Mt(t, e) {
306
344
  if (e.kind === "workflow") {
307
345
  const [r, i] = await Promise.all([
308
346
  t.console.workflows.getRun(e.id),
309
- z(t, e.callableId)
347
+ X(t, e.callableId)
310
348
  ]), a = r;
311
349
  return {
312
350
  id: e.id,
@@ -320,7 +358,7 @@ async function Tt(t, e) {
320
358
  output: r.output,
321
359
  error: r.error,
322
360
  rerunOf: e.rerunOf ?? null,
323
- steps: Q(K(r)).map((c) => {
361
+ steps: U(K(r)).map((c) => {
324
362
  const u = i.get(c.id);
325
363
  return u ? { ...c, node: u } : c;
326
364
  })
@@ -344,14 +382,14 @@ async function Tt(t, e) {
344
382
  rerunOf: e.rerunOf ?? null
345
383
  };
346
384
  }
347
- function Z(t) {
385
+ function et(t) {
348
386
  const e = t == null ? void 0 : t.raw, n = e == null ? void 0 : e.invocationId;
349
387
  return typeof n == "string" ? n : void 0;
350
388
  }
351
- function X(t) {
389
+ function nt(t) {
352
390
  return t !== null && typeof t == "object" && !Array.isArray(t) ? t : {};
353
391
  }
354
- async function tt(t, e, n) {
392
+ async function ot(t, e, n) {
355
393
  const o = encodeURIComponent(e.callableId);
356
394
  if (e.kind === "workflow") {
357
395
  const u = (await t.request({
@@ -364,7 +402,7 @@ async function tt(t, e, n) {
364
402
  const r = await t.request({
365
403
  method: "GET",
366
404
  path: `/invocations/${encodeURIComponent(e.id)}`
367
- }), i = X(r.body.invocation.input), a = e.kind === "function" ? { inputs: i, allowUnpublished: !0, rerunOf: e.id } : { input: i, allowUnpublished: !0, rerunOf: e.id };
405
+ }), i = nt(r.body.invocation.input), a = e.kind === "function" ? { inputs: i, allowUnpublished: !0, rerunOf: e.id } : { input: i, allowUnpublished: !0, rerunOf: e.id };
368
406
  try {
369
407
  const u = (await t.request({
370
408
  method: "POST",
@@ -374,56 +412,56 @@ async function tt(t, e, n) {
374
412
  if (typeof u != "string") throw new Error("The server did not return an invocation id.");
375
413
  return u;
376
414
  } catch (c) {
377
- const u = Z(c);
415
+ const u = et(c);
378
416
  if (u === void 0) throw c;
379
417
  return u;
380
418
  }
381
419
  }
382
- async function Nt(t, e, n = {}) {
383
- const o = await tt(t, e, n.sleep);
384
- return et(t, e.callableId, o);
420
+ async function Ct(t, e, n = {}) {
421
+ const o = await ot(t, e, n.sleep);
422
+ return rt(t, e.callableId, o);
385
423
  }
386
- async function et(t, e, n) {
387
- return (await V(
424
+ async function rt(t, e, n) {
425
+ return (await Z(
388
426
  t,
389
427
  { callable: e },
390
- { ...H, q: n },
428
+ { ...Y, q: n },
391
429
  1
392
430
  )).executions.find((r) => r.id === n) ?? null;
393
431
  }
394
- const nt = (t) => ["workflows", t];
395
- function ot(t, e) {
432
+ const st = (t) => ["workflows", t];
433
+ function it(t, e) {
396
434
  return t.workflows.list({ project: e });
397
435
  }
398
- function Ft(t, e = !0) {
399
- const n = l();
400
- return g({
401
- queryKey: nt(t),
402
- queryFn: () => ot(n, t),
436
+ function Kt(t, e = !0) {
437
+ const n = d();
438
+ return y({
439
+ queryKey: st(t),
440
+ queryFn: () => it(n, t),
403
441
  enabled: e
404
442
  });
405
443
  }
406
- const rt = (t) => ["workflow", t];
407
- function st(t, e) {
444
+ const at = (t) => ["workflow", t];
445
+ function ut(t, e) {
408
446
  return t.workflows.get(e);
409
447
  }
410
- function _t(t, e = !0) {
411
- const n = l();
412
- return g({
413
- queryKey: rt(t),
414
- queryFn: () => st(n, t),
448
+ function $t(t, e = !0) {
449
+ const n = d();
450
+ return y({
451
+ queryKey: at(t),
452
+ queryFn: () => ut(n, t),
415
453
  enabled: e
416
454
  });
417
455
  }
418
- function Ot(t) {
419
- const e = l(), n = y();
456
+ function Pt(t) {
457
+ const e = d(), n = g();
420
458
  return w({
421
459
  mutationFn: (o) => t ? e.console.workflows.upsert(o, { project: t }) : Promise.reject(new Error("No project selected yet.")),
422
460
  onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
423
461
  });
424
462
  }
425
- function Ct(t) {
426
- const e = l(), n = y();
463
+ function Ut(t) {
464
+ const e = d(), n = g();
427
465
  return w({
428
466
  mutationFn: (o) => t ? e.console.workflows.upsert(o.definition, {
429
467
  project: t,
@@ -432,46 +470,46 @@ function Ct(t) {
432
470
  onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
433
471
  });
434
472
  }
435
- function Kt() {
436
- const t = l(), e = y();
473
+ function Wt() {
474
+ const t = d(), e = g();
437
475
  return w({
438
476
  mutationFn: (n) => t.workflows.archive(n),
439
477
  onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
440
478
  });
441
479
  }
442
- function Mt() {
443
- const t = l(), e = y();
480
+ function Qt() {
481
+ const t = d(), e = g();
444
482
  return w({
445
483
  mutationFn: (n) => t.workflows.delete(n),
446
484
  onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
447
485
  });
448
486
  }
449
487
  const S = (t) => ["runs", t];
450
- function Pt(t) {
451
- const e = l();
452
- return g({
488
+ function Lt(t) {
489
+ const e = d();
490
+ return y({
453
491
  queryKey: S(t),
454
492
  queryFn: () => e.console.workflows.listRuns(t)
455
493
  });
456
494
  }
457
- function it(t, e, n, o) {
495
+ function ct(t, e, n, o) {
458
496
  return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => F(() => t.console.workflows.getRun(r.runId)));
459
497
  }
460
- function Qt() {
461
- const t = l(), e = y();
498
+ function Dt() {
499
+ const t = d(), e = g();
462
500
  return w({
463
- mutationFn: (n) => it(t, n.id, n.variables, n.input),
501
+ mutationFn: (n) => ct(t, n.id, n.variables, n.input),
464
502
  onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
465
503
  onSettled: () => e.invalidateQueries({ queryKey: E.root })
466
504
  });
467
505
  }
468
- function Ut(t, e, n, o, r) {
506
+ function jt(t, e, n, o, r) {
469
507
  return t.workflows.run(e, { variables: n, input: o, entry: r, wait: !0 });
470
508
  }
471
- function at(t, e, n, o) {
509
+ function lt(t, e, n, o) {
472
510
  return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => ({ runId: r.runId }));
473
511
  }
474
- async function ut(t, e, n, o) {
512
+ async function dt(t, e, n, o) {
475
513
  return { runId: (await t.request({
476
514
  method: "POST",
477
515
  path: h`/workflows/${e}/nodes/${n}/run`,
@@ -483,19 +521,19 @@ async function ut(t, e, n, o) {
483
521
  }
484
522
  })).body.runId };
485
523
  }
486
- function Wt(t, e) {
524
+ function xt(t, e) {
487
525
  return t.request({
488
526
  method: "GET",
489
527
  path: h`/workflows/${e}/node-samples`
490
528
  }).then((n) => n.body.nodeSamples ?? []);
491
529
  }
492
- function $t(t, e) {
530
+ function Gt(t, e) {
493
531
  return t.request({
494
532
  method: "GET",
495
533
  path: h`/workflows/${e}/test-inputs`
496
534
  }).then((n) => n.body.testInputs ?? []);
497
535
  }
498
- function Dt(t, e, n, o) {
536
+ function Ht(t, e, n, o) {
499
537
  return t.request({
500
538
  method: "PUT",
501
539
  path: h`/workflows/${e}/nodes/${n}/test-input`,
@@ -503,124 +541,127 @@ function Dt(t, e, n, o) {
503
541
  }).then(() => {
504
542
  });
505
543
  }
506
- function Lt() {
507
- const t = l(), e = y();
544
+ function Yt() {
545
+ const t = d(), e = g();
508
546
  return w({
509
- mutationFn: (n) => ut(t, n.id, n.nodeId, n.body),
547
+ mutationFn: (n) => dt(t, n.id, n.nodeId, n.body),
510
548
  onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
511
549
  onSettled: () => e.invalidateQueries({ queryKey: E.root })
512
550
  });
513
551
  }
514
- function jt() {
515
- const t = l(), e = y();
552
+ function Bt() {
553
+ const t = d(), e = g();
516
554
  return w({
517
- mutationFn: (n) => at(t, n.id, n.variables, n.input),
555
+ mutationFn: (n) => lt(t, n.id, n.variables, n.input),
518
556
  onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
519
557
  onSettled: () => e.invalidateQueries({ queryKey: E.root })
520
558
  });
521
559
  }
522
- function ct(t, e) {
560
+ function ft(t, e) {
523
561
  return t.workflows.cancel(e);
524
562
  }
525
- function xt() {
526
- const t = l();
563
+ function Jt() {
564
+ const t = d();
527
565
  return w({
528
- mutationFn: (e) => ct(t, e)
566
+ mutationFn: (e) => ft(t, e)
529
567
  });
530
568
  }
531
- function dt(t, e) {
569
+ function pt(t, e) {
532
570
  return t.console.workflows.getRun(e);
533
571
  }
534
- const lt = (t) => ["run", t];
535
- function Gt(t) {
536
- const e = l();
537
- return g({
538
- queryKey: lt(t ?? ""),
539
- queryFn: () => dt(e, t),
572
+ const wt = (t) => ["run", t];
573
+ function Vt(t) {
574
+ const e = d();
575
+ return y({
576
+ queryKey: wt(t ?? ""),
577
+ queryFn: () => pt(e, t),
540
578
  enabled: t != null,
541
579
  refetchInterval: (n) => {
542
580
  var o;
543
- return A((o = n.state.data) == null ? void 0 : o.status) ? 500 : !1;
581
+ return T((o = n.state.data) == null ? void 0 : o.status) ? 500 : !1;
544
582
  }
545
583
  });
546
584
  }
547
- function ft(t, e) {
585
+ function gt(t, e) {
548
586
  return t.request({
549
587
  method: "GET",
550
588
  path: h`/runs/${e}/state-writes`
551
589
  }).then((n) => ({ writes: n.body.writes ?? [], truncated: n.body.truncated === !0 }));
552
590
  }
553
- function pt(t, e) {
554
- return ["run", t, "state-writes", A(e) ? "live" : "final"];
591
+ function yt(t, e) {
592
+ return ["run", t, "state-writes", T(e) ? "live" : "final"];
555
593
  }
556
- function Ht(t, e) {
557
- const n = l(), o = A(e);
558
- return g({
559
- queryKey: pt(t ?? "", e),
560
- queryFn: () => ft(n, t),
594
+ function zt(t, e) {
595
+ const n = d(), o = T(e);
596
+ return y({
597
+ queryKey: yt(t ?? "", e),
598
+ queryFn: () => gt(n, t),
561
599
  enabled: t != null,
562
600
  refetchInterval: o ? 500 : !1,
563
601
  retry: !1
564
602
  });
565
603
  }
566
604
  export {
567
- jt as $,
568
- vt as A,
569
- K as B,
570
- lt as C,
571
- pt as D,
572
- H as E,
573
- it as F,
574
- Ut as G,
575
- _ as H,
576
- S as I,
577
- Dt as J,
578
- A as K,
579
- ut as L,
580
- at as M,
581
- St as N,
582
- b as O,
583
- Kt as P,
584
- xt as Q,
585
- M as R,
586
- v as S,
587
- Ot as T,
588
- Mt as U,
589
- Gt as V,
590
- Lt as W,
591
- Ht as X,
592
- Qt as Y,
593
- Pt as Z,
594
- Ct as _,
595
- mt as a,
596
- _t as a0,
597
- Ft as a1,
598
- rt as a2,
599
- nt as a3,
600
- qt as b,
601
- ct as c,
602
- z as d,
603
- At as e,
604
- It as f,
605
- et as g,
606
- Tt as h,
607
- V as i,
608
- Et as j,
609
- dt as k,
610
- ft as l,
611
- st as m,
612
- Rt as n,
605
+ Lt as $,
606
+ Tt as A,
607
+ vt as B,
608
+ Rt as C,
609
+ K as D,
610
+ Y as E,
611
+ wt as F,
612
+ yt as G,
613
+ O as H,
614
+ ct as I,
615
+ jt as J,
616
+ S as K,
617
+ Ht as L,
618
+ T as M,
619
+ dt as N,
620
+ lt as O,
621
+ qt as P,
622
+ v as Q,
623
+ $ as R,
624
+ q as S,
625
+ Wt as T,
626
+ Jt as U,
627
+ Pt as V,
628
+ Qt as W,
629
+ Vt as X,
630
+ Yt as Y,
631
+ zt as Z,
632
+ Dt as _,
633
+ bt as a,
634
+ Ut as a0,
635
+ Bt as a1,
636
+ $t as a2,
637
+ Kt as a3,
638
+ at as a4,
639
+ _t as a5,
640
+ st as a6,
641
+ It as b,
642
+ ft as c,
643
+ X as d,
644
+ Nt as e,
645
+ At as f,
646
+ rt as g,
647
+ Mt as h,
648
+ Z as i,
649
+ Ft as j,
650
+ pt as k,
651
+ gt as l,
652
+ ut as m,
653
+ Et as n,
613
654
  E as o,
614
- O as p,
655
+ M as p,
615
656
  P as q,
616
- j as r,
617
- Wt as s,
618
- $t as t,
619
- ot as u,
620
- Q as v,
621
- F as w,
622
- Nt as x,
623
- bt as y,
624
- kt as z
657
+ Ot as r,
658
+ x as s,
659
+ B as t,
660
+ xt as u,
661
+ Gt as v,
662
+ it as w,
663
+ U as x,
664
+ F as y,
665
+ Ct as z
625
666
  };
626
- //# sourceMappingURL=workflows-Dz8LMjnt.js.map
667
+ //# sourceMappingURL=workflows-RhR8kwt7.js.map