@w6w/embed 0.2.0 → 0.2.11
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/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
- package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
- package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
- package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
- package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
- package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
- package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
- package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
- package/dist/ModelRoutesManager-BGESQahw.js +345 -0
- package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
- package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
- package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
- package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
- package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
- package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
- package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
- package/dist/chrome/ConfirmModal.d.ts +4 -1
- package/dist/chrome/workspace.d.ts +4 -0
- package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
- package/dist/coerce-input-DttlcSdO.js.map +1 -0
- package/dist/connections-D7cgXhDS.js +119 -0
- package/dist/connections-D7cgXhDS.js.map +1 -0
- package/dist/credentials-DaQU3Ca_.js +171 -0
- package/dist/credentials-DaQU3Ca_.js.map +1 -0
- package/dist/document-sources-UCwe8x77.js +91 -0
- package/dist/document-sources-UCwe8x77.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/BindingBanner.d.ts +13 -0
- package/dist/editor/CallableEditorFrame.d.ts +7 -0
- package/dist/editor/EndpointCards.d.ts +4 -1
- package/dist/editor/PublishControl.d.ts +19 -0
- package/dist/editor/TargetSelector.d.ts +15 -0
- package/dist/editor/TargetSelector.types.d.ts +2 -0
- package/dist/editor/definition.d.ts +2 -0
- package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
- package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
- package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
- package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +769 -622
- package/dist/editors.mjs.map +1 -1
- package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
- package/dist/endpoints-DSRo1Lc5.js.map +1 -0
- package/dist/fields-DvS8XZFc.js +21 -0
- package/dist/fields-DvS8XZFc.js.map +1 -0
- package/dist/forms/ModelBudgetsManager.d.ts +9 -0
- package/dist/forms/ModelRoutesManager.d.ts +14 -0
- package/dist/forms.d.ts +4 -0
- package/dist/forms.mjs +611 -212
- package/dist/forms.mjs.map +1 -1
- package/dist/index.mjs +119 -112
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +38 -0
- package/dist/lib/code-rail.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/invoke-error.d.ts +1 -0
- package/dist/lib/sdk-snippets.d.ts +1 -1
- package/dist/lib/target-fields.d.ts +8 -0
- package/dist/lib/trigger-preview.d.ts +1 -0
- package/dist/lib/workflow-live-run.d.ts +9 -2
- package/dist/lib/workflow-nodes.d.ts +5 -0
- package/dist/lib/workflow-validity.d.ts +1 -0
- package/dist/lib.mjs +72 -70
- package/dist/lists/ConnectionDependents.d.ts +31 -0
- package/dist/lists/ConnectionDetail.d.ts +4 -1
- package/dist/lists/ConnectionList.d.ts +4 -1
- package/dist/lists/CredentialDetail.d.ts +15 -0
- package/dist/lists/CredentialList.d.ts +14 -0
- package/dist/lists/ModelCatalog.d.ts +12 -0
- package/dist/lists/ModelUsage.d.ts +12 -0
- package/dist/lists.d.ts +8 -0
- package/dist/lists.mjs +1322 -604
- package/dist/lists.mjs.map +1 -1
- package/dist/models-bAayQPJ_.js +270 -0
- package/dist/models-bAayQPJ_.js.map +1 -0
- package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
- package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
- package/dist/rail.mjs +4 -4
- package/dist/repos/agents-studio-agents.d.ts +52 -0
- package/dist/repos/agents-studio-assets.d.ts +68 -0
- package/dist/repos/connections.d.ts +30 -12
- package/dist/repos/credentials.d.ts +83 -0
- package/dist/repos/endpoints.d.ts +9 -3
- package/dist/repos/fields.d.ts +34 -0
- package/dist/repos/functions.d.ts +7 -5
- package/dist/repos/index.d.ts +5 -0
- package/dist/repos/models.d.ts +289 -0
- package/dist/repos.mjs +613 -176
- package/dist/repos.mjs.map +1 -1
- package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
- package/dist/slug-BVdgiP_L.js.map +1 -0
- package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
- package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
- package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
- package/dist/spec-import-CW6R_Wk1.js.map +1 -0
- package/dist/theme-context-E2ZhlXDX.js +6 -0
- package/dist/theme-context-E2ZhlXDX.js.map +1 -0
- package/dist/theme-context.d.ts +2 -0
- package/dist/trigger-preview-DKxfjzUY.js +145 -0
- package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
- package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
- package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
- package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
- package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
- package/package.json +1 -1
- package/src/styles.css +2 -6
- package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
- package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
- package/dist/coerce-input-BicYr7nc.js.map +0 -1
- package/dist/connections-CjjYeRqb.js +0 -78
- package/dist/connections-CjjYeRqb.js.map +0 -1
- package/dist/document-sources-C0grrtdq.js +0 -86
- package/dist/document-sources-C0grrtdq.js.map +0 -1
- package/dist/editor-tools-RxmY5iyi.js.map +0 -1
- package/dist/endpoints-B2ynbZo-.js.map +0 -1
- package/dist/slug-C4ktDPdy.js.map +0 -1
- package/dist/spec-import-CjmxyZDR.js.map +0 -1
- package/dist/trigger-preview-VPkrryDl.js +0 -120
- package/dist/trigger-preview-VPkrryDl.js.map +0 -1
package/dist/repos.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"repos.mjs","sources":["../src/repos/agents-studio-agents.ts","../src/repos/agents-studio-assets.ts"],"sourcesContent":["/**\n * The Agents Studio repo — agent drafts, ready-only skill/context pickers, model routes,\n * agent settings and storage bindings over `@w6w/sdk` (`agents.*`, `skills.*`, `context.*`,\n * `console.storage.*`). Query-key factory + react-query hooks, mirroring `documents.ts`.\n *\n * Agents are DRAFTS: `runnable` is always `false` (A22). A save sends the body `revision` and\n * the precondition header from the loaded `updatedAt`; a 409 is surfaced as a typed\n * {@linkcode AgentConflictError} and is never retried or overwritten (A18).\n */\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport {\n type Agent,\n ApiError,\n type ContextEntry,\n type ContextPin,\n type CreateAgentInput,\n type SkillPin,\n type SkillVersion,\n type UpdateAgentInput,\n type W6WClient,\n} from \"@w6w/sdk\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\nimport { listModelRoutes } from \"./models.ts\";\n\nexport type {\n Agent,\n ContextEntry,\n ContextPin,\n CreateAgentInput,\n SkillPin,\n SkillVersion,\n UpdateAgentInput,\n};\n\n/** Thrown by {@linkcode updateAgent} on a 409: the draft changed elsewhere. Never overwrites. */\nexport class AgentConflictError extends Error {\n readonly kind = \"conflict\" as const;\n /** The server's current revision, when the error body carried one. */\n readonly currentRevision: number | null;\n readonly cause: ApiError;\n constructor(cause: ApiError) {\n super(\"This agent changed elsewhere — reload to see the latest version.\");\n this.name = \"AgentConflictError\";\n this.cause = cause;\n this.currentRevision = currentRevisionOf(cause.raw);\n }\n}\n\nfunction currentRevisionOf(raw: unknown): number | null {\n const o = raw as {\n revision?: unknown;\n error?: { revision?: unknown; details?: { revision?: unknown } };\n } | null;\n const v = o?.revision ?? o?.error?.revision ?? o?.error?.details?.revision;\n return typeof v === \"number\" ? v : null;\n}\n\n/** True for a {@linkcode AgentConflictError}. */\nexport function isAgentConflict(e: unknown): e is AgentConflictError {\n return e instanceof AgentConflictError;\n}\n\nexport const agentsKey = (includeArchived = false) => [\"agents\", { includeArchived }] as const;\nexport const agentKey = (id: string) => [\"agents\", \"detail\", id] as const;\nexport const agentSkillVersionsKey = (skillId: string) =>\n [\"agents\", \"skill-versions\", skillId] as const;\nexport const agentSkillsKey = () => [\"agents\", \"skills\"] as const;\nexport const agentContextKey = () => [\"agents\", \"context\"] as const;\nexport const agentContextEntriesKey = (collectionId: string) =>\n [\"agents\", \"context-entries\", collectionId] as const;\nexport const agentAllContextEntriesKey = () => [\"agents\", \"context-entries-all\"] as const;\nexport const agentModelRoutesKey = (projectId?: string) =>\n [\"agents\", \"model-routes\", projectId] as const;\nexport const agentSettingsKey = () => [\"agent-settings\"] as const;\nexport const storageBindingsKey = () => [\"agent-settings\", \"storage-bindings\"] as const;\n\n/** Save an agent: `revision` in the body, `updatedAt` as the precondition header; 409 → conflict. */\nexport async function updateAgent(\n client: W6WClient,\n id: string,\n patch: Omit<UpdateAgentInput, \"revision\">,\n loaded: Pick<Agent, \"revision\" | \"updatedAt\">,\n): Promise<Agent> {\n try {\n return await client.agents.update(\n id,\n { ...patch, revision: loaded.revision },\n { ifUnmodifiedSince: loaded.updatedAt },\n );\n } catch (e) {\n if (e instanceof ApiError && e.status === 409) throw new AgentConflictError(e);\n throw e;\n }\n}\n\n/** Readiness of a pin against the ready-only picker lists. */\nexport type PinState = \"ready\" | \"unavailable\";\n\n/** A skill pin is `ready` only when its version is among the ready versions of its skill. */\nexport function skillPinState(\n pin: SkillPin,\n readyVersions: readonly SkillVersion[] | undefined,\n): PinState {\n return readyVersions?.some((v) => v.id === pin.skillVersionId && v.skillId === pin.skillId)\n ? \"ready\"\n : \"unavailable\";\n}\n\n/** A context pin is `ready` only when its entry is listed, unarchived, at the pinned version. */\nexport function contextPinState(\n pin: ContextPin,\n entries: readonly ContextEntry[] | undefined,\n): PinState {\n return entries?.some((e) => e.assetVersionId === pin.assetVersionId && e.archivedAt == null)\n ? \"ready\"\n : \"unavailable\";\n}\n\n/** Picker options: ready (listed, unarchived) context entries only. */\nexport function readyContextEntries(entries: readonly ContextEntry[]): ContextEntry[] {\n return entries.filter((e) => e.archivedAt == null);\n}\n\nexport function useAgentsQuery(includeArchived = false) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentsKey(includeArchived),\n queryFn: () => client.agents.list({ includeArchived }),\n });\n}\n\nexport function useAgentQuery(id: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentKey(id ?? \"\"),\n enabled: !!id,\n queryFn: () => client.agents.get(id as string),\n });\n}\n\nexport function useCreateAgent() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (input: CreateAgentInput) => client.agents.create(input),\n onSuccess: () => qc.invalidateQueries({ queryKey: [\"agents\"] }),\n });\n}\n\nexport function useUpdateAgent(id: string) {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (v: {\n patch: Omit<UpdateAgentInput, \"revision\">;\n loaded: Pick<Agent, \"revision\" | \"updatedAt\">;\n }) => updateAgent(client, id, v.patch, v.loaded),\n onSuccess: (agent) => {\n qc.setQueryData(agentKey(id), agent);\n return qc.invalidateQueries({ queryKey: [\"agents\"] });\n },\n });\n}\n\nexport function useArchiveAgent() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => client.agents.archive(id),\n onSuccess: () => qc.invalidateQueries({ queryKey: [\"agents\"] }),\n });\n}\n\nexport function useAgentSkillsQuery() {\n const client = useEmbedClient();\n return useQuery({ queryKey: agentSkillsKey(), queryFn: () => client.skills.list() });\n}\n\nexport function useAgentSkillVersionsQuery(skillId: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentSkillVersionsKey(skillId ?? \"\"),\n enabled: !!skillId,\n queryFn: () => client.skills.versions(skillId as string),\n });\n}\n\nexport function useAgentContextCollectionsQuery() {\n const client = useEmbedClient();\n return useQuery({ queryKey: agentContextKey(), queryFn: () => client.context.list() });\n}\n\nexport function useAgentContextEntriesQuery(collectionId: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentContextEntriesKey(collectionId ?? \"\"),\n enabled: !!collectionId,\n queryFn: () => client.context.entries.list(collectionId as string),\n });\n}\n\n/** Every doc visible to the caller (collection-less included) — the pin picker's source. */\nexport function useAgentAllContextEntriesQuery() {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentAllContextEntriesKey(),\n queryFn: () => client.contextEntries.list({}),\n });\n}\n\nexport function useAgentModelRoutesQuery(projectId?: string) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentModelRoutesKey(projectId),\n enabled: projectId != null,\n queryFn: () => listModelRoutes(client, projectId as string),\n });\n}\n\nexport function useAgentSettingsQuery() {\n const client = useEmbedClient();\n return useQuery({\n queryKey: agentSettingsKey(),\n queryFn: () => client.console.storage.settings.get(),\n });\n}\n\nexport function usePatchAgentSettings() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (patch: Parameters<W6WClient[\"console\"][\"storage\"][\"settings\"][\"patch\"]>[0]) =>\n client.console.storage.settings.patch(patch),\n onSuccess: (s) => {\n qc.setQueryData(agentSettingsKey(), s);\n },\n });\n}\n\nexport function useStorageBindingsQuery() {\n const client = useEmbedClient();\n return useQuery({\n queryKey: storageBindingsKey(),\n queryFn: () => client.console.storage.bindings.list(),\n });\n}\n","/**\n * Agents Studio asset hooks — skills, context collections/entries and stored asset files over\n * `W6WClient`'s `skills.*`, `context.*` and `assets.*` (react-query, same shape as `vars.ts`).\n *\n * These are tenant/account-scoped (no `project` is sent). Uploads are byte-mode: the caller\n * hashes and PUTs the same bytes (see Studio's `agents-studio/upload.ts`); this module only\n * wraps the single-call operations.\n */\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type {\n AssetUploadCreateInput,\n CreateContextCollectionInput,\n CreateStandaloneContextEntryInput,\n UpdateContextEntryInput,\n} from \"@w6w/sdk\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n\nexport const skillsKey = (includeArchived = false) => [\"skills\", { includeArchived }] as const;\nexport const skillKey = (id: string) => [\"skills\", id] as const;\nexport const skillVersionsKey = (id: string) => [\"skills\", id, \"versions\"] as const;\nexport const contextCollectionsKey = (includeArchived = false) =>\n [\"context-collections\", { includeArchived }] as const;\nexport const contextCollectionKey = (id: string) => [\"context-collections\", id] as const;\nexport const contextEntriesKey = (id: string, includeArchived = false) =>\n [\"context-collections\", id, \"entries\", { includeArchived }] as const;\nexport const allContextEntriesKey = (includeArchived = false) =>\n [\"context-entries\", { includeArchived }] as const;\nexport const assetVersionsKey = (id: string) => [\"assets\", id, \"versions\"] as const;\nexport const assetFilesKey = (id: string, versionId: string) =>\n [\"assets\", id, \"versions\", versionId, \"files\"] as const;\n\n// ── Skills ──────────────────────────────────────────────────────────────────────────────────\n\nexport function useSkillsQuery(includeArchived = false) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: skillsKey(includeArchived),\n queryFn: () => client.skills.list({ includeArchived }),\n });\n}\n\nexport function useSkillQuery(id: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: skillKey(id ?? \"\"),\n enabled: id != null,\n queryFn: () => client.skills.get(id as string),\n });\n}\n\nexport function useSkillVersionsQuery(id: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: skillVersionsKey(id ?? \"\"),\n enabled: id != null,\n queryFn: () => client.skills.versions(id as string),\n });\n}\n\nexport function useArchiveSkillMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => client.skills.archive(id),\n onSuccess: () => qc.invalidateQueries({ queryKey: [\"skills\"] }),\n });\n}\n\n// ── Context collections + entries ───────────────────────────────────────────────────────────\n\nexport function useContextCollectionsQuery(includeArchived = false) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: contextCollectionsKey(includeArchived),\n queryFn: () => client.context.list({ includeArchived }),\n });\n}\n\nexport function useContextCollectionQuery(id: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: contextCollectionKey(id ?? \"\"),\n enabled: id != null,\n queryFn: () => client.context.get(id as string),\n });\n}\n\nexport function useCreateContextCollectionMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (input: CreateContextCollectionInput) => client.context.create(input),\n onSuccess: () => qc.invalidateQueries({ queryKey: [\"context-collections\"] }),\n });\n}\n\nexport function useContextEntriesQuery(collectionId: string | undefined, includeArchived = false) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: contextEntriesKey(collectionId ?? \"\", includeArchived),\n enabled: collectionId != null,\n queryFn: () => client.context.entries.list(collectionId as string, { includeArchived }),\n });\n}\n\n/** Edit-as-new-version: `PUT` creates the next version; `ifUnmodifiedSince` guards a stale edit. */\nexport function useUpdateContextEntryMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (v: {\n collectionId: string;\n entryId: string;\n input: UpdateContextEntryInput;\n ifUnmodifiedSince?: string;\n }) =>\n client.context.entries.update(v.collectionId, v.entryId, v.input, {\n ifUnmodifiedSince: v.ifUnmodifiedSince,\n }),\n onSuccess: (_r, v) => {\n qc.invalidateQueries({ queryKey: [\"context-collections\", v.collectionId] });\n qc.invalidateQueries({ queryKey: [\"assets\"] });\n },\n });\n}\n\n// ── Collection-independent entries (`client.contextEntries.*`) ──────────────────────────────\n\n/** Every doc visible to the caller, whether or not it is in a collection. */\nexport function useAllContextEntriesQuery(includeArchived = false) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: allContextEntriesKey(includeArchived),\n queryFn: () => client.contextEntries.list({ includeArchived }),\n });\n}\n\n/** Invalidate the all-docs list and, per affected collection, its entries list. */\nfunction invalidateEntries(qc: ReturnType<typeof useQueryClient>, collectionIds: string[] = []) {\n qc.invalidateQueries({ queryKey: [\"context-entries\"] });\n for (const id of collectionIds) qc.invalidateQueries({ queryKey: contextEntriesKey(id) });\n}\n\n/** Create a text doc, private unless `collectionIds` / `visibility` say otherwise. */\nexport function useCreateContextEntryMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (input: CreateStandaloneContextEntryInput) => client.contextEntries.create(input),\n onSuccess: (_r, v) => invalidateEntries(qc, v.collectionIds),\n });\n}\n\nexport function useAddEntryToCollectionMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (v: { entryId: string; collectionId: string }) =>\n client.contextEntries.addToCollection(v.entryId, v.collectionId),\n onSuccess: (_r, v) => invalidateEntries(qc, [v.collectionId]),\n });\n}\n\nexport function useRemoveEntryFromCollectionMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (v: { entryId: string; collectionId: string }) =>\n client.contextEntries.removeFromCollection(v.entryId, v.collectionId),\n onSuccess: (_r, v) => invalidateEntries(qc, [v.collectionId]),\n });\n}\n\n// ── Asset versions, files, downloads ────────────────────────────────────────────────────────\n\nexport function useAssetVersionsQuery(assetId: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: assetVersionsKey(assetId ?? \"\"),\n enabled: assetId != null,\n queryFn: () => client.assets.versions(assetId as string),\n });\n}\n\nexport function useAssetFilesQuery(assetId: string | undefined, versionId: string | undefined) {\n const client = useEmbedClient();\n return useQuery({\n queryKey: assetFilesKey(assetId ?? \"\", versionId ?? \"\"),\n enabled: assetId != null && versionId != null,\n queryFn: () => client.assets.files(assetId as string, versionId as string),\n });\n}\n\n/** Exact bytes of one file. A mutation (not a query): downloads are user-triggered, never cached. */\nexport function useDownloadAssetFileMutation() {\n const client = useEmbedClient();\n return useMutation({\n mutationFn: (v: { assetId: string; versionId: string; fileId: string }) =>\n client.assets.content(v.assetId, v.versionId, v.fileId),\n });\n}\n\n/** One version as a store-only ZIP. */\nexport function useDownloadAssetArchiveMutation() {\n const client = useEmbedClient();\n return useMutation({\n mutationFn: (v: { assetId: string; versionId: string }) =>\n client.assets.archiveDownload(v.assetId, v.versionId),\n });\n}\n\nexport function useArchiveAssetMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (id: string) => client.assets.archive(id),\n onSuccess: () => qc.invalidateQueries({ queryKey: [\"assets\"] }),\n });\n}\n\n// ── Upload (resumable, byte-mode) ───────────────────────────────────────────────────────────\n\nexport function useCreateAssetUploadMutation() {\n const client = useEmbedClient();\n return useMutation({\n mutationFn: (input: AssetUploadCreateInput) => client.assets.uploads.create(input),\n });\n}\n\nexport function usePutAssetUploadEntryMutation() {\n const client = useEmbedClient();\n return useMutation({\n mutationFn: (v: { uploadId: string; index: number; bytes: Uint8Array }) =>\n client.assets.uploads.putEntry(v.uploadId, v.index, v.bytes),\n });\n}\n\n/** Publishing a version changes skills, context and assets alike — invalidate all three. */\nexport function useFinalizeAssetUploadMutation() {\n const client = useEmbedClient();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: (uploadId: string) => client.assets.uploads.finalize(uploadId),\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: [\"skills\"] });\n qc.invalidateQueries({ queryKey: [\"context-collections\"] });\n qc.invalidateQueries({ queryKey: [\"assets\"] });\n },\n });\n}\n\nexport function useAbortAssetUploadMutation() {\n const client = useEmbedClient();\n return useMutation({ mutationFn: (uploadId: string) => client.assets.uploads.abort(uploadId) });\n}\n"],"names":["AgentConflictError","cause","__publicField","currentRevisionOf","raw","o","v","_a","_c","_b","isAgentConflict","agentsKey","includeArchived","agentKey","id","agentSkillVersionsKey","skillId","agentSkillsKey","agentContextKey","agentContextEntriesKey","collectionId","agentAllContextEntriesKey","agentModelRoutesKey","projectId","agentSettingsKey","storageBindingsKey","updateAgent","client","patch","loaded","e","ApiError","skillPinState","pin","readyVersions","contextPinState","entries","readyContextEntries","useAgentsQuery","useEmbedClient","useQuery","useAgentQuery","useCreateAgent","qc","useQueryClient","useMutation","input","useUpdateAgent","agent","useArchiveAgent","useAgentSkillsQuery","useAgentSkillVersionsQuery","useAgentContextCollectionsQuery","useAgentContextEntriesQuery","useAgentAllContextEntriesQuery","useAgentModelRoutesQuery","listModelRoutes","useAgentSettingsQuery","usePatchAgentSettings","useStorageBindingsQuery","skillsKey","skillKey","skillVersionsKey","contextCollectionsKey","contextCollectionKey","contextEntriesKey","allContextEntriesKey","assetVersionsKey","assetFilesKey","versionId","useSkillsQuery","useSkillQuery","useSkillVersionsQuery","useArchiveSkillMutation","useContextCollectionsQuery","useContextCollectionQuery","useCreateContextCollectionMutation","useContextEntriesQuery","useUpdateContextEntryMutation","_r","useAllContextEntriesQuery","invalidateEntries","collectionIds","useCreateContextEntryMutation","useAddEntryToCollectionMutation","useRemoveEntryFromCollectionMutation","useAssetVersionsQuery","assetId","useAssetFilesQuery","useDownloadAssetFileMutation","useDownloadAssetArchiveMutation","useArchiveAssetMutation","useCreateAssetUploadMutation","usePutAssetUploadEntryMutation","useFinalizeAssetUploadMutation","uploadId","useAbortAssetUploadMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,UAA2B,MAAM;AAAA,EAK5C,YAAYC,GAAiB;AAC3B,UAAM,kEAAkE;AALjE,IAAAC,EAAA,cAAO;AAEP;AAAA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAGP,SAAK,OAAO,sBACZ,KAAK,QAAQD,GACb,KAAK,kBAAkBE,EAAkBF,EAAM,GAAG;AAAA,EACpD;AACF;AAEA,SAASE,EAAkBC,GAA6B;;AACtD,QAAMC,IAAID,GAIJE,KAAID,KAAA,gBAAAA,EAAG,eAAYE,IAAAF,KAAA,gBAAAA,EAAG,UAAH,gBAAAE,EAAU,eAAYC,KAAAC,IAAAJ,KAAA,gBAAAA,EAAG,UAAH,gBAAAI,EAAU,YAAV,gBAAAD,EAAmB;AAClE,SAAO,OAAOF,KAAM,WAAWA,IAAI;AACrC;AAGO,SAASI,EAAgB,GAAqC;AACnE,SAAO,aAAaV;AACtB;AAEO,MAAMW,IAAY,CAACC,IAAkB,OAAU,CAAC,UAAU,EAAE,iBAAAA,GAAiB,GACvEC,IAAW,CAACC,MAAe,CAAC,UAAU,UAAUA,CAAE,GAClDC,IAAwB,CAACC,MACpC,CAAC,UAAU,kBAAkBA,CAAO,GACzBC,IAAiB,MAAM,CAAC,UAAU,QAAQ,GAC1CC,IAAkB,MAAM,CAAC,UAAU,SAAS,GAC5CC,IAAyB,CAACC,MACrC,CAAC,UAAU,mBAAmBA,CAAY,GAC/BC,IAA4B,MAAM,CAAC,UAAU,qBAAqB,GAClEC,IAAsB,CAACC,MAClC,CAAC,UAAU,gBAAgBA,CAAS,GACzBC,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
function
|
|
5
|
+
function h(n) {
|
|
6
6
|
var e;
|
|
7
7
|
const t = (e = n.key) == null ? void 0 : e.trim();
|
|
8
8
|
return t && t.length > 0 ? t : n.id;
|
|
@@ -11,12 +11,12 @@ function l(n) {
|
|
|
11
11
|
return `'${n.replaceAll("'", "'\\''")}'`;
|
|
12
12
|
}
|
|
13
13
|
const v = 72;
|
|
14
|
-
function
|
|
14
|
+
function y(n, ...t) {
|
|
15
15
|
const e = [n, ...t].filter((o) => o.length > 0), i = e.join(" ");
|
|
16
16
|
return t.length === 0 || i.length <= v ? i : e.join(` \\
|
|
17
17
|
`);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function m(n) {
|
|
20
20
|
return !n || n.length === 0 ? [] : n.map(
|
|
21
21
|
(t) => typeof t == "string" ? { key: t, required: !0 } : {
|
|
22
22
|
key: t.key,
|
|
@@ -26,12 +26,12 @@ function $(n) {
|
|
|
26
26
|
}
|
|
27
27
|
).filter((t) => typeof t.key == "string" && t.key.trim() !== "");
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const e =
|
|
29
|
+
function $(n, t = !1) {
|
|
30
|
+
const e = m(n), i = t ? e.filter((o) => o.required) : e;
|
|
31
31
|
return Object.fromEntries(i.map((o) => [o.key, `<${o.key}>`]));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const e =
|
|
33
|
+
function u(n, t) {
|
|
34
|
+
const e = m(n);
|
|
35
35
|
return e.length === 0 ? "{}" : t.compact && e.every((o) => o.required) ? JSON.stringify(Object.fromEntries(e.map((o) => [o.key, `<${o.key}>`]))) : `{
|
|
36
36
|
${e.map(({ key: o, required: a }) => {
|
|
37
37
|
const r = `${JSON.stringify(o)}: ${JSON.stringify(`<${o}>`)},`;
|
|
@@ -40,21 +40,21 @@ ${e.map(({ key: o, required: a }) => {
|
|
|
40
40
|
`)}
|
|
41
41
|
${t.indent}}`;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function k(n) {
|
|
44
|
+
return m(n).filter((t) => !t.required).map((t) => `
|
|
45
45
|
# optional: ${t.key}`).join("");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function b(n) {
|
|
48
48
|
return n ? n.filter((t) => typeof t.key == "string" && t.key.trim() !== "") : [];
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function w(n, t) {
|
|
51
51
|
return n === "number" ? 0 : n === "boolean" ? !1 : n === "json" ? {} : `<${t}>`;
|
|
52
52
|
}
|
|
53
53
|
function g(n, t, e) {
|
|
54
|
-
const i =
|
|
54
|
+
const i = w(n, t);
|
|
55
55
|
return typeof i == "boolean" ? e ? "False" : "false" : JSON.stringify(i);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function S(n) {
|
|
58
58
|
return n.length === 0 ? "" : `
|
|
59
59
|
input: {
|
|
60
60
|
${n.map((e) => {
|
|
@@ -81,11 +81,11 @@ ${i.join(`
|
|
|
81
81
|
)`;
|
|
82
82
|
}
|
|
83
83
|
function T(n, t) {
|
|
84
|
-
if (t.length === 0) return
|
|
84
|
+
if (t.length === 0) return y(`w6w workflows run ${n}`, "--wait");
|
|
85
85
|
const e = t.filter((r) => r.required === !0), i = t.filter((r) => r.required !== !0), o = Object.fromEntries(
|
|
86
|
-
e.map((r) => [r.key,
|
|
86
|
+
e.map((r) => [r.key, w(r.type, r.key)])
|
|
87
87
|
);
|
|
88
|
-
let a =
|
|
88
|
+
let a = y(
|
|
89
89
|
`w6w workflows run ${n}`,
|
|
90
90
|
"--wait",
|
|
91
91
|
`--input ${l(JSON.stringify(o))}`
|
|
@@ -95,13 +95,13 @@ function T(n, t) {
|
|
|
95
95
|
# optional: ${r.key} (${r.type ?? "string"})`;
|
|
96
96
|
return a;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function c(...n) {
|
|
99
99
|
return `import { ${["W6WClient", ...n].join(", ")} } from "@w6w/sdk";
|
|
100
100
|
|
|
101
101
|
// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
|
|
102
102
|
const client = new W6WClient();`;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function d(...n) {
|
|
105
105
|
return `from w6w import ${["Client", ...n].join(", ")}
|
|
106
106
|
|
|
107
107
|
# Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
|
|
@@ -124,7 +124,7 @@ function W(n, t) {
|
|
|
124
124
|
const e = `"$W6W_BASE_URL/workflows/${n}/run?wait=true"`;
|
|
125
125
|
if (t.length === 0) return f(e, {});
|
|
126
126
|
const i = t.filter((s) => s.required === !0), o = t.filter((s) => s.required !== !0), a = Object.fromEntries(
|
|
127
|
-
i.map((s) => [s.key,
|
|
127
|
+
i.map((s) => [s.key, w(s.type, s.key)])
|
|
128
128
|
);
|
|
129
129
|
let r = f(e, { input: a });
|
|
130
130
|
for (const s of o)
|
|
@@ -135,21 +135,21 @@ function W(n, t) {
|
|
|
135
135
|
function U(n, t) {
|
|
136
136
|
switch (n.kind) {
|
|
137
137
|
case "workflow": {
|
|
138
|
-
if (!
|
|
139
|
-
const e =
|
|
138
|
+
if (!p(n.id)) return null;
|
|
139
|
+
const e = h(n), i = b(t);
|
|
140
140
|
return {
|
|
141
141
|
operation: "workflows.run — POST /workflows/{idOrKey}/run",
|
|
142
|
-
node: `${
|
|
142
|
+
node: `${c()}
|
|
143
143
|
|
|
144
144
|
// \`wait: true\` blocks until the run reaches a terminal state.
|
|
145
145
|
// Omit it and you get \`{ runId, status: "queued" }\` back immediately.
|
|
146
146
|
const result = await client.workflows.run(${JSON.stringify(e)}, {
|
|
147
|
-
wait: true,${
|
|
147
|
+
wait: true,${S(i)}
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
console.log(result.status, result.runId);`,
|
|
151
151
|
cli: T(e, i),
|
|
152
|
-
python: `${
|
|
152
|
+
python: `${d()}
|
|
153
153
|
|
|
154
154
|
# \`wait=True\` blocks until the run reaches a terminal state.
|
|
155
155
|
# Omit it and you get \`WorkflowRunResult(status="queued", ...)\` back immediately.
|
|
@@ -160,15 +160,15 @@ print(result.status, result.runId)`,
|
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
case "function": {
|
|
163
|
-
if (!
|
|
164
|
-
const e =
|
|
163
|
+
if (!p(n.id)) return null;
|
|
164
|
+
const e = h(n), i = $(n.inputs, !0), o = JSON.stringify(i), a = k(n.inputs), r = u(n.inputs, { indent: " ", comment: "//" }), s = u(n.inputs, {
|
|
165
165
|
indent: "",
|
|
166
166
|
comment: "#",
|
|
167
167
|
compact: !0
|
|
168
168
|
});
|
|
169
169
|
return {
|
|
170
170
|
operation: "functions.run — POST /functions/{idOrKey}/invoke",
|
|
171
|
-
node: `${
|
|
171
|
+
node: `${c()}
|
|
172
172
|
|
|
173
173
|
// The name is the first argument, and it may be the Function's key or its
|
|
174
174
|
// \`fn_…\` id — one slot takes either. Returns the OUTPUT directly: the kind is
|
|
@@ -178,8 +178,8 @@ const output = await client.functions.run(${JSON.stringify(e)}, {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
console.log(output);`,
|
|
181
|
-
cli:
|
|
182
|
-
python: `${
|
|
181
|
+
cli: y(`w6w functions run ${e}`, `--payload ${l(o)}`) + a,
|
|
182
|
+
python: `${d()}
|
|
183
183
|
|
|
184
184
|
# The name is the first argument — the Function's key or its \`fn_…\` id.
|
|
185
185
|
output = client.functions.run(${JSON.stringify(e)}, payload=${s})
|
|
@@ -189,15 +189,15 @@ print(output)`,
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
case "endpoint": {
|
|
192
|
-
if (!
|
|
193
|
-
const e = n.urlForm === "key" && n.invokeUrlByKey ? n.invokeUrlByKey : n.invokeUrl, i =
|
|
192
|
+
if (!p(n.id)) return null;
|
|
193
|
+
const e = n.urlForm === "key" && n.invokeUrlByKey ? n.invokeUrlByKey : n.invokeUrl, i = h(n), o = $(n.inputs, !0), a = JSON.stringify(o), r = k(n.inputs), s = u(n.inputs, { indent: " ", comment: "//" }), O = u(n.inputs, {
|
|
194
194
|
indent: "",
|
|
195
195
|
comment: "#",
|
|
196
196
|
compact: !0
|
|
197
197
|
});
|
|
198
198
|
return {
|
|
199
199
|
operation: "endpoints.run — POST /endpoints/{idOrKey}/invoke",
|
|
200
|
-
node: `${
|
|
200
|
+
node: `${c()}
|
|
201
201
|
|
|
202
202
|
// The name is the first argument — the Endpoint's key or its \`ep_…\` id. Unlike
|
|
203
203
|
// \`functions.run\` this returns the ENVELOPE: an Endpoint dispatches to an app
|
|
@@ -207,8 +207,8 @@ const envelope = await client.endpoints.run(${JSON.stringify(i)}, {
|
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
console.log(envelope.kind, envelope);`,
|
|
210
|
-
cli:
|
|
211
|
-
python: `${
|
|
210
|
+
cli: y(`w6w endpoints run ${i}`, `--payload ${l(a)}`) + r,
|
|
211
|
+
python: `${d()}
|
|
212
212
|
|
|
213
213
|
# The name is the first argument — the Endpoint's key or its \`ep_…\` id.
|
|
214
214
|
envelope = client.endpoints.run(${JSON.stringify(i)}, payload=${O})
|
|
@@ -218,11 +218,17 @@ print(envelope["kind"], envelope)`,
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
case "connection": {
|
|
221
|
-
if (!
|
|
222
|
-
const e =
|
|
221
|
+
if (!p(n.id)) return null;
|
|
222
|
+
const e = $(n.params, !0), i = k(n.params), a = m(n.params).every((s) => s.required) ? JSON.stringify(e, null, 2).replaceAll(`
|
|
223
|
+
`, `
|
|
224
|
+
`) : u(n.params, { indent: " ", comment: "//" }), r = u(n.params, {
|
|
225
|
+
indent: "",
|
|
226
|
+
comment: "#",
|
|
227
|
+
compact: !0
|
|
228
|
+
});
|
|
223
229
|
return {
|
|
224
230
|
operation: "run — POST /run",
|
|
225
|
-
node: `${
|
|
231
|
+
node: `${c("isActionRun")}
|
|
226
232
|
|
|
227
233
|
// An app action runs through the CONNECTION that authenticates it, so the URN
|
|
228
234
|
// is the connection id and \`action\` names the action on its app. This is the
|
|
@@ -231,18 +237,16 @@ print(envelope["kind"], envelope)`,
|
|
|
231
237
|
const envelope = await client.run({
|
|
232
238
|
urn: ${JSON.stringify(n.id)},
|
|
233
239
|
action: ${JSON.stringify(n.action)},
|
|
234
|
-
payload: ${
|
|
235
|
-
`, `
|
|
236
|
-
`)},
|
|
240
|
+
payload: ${a},
|
|
237
241
|
});
|
|
238
242
|
|
|
239
243
|
if (isActionRun(envelope)) console.log(envelope.value);`,
|
|
240
|
-
cli:
|
|
244
|
+
cli: y(
|
|
241
245
|
`w6w run ${n.id}`,
|
|
242
246
|
`--action ${n.action}`,
|
|
243
247
|
`--payload ${l(JSON.stringify(e))}`
|
|
244
|
-
),
|
|
245
|
-
python: `${
|
|
248
|
+
) + i,
|
|
249
|
+
python: `${d("is_action_run")}
|
|
246
250
|
|
|
247
251
|
# An app action runs through the CONNECTION that authenticates it, so the URN
|
|
248
252
|
# is the connection id and \`action\` names the action on its app. This is the
|
|
@@ -251,7 +255,7 @@ if (isActionRun(envelope)) console.log(envelope.value);`,
|
|
|
251
255
|
envelope = client.run(
|
|
252
256
|
${JSON.stringify(n.id)},
|
|
253
257
|
action=${JSON.stringify(n.action)},
|
|
254
|
-
payload=${
|
|
258
|
+
payload=${r},
|
|
255
259
|
)
|
|
256
260
|
|
|
257
261
|
if is_action_run(envelope):
|
|
@@ -261,12 +265,12 @@ if is_action_run(envelope):
|
|
|
261
265
|
case "var":
|
|
262
266
|
return {
|
|
263
267
|
operation: "vars.getByName — GET /vars/by-name/{name}",
|
|
264
|
-
node: `${
|
|
268
|
+
node: `${c()}
|
|
265
269
|
|
|
266
270
|
const variable = await client.vars.getByName(${JSON.stringify(n.name)});
|
|
267
271
|
console.log(variable.value);`,
|
|
268
272
|
cli: `w6w vars get-by-name ${n.name}`,
|
|
269
|
-
python: `${
|
|
273
|
+
python: `${d()}
|
|
270
274
|
|
|
271
275
|
variable = client.vars.get_by_name(${JSON.stringify(n.name)})
|
|
272
276
|
print(variable.value)`
|
|
@@ -274,42 +278,42 @@ print(variable.value)`
|
|
|
274
278
|
case "document":
|
|
275
279
|
return {
|
|
276
280
|
operation: "documents.getByKey — GET /documents/by-key/{key}",
|
|
277
|
-
node: `${
|
|
281
|
+
node: `${c()}
|
|
278
282
|
|
|
279
283
|
const doc = await client.documents.getByKey(${JSON.stringify(n.key)});
|
|
280
284
|
console.log(doc.content);`,
|
|
281
285
|
cli: `w6w documents get-by-key ${l(n.key)}`,
|
|
282
|
-
python: `${
|
|
286
|
+
python: `${d()}
|
|
283
287
|
|
|
284
288
|
doc = client.documents.get_by_key(${JSON.stringify(n.key)})
|
|
285
289
|
print(doc.content)`
|
|
286
290
|
};
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
function C(n) {
|
|
290
|
-
return (n.kind === "function" || n.kind === "endpoint" || n.kind === "workflow") && !d(n.id) ? `This ${n.kind}'s id (${n.id}) has no \`${n.kind === "workflow" ? "wf_" : n.kind === "function" ? "fn_" : "ep_"}\` prefix, so it cannot be addressed by URN. The SDK and CLI reach ${n.kind}s through \`run\`, which resolves a URN by that prefix — re-create it with a host-issued id to call it from code.` : "The client libraries do not expose an operation for this yet.";
|
|
291
|
-
}
|
|
292
293
|
function q(n) {
|
|
294
|
+
return (n.kind === "function" || n.kind === "endpoint" || n.kind === "workflow") && !p(n.id) ? `This ${n.kind}'s id (${n.id}) has no \`${n.kind === "workflow" ? "wf_" : n.kind === "function" ? "fn_" : "ep_"}\` prefix, so it cannot be addressed by URN. The SDK and CLI reach ${n.kind}s through \`run\`, which resolves a URN by that prefix — re-create it with a host-issued id to call it from code.` : "The client libraries do not expose an operation for this yet.";
|
|
295
|
+
}
|
|
296
|
+
function C(n) {
|
|
293
297
|
return n.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
294
298
|
}
|
|
295
299
|
const R = /^[a-z][a-z0-9-]{2,}$/;
|
|
296
300
|
function A(n) {
|
|
297
301
|
return R.test(n);
|
|
298
302
|
}
|
|
299
|
-
function
|
|
303
|
+
function P(n) {
|
|
300
304
|
return /^[a-z][a-z0-9-]{2,38}$/.test(n) && !n.includes("--") && !n.endsWith("-");
|
|
301
305
|
}
|
|
302
|
-
function
|
|
306
|
+
function B(n) {
|
|
303
307
|
return n.toLowerCase().replace(/[^a-z0-9-]/g, "").slice(0, 39);
|
|
304
308
|
}
|
|
305
309
|
export {
|
|
306
310
|
R as A,
|
|
307
|
-
|
|
311
|
+
p as a,
|
|
308
312
|
U as b,
|
|
309
313
|
A as c,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
B as f,
|
|
315
|
+
P as i,
|
|
316
|
+
C as s,
|
|
317
|
+
q as u
|
|
314
318
|
};
|
|
315
|
-
//# sourceMappingURL=slug-
|
|
319
|
+
//# sourceMappingURL=slug-BVdgiP_L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug-BVdgiP_L.js","sources":["../src/lib/sdk-snippets.ts","../src/lib/slug.ts"],"sourcesContent":["/**\n * Node/CLI call snippets for a studio resource — \"how do I do this from code?\"\n *\n * Pure string builders over the wrapper contract at `packages/wrappers`\n * (`endpoints.json` + `docs/endpoints.md`). Nothing here fetches, and nothing\n * here invents an operation: every snippet emitted maps to an operation the\n * contract lists as `status: required, serverImplemented: true`, using the exact\n * symbol its `naming.ts` / `naming.cli` field pins. If an operation is not in\n * the contract there is no snippet for it — a copyable example of a method that\n * does not exist is worse than no example.\n *\n * The surface at contract v0.3.0, and what each studio page can therefore show:\n *\n * | Resource | Node | CLI | Python | curl |\n * |-----------|-------------------------------------|------------------------------|--------|------|\n * | Workflow | `client.workflows.run(id, opts?)` | `w6w workflows run <id>` | `client.workflows.run(id, ...)` | `curl … /workflows/{id}/run?wait=true` |\n * | Function | `client.functions.run(name, {payload})` | `w6w functions run <name>` | `client.functions.run(name, payload=...)` | `curl … /functions/{name}/invoke` |\n * | Endpoint | `client.endpoints.run(name, {payload})` | `w6w endpoints run <name>` | `client.endpoints.run(name, payload=...)` | `curl … <server-rendered URL>` |\n * | Connection | `client.run({urn, action, payload})` | `w6w run <urn> --action` | `client.run(urn, action=..., payload=...)` | — |\n * | Var | `client.vars.getByName(name)` | `w6w vars get-by-name <n>` | `client.vars.get_by_name(name)` | — |\n * | Document | `client.documents.getByKey(key)` | `w6w documents get-by-key` | `client.documents.get_by_key(key)` | — |\n *\n * There is a fourth, contract-free arm: a raw-HTTP (`curl`) snippet, for the\n * three kinds a caller reaches through a fixed route — Function and Workflow\n * against the `$W6W_BASE_URL` env placeholder (the same one the node/cli/python\n * arms already tell the reader to export), and Endpoint against the URL the\n * SERVER rendered, handed in on the resource. It maps to no wrapper operation\n * on purpose — the three wrapper arms reach a Function or Endpoint through\n * `run`, which takes a URN and not a URL, so raw HTTP is the only place a\n * literal route (or, for an Endpoint, the id-form / key-form URL toggle) can\n * even be shown. An Endpoint's URL is used VERBATIM: nothing here concatenates\n * a host, a path or a slug onto it. Connection, Var and Document have no\n * fixed single-resource route to curl against, so they carry no `curl` arm.\n *\n * **Functions and Endpoints have their own namespaces** as of `@w6w/sdk` 0.6.0\n * (contract 0.3.0): `functions.run(name, {payload})` and\n * `endpoints.run(name, {payload})`, with the NAME FIRST and the same slot\n * accepting either the resource's key or its `fn_…`/`ep_…` id — the two shapes\n * cannot collide, so nothing is tagged. This module used to emit\n * `client.run({urn: \"fn:send-email\"})`, a kind smuggled into a string because\n * the field was one string; that form is gone.\n *\n * **One form per kind, always.** An earlier version rendered\n * `client.run({urn: alias})` for a resource that carried an alias, which put\n * two different call styles side by side for two Functions. `key` is required\n * on every Function and Endpoint server-side, so the namespace call always\n * works and the alias form was never the only way in. An alias is a SECOND\n * address with its own rail (`alias-rail.ts`); it is not advertised here,\n * because the answer to \"how do I call this Function?\" should not change shape\n * depending on whether someone aliased it. See {@link addressName}.\n *\n * `isUrnAddressable` still gates every arm: an id without its kind prefix is\n * not addressable by `run`, so the snippet is withheld rather than emitting a\n * call that cannot work.\n */\n\nimport type { TriggerPreviewFieldDef } from \"./trigger-preview.ts\";\n\n/**\n * One declared input of a Function or Endpoint, as a snippet needs it.\n *\n * A BARE STRING is treated as REQUIRED. That is the shape this file took before\n * it knew about optionality, when every input rendered active — so a caller that\n * only has keys keeps its existing output rather than silently having every\n * field commented out.\n */\nexport type SnippetInput = string | { key: string; required?: boolean };\n\n/** Normalized, so the renderers below never branch on the union. */\ninterface ResolvedInput {\n key: string;\n required: boolean;\n}\n\n/** What the caller is looking at. Mirrors the four runnable URN arms plus assets. */\nexport type SnippetCallable =\n | { kind: \"workflow\"; id: string; displayName?: string; key?: string; alias?: string }\n | { kind: \"function\"; id: string; key?: string; inputs?: readonly SnippetInput[]; alias?: string }\n /**\n * An Endpoint. `invokeUrl` / `invokeUrlByKey` are the two SERVER-rendered\n * forms of its public address, passed straight through from the endpoints\n * envelope; `urlForm` is which of them the page currently has selected, so a\n * raw-HTTP sample follows the toggle the reader can see. All three are\n * optional — an Endpoint with no URL in hand simply gets no HTTP snippet.\n * `inputs` are the target's input parameter keys, resolved from the Function\n * or Workflow the Endpoint dispatches to.\n */\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 /** One app action, invoked through a connection — the `conn_` URN arm. */\n | { kind: \"connection\"; id: string; action: string; params?: readonly SnippetInput[] }\n | { kind: \"var\"; name: string }\n | { kind: \"document\"; key: string };\n\nexport interface Snippet {\n /** Runnable TypeScript against `@w6w/sdk`. */\n node: string;\n /** A single `w6w …` invocation. */\n cli: string;\n /** Runnable Python against `w6w` (PyPI). */\n python: string;\n /**\n * A raw-HTTP (`curl`) call against the resource's own public URL — OPTIONAL,\n * and emitted only where such a URL exists and was handed in (today: an\n * Endpoint). Optional rather than required so the other five `case` arms of\n * {@link buildSnippet} are untouched, and so the tab strip can render only\n * the tabs a built snippet actually carries.\n */\n curl?: string;\n /** The contract operation this maps to, shown so the snippet is checkable. */\n operation: string;\n}\n\n/**\n * The URN prefixes `POST /run` resolves. Kept as data rather than inlined so\n * the gate below and the docs above cannot drift apart.\n */\nconst RUNNABLE_PREFIXES = [\"conn_\", \"fn_\", \"wf_\", \"ep_\"] as const;\n\n/**\n * Can this id be passed to `client.run({urn})` at all?\n *\n * Ids are host-issued and carry a kind prefix (rfcs/function.md §id — \"host-issued\n * opaque id (`fn_…`)\"), but the create routes do not *enforce* it, so a\n * hand-authored id can reach the database without one. Such a resource is\n * reachable through the studio and through its own `/invoke` route, but NOT\n * through the URN operation the wrappers expose — and a snippet is a promise\n * that the code in it runs.\n */\nexport function isUrnAddressable(id: string): boolean {\n return RUNNABLE_PREFIXES.some((p) => id.startsWith(p));\n}\n\n/**\n * The three kinds `POST /run` addresses by URN and that can carry an alias.\n */\ntype AddressableCallable = Extract<SnippetCallable, { kind: \"workflow\" | \"function\" | \"endpoint\" }>;\n\n/**\n * The name a snippet addresses a resource by: its own `key`, falling back to\n * the opaque id when it somehow has none.\n *\n * ONE FORM, ALWAYS — `functions.run(name)` / `endpoints.run(name)`. An earlier\n * version branched to `client.run({urn: alias})` when the resource carried an\n * alias, which rendered two different call styles for two Functions side by\n * side. That inconsistency bought nothing: `key` is REQUIRED on every Function\n * and Endpoint server-side (`admin/functions.ts`: \"`key` is required\"), so the\n * namespace call always works and the alias form was never the only way in.\n *\n * An alias is a SECOND address, not a substitute for the first, and it has its\n * own rail (`alias-rail.ts`) on the page where it belongs. It is deliberately\n * not advertised here: this snippet answers \"how do I call this Function?\",\n * and the answer should not change shape depending on whether someone happened\n * to alias it.\n *\n * `key` is optional on the type rather than on the wire — a row that predates\n * the requirement can still reach the studio — so the id fallback stays.\n */\nfunction addressName(resource: AddressableCallable): string {\n const key = (resource as { key?: string }).key?.trim();\n return key && key.length > 0 ? key : resource.id;\n}\n\n/** Single-quoted shell literal — `'` closed, escaped, reopened. */\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n\n/**\n * Past this many characters a one-line command is harder to read than a\n * continued one. Chosen so the common `w6w run <urn> --action <a>` stays on one\n * line and only a real payload pushes it over.\n */\nconst CLI_WRAP_AT = 72;\n\n/**\n * Assemble a CLI command, breaking it across lines with `\\` when it is long.\n *\n * A single-line `w6w run conn_… --action … --payload '{\"a\":\"<a>\",\"b\":\"<b>\"}'`\n * runs off the edge of the panel, so the reader scrolls sideways to find out\n * what the flags even are. Continued, each flag is its own line and the shape\n * of the call is visible at a glance:\n *\n * w6w run conn_c19f4db6 \\\n * --action message-post \\\n * --payload '{\"channel\":\"<channel>\"}'\n *\n * `\\`-newline is the POSIX continuation, so the wrapped form pastes into\n * bash/zsh **and copies as one command** — the text is identical to what the\n * shell sees. (It is not `cmd.exe` syntax; the snippets already assume a POSIX\n * shell for their single-quoting.)\n *\n * Short commands are left alone: breaking `w6w vars get-by-name x` across two\n * lines makes it less readable, not more.\n *\n * @param head the command and its positional argument(s), never split\n * @param flags one `--flag value` (or bare `--flag`) per entry\n */\nfunction cliCommand(head: string, ...flags: string[]): string {\n const parts = [head, ...flags].filter((p) => p.length > 0);\n const oneLine = parts.join(\" \");\n if (flags.length === 0 || oneLine.length <= CLI_WRAP_AT) return oneLine;\n return parts.join(\" \\\\\\n \");\n}\n\n/** Normalize the caller's input list. A bare key is required — see {@link SnippetInput}. */\nfunction resolveInputs(inputs: readonly SnippetInput[] | undefined): ResolvedInput[] {\n if (!inputs || inputs.length === 0) return [];\n return inputs\n .map((i) =>\n typeof i === \"string\"\n ? { key: i, required: true }\n : {\n key: i.key,\n // Only an explicit `true` is required — an undeclared flag means the\n // Function did not mark it, which is exactly what optional means.\n required: i.required === true,\n },\n )\n .filter((i) => typeof i.key === \"string\" && i.key.trim() !== \"\");\n}\n\n/**\n * A sample payload for a Function's declared inputs, so the snippet shows the\n * shape rather than an empty object the reader has to go and look up.\n * Values are placeholders — this is an example, not a saved request.\n *\n * `requiredOnly` is for the comment-less lanes (JSON has no comments), which\n * carry the required fields and name the optional ones in trailing shell\n * comments instead — the same D-4 split the workflow arm already makes.\n */\nfunction samplePayload(\n inputs: readonly SnippetInput[] | undefined,\n requiredOnly = false,\n): Record<string, string> {\n const resolved = resolveInputs(inputs);\n const used = requiredOnly ? resolved.filter((i) => i.required) : resolved;\n return Object.fromEntries(used.map((i) => [i.key, `<${i.key}>`]));\n}\n\n/**\n * The payload object rendered as SOURCE, with optional inputs commented out —\n * the same active/commented rule {@link nodeInputBlock} applies to a trigger's\n * fields, so both halves of this file read alike.\n *\n * EVERY line ends with a comma, active or commented. A JS object literal\n * tolerates the trailing one, and without it uncommenting the last optional\n * field would leave the line above it without a separator — a paste that no\n * longer parses, produced by doing exactly what the comment invites.\n */\nfunction payloadSource(\n inputs: readonly SnippetInput[] | undefined,\n opts: { indent: string; comment: string; compact?: boolean },\n): string {\n const resolved = resolveInputs(inputs);\n if (resolved.length === 0) return \"{}\";\n // Python's payload is a one-liner today, and stays one when there is nothing\n // to comment: the multi-line form exists to carry the `#` lines, so growing\n // it for a Function whose inputs are all required would be churn in every\n // snippet to serve the minority that needs it.\n if (opts.compact && resolved.every((i) => i.required)) {\n return JSON.stringify(Object.fromEntries(resolved.map((i) => [i.key, `<${i.key}>`])));\n }\n const lines = resolved.map(({ key, required }) => {\n const member = `${JSON.stringify(key)}: ${JSON.stringify(`<${key}>`)},`;\n return required ? `${opts.indent} ${member}` : `${opts.indent} ${opts.comment} ${member}`;\n });\n return `{\\n${lines.join(\"\\n\")}\\n${opts.indent}}`;\n}\n\n/**\n * Trailing `# optional: <key>` lines for the lanes that cannot carry a comment\n * INSIDE the payload (CLI and curl both pass JSON). Appended after the command,\n * and none of them ends with a backslash, so the block still pastes and runs as\n * one command. Mirrors `cliWorkflowCommand`/`curlWorkflowCommand`.\n */\nfunction optionalNotes(inputs: readonly SnippetInput[] | undefined): string {\n return resolveInputs(inputs)\n .filter((i) => !i.required)\n .map((i) => `\\n# optional: ${i.key}`)\n .join(\"\");\n}\n\n/**\n * A trigger field with no declared/blank `key` is dropped — mirrors\n * `trigger-preview.ts`'s own `triggerPreviews()` (and `@w6w/ui/flow`'s\n * `fieldsToParams`), which do the same before turning field defs into\n * anything fillable. Declared order is preserved.\n */\nfunction usableTriggerFields(\n fields: readonly TriggerPreviewFieldDef[] | undefined,\n): TriggerPreviewFieldDef[] {\n if (!fields) return [];\n return fields.filter((f) => typeof f.key === \"string\" && f.key.trim() !== \"\");\n}\n\n/**\n * The D-3 placeholder VALUE for a trigger field's declared `type`. The domain\n * is closed at four values — `trigger-fields.ts`'s `fieldWidget()` collapses\n * anything else to `\"string\"` — so this mirrors that collapse rather than\n * re-deriving it. The `\"<key>\"` form mirrors `samplePayload()`'s own\n * convention, so both arms of this file stay idiomatic.\n */\nfunction fieldPlaceholderValue(\n type: string | undefined,\n key: string,\n): string | number | boolean | Record<string, never> {\n if (type === \"number\") return 0;\n if (type === \"boolean\") return false;\n if (type === \"json\") return {};\n return `<${key}>`;\n}\n\n/**\n * The placeholder rendered as SOURCE CODE for one lane. Only the boolean\n * literal differs between Python (`False`) and Node/JSON (`false`) — a\n * shared `JSON.stringify` across all three lanes would emit `false` into\n * Python and raise `NameError` the moment the pasted snippet runs, which is\n * why this branches on `python` rather than reusing one formatter.\n */\nfunction fieldSourceLiteral(type: string | undefined, key: string, python: boolean): string {\n const value = fieldPlaceholderValue(type, key);\n if (typeof value === \"boolean\") return python ? \"False\" : \"false\";\n return JSON.stringify(value);\n}\n\n/**\n * The trigger's `input` object rendered into the Node call — required fields\n * active, optional fields commented out with `//` (D-3/D-4). `\"\"` when there\n * is nothing to show, so the caller can splice it straight after `wait: true,`\n * without leaving a dangling empty block.\n */\nfunction nodeInputBlock(fields: readonly TriggerPreviewFieldDef[]): string {\n if (fields.length === 0) return \"\";\n const lines = fields.map((f) => {\n // A field key is free text (`packages/ui/src/flow-types.ts:340`, no\n // validation) — `first-name`, `2fa`, `api key` are all reachable. A bare\n // object member (`first-name: ...`) is not valid TypeScript; quoting the\n // key with `JSON.stringify` (the same shape `:311`'s payload already\n // uses) is correct for every key by construction, so nothing here has to\n // decide what counts as a \"safe\" identifier.\n const member = `${JSON.stringify(f.key)}: ${fieldSourceLiteral(f.type, f.key as string, false)},`;\n return f.required === true ? ` ${member}` : ` // ${member}`;\n });\n return `\n input: {\n${lines.join(\"\\n\")}\n },`;\n}\n\n/**\n * The whole `client.workflows.run(...)` call expression for Python — not just\n * the `input=` block, because the no-fields case keeps the existing\n * single-line call rather than growing an empty `input={}`. Same active/\n * commented rule as `nodeInputBlock()`, `#` in place of `//`.\n */\nfunction pythonWorkflowCall(id: string, fields: readonly TriggerPreviewFieldDef[]): string {\n const idLiteral = JSON.stringify(id);\n if (fields.length === 0) return `client.workflows.run(${idLiteral}, wait=True)`;\n const lines = fields.map((f) => {\n const member = `\"${f.key}\": ${fieldSourceLiteral(f.type, f.key as string, true)},`;\n return f.required === true ? ` ${member}` : ` # ${member}`;\n });\n return `client.workflows.run(\n ${idLiteral},\n wait=True,\n input={\n${lines.join(\"\\n\")}\n },\n)`;\n}\n\n/**\n * The CLI arm of the same rule (D-4): JSON admits no comments, so\n * `--input '<json>'` carries the REQUIRED fields only, and each optional\n * field's key is instead named in a trailing `#` shell-comment line. Those\n * lines are appended after `cliCommand()` returns and none of them ends\n * with `\\`, so the whole block — command plus comments — still pastes and\n * runs as one command.\n */\nfunction cliWorkflowCommand(id: string, fields: readonly TriggerPreviewFieldDef[]): string {\n if (fields.length === 0) return cliCommand(`w6w workflows run ${id}`, \"--wait\");\n const required = fields.filter((f) => f.required === true);\n const optional = fields.filter((f) => f.required !== true);\n const payload = Object.fromEntries(\n required.map((f) => [f.key as string, fieldPlaceholderValue(f.type, f.key as string)]),\n );\n let cmd = cliCommand(\n `w6w workflows run ${id}`,\n \"--wait\",\n `--input ${shellQuote(JSON.stringify(payload))}`,\n );\n for (const f of optional) {\n cmd += `\\n# optional: ${f.key} (${f.type ?? \"string\"})`;\n }\n return cmd;\n}\n\n/**\n * The lines every Node snippet opens with. `extra` names any additional symbol\n * the body uses — the import list has to be complete or the snippet does not\n * compile when pasted, which is the one thing a copyable example must not do.\n */\nfunction nodePreamble(...extra: string[]): string {\n const symbols = [\"W6WClient\", ...extra].join(\", \");\n return `import { ${symbols} } from \"@w6w/sdk\";\n\n// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.\nconst client = new W6WClient();`;\n}\n\n/**\n * The lines every Python snippet opens with. Mirrors `nodePreamble()`:\n * `extra` names any additional symbol the body uses (a discriminator\n * free-function), and the import list has to be complete or the snippet does\n * not run when pasted.\n */\nfunction pythonPreamble(...extra: string[]): string {\n const symbols = [\"Client\", ...extra].join(\", \");\n return `from w6w import ${symbols}\n\n# Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.\nclient = Client()`;\n}\n\n/**\n * The two header lines and the `-d` line every curl arm shares — the \"one\n * body builder, not three\" the three curl arms below are built on. `urlToken`\n * is the URL already rendered as a shell token: `\"$W6W_BASE_URL/…\"`\n * double-quoted so the env var expands (the function/workflow arms), or\n * `shellQuote`d (the endpoint arm, whose URL is a server-rendered literal\n * that may carry an operator-typed `'`). The auth header is DOUBLE-quoted so\n * `$W6W_TOKEN` expands on paste; `content-type` keeps single quotes (nothing\n * in it expands); `-d`'s JSON body is always `shellQuote`d — double-quoting\n * it would let the shell eat its own `\"` characters.\n */\nfunction curlBody(urlToken: string, data: unknown): string {\n return `curl -X POST ${urlToken} \\\\\n -H \"authorization: Bearer $W6W_TOKEN\" \\\\\n -H 'content-type: application/json' \\\\\n -d ${shellQuote(JSON.stringify(data))}`;\n}\n\n/**\n * A raw-HTTP call against a URL the SERVER rendered (the Endpoint arm).\n *\n * `url` is spliced in verbatim (through the same `shellQuote` every other shell\n * literal in this file uses) — this function has no notion of a host, a path, an\n * account or a key, and must never grow one: the whole point of the id/key\n * toggle is that both strings arrive fully formed from the server.\n * `payload` is the optional data payload to send with the request.\n */\nfunction curlCommand(url: string, payload?: Record<string, string>): string {\n return curlBody(shellQuote(url), payload ?? {});\n}\n\n/**\n * The name-addressed arm: `POST $W6W_BASE_URL/{group}/{name}/invoke`.\n *\n * `bodyKey` is a parameter because the wire is inconsistent where the SDK is\n * not — a Function takes `inputs`, an Endpoint takes `input`. The wrappers\n * spell both `payload`; raw HTTP cannot, so the caller passes the real one and\n * this helper never guesses.\n *\n * `name` is percent-encoded: it lands in a URL path, and a key that predates\n * the kebab-slug grammar may still contain something that needs escaping.\n */\nfunction curlInvokeCommand(\n group: \"functions\" | \"endpoints\",\n name: string,\n bodyKey: \"inputs\" | \"input\",\n payload: Record<string, string>,\n): string {\n const url = `\"$W6W_BASE_URL/${group}/${encodeURIComponent(name)}/invoke\"`;\n return curlBody(url, { [bodyKey]: payload });\n}\n\n/**\n * The Workflow arm: `POST /workflows/{id}/run?wait=true` — same route as the\n * node/cli/python lanes' `wait: true` / `--wait`. Mirrors `cliWorkflowCommand`\n * (D-3/D-4): required trigger fields are active JSON, optional ones are named\n * in a trailing `#` comment line each (JSON admits no comments), and a\n * trigger with no usable fields emits a bare `{}` body and no trailer.\n */\nfunction curlWorkflowCommand(id: string, fields: readonly TriggerPreviewFieldDef[]): string {\n const url = `\"$W6W_BASE_URL/workflows/${id}/run?wait=true\"`;\n if (fields.length === 0) return curlBody(url, {});\n const required = fields.filter((f) => f.required === true);\n const optional = fields.filter((f) => f.required !== true);\n const payload = Object.fromEntries(\n required.map((f) => [f.key as string, fieldPlaceholderValue(f.type, f.key as string)]),\n );\n let cmd = curlBody(url, { input: payload });\n for (const f of optional) {\n cmd += `\\n# optional: ${f.key} (${f.type ?? \"string\"})`;\n }\n return cmd;\n}\n\n/**\n * Build the Node + CLI snippet for one resource, or `null` when the contract\n * has no operation for it (today: a function or endpoint whose id carries no\n * runnable prefix).\n */\nexport function buildSnippet(\n resource: SnippetCallable,\n triggerFields?: readonly TriggerPreviewFieldDef[],\n): Snippet | null {\n switch (resource.kind) {\n case \"workflow\": {\n if (!isUrnAddressable(resource.id)) return null;\n const name = addressName(resource);\n const fields = usableTriggerFields(triggerFields);\n return {\n operation: \"workflows.run — POST /workflows/{idOrKey}/run\",\n node: `${nodePreamble()}\n\n// \\`wait: true\\` blocks until the run reaches a terminal state.\n// Omit it and you get \\`{ runId, status: \"queued\" }\\` back immediately.\nconst result = await client.workflows.run(${JSON.stringify(name)}, {\n wait: true,${nodeInputBlock(fields)}\n});\n\nconsole.log(result.status, result.runId);`,\n cli: cliWorkflowCommand(name, fields),\n python: `${pythonPreamble()}\n\n# \\`wait=True\\` blocks until the run reaches a terminal state.\n# Omit it and you get \\`WorkflowRunResult(status=\"queued\", ...)\\` back immediately.\nresult = ${pythonWorkflowCall(name, fields)}\n\nprint(result.status, result.runId)`,\n curl: curlWorkflowCommand(name, fields),\n };\n }\n\n case \"function\": {\n if (!isUrnAddressable(resource.id)) return null;\n const name = addressName(resource);\n // JSON carries no comments, so the CLI/curl lanes take the REQUIRED\n // inputs and name the optional ones underneath; Node and Python render\n // every input and comment the optional ones out in place.\n const payload = samplePayload(resource.inputs, true);\n const payloadJson = JSON.stringify(payload);\n const notes = optionalNotes(resource.inputs);\n const payloadBlock = payloadSource(resource.inputs, { indent: \" \", comment: \"//\" });\n const pythonPayload = payloadSource(resource.inputs, {\n indent: \"\",\n comment: \"#\",\n compact: true,\n });\n return {\n operation: \"functions.run — POST /functions/{idOrKey}/invoke\",\n node: `${nodePreamble()}\n\n// The name is the first argument, and it may be the Function's key or its\n// \\`fn_…\\` id — one slot takes either. Returns the OUTPUT directly: the kind is\n// settled by the method, so there is no envelope to narrow.\nconst output = await client.functions.run(${JSON.stringify(name)}, {\n payload: ${payloadBlock},\n});\n\nconsole.log(output);`,\n cli:\n cliCommand(`w6w functions run ${name}`, `--payload ${shellQuote(payloadJson)}`) + notes,\n python: `${pythonPreamble()}\n\n# The name is the first argument — the Function's key or its \\`fn_…\\` id.\noutput = client.functions.run(${JSON.stringify(name)}, payload=${pythonPayload})\n\nprint(output)`,\n curl: curlInvokeCommand(\"functions\", name, \"inputs\", payload) + notes,\n };\n }\n\n case \"endpoint\": {\n if (!isUrnAddressable(resource.id)) return null;\n // Which of the two server-rendered URLs the raw-HTTP arm shows. The\n // absence of a URL altogether means no `curl` snippet at all, rather than\n // a plausible-looking one built here.\n const httpUrl =\n resource.urlForm === \"key\" && resource.invokeUrlByKey\n ? resource.invokeUrlByKey\n : resource.invokeUrl;\n const name = addressName(resource);\n const payload = samplePayload(resource.inputs, true);\n const payloadJson = JSON.stringify(payload);\n const notes = optionalNotes(resource.inputs);\n const payloadBlock = payloadSource(resource.inputs, { indent: \" \", comment: \"//\" });\n const pythonPayload = payloadSource(resource.inputs, {\n indent: \"\",\n comment: \"#\",\n compact: true,\n });\n return {\n operation: \"endpoints.run — POST /endpoints/{idOrKey}/invoke\",\n node: `${nodePreamble()}\n\n// The name is the first argument — the Endpoint's key or its \\`ep_…\\` id. Unlike\n// \\`functions.run\\` this returns the ENVELOPE: an Endpoint dispatches to an app\n// action, a Function or a Workflow, and only \\`kind\\` says which answered.\nconst envelope = await client.endpoints.run(${JSON.stringify(name)}, {\n payload: ${payloadBlock},\n});\n\nconsole.log(envelope.kind, envelope);`,\n cli:\n cliCommand(`w6w endpoints run ${name}`, `--payload ${shellQuote(payloadJson)}`) + notes,\n python: `${pythonPreamble()}\n\n# The name is the first argument — the Endpoint's key or its \\`ep_…\\` id.\nenvelope = client.endpoints.run(${JSON.stringify(name)}, payload=${pythonPayload})\n\nprint(envelope[\"kind\"], envelope)`,\n ...(typeof httpUrl === \"string\" && httpUrl !== \"\"\n ? { curl: curlCommand(httpUrl, payload) + notes }\n : {}),\n };\n }\n\n case \"connection\": {\n if (!isUrnAddressable(resource.id)) return null;\n // Same split as the Function/Endpoint arms: the CLI carries the REQUIRED\n // params and names the optional ones underneath; Node and Python render\n // every param and comment the optional ones out. An all-required action\n // keeps the original compact rendering, byte for byte.\n const payload = samplePayload(resource.params, true);\n const notes = optionalNotes(resource.params);\n const allRequired = resolveInputs(resource.params).every((i) => i.required);\n const nodePayload = allRequired\n ? JSON.stringify(payload, null, 2).replaceAll(\"\\n\", \"\\n \")\n : payloadSource(resource.params, { indent: \" \", comment: \"//\" });\n const pythonPayload = payloadSource(resource.params, {\n indent: \"\",\n comment: \"#\",\n compact: true,\n });\n return {\n operation: \"run — POST /run\",\n node: `${nodePreamble(\"isActionRun\")}\n\n// An app action runs through the CONNECTION that authenticates it, so the URN\n// is the connection id and \\`action\\` names the action on its app. This is the\n// one arm where \\`action\\` is required — a workflow, function or endpoint URN\n// has no action to name.\nconst envelope = await client.run({\n urn: ${JSON.stringify(resource.id)},\n action: ${JSON.stringify(resource.action)},\n payload: ${nodePayload},\n});\n\nif (isActionRun(envelope)) console.log(envelope.value);`,\n cli:\n cliCommand(\n `w6w run ${resource.id}`,\n `--action ${resource.action}`,\n `--payload ${shellQuote(JSON.stringify(payload))}`,\n ) + notes,\n python: `${pythonPreamble(\"is_action_run\")}\n\n# An app action runs through the CONNECTION that authenticates it, so the URN\n# is the connection id and \\`action\\` names the action on its app. This is the\n# one arm where \\`action\\` is required — a workflow, function or endpoint URN\n# has no action to name.\nenvelope = client.run(\n ${JSON.stringify(resource.id)},\n action=${JSON.stringify(resource.action)},\n payload=${pythonPayload},\n)\n\nif is_action_run(envelope):\n print(envelope[\"value\"])`,\n };\n }\n\n case \"var\":\n return {\n operation: \"vars.getByName — GET /vars/by-name/{name}\",\n node: `${nodePreamble()}\n\nconst variable = await client.vars.getByName(${JSON.stringify(resource.name)});\nconsole.log(variable.value);`,\n cli: `w6w vars get-by-name ${resource.name}`,\n python: `${pythonPreamble()}\n\nvariable = client.vars.get_by_name(${JSON.stringify(resource.name)})\nprint(variable.value)`,\n };\n\n case \"document\":\n return {\n operation: \"documents.getByKey — GET /documents/by-key/{key}\",\n node: `${nodePreamble()}\n\nconst doc = await client.documents.getByKey(${JSON.stringify(resource.key)});\nconsole.log(doc.content);`,\n cli: `w6w documents get-by-key ${shellQuote(resource.key)}`,\n python: `${pythonPreamble()}\n\ndoc = client.documents.get_by_key(${JSON.stringify(resource.key)})\nprint(doc.content)`,\n };\n }\n}\n\n/** Why no snippet exists, phrased for the reader rather than for a log. */\nexport function unavailableReason(resource: SnippetCallable): string {\n if (\n (resource.kind === \"function\" ||\n resource.kind === \"endpoint\" ||\n resource.kind === \"workflow\") &&\n !isUrnAddressable(resource.id)\n ) {\n return `This ${resource.kind}'s id (${resource.id}) has no \\`${\n resource.kind === \"workflow\" ? \"wf_\" : resource.kind === \"function\" ? \"fn_\" : \"ep_\"\n }\\` prefix, so it cannot be addressed by URN. The SDK and CLI reach ${resource.kind}s through \\`run\\`, which resolves a URN by that prefix — re-create it with a host-issued id to call it from code.`;\n }\n return \"The client libraries do not expose an operation for this yet.\";\n}\n","/**\n * Slug rules — the ONE place in `studio/src` that owns one.\n *\n * Two rules live here and they are deliberately NOT the same rule:\n *\n * · `slugify()` turns a human display name into a machine key. It is the\n * fallback the Endpoint and Function editors use when the operator leaves\n * `key` blank, and it is permissive on purpose: whatever it returns is a\n * legal resource key, digits-first and two characters included.\n * · `ACCOUNT_SLUG_RE` / `isValidAccountSlug()` decide whether a string is a\n * legal ACCOUNT slug — the account segment a key-form invoke URL is\n * addressed by. That rule is stricter: it must start with a letter and run to\n * at least three characters, so `2024-team` and `ab` are both perfectly good\n * keys and both invalid account slugs.\n *\n * The regex is exported rather than re-typed by each caller. A second copy is\n * exactly how a form comes to accept a value the server rejects, so the literal\n * appears in this file and nowhere else in `src/`.\n *\n * Why `src/lib` and why this module imports nothing: `src/lib/*.ts` is the only\n * place studio's `node --test` suite can reach. A rule living inside a `.tsx`\n * page cannot be unit-tested at all (Node's type-stripping does not parse JSX),\n * and a `src/lib` module that imports `@w6w/ui` throws\n * `ERR_UNKNOWN_FILE_EXTENSION` under the same runner because the barrel\n * re-exports `.tsx`. Same constraint documented at\n * `src/lib/workflow-validity.ts:11-20`.\n */\n\n/** Kebab-case a display name into a machine key (the fallback when key is blank). */\nexport function slugify(s: string): string {\n return s\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\n/**\n * A legal account slug: lowercase, opens with a LETTER, then two or more\n * letters/digits/hyphens — three characters minimum.\n *\n * Note this is NOT the server's `tenants.ts` `SLUG_RE`\n * (`/^[a-z0-9][a-z0-9_-]*$/`), which governs tenant ids and is a different,\n * more permissive rule. Do not merge the two.\n */\nexport const ACCOUNT_SLUG_RE = /^[a-z][a-z0-9-]{2,}$/;\n\n/** Does `s` satisfy {@link ACCOUNT_SLUG_RE}? */\nexport function isValidAccountSlug(s: string): boolean {\n return ACCOUNT_SLUG_RE.test(s);\n}\n\n/**\n * A legal Endpoint `key` — mirrors the server's rule VERBATIM, not\n * {@link ACCOUNT_SLUG_RE} above: that one is `{2,}` with no 39-character cap\n * and encodes neither the `--` rule nor the trailing-`-` rule, so a form that\n * validated a key with it would accept a value the server rejects.\n *\n * Source of truth: `packages/server/packages/bll/accounts.ts:72`\n * (`ACCOUNT_SLUG_RE = /^[a-z][a-z0-9-]{2,38}$/`) + `:216-218` (`isAccountSlug`),\n * reached from `packages/server/packages/api/invoke-address.ts:55-57`\n * (`isEndpointKey = isAccountSlug`). There is no reserved-word check on an\n * Endpoint key server-side — `isAccountSlug` only, never\n * `RESERVED_ACCOUNT_SLUGS` — so none is added here either.\n */\nexport function isEndpointKey(s: string): boolean {\n return /^[a-z][a-z0-9-]{2,38}$/.test(s) && !s.includes(\"--\") && !s.endsWith(\"-\");\n}\n\n/**\n * Filters a keystroke into a key input down to what {@link isEndpointKey}'s\n * grammar can ever accept: lowercase letters, digits, hyphens — nothing\n * else, capped at the grammar's own 39-character ceiling. A space or any\n * other disallowed character is dropped outright rather than folded into a\n * `-` ({@link slugify}'s job, for the one-time displayName-to-key fallback —\n * this is a LIVE filter on a field the operator is typing directly into, so\n * silently substituting a different character would be its own surprise).\n * Positional rules the grammar also enforces (must START with a letter, no\n * `--`, no trailing `-`) are left to {@link isEndpointKey} at Save time —\n * blocking those mid-keystroke would refuse a caller who is one keystroke\n * away from a valid value (e.g. typing `\"2\"` before backspacing to start\n * over).\n */\nexport function filterKeyInput(raw: string): string {\n return raw\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"\")\n .slice(0, 39);\n}\n"],"names":["RUNNABLE_PREFIXES","isUrnAddressable","id","p","addressName","resource","_a","key","shellQuote","value","CLI_WRAP_AT","cliCommand","head","flags","parts","oneLine","resolveInputs","inputs","i","samplePayload","requiredOnly","resolved","used","payloadSource","opts","required","member","optionalNotes","usableTriggerFields","fields","f","fieldPlaceholderValue","type","fieldSourceLiteral","python","nodeInputBlock","pythonWorkflowCall","idLiteral","lines","cliWorkflowCommand","optional","payload","cmd","nodePreamble","extra","pythonPreamble","curlBody","urlToken","data","curlCommand","url","curlInvokeCommand","group","name","bodyKey","curlWorkflowCommand","buildSnippet","triggerFields","payloadJson","notes","payloadBlock","pythonPayload","httpUrl","nodePayload","unavailableReason","slugify","s","ACCOUNT_SLUG_RE","isValidAccountSlug","isEndpointKey","filterKeyInput","raw"],"mappings":"AA6HA,MAAMA,IAAoB,CAAC,SAAS,OAAO,OAAO,KAAK;AAYhD,SAASC,EAAiBC,GAAqB;AACpD,SAAOF,EAAkB,KAAK,CAACG,MAAMD,EAAG,WAAWC,CAAC,CAAC;AACvD;AA2BA,SAASC,EAAYC,GAAuC;AAzC5D,MAAAC;AA0CE,QAAMC,KAAOD,IAAAD,EAA8B,QAA9B,gBAAAC,EAAmC;AAChD,SAAOC,KAAOA,EAAI,SAAS,IAAIA,IAAMF,EAAS;AAChD;AAGA,SAASG,EAAWC,GAAuB;AACzC,SAAO,IAAIA,EAAM,WAAW,KAAK,OAAO,CAAC;AAC3C;AAOA,MAAMC,IAAc;AAyBpB,SAASC,EAAWC,MAAiBC,GAAyB;AAC5D,QAAMC,IAAQ,CAACF,GAAM,GAAGC,CAAK,EAAE,OAAO,CAACV,MAAMA,EAAE,SAAS,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QAElE,KAAK,4BAA4BG,EAAWH,EAAS,GAAG,CAAC;AAAA,QACzD,QAAQ,GAAGwC,EAAA,CAAgB;AAAA;AAAA,oCAEC,KAAK,UAAUxC,EAAS,GAAG,CAAC;AAAA;AAAA,MAAA;AAAA,EAE1D;AAEN;AAGO,SAAS2D,EAAkB3D,GAAmC;AACnE,UACGA,EAAS,SAAS,cACjBA,EAAS,SAAS,cAClBA,EAAS,SAAS,eACpB,CAACJ,EAAiBI,EAAS,EAAE,IAEtB,QAAQA,EAAS,IAAI,UAAUA,EAAS,EAAE,cAC/CA,EAAS,SAAS,aAAa,QAAQA,EAAS,SAAS,aAAa,QAAQ,KAChF,sEAAsEA,EAAS,IAAI,sHAE9E;AACT;ACzrBO,SAAS4D,EAAQC,GAAmB;AACzC,SAAOA,EACJ,cACA,OACA,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AAC3B;AAUO,MAAMC,IAAkB;AAGxB,SAASC,EAAmBF,GAAoB;AACrD,SAAOC,EAAgB,KAAKD,CAAC;AAC/B;AAeO,SAASG,EAAcH,GAAoB;AAChD,SAAO,yBAAyB,KAAKA,CAAC,KAAK,CAACA,EAAE,SAAS,IAAI,KAAK,CAACA,EAAE,SAAS,GAAG;AACjF;AAgBO,SAASI,EAAeC,GAAqB;AAClD,SAAOA,EACJ,cACA,QAAQ,eAAe,EAAE,EACzB,MAAM,GAAG,EAAE;AAChB;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useQueryClient as c, useMutation as l, useQuery as f } from "@tanstack/react-query";
|
|
2
2
|
import { path as i } from "@w6w/sdk";
|
|
3
3
|
import { u } from "./client-context-CX61Bgw-.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { i as p, a as d } from "./callables-tOlflvbl.js";
|
|
5
|
+
import { o as y, _ as b } from "./spec-import-CW6R_Wk1.js";
|
|
6
6
|
const h = (t) => d("endpoint", t), m = (t) => d("function", t), a = {
|
|
7
7
|
function: "functions",
|
|
8
8
|
workflow: "workflows",
|
|
@@ -134,7 +134,7 @@ function F(t) {
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function _(t) {
|
|
138
138
|
const n = u(), s = c();
|
|
139
139
|
return l({
|
|
140
140
|
mutationFn: async (e) => {
|
|
@@ -151,7 +151,7 @@ function g(t) {
|
|
|
151
151
|
onSettled: () => s.invalidateQueries({ queryKey: y.root })
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function g(t, n, s) {
|
|
155
155
|
const e = u();
|
|
156
156
|
return f({
|
|
157
157
|
queryKey: ["spec", t, n],
|
|
@@ -166,11 +166,11 @@ export {
|
|
|
166
166
|
Q as a,
|
|
167
167
|
F as b,
|
|
168
168
|
v as c,
|
|
169
|
-
|
|
169
|
+
g as d,
|
|
170
170
|
O as e,
|
|
171
171
|
T as f,
|
|
172
172
|
w as g,
|
|
173
|
-
|
|
173
|
+
_ as u,
|
|
174
174
|
$ as v
|
|
175
175
|
};
|
|
176
|
-
//# sourceMappingURL=spec-export-
|
|
176
|
+
//# sourceMappingURL=spec-export-CBbloO_n.js.map
|