@w6w/embed 0.2.1 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +22 -5
  2. package/dist/ConfirmModal-Pv2-A_3U.js +186 -0
  3. package/dist/ConfirmModal-Pv2-A_3U.js.map +1 -0
  4. package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-DScxp_LN.js} +25 -25
  5. package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-DScxp_LN.js.map} +1 -1
  6. package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-Br4s8wmi.js} +5 -5
  7. package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-Br4s8wmi.js.map} +1 -1
  8. package/dist/ImportSpecModal-Cpzp8ndt.js +251 -0
  9. package/dist/ImportSpecModal-Cpzp8ndt.js.map +1 -0
  10. package/dist/ModelRoutesManager-1Ac5wcas.js +345 -0
  11. package/dist/ModelRoutesManager-1Ac5wcas.js.map +1 -0
  12. package/dist/WorkflowEditor-CmhXHRxi.js +1109 -0
  13. package/dist/WorkflowEditor-CmhXHRxi.js.map +1 -0
  14. package/dist/apps-ItBvnWX3.js +92 -0
  15. package/dist/apps-ItBvnWX3.js.map +1 -0
  16. package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
  17. package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
  18. package/dist/chrome/ConfirmModal.d.ts +4 -1
  19. package/dist/chrome/DangerZone.d.ts +4 -3
  20. package/dist/chrome/ExecutionProfileHeader.d.ts +3 -3
  21. package/dist/chrome/JsonToggle.d.ts +29 -20
  22. package/dist/chrome/Modal.d.ts +3 -1
  23. package/dist/chrome/RightRail.d.ts +6 -1
  24. package/dist/chrome/VersionHistoryModal.d.ts +2 -0
  25. package/dist/chrome/index.d.ts +1 -0
  26. package/dist/chrome/workspace.d.ts +36 -1
  27. package/dist/coerce-input-DFJ4n_wc.js +150 -0
  28. package/dist/coerce-input-DFJ4n_wc.js.map +1 -0
  29. package/dist/connections-CzsCyIxY.js +119 -0
  30. package/dist/connections-CzsCyIxY.js.map +1 -0
  31. package/dist/credentials-Cn92LGhJ.js +171 -0
  32. package/dist/credentials-Cn92LGhJ.js.map +1 -0
  33. package/dist/data-stores-UeQvwVCa.js +170 -0
  34. package/dist/data-stores-UeQvwVCa.js.map +1 -0
  35. package/dist/document-sources-DNmBojx6.js +169 -0
  36. package/dist/document-sources-DNmBojx6.js.map +1 -0
  37. package/dist/draft/use-workflow-draft.d.ts +2 -0
  38. package/dist/draft.mjs +2 -2
  39. package/dist/editor/BindingBanner.d.ts +13 -0
  40. package/dist/editor/CallableEditorFrame.d.ts +7 -0
  41. package/dist/editor/EndpointCards.d.ts +4 -1
  42. package/dist/editor/PublishControl.d.ts +19 -0
  43. package/dist/editor/PublishTooltip.d.ts +7 -0
  44. package/dist/editor/SetupIncompleteBanner.d.ts +12 -0
  45. package/dist/editor/StartingStateModal.d.ts +14 -0
  46. package/dist/editor/TargetSelector.d.ts +15 -0
  47. package/dist/editor/TargetSelector.types.d.ts +2 -0
  48. package/dist/editor/WorkflowSettingsModal.d.ts +6 -1
  49. package/dist/editor/WorkflowVariablesEditor.d.ts +6 -0
  50. package/dist/editor/definition.d.ts +6 -0
  51. package/dist/editor/json-apply.d.ts +29 -0
  52. package/dist/editor/step-problems-feed.d.ts +5 -0
  53. package/dist/editor/types.d.ts +2 -2
  54. package/dist/editor-apps-DkkC7wOQ.js +152 -0
  55. package/dist/editor-apps-DkkC7wOQ.js.map +1 -0
  56. package/dist/editor-tools-BR27RGto.js +1683 -0
  57. package/dist/editor-tools-BR27RGto.js.map +1 -0
  58. package/dist/editor.mjs +1 -1
  59. package/dist/editors.mjs +855 -650
  60. package/dist/editors.mjs.map +1 -1
  61. package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
  62. package/dist/endpoints-DSRo1Lc5.js.map +1 -0
  63. package/dist/fields-DvS8XZFc.js +21 -0
  64. package/dist/fields-DvS8XZFc.js.map +1 -0
  65. package/dist/forms/ModelBudgetsManager.d.ts +9 -0
  66. package/dist/forms/ModelRoutesManager.d.ts +14 -0
  67. package/dist/forms.d.ts +4 -0
  68. package/dist/forms.mjs +611 -212
  69. package/dist/forms.mjs.map +1 -1
  70. package/dist/{rail-settings-XYGToh00.js → import-bindings-EUtxZ9Ti.js} +90 -24
  71. package/dist/import-bindings-EUtxZ9Ti.js.map +1 -0
  72. package/dist/index.mjs +154 -117
  73. package/dist/index.mjs.map +1 -1
  74. package/dist/lib/binding-problems.d.ts +42 -0
  75. package/dist/lib/code-rail.d.ts +4 -2
  76. package/dist/lib/history-query.d.ts +45 -0
  77. package/dist/lib/import-bindings.d.ts +89 -0
  78. package/dist/lib/index.d.ts +4 -0
  79. package/dist/lib/invoke-error.d.ts +1 -0
  80. package/dist/lib/rail-settings.d.ts +1 -1
  81. package/dist/lib/sdk-snippets.d.ts +1 -1
  82. package/dist/lib/setup-incomplete.d.ts +22 -0
  83. package/dist/lib/starting-data.d.ts +31 -0
  84. package/dist/lib/state-panel.d.ts +29 -0
  85. package/dist/lib/target-fields.d.ts +11 -15
  86. package/dist/lib/trigger-preview.d.ts +1 -0
  87. package/dist/lib/workflow-live-run.d.ts +93 -8
  88. package/dist/lib/workflow-nodes.d.ts +5 -0
  89. package/dist/lib/workflow-validity.d.ts +65 -16
  90. package/dist/lib/workflow-variables.d.ts +1 -1
  91. package/dist/lib/workflow-version.d.ts +2 -0
  92. package/dist/lib.mjs +86 -69
  93. package/dist/lists/ConnectionDependents.d.ts +31 -0
  94. package/dist/lists/ConnectionDetail.d.ts +4 -1
  95. package/dist/lists/ConnectionList.d.ts +4 -1
  96. package/dist/lists/CredentialDetail.d.ts +15 -0
  97. package/dist/lists/CredentialList.d.ts +14 -0
  98. package/dist/lists/DataStoreList.d.ts +17 -0
  99. package/dist/lists/DataStoreView.d.ts +19 -0
  100. package/dist/lists/Logs.d.ts +19 -0
  101. package/dist/lists/ModelCatalog.d.ts +12 -0
  102. package/dist/lists/ModelUsage.d.ts +12 -0
  103. package/dist/lists.d.ts +14 -0
  104. package/dist/lists.mjs +1766 -609
  105. package/dist/lists.mjs.map +1 -1
  106. package/dist/models-bAayQPJ_.js +270 -0
  107. package/dist/models-bAayQPJ_.js.map +1 -0
  108. package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
  109. package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
  110. package/dist/rail/ConnectionsTool.d.ts +2 -0
  111. package/dist/rail/HistoryTool.d.ts +2 -0
  112. package/dist/rail/StartingStateTool.d.ts +2 -0
  113. package/dist/rail/settings-sections.d.ts +4 -1
  114. package/dist/rail.mjs +4 -4
  115. package/dist/repos/agents-studio-agents.d.ts +52 -0
  116. package/dist/repos/agents-studio-assets.d.ts +68 -0
  117. package/dist/repos/connections.d.ts +30 -12
  118. package/dist/repos/constants.d.ts +12 -0
  119. package/dist/repos/credentials.d.ts +83 -0
  120. package/dist/repos/data-stores.d.ts +84 -0
  121. package/dist/repos/endpoints.d.ts +9 -3
  122. package/dist/repos/fields.d.ts +34 -0
  123. package/dist/repos/functions.d.ts +7 -5
  124. package/dist/repos/history.d.ts +9 -0
  125. package/dist/repos/index.d.ts +7 -0
  126. package/dist/repos/models.d.ts +289 -0
  127. package/dist/repos/spec-export.d.ts +3 -3
  128. package/dist/repos/spec-import.d.ts +30 -1
  129. package/dist/repos/step-tests.d.ts +2 -0
  130. package/dist/repos/webhook-listen.d.ts +35 -0
  131. package/dist/repos/workflows.d.ts +105 -2
  132. package/dist/repos.mjs +655 -176
  133. package/dist/repos.mjs.map +1 -1
  134. package/dist/setup-incomplete-BHs3Lpfy.js +199 -0
  135. package/dist/setup-incomplete-BHs3Lpfy.js.map +1 -0
  136. package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
  137. package/dist/slug-BVdgiP_L.js.map +1 -0
  138. package/dist/{spec-export-Cf3VQSQS.js → spec-export-DGy5ijps.js} +73 -60
  139. package/dist/spec-export-DGy5ijps.js.map +1 -0
  140. package/dist/spec-import-SWOonsNr.js +116 -0
  141. package/dist/spec-import-SWOonsNr.js.map +1 -0
  142. package/dist/{step-tests-CivICmTq.js → step-tests-B4E4W3ly.js} +8 -7
  143. package/dist/step-tests-B4E4W3ly.js.map +1 -0
  144. package/dist/theme-context-E2ZhlXDX.js +6 -0
  145. package/dist/theme-context-E2ZhlXDX.js.map +1 -0
  146. package/dist/theme-context.d.ts +2 -0
  147. package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DCauHt5o.js} +23 -23
  148. package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DCauHt5o.js.map} +1 -1
  149. package/dist/use-workflow-draft-l3P5KZzw.js +338 -0
  150. package/dist/use-workflow-draft-l3P5KZzw.js.map +1 -0
  151. package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
  152. package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
  153. package/dist/workflows-BZN4Hyz1.js +623 -0
  154. package/dist/workflows-BZN4Hyz1.js.map +1 -0
  155. package/package.json +3 -2
  156. package/src/styles.css +155 -7
  157. package/dist/ConfirmModal-RLbZT5_k.js +0 -181
  158. package/dist/ConfirmModal-RLbZT5_k.js.map +0 -1
  159. package/dist/ImportSpecModal-BDQIf6rg.js +0 -136
  160. package/dist/ImportSpecModal-BDQIf6rg.js.map +0 -1
  161. package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
  162. package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
  163. package/dist/apps-1FNUwbGv.js +0 -77
  164. package/dist/apps-1FNUwbGv.js.map +0 -1
  165. package/dist/coerce-input-BicYr7nc.js +0 -139
  166. package/dist/coerce-input-BicYr7nc.js.map +0 -1
  167. package/dist/connections-CjjYeRqb.js +0 -78
  168. package/dist/connections-CjjYeRqb.js.map +0 -1
  169. package/dist/document-sources-C0grrtdq.js +0 -86
  170. package/dist/document-sources-C0grrtdq.js.map +0 -1
  171. package/dist/editor-apps-BdenSV1o.js +0 -95
  172. package/dist/editor-apps-BdenSV1o.js.map +0 -1
  173. package/dist/editor-tools-RxmY5iyi.js +0 -1279
  174. package/dist/editor-tools-RxmY5iyi.js.map +0 -1
  175. package/dist/endpoints-B2ynbZo-.js.map +0 -1
  176. package/dist/rail-settings-XYGToh00.js.map +0 -1
  177. package/dist/slug-C4ktDPdy.js.map +0 -1
  178. package/dist/spec-export-Cf3VQSQS.js.map +0 -1
  179. package/dist/spec-import-CjmxyZDR.js +0 -465
  180. package/dist/spec-import-CjmxyZDR.js.map +0 -1
  181. package/dist/step-tests-CivICmTq.js.map +0 -1
  182. package/dist/trigger-preview-VPkrryDl.js +0 -120
  183. package/dist/trigger-preview-VPkrryDl.js.map +0 -1
  184. package/dist/use-workflow-draft-DzAyUeA6.js +0 -316
  185. package/dist/use-workflow-draft-DzAyUeA6.js.map +0 -1
@@ -1,78 +0,0 @@
1
- import { useQuery as s, useQueryClient as i, useMutation as u } from "@tanstack/react-query";
2
- import { u as o } from "./client-context-CX61Bgw-.js";
3
- const y = (n) => ["app-connections", n];
4
- function l(n, e) {
5
- return n.console.connections.listForApp(e);
6
- }
7
- function F(n, e = !0) {
8
- const t = o();
9
- return s({
10
- queryKey: y(n),
11
- queryFn: () => l(t, n),
12
- enabled: e
13
- });
14
- }
15
- const c = ["connections"];
16
- function f(n) {
17
- return n.connections.list();
18
- }
19
- function Q() {
20
- const n = o();
21
- return s({ queryKey: c, queryFn: () => f(n) });
22
- }
23
- const r = (n) => ["connection", n];
24
- function p(n, e) {
25
- return n.console.connections.get(e);
26
- }
27
- function m(n) {
28
- const e = o();
29
- return s({ queryKey: r(n), queryFn: () => p(e, n) });
30
- }
31
- function d(n, e, t) {
32
- return n.console.connections.create(e, t);
33
- }
34
- function q(n, e, t) {
35
- return n.console.connections.update(e, t);
36
- }
37
- function v(n) {
38
- const e = o(), t = i();
39
- return u({
40
- mutationFn: (a) => q(e, n, a),
41
- onSuccess: () => {
42
- t.invalidateQueries({ queryKey: c }), t.invalidateQueries({ queryKey: r(n) });
43
- }
44
- });
45
- }
46
- function A(n) {
47
- const e = o(), t = i();
48
- return u({
49
- mutationFn: () => e.console.connections.test(n),
50
- onSuccess: () => {
51
- t.invalidateQueries({ queryKey: r(n) }), t.invalidateQueries({ queryKey: c });
52
- }
53
- });
54
- }
55
- function M() {
56
- const n = o(), e = i();
57
- return u({
58
- mutationFn: (t) => n.console.connections.delete(t),
59
- onSuccess: () => e.invalidateQueries({ queryKey: c })
60
- });
61
- }
62
- export {
63
- y as a,
64
- c as b,
65
- r as c,
66
- d,
67
- l as e,
68
- m as f,
69
- p as g,
70
- F as h,
71
- Q as i,
72
- M as j,
73
- A as k,
74
- f as l,
75
- v as m,
76
- q as u
77
- };
78
- //# sourceMappingURL=connections-CjjYeRqb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connections-CjjYeRqb.js","sources":["../src/repos/connections.ts"],"sourcesContent":["/**\n * The connections-for-one-app repo — the Target selector's connection picker.\n *\n * Moved from Studio's `repos/connections.ts` (B-3a); the Studio file re-exports these names. The\n * client comes from `useEmbedClient()`. D-12e moved the rest of the file here (list, single,\n * create, update, test, delete); Studio's `repos/connections.ts` is now a pure re-export shim.\n */\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { ConnectionSummary, W6WClient } from \"@w6w/sdk\";\nimport type { ConnectionTestResult } from \"@w6w/sdk/console\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n\nexport type { ConnectionSummary } from \"@w6w/sdk\";\n\nexport const connectionsForAppKey = (appId: string) => [\"app-connections\", appId] as const;\n\nexport function listConnectionsForApp(\n client: W6WClient,\n appId: string,\n): Promise<ConnectionSummary[]> {\n return client.console.connections.listForApp(appId);\n}\n\n/**\n * `enabled` defaults to `true`. `TargetSelector` passes `app !== \"\"` — its original\n * pre-migration guard, preserved exactly.\n */\nexport function useConnectionsForAppQuery(appId: string, enabled = true) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: connectionsForAppKey(appId),\n queryFn: () => listConnectionsForApp(client, appId),\n enabled,\n });\n}\n\n// ── connections (list, all apps) ──────────────────────────────────────\n// BASE partner surface — client.connections.list() already exists. There is no\n// console.connections.list(); do NOT route this one through client.console.connections.\n\nexport const connectionsKey = [\"connections\"] as const;\n\nexport function listConnections(client: W6WClient): Promise<ConnectionSummary[]> {\n return client.connections.list();\n}\n\nexport function useConnectionsQuery() {\n const client = useEmbedClient();\n return useQuery({ queryKey: connectionsKey, queryFn: () => listConnections(client) });\n}\n\n// ── connection (single) ───────────────────────────────────────────────\n\nexport const connectionKey = (id: string) => [\"connection\", id] as const;\n\nexport function getConnection(client: W6WClient, id: string): Promise<ConnectionSummary> {\n return client.console.connections.get(id);\n}\n\nexport function useConnectionQuery(id: string) {\n const client = useEmbedClient();\n return useQuery({ queryKey: connectionKey(id), queryFn: () => getConnection(client, id) });\n}\n\n// ── create / update (plain fetchers) ──────────────────────────────────\n\nexport function createConnection(\n client: W6WClient,\n appId: string,\n body: {\n authKey: string;\n credential: Record<string, unknown>;\n displayName?: string;\n profile?: Record<string, unknown>;\n },\n): Promise<ConnectionSummary> {\n return client.console.connections.create(appId, body);\n}\n\n/** The write `W6WEmbedProvider` hands the ui adapter as `updateConnection` (the SDK adapter has none). */\nexport function updateConnection(\n client: W6WClient,\n id: string,\n body: { displayName?: string; credential?: Record<string, unknown> },\n): Promise<ConnectionSummary> {\n return client.console.connections.update(id, body);\n}\n\n// ── mutations ────────────────────────────────────────────────────────\n\nexport function useUpdateConnectionMutation(connectionId: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (body: { displayName?: string; credential?: Record<string, unknown> }) =>\n updateConnection(client, connectionId, body),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: connectionsKey });\n qc.invalidateQueries({ queryKey: connectionKey(connectionId) });\n },\n });\n}\n\nexport function useTestConnectionMutation(connectionId: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (): Promise<ConnectionTestResult> => client.console.connections.test(connectionId),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: connectionKey(connectionId) });\n qc.invalidateQueries({ queryKey: connectionsKey });\n },\n });\n}\n\nexport function useDeleteConnectionMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => client.console.connections.delete(id),\n onSuccess: () => qc.invalidateQueries({ queryKey: connectionsKey }),\n });\n}\n"],"names":["connectionsForAppKey","appId","listConnectionsForApp","client","useConnectionsForAppQuery","enabled","useEmbedClient","useQuery","connectionsKey","listConnections","useConnectionsQuery","connectionKey","id","getConnection","useConnectionQuery","createConnection","body","updateConnection","useUpdateConnectionMutation","connectionId","qc","useQueryClient","useMutation","useTestConnectionMutation","useDeleteConnectionMutation"],"mappings":";;AAcO,MAAMA,IAAuB,CAACC,MAAkB,CAAC,mBAAmBA,CAAK;AAEzE,SAASC,EACdC,GACAF,GAC8B;AAC9B,SAAOE,EAAO,QAAQ,YAAY,WAAWF,CAAK;AACpD;AAMO,SAASG,EAA0BH,GAAeI,IAAU,IAAM;AACvE,QAAMF,IAASG,EAAA;AACf,SAAOC,EAAS;AAAA,IACd,UAAUP,EAAqBC,CAAK;AAAA,IACpC,SAAS,MAAMC,EAAsBC,GAAQF,CAAK;AAAA,IAClD,SAAAI;AAAA,EAAA,CACD;AACH;AAMO,MAAMG,IAAiB,CAAC,aAAa;AAErC,SAASC,EAAgBN,GAAiD;AAC/E,SAAOA,EAAO,YAAY,KAAA;AAC5B;AAEO,SAASO,IAAsB;AACpC,QAAMP,IAASG,EAAA;AACf,SAAOC,EAAS,EAAE,UAAUC,GAAgB,SAAS,MAAMC,EAAgBN,CAAM,GAAG;AACtF;AAIO,MAAMQ,IAAgB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T,EAAO,QAAQ,YAAY,OAAOS,CAAE;AAAA,IAChE,WAAW,MAAMQ,EAAG,kBAAkB,EAAE,UAAUZ,GAAgB;AAAA,EAAA,CACnE;AACH;"}
@@ -1,86 +0,0 @@
1
- import { parse as u } from "yaml";
2
- function a(e) {
3
- if (!e) return !1;
4
- switch (e.kind) {
5
- case "function":
6
- case "endpoint":
7
- case "workflow":
8
- return !0;
9
- default:
10
- return !1;
11
- }
12
- }
13
- function f(e) {
14
- if (!e) return null;
15
- switch (e.kind) {
16
- case "function":
17
- return { kind: "function", id: e.id, key: e.key, inputs: e.inputs, alias: e.alias };
18
- case "endpoint":
19
- return {
20
- kind: "endpoint",
21
- id: e.id,
22
- key: e.key,
23
- invokeUrl: e.invokeUrl,
24
- invokeUrlByKey: e.invokeUrlByKey,
25
- urlForm: e.urlForm,
26
- alias: e.alias,
27
- inputs: e.inputs
28
- };
29
- case "workflow":
30
- return { kind: "workflow", id: e.id, displayName: e.label, key: e.key };
31
- default:
32
- return null;
33
- }
34
- }
35
- function k({
36
- resource: e,
37
- target: n,
38
- hasAdapter: r
39
- }) {
40
- return (n.kind === "function" || n.kind === "workflow") && n.kind === e.kind && n.id === e.id ? r ? "warn" : "block" : "allow";
41
- }
42
- function o(e) {
43
- let n;
44
- if (e.format === "json")
45
- try {
46
- n = JSON.parse(e.content);
47
- } catch {
48
- return null;
49
- }
50
- else if (e.format === "yaml")
51
- try {
52
- n = u(e.content);
53
- } catch {
54
- return null;
55
- }
56
- else
57
- return null;
58
- return typeof n != "object" || n === null || Array.isArray(n) ? null : n;
59
- }
60
- function d(e) {
61
- return e.map((n) => {
62
- const r = o(n);
63
- if (!r) return { key: n.key };
64
- const i = Object.keys(r);
65
- return i.length > 0 ? { key: n.key, fields: i.map((t) => ({ key: t })) } : { key: n.key };
66
- });
67
- }
68
- function y(e) {
69
- const n = {};
70
- for (const r of e) {
71
- n[`documents.${r.key}`] = r.content;
72
- const i = o(r);
73
- if (i)
74
- for (const [t, l] of Object.entries(i))
75
- n[`documents.${r.key}.${t}`] = l;
76
- }
77
- return n;
78
- }
79
- export {
80
- y as d,
81
- k as e,
82
- a as i,
83
- d as p,
84
- f as t
85
- };
86
- //# sourceMappingURL=document-sources-C0grrtdq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"document-sources-C0grrtdq.js","sources":["../src/lib/code-rail.ts","../src/lib/error-handler-self.ts","../src/lib/document-sources.ts"],"sourcesContent":["/**\n * Pure decisions behind the right rail's Code tool (`src/ui/rail/CodeTool.tsx`).\n * Split out so `node --test` can gate them directly — mirrors\n * `src/lib/alias-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.\n */\nimport type { SnippetCallable, SnippetInput } from \"./sdk-snippets.ts\";\n\n/** Structural mirror of T2.1.2's widened `WorkspaceCallable` (`src/ui/workspace.tsx`). */\nexport type RailCallable =\n | { kind: \"function\"; id: string; key?: string; inputs?: readonly SnippetInput[]; alias?: string }\n | {\n kind: \"endpoint\";\n id: string;\n key?: string;\n invokeUrl?: string;\n invokeUrlByKey?: string;\n urlForm?: \"id\" | \"key\";\n alias?: string;\n inputs?: readonly SnippetInput[];\n }\n | { kind: \"workflow\"; id: string; label?: string; key?: string }\n | { kind: \"connection\"; id: string }\n | null;\n\n/**\n * Is a \"Call from code\" panel meaningful for this context? Mirrors\n * `alias-rail.ts`'s `targetForCallable` fail-closed shape exactly (its own\n * comment: *\"'connection' and no resource at all both fail closed to null —\n * house style\"*) — `\"connection\"` and `null` both answer `false`.\n */\nexport function isAvailable(ctx: RailCallable): boolean {\n if (!ctx) return false;\n switch (ctx.kind) {\n case \"function\":\n case \"endpoint\":\n case \"workflow\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * The widened-union -> `SnippetCallable` conversion `CodeTool.Panel` hands to\n * `CallFromCodeBody`. `null` for a context this tool has no snippet for\n * (`\"connection\"`, or no resource at all) — defensive, since `isAvailable`\n * already keeps the tool off the strip for those.\n *\n * The one easy-to-miss field: `WorkspaceCallable`'s `label` maps to\n * `SnippetCallable`'s `workflow` arm's `displayName` — NOT the same field\n * name. A naive `{...ctx}` spread compiles (both optional) but silently\n * drops the label everywhere it matters, never caught by `tsc`.\n */\nexport function toSnippetCallable(ctx: RailCallable): SnippetCallable | null {\n if (!ctx) return null;\n switch (ctx.kind) {\n case \"function\":\n return { kind: \"function\", id: ctx.id, key: ctx.key, inputs: ctx.inputs, alias: ctx.alias };\n case \"endpoint\":\n return {\n kind: \"endpoint\",\n id: ctx.id,\n key: ctx.key,\n invokeUrl: ctx.invokeUrl,\n invokeUrlByKey: ctx.invokeUrlByKey,\n urlForm: ctx.urlForm,\n alias: ctx.alias,\n inputs: ctx.inputs,\n };\n case \"workflow\":\n return { kind: \"workflow\", id: ctx.id, displayName: ctx.label, key: ctx.key };\n default:\n return null;\n }\n}\n","/**\n * The authoring-time half of the error-handler recursion guard. The server\n * compares resolved values at dispatch time; this small, pure decision keeps\n * the rail from creating the known-identical no-adapter case in the first\n * place without losing an adapter imported or authored elsewhere.\n */\nexport type ErrorHandlerSelfDecision = \"allow\" | \"warn\" | \"block\";\n\nexport interface ErrorHandlerSelfInput {\n resource: { kind: string; id: string };\n target: { kind: string; id: string };\n hasAdapter: boolean;\n}\n\n/**\n * Only Function and Workflow targets can re-enter the currently edited\n * resource. Actions are always allowed. A self-target with no adapter passes\n * the failed input through unchanged, so it is refused; an adapter is kept\n * and called out because only the runtime can determine its resolved values.\n */\nexport function errorHandlerSelfDecision({\n resource,\n target,\n hasAdapter,\n}: ErrorHandlerSelfInput): ErrorHandlerSelfDecision {\n const selfTarget =\n (target.kind === \"function\" || target.kind === \"workflow\") &&\n target.kind === resource.kind &&\n target.id === resource.id;\n if (!selfTarget) return \"allow\";\n return hasAdapter ? \"warn\" : \"block\";\n}\n","/**\n * Pure `Doc[]` → `ExpressionOptions` projections for the ƒx picker's\n * Documents group — extracted out of `ExpressionScope.tsx` so studio's\n * Node-native `test:unit` runner (globbed to `src/lib/__tests__/`,\n * `src/api/__tests__/` and `src/repos/__tests__/` only — `.ai/PLANNER.md`\n * fact 10) can reach it. No React, no import from `src/ui/` — `@w6w/ui`'s\n * `ExpressionDocumentSource` interface is not imported either (it is not\n * exported from `@w6w/ui`'s barrel, D-P3): the object literals returned below\n * are structurally identical to it, so TypeScript carries the shape without a\n * type import.\n *\n * ## The gate — mirrors the engine's own, bit-for-bit\n *\n * A document contributes field data **iff**: `doc.format === \"json\"` AND\n * `JSON.parse(doc.content)` succeeds into a plain object, OR\n * `doc.format === \"yaml\"` AND npm `yaml`'s `parse(doc.content)` succeeds into\n * a plain object — where *plain object* means\n * `typeof v === \"object\" && v !== null && !Array.isArray(v)`. This mirrors\n * the engine's own gate (`documentsSeed` /\n * `packages/server/packages/api/run-seed.ts`, read-only, out of scope)\n * bit-for-bit for each format: `format === \"json\"` or `format === \"yaml\"`,\n * then a `try/catch` parse, falling back to the raw content string on either\n * a non-matching format or a throw. Reproduced here so the picker never\n * offers a ref the run scope itself would refuse to resolve\n * (`render_ref_unresolved`) — `text`/`markdown`/`html` documents, and a\n * `json`/`yaml` document whose parse throws or yields a non-plain-object, are\n * excluded.\n *\n * The two parsers are not identical for every input — `@std/yaml` (server,\n * `{ schema: \"core\" }`) and npm `yaml` (here) diverge on tab-indented content\n * and on an unresolvable custom tag (`!!js/function`), both accepted, tested\n * debt (D-3). Every other input, including a plain JSON object (JSON is a\n * subset of YAML), agrees between the two.\n *\n * Field keys are enumerated RAW and UNFILTERED by {@link projectDocumentSources}\n * — arbitrary user-authored JSON keys (which can contain `.`/`{`/`}`/\n * whitespace) reach the modal; `isRefSafeKey` filters them exactly once, at\n * the modal's render site (`ExpressionEditorModal.tsx`), never here\n * (`building-blocks.md`: \"enumerate raw at the source, filter once at the\n * single render site\").\n */\nimport type { Doc } from \"@w6w/sdk\";\nimport { parse as parseYaml } from \"yaml\";\n\n/** One document's contribution to `ExpressionOptions.documents` — structurally\n * identical to `@w6w/ui`'s (unexported) `ExpressionDocumentSource`. */\nexport interface DocumentSource {\n key: string;\n fields?: { key: string }[];\n}\n\n/**\n * `doc`'s parsed content when the gate holds, else `null`. The one place both\n * functions below apply the gate, so they cannot silently disagree on it.\n */\nfunction gatedFields(doc: Doc): Record<string, unknown> | null {\n let parsed: unknown;\n if (doc.format === \"json\") {\n try {\n parsed = JSON.parse(doc.content);\n } catch {\n return null;\n }\n } else if (doc.format === \"yaml\") {\n try {\n parsed = parseYaml(doc.content);\n } catch {\n return null;\n }\n } else {\n return null;\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return null;\n return parsed as Record<string, unknown>;\n}\n\n/**\n * The `ExpressionOptions.documents` array: `{ key }` for every document, plus\n * `fields` (raw, unfiltered top-level keys) when the gate holds AND the\n * parsed object has at least one key. `fields` is OMITTED (not `[]`) both\n * when the gate fails and when it holds but yields zero keys — a consumer\n * must be able to tell \"nothing declared\" from \"declared none\".\n */\nexport function projectDocumentSources(docs: Doc[]): DocumentSource[] {\n return docs.map((d) => {\n const parsed = gatedFields(d);\n if (!parsed) return { key: d.key };\n const keys = Object.keys(parsed);\n return keys.length > 0 ? { key: d.key, fields: keys.map((key) => ({ key })) } : { key: d.key };\n });\n}\n\n/**\n * The `sampleValues` entries the ƒx Result preview substitutes for document\n * refs: `documents.<key>` → the document's raw content, for every document\n * (unconditional, exactly as before this project), PLUS `documents.<key>.<field>`\n * → the field's own parsed value, for the gated set only. Without the second\n * half, every field ref this project newly makes pickable would preview as\n * the empty string (`renderResult` does an exact flat-key lookup).\n */\nexport function documentSampleValues(docs: Doc[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const d of docs) {\n out[`documents.${d.key}`] = d.content;\n const parsed = gatedFields(d);\n if (!parsed) continue;\n for (const [key, value] of Object.entries(parsed)) {\n out[`documents.${d.key}.${key}`] = value;\n }\n }\n return out;\n}\n"],"names":["isAvailable","ctx","toSnippetCallable","errorHandlerSelfDecision","resource","target","hasAdapter","gatedFields","doc","parsed","parseYaml","projectDocumentSources","docs","d","keys","key","documentSampleValues","out","value"],"mappings":";AAkCO,SAASA,EAAYC,GAA4B;AACtD,MAAI,CAACA,EAAK,QAAO;AACjB,UAAQA,EAAI,MAAA;AAAA,IACV,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;AAaO,SAASC,EAAkBD,GAA2C;AAC3E,MAAI,CAACA,EAAK,QAAO;AACjB,UAAQA,EAAI,MAAA;AAAA,IACV,KAAK;AACH,aAAO,EAAE,MAAM,YAAY,IAAIA,EAAI,IAAI,KAAKA,EAAI,KAAK,QAAQA,EAAI,QAAQ,OAAOA,EAAI,MAAA;AAAA,IACtF,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,IAAIA,EAAI;AAAA,QACR,KAAKA,EAAI;AAAA,QACT,WAAWA,EAAI;AAAA,QACf,gBAAgBA,EAAI;AAAA,QACpB,SAASA,EAAI;AAAA,QACb,OAAOA,EAAI;AAAA,QACX,QAAQA,EAAI;AAAA,MAAA;AAAA,IAEhB,KAAK;AACH,aAAO,EAAE,MAAM,YAAY,IAAIA,EAAI,IAAI,aAAaA,EAAI,OAAO,KAAKA,EAAI,IAAA;AAAA,IAC1E;AACE,aAAO;AAAA,EAAA;AAEb;AC1DO,SAASE,EAAyB;AAAA,EACvC,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AACF,GAAoD;AAKlD,UAHGD,EAAO,SAAS,cAAcA,EAAO,SAAS,eAC/CA,EAAO,SAASD,EAAS,QACzBC,EAAO,OAAOD,EAAS,KAElBE,IAAa,SAAS,UADL;AAE1B;ACwBA,SAASC,EAAYC,GAA0C;AAC7D,MAAIC;AACJ,MAAID,EAAI,WAAW;AACjB,QAAI;AACF,MAAAC,IAAS,KAAK,MAAMD,EAAI,OAAO;AAAA,IACjC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,WACSA,EAAI,WAAW;AACxB,QAAI;AACF,MAAAC,IAASC,EAAUF,EAAI,OAAO;AAAA,IAChC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA;AAEA,WAAO;AAET,SAAI,OAAOC,KAAW,YAAYA,MAAW,QAAQ,MAAM,QAAQA,CAAM,IAAU,OAC5EA;AACT;AASO,SAASE,EAAuBC,GAA+B;AACpE,SAAOA,EAAK,IAAI,CAACC,MAAM;AACrB,UAAMJ,IAASF,EAAYM,CAAC;AAC5B,QAAI,CAACJ,EAAQ,QAAO,EAAE,KAAKI,EAAE,IAAA;AAC7B,UAAMC,IAAO,OAAO,KAAKL,CAAM;AAC/B,WAAOK,EAAK,SAAS,IAAI,EAAE,KAAKD,EAAE,KAAK,QAAQC,EAAK,IAAI,CAACC,OAAS,EAAE,KAAAA,IAAM,EAAA,IAAM,EAAE,KAAKF,EAAE,IAAA;AAAA,EAC3F,CAAC;AACH;AAUO,SAASG,EAAqBJ,GAAsC;AACzE,QAAMK,IAA+B,CAAA;AACrC,aAAWJ,KAAKD,GAAM;AACpB,IAAAK,EAAI,aAAaJ,EAAE,GAAG,EAAE,IAAIA,EAAE;AAC9B,UAAMJ,IAASF,EAAYM,CAAC;AAC5B,QAAKJ;AACL,iBAAW,CAACM,GAAKG,CAAK,KAAK,OAAO,QAAQT,CAAM;AAC9C,QAAAQ,EAAI,aAAaJ,EAAE,GAAG,IAAIE,CAAG,EAAE,IAAIG;AAAA,EAEvC;AACA,SAAOD;AACT;"}
@@ -1,95 +0,0 @@
1
- import { jsxs as F, Fragment as N, jsx as f } from "react/jsx-runtime";
2
- import { h as O, i as _, e as R } from "./apps-1FNUwbGv.js";
3
- import { H as g } from "./spec-import-CjmxyZDR.js";
4
- import { ExecutionStats as j, ExecutionFilters as D, ExecutionList as L, ExecutionDetail as B, useW6WApi as K } from "@w6w/ui";
5
- import { useRef as I, useState as S, useEffect as b, useCallback as V, useMemo as W } from "react";
6
- import { useQuery as G } from "@tanstack/react-query";
7
- const U = 300;
8
- function ot(e) {
9
- var x, q;
10
- const { scope: n, showKind: a, filters: t, onFiltersChange: l, onOpenInEditor: u } = e, p = I(t);
11
- p.current = t;
12
- const [r, i] = S(t.q), c = I(null), [o, h] = S(null);
13
- b(() => {
14
- i(t.q);
15
- }, [t.q]), b(
16
- () => () => {
17
- c.current && clearTimeout(c.current);
18
- },
19
- []
20
- );
21
- const d = O(n, t), v = _(n, t), m = R(o), y = ((x = d.data) == null ? void 0 : x.executions) ?? [], E = t.offset, C = ((q = d.data) == null ? void 0 : q.hasMore) ?? !1, M = (s) => {
22
- l({ ...s, offset: 0 });
23
- }, Q = (s) => {
24
- if (s.q === r) {
25
- M(s);
26
- return;
27
- }
28
- i(s.q), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
29
- c.current = null, l({ ...p.current, q: s.q, offset: 0 });
30
- }, U);
31
- }, w = () => l({ ...t, q: r, offset: Math.max(0, E - g) }), A = () => l({ ...t, q: r, offset: E + g }), H = V(
32
- (s) => {
33
- h(y.find((T) => T.id === s) ?? null);
34
- },
35
- [y]
36
- ), k = {
37
- status: t.status,
38
- kind: t.kind,
39
- from: t.from,
40
- to: t.to,
41
- q: r
42
- }, P = (o == null ? void 0 : o.kind) === "workflow" && u ? () => u(o) : void 0;
43
- return /* @__PURE__ */ F(N, { children: [
44
- /* @__PURE__ */ f(j, { stats: v.data ?? null }),
45
- /* @__PURE__ */ f(D, { showKind: a, value: k, onChange: Q }),
46
- d.isError && /* @__PURE__ */ f("p", { className: "error", "data-testid": "history-error", children: "Couldn't load execution history." }),
47
- /* @__PURE__ */ f(
48
- L,
49
- {
50
- items: y,
51
- showCallable: a,
52
- loading: d.isLoading,
53
- selectedId: (o == null ? void 0 : o.id) ?? null,
54
- hasPrev: E > 0,
55
- hasNext: C,
56
- onPrev: w,
57
- onNext: A,
58
- onSelect: H
59
- }
60
- ),
61
- o && /* @__PURE__ */ f(
62
- B,
63
- {
64
- execution: m.data ?? null,
65
- loading: m.isLoading,
66
- errorMessage: m.isError ? "This execution is no longer available." : void 0,
67
- onClose: () => h(null),
68
- onOpenInEditor: P
69
- }
70
- )
71
- ] });
72
- }
73
- const Y = /* @__PURE__ */ new Map();
74
- function Z(e) {
75
- var r;
76
- const n = K(), a = (r = n.listAppsByIds) == null ? void 0 : r.bind(n), t = [...e].sort().join(","), u = G({
77
- queryKey: ["editor-apps", t],
78
- queryFn: ({ signal: i }) => a ? a(e, { signal: i }) : Promise.resolve([]),
79
- enabled: e.length > 0 && typeof a == "function"
80
- }).data;
81
- return { byId: W(
82
- () => u ? new Map(u.map((i) => [i.id, i])) : Y,
83
- [u]
84
- ) };
85
- }
86
- function st(e) {
87
- const { byId: n } = Z(e ? [e] : []);
88
- return e ? n.get(e) : void 0;
89
- }
90
- export {
91
- ot as H,
92
- Z as a,
93
- st as u
94
- };
95
- //# sourceMappingURL=editor-apps-BdenSV1o.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-apps-BdenSV1o.js","sources":["../src/chrome/HistoryView.tsx","../src/editor/editor-apps.ts"],"sourcesContent":["/**\n * `HistoryView` — the execution-history view body (T3.2.1, extracted from\n * `HistoryPage.tsx`'s T2.4.1 shape): stats + filters + paged list + the\n * selected execution's detail. Two hosts mount it — `HistoryPage` (the\n * project-wide and per-callable routes, filters URL-backed) and\n * `HistoryModal` (R-2's in-place modal, filters kept in local state) — so\n * this component owns every judgment call about HOW the view behaves, and\n * takes no position on WHERE its filters live: the host hands down\n * `filters` and gets every change back through `onFiltersChange`, exactly\n * the controlled-value shape `filtersToSearch`/`filtersFromSearch` already\n * assume on the URL-backed side.\n *\n * What stays here, same as it was in `HistoryPage` before the extraction:\n * - the search box's text, debounced, so a keystroke does not re-key and\n * re-issue both queries on every character (`onFiltersChange` — and so\n * the host's own write, URL or local state — fires only once typing\n * settles);\n * - which list row is selected, which is not shareable state and resets on\n * every mount;\n * - every filter change but paging snapping the page back to the first\n * (`offset` 0), because a narrowed result set has no meaningful \"page 3\".\n *\n * `onOpenInEditor`, when given, is called with the selected execution ONLY\n * while it is a workflow run (a function/endpoint invocation has no visual\n * editor to open) — the same gate `HistoryPage.tsx` applied inline before\n * this extraction. A host that never passes it (none of today's two do)\n * simply never sees the call.\n */\nimport {\n type ExecutionSummary,\n HISTORY_PAGE_SIZE,\n type HistoryFilters,\n type HistoryScope,\n useExecutionDetailQuery,\n useHistoryQuery,\n useHistoryStatsQuery,\n} from \"@w6w/embed/repos\";\nimport {\n ExecutionDetail,\n type ExecutionFilterValue,\n ExecutionFilters,\n ExecutionList,\n ExecutionStats,\n} from \"@w6w/ui\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\n/** How long to wait after the last keystroke before `onFiltersChange` fires\n * with the new `q` (and so before either query re-issues with it). */\nconst SEARCH_DEBOUNCE_MS = 300;\n\nexport interface HistoryViewProps {\n /** `null` ⇒ no scope known yet (the project-wide host, before its project\n * resolves) — both queries stay disabled, mirroring `repos/history.ts`'s\n * own `enabled: scope !== null`. */\n scope: HistoryScope | null;\n /** Project-wide chrome: the Kind filter, and the Callable column on every\n * row. A per-callable host (every callable already knows its own kind)\n * passes `false`. */\n showKind: boolean;\n filters: HistoryFilters;\n onFiltersChange: (next: HistoryFilters) => void;\n onOpenInEditor?: (execution: ExecutionSummary) => void;\n}\n\nexport function HistoryView(props: HistoryViewProps) {\n const { scope, showKind, filters, onFiltersChange, onOpenInEditor } = props;\n\n // The debounce below fires outside any render, so it needs the LATEST\n // filters (a status picked while a `q` write was still pending must\n // survive it) rather than the ones captured when typing started.\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n\n const [q, setQ] = useState(filters.q);\n const searchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [selected, setSelected] = useState<ExecutionSummary | null>(null);\n\n // Keep the search box in step with `filters.q` when IT moves from outside\n // (Back/Forward or a shared link on the URL-backed host). This never\n // fights a keystroke: an outside `q` only changes once typing has\n // settled, by which point `q` already equals it.\n useEffect(() => {\n setQ(filters.q);\n }, [filters.q]);\n\n // Drop a pending debounce on unmount.\n useEffect(\n () => () => {\n if (searchTimer.current) clearTimeout(searchTimer.current);\n },\n [],\n );\n\n const listQuery = useHistoryQuery(scope, filters);\n const statsQuery = useHistoryStatsQuery(scope, filters);\n const detailQuery = useExecutionDetailQuery(selected);\n\n const executions = listQuery.data?.executions ?? [];\n const offset = filters.offset;\n const hasMore = listQuery.data?.hasMore ?? false;\n\n /** Every filter change but paging reports a fresh filter set and resets\n * the page to the first. */\n const applyFilters = (next: ExecutionFilterValue) => {\n onFiltersChange({ ...next, offset: 0 });\n };\n\n const onChange = (next: ExecutionFilterValue) => {\n if (next.q === q) {\n applyFilters(next);\n return;\n }\n setQ(next.q);\n if (searchTimer.current) clearTimeout(searchTimer.current);\n searchTimer.current = setTimeout(() => {\n searchTimer.current = null;\n onFiltersChange({ ...filtersRef.current, q: next.q, offset: 0 });\n }, SEARCH_DEBOUNCE_MS);\n };\n\n const onPrev = () =>\n onFiltersChange({ ...filters, q, offset: Math.max(0, offset - HISTORY_PAGE_SIZE) });\n const onNext = () => onFiltersChange({ ...filters, q, offset: offset + HISTORY_PAGE_SIZE });\n\n const onSelect = useCallback(\n (executionId: string) => {\n setSelected(executions.find((row) => row.id === executionId) ?? null);\n },\n [executions],\n );\n\n const filterValue: ExecutionFilterValue = {\n status: filters.status,\n kind: filters.kind,\n from: filters.from,\n to: filters.to,\n q,\n };\n\n // A workflow run is the only execution with a visual editor to jump into\n // — a function/endpoint invocation has no such surface.\n const openInEditor =\n selected?.kind === \"workflow\" && onOpenInEditor ? () => onOpenInEditor(selected) : undefined;\n\n return (\n <>\n <ExecutionStats stats={statsQuery.data ?? null} />\n\n <ExecutionFilters showKind={showKind} value={filterValue} onChange={onChange} />\n\n {listQuery.isError && (\n <p className=\"error\" data-testid=\"history-error\">\n Couldn't load execution history.\n </p>\n )}\n\n <ExecutionList\n items={executions}\n showCallable={showKind}\n loading={listQuery.isLoading}\n selectedId={selected?.id ?? null}\n hasPrev={offset > 0}\n hasNext={hasMore}\n onPrev={onPrev}\n onNext={onNext}\n onSelect={onSelect}\n />\n\n {selected && (\n <ExecutionDetail\n execution={detailQuery.data ?? null}\n loading={detailQuery.isLoading}\n errorMessage={detailQuery.isError ? \"This execution is no longer available.\" : undefined}\n onClose={() => setSelected(null)}\n onOpenInEditor={openInEditor}\n />\n )}\n </>\n );\n}\n","/**\n * The canvas's app lookups, through the host-provided `W6WApi` (`useW6WApi()` — in an embed that\n * is `createW6WUiAdapter`'s, in Studio the facade, which delegates to the same store/repo).\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { type AppSummary, useW6WApi } from \"@w6w/ui\";\nimport { useMemo } from \"react\";\n\n/** The per-app actions query key — the repos export itself (one declaration, no copy). */\nexport { appActionsKey } from \"../repos/apps.ts\";\n\nconst NO_APPS: ReadonlyMap<string, AppSummary> = new Map();\n\n/** A bounded set of app records by id. Empty when the host's API has no `listAppsByIds`. */\nexport function useEditorApps(ids: readonly string[]): { byId: ReadonlyMap<string, AppSummary> } {\n const api = useW6WApi();\n const list = api.listAppsByIds?.bind(api);\n const key = [...ids].sort().join(\",\");\n const q = useQuery({\n queryKey: [\"editor-apps\", key],\n queryFn: ({ signal }) => (list ? list(ids, { signal }) : Promise.resolve([] as AppSummary[])),\n enabled: ids.length > 0 && typeof list === \"function\",\n });\n const data = q.data;\n const byId = useMemo(\n () => (data ? new Map(data.map((a) => [a.id, a] as const)) : NO_APPS),\n [data],\n );\n return { byId };\n}\n\n/**\n * One app record by id, over {@link useEditorApps} (same `/apps` request, same cache entry as the\n * canvas's batch lookup). `undefined` while loading, for an empty id (which issues no request),\n * or when the host's API cannot look apps up by id.\n */\nexport function useEditorApp(id: string): AppSummary | undefined {\n const { byId } = useEditorApps(id ? [id] : []);\n return id ? byId.get(id) : undefined;\n}\n"],"names":["SEARCH_DEBOUNCE_MS","HistoryView","props","scope","showKind","filters","onFiltersChange","onOpenInEditor","filtersRef","useRef","q","setQ","useState","searchTimer","selected","setSelected","useEffect","listQuery","useHistoryQuery","statsQuery","useHistoryStatsQuery","detailQuery","useExecutionDetailQuery","executions","_a","offset","hasMore","_b","applyFilters","next","onChange","onPrev","HISTORY_PAGE_SIZE","onNext","onSelect","useCallback","executionId","row","filterValue","openInEditor","jsxs","Fragment","jsx","ExecutionStats","ExecutionFilters","ExecutionList","ExecutionDetail","NO_APPS","useEditorApps","ids","api","useW6WApi","list","key","data","useQuery","signal","useMemo","a","useEditorApp","id","byId"],"mappings":";;;;;;AAgDA,MAAMA,IAAqB;AAgBpB,SAASC,GAAYC,GAAyB;;AACnD,QAAM,EAAE,OAAAC,GAAO,UAAAC,GAAU,SAAAC,GAAS,iBAAAC,GAAiB,gBAAAC,MAAmBL,GAKhEM,IAAaC,EAAOJ,CAAO;AACjC,EAAAG,EAAW,UAAUH;AAErB,QAAM,CAACK,GAAGC,CAAI,IAAIC,EAASP,EAAQ,CAAC,GAC9BQ,IAAcJ,EAA6C,IAAI,GAC/D,CAACK,GAAUC,CAAW,IAAIH,EAAkC,IAAI;AAMtE,EAAAI,EAAU,MAAM;AACd,IAAAL,EAAKN,EAAQ,CAAC;AAAA,EAChB,GAAG,CAACA,EAAQ,CAAC,CAAC,GAGdW;AAAA,IACE,MAAM,MAAM;AACV,MAAIH,EAAY,WAAS,aAAaA,EAAY,OAAO;AAAA,IAC3D;AAAA,IACA,CAAA;AAAA,EAAC;AAGH,QAAMI,IAAYC,EAAgBf,GAAOE,CAAO,GAC1Cc,IAAaC,EAAqBjB,GAAOE,CAAO,GAChDgB,IAAcC,EAAwBR,CAAQ,GAE9CS,MAAaC,IAAAP,EAAU,SAAV,gBAAAO,EAAgB,eAAc,CAAA,GAC3CC,IAASpB,EAAQ,QACjBqB,MAAUC,IAAAV,EAAU,SAAV,gBAAAU,EAAgB,YAAW,IAIrCC,IAAe,CAACC,MAA+B;AACnD,IAAAvB,EAAgB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