@w6w/embed 0.1.1 → 0.2.1

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 (148) hide show
  1. package/README.md +231 -4
  2. package/dist/ConfirmModal-RLbZT5_k.js +181 -0
  3. package/dist/ConfirmModal-RLbZT5_k.js.map +1 -0
  4. package/dist/CreateFunctionModal-DRsFx-FB.js +221 -0
  5. package/dist/CreateFunctionModal-DRsFx-FB.js.map +1 -0
  6. package/dist/DocumentFormModal-BExK1V-B.js +89 -0
  7. package/dist/DocumentFormModal-BExK1V-B.js.map +1 -0
  8. package/dist/ImportSpecModal-BDQIf6rg.js +136 -0
  9. package/dist/ImportSpecModal-BDQIf6rg.js.map +1 -0
  10. package/dist/W6WEmbedProvider.d.ts +22 -4
  11. package/dist/WorkflowEditor-DlbVv6Fs.js +854 -0
  12. package/dist/WorkflowEditor-DlbVv6Fs.js.map +1 -0
  13. package/dist/api-calls--JHyif6a.js +107 -0
  14. package/dist/api-calls--JHyif6a.js.map +1 -0
  15. package/dist/apps-1FNUwbGv.js +77 -0
  16. package/dist/apps-1FNUwbGv.js.map +1 -0
  17. package/dist/callables-3mFrMVG_.js +151 -0
  18. package/dist/callables-3mFrMVG_.js.map +1 -0
  19. package/dist/chrome/index.d.ts +6 -0
  20. package/dist/chrome/workspace.d.ts +29 -1
  21. package/dist/coerce-input-BicYr7nc.js +139 -0
  22. package/dist/coerce-input-BicYr7nc.js.map +1 -0
  23. package/dist/connections-CjjYeRqb.js +78 -0
  24. package/dist/connections-CjjYeRqb.js.map +1 -0
  25. package/dist/document-sources-C0grrtdq.js +86 -0
  26. package/dist/document-sources-C0grrtdq.js.map +1 -0
  27. package/dist/draft/index.d.ts +3 -1
  28. package/dist/draft/use-callable-draft.d.ts +65 -0
  29. package/dist/draft/workflow-save.d.ts +3 -0
  30. package/dist/draft.mjs +9 -5
  31. package/dist/draft.mjs.map +1 -1
  32. package/dist/editor/CallableEditorFrame.d.ts +33 -0
  33. package/dist/editor/EditorShell.d.ts +16 -0
  34. package/dist/editor/EndpointCards.d.ts +56 -0
  35. package/dist/editor/EndpointEditor.d.ts +26 -0
  36. package/dist/editor/FunctionEditor.d.ts +21 -0
  37. package/dist/editor/InputListEditor.d.ts +29 -0
  38. package/dist/editor/TargetSelector.d.ts +30 -0
  39. package/dist/editor/TargetSelector.types.d.ts +62 -0
  40. package/dist/editor/editor-apps.d.ts +8 -2
  41. package/dist/editor/types.d.ts +57 -0
  42. package/dist/editor-apps-BdenSV1o.js +95 -0
  43. package/dist/editor-apps-BdenSV1o.js.map +1 -0
  44. package/dist/editor-tools-RxmY5iyi.js +1279 -0
  45. package/dist/editor-tools-RxmY5iyi.js.map +1 -0
  46. package/dist/editor.mjs +2 -2166
  47. package/dist/editor.mjs.map +1 -1
  48. package/dist/editors/DocumentEditor.d.ts +20 -0
  49. package/dist/editors/doc-format.d.ts +3 -0
  50. package/dist/editors.d.ts +12 -0
  51. package/dist/editors.mjs +1313 -0
  52. package/dist/editors.mjs.map +1 -0
  53. package/dist/embed-status.d.ts +20 -0
  54. package/dist/endpoints-B2ynbZo-.js +227 -0
  55. package/dist/endpoints-B2ynbZo-.js.map +1 -0
  56. package/dist/forms/CreateEndpointModal.d.ts +54 -0
  57. package/dist/forms/CreateFunctionModal.d.ts +55 -0
  58. package/dist/forms/DocumentFormModal.d.ts +8 -0
  59. package/dist/forms/SecretsManager.d.ts +12 -0
  60. package/dist/forms/VarsManager.d.ts +29 -0
  61. package/dist/forms.d.ts +6 -0
  62. package/dist/forms.mjs +407 -0
  63. package/dist/forms.mjs.map +1 -0
  64. package/dist/index.d.ts +3 -1
  65. package/dist/index.mjs +153 -50
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/lib/callable-record.d.ts +21 -0
  68. package/dist/lib/coerce-input.d.ts +6 -0
  69. package/dist/lib/endpoint-editor.d.ts +23 -0
  70. package/dist/lib/index.d.ts +7 -0
  71. package/dist/lib/input-coverage.d.ts +28 -0
  72. package/dist/lib/input-seeding.d.ts +67 -0
  73. package/dist/lib/rail-settings.d.ts +3 -3
  74. package/dist/lib/recent-activity.d.ts +128 -0
  75. package/dist/lib/target-fields.d.ts +168 -0
  76. package/dist/lib/workflow-blank.d.ts +2 -0
  77. package/dist/lib.mjs +70 -48
  78. package/dist/lib.mjs.map +1 -1
  79. package/dist/lists/ActivitySummary.d.ts +29 -0
  80. package/dist/lists/CallableKindList.d.ts +34 -0
  81. package/dist/lists/ConnectionDetail.d.ts +17 -0
  82. package/dist/lists/ConnectionList.d.ts +16 -0
  83. package/dist/lists/DocumentList.d.ts +29 -0
  84. package/dist/lists/EndpointList.d.ts +19 -0
  85. package/dist/lists/FunctionList.d.ts +18 -0
  86. package/dist/lists/ReliabilityBoard.d.ts +23 -0
  87. package/dist/lists/RunHistory.d.ts +11 -0
  88. package/dist/lists/ServiceDetail.d.ts +20 -0
  89. package/dist/lists/WorkflowList.d.ts +19 -0
  90. package/dist/lists/vendor-history.d.ts +40 -0
  91. package/dist/lists.d.ts +20 -0
  92. package/dist/lists.mjs +1185 -0
  93. package/dist/lists.mjs.map +1 -0
  94. package/dist/project-context-BiCjv_E3.js +25 -0
  95. package/dist/project-context-BiCjv_E3.js.map +1 -0
  96. package/dist/project-context.d.ts +15 -1
  97. package/dist/rail/CallableRail.d.ts +12 -0
  98. package/dist/rail/CallableWorkspace.d.ts +16 -0
  99. package/dist/rail/SettingsTool.d.ts +7 -1
  100. package/dist/rail/settings-sections.d.ts +2 -2
  101. package/dist/rail-settings-XYGToh00.js +111 -0
  102. package/dist/rail-settings-XYGToh00.js.map +1 -0
  103. package/dist/rail.d.ts +11 -0
  104. package/dist/rail.mjs +35 -0
  105. package/dist/rail.mjs.map +1 -0
  106. package/dist/repos/api-calls.d.ts +4 -0
  107. package/dist/repos/apps.d.ts +14 -0
  108. package/dist/repos/callables.d.ts +91 -0
  109. package/dist/repos/connections.d.ts +33 -0
  110. package/dist/repos/dashboard.d.ts +4 -0
  111. package/dist/repos/endpoints.d.ts +125 -0
  112. package/dist/repos/functions.d.ts +79 -0
  113. package/dist/repos/index.d.ts +10 -0
  114. package/dist/repos/reliability.d.ts +42 -0
  115. package/dist/repos/saved-tests.d.ts +46 -0
  116. package/dist/repos/spec-export.d.ts +23 -0
  117. package/dist/repos/workflows.d.ts +138 -0
  118. package/dist/repos.mjs +174 -88
  119. package/dist/repos.mjs.map +1 -1
  120. package/dist/settings-rail--GdRMusb.js +33 -0
  121. package/dist/settings-rail--GdRMusb.js.map +1 -0
  122. package/dist/slug-C4ktDPdy.js +315 -0
  123. package/dist/slug-C4ktDPdy.js.map +1 -0
  124. package/dist/spec-export-Cf3VQSQS.js +176 -0
  125. package/dist/spec-export-Cf3VQSQS.js.map +1 -0
  126. package/dist/spec-import-CjmxyZDR.js +465 -0
  127. package/dist/spec-import-CjmxyZDR.js.map +1 -0
  128. package/dist/step-tests-CivICmTq.js +18 -0
  129. package/dist/step-tests-CivICmTq.js.map +1 -0
  130. package/dist/trigger-preview-VPkrryDl.js +120 -0
  131. package/dist/trigger-preview-VPkrryDl.js.map +1 -0
  132. package/dist/use-callable-draft-zHLpcr-b.js +271 -0
  133. package/dist/use-callable-draft-zHLpcr-b.js.map +1 -0
  134. package/dist/{use-workflow-draft-oI02dsP-.js → use-workflow-draft-DzAyUeA6.js} +48 -46
  135. package/dist/use-workflow-draft-DzAyUeA6.js.map +1 -0
  136. package/dist/vault-BSEWhMYC.js +117 -0
  137. package/dist/vault-BSEWhMYC.js.map +1 -0
  138. package/dist/workflow-blank-DyL3_RUA.js +14 -0
  139. package/dist/workflow-blank-DyL3_RUA.js.map +1 -0
  140. package/package.json +21 -5
  141. package/src/styles.css +408 -1
  142. package/dist/project-context-Dbk0Gr1K.js +0 -16
  143. package/dist/project-context-Dbk0Gr1K.js.map +0 -1
  144. package/dist/slug-ByKQgxrf.js +0 -642
  145. package/dist/slug-ByKQgxrf.js.map +0 -1
  146. package/dist/spec-import-HgO7ZkLZ.js +0 -898
  147. package/dist/spec-import-HgO7ZkLZ.js.map +0 -1
  148. package/dist/use-workflow-draft-oI02dsP-.js.map +0 -1
@@ -0,0 +1,138 @@
1
+ import { UseMutationResult } from '@tanstack/react-query';
2
+ import { W6WClient, WorkflowRunResult } from '@w6w/sdk';
3
+ import { RunState } from '@w6w/sdk/console';
4
+ export type { RunState, RunSummary } from '@w6w/sdk/console';
5
+ export type { WorkflowStatus, WorkflowSummary } from '@w6w/sdk';
6
+ export declare const workflowsKey: (project?: string) => readonly ["workflows", string | undefined];
7
+ export declare function listWorkflows(client: W6WClient, project?: string): Promise<import('@w6w/sdk').WorkflowSummary[]>;
8
+ export declare function useWorkflowsQuery(project?: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<import('@w6w/sdk').WorkflowSummary[]>, Error>;
9
+ export declare const workflowKey: (id: string) => readonly ["workflow", string];
10
+ export declare function getWorkflow(client: W6WClient, id: string): Promise<import('@w6w/sdk').WorkflowDetail>;
11
+ export declare function useWorkflowQuery(id: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<import('@w6w/sdk').WorkflowDetail>, Error>;
12
+ /**
13
+ * A missing `project` here is not "unscoped" the way a read can legitimately
14
+ * be — the write would silently land in the account's default project
15
+ * instead of the one the caller is looking at. Both mutations refuse rather
16
+ * than risk that; `WorkflowsPage.tsx`'s own `projectId != null` gate on
17
+ * `useWorkflowsQuery` should mean `project` is always set by the time either
18
+ * of these can actually be invoked from the UI, but the guard costs nothing.
19
+ */
20
+ export declare function useCreateWorkflowMutation(project?: string): UseMutationResult<{
21
+ workflow: {
22
+ id: string;
23
+ name: string;
24
+ key: string | null;
25
+ };
26
+ scheduled: boolean;
27
+ updatedAt: string;
28
+ }, Error, unknown, unknown>;
29
+ export declare function useSaveWorkflowMutation(project?: string): UseMutationResult<{
30
+ workflow: {
31
+ id: string;
32
+ name: string;
33
+ key: string | null;
34
+ };
35
+ scheduled: boolean;
36
+ updatedAt: string;
37
+ }, Error, {
38
+ definition: unknown;
39
+ ifUnmodifiedSince: string | null;
40
+ }, unknown>;
41
+ export declare function useArchiveWorkflowMutation(): UseMutationResult<import('@w6w/sdk').WorkflowDefinition, Error, string, unknown>;
42
+ export declare function useDeleteWorkflowMutation(): UseMutationResult<void, Error, string, unknown>;
43
+ export declare const runsKey: (workflowId: string) => readonly ["runs", string];
44
+ export declare function useRunsQuery(workflowId: string): import('@tanstack/react-query').UseQueryResult<NoInfer<import('@w6w/sdk/console').RunSummary[]>, Error>;
45
+ /**
46
+ * Start a run and poll it to a terminal state.
47
+ *
48
+ * `input` is the run's START PAYLOAD, and it is a different thing from
49
+ * `variables`: the server hands it to the entry `@w6w/trigger` node as that
50
+ * node's own output, which is what makes `{{ steps.<trigger>.output.<field> }}`
51
+ * resolve in a real run. Omitted, that node outputs `{}` and every reference to
52
+ * a trigger field resolves to the empty string — the failure mode filed as
53
+ * `.ai/projects/backlog/26-07-29-01-trigger-run-payload.md`, where a step tests
54
+ * green and then does nothing in production. `variables` seeds `vars.*` and
55
+ * reaches the trigger node not at all.
56
+ *
57
+ * Goes through the typed `client.workflows.run()` with
58
+ * `allowUnpublished: true`: this call site always runs the STORED draft, and
59
+ * the server exempts a caller that sets the flag from the publish gate
60
+ * (`packages/api/run-workflow.ts`'s `enqueueRun`). The SDK's result is the flat
61
+ * run body, so the `runId` used to poll comes off `res.runId`.
62
+ */
63
+ export declare function runWorkflow(client: W6WClient, id: string, variables: Record<string, unknown>, input?: Record<string, unknown>): Promise<RunState>;
64
+ export declare function useRunWorkflowMutation(): UseMutationResult<RunState, Error, {
65
+ id: string;
66
+ variables: Record<string, unknown>;
67
+ input?: Record<string, unknown>;
68
+ }, unknown>;
69
+ /**
70
+ * Run a Workflow SYNCHRONOUSLY — the `W6WApi.runWorkflow` facade member's
71
+ * backing function (the Workflows tab's Test stage, D-11/D-15(c)). A sibling
72
+ * of {@link runWorkflow}, NOT a replacement: that function's enqueue-then-poll
73
+ * shape is the studio-wide "Run this workflow" action and stays exactly as it
74
+ * is. This one instead sends `wait: true` on the SAME base `client.workflows
75
+ * .run` call already published (`?wait=true` — the server polls internally,
76
+ * up to its own timeout) — zero new server code, and no second poll loop:
77
+ * there is no `pollRunToTerminal` here at all. `terminal`/`httpStatus` on the
78
+ * result distinguish "finished in time" (`200`) from "still going when the
79
+ * server's own wait timed out" (`202`, a legitimate outcome, not an error).
80
+ */
81
+ export declare function runWorkflowSync(client: W6WClient, id: string, variables: Record<string, unknown>, input?: Record<string, unknown>): Promise<WorkflowRunResult>;
82
+ /**
83
+ * T2.1.1 — the ENQUEUE half only: starts a run and returns its handle
84
+ * immediately, without polling it to terminal. A genuine sibling of
85
+ * {@link runWorkflow}, NOT a replacement — that function's "enqueue, then
86
+ * block to a terminal result" shape is what `WorkflowDetailPage.tsx`'s "Run
87
+ * now" panel is built on and stays exactly as it is. This one is for a host
88
+ * that wants the `runId` right away so it can poll it live itself (the
89
+ * visual editor's canvas + execution log panel) — see {@link useLiveRunQuery}.
90
+ *
91
+ * Like {@link runWorkflow}, this calls `client.workflows.run()` with
92
+ * `allowUnpublished: true` unconditionally. Only `{ runId }` is returned, so
93
+ * callers keep reading `runId` off the resolved value exactly as before.
94
+ */
95
+ export declare function startWorkflowRun(client: W6WClient, id: string, variables: Record<string, unknown>, input?: Record<string, unknown>): Promise<{
96
+ runId: string;
97
+ }>;
98
+ export declare function useStartRunMutation(): UseMutationResult<{
99
+ runId: string;
100
+ }, Error, {
101
+ id: string;
102
+ variables: Record<string, unknown>;
103
+ input?: Record<string, unknown>;
104
+ }, unknown>;
105
+ /** What `client.workflows.cancel` resolves to. Named here because the SDK's root entry does not
106
+ * export its `WorkflowCancelResult`: an inferred return type would name it and `vite-plugin-dts`
107
+ * would skip this whole file (TS2742), leaving every `./repos` declaration out of the tarball. */
108
+ export type WorkflowCancelResult = Awaited<ReturnType<W6WClient["workflows"]["cancel"]>>;
109
+ /**
110
+ * T2.1.1/A6 — cancel a queued or running run. `client.workflows.cancel`
111
+ * itself never claims the run has stopped (its own doc comment: a `202`
112
+ * means the request was RECORDED, not that the run finished) — the caller
113
+ * keeps polling {@link useLiveRunQuery} until the run actually reaches a
114
+ * terminal status. See `../lib/workflow-live-run.ts`'s `classifyCancelError`
115
+ * for how a `409 run_not_cancelable` (the run beat the cancel to the finish
116
+ * line) is told apart from a real failure.
117
+ */
118
+ export declare function cancelWorkflowRun(client: W6WClient, runId: string): Promise<WorkflowCancelResult>;
119
+ export declare function useCancelRunMutation(): UseMutationResult<WorkflowCancelResult, Error, string>;
120
+ /** The single-shot half of {@link useLiveRunQuery} — a thin, directly
121
+ * testable wrapper around `client.console.workflows.getRun`, so the polling
122
+ * config below can be pinned without needing to render a hook. */
123
+ export declare function getRunState(client: W6WClient, runId: string): Promise<RunState>;
124
+ /** Query key for one run's live state — distinct from {@link runsKey}, which
125
+ * is the workflow's run LIST. */
126
+ export declare const runStateKey: (runId: string) => readonly ["run", string];
127
+ /**
128
+ * T2.1.1/A2/A3 — poll one run's live state at a fixed 500ms interval,
129
+ * stopping once it reaches a terminal status ({@link shouldContinuePolling},
130
+ * `../lib/workflow-live-run.ts`). A genuine sibling of `pollRunToTerminal`
131
+ * (`../lib/workflow-poll.ts`) using the SAME underlying SDK call
132
+ * (`client.console.workflows.getRun`), but publishing every intermediate
133
+ * `RunState` to its caller via TanStack Query's own `data` — unlike
134
+ * `pollRunToTerminal`, which discards every non-terminal result and hands
135
+ * back only the last one. `runId === null` disables the query entirely (no
136
+ * run started yet, or the page navigated to a different workflow).
137
+ */
138
+ export declare function useLiveRunQuery(runId: string | null): import('@tanstack/react-query').UseQueryResult<NoInfer<RunState>, Error>;
package/dist/repos.mjs CHANGED
@@ -1,94 +1,180 @@
1
1
  "use client";
2
- import { C as s, E as t, H as u, I as o, R as r, S as n, c as i, a as l, b as y, d as c, e as S, f as M, g as R, h as f, i as w, j as E, k as d, l as k, m as p, n as D, o as m, p as v, q as I, r as Q, s as T, t as K, u as W, v as L, w as _, x as C, y as g, z as A, A as h, B as H, D as P, F as b, G as F, J as O, K as V, L as x, M as N, N as U, O as B, P as Y, Q as q, T as j, U as G, V as Z, W as z, X as J, Y as X, Z as $, _ as aa, $ as ea, a0 as sa, a1 as ta, a2 as ua, a3 as oa, a4 as ra, a5 as na, a6 as ia, a7 as la, a8 as ya, a9 as ca, aa as Sa, ab as Ma, ac as Ra, ad as fa, ae as wa, af as Ea, ag as da, ah as ka, ai as pa, aj as Da, ak as ma, al as va, am as Ia, an as Qa, ao as Ta, ap as Ka, aq as Wa, ar as La, as as _a, at as Ca, au as ga, av as Aa, aw as ha, ax as Ha, ay as Pa } from "./spec-import-HgO7ZkLZ.js";
2
+ import { E as a, H as t, R as u, S as o, c as n, a as r, d as i, b as l, e as c, f as y, g as p, h as S, i as d, j as M, k as f, l as v, m as C, n as E, o as R, p as Q, q as b, r as T, s as A, t as m, u as K, v as F, w as I, x as k, y as D, z as g, A as h, B as w, C as _, D as x, F as L, G as N, I as W, J as O, K as P, L as H, M as V, N as U, O as j, P as B, Q as G, T as Y, U as q, V as z, W as Z, X as J, Y as X, Z as $, _ as ee } from "./spec-import-CjmxyZDR.js";
3
+ import { u as ae, a as te, b as ue, c as oe, d as ne, e as re, f as ie, v as le, g as ce } from "./spec-export-Cf3VQSQS.js";
4
+ import { l as pe, r as Se, s as de, a as Me } from "./step-tests-CivICmTq.js";
5
+ import { a as ve, b as Ce, g as Ee, c as Re, u as Qe, d as be, e as Te, f as Ae, h as me, i as Ke } from "./apps-1FNUwbGv.js";
6
+ import { l as Ie, s as ke, a as De, u as ge, b as he, c as we, d as _e, e as xe, f as Le, g as Ne, h as We, i as Oe, v as Pe } from "./vault-BSEWhMYC.js";
7
+ import { a as Ve, c as Ue, b as je, d as Be, e as Ge, f as Ye, g as qe, h as ze, i as Ze, j as Je, l as Xe, s as $e, u as es, k as ss, m as as, n as ts, o as us } from "./callables-3mFrMVG_.js";
8
+ import { C as ns, E as rs, F as is, I as ls, d as cs, e as ys, a as ps, f as Ss, b as ds, g as Ms, c as fs, i as vs, h as Cs, j as Es, l as Rs, n as Qs, k as bs, u as Ts, m as As, o as ms, p as Ks, q as Fs, r as Is, s as ks, t as Ds, v as gs, w as hs, x as ws, y as _s, z as xs, A as Ls } from "./endpoints-B2ynbZo-.js";
9
+ import { c as Ws, a as Os, b as Ps, d as Hs, g as Vs, l as Us, e as js, u as Bs, f as Gs, h as Ys, i as qs, j as zs, k as Zs, m as Js } from "./connections-CjjYeRqb.js";
10
+ import { c as $s, d as ea, l as sa, a as aa, r as ta, s as ua, t as oa, u as na, b as ra, e as ia, f as la, g as ca, h as ya, i as pa } from "./api-calls--JHyif6a.js";
11
+ import { SECRET_MASK as da } from "@w6w/sdk/console";
3
12
  export {
4
- s as CALLABLE_DESCRIPTORS,
5
- t as EMPTY_HISTORY_FILTERS,
6
- u as HISTORY_PAGE_SIZE,
7
- o as ID_ALPHABET,
8
- r as RUN_FAILED_NO_REASON,
9
- n as STEP_FAILED_NO_REASON,
10
- i as callableKey,
11
- l as cancelWorkflowRun,
12
- y as classifyCancelError,
13
- c as descriptorFor,
14
- S as documentKey,
15
- M as documentProvenanceState,
16
- R as documentsKey,
17
- f as filtersFromSearch,
18
- w as filtersToSearch,
19
- E as getExecutionDetail,
13
+ ns as CALLABLE_DESCRIPTORS,
14
+ a as EMPTY_HISTORY_FILTERS,
15
+ rs as ENDPOINT_MANIFEST_VERSION,
16
+ is as FUNCTION_MANIFEST_VERSION,
17
+ t as HISTORY_PAGE_SIZE,
18
+ ls as ID_ALPHABET,
19
+ u as RUN_FAILED_NO_REASON,
20
+ da as SECRET_MASK,
21
+ o as STEP_FAILED_NO_REASON,
22
+ ve as appActionsKey,
23
+ Ce as appKey,
24
+ Ve as archiveCallable,
25
+ Ue as callableCollection,
26
+ je as callableHistoryRoute,
27
+ Be as callableKey,
28
+ Ge as callableListKey,
29
+ Ye as callablePath,
30
+ qe as callableRoute,
31
+ n as cancelWorkflowRun,
32
+ r as classifyCancelError,
33
+ Ws as connectionKey,
34
+ Os as connectionsForAppKey,
35
+ Ps as connectionsKey,
36
+ Hs as createConnection,
37
+ $s as createSavedTest,
38
+ ze as deleteCallable,
39
+ ea as deleteSavedTest,
40
+ cs as descriptorFor,
41
+ i as documentKey,
42
+ l as documentProvenanceState,
43
+ c as documentsKey,
44
+ ys as endpointKey,
45
+ ps as endpointsKey,
46
+ y as filtersFromSearch,
47
+ p as filtersToSearch,
48
+ Ss as functionKey,
49
+ ds as functionsKey,
50
+ Ee as getApp,
51
+ Re as getAppActions,
52
+ Ze as getCallable,
53
+ Vs as getConnection,
54
+ Ms as getEndpoint,
55
+ S as getExecutionDetail,
56
+ fs as getFunction,
20
57
  d as getHistory,
21
- k as getHistoryStats,
22
- p as getRunState,
23
- D as getWorkflow,
24
- m as historyKeys,
25
- v as historyRequestQuery,
26
- I as invalidateSavedCallable,
27
- Q as isRunInFlight,
28
- T as latestFixtureInput,
29
- K as listSecrets,
30
- W as listStepTests,
31
- L as listWorkflows,
32
- _ as mapRunStateToLogSteps,
33
- C as newCallableId,
34
- g as newId,
58
+ M as getHistoryStats,
59
+ f as getRunState,
60
+ v as getWorkflow,
61
+ C as historyKeys,
62
+ E as historyRequestQuery,
63
+ Je as invalidateSavedCallable,
64
+ vs as invokeEndpoint,
65
+ Cs as invokeFunction,
66
+ Es as isEndpointDraft,
67
+ R as isRunInFlight,
68
+ Q as latestFixtureInput,
69
+ Xe as listCallables,
70
+ Us as listConnections,
71
+ js as listConnectionsForApp,
72
+ Rs as listFunctions,
73
+ sa as listSavedTests,
74
+ Ie as listSecrets,
75
+ pe as listStepTests,
76
+ aa as listTestRuns,
77
+ b as listWorkflows,
78
+ T as mapRunStateToLogSteps,
79
+ Qs as newCallableId,
80
+ bs as newId,
35
81
  A as pollRunToTerminal,
36
- h as recordStepTestRun,
37
- H as resolveHeaderRunInput,
38
- P as runButtonLabel,
39
- b as runLevelErrors,
40
- F as runStateKey,
41
- O as runWorkflow,
42
- V as runWorkflowSync,
43
- x as runsKey,
44
- N as saveStepTest,
45
- U as sealSecret,
46
- B as secretsKey,
47
- Y as shouldContinuePolling,
48
- q as startWorkflowRun,
49
- j as stepTestsKey,
50
- G as toLogError,
51
- Z as useArchiveWorkflowMutation,
52
- z as useCancelRunMutation,
53
- J as useCreateDocumentMutation,
54
- X as useCreateSecretMutation,
55
- $ as useCreateVarMutation,
56
- aa as useCreateWorkflowMutation,
57
- ea as useDeleteDocumentMutation,
58
- sa as useDeleteSecretMutation,
59
- ta as useDeleteVarMutation,
60
- ua as useDeleteWorkflowMutation,
61
- oa as useDocumentQuery,
62
- ra as useDocumentsQuery,
63
- na as useExecutionDetailQuery,
64
- ia as useHasExecutedQuery,
65
- la as useHistoryQuery,
66
- ya as useHistoryStatsQuery,
67
- ca as useImportSpecMutation,
68
- Sa as useInvokeVersionMutation,
69
- Ma as useLiveRunQuery,
70
- Ra as usePublishMutation,
71
- fa as useRevertMutation,
72
- wa as useRunWorkflowMutation,
73
- Ea as useRunsQuery,
74
- da as useSaveWorkflowMutation,
75
- ka as useSealSecret,
76
- pa as useSecretsQuery,
77
- Da as useSetEnabledMutation,
78
- ma as useStartRunMutation,
79
- va as useSyncDocumentMutation,
80
- Ia as useUpdateDocumentMutation,
81
- Qa as useUpdateSecretMutation,
82
- Ta as useUpdateVarMutation,
83
- Ka as useVarsQuery,
84
- Wa as useVersionQuery,
85
- La as useVersionsQuery,
86
- _a as useWorkflowQuery,
87
- Ca as useWorkflowsQuery,
88
- ga as varsKey,
89
- Aa as versionKey,
90
- ha as versionsKey,
91
- Ha as workflowKey,
92
- Pa as workflowsKey
82
+ Se as recordStepTestRun,
83
+ ta as recordTestRun,
84
+ m as resolveHeaderRunInput,
85
+ K as runButtonLabel,
86
+ F as runLevelErrors,
87
+ I as runStateKey,
88
+ k as runWorkflow,
89
+ D as runWorkflowSync,
90
+ g as runsKey,
91
+ $e as saveCallable,
92
+ de as saveStepTest,
93
+ ua as savedTestsKey,
94
+ ke as sealSecret,
95
+ De as secretsKey,
96
+ h as shouldContinuePolling,
97
+ w as startWorkflowRun,
98
+ Me as stepTestsKey,
99
+ oa as testRunsKey,
100
+ _ as toLogError,
101
+ Bs as updateConnection,
102
+ na as updateSavedTest,
103
+ ra as useApiCallsQuery,
104
+ Qe as useAppActionsQuery,
105
+ be as useAppQuery,
106
+ es as useArchiveCallableMutation,
107
+ Ts as useArchiveEndpointMutation,
108
+ As as useArchiveFunctionMutation,
109
+ x as useArchiveWorkflowMutation,
110
+ ss as useCallableListQuery,
111
+ as as useCallableQuery,
112
+ L as useCancelRunMutation,
113
+ Gs as useConnectionQuery,
114
+ Ys as useConnectionsForAppQuery,
115
+ qs as useConnectionsQuery,
116
+ N as useCreateDocumentMutation,
117
+ ge as useCreateSecretMutation,
118
+ he as useCreateVarMutation,
119
+ W as useCreateWorkflowMutation,
120
+ ia as useDashboardStatsQuery,
121
+ ts as useDeleteCallableMutation,
122
+ zs as useDeleteConnectionMutation,
123
+ O as useDeleteDocumentMutation,
124
+ ms as useDeleteEndpointMutation,
125
+ Ks as useDeleteFunctionMutation,
126
+ we as useDeleteSecretMutation,
127
+ _e as useDeleteVarMutation,
128
+ P as useDeleteWorkflowMutation,
129
+ H as useDocumentQuery,
130
+ V as useDocumentsQuery,
131
+ Fs as useEndpointQuery,
132
+ Is as useEndpointsQuery,
133
+ Te as useExecutionDetailQuery,
134
+ ks as useFunctionQuery,
135
+ Ds as useFunctionsQuery,
136
+ gs as useGuardedSaveEndpointMutation,
137
+ hs as useGuardedSaveFunctionMutation,
138
+ Ae as useHasExecutedQuery,
139
+ me as useHistoryQuery,
140
+ Ke as useHistoryStatsQuery,
141
+ U as useImportSpecMutation,
142
+ ws as useInvokeEndpointMutation,
143
+ _s as useInvokeFunctionMutation,
144
+ ae as useInvokeVersionMutation,
145
+ j as useLiveRunQuery,
146
+ la as useProjectReliabilityQuery,
147
+ te as usePublishMutation,
148
+ ca as useReliabilityQuery,
149
+ ue as useRevertMutation,
150
+ B as useRunWorkflowMutation,
151
+ G as useRunsQuery,
152
+ us as useSaveCallableMutation,
153
+ xs as useSaveEndpointMutation,
154
+ Ls as useSaveFunctionMutation,
155
+ Y as useSaveWorkflowMutation,
156
+ ya as useSavedTestsQuery,
157
+ xe as useSealSecret,
158
+ Le as useSecretsQuery,
159
+ oe as useSetEnabledMutation,
160
+ ne as useSpecQuery,
161
+ q as useStartRunMutation,
162
+ z as useSyncDocumentMutation,
163
+ Zs as useTestConnectionMutation,
164
+ pa as useTestRunsQuery,
165
+ Js as useUpdateConnectionMutation,
166
+ Z as useUpdateDocumentMutation,
167
+ Ne as useUpdateSecretMutation,
168
+ We as useUpdateVarMutation,
169
+ Oe as useVarsQuery,
170
+ re as useVersionQuery,
171
+ ie as useVersionsQuery,
172
+ J as useWorkflowQuery,
173
+ X as useWorkflowsQuery,
174
+ Pe as varsKey,
175
+ le as versionKey,
176
+ ce as versionsKey,
177
+ $ as workflowKey,
178
+ ee as workflowsKey
93
179
  };
94
180
  //# sourceMappingURL=repos.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"repos.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"repos.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -0,0 +1,33 @@
1
+ function l(r, n) {
2
+ if (typeof n != "object" || n === null || Array.isArray(n)) return null;
3
+ const t = n, e = typeof t.updatedAt == "string" ? t.updatedAt : null;
4
+ if (r === "function") {
5
+ const { valid: i, updatedAt: f, ...u } = t;
6
+ return { definition: u, updatedAt: e };
7
+ }
8
+ const o = t.endpoint;
9
+ return typeof o != "object" || o === null || Array.isArray(o) ? null : { definition: o, updatedAt: e };
10
+ }
11
+ function a(r) {
12
+ return r ? r.kind === "function" || r.kind === "endpoint" ? !0 : r.kind === "workflow" && typeof r.onPolicyChange == "function" : !1;
13
+ }
14
+ function s(r) {
15
+ const n = {};
16
+ return r.retry && (n.retry = r.retry), r.onError && r.onError !== "fail" && (n.onError = r.onError), r.reroute && (n.reroute = r.reroute), n;
17
+ }
18
+ function d(r, n) {
19
+ const { retry: t, onError: e, reroute: o, ...i } = r;
20
+ return {
21
+ ...i,
22
+ ...n.retry ? { retry: n.retry } : {},
23
+ ...n.onError && n.onError !== "fail" ? { onError: n.onError } : {},
24
+ ...n.reroute ? { reroute: n.reroute } : {}
25
+ };
26
+ }
27
+ export {
28
+ l as c,
29
+ d,
30
+ a as i,
31
+ s as p
32
+ };
33
+ //# sourceMappingURL=settings-rail--GdRMusb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-rail--GdRMusb.js","sources":["../src/lib/callable-record.ts","../src/lib/settings-rail.ts"],"sourcesContent":["/**\n * The ONE split of a Function's / Endpoint's `get` response into the editable definition and the\n * stale-write token. `useCallableDraft` (seed, external-change detection, the posted body) and the\n * rail's write paths (B-4) both read through it, so \"what do we post, and which `updatedAt` do we\n * guard it with\" has one answer.\n *\n * - **function** — the `console.functions.get` result is `FunctionDef & {valid, updatedAt}` with the\n * top-level values spread LAST. The definition is that object minus `valid` and `updatedAt`\n * (both read-only splices that must never ride back in a save body); the token is its top-level\n * `updatedAt`, so a stale `updatedAt` stored INSIDE a definition never wins.\n * - **endpoint** — the response is the verbatim envelope `{endpoint, invokeUrl, …, updatedAt}`.\n * The definition is `data.endpoint` as-is; the token is the TOP-LEVEL `data.updatedAt`, never\n * `data.endpoint.updatedAt`.\n *\n * `null` when `data` is absent or is not the shape the kind answers with. Pure, no imports:\n * loadable by `node --test`.\n */\nexport function callableRecord(\n kind: \"function\" | \"endpoint\",\n data: unknown,\n): { definition: Record<string, unknown>; updatedAt: string | null } | null {\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) return null;\n const top = data as Record<string, unknown>;\n const updatedAt = typeof top.updatedAt === \"string\" ? top.updatedAt : null;\n if (kind === \"function\") {\n const { valid: _valid, updatedAt: _updatedAt, ...definition } = top;\n return { definition, updatedAt };\n }\n const endpoint = top.endpoint;\n if (typeof endpoint !== \"object\" || endpoint === null || Array.isArray(endpoint)) return null;\n return { definition: endpoint as Record<string, unknown>, updatedAt };\n}\n","/**\n * Pure decisions behind the right rail's Error handling tool\n * (`src/ui/rail/SettingsTool.tsx`, D-10) — the third `railTools` entry,\n * rendering `@w6w/ui`'s `NodeConfigForm` for a Function or an Endpoint and\n * persisting `retry` / `onError` / `reroute` onto that resource's own\n * definition. Split out so `node --test` can gate them directly — mirrors\n * `code-rail.ts`'s own reason for existing: `node --test` throws\n * `ERR_UNKNOWN_FILE_EXTENSION` on any `@w6w/ui`-adjacent import, and\n * `src/ui/workspace.tsx` sits one hop from that barrel through `Layout.tsx`'s\n * import graph. So this module declares its own structural mirror of\n * `WorkspaceCallable` instead of importing it — `import type … from\n * \"@w6w/sdk/console\"` is safe and precedented (`src/lib/workflow-poll.ts:15`,\n * `src/lib/tenant-oauth-patch.ts:69`, both unit-tested today).\n */\nimport type { CallableOnError, ErrorReroute, RetryPolicy } from \"@w6w/sdk/console\";\n\n/** Structural mirror of `WorkspaceCallable` (`src/ui/workspace.tsx`) — only\n * the fields this module reads. `onPolicyChange` is the WORKFLOW arm's\n * injected writer (see {@link isAvailable}); the two callable arms have no\n * such member and never read it. */\nexport type SettingsCallable = {\n kind: string;\n id: string;\n onPolicyChange?: (policy: CallablePolicy) => void;\n} | null;\n\n/** The three fields this tool owns on a Function/Endpoint definition —\n * TC2's pinned shape, shared by both `Fn` and `Endpoint`. */\nexport interface CallablePolicy {\n retry?: RetryPolicy;\n onError?: CallableOnError;\n reroute?: ErrorReroute;\n}\n\n/** A definition carrying (at least) the three fields above, plus whatever\n * else `Fn`/`Endpoint` declares — `definitionWithPolicy` preserves every\n * field this type doesn't name. */\nexport type CallableDefinition = CallablePolicy;\n\n/**\n * Is the Error handling tool meaningful for this context?\n *\n * A Function and an Endpoint: always — the panel owns their whole\n * read-modify-write, because nothing else on the page is editing the same\n * definition at the same time.\n *\n * A Workflow: only when the publishing page injects `onPolicyChange` (core\n * Workflow RFC — *Amendment — 2026-08-21: the run-level error handler*). This\n * is not fussiness. The workflow canvas holds the definition as JSON TEXT it\n * owns, and auto-saves it (`settings.autoSave` defaults to ON), so a rail\n * panel doing its own read-modify-write against the server would be racing the\n * editor: whichever wrote last would silently drop the other's edit, and the\n * loser would most often be the rail, since the canvas re-sends its whole\n * buffer on the next keystroke. Injecting the writer instead means the rail\n * edits the SAME buffer the canvas is about to save. A page that does not own\n * that buffer (the run-detail page) publishes no writer, and the tool simply\n * does not appear there.\n *\n * A Connection has no run-level policy at all. `null` (no resource published)\n * fails closed, house style (mirrors `code-rail.ts`'s `isAvailable`).\n */\nexport function isAvailable(ctx: SettingsCallable): boolean {\n if (!ctx) return false;\n if (ctx.kind === \"function\" || ctx.kind === \"endpoint\") return true;\n return ctx.kind === \"workflow\" && typeof ctx.onPolicyChange === \"function\";\n}\n\n/**\n * Read a definition's `{retry, onError, reroute}` into the shape the panel's\n * local editing state starts from. Normalizes the same way\n * `definitionWithPolicy` writes: a stored `onError: \"fail\"` (never written by\n * this tool, but defensive against a hand-edited or older definition) reads\n * back as absent, matching how `NodeConfigForm` already treats `\"fail\"` as\n * its own default.\n */\nexport function policyFromDefinition(def: CallableDefinition): CallablePolicy {\n const policy: CallablePolicy = {};\n if (def.retry) policy.retry = def.retry;\n if (def.onError && def.onError !== \"fail\") policy.onError = def.onError;\n if (def.reroute) policy.reroute = def.reroute;\n return policy;\n}\n\n/**\n * Read-modify-write: apply `policy`'s `{retry, onError, reroute}` onto `def`,\n * preserving every OTHER field untouched (`impl`/`inputs`/`key` on a\n * Function, `target`/`input`/`key` on an Endpoint, …) — the save this tool\n * issues is never a bare `{retry, onError, reroute}` object. A field whose\n * value is the default is OMITTED entirely, not written as `undefined`:\n * `policy.onError === \"fail\"` (or absent) drops the key, matching\n * `NodeConfigForm`'s own \"fail\" -> absent convention for the field it edits\n * in place. Built by destructuring the three fields OUT of `def` and\n * conditionally re-spreading them, rather than `delete`, so the key is\n * genuinely absent from the returned object, not merely `undefined`-valued —\n * `node:assert/strict`'s deep-equal distinguishes the two (this module's own\n * test pins it).\n */\nexport function definitionWithPolicy<T extends CallableDefinition>(\n def: T,\n policy: CallablePolicy,\n): T {\n const { retry: _retry, onError: _onError, reroute: _reroute, ...rest } = def;\n return {\n ...rest,\n ...(policy.retry ? { retry: policy.retry } : {}),\n ...(policy.onError && policy.onError !== \"fail\" ? { onError: policy.onError } : {}),\n ...(policy.reroute ? { reroute: policy.reroute } : {}),\n } as T;\n}\n"],"names":["callableRecord","kind","data","top","updatedAt","_valid","_updatedAt","definition","endpoint","isAvailable","ctx","policyFromDefinition","def","policy","definitionWithPolicy","_retry","_onError","_reroute","rest"],"mappings":"AAiBO,SAASA,EACdC,GACAC,GAC0E;AAC1E,MAAI,OAAOA,KAAS,YAAYA,MAAS,QAAQ,MAAM,QAAQA,CAAI,EAAG,QAAO;AAC7E,QAAMC,IAAMD,GACNE,IAAY,OAAOD,EAAI,aAAc,WAAWA,EAAI,YAAY;AACtE,MAAIF,MAAS,YAAY;AACvB,UAAM,EAAE,OAAOI,GAAQ,WAAWC,GAAY,GAAGC,MAAeJ;AAChE,WAAO,EAAE,YAAAI,GAAY,WAAAH,EAAA;AAAA,EACvB;AACA,QAAMI,IAAWL,EAAI;AACrB,SAAI,OAAOK,KAAa,YAAYA,MAAa,QAAQ,MAAM,QAAQA,CAAQ,IAAU,OAClF,EAAE,YAAYA,GAAqC,WAAAJ,EAAA;AAC5D;AC8BO,SAASK,EAAYC,GAAgC;AAC1D,SAAKA,IACDA,EAAI,SAAS,cAAcA,EAAI,SAAS,aAAmB,KACxDA,EAAI,SAAS,cAAc,OAAOA,EAAI,kBAAmB,aAF/C;AAGnB;AAUO,SAASC,EAAqBC,GAAyC;AAC5E,QAAMC,IAAyB,CAAA;AAC/B,SAAID,EAAI,UAAOC,EAAO,QAAQD,EAAI,QAC9BA,EAAI,WAAWA,EAAI,YAAY,WAAQC,EAAO,UAAUD,EAAI,UAC5DA,EAAI,YAASC,EAAO,UAAUD,EAAI,UAC/BC;AACT;AAgBO,SAASC,EACdF,GACAC,GACG;AACH,QAAM,EAAE,OAAOE,GAAQ,SAASC,GAAU,SAASC,GAAU,GAAGC,EAAA,IAASN;AACzE,SAAO;AAAA,IACL,GAAGM;AAAA,IACH,GAAIL,EAAO,QAAQ,EAAE,OAAOA,EAAO,MAAA,IAAU,CAAA;AAAA,IAC7C,GAAIA,EAAO,WAAWA,EAAO,YAAY,SAAS,EAAE,SAASA,EAAO,QAAA,IAAY,CAAA;AAAA,IAChF,GAAIA,EAAO,UAAU,EAAE,SAASA,EAAO,QAAA,IAAY,CAAA;AAAA,EAAC;AAExD;"}