@w6w/embed 0.2.33 → 0.2.35

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 (82) hide show
  1. package/dist/{CreateFunctionModal-glk2zg1r.js → CreateFunctionModal-CYNHJUGJ.js} +3 -3
  2. package/dist/{CreateFunctionModal-glk2zg1r.js.map → CreateFunctionModal-CYNHJUGJ.js.map} +1 -1
  3. package/dist/{DocumentFormModal-Cw85R4wk.js → DocumentFormModal-CLmdGx34.js} +2 -2
  4. package/dist/{DocumentFormModal-Cw85R4wk.js.map → DocumentFormModal-CLmdGx34.js.map} +1 -1
  5. package/dist/ImportSpecModal-BzEyiNWD.js +378 -0
  6. package/dist/ImportSpecModal-BzEyiNWD.js.map +1 -0
  7. package/dist/WorkflowEditor-CxTuK8_d.js +1272 -0
  8. package/dist/WorkflowEditor-CxTuK8_d.js.map +1 -0
  9. package/dist/apps-CyEszfIu.js +106 -0
  10. package/dist/apps-CyEszfIu.js.map +1 -0
  11. package/dist/callable-row-actions-BPBPflMn.js +56 -0
  12. package/dist/callable-row-actions-BPBPflMn.js.map +1 -0
  13. package/dist/callables-dLF2IcwA.js +317 -0
  14. package/dist/callables-dLF2IcwA.js.map +1 -0
  15. package/dist/chrome/HistoryView.d.ts +3 -0
  16. package/dist/chrome/TagEditor.d.ts +6 -1
  17. package/dist/chrome/workspace.d.ts +16 -0
  18. package/dist/documents-hgltn0xe.js +1017 -0
  19. package/dist/documents-hgltn0xe.js.map +1 -0
  20. package/dist/draft.mjs +1 -1
  21. package/dist/editor/WaitingForm.d.ts +19 -0
  22. package/dist/editor-apps-DsGrGKfe.js +178 -0
  23. package/dist/editor-apps-DsGrGKfe.js.map +1 -0
  24. package/dist/{editor-tools-Dn7TgCP4.js → editor-tools-Ct7YPPj8.js} +681 -783
  25. package/dist/editor-tools-Ct7YPPj8.js.map +1 -0
  26. package/dist/editor.mjs +1 -1
  27. package/dist/editors.mjs +18 -18
  28. package/dist/{endpoints-zOuwci2U.js → endpoints-DJxXRh-I.js} +12 -12
  29. package/dist/{endpoints-zOuwci2U.js.map → endpoints-DJxXRh-I.js.map} +1 -1
  30. package/dist/forms.mjs +1 -1
  31. package/dist/index.mjs +140 -115
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/lib/callable-row-actions.d.ts +17 -0
  34. package/dist/lib/history-query.d.ts +22 -1
  35. package/dist/lib/index.d.ts +2 -0
  36. package/dist/lib/run-event-stream.d.ts +122 -0
  37. package/dist/lib/run-log-nodes.d.ts +43 -0
  38. package/dist/lib/tag-editor.d.ts +6 -0
  39. package/dist/lib/workflow-live-run.d.ts +7 -0
  40. package/dist/lib/workflow-validity.d.ts +7 -1
  41. package/dist/lib.mjs +52 -47
  42. package/dist/lists/CallableKindList.d.ts +12 -0
  43. package/dist/lists/CallableRowParts.d.ts +8 -1
  44. package/dist/lists/EndpointList.d.ts +3 -0
  45. package/dist/lists/FunctionList.d.ts +3 -0
  46. package/dist/lists/WorkflowList.d.ts +3 -0
  47. package/dist/lists.d.ts +1 -0
  48. package/dist/lists.mjs +1589 -1513
  49. package/dist/lists.mjs.map +1 -1
  50. package/dist/rail.mjs +1 -1
  51. package/dist/repos/callables.d.ts +25 -0
  52. package/dist/repos/documents.d.ts +9 -1
  53. package/dist/repos/history.d.ts +5 -1
  54. package/dist/repos/saved-file-names.d.ts +10 -0
  55. package/dist/repos/workflows.d.ts +19 -13
  56. package/dist/repos.mjs +338 -329
  57. package/dist/{setup-incomplete-BHs3Lpfy.js → setup-incomplete-6PAbN0EW.js} +50 -49
  58. package/dist/setup-incomplete-6PAbN0EW.js.map +1 -0
  59. package/dist/spec-import-BKyfhTYG.js +200 -0
  60. package/dist/spec-import-BKyfhTYG.js.map +1 -0
  61. package/dist/{use-callable-draft-w4tDTYcb.js → use-callable-draft-7HwfTuYQ.js} +3 -3
  62. package/dist/{use-callable-draft-w4tDTYcb.js.map → use-callable-draft-7HwfTuYQ.js.map} +1 -1
  63. package/package.json +3 -3
  64. package/src/styles.css +43 -0
  65. package/dist/ImportSpecModal-fU5RsVTa.js +0 -252
  66. package/dist/ImportSpecModal-fU5RsVTa.js.map +0 -1
  67. package/dist/WorkflowEditor-C7oudiIb.js +0 -1169
  68. package/dist/WorkflowEditor-C7oudiIb.js.map +0 -1
  69. package/dist/apps-FMcQfyL2.js +0 -92
  70. package/dist/apps-FMcQfyL2.js.map +0 -1
  71. package/dist/callable-record-Bhxim8C1.js +0 -14
  72. package/dist/callable-record-Bhxim8C1.js.map +0 -1
  73. package/dist/callables-B49tS2vv.js +0 -297
  74. package/dist/callables-B49tS2vv.js.map +0 -1
  75. package/dist/editor-apps-HEOclsxL.js +0 -152
  76. package/dist/editor-apps-HEOclsxL.js.map +0 -1
  77. package/dist/editor-tools-Dn7TgCP4.js.map +0 -1
  78. package/dist/setup-incomplete-BHs3Lpfy.js.map +0 -1
  79. package/dist/spec-import-CGPqUUjN.js +0 -272
  80. package/dist/spec-import-CGPqUUjN.js.map +0 -1
  81. package/dist/workflows-Dz8LMjnt.js +0 -626
  82. package/dist/workflows-Dz8LMjnt.js.map +0 -1
@@ -1,626 +0,0 @@
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";
4
- import { foldStateLog as C } from "@w6w/expr";
5
- function K(t) {
6
- return (t == null ? void 0 : t.nodes) ?? (t == null ? void 0 : t.steps) ?? void 0;
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);
11
- }
12
- function P(t, e) {
13
- return e || t === void 0 ? !1 : !I(t);
14
- }
15
- const mt = [0, 1500];
16
- function St(t, e, n) {
17
- return t !== void 0 && I(t) && e === n;
18
- }
19
- function kt(t, e) {
20
- return P(t, e) ? t === "queued" ? "Queued…" : "Running…" : "Run";
21
- }
22
- function qt(t) {
23
- return t === "run_not_cancelable" ? "reconcile" : "surface";
24
- }
25
- function Q(t, e) {
26
- if (!t) return [];
27
- const n = e ? U(e) : void 0;
28
- return Object.entries(t).map(([o, r]) => ({
29
- ...T(o, r),
30
- ...N(r),
31
- ...(n == null ? void 0 : n.get(o)) ?? {}
32
- }));
33
- }
34
- function U(t) {
35
- const e = [...t].sort((r, i) => r.seq - i.seq), n = /* @__PURE__ */ new Map();
36
- for (const r of e) {
37
- if (r.nodeId === null || r.nodeId === void 0) continue;
38
- const i = { path: r.path };
39
- r.item !== void 0 && (i.item = r.item), r.old !== void 0 && (i.old = r.old), r.new !== void 0 && (i.new = r.new), r.warning !== void 0 && (i.warning = r.warning);
40
- const a = n.get(r.nodeId) ?? { writes: [], lastSeq: r.seq };
41
- a.writes.push(i), a.lastSeq = r.seq, n.set(r.nodeId, a);
42
- }
43
- const o = /* @__PURE__ */ new Map();
44
- for (const [r, { writes: i, lastSeq: a }] of n)
45
- o.set(r, { stateWrites: i, stateAfter: C(e, a) });
46
- return o;
47
- }
48
- const W = /* @__PURE__ */ new Set([
49
- "not_on_path",
50
- "condition",
51
- "stopped",
52
- "disabled"
53
- ]);
54
- function T(t, e) {
55
- return {
56
- id: t,
57
- status: e.status,
58
- ...e.status === "skipped" && W.has(e.skipReason) ? { skipReason: e.skipReason } : {},
59
- startedAt: e.startedAt,
60
- finishedAt: e.finishedAt,
61
- input: e.input,
62
- output: e.output,
63
- ...Array.isArray(e.logs) && e.logs.length ? { logs: e.logs.filter((n) => typeof n == "string") } : {},
64
- ...e.meta !== void 0 && e.meta !== null ? { meta: e.meta } : {},
65
- ...D(e)
66
- };
67
- }
68
- const $ = /* @__PURE__ */ new Set(["succeeded", "failed", "running"]);
69
- function N(t) {
70
- if (!t || !Array.isArray(t.iterations)) return {};
71
- const e = t.iterations.filter((o) => o !== null && typeof o == "object").map((o) => {
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";
77
- return {
78
- index: o.index,
79
- status: c,
80
- ...a !== void 0 ? { failedNodeId: a } : {},
81
- steps: i
82
- };
83
- }).sort((o, r) => o.index - r.index), n = (o) => typeof o == "number" && Number.isFinite(o);
84
- return {
85
- iterations: e,
86
- ...n(t.iterationsTotal) ? { iterationsTotal: t.iterationsTotal } : {},
87
- ...n(t.iterationsFailed) ? { iterationsFailed: t.iterationsFailed } : {},
88
- ...typeof t.iterationsTruncated == "boolean" ? { iterationsTruncated: t.iterationsTruncated } : {}
89
- };
90
- }
91
- function D(t) {
92
- const e = b(t.error);
93
- return e ? { error: e } : t.status === "failed" ? { error: { message: v } } : {};
94
- }
95
- function b(t) {
96
- if (t != null) {
97
- if (typeof t == "string" && t !== "") return { message: t };
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);
100
- return {
101
- ...n !== void 0 ? { code: n } : {},
102
- message: o || "Unknown error.",
103
- ...typeof e.phase == "string" ? { phase: e.phase } : {},
104
- ...typeof e.retryable == "boolean" ? { retryable: e.retryable } : {}
105
- };
106
- }
107
- return { message: String(t) || "Unknown error." };
108
- }
109
- }
110
- function L(t) {
111
- try {
112
- return JSON.stringify(t) ?? "";
113
- } catch {
114
- return "";
115
- }
116
- }
117
- function vt(t, e) {
118
- if (!t) return {};
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;
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 }), {
127
- ...u ? { runError: u } : {},
128
- ...r.length > 0 ? { stepErrors: r } : {}
129
- };
130
- }
131
- function j(t) {
132
- var n;
133
- const e = (n = t == null ? void 0 : t[t.length - 1]) == null ? void 0 : n.with;
134
- if (!(e === null || typeof e != "object" || Array.isArray(e)))
135
- return e;
136
- }
137
- async function bt(t, e, n) {
138
- var o;
139
- if (t) {
140
- if (n)
141
- try {
142
- const r = (o = await n()) == null ? void 0 : o.find((i) => i.nodeId === t);
143
- if (r) {
144
- const i = r.input;
145
- return i === null || typeof i != "object" || Array.isArray(i) ? void 0 : Object.keys(i).length > 0 ? i : void 0;
146
- }
147
- } catch {
148
- }
149
- try {
150
- return j(await e(t));
151
- } catch {
152
- return;
153
- }
154
- }
155
- }
156
- function Rt(t, e, n) {
157
- const o = t.find((i) => {
158
- var a;
159
- return !!((a = i.uses) != null && a.app) && e(i.uses.app);
160
- });
161
- if (o) return { id: o.id, manual: !0 };
162
- const r = t.find(
163
- (i) => {
164
- var a;
165
- return !!((a = i.uses) != null && a.app) && n({ app: i.uses.app, ...i.uses.trigger === !0 ? { trigger: !0 } : {} });
166
- }
167
- );
168
- return r ? { id: r.id, manual: !1 } : void 0;
169
- }
170
- const x = /* @__PURE__ */ new Set(["succeeded", "failed", "canceled"]);
171
- function G(t) {
172
- return new Promise((e) => setTimeout(e, t));
173
- }
174
- async function F(t, e = G) {
175
- for (let n = 0; n < 600; n++) {
176
- const o = await t();
177
- if (x.has(o.status)) return o;
178
- await e(500);
179
- }
180
- return t();
181
- }
182
- const H = {
183
- status: "",
184
- kind: "",
185
- from: "",
186
- to: "",
187
- q: "",
188
- offset: 0
189
- }, _ = 25, Y = /* @__PURE__ */ new Set([
190
- "queued",
191
- "running",
192
- "succeeded",
193
- "failed",
194
- "canceled"
195
- ]), B = /* @__PURE__ */ new Set(["function", "endpoint", "workflow"]), J = /^\d{4}-\d{2}-\d{2}$/;
196
- 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);
199
- return r.getFullYear() === e && r.getMonth() === n - 1 && r.getDate() === o;
200
- }
201
- function R(t) {
202
- const [e, n, o] = t.split("-").map(Number);
203
- return { y: e, m: n, d: o };
204
- }
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);
211
- }
212
- return {
213
- status: Y.has(n) ? n : "",
214
- kind: B.has(o) ? o : "",
215
- from: m(r) ? r : "",
216
- to: m(i) ? i : "",
217
- q: a,
218
- offset: u
219
- };
220
- }
221
- function At(t) {
222
- 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));
224
- const n = e.toString();
225
- return n === "" ? "" : `?${n}`;
226
- }
227
- function O(t, e, n) {
228
- const o = {};
229
- 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);
231
- o.from = new Date(i, a - 1, c).toISOString();
232
- }
233
- if (e.to !== "" && m(e.to)) {
234
- const { y: i, m: a, d: c } = R(e.to);
235
- o.to = new Date(i, a - 1, c + 1).toISOString();
236
- }
237
- 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;
239
- }
240
- const E = {
241
- root: ["history"],
242
- list(t, e, n) {
243
- return ["history", "list", t, e, n];
244
- },
245
- stats(t, e) {
246
- return ["history", "stats", t, e];
247
- },
248
- exists(t) {
249
- return ["history", "exists", t];
250
- },
251
- detail(t, e) {
252
- return ["history", "detail", t, e];
253
- }
254
- };
255
- function V(t, e, n, o = _) {
256
- return t.request({
257
- method: "GET",
258
- path: "/history",
259
- query: O(e, n, { paged: !0, limit: o })
260
- }).then((r) => r.body);
261
- }
262
- function Et(t, e, n) {
263
- return t.request({
264
- method: "GET",
265
- path: "/history/stats",
266
- query: O(e, n, { paged: !1 })
267
- }).then((o) => o.body.stats);
268
- }
269
- async function z(t, e) {
270
- var a, c, u;
271
- const n = /* @__PURE__ */ new Map();
272
- let o;
273
- try {
274
- const { workflow: s } = await t.console.workflows.get(e);
275
- o = Array.isArray(s.nodes) ? s.nodes : [];
276
- } catch {
277
- return n;
278
- }
279
- 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 } : {} });
282
- }
283
- const r = [...new Set([...n.values()].map((s) => s.app))].filter(
284
- (s) => !s.startsWith("@w6w/")
285
- ), i = await Promise.all(
286
- r.map(async (s) => {
287
- const d = [...n.values()].some((p) => p.app === s && p.trigger), [f, k] = await Promise.all([
288
- 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 };
294
- })
295
- );
296
- 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}`);
301
- f && (s.actionName = f);
302
- }
303
- return n;
304
- }
305
- async function Tt(t, e) {
306
- if (e.kind === "workflow") {
307
- const [r, i] = await Promise.all([
308
- t.console.workflows.getRun(e.id),
309
- z(t, e.callableId)
310
- ]), a = r;
311
- return {
312
- id: e.id,
313
- kind: "workflow",
314
- callableName: e.callableName,
315
- status: r.status,
316
- startedAt: e.startedAt,
317
- finishedAt: e.finishedAt,
318
- durationMs: e.durationMs,
319
- input: a.input ?? a.event ?? r.variables,
320
- output: r.output,
321
- error: r.error,
322
- rerunOf: e.rerunOf ?? null,
323
- steps: Q(K(r)).map((c) => {
324
- const u = i.get(c.id);
325
- return u ? { ...c, node: u } : c;
326
- })
327
- };
328
- }
329
- const o = (await t.request({
330
- method: "GET",
331
- path: `/invocations/${encodeURIComponent(e.id)}`
332
- })).body.invocation;
333
- return {
334
- id: e.id,
335
- kind: e.kind,
336
- callableName: e.callableName,
337
- status: o.status,
338
- startedAt: o.startedAt,
339
- finishedAt: o.finishedAt,
340
- durationMs: o.durationMs,
341
- input: o.input,
342
- output: o.output,
343
- error: o.error,
344
- rerunOf: e.rerunOf ?? null
345
- };
346
- }
347
- function Z(t) {
348
- const e = t == null ? void 0 : t.raw, n = e == null ? void 0 : e.invocationId;
349
- return typeof n == "string" ? n : void 0;
350
- }
351
- function X(t) {
352
- return t !== null && typeof t == "object" && !Array.isArray(t) ? t : {};
353
- }
354
- async function tt(t, e, n) {
355
- const o = encodeURIComponent(e.callableId);
356
- if (e.kind === "workflow") {
357
- const u = (await t.request({
358
- method: "POST",
359
- path: `/runs/${encodeURIComponent(e.id)}/rerun`,
360
- body: { allowUnpublished: !0 }
361
- })).body.runId;
362
- return await F(() => t.console.workflows.getRun(u), n), u;
363
- }
364
- const r = await t.request({
365
- method: "GET",
366
- 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 };
368
- try {
369
- const u = (await t.request({
370
- method: "POST",
371
- path: `/${e.kind === "function" ? "functions" : "endpoints"}/${o}/invoke`,
372
- body: a
373
- })).body.invocationId;
374
- if (typeof u != "string") throw new Error("The server did not return an invocation id.");
375
- return u;
376
- } catch (c) {
377
- const u = Z(c);
378
- if (u === void 0) throw c;
379
- return u;
380
- }
381
- }
382
- async function Nt(t, e, n = {}) {
383
- const o = await tt(t, e, n.sleep);
384
- return et(t, e.callableId, o);
385
- }
386
- async function et(t, e, n) {
387
- return (await V(
388
- t,
389
- { callable: e },
390
- { ...H, q: n },
391
- 1
392
- )).executions.find((r) => r.id === n) ?? null;
393
- }
394
- const nt = (t) => ["workflows", t];
395
- function ot(t, e) {
396
- return t.workflows.list({ project: e });
397
- }
398
- function Ft(t, e = !0) {
399
- const n = l();
400
- return g({
401
- queryKey: nt(t),
402
- queryFn: () => ot(n, t),
403
- enabled: e
404
- });
405
- }
406
- const rt = (t) => ["workflow", t];
407
- function st(t, e) {
408
- return t.workflows.get(e);
409
- }
410
- function _t(t, e = !0) {
411
- const n = l();
412
- return g({
413
- queryKey: rt(t),
414
- queryFn: () => st(n, t),
415
- enabled: e
416
- });
417
- }
418
- function Ot(t) {
419
- const e = l(), n = y();
420
- return w({
421
- mutationFn: (o) => t ? e.console.workflows.upsert(o, { project: t }) : Promise.reject(new Error("No project selected yet.")),
422
- onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
423
- });
424
- }
425
- function Ct(t) {
426
- const e = l(), n = y();
427
- return w({
428
- mutationFn: (o) => t ? e.console.workflows.upsert(o.definition, {
429
- project: t,
430
- ifUnmodifiedSince: o.ifUnmodifiedSince
431
- }) : Promise.reject(new Error("No project selected yet.")),
432
- onSuccess: () => n.invalidateQueries({ queryKey: ["workflows"] })
433
- });
434
- }
435
- function Kt() {
436
- const t = l(), e = y();
437
- return w({
438
- mutationFn: (n) => t.workflows.archive(n),
439
- onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
440
- });
441
- }
442
- function Mt() {
443
- const t = l(), e = y();
444
- return w({
445
- mutationFn: (n) => t.workflows.delete(n),
446
- onSuccess: () => e.invalidateQueries({ queryKey: ["workflows"] })
447
- });
448
- }
449
- const S = (t) => ["runs", t];
450
- function Pt(t) {
451
- const e = l();
452
- return g({
453
- queryKey: S(t),
454
- queryFn: () => e.console.workflows.listRuns(t)
455
- });
456
- }
457
- function it(t, e, n, o) {
458
- return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => F(() => t.console.workflows.getRun(r.runId)));
459
- }
460
- function Qt() {
461
- const t = l(), e = y();
462
- return w({
463
- mutationFn: (n) => it(t, n.id, n.variables, n.input),
464
- onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
465
- onSettled: () => e.invalidateQueries({ queryKey: E.root })
466
- });
467
- }
468
- function Ut(t, e, n, o, r) {
469
- return t.workflows.run(e, { variables: n, input: o, entry: r, wait: !0 });
470
- }
471
- function at(t, e, n, o) {
472
- return t.workflows.run(e, { variables: n, input: o, allowUnpublished: !0 }).then((r) => ({ runId: r.runId }));
473
- }
474
- async function ut(t, e, n, o) {
475
- return { runId: (await t.request({
476
- method: "POST",
477
- path: h`/workflows/${e}/nodes/${n}/run`,
478
- body: {
479
- continue: !0,
480
- stopAt: o.stopAt,
481
- ...o.nodes ? { state: { nodes: o.nodes } } : {},
482
- ...o.input ? { input: o.input } : {}
483
- }
484
- })).body.runId };
485
- }
486
- function Wt(t, e) {
487
- return t.request({
488
- method: "GET",
489
- path: h`/workflows/${e}/node-samples`
490
- }).then((n) => n.body.nodeSamples ?? []);
491
- }
492
- function $t(t, e) {
493
- return t.request({
494
- method: "GET",
495
- path: h`/workflows/${e}/test-inputs`
496
- }).then((n) => n.body.testInputs ?? []);
497
- }
498
- function Dt(t, e, n, o) {
499
- return t.request({
500
- method: "PUT",
501
- path: h`/workflows/${e}/nodes/${n}/test-input`,
502
- body: { input: o }
503
- }).then(() => {
504
- });
505
- }
506
- function Lt() {
507
- const t = l(), e = y();
508
- return w({
509
- mutationFn: (n) => ut(t, n.id, n.nodeId, n.body),
510
- onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
511
- onSettled: () => e.invalidateQueries({ queryKey: E.root })
512
- });
513
- }
514
- function jt() {
515
- const t = l(), e = y();
516
- return w({
517
- mutationFn: (n) => at(t, n.id, n.variables, n.input),
518
- onSuccess: (n, o) => e.invalidateQueries({ queryKey: S(o.id) }),
519
- onSettled: () => e.invalidateQueries({ queryKey: E.root })
520
- });
521
- }
522
- function ct(t, e) {
523
- return t.workflows.cancel(e);
524
- }
525
- function xt() {
526
- const t = l();
527
- return w({
528
- mutationFn: (e) => ct(t, e)
529
- });
530
- }
531
- function dt(t, e) {
532
- return t.console.workflows.getRun(e);
533
- }
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),
540
- enabled: t != null,
541
- refetchInterval: (n) => {
542
- var o;
543
- return A((o = n.state.data) == null ? void 0 : o.status) ? 500 : !1;
544
- }
545
- });
546
- }
547
- function ft(t, e) {
548
- return t.request({
549
- method: "GET",
550
- path: h`/runs/${e}/state-writes`
551
- }).then((n) => ({ writes: n.body.writes ?? [], truncated: n.body.truncated === !0 }));
552
- }
553
- function pt(t, e) {
554
- return ["run", t, "state-writes", A(e) ? "live" : "final"];
555
- }
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),
561
- enabled: t != null,
562
- refetchInterval: o ? 500 : !1,
563
- retry: !1
564
- });
565
- }
566
- 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,
613
- E as o,
614
- O as p,
615
- 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
625
- };
626
- //# sourceMappingURL=workflows-Dz8LMjnt.js.map