@w6w/embed 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{ImportSpecModal-Cpzp8ndt.js → ImportSpecModal-VdYN1QeZ.js} +21 -20
  2. package/dist/{ImportSpecModal-Cpzp8ndt.js.map → ImportSpecModal-VdYN1QeZ.js.map} +1 -1
  3. package/dist/{WorkflowEditor-LesBKjb2.js → WorkflowEditor-CGKoeSG7.js} +6 -6
  4. package/dist/{WorkflowEditor-LesBKjb2.js.map → WorkflowEditor-CGKoeSG7.js.map} +1 -1
  5. package/dist/{apps-CYUgEfGf.js → apps-FMcQfyL2.js} +2 -2
  6. package/dist/{apps-CYUgEfGf.js.map → apps-FMcQfyL2.js.map} +1 -1
  7. package/dist/chrome/ImportSpecModal.d.ts +2 -0
  8. package/dist/{credentials-Cn92LGhJ.js → credentials-CMR_wEvx.js} +96 -71
  9. package/dist/credentials-CMR_wEvx.js.map +1 -0
  10. package/dist/editor-apps-HEOclsxL.js +152 -0
  11. package/dist/{editor-apps-LZmDWMqf.js.map → editor-apps-HEOclsxL.js.map} +1 -1
  12. package/dist/{editor-tools-DHyWiG21.js → editor-tools-Brw0cv2F.js} +4 -4
  13. package/dist/{editor-tools-DHyWiG21.js.map → editor-tools-Brw0cv2F.js.map} +1 -1
  14. package/dist/editor.mjs +1 -1
  15. package/dist/editors.mjs +7 -7
  16. package/dist/index.mjs +15 -15
  17. package/dist/lists/ConnectionList.d.ts +3 -1
  18. package/dist/lists/CredentialCreate.d.ts +25 -0
  19. package/dist/lists/CredentialDetail.d.ts +5 -1
  20. package/dist/lists/CredentialList.d.ts +3 -1
  21. package/dist/lists.d.ts +2 -0
  22. package/dist/lists.mjs +1035 -862
  23. package/dist/lists.mjs.map +1 -1
  24. package/dist/rail.mjs +1 -1
  25. package/dist/repos/credentials.d.ts +16 -2
  26. package/dist/repos.mjs +157 -153
  27. package/dist/{spec-export-DGigBUsP.js → spec-export-DMMET5VM.js} +2 -2
  28. package/dist/{spec-export-DGigBUsP.js.map → spec-export-DMMET5VM.js.map} +1 -1
  29. package/dist/{workflows-BK6IM4if.js → workflows-Dz8LMjnt.js} +37 -34
  30. package/dist/workflows-Dz8LMjnt.js.map +1 -0
  31. package/package.json +2 -2
  32. package/dist/credentials-Cn92LGhJ.js.map +0 -1
  33. package/dist/editor-apps-LZmDWMqf.js +0 -152
  34. package/dist/workflows-BK6IM4if.js.map +0 -1
@@ -29,10 +29,10 @@ const z = {
29
29
  goto: "workflows-import-goto"
30
30
  }
31
31
  };
32
- function te(a) {
33
- const { kind: s } = a, d = z[s], f = Q[s], [v, P] = p(""), [N, r] = p(null), [m, k] = p(null), [l, c] = p(null), [C, y] = p(null), h = K(a.project, a.listKeys), b = V(a.project), { parsed: g, blockedReason: u } = R(v, s), j = l !== null, w = !j || !F(l) || u !== null || h.isPending;
32
+ function te(l) {
33
+ const { kind: s } = l, d = z[s], h = Q[s], [v, P] = p(""), [N, r] = p(null), [m, C] = p(null), [a, c] = p(null), [k, y] = p(null), f = K(l.project, l.listKeys), b = V(l.project), { parsed: g, blockedReason: u } = R(v, s), j = a !== null, w = !j || !F(a) || u !== null || f.isPending;
34
34
  function S(e) {
35
- P(e), k(null), r(null), c(null);
35
+ P(e), C(null), r(null), c(null);
36
36
  }
37
37
  function E() {
38
38
  u !== null || g === null || b.isPending || (r(null), b.mutate(g, {
@@ -46,18 +46,18 @@ function te(a) {
46
46
  e && e.text().then(S, (n) => r(String(n)));
47
47
  }
48
48
  function $(e) {
49
- a.onClose(), a.onOpenImported(s, e);
49
+ l.onClose(), l.onOpenImported(s, e);
50
50
  }
51
51
  function T() {
52
- l === null || u !== null || g === null || h.isPending || (r(null), k(null), h.mutate(
53
- { document: g, selections: B(l) },
52
+ a === null || u !== null || g === null || f.isPending || (r(null), C(null), f.mutate(
53
+ { document: g, selections: B(a) },
54
54
  {
55
55
  onSuccess: (e) => {
56
56
  if (e.references.every((o) => o.resolved)) {
57
57
  $(e.callable.id);
58
58
  return;
59
59
  }
60
- k({
60
+ C({
61
61
  callableId: e.callable.id,
62
62
  references: e.references.filter((o) => !o.resolved)
63
63
  });
@@ -73,7 +73,7 @@ function te(a) {
73
73
  function O(e, n) {
74
74
  c((o) => o && (n === "unconfigured" ? D(o, e.key) : n === "create" ? x(o, e.key, e.createName) : J(o, e.key, n.slice(5))));
75
75
  }
76
- return /* @__PURE__ */ i(q, { title: `Import ${s}`, onClose: a.onClose, wide: !0, children: [
76
+ return /* @__PURE__ */ i(q, { title: `Import ${s}`, onClose: l.onClose, wide: !0, children: [
77
77
  /* @__PURE__ */ i("div", { className: "modal-body", children: [
78
78
  /* @__PURE__ */ i("p", { className: "muted small", children: [
79
79
  "Paste a portable ",
@@ -87,7 +87,7 @@ function te(a) {
87
87
  ] }),
88
88
  "). A fresh id is minted here; connection references are re-bound to whatever this account already has connected, and anything that couldn't be re-bound is reported below."
89
89
  ] }),
90
- /* @__PURE__ */ t("div", { "data-testid": f.json, children: /* @__PURE__ */ t(
90
+ /* @__PURE__ */ t("div", { "data-testid": h.json, children: /* @__PURE__ */ t(
91
91
  G,
92
92
  {
93
93
  value: v,
@@ -116,12 +116,12 @@ function te(a) {
116
116
  ] }),
117
117
  u && v !== "" && /* @__PURE__ */ t("p", { className: "muted small", children: u }),
118
118
  N && /* @__PURE__ */ t("div", { className: "result error", children: N }),
119
- l && l.length === 0 && /* @__PURE__ */ i("p", { className: "muted small", "data-testid": `${d}-import-nodeps`, children: [
119
+ a && a.length === 0 && /* @__PURE__ */ i("p", { className: "muted small", "data-testid": `${d}-import-nodeps`, children: [
120
120
  "This ",
121
121
  s,
122
122
  " has no dependencies."
123
123
  ] }),
124
- l && l.length > 0 && /* @__PURE__ */ t("ul", { className: "list", "data-testid": `${d}-import-rows`, children: l.map((e) => /* @__PURE__ */ i("li", { "data-testid": `${d}-import-row-${e.key}`, children: [
124
+ a && a.length > 0 && /* @__PURE__ */ t("ul", { className: "list", "data-testid": `${d}-import-rows`, children: a.map((e) => /* @__PURE__ */ i("li", { "data-testid": `${d}-import-row-${e.key}`, children: [
125
125
  /* @__PURE__ */ t("code", { children: e.dep.name }),
126
126
  " ",
127
127
  /* @__PURE__ */ i("span", { className: "muted", children: [
@@ -167,20 +167,21 @@ function te(a) {
167
167
  ),
168
168
  e.dep.kind === "connection" && e.dep.app && /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: () => y(e), children: "Add connection" })
169
169
  ] }, e.key)) }),
170
- C && /* @__PURE__ */ t(
170
+ k && /* @__PURE__ */ t(
171
171
  H,
172
172
  {
173
- initialAppId: C.dep.app,
173
+ onCreateSharedCredential: l.onCreateSharedCredential,
174
+ initialAppId: k.dep.app,
174
175
  onClose: () => y(null),
175
176
  onCreated: ({ connectionId: e }) => {
176
- const n = C.key;
177
+ const n = k.key;
177
178
  c(
178
179
  (o) => o && L(o, n, e, e)
179
180
  ), y(null);
180
181
  }
181
182
  }
182
183
  ),
183
- m && /* @__PURE__ */ i("div", { className: "result", "data-testid": f.unresolved, children: [
184
+ m && /* @__PURE__ */ i("div", { className: "result", "data-testid": h.unresolved, children: [
184
185
  /* @__PURE__ */ i("p", { children: [
185
186
  "The ",
186
187
  s,
@@ -208,7 +209,7 @@ function te(a) {
208
209
  {
209
210
  type: "button",
210
211
  className: "btn",
211
- "data-testid": f.goto,
212
+ "data-testid": h.goto,
212
213
  onClick: () => $(m.callableId),
213
214
  children: [
214
215
  "Open the created ",
@@ -219,7 +220,7 @@ function te(a) {
219
220
  ] })
220
221
  ] }),
221
222
  /* @__PURE__ */ i("div", { className: "modal-actions", children: [
222
- /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: a.onClose, children: "Cancel" }),
223
+ /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: l.onClose, children: "Cancel" }),
223
224
  !j && /* @__PURE__ */ t(
224
225
  "button",
225
226
  {
@@ -236,10 +237,10 @@ function te(a) {
236
237
  {
237
238
  type: "button",
238
239
  className: "btn",
239
- "data-testid": f.submit,
240
+ "data-testid": h.submit,
240
241
  disabled: w,
241
242
  onClick: T,
242
- children: h.isPending ? "Importing…" : "Create"
243
+ children: f.isPending ? "Importing…" : "Create"
243
244
  }
244
245
  )
245
246
  ] })
@@ -248,4 +249,4 @@ function te(a) {
248
249
  export {
249
250
  te as I
250
251
  };
251
- //# sourceMappingURL=ImportSpecModal-Cpzp8ndt.js.map
252
+ //# sourceMappingURL=ImportSpecModal-VdYN1QeZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImportSpecModal-Cpzp8ndt.js","sources":["../src/chrome/ImportSpecModal.tsx"],"sourcesContent":["import {\n type ImportRow,\n type SpecImportKind,\n type SpecImportListKeys,\n buildRows,\n parseImportPaste,\n rowsReady,\n setBind,\n setCreateName,\n setUnconfigured,\n toSelections,\n withCreatedConnection,\n} from \"@w6w/embed/lib\";\nimport { ApiError } from \"@w6w/sdk\";\nimport { AddConnectionModal, JsonEditor } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport {\n type SpecImportReferenceReport,\n useImportSpecMutation,\n useSpecPreviewMutation,\n} from \"../repos/spec-import.ts\";\nimport { Modal } from \"./Modal.tsx\";\n\n/** The list route segment for each kind — `goto()`'s `<collection>/<id>` nav target. */\nconst COLLECTION: Record<SpecImportKind, \"functions\" | \"endpoints\" | \"workflows\"> = {\n function: \"functions\",\n endpoint: \"endpoints\",\n workflow: \"workflows\",\n};\n\n/**\n * P2's `<collection>-import-*` testid scheme, spelled out literally per kind rather than built by\n * string interpolation — so the Functions arm's four testids stay the exact byte strings\n * `functions-page-guards.test.cjs` (IM1–IM3) already asserts against, verifiable by a plain\n * substring search over this file rather than only by running the browser suite.\n */\nconst TESTIDS: Record<\n SpecImportKind,\n { json: string; submit: string; unresolved: string; goto: string }\n> = {\n function: {\n json: \"functions-import-json\",\n submit: \"functions-import-submit\",\n unresolved: \"functions-import-unresolved\",\n goto: \"functions-import-goto\",\n },\n endpoint: {\n json: \"endpoints-import-json\",\n submit: \"endpoints-import-submit\",\n unresolved: \"endpoints-import-unresolved\",\n goto: \"endpoints-import-goto\",\n },\n workflow: {\n json: \"workflows-import-json\",\n submit: \"workflows-import-submit\",\n unresolved: \"workflows-import-unresolved\",\n goto: \"workflows-import-goto\",\n },\n};\n\n/**\n * Import modal for the Functions, Endpoints and Workflows lists (T1.2.1, generalizing T3.2.1's\n * Functions-only `ImportFunctionModal`): paste a portable spec document (rfcs/function.md), POST\n * it to `/spec/import` and either land in the created resource's editor (every reference resolved)\n * or stay open with the unresolved-reference report (A5).\n *\n * **P1 — one parameterized component, not three.** The Function-specific surface was four strings,\n * one nav target and a testid prefix — forking it into three siblings would duplicate the state\n * machine below for no gain. The `kind` prop drives all of it: `parseImportPaste`'s expected kind,\n * the title/copy, the `goto()` navigation target (`<collection>/<id>`), and every testid (P2 — the\n * four `functions-import-*` ones this file used to hardcode keep matching byte-for-byte; see\n * `TESTIDS` above for why they are spelled out literally per kind rather than interpolated).\n *\n * Mirrors `FunctionIdentityModal.tsx` (note 3 — same studio-local `Modal`,\n * same `ApiError.message` handling, same \"the row was created, hand the\n * operator the id\" shape as `onCreated`) but is a structurally PARALLEL,\n * distinct trigger — not a second \"create a resource and land in its editor\"\n * flow built on top of it. It owns its own navigation (unlike the identity\n * modal, which reports back to the list) because A5's \"created but\n * partially resolved\" outcome has nowhere else to render the report: the\n * modal has to stay mounted to show it, so it is also the one place that can\n * decide whether and when to leave the list route.\n *\n * **A `201` whose `references` carry any `resolved: false` entry is NOT\n * \"done\" (A5)** — the near-miss this exists to kill is \"201 ⇒ close and\n * navigate\", which would hide exactly the unresolved-reference report the\n * intake asks for.\n */\nexport interface ImportSpecModalProps {\n kind: SpecImportKind;\n /** The host's current project (only the workflow list key reads it). */\n project: string | undefined;\n /** The three list query keys, injected by the host. */\n listKeys: SpecImportListKeys;\n /** Navigate to the imported row; the modal closes itself first. */\n onOpenImported: (kind: SpecImportKind, id: string) => void;\n onClose: () => void;\n}\n\nexport function ImportSpecModal(props: ImportSpecModalProps) {\n const { kind } = props;\n const collection = COLLECTION[kind];\n const testids = TESTIDS[kind];\n const [text, setText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const [unresolved, setUnresolved] = useState<{\n callableId: string;\n references: SpecImportReferenceReport[];\n } | null>(null);\n // Two steps: \"paste\" (parse → explicit Next → ONE preview request) then \"configure\" (rows).\n const [rows, setRows] = useState<ImportRow[] | null>(null);\n const [addingFor, setAddingFor] = useState<ImportRow | null>(null);\n const importMut = useImportSpecMutation(props.project, props.listKeys);\n const previewMut = useSpecPreviewMutation(props.project);\n\n const { parsed, blockedReason } = parseImportPaste(text, kind);\n const configuring = rows !== null;\n // Create is enabled ONLY after a successful preview (never a verbatim post).\n const disabled =\n !configuring || !rowsReady(rows) || blockedReason !== null || importMut.isPending;\n\n function edit(next: string) {\n setText(next);\n setUnresolved(null);\n setError(null);\n setRows(null);\n }\n\n function next() {\n if (blockedReason !== null || parsed === null || previewMut.isPending) return;\n setError(null);\n previewMut.mutate(parsed as Record<string, unknown>, {\n onSuccess: (res) => setRows(buildRows(res.dependencies)),\n onError: (e) => {\n setRows(null);\n setError(e instanceof ApiError ? e.message : String(e));\n },\n });\n }\n\n function onFile(file: File | undefined) {\n if (!file) return;\n file.text().then(edit, (e) => setError(String(e)));\n }\n\n function goto(id: string) {\n props.onClose();\n props.onOpenImported(kind, id);\n }\n\n function submit() {\n // Defensive, not decorative: a forced click (e.g. `dispatchEvent`) on a\n // disabled button must still issue zero requests (A3, IM1(a)/(b)).\n if (rows === null || blockedReason !== null || parsed === null || importMut.isPending) return;\n setError(null);\n setUnresolved(null);\n // The parsed paste plus EVERY row's selection (`unconfigured` included).\n importMut.mutate(\n { document: parsed as Record<string, unknown>, selections: toSelections(rows) },\n {\n onSuccess: (result) => {\n const allResolved = result.references.every((r) => r.resolved);\n if (allResolved) {\n goto(result.callable.id);\n return;\n }\n // Kept open (A5): the resource WAS created, but at least one\n // reference did not bind — report every unresolved entry, and give\n // the operator an explicit way to still reach the row.\n setUnresolved({\n callableId: result.callable.id,\n references: result.references.filter((r) => !r.resolved),\n });\n },\n onError: (e) => setError(e instanceof ApiError ? e.message : String(e)),\n },\n );\n }\n\n function selectValue(row: ImportRow): string {\n const s = row.selection;\n return s.mode === \"bind\" ? `bind:${s.target}` : s.mode;\n }\n\n function onPick(row: ImportRow, value: string) {\n setRows((cur) => {\n if (!cur) return cur;\n if (value === \"unconfigured\") return setUnconfigured(cur, row.key);\n if (value === \"create\") return setCreateName(cur, row.key, row.createName);\n return setBind(cur, row.key, value.slice(\"bind:\".length));\n });\n }\n\n return (\n <Modal title={`Import ${kind}`} onClose={props.onClose} wide>\n <div className=\"modal-body\">\n <p className=\"muted small\">\n Paste a portable {kind} spec document (exported via{\" \"}\n <code>GET /{collection}/:id/spec</code>\n ). A fresh id is minted here; connection references are re-bound to whatever this account\n already has connected, and anything that couldn't be re-bound is reported below.\n </p>\n\n <div data-testid={testids.json}>\n <JsonEditor\n value={text}\n onChange={edit}\n minHeight=\"320px\"\n aria-label={`${kind} spec document JSON`}\n />\n </div>\n\n <label className=\"muted small\">\n Or choose a <code>.json</code> file:{\" \"}\n <input\n type=\"file\"\n accept=\".json,application/json\"\n data-testid={`${collection}-import-file`}\n onChange={(e) => onFile(e.target.files?.[0])}\n />\n </label>\n\n {blockedReason && text !== \"\" && <p className=\"muted small\">{blockedReason}</p>}\n {error && <div className=\"result error\">{error}</div>}\n\n {rows && rows.length === 0 && (\n <p className=\"muted small\" data-testid={`${collection}-import-nodeps`}>\n This {kind} has no dependencies.\n </p>\n )}\n {rows && rows.length > 0 && (\n <ul className=\"list\" data-testid={`${collection}-import-rows`}>\n {rows.map((row) => (\n <li key={row.key} data-testid={`${collection}-import-row-${row.key}`}>\n <code>{row.dep.name}</code> <span className=\"muted\">({row.dep.kind})</span>{\" \"}\n {row.dep.dynamic ? (\n <span className=\"muted small\">\n Dynamic store name — configure it manually after import.\n </span>\n ) : null}\n <select\n value={selectValue(row)}\n onChange={(e) => onPick(row, e.target.value)}\n aria-label={`Configure ${row.dep.name}`}\n >\n <option value=\"unconfigured\">Leave unconfigured</option>\n {!row.dep.dynamic &&\n row.options.map((o) => (\n <option\n key={o.id}\n value={`bind:${o.id}`}\n disabled={o.compatible === false}\n title={o.reason}\n >\n {o.label}\n {o.compatible === false && o.reason ? ` — ${o.reason}` : \"\"}\n </option>\n ))}\n {row.dep.kind === \"store\" && row.dep.canCreate && !row.dep.dynamic && (\n <option value=\"create\">Create new</option>\n )}\n </select>\n {row.selection.mode === \"create\" && (\n <input\n type=\"text\"\n value={row.selection.name}\n aria-label={`New name for ${row.dep.name}`}\n onChange={(e) =>\n setRows((cur) => (cur ? setCreateName(cur, row.key, e.target.value) : cur))\n }\n />\n )}\n {row.dep.kind === \"connection\" && row.dep.app && (\n <button type=\"button\" className=\"btn ghost\" onClick={() => setAddingFor(row)}>\n Add connection\n </button>\n )}\n </li>\n ))}\n </ul>\n )}\n {addingFor && (\n <AddConnectionModal\n initialAppId={addingFor.dep.app}\n onClose={() => setAddingFor(null)}\n onCreated={({ connectionId }) => {\n // Append the new connection as an option and bind the row to it (no re-preview).\n const key = addingFor.key;\n setRows((cur) =>\n cur ? withCreatedConnection(cur, key, connectionId, connectionId) : cur,\n );\n setAddingFor(null);\n }}\n />\n )}\n\n {unresolved && (\n <div className=\"result\" data-testid={testids.unresolved}>\n <p>\n The {kind} was created, but {unresolved.references.length} reference\n {unresolved.references.length === 1 ? \"\" : \"s\"} could not be resolved:\n </p>\n <ul className=\"list\">\n {unresolved.references.map((r) => (\n <li key={r.path}>\n <code>{r.path}</code> <span className=\"muted\">({r.kind})</span>\n {r.reason && <span className=\"muted\"> — {r.reason}</span>}\n </li>\n ))}\n </ul>\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={testids.goto}\n onClick={() => goto(unresolved.callableId)}\n >\n Open the created {kind}\n </button>\n </div>\n )}\n </div>\n\n <div className=\"modal-actions\">\n <button type=\"button\" className=\"btn ghost\" onClick={props.onClose}>\n Cancel\n </button>\n {!configuring && (\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={`${collection}-import-next`}\n disabled={blockedReason !== null || previewMut.isPending}\n onClick={next}\n >\n {previewMut.isPending ? \"Checking…\" : \"Next\"}\n </button>\n )}\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={testids.submit}\n disabled={disabled}\n onClick={submit}\n >\n {importMut.isPending ? \"Importing…\" : \"Create\"}\n </button>\n </div>\n </Modal>\n );\n}\n"],"names":["COLLECTION","TESTIDS","ImportSpecModal","props","kind","collection","testids","text","setText","useState","error","setError","unresolved","setUnresolved","rows","setRows","addingFor","setAddingFor","importMut","useImportSpecMutation","previewMut","useSpecPreviewMutation","parsed","blockedReason","parseImportPaste","configuring","disabled","rowsReady","edit","next","res","buildRows","ApiError","onFile","file","e","goto","id","submit","toSelections","result","r","selectValue","row","s","onPick","value","cur","setUnconfigured","setCreateName","setBind","jsxs","Modal","jsx","JsonEditor","_a","o","AddConnectionModal","connectionId","key","withCreatedConnection"],"mappings":";;;;;;;AAwBA,MAAMA,IAA8E;AAAA,EAClF,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ,GAQMC,IAGF;AAAA,EACF,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAEV;AAyCO,SAASC,GAAgBC,GAA6B;AAC3D,QAAM,EAAE,MAAAC,MAASD,GACXE,IAAaL,EAAWI,CAAI,GAC5BE,IAAUL,EAAQG,CAAI,GACtB,CAACG,GAAMC,CAAO,IAAIC,EAAS,EAAE,GAC7B,C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Modal.tsx"],"sourcesContent":["import {\n type ImportRow,\n type SpecImportKind,\n type SpecImportListKeys,\n buildRows,\n parseImportPaste,\n rowsReady,\n setBind,\n setCreateName,\n setUnconfigured,\n toSelections,\n withCreatedConnection,\n} from \"@w6w/embed/lib\";\nimport { ApiError } from \"@w6w/sdk\";\nimport { AddConnectionModal, JsonEditor } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport {\n type SpecImportReferenceReport,\n useImportSpecMutation,\n useSpecPreviewMutation,\n} from \"../repos/spec-import.ts\";\nimport { Modal } from \"./Modal.tsx\";\n\n/** The list route segment for each kind — `goto()`'s `<collection>/<id>` nav target. */\nconst COLLECTION: Record<SpecImportKind, \"functions\" | \"endpoints\" | \"workflows\"> = {\n function: \"functions\",\n endpoint: \"endpoints\",\n workflow: \"workflows\",\n};\n\n/**\n * P2's `<collection>-import-*` testid scheme, spelled out literally per kind rather than built by\n * string interpolation — so the Functions arm's four testids stay the exact byte strings\n * `functions-page-guards.test.cjs` (IM1–IM3) already asserts against, verifiable by a plain\n * substring search over this file rather than only by running the browser suite.\n */\nconst TESTIDS: Record<\n SpecImportKind,\n { json: string; submit: string; unresolved: string; goto: string }\n> = {\n function: {\n json: \"functions-import-json\",\n submit: \"functions-import-submit\",\n unresolved: \"functions-import-unresolved\",\n goto: \"functions-import-goto\",\n },\n endpoint: {\n json: \"endpoints-import-json\",\n submit: \"endpoints-import-submit\",\n unresolved: \"endpoints-import-unresolved\",\n goto: \"endpoints-import-goto\",\n },\n workflow: {\n json: \"workflows-import-json\",\n submit: \"workflows-import-submit\",\n unresolved: \"workflows-import-unresolved\",\n goto: \"workflows-import-goto\",\n },\n};\n\n/**\n * Import modal for the Functions, Endpoints and Workflows lists (T1.2.1, generalizing T3.2.1's\n * Functions-only `ImportFunctionModal`): paste a portable spec document (rfcs/function.md), POST\n * it to `/spec/import` and either land in the created resource's editor (every reference resolved)\n * or stay open with the unresolved-reference report (A5).\n *\n * **P1 — one parameterized component, not three.** The Function-specific surface was four strings,\n * one nav target and a testid prefix — forking it into three siblings would duplicate the state\n * machine below for no gain. The `kind` prop drives all of it: `parseImportPaste`'s expected kind,\n * the title/copy, the `goto()` navigation target (`<collection>/<id>`), and every testid (P2 — the\n * four `functions-import-*` ones this file used to hardcode keep matching byte-for-byte; see\n * `TESTIDS` above for why they are spelled out literally per kind rather than interpolated).\n *\n * Mirrors `FunctionIdentityModal.tsx` (note 3 — same studio-local `Modal`,\n * same `ApiError.message` handling, same \"the row was created, hand the\n * operator the id\" shape as `onCreated`) but is a structurally PARALLEL,\n * distinct trigger — not a second \"create a resource and land in its editor\"\n * flow built on top of it. It owns its own navigation (unlike the identity\n * modal, which reports back to the list) because A5's \"created but\n * partially resolved\" outcome has nowhere else to render the report: the\n * modal has to stay mounted to show it, so it is also the one place that can\n * decide whether and when to leave the list route.\n *\n * **A `201` whose `references` carry any `resolved: false` entry is NOT\n * \"done\" (A5)** — the near-miss this exists to kill is \"201 ⇒ close and\n * navigate\", which would hide exactly the unresolved-reference report the\n * intake asks for.\n */\nexport interface ImportSpecModalProps {\n kind: SpecImportKind;\n /** The host's current project (only the workflow list key reads it). */\n project: string | undefined;\n /** The three list query keys, injected by the host. */\n listKeys: SpecImportListKeys;\n /** Navigate to the imported row; the modal closes itself first. */\n onOpenImported: (kind: SpecImportKind, id: string) => void;\n onClose: () => void;\n /** Optional: where the connect form's Use existing empty state sends the user. */\n onCreateSharedCredential?: () => void;\n}\n\nexport function ImportSpecModal(props: ImportSpecModalProps) {\n const { kind } = props;\n const collection = COLLECTION[kind];\n const testids = TESTIDS[kind];\n const [text, setText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const [unresolved, setUnresolved] = useState<{\n callableId: string;\n references: SpecImportReferenceReport[];\n } | null>(null);\n // Two steps: \"paste\" (parse → explicit Next → ONE preview request) then \"configure\" (rows).\n const [rows, setRows] = useState<ImportRow[] | null>(null);\n const [addingFor, setAddingFor] = useState<ImportRow | null>(null);\n const importMut = useImportSpecMutation(props.project, props.listKeys);\n const previewMut = useSpecPreviewMutation(props.project);\n\n const { parsed, blockedReason } = parseImportPaste(text, kind);\n const configuring = rows !== null;\n // Create is enabled ONLY after a successful preview (never a verbatim post).\n const disabled =\n !configuring || !rowsReady(rows) || blockedReason !== null || importMut.isPending;\n\n function edit(next: string) {\n setText(next);\n setUnresolved(null);\n setError(null);\n setRows(null);\n }\n\n function next() {\n if (blockedReason !== null || parsed === null || previewMut.isPending) return;\n setError(null);\n previewMut.mutate(parsed as Record<string, unknown>, {\n onSuccess: (res) => setRows(buildRows(res.dependencies)),\n onError: (e) => {\n setRows(null);\n setError(e instanceof ApiError ? e.message : String(e));\n },\n });\n }\n\n function onFile(file: File | undefined) {\n if (!file) return;\n file.text().then(edit, (e) => setError(String(e)));\n }\n\n function goto(id: string) {\n props.onClose();\n props.onOpenImported(kind, id);\n }\n\n function submit() {\n // Defensive, not decorative: a forced click (e.g. `dispatchEvent`) on a\n // disabled button must still issue zero requests (A3, IM1(a)/(b)).\n if (rows === null || blockedReason !== null || parsed === null || importMut.isPending) return;\n setError(null);\n setUnresolved(null);\n // The parsed paste plus EVERY row's selection (`unconfigured` included).\n importMut.mutate(\n { document: parsed as Record<string, unknown>, selections: toSelections(rows) },\n {\n onSuccess: (result) => {\n const allResolved = result.references.every((r) => r.resolved);\n if (allResolved) {\n goto(result.callable.id);\n return;\n }\n // Kept open (A5): the resource WAS created, but at least one\n // reference did not bind — report every unresolved entry, and give\n // the operator an explicit way to still reach the row.\n setUnresolved({\n callableId: result.callable.id,\n references: result.references.filter((r) => !r.resolved),\n });\n },\n onError: (e) => setError(e instanceof ApiError ? e.message : String(e)),\n },\n );\n }\n\n function selectValue(row: ImportRow): string {\n const s = row.selection;\n return s.mode === \"bind\" ? `bind:${s.target}` : s.mode;\n }\n\n function onPick(row: ImportRow, value: string) {\n setRows((cur) => {\n if (!cur) return cur;\n if (value === \"unconfigured\") return setUnconfigured(cur, row.key);\n if (value === \"create\") return setCreateName(cur, row.key, row.createName);\n return setBind(cur, row.key, value.slice(\"bind:\".length));\n });\n }\n\n return (\n <Modal title={`Import ${kind}`} onClose={props.onClose} wide>\n <div className=\"modal-body\">\n <p className=\"muted small\">\n Paste a portable {kind} spec document (exported via{\" \"}\n <code>GET /{collection}/:id/spec</code>\n ). A fresh id is minted here; connection references are re-bound to whatever this account\n already has connected, and anything that couldn't be re-bound is reported below.\n </p>\n\n <div data-testid={testids.json}>\n <JsonEditor\n value={text}\n onChange={edit}\n minHeight=\"320px\"\n aria-label={`${kind} spec document JSON`}\n />\n </div>\n\n <label className=\"muted small\">\n Or choose a <code>.json</code> file:{\" \"}\n <input\n type=\"file\"\n accept=\".json,application/json\"\n data-testid={`${collection}-import-file`}\n onChange={(e) => onFile(e.target.files?.[0])}\n />\n </label>\n\n {blockedReason && text !== \"\" && <p className=\"muted small\">{blockedReason}</p>}\n {error && <div className=\"result error\">{error}</div>}\n\n {rows && rows.length === 0 && (\n <p className=\"muted small\" data-testid={`${collection}-import-nodeps`}>\n This {kind} has no dependencies.\n </p>\n )}\n {rows && rows.length > 0 && (\n <ul className=\"list\" data-testid={`${collection}-import-rows`}>\n {rows.map((row) => (\n <li key={row.key} data-testid={`${collection}-import-row-${row.key}`}>\n <code>{row.dep.name}</code> <span className=\"muted\">({row.dep.kind})</span>{\" \"}\n {row.dep.dynamic ? (\n <span className=\"muted small\">\n Dynamic store name — configure it manually after import.\n </span>\n ) : null}\n <select\n value={selectValue(row)}\n onChange={(e) => onPick(row, e.target.value)}\n aria-label={`Configure ${row.dep.name}`}\n >\n <option value=\"unconfigured\">Leave unconfigured</option>\n {!row.dep.dynamic &&\n row.options.map((o) => (\n <option\n key={o.id}\n value={`bind:${o.id}`}\n disabled={o.compatible === false}\n title={o.reason}\n >\n {o.label}\n {o.compatible === false && o.reason ? ` — ${o.reason}` : \"\"}\n </option>\n ))}\n {row.dep.kind === \"store\" && row.dep.canCreate && !row.dep.dynamic && (\n <option value=\"create\">Create new</option>\n )}\n </select>\n {row.selection.mode === \"create\" && (\n <input\n type=\"text\"\n value={row.selection.name}\n aria-label={`New name for ${row.dep.name}`}\n onChange={(e) =>\n setRows((cur) => (cur ? setCreateName(cur, row.key, e.target.value) : cur))\n }\n />\n )}\n {row.dep.kind === \"connection\" && row.dep.app && (\n <button type=\"button\" className=\"btn ghost\" onClick={() => setAddingFor(row)}>\n Add connection\n </button>\n )}\n </li>\n ))}\n </ul>\n )}\n {addingFor && (\n <AddConnectionModal\n onCreateSharedCredential={props.onCreateSharedCredential}\n initialAppId={addingFor.dep.app}\n onClose={() => setAddingFor(null)}\n onCreated={({ connectionId }) => {\n // Append the new connection as an option and bind the row to it (no re-preview).\n const key = addingFor.key;\n setRows((cur) =>\n cur ? withCreatedConnection(cur, key, connectionId, connectionId) : cur,\n );\n setAddingFor(null);\n }}\n />\n )}\n\n {unresolved && (\n <div className=\"result\" data-testid={testids.unresolved}>\n <p>\n The {kind} was created, but {unresolved.references.length} reference\n {unresolved.references.length === 1 ? \"\" : \"s\"} could not be resolved:\n </p>\n <ul className=\"list\">\n {unresolved.references.map((r) => (\n <li key={r.path}>\n <code>{r.path}</code> <span className=\"muted\">({r.kind})</span>\n {r.reason && <span className=\"muted\"> — {r.reason}</span>}\n </li>\n ))}\n </ul>\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={testids.goto}\n onClick={() => goto(unresolved.callableId)}\n >\n Open the created {kind}\n </button>\n </div>\n )}\n </div>\n\n <div className=\"modal-actions\">\n <button type=\"button\" className=\"btn ghost\" onClick={props.onClose}>\n Cancel\n </button>\n {!configuring && (\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={`${collection}-import-next`}\n disabled={blockedReason !== null || previewMut.isPending}\n onClick={next}\n >\n {previewMut.isPending ? \"Checking…\" : \"Next\"}\n </button>\n )}\n <button\n type=\"button\"\n className=\"btn\"\n data-testid={testids.submit}\n disabled={disabled}\n onClick={submit}\n >\n {importMut.isPending ? \"Importing…\" : \"Create\"}\n </button>\n </div>\n </Modal>\n );\n}\n"],"names":["COLLECTION","TESTIDS","ImportSpecModal","props","kind","collection","testids","text","setText","useState","error","setError","unresolved","setUnresolved","rows","setRows","addingFor","setAddingFor","importMut","useImportSpecMutation","previewMut","useSpecPreviewMutation","parsed","blockedReason","parseImportPaste","configuring","disabled","rowsReady","edit","next","res","buildRows","ApiError","onFile","file","e","goto","id","submit","toSelections","result","r","selectValue","row","s","onPick","value","cur","setUnconfigured","setCreateName","setBind","jsxs","Modal","jsx","JsonEditor","_a","o","AddConnectionModal","connectionId","key","withCreatedConnection"],"mappings":";;;;;;;AAwBA,MAAMA,IAA8E;AAAA,EAClF,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ,GAQMC,IAGF;AAAA,EACF,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,EAAA;AAEV;AA2CO,SAASC,GAAgBC,GAA6B;AAC3D,QAAM,EAAE,MAAAC,MAASD,GACXE,IAAaL,EAAWI,CAAI,GAC5BE,IAAUL,EAAQG,CAAI,GACtB,CAACG,GAAMC,CAAO,IAAIC,EAAS,EAAE,GAC7B,CAACC,GAAOC,CAAQ,IAAIF,EAAwB,IAAI,GAChD,CAACG,GAAYC,CAAa,IAAIJ,EAG1B,IAAI,GAER,CAACK,GAAMC,CAAO,IAAIN,EAA6B,IAAI,GACnD,CAACO,GAAWC,CAAY,IAAIR,EAA2B,IAAI,GAC3DS,IAAYC,EAAsBhB,EAAM,SAASA,EAAM,QAAQ,GAC/DiB,IAAaC,EAAuBlB,EAAM,OAAO,GAEjD,EAAE,QAAAmB,GAAQ,eAAAC,EAAA,IAAkBC,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YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,eAAa7C,EAAQ;AAAA,YACrB,SAAS,MAAM8B,EAAKxB,EAAW,UAAU;AAAA,YAC1C,UAAA;AAAA,cAAA;AAAA,cACmBR;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACpB,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAA+C,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAA,EAAO,MAAK,UAAS,WAAU,aAAY,SAASlD,EAAM,SAAS,UAAA,SAAA,CAEpE;AAAA,MACC,CAACsB,KACA,gBAAA4B;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,eAAa,GAAGhD,CAAU;AAAA,UAC1B,UAAUkB,MAAkB,QAAQH,EAAW;AAAA,UAC/C,SAASS;AAAA,UAER,UAAAT,EAAW,YAAY,cAAc;AAAA,QAAA;AAAA,MAAA;AAAA,MAG1C,gBAAAiC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,eAAa/C,EAAQ;AAAA,UACrB,UAAAoB;AAAA,UACA,SAASY;AAAA,UAER,UAAApB,EAAU,YAAY,eAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IACxC,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -3,10 +3,10 @@ import { useQueryClient as Ot, useQueries as Re } from "@tanstack/react-query";
3
3
  import { ApiError as Ce } from "@w6w/sdk";
4
4
  import { Modal as fn, IconButton as ce, JsonEditor as pn, useExpressionOptions as hn, ExpressionEditorModal as mn, useW6WApi as It, W6WUIProvider as bn, isTestRequired as Ct, requiredParamsFilled as gn, ExecutionLogPanel as yn, testInputSavesSettled as vn } from "@w6w/ui";
5
5
  import { useState as v, useMemo as w, createElement as J, useId as wn, useCallback as E, useContext as Sn, useRef as S, useEffect as T, Suspense as kn, lazy as Nn } from "react";
6
- import { E as En, $ as Rn, W as Cn, Q as Pn, V as An, q as Tn, X as jn, v as On, B as In, A as Fn, N as Ln, a as Mn, z as Jn, n as Dn, y as Bn, t as Wn, b as $n } from "./workflows-BK6IM4if.js";
7
- import { H as xn, a as Kn } from "./editor-apps-LZmDWMqf.js";
6
+ import { E as En, $ as Rn, W as Cn, Q as Pn, V as An, q as Tn, X as jn, v as On, B as In, A as Fn, N as Ln, a as Mn, z as Jn, n as Dn, y as Bn, t as Wn, b as $n } from "./workflows-Dz8LMjnt.js";
7
+ import { H as xn, a as Kn } from "./editor-apps-HEOclsxL.js";
8
8
  import { M as ue } from "./ConfirmModal-Pv2-A_3U.js";
9
- import { d as Qn, W as _n, e as qn, R as Hn, P as Vn, b as zn, c as Gn } from "./editor-tools-DHyWiG21.js";
9
+ import { d as Qn, W as _n, e as qn, R as Hn, P as Vn, b as zn, c as Gn } from "./editor-tools-Brw0cv2F.js";
10
10
  import { u as Yn } from "./client-context-CX61Bgw-.js";
11
11
  import { u as Un } from "./use-workflow-draft-l3P5KZzw.js";
12
12
  import { r as Xn, h as Zn, e as es, f as ts, a as ns, d as ss, b as os, p as is, i as rs, g as as } from "./setup-incomplete-BHs3Lpfy.js";
@@ -15,11 +15,11 @@ import { n as At } from "./import-bindings-EUtxZ9Ti.js";
15
15
  import { p as ds, d as fs } from "./settings-rail--GdRMusb.js";
16
16
  import { u as ps, b as hs } from "./project-context-Tvp-La7A.js";
17
17
  import { i as ms, d as Tt } from "./connections-CzsCyIxY.js";
18
- import { h as bs, b as gs, g as ys, d as vs, u as ws, e as Ss } from "./spec-export-DGigBUsP.js";
18
+ import { h as bs, b as gs, g as ys, d as vs, u as ws, e as Ss } from "./spec-export-DMMET5VM.js";
19
19
  import { l as jt, a as Pe, w as ks } from "./step-tests-B4E4W3ly.js";
20
20
  import { i as Ns, f as Es } from "./vault-BSEWhMYC.js";
21
21
  import { i as Rs } from "./data-stores-UeQvwVCa.js";
22
- import { e as Cs } from "./apps-CYUgEfGf.js";
22
+ import { e as Cs } from "./apps-FMcQfyL2.js";
23
23
  import { E as Ps } from "./theme-context-E2ZhlXDX.js";
24
24
  import { validateInitialState as As } from "@w6w/expr";
25
25
  function Ts({ title: n }) {
@@ -1114,4 +1114,4 @@ export {
1114
1114
  Ws as a,
1115
1115
  Fs as b
1116
1116
  };
1117
- //# sourceMappingURL=WorkflowEditor-LesBKjb2.js.map
1117
+ //# sourceMappingURL=WorkflowEditor-CGKoeSG7.js.map