@w6w/embed 0.2.33 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DocumentFormModal-Cw85R4wk.js → DocumentFormModal-B3OkvI5v.js} +2 -2
- package/dist/{DocumentFormModal-Cw85R4wk.js.map → DocumentFormModal-B3OkvI5v.js.map} +1 -1
- package/dist/{ImportSpecModal-fU5RsVTa.js → ImportSpecModal-SQvTwtcX.js} +2 -2
- package/dist/{ImportSpecModal-fU5RsVTa.js.map → ImportSpecModal-SQvTwtcX.js.map} +1 -1
- package/dist/WorkflowEditor-D2EfEP-U.js +1201 -0
- package/dist/WorkflowEditor-D2EfEP-U.js.map +1 -0
- package/dist/apps-CFWdgGst.js +106 -0
- package/dist/apps-CFWdgGst.js.map +1 -0
- package/dist/chrome/HistoryView.d.ts +3 -0
- package/dist/editor-apps-ShwCmvLY.js +178 -0
- package/dist/editor-apps-ShwCmvLY.js.map +1 -0
- package/dist/{editor-tools-Dn7TgCP4.js → editor-tools-rY9nddqr.js} +49 -49
- package/dist/{editor-tools-Dn7TgCP4.js.map → editor-tools-rY9nddqr.js.map} +1 -1
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +8 -8
- package/dist/index.mjs +4 -4
- package/dist/lib/history-query.d.ts +22 -1
- package/dist/lib/run-log-nodes.d.ts +43 -0
- package/dist/lists.mjs +6 -6
- package/dist/rail.mjs +1 -1
- package/dist/repos/history.d.ts +5 -1
- package/dist/repos.mjs +304 -300
- package/dist/{spec-import-CGPqUUjN.js → spec-import-CPbDnnuv.js} +2 -2
- package/dist/{spec-import-CGPqUUjN.js.map → spec-import-CPbDnnuv.js.map} +1 -1
- package/dist/{workflows-Dz8LMjnt.js → workflows-RhR8kwt7.js} +255 -214
- package/dist/workflows-RhR8kwt7.js.map +1 -0
- package/package.json +2 -2
- package/dist/WorkflowEditor-C7oudiIb.js +0 -1169
- package/dist/WorkflowEditor-C7oudiIb.js.map +0 -1
- package/dist/apps-FMcQfyL2.js +0 -92
- package/dist/apps-FMcQfyL2.js.map +0 -1
- package/dist/editor-apps-HEOclsxL.js +0 -152
- package/dist/editor-apps-HEOclsxL.js.map +0 -1
- package/dist/workflows-Dz8LMjnt.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { ApiError as Y } from "@w6w/sdk";
|
|
|
3
3
|
import { useEnterSubmit as J, JsonEditor as P, YamlEditor as R, CodeEditor as $ } from "@w6w/ui";
|
|
4
4
|
import { useState as l } from "react";
|
|
5
5
|
import { M as H } from "./ConfirmModal-WqBfWftD.js";
|
|
6
|
-
import { b as K, c as V } from "./spec-import-
|
|
6
|
+
import { b as K, c as V } from "./spec-import-CPbDnnuv.js";
|
|
7
7
|
const _ = ".txt,.md,.markdown,.yaml,.yml,.html,.htm,.json,.csv,text/*,application/json,application/yaml";
|
|
8
8
|
async function q(t) {
|
|
9
9
|
var d;
|
|
@@ -172,4 +172,4 @@ function Z(t) {
|
|
|
172
172
|
export {
|
|
173
173
|
Z as D
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=DocumentFormModal-
|
|
175
|
+
//# sourceMappingURL=DocumentFormModal-B3OkvI5v.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentFormModal-Cw85R4wk.js","sources":["../src/lib/document-upload.ts","../src/forms/DocumentFormModal.tsx"],"sourcesContent":["import type { DocFormat } from \"@w6w/sdk\";\n\nexport const DOCUMENT_FILE_ACCEPT =\n \".txt,.md,.markdown,.yaml,.yml,.html,.htm,.json,.csv,text/*,application/json,application/yaml\";\n\n/** Read text without silently turning a binary or invalid UTF-8 file into document content. */\nexport async function readDocumentFile(file: Pick<File, \"name\" | \"arrayBuffer\">): Promise<{\n key: string;\n format: DocFormat;\n content: string;\n}> {\n const extension = file.name.split(\".\").pop()?.toLowerCase() ?? \"\";\n const formats: Record<string, DocFormat> = {\n txt: \"text\",\n csv: \"text\",\n md: \"markdown\",\n markdown: \"markdown\",\n yaml: \"yaml\",\n yml: \"yaml\",\n html: \"html\",\n htm: \"html\",\n json: \"json\",\n };\n const format = formats[extension];\n if (!format)\n throw new Error(\n \"Choose a text, Markdown, YAML, HTML, JSON, or CSV file. Use Files for other file types.\",\n );\n let content: string;\n try {\n content = new TextDecoder(\"utf-8\", { fatal: true }).decode(await file.arrayBuffer());\n } catch {\n throw new Error(\"Could not read this file as UTF-8 text. Choose a UTF-8 text file.\");\n }\n if (content.includes(\"\\0\"))\n throw new Error(\"This file contains binary data. Upload it in Files instead.\");\n return {\n key:\n file.name\n .replace(/\\.[^.]+$/, \"\")\n .trim()\n .slice(0, 128) || \"document\",\n format,\n content,\n };\n}\n","/**\n * Create/edit modal for a document (internal: not exported from `@w6w/embed/forms`). Content is\n * stored verbatim in whatever format is selected, with no parsing or validation. The key is\n * immutable once set, so an edit never sends it.\n */\nimport { ApiError } from \"@w6w/sdk\";\nimport type { Doc, DocFormat } from \"@w6w/sdk\";\nimport { CodeEditor, JsonEditor, YamlEditor, useEnterSubmit } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport { Modal } from \"../chrome/Modal.tsx\";\nimport { DOCUMENT_FILE_ACCEPT, readDocumentFile } from \"../lib/document-upload.ts\";\nimport { useCreateDocumentMutation, useUpdateDocumentMutation } from \"../repos/documents.ts\";\n\nconst FORMATS: readonly DocFormat[] = [\"text\", \"markdown\", \"yaml\", \"html\", \"json\"];\n\nexport function DocumentFormModal(props: {\n initial?: Doc;\n /** The resolved project, or `null` (none yet): a save is refused, never sent project-less. */\n project: string | null;\n onClose: () => void;\n onSaved: () => void;\n}) {\n const isEdit = !!props.initial;\n const [key, setKey] = useState(props.initial?.key ?? \"\");\n const [format, setFormat] = useState<DocFormat>(props.initial?.format ?? \"text\");\n const [content, setContent] = useState(props.initial?.content ?? \"\");\n const [description, setDescription] = useState(props.initial?.description ?? \"\");\n const [error, setError] = useState<string | null>(null);\n const [source, setSource] = useState<\"paste\" | \"upload\">(\"paste\");\n const [reading, setReading] = useState(false);\n const [uploadedName, setUploadedName] = useState<string | null>(null);\n\n const createMut = useCreateDocumentMutation();\n const updateMut = useUpdateDocumentMutation();\n const saving = createMut.isPending || updateMut.isPending;\n const canSave =\n !!key.trim() && !saving && !reading && (source !== \"upload\" || uploadedName !== null);\n\n async function loadFile(file: File) {\n setReading(true);\n setError(null);\n setUploadedName(null);\n try {\n const document = await readDocumentFile(file);\n setKey((current) => current || document.key);\n setFormat(document.format);\n setContent(document.content);\n setUploadedName(file.name);\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Could not read this file.\");\n } finally {\n setReading(false);\n }\n }\n\n function save() {\n setError(null);\n if (props.project == null) {\n setError(\"No project selected: nothing was saved.\");\n return;\n }\n const onSettled = {\n onSuccess: () => props.onSaved(),\n onError: (e: unknown) => setError(e instanceof ApiError ? e.message : (e as Error).message),\n };\n if (props.initial) {\n updateMut.mutate(\n { id: props.initial.id, patch: { content, format, description }, project: props.project },\n onSettled,\n );\n return;\n }\n createMut.mutate(\n { input: { key: key.trim(), content, format, description }, project: props.project },\n onSettled,\n );\n }\n\n const enterSubmit = useEnterSubmit(save, { enabled: canSave });\n\n return (\n <Modal\n title={props.initial ? `Edit ${props.initial.key}` : \"Add document\"}\n onClose={props.onClose}\n >\n <div className=\"modal-body\">\n {!isEdit && (\n <>\n <div className=\"row\">\n <button\n type=\"button\"\n className={source === \"paste\" ? \"btn\" : \"btn ghost\"}\n disabled={saving || reading}\n aria-pressed={source === \"paste\"}\n onClick={() => setSource(\"paste\")}\n >\n Write or paste\n </button>\n <button\n type=\"button\"\n className={source === \"upload\" ? \"btn\" : \"btn ghost\"}\n disabled={saving || reading}\n aria-pressed={source === \"upload\"}\n onClick={() => setSource(\"upload\")}\n >\n Upload file\n </button>\n </div>\n {source === \"upload\" && (\n <label className=\"field\">\n <span>Document file</span>\n <input\n type=\"file\"\n accept={DOCUMENT_FILE_ACCEPT}\n disabled={saving || reading}\n onChange={(event) => {\n const file = event.currentTarget.files?.[0];\n event.currentTarget.value = \"\";\n if (file) void loadFile(file);\n }}\n />\n <span className=\"hint\">\n {reading\n ? \"Reading file…\"\n : uploadedName\n ? `${uploadedName} — review the content below before saving.`\n : \"Text, Markdown, YAML, HTML, JSON, or CSV. You can review and edit the content before saving.\"}\n </span>\n </label>\n )}\n </>\n )}\n <label className=\"field\">\n <span>Key</span>\n <input\n type=\"text\"\n value={key}\n disabled={isEdit}\n onChange={(e) => setKey(e.target.value)}\n placeholder=\"e.g. welcome-email\"\n {...enterSubmit}\n />\n {!isEdit && <span className=\"hint\">A unique name to reference this document by.</span>}\n </label>\n\n <label className=\"field\">\n <span>Format</span>\n <select value={format} onChange={(e) => setFormat(e.target.value as DocFormat)}>\n {FORMATS.map((f) => (\n <option key={f} value={f}>\n {f}\n </option>\n ))}\n </select>\n </label>\n\n {/* A `div`, not a `label`: none of JsonEditor/YamlEditor/CodeEditor render a native\n control for a label to name; each carries its own `aria-label` instead. */}\n <div className=\"field\">\n <span>Content</span>\n {format === \"json\" ? (\n <JsonEditor value={content} onChange={setContent} aria-label=\"Content\" />\n ) : format === \"yaml\" ? (\n <YamlEditor value={content} onChange={setContent} aria-label=\"Content\" />\n ) : (\n <CodeEditor value={content} onChange={setContent} aria-label=\"Content\" />\n )}\n </div>\n\n <label className=\"field\">\n <span>Description</span>\n <input\n type=\"text\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"Optional\"\n {...enterSubmit}\n />\n </label>\n\n {error && <div className=\"result error\">{error}</div>}\n </div>\n <div className=\"modal-actions\">\n <button type=\"button\" className=\"btn ghost\" onClick={props.onClose}>\n Cancel\n </button>\n <button type=\"button\" className=\"btn\" disabled={!canSave} onClick={save}>\n {saving ? \"Saving…\" : isEdit ? \"Save changes\" : \"Save document\"}\n </button>\n </div>\n </Modal>\n );\n}\n"],"names":["DOCUMENT_FILE_ACCEPT","readDocumentFile","file","extension","_a","format","content","FORMATS","DocumentFormModal","props","isEdit","key","setKey","useState","setFormat","_b","setContent","_c","description","setDescription","_d","error","setError","source","setSource","reading","setReading","uploadedName","setUploadedName","createMut","useCreateDocumentMutation","updateMut","useUpdateDocumentMutation","saving","canSave","loadFile","document","current","e","save","onSettled","ApiError","enterSubmit","useEnterSubmit","jsxs","Modal","Fragment","jsx","event","f","JsonEditor","YamlEditor","CodeEditor"],"mappings":";;;;;;AAEO,MAAMA,IACX;AAGF,eAAsBC,EAAiBC,GAIpC;;AACD,QAAMC,MAAYC,IAAAF,EAAK,KAAK,MAAM,GAAG,EAAE,IAAA,MAArB,gBAAAE,EAA4B,kBAAiB,IAYzDC,IAXqC;AAAA,IACzC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,EAEeF,CAAS;AAChC,MAAI,CAACE;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAEJ,MAAIC;AACJ,MAAI;AACF,IAAAA,IAAU,IAAI,YAAY,SAAS,EAAE,OAAO,GAAA,CAAM,EAAE,OAAO,MAAMJ,EAAK,YAAA,CAAa;AAAA,EACrF,QAAQ;AACN,UAAM,IAAI,MAAM,mEAAmE;AAAA,EACrF;AACA,MAAII,EAAQ,SAAS,IAAI;AACvB,UAAM,IAAI,MAAM,6DAA6D;AAC/E,SAAO;AAAA,IACL,KACEJ,EAAK,KACF,QAAQ,YAAY,EAAE,EACtB,KAAA,EACA,MAAM,GAAG,GAAG,KAAK;AAAA,IACtB,QAAAG;AAAA,IACA,SAAAC;AAAA,EAAA;AAEJ;AChCA,MAAMC,IAAgC,CAAC,QAAQ,YAAY,QAAQ,QAAQ,MAAM;AAE1E,SAASC,EAAkBC,GAM/B;;AACD,QAAMC,IAAS,CAAC,CAACD,EAAM,SACjB,CAACE,GAAKC,CAAM,IAAIC,IAAST,IAAAK,EAAM,YAAN,gBAAAL,EAAe,QAAO,EAAE,GACjD,C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AA,EAAO,MAAK,UAAS,WAAU,OAAM,UAAU,CAACb,GAAS,SAASK,GAChE,UAAAN,IAAS,YAAYvB,IAAS,iBAAiB,gBAAA,CAClD;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"DocumentFormModal-B3OkvI5v.js","sources":["../src/lib/document-upload.ts","../src/forms/DocumentFormModal.tsx"],"sourcesContent":["import type { DocFormat } from \"@w6w/sdk\";\n\nexport const DOCUMENT_FILE_ACCEPT =\n \".txt,.md,.markdown,.yaml,.yml,.html,.htm,.json,.csv,text/*,application/json,application/yaml\";\n\n/** Read text without silently turning a binary or invalid UTF-8 file into document content. */\nexport async function readDocumentFile(file: Pick<File, \"name\" | \"arrayBuffer\">): Promise<{\n key: string;\n format: DocFormat;\n content: string;\n}> {\n const extension = file.name.split(\".\").pop()?.toLowerCase() ?? \"\";\n const formats: Record<string, DocFormat> = {\n txt: \"text\",\n csv: \"text\",\n md: \"markdown\",\n markdown: \"markdown\",\n yaml: \"yaml\",\n yml: \"yaml\",\n html: \"html\",\n htm: \"html\",\n json: \"json\",\n };\n const format = formats[extension];\n if (!format)\n throw new Error(\n \"Choose a text, Markdown, YAML, HTML, JSON, or CSV file. Use Files for other file types.\",\n );\n let content: string;\n try {\n content = new TextDecoder(\"utf-8\", { fatal: true }).decode(await file.arrayBuffer());\n } catch {\n throw new Error(\"Could not read this file as UTF-8 text. Choose a UTF-8 text file.\");\n }\n if (content.includes(\"\\0\"))\n throw new Error(\"This file contains binary data. Upload it in Files instead.\");\n return {\n key:\n file.name\n .replace(/\\.[^.]+$/, \"\")\n .trim()\n .slice(0, 128) || \"document\",\n format,\n content,\n };\n}\n","/**\n * Create/edit modal for a document (internal: not exported from `@w6w/embed/forms`). Content is\n * stored verbatim in whatever format is selected, with no parsing or validation. The key is\n * immutable once set, so an edit never sends it.\n */\nimport { ApiError } from \"@w6w/sdk\";\nimport type { Doc, DocFormat } from \"@w6w/sdk\";\nimport { CodeEditor, JsonEditor, YamlEditor, useEnterSubmit } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport { Modal } from \"../chrome/Modal.tsx\";\nimport { DOCUMENT_FILE_ACCEPT, readDocumentFile } from \"../lib/document-upload.ts\";\nimport { useCreateDocumentMutation, useUpdateDocumentMutation } from \"../repos/documents.ts\";\n\nconst FORMATS: readonly DocFormat[] = [\"text\", \"markdown\", \"yaml\", \"html\", \"json\"];\n\nexport function DocumentFormModal(props: {\n initial?: Doc;\n /** The resolved project, or `null` (none yet): a save is refused, never sent project-less. */\n project: string | null;\n onClose: () => void;\n onSaved: () => void;\n}) {\n const isEdit = !!props.initial;\n const [key, setKey] = useState(props.initial?.key ?? \"\");\n const [format, setFormat] = useState<DocFormat>(props.initial?.format ?? \"text\");\n const [content, setContent] = useState(props.initial?.content ?? \"\");\n const [description, setDescription] = useState(props.initial?.description ?? \"\");\n const [error, setError] = useState<string | null>(null);\n const [source, setSource] = useState<\"paste\" | \"upload\">(\"paste\");\n const [reading, setReading] = useState(false);\n const [uploadedName, setUploadedName] = useState<string | null>(null);\n\n const createMut = useCreateDocumentMutation();\n const updateMut = useUpdateDocumentMutation();\n const saving = createMut.isPending || updateMut.isPending;\n const canSave =\n !!key.trim() && !saving && !reading && (source !== \"upload\" || uploadedName !== null);\n\n async function loadFile(file: File) {\n setReading(true);\n setError(null);\n setUploadedName(null);\n try {\n const document = await readDocumentFile(file);\n setKey((current) => current || document.key);\n setFormat(document.format);\n setContent(document.content);\n setUploadedName(file.name);\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Could not read this file.\");\n } finally {\n setReading(false);\n }\n }\n\n function save() {\n setError(null);\n if (props.project == null) {\n setError(\"No project selected: nothing was saved.\");\n return;\n }\n const onSettled = {\n onSuccess: () => props.onSaved(),\n onError: (e: unknown) => setError(e instanceof ApiError ? e.message : (e as Error).message),\n };\n if (props.initial) {\n updateMut.mutate(\n { id: props.initial.id, patch: { content, format, description }, project: props.project },\n onSettled,\n );\n return;\n }\n createMut.mutate(\n { input: { key: key.trim(), content, format, description }, project: props.project },\n onSettled,\n );\n }\n\n const enterSubmit = useEnterSubmit(save, { enabled: canSave });\n\n return (\n <Modal\n title={props.initial ? `Edit ${props.initial.key}` : \"Add document\"}\n onClose={props.onClose}\n >\n <div className=\"modal-body\">\n {!isEdit && (\n <>\n <div className=\"row\">\n <button\n type=\"button\"\n className={source === \"paste\" ? \"btn\" : \"btn ghost\"}\n disabled={saving || reading}\n aria-pressed={source === \"paste\"}\n onClick={() => setSource(\"paste\")}\n >\n Write or paste\n </button>\n <button\n type=\"button\"\n className={source === \"upload\" ? \"btn\" : \"btn ghost\"}\n disabled={saving || reading}\n aria-pressed={source === \"upload\"}\n onClick={() => setSource(\"upload\")}\n >\n Upload file\n </button>\n </div>\n {source === \"upload\" && (\n <label className=\"field\">\n <span>Document file</span>\n <input\n type=\"file\"\n accept={DOCUMENT_FILE_ACCEPT}\n disabled={saving || reading}\n onChange={(event) => {\n const file = event.currentTarget.files?.[0];\n event.currentTarget.value = \"\";\n if (file) void loadFile(file);\n }}\n />\n <span className=\"hint\">\n {reading\n ? \"Reading file…\"\n : uploadedName\n ? `${uploadedName} — review the content below before saving.`\n : \"Text, Markdown, YAML, HTML, JSON, or CSV. You can review and edit the content before saving.\"}\n </span>\n </label>\n )}\n </>\n )}\n <label className=\"field\">\n <span>Key</span>\n <input\n type=\"text\"\n value={key}\n disabled={isEdit}\n onChange={(e) => setKey(e.target.value)}\n placeholder=\"e.g. welcome-email\"\n {...enterSubmit}\n />\n {!isEdit && <span className=\"hint\">A unique name to reference this document by.</span>}\n </label>\n\n <label className=\"field\">\n <span>Format</span>\n <select value={format} onChange={(e) => setFormat(e.target.value as DocFormat)}>\n {FORMATS.map((f) => (\n <option key={f} value={f}>\n {f}\n </option>\n ))}\n </select>\n </label>\n\n {/* A `div`, not a `label`: none of JsonEditor/YamlEditor/CodeEditor render a native\n control for a label to name; each carries its own `aria-label` instead. */}\n <div className=\"field\">\n <span>Content</span>\n {format === \"json\" ? (\n <JsonEditor value={content} onChange={setContent} aria-label=\"Content\" />\n ) : format === \"yaml\" ? (\n <YamlEditor value={content} onChange={setContent} aria-label=\"Content\" />\n ) : (\n <CodeEditor value={content} onChange={setContent} aria-label=\"Content\" />\n )}\n </div>\n\n <label className=\"field\">\n <span>Description</span>\n <input\n type=\"text\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"Optional\"\n {...enterSubmit}\n />\n </label>\n\n {error && <div className=\"result error\">{error}</div>}\n </div>\n <div className=\"modal-actions\">\n <button type=\"button\" className=\"btn ghost\" onClick={props.onClose}>\n Cancel\n </button>\n <button type=\"button\" className=\"btn\" disabled={!canSave} onClick={save}>\n {saving ? \"Saving…\" : isEdit ? \"Save changes\" : \"Save document\"}\n </button>\n </div>\n </Modal>\n );\n}\n"],"names":["DOCUMENT_FILE_ACCEPT","readDocumentFile","file","extension","_a","format","content","FORMATS","DocumentFormModal","props","isEdit","key","setKey","useState","setFormat","_b","setContent","_c","description","setDescription","_d","error","setError","source","setSource","reading","setReading","uploadedName","setUploadedName","createMut","useCreateDocumentMutation","updateMut","useUpdateDocumentMutation","saving","canSave","loadFile","document","current","e","save","onSettled","ApiError","enterSubmit","useEnterSubmit","jsxs","Modal","Fragment","jsx","event","f","JsonEditor","YamlEditor","CodeEditor"],"mappings":";;;;;;AAEO,MAAMA,IACX;AAGF,eAAsBC,EAAiBC,GAIpC;;AACD,QAAMC,MAAYC,IAAAF,EAAK,KAAK,MAAM,GAAG,EAAE,IAAA,MAArB,gBAAAE,EAA4B,kBAAiB,IAYzDC,IAXqC;AAAA,IACzC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,EAEeF,CAAS;AAChC,MAAI,CAACE;AACH,UAAM,IA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,cAAW,UAAA,CAAU;AAAA,UAAA,GAE3E;AAAA,UAEA,gBAAA4B,EAAC,SAAA,EAAM,WAAU,SACf,UAAA;AAAA,YAAA,gBAAAG,EAAC,UAAK,UAAA,cAAA,CAAW;AAAA,YACjB,gBAAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,OAAO7B;AAAA,gBACP,UAAU,CAACoB,MAAMnB,EAAemB,EAAE,OAAO,KAAK;AAAA,gBAC9C,aAAY;AAAA,gBACX,GAAGI;AAAA,cAAA;AAAA,YAAA;AAAA,UACN,GACF;AAAA,UAECrB,KAAS,gBAAA0B,EAAC,OAAA,EAAI,WAAU,gBAAgB,UAAA1B,EAAA,CAAM;AAAA,QAAA,GACjD;AAAA,QACA,gBAAAuB,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,UAAA,gBAAAG,EAAC,UAAA,EAAO,MAAK,UAAS,WAAU,aAAY,SAAStC,EAAM,SAAS,UAAA,SAAA,CAEpE;AAAA,UACA,gBAAAsC,EAAC,UAAA,EAAO,MAAK,UAAS,WAAU,OAAM,UAAU,CAACb,GAAS,SAASK,GAChE,UAAAN,IAAS,YAAYvB,IAAS,iBAAiB,gBAAA,CAClD;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -3,7 +3,7 @@ import { p as R, g as F, j as x, w as L, k as D, s as J, b as U, t as B } from "
|
|
|
3
3
|
import { ApiError as I } from "@w6w/sdk";
|
|
4
4
|
import { JsonEditor as G, AddConnectionModal as H } from "@w6w/ui";
|
|
5
5
|
import { useState as p } from "react";
|
|
6
|
-
import { u as K, a as V } from "./spec-import-
|
|
6
|
+
import { u as K, a as V } from "./spec-import-CPbDnnuv.js";
|
|
7
7
|
import { M as q } from "./ConfirmModal-WqBfWftD.js";
|
|
8
8
|
const z = {
|
|
9
9
|
function: "functions",
|
|
@@ -249,4 +249,4 @@ function te(l) {
|
|
|
249
249
|
export {
|
|
250
250
|
te as I
|
|
251
251
|
};
|
|
252
|
-
//# sourceMappingURL=ImportSpecModal-
|
|
252
|
+
//# sourceMappingURL=ImportSpecModal-SQvTwtcX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportSpecModal-fU5RsVTa.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 /** 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,G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UACvDA,EAAE,UAAU,gBAAAU,EAAC,QAAA,EAAK,WAAU,SAAQ,UAAA;AAAA,YAAA;AAAA,YAAIV,EAAE;AAAA,UAAA,EAAA,CAAO;AAAA,QAAA,EAAA,GAF3CA,EAAE,IAGX,CACD,GACH;AAAA,QACA,gBAAAU;AAAA,UAAC;AAAA,UAAA;AAAA,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;"}
|
|
1
|
+
{"version":3,"file":"ImportSpecModal-SQvTwtcX.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 /** 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,EAAiBjB,GAAMH,CAAI,GACvDqB,IAAcX,MAAS,MAEvBY,IACJ,CAACD,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