@w6w/embed 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +166 -2
  3. package/dist/W6WEmbedProvider.d.ts +29 -0
  4. package/dist/chrome/CallFromCodeButton.d.ts +155 -0
  5. package/dist/chrome/CallableSettingsModal.d.ts +17 -0
  6. package/dist/chrome/ConfirmModal.d.ts +20 -0
  7. package/dist/chrome/DangerZone.d.ts +19 -0
  8. package/dist/chrome/ExecutionProfileHeader.d.ts +69 -0
  9. package/dist/chrome/HistoryButton.d.ts +8 -0
  10. package/dist/chrome/HistoryModal.d.ts +9 -0
  11. package/dist/chrome/HistoryView.d.ts +15 -0
  12. package/dist/chrome/ImportSpecModal.d.ts +40 -0
  13. package/dist/chrome/JsonToggle.d.ts +51 -0
  14. package/dist/chrome/Modal.d.ts +20 -0
  15. package/dist/chrome/RightRail.d.ts +24 -0
  16. package/dist/chrome/TagEditor.d.ts +23 -0
  17. package/dist/chrome/VersionHistoryModal.d.ts +38 -0
  18. package/dist/chrome/history-open-run.d.ts +7 -0
  19. package/dist/chrome/index.d.ts +36 -0
  20. package/dist/chrome/workspace.d.ts +67 -0
  21. package/dist/client-context-CX61Bgw-.js +16 -0
  22. package/dist/client-context-CX61Bgw-.js.map +1 -0
  23. package/dist/draft/autosave-flush.d.ts +63 -0
  24. package/dist/draft/autosave.d.ts +68 -0
  25. package/dist/draft/client-context.d.ts +8 -0
  26. package/dist/draft/draft-registry.d.ts +14 -0
  27. package/dist/draft/index.d.ts +15 -0
  28. package/dist/draft/use-workflow-draft.d.ts +67 -0
  29. package/dist/draft/workflow-save.d.ts +48 -0
  30. package/dist/draft-registry-YF0tqNN0.js +49 -0
  31. package/dist/draft-registry-YF0tqNN0.js.map +1 -0
  32. package/dist/draft.d.ts +2 -0
  33. package/dist/draft.mjs +18 -0
  34. package/dist/draft.mjs.map +1 -0
  35. package/dist/editor/WorkflowEditor.d.ts +12 -0
  36. package/dist/editor/WorkflowSettingsModal.d.ts +17 -0
  37. package/dist/editor/definition.d.ts +31 -0
  38. package/dist/editor/editor-apps.d.ts +7 -0
  39. package/dist/editor/types.d.ts +34 -0
  40. package/dist/editor.d.ts +9 -0
  41. package/dist/editor.mjs +2170 -0
  42. package/dist/editor.mjs.map +1 -0
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.mjs +67 -0
  45. package/dist/index.mjs.map +1 -0
  46. package/dist/lib/callable-descriptors.d.ts +77 -0
  47. package/dist/lib/callable-kind.d.ts +13 -0
  48. package/dist/lib/code-rail.d.ts +45 -0
  49. package/dist/lib/document-sources.d.ts +26 -0
  50. package/dist/lib/error-handler-self.d.ts +25 -0
  51. package/dist/lib/history-query.d.ts +135 -0
  52. package/dist/lib/import-paste.d.ts +41 -0
  53. package/dist/lib/index.d.ts +17 -0
  54. package/dist/lib/new-id.d.ts +10 -0
  55. package/dist/lib/rail-settings.d.ts +196 -0
  56. package/dist/lib/save-invalidation.d.ts +24 -0
  57. package/dist/lib/sdk-snippets.d.ts +96 -0
  58. package/dist/lib/settings-rail.d.ts +68 -0
  59. package/dist/lib/slug.d.ts +69 -0
  60. package/dist/lib/spec-import-invalidation.d.ts +48 -0
  61. package/dist/lib/tag-editor.d.ts +36 -0
  62. package/dist/lib/trigger-preview.d.ts +89 -0
  63. package/dist/lib/workflow-live-run.d.ts +165 -0
  64. package/dist/lib/workflow-poll.d.ts +8 -0
  65. package/dist/lib/workflow-route.d.ts +26 -0
  66. package/dist/lib/workflow-settings.d.ts +72 -0
  67. package/dist/lib/workflow-validity.d.ts +92 -0
  68. package/dist/lib/workflow-variables.d.ts +106 -0
  69. package/dist/lib.d.ts +2 -0
  70. package/dist/lib.mjs +62 -0
  71. package/dist/lib.mjs.map +1 -0
  72. package/dist/project-context-Dbk0Gr1K.js +16 -0
  73. package/dist/project-context-Dbk0Gr1K.js.map +1 -0
  74. package/dist/project-context.d.ts +11 -0
  75. package/dist/rail/CodeTool.d.ts +2 -0
  76. package/dist/rail/ErrorHandlingTool.d.ts +22 -0
  77. package/dist/rail/ExpressionScope.d.ts +21 -0
  78. package/dist/rail/SettingsTool.d.ts +27 -0
  79. package/dist/rail/editor-tools.d.ts +2 -0
  80. package/dist/rail/rail-env.d.ts +18 -0
  81. package/dist/rail/settings-sections.d.ts +93 -0
  82. package/dist/repos/documents.d.ts +102 -0
  83. package/dist/repos/history.d.ts +24 -0
  84. package/dist/repos/index.d.ts +22 -0
  85. package/dist/repos/spec-import.d.ts +44 -0
  86. package/dist/repos/step-tests.d.ts +19 -0
  87. package/dist/repos/vars.d.ts +25 -0
  88. package/dist/repos/vault.d.ts +24 -0
  89. package/dist/repos/versions.d.ts +112 -0
  90. package/dist/repos.d.ts +2 -0
  91. package/dist/repos.mjs +94 -0
  92. package/dist/repos.mjs.map +1 -0
  93. package/dist/slug-ByKQgxrf.js +642 -0
  94. package/dist/slug-ByKQgxrf.js.map +1 -0
  95. package/dist/spec-import-HgO7ZkLZ.js +898 -0
  96. package/dist/spec-import-HgO7ZkLZ.js.map +1 -0
  97. package/dist/spec-import-invalidation-D3retX4Q.js +18 -0
  98. package/dist/spec-import-invalidation-D3retX4Q.js.map +1 -0
  99. package/dist/use-workflow-draft-oI02dsP-.js +314 -0
  100. package/dist/use-workflow-draft-oI02dsP-.js.map +1 -0
  101. package/package.json +84 -3
  102. package/src/styles.css +829 -0
@@ -0,0 +1,27 @@
1
+ import { RailTool } from '../chrome/RightRail.tsx';
2
+ import { WorkspaceCallable } from '../chrome/workspace.tsx';
3
+ import { RailNavigation } from './rail-env.tsx';
4
+ /**
5
+ * The three open flags a Settings panel shows: the Name/Key/Tags modal, the history section, and
6
+ * the version list modal. They are OWNED BY THE CALLER (a stateful shell above every kind's arm),
7
+ * not by the arm: a rail that stays mounted across a kind change (function -> workflow ->
8
+ * endpoint) swaps arm component types, and state held in the arm would be remounted away,
9
+ * closing an open modal. Lifting them keeps the modal open exactly as the pre-split single
10
+ * component did.
11
+ */
12
+ export type SettingsOpenState = {
13
+ editingSettings: boolean;
14
+ setEditingSettings: (v: boolean) => void;
15
+ historyOpen: boolean;
16
+ setHistoryOpen: (v: boolean) => void;
17
+ versionListOpen: boolean;
18
+ setVersionListOpen: (v: boolean) => void;
19
+ };
20
+ export declare function WorkflowSettingsPanel({ ctx, project, onNavigate, open, }: {
21
+ ctx: WorkspaceCallable;
22
+ project: string | null;
23
+ onNavigate: (to: RailNavigation) => void;
24
+ open: SettingsOpenState;
25
+ }): import("react").JSX.Element;
26
+ /** The package's Settings tool — workflow context only (Studio keeps its own for the other arms). */
27
+ export declare const settingsTool: RailTool;
@@ -0,0 +1,2 @@
1
+ import { RailTool } from '../chrome/RightRail.tsx';
2
+ export declare const editorRailTools: readonly RailTool[];
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { SpecImportKind } from '../lib/spec-import-invalidation.ts';
3
+ /** Where the host should go after a rail action. */
4
+ export type RailNavigation = {
5
+ type: "list";
6
+ } | {
7
+ type: "imported";
8
+ kind: SpecImportKind;
9
+ id: string;
10
+ };
11
+ export interface RailEnv {
12
+ project: string | null;
13
+ onNavigate(to: RailNavigation): void;
14
+ }
15
+ export declare function RailEnvProvider({ project, onNavigate, children, }: RailEnv & {
16
+ children: ReactNode;
17
+ }): import("react").JSX.Element;
18
+ export declare function useRailEnv(): RailEnv;
@@ -0,0 +1,93 @@
1
+ import { ReactNode } from 'react';
2
+ import { RailSettingsKind } from '../lib/rail-settings.ts';
3
+ import { VersionSummary, VersionsEnvelope } from '../repos/versions.ts';
4
+ /** The three kinds the Settings panel renders for. */
5
+ export type SettingsKind = Extract<RailSettingsKind, "function" | "endpoint" | "workflow">;
6
+ /** Heading row: the title and the "Edit settings" trigger for the unified settings modal. */
7
+ export declare function SettingsHeading(props: {
8
+ onEdit: () => void;
9
+ }): import("react").JSX.Element;
10
+ /**
11
+ * id + key + updated (+ tags, workflow only) — and nothing else. No createdAt, ever. A two-column
12
+ * label/value GRID (`dl`/`dt`/`dd`); `.rail-meta-list` is the rail-scoped grid and there is
13
+ * deliberately no global `dl`/`dt`/`dd` rule.
14
+ */
15
+ export declare function MetadataSection(props: {
16
+ id: string;
17
+ displayName: string;
18
+ /** `metadataFieldsForKind(kind)`. */
19
+ fields: ReadonlyArray<"id" | "key" | "updatedAt">;
20
+ /** The already-cached list row (carries key/updatedAt); `undefined` until the list loads. */
21
+ row: {
22
+ key?: string | null;
23
+ updatedAt: string;
24
+ } | undefined;
25
+ /** Workflow only: the tag chips. `undefined` hides the row (function/endpoint). */
26
+ tags?: readonly string[];
27
+ }): import("react").JSX.Element;
28
+ /**
29
+ * A5: one icon opens the combined Export/Edit JSON/Import chooser. Nothing here grows with the
30
+ * size of the resource's definition — the definition renders in neither vessel here, only inside
31
+ * a modal.
32
+ */
33
+ export declare function SpecActionsTrigger(props: {
34
+ onOpen: () => void;
35
+ }): import("react").JSX.Element;
36
+ /**
37
+ * The chooser shell: Import always (it creates a NEW resource and navigates to it, never an
38
+ * in-place replacement), plus a slot the host fills with extra definition actions (Studio adds
39
+ * Export + Edit JSON for function/endpoint). Picking an item closes THIS modal and opens that
40
+ * item's own — nothing is ever nested inside this one's body.
41
+ */
42
+ export declare function SpecChooserModal(props: {
43
+ kind: SettingsKind;
44
+ /** Extra definition actions, rendered above the Import row. */
45
+ children?: ReactNode;
46
+ onImport: () => void;
47
+ onClose: () => void;
48
+ }): import("react").JSX.Element;
49
+ /**
50
+ * Version history (A4): a link-styled icon, ALWAYS enabled ("no earlier versions" is an empty
51
+ * state INSIDE the list modal, never a disabled control). Once opened (`open`), the un-carded
52
+ * "Published: vN" line and Publish / Enable-Disable stay in the main panel.
53
+ */
54
+ export declare function VersionSection(props: {
55
+ open: boolean;
56
+ versions: VersionsEnvelope | undefined;
57
+ publishing: boolean;
58
+ togglingEnabled: boolean;
59
+ publishError: string | null;
60
+ enableError: string | null;
61
+ onShow: () => void;
62
+ onPublish: () => void;
63
+ onToggleEnabled: () => void;
64
+ }): import("react").JSX.Element;
65
+ /**
66
+ * The "All versions" list modal — deliberately NOT titled "Version history" (which would share
67
+ * the `Version …` aria-label prefix the per-version detail viewer's own dialogs use).
68
+ */
69
+ export declare function VersionListModal(props: {
70
+ loading: boolean;
71
+ versions: readonly VersionSummary[] | undefined;
72
+ onSelect: (versionNumber: number) => void;
73
+ onClose: () => void;
74
+ }): import("react").JSX.Element;
75
+ /**
76
+ * The bottom "danger zone": Archive (until archived) then Delete, with the two confirm modals.
77
+ * Per-kind variance (copy, test ids) is the table above; the caller owns the mutations and the
78
+ * confirm/error state, and renders this only when `hasDelete(kind)`.
79
+ */
80
+ export declare function SettingsDangerZone(props: {
81
+ kind: SettingsKind;
82
+ archived: boolean;
83
+ deleteConfirming: boolean;
84
+ archiveConfirming: boolean;
85
+ deleteError: string | null;
86
+ archiveError: string | null;
87
+ onRequestDelete: () => void;
88
+ onRequestArchive: () => void;
89
+ onConfirmDelete: () => void;
90
+ onConfirmArchive: () => void;
91
+ onCloseDelete: () => void;
92
+ onCloseArchive: () => void;
93
+ }): import("react").JSX.Element;
@@ -0,0 +1,102 @@
1
+ import { Doc, DocumentCreateInput, DocumentPatch } from '@w6w/sdk';
2
+ /**
3
+ * T1.1.1's wire shape for one document, pinned here ahead of that node
4
+ * merging (this node is dispatched speculatively against it — see this
5
+ * task's contract). `shared` and the six `source*`/`syncedAt` fields are all
6
+ * additive over the SDK's own `Doc`, so a locally-created document simply
7
+ * carries them as `null` (or `false` for `shared`) rather than omitting
8
+ * them. Do not rename a field — the server produces these names verbatim.
9
+ */
10
+ export interface DocWithProvenance extends Doc {
11
+ shared: boolean;
12
+ /** "owner/name" of the bound repository this document was pulled from. */
13
+ sourceRepo: string | null;
14
+ /** Repo-relative file path the document was pulled from. */
15
+ sourcePath: string | null;
16
+ /** The pulled file's content hash — NOT a commit SHA. */
17
+ sourceSha: string | null;
18
+ /** The repository's HEAD commit SHA at pull time — NOT a content hash. */
19
+ sourceRefSha: string | null;
20
+ /** Web link to the file; may be absent even when the rest of provenance is set. */
21
+ sourceUrl: string | null;
22
+ /** ISO-8601. Stamped at the document's last actual change, not at every sync. */
23
+ syncedAt: string | null;
24
+ }
25
+ /**
26
+ * Which provenance state `DocumentDetailPage.tsx`'s "Source" card should
27
+ * render for `doc`. `shared` (not `sourceRepo`) is the gate: a shared
28
+ * document whose provenance columns haven't been stamped yet (any document
29
+ * synced before this feature shipped, until its next real-content sync —
30
+ * tier-1 "unchanged" syncs never restamp provenance) is still shared, and
31
+ * must say so, distinct from a genuinely private document.
32
+ *
33
+ * - `"private"` — `doc.shared` is false. No card.
34
+ * - `"pending"` — shared, but `sourceRepo` hasn't been stamped yet.
35
+ * - `"synced"` — shared, with full provenance available.
36
+ */
37
+ export declare function documentProvenanceState(doc: DocWithProvenance): "private" | "pending" | "synced";
38
+ /** Query key for a documents list, optionally scoped to a project. */
39
+ export declare function documentsKey(projectId?: string): readonly ["documents", string | undefined];
40
+ /**
41
+ * Query key for a single document, scoped to a project (mirrors
42
+ * {@linkcode useDocumentsQuery}'s fix at :72-79/:80-87 below — `projectId`
43
+ * belongs in the key itself, not just the `queryFn`, so a render where the
44
+ * key was cached under `projectId === undefined` genuinely changes key once
45
+ * `ProjectContext` resolves the real one, instead of reusing the same cache
46
+ * entry — and its `retry: false` wrong-project 404 — forever). Still sits
47
+ * under the bare `["documents"]` prefix every mutation below invalidates, so
48
+ * an edit/delete refreshes this page too — `"detail"` keeps it from
49
+ * colliding with {@linkcode documentsKey}'s own `["documents", projectId]`
50
+ * shape.
51
+ */
52
+ export declare function documentKey(id: string, projectId?: string): readonly ["documents", "detail", string, string | undefined];
53
+ /**
54
+ * A single document by id, cast to {@link DocWithProvenance} (D-5): the SDK's
55
+ * `Doc` doesn't model T1.1.1's provenance fields yet, and this repo is not
56
+ * the place to fork or extend `@w6w/sdk` (D-4). The `project` option is
57
+ * passed exactly as {@linkcode useDocumentsQuery} passes it — a document in a
58
+ * non-default project 404s without it. `enabled` defaults `true` to preserve
59
+ * that unscoped fallback for a caller that genuinely wants it — same as
60
+ * {@linkcode useDocumentsQuery}'s own `enabled` doc comment below — a
61
+ * project-scoped page should instead pass `enabled: projectId != null` so it
62
+ * never queries (and never renders) against the wrong project while
63
+ * `ProjectContext`'s own project list is still resolving.
64
+ */
65
+ export declare function useDocumentQuery(id: string, projectId?: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<DocWithProvenance>, Error>;
66
+ /**
67
+ * The current project's documents (or the tenant default when unscoped).
68
+ * `enabled` defaults `true` to preserve that unscoped fallback for a caller
69
+ * that genuinely wants it — a project-scoped page should instead pass
70
+ * `enabled: projectId != null` so it never queries (and never renders)
71
+ * against the wrong project while `ProjectContext`'s own project list is
72
+ * still resolving.
73
+ */
74
+ export declare function useDocumentsQuery(projectId?: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<DocWithProvenance[]>, Error>;
75
+ export declare function useCreateDocumentMutation(): import('@tanstack/react-query').UseMutationResult<Doc, Error, {
76
+ input: DocumentCreateInput;
77
+ project?: string;
78
+ }, unknown>;
79
+ export declare function useUpdateDocumentMutation(): import('@tanstack/react-query').UseMutationResult<Doc, Error, {
80
+ id: string;
81
+ patch: DocumentPatch;
82
+ project?: string;
83
+ }, unknown>;
84
+ export declare function useDeleteDocumentMutation(): import('@tanstack/react-query').UseMutationResult<void, Error, {
85
+ id: string;
86
+ project?: string;
87
+ }, unknown>;
88
+ /**
89
+ * Re-pulls a shared document from its bound repository ("Sync" button, T2.1.4)
90
+ * — `POST /documents/:id/sync` (T3.1.1). No SDK method exists for this route
91
+ * yet (D-4/D-5), so this goes through `apiClient.request()` directly, same
92
+ * escape hatch `repo-sync.ts`'s `useSyncRepoNowMutation` uses. The document
93
+ * routes are project-scoped by QUERY param, not a path segment (unlike
94
+ * `repo-binding`'s `/projects/:id/...` shape), so `project` travels in
95
+ * `query`, mirroring {@linkcode useDocumentQuery}'s own `{ project: … }` use.
96
+ */
97
+ export declare function useSyncDocumentMutation(): import('@tanstack/react-query').UseMutationResult<import('@w6w/sdk').HttpResponse<{
98
+ document: DocWithProvenance;
99
+ }>, Error, {
100
+ id: string;
101
+ project?: string;
102
+ }, unknown>;
@@ -0,0 +1,24 @@
1
+ import { ExecutionSummary, HistoryFilters, HistoryScope } from '../lib/history-query.ts';
2
+ /** The project-wide or per-callable execution list, one page at a time.
3
+ * Disabled while `scope` is `null` (no project/callable selected yet).
4
+ * `placeholderData: keepPreviousData` keeps the previous page's rows on
5
+ * screen while a filter/page change is in flight, instead of flashing to
6
+ * an empty list. */
7
+ export declare function useHistoryQuery(scope: HistoryScope | null, f: HistoryFilters, limit?: number): import('@tanstack/react-query').UseQueryResult<NoInfer<{
8
+ executions: ExecutionSummary[];
9
+ hasMore: boolean;
10
+ }>, Error>;
11
+ /** The aggregate stats card above the list — same scope/filters, no paging.
12
+ * Disabled while `scope` is `null`. */
13
+ export declare function useHistoryStatsQuery(scope: HistoryScope | null, f: HistoryFilters): import('@tanstack/react-query').UseQueryResult<NoInfer<import('./index.ts').ExecutionStats>, Error>;
14
+ /** "Has this callable ever been executed?" — the cheap existence probe the
15
+ * header's History button uses to decide its disabled state (one row,
16
+ * every filter at its default). `hasExecuted` reads `false` while loading
17
+ * or on error — never a false "yes". */
18
+ export declare function useHasExecutedQuery(callableId: string): {
19
+ hasExecuted: boolean;
20
+ isLoading: boolean;
21
+ };
22
+ /** One execution's full detail, opened from a list row. Disabled while
23
+ * `summary` is `null` (no row selected). */
24
+ export declare function useExecutionDetailQuery(summary: ExecutionSummary | null): import('@tanstack/react-query').UseQueryResult<NoInfer<import('./index.ts').ExecutionDetailData>, Error>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * `@w6w/embed/repos` — the client-backed lib modules and the editor's data repos.
3
+ *
4
+ * Every hook reads its SDK client from `useEmbedClient()` (`../draft/client-context.ts`), so a
5
+ * host mounts one `EmbedClientProvider` (Studio and `W6WEmbedProvider` both do) and the same
6
+ * code serves both. Query keys are byte-identical to the Studio copies they replace.
7
+ */
8
+ export * from './workflows.ts';
9
+ export * from './versions.ts';
10
+ export * from './step-tests.ts';
11
+ export * from './history.ts';
12
+ export * from './vars.ts';
13
+ export * from './vault.ts';
14
+ export * from './documents.ts';
15
+ export * from '../lib/history-query.ts';
16
+ export * from '../lib/workflow-live-run.ts';
17
+ export * from '../lib/workflow-poll.ts';
18
+ export * from '../lib/save-invalidation.ts';
19
+ export * from '../lib/new-id.ts';
20
+ export * from '../lib/callable-descriptors.ts';
21
+ export * from '../lib/callable-kind.ts';
22
+ export * from './spec-import.ts';
@@ -0,0 +1,44 @@
1
+ import { SpecImportListKeys } from '../lib/spec-import-invalidation.ts';
2
+ /**
3
+ * Mirrors `T2.1.1`'s `SpecDocument` (`T2.1.1.contract.md:134-141`): the
4
+ * portable document a `GET /<kind>/:id/spec` export produces and this
5
+ * route consumes. Not a bare `FunctionDef` — connection/var references ride
6
+ * as re-bindable `rebind` entries, never live ids.
7
+ */
8
+ export interface SpecImportDocument {
9
+ specVersion: string;
10
+ kind: "function" | "endpoint" | "workflow";
11
+ callable: Record<string, unknown>;
12
+ rebind: unknown[];
13
+ }
14
+ /** One reference site's outcome (T2.1.2 §E's `SpecImportReferenceReport`). */
15
+ export interface SpecImportReferenceReport {
16
+ path: string;
17
+ kind: string;
18
+ resolved: boolean;
19
+ /** Present only when `resolved` is `true`. */
20
+ boundTo?: string;
21
+ /** Present only when `resolved` is `false`. */
22
+ reason?: string;
23
+ }
24
+ /** The `201` body `POST /spec/import` returns (T2.1.2 §E). */
25
+ export interface SpecImportResult {
26
+ kind: "function" | "endpoint" | "workflow";
27
+ callable: {
28
+ id: string;
29
+ key?: string;
30
+ name?: string;
31
+ };
32
+ references: SpecImportReferenceReport[];
33
+ }
34
+ /**
35
+ * `POST /spec/import`. Success is always `201` — including a partially
36
+ * resolved import (T2.1.2 §E: "report, never fail silently"). This mutation
37
+ * resolves on ANY `201`; branching on `references.every(r => r.resolved)` is
38
+ * the caller's job (A5), never this repo's.
39
+ *
40
+ * `project` is the caller's current project — only the workflow arm reads it
41
+ * (`listKeys.workflowsKey(project)`), but every caller passes it uniformly rather than branching on kind itself; see
42
+ * `../lib/spec-import-invalidation.ts` for why the key differs by kind.
43
+ */
44
+ export declare function useImportSpecMutation(project: string | undefined, listKeys: SpecImportListKeys): import('@tanstack/react-query').UseMutationResult<SpecImportResult, Error, Record<string, unknown>, unknown>;
@@ -0,0 +1,19 @@
1
+ import { W6WClient } from '@w6w/sdk';
2
+ import { StepTest } from '@w6w/sdk/console';
3
+ export type { StepTest } from '@w6w/sdk/console';
4
+ export declare const stepTestsKey: (workflowId: string, stepId: string) => readonly ["stepTests", string, string];
5
+ export declare function listStepTests(client: W6WClient, workflowId: string, stepId: string): Promise<StepTest[]>;
6
+ export declare function saveStepTest(client: W6WClient, workflowId: string, stepId: string, body: {
7
+ name?: string;
8
+ input: Record<string, unknown>;
9
+ with: Record<string, unknown>;
10
+ }): Promise<StepTest>;
11
+ /** Same void-discard reasoning as `recordTestRun` above — see that function's doc comment. */
12
+ export declare function recordStepTestRun(client: W6WClient, workflowId: string, stepId: string, body: {
13
+ stepTestId?: string | null;
14
+ status: string;
15
+ input?: unknown;
16
+ output?: unknown;
17
+ error?: unknown;
18
+ meta?: unknown;
19
+ }): Promise<void>;
@@ -0,0 +1,25 @@
1
+ import { Var, VarCreateInput, VarPatch } from '@w6w/sdk';
2
+ /** Query key for the vars list, optionally scoped to a project. */
3
+ export declare function varsKey(projectId?: string): readonly ["vars", string | undefined];
4
+ /**
5
+ * The current project's variables (or the tenant default when unscoped).
6
+ * `enabled` defaults `true` to preserve that unscoped fallback for a caller
7
+ * that genuinely wants it — a project-scoped page should instead pass
8
+ * `enabled: projectId != null` so it never queries (and never renders)
9
+ * against the wrong project while `ProjectContext`'s own project list is
10
+ * still resolving. Same fix as `documents.ts`'s `useDocumentsQuery`.
11
+ */
12
+ export declare function useVarsQuery(projectId?: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<Var[]>, Error>;
13
+ export declare function useCreateVarMutation(): import('@tanstack/react-query').UseMutationResult<Var, Error, {
14
+ input: VarCreateInput;
15
+ project?: string;
16
+ }, unknown>;
17
+ export declare function useUpdateVarMutation(): import('@tanstack/react-query').UseMutationResult<Var, Error, {
18
+ id: string;
19
+ patch: VarPatch;
20
+ project?: string;
21
+ }, unknown>;
22
+ export declare function useDeleteVarMutation(): import('@tanstack/react-query').UseMutationResult<void, Error, {
23
+ id: string;
24
+ project?: string;
25
+ }, unknown>;
@@ -0,0 +1,24 @@
1
+ import { W6WClient } from '@w6w/sdk';
2
+ import { SecretValue, VaultSecretSummary } from '@w6w/sdk/console';
3
+ export type { SecretValue, VaultSecretSummary } from '@w6w/sdk/console';
4
+ export declare const secretsKey: readonly ["secrets"];
5
+ export declare function listSecrets(client: W6WClient): Promise<VaultSecretSummary[]>;
6
+ export declare function useSecretsQuery(): import('@tanstack/react-query').UseQueryResult<NoInfer<VaultSecretSummary[]>, Error>;
7
+ export declare function sealSecret(client: W6WClient, value: string): Promise<SecretValue>;
8
+ /**
9
+ * A stable, bound `(value: string) => Promise<SecretValue>` closing over
10
+ * the ambient apiClient — drop straight into `ExpressionOptions.sealSecret`.
11
+ * Rebuilds only when `apiClient` itself changes identity (HITL-2's own
12
+ * token-rotation `useMemo`, one layer up).
13
+ */
14
+ export declare function useSealSecret(): (value: string) => Promise<SecretValue>;
15
+ export declare function useCreateSecretMutation(): import('@tanstack/react-query').UseMutationResult<VaultSecretSummary, Error, {
16
+ name: string;
17
+ value: string;
18
+ description?: string;
19
+ }, unknown>;
20
+ export declare function useUpdateSecretMutation(id: string): import('@tanstack/react-query').UseMutationResult<VaultSecretSummary, Error, {
21
+ value?: string;
22
+ description?: string;
23
+ }, unknown>;
24
+ export declare function useDeleteSecretMutation(): import('@tanstack/react-query').UseMutationResult<void, Error, string, unknown>;
@@ -0,0 +1,112 @@
1
+ /** The three kinds the wire contract's version-history routes exist for — `connection` has none
2
+ * (see `hasVersionHistory`, `../lib/rail-settings.ts`). */
3
+ export type VersionsKind = "function" | "workflow" | "endpoint";
4
+ /** One row of `GET /<coll>/:id/versions`'s `versions` array — newest first, per the wire contract. */
5
+ export interface VersionSummary {
6
+ versionNumber: number;
7
+ createdAt: string;
8
+ createdBy: string | null;
9
+ isCurrentPublished: boolean;
10
+ }
11
+ /** `GET /<coll>/:id/versions`'s full 200 body. */
12
+ export interface VersionsEnvelope {
13
+ enabled: boolean;
14
+ currentPublishedVersion: number | null;
15
+ versions: VersionSummary[];
16
+ }
17
+ /** `GET /<coll>/:id/versions/:n`'s `version` field — `definition` is the redacted stored
18
+ * definition for THIS query; {@link useRevertMutation} is what posts a version's definition
19
+ * back onto the live resource, and {@link useInvokeVersionMutation} is what runs it. */
20
+ export interface VersionDetail {
21
+ versionNumber: number;
22
+ createdAt: string;
23
+ createdBy: string | null;
24
+ isCurrentPublished: boolean;
25
+ definition: Record<string, unknown>;
26
+ }
27
+ /** `POST /<coll>/:id/publish`'s 200 body. */
28
+ export interface PublishResult {
29
+ version: {
30
+ kind: string;
31
+ callableId: string;
32
+ versionNumber: number;
33
+ createdAt: string;
34
+ createdBy: string | null;
35
+ };
36
+ currentPublishedVersion: number;
37
+ }
38
+ /** `POST /<coll>/:id/versions/:n/revert`'s 200 body. */
39
+ export interface RevertResult {
40
+ reverted: {
41
+ kind: string;
42
+ callableId: string;
43
+ versionNumber: number;
44
+ };
45
+ }
46
+ export declare function versionsKey(kind: VersionsKind | null, id: string): readonly ["versions", VersionsKind | null, string];
47
+ export declare function versionKey(kind: VersionsKind | null, id: string, versionNumber: number | null): readonly ["version", VersionsKind | null, string, number | null];
48
+ /**
49
+ * `GET /<collection>/:id/versions`. Never fires on mount — `enabled` is the caller's own flag
50
+ * (the Settings panel's History-open state, or `WorkflowsPage.tsx`'s own editor-open gate), ANDed
51
+ * with `kind !== null` and `id !== ""`, exactly `useSpecQuery`'s shape (`spec-export.ts:45-57`).
52
+ */
53
+ export declare function useVersionsQuery(kind: VersionsKind | null, id: string, enabled: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<VersionsEnvelope>, Error>;
54
+ /**
55
+ * `GET /<collection>/:id/versions/:n`. Same gating shape as {@link useVersionsQuery}, plus
56
+ * `versionNumber !== null` — the modal opens this only once a row has been clicked.
57
+ */
58
+ export declare function useVersionQuery(kind: VersionsKind | null, id: string, versionNumber: number | null, enabled: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<VersionDetail>, Error>;
59
+ /**
60
+ * `POST /<collection>/:id/publish`. `kind` is fixed per hook instance — the caller already knows
61
+ * which kind it is publishing (the rail's `ctx.kind`, or `WorkflowsPage.tsx`'s hardcoded
62
+ * `"workflow"`) — and `mutate(id)` supplies the resource. `onSuccess` invalidates the SAME
63
+ * `["versions", kind, id]` key {@link useVersionsQuery} reads, so the panel's published pointer
64
+ * and version list are fresh without a reload (A3), mirroring `useSaveFunctionMutation`'s
65
+ * `onSuccess` shape (`./functions.ts`).
66
+ */
67
+ export declare function usePublishMutation(kind: VersionsKind): import('@tanstack/react-query').UseMutationResult<PublishResult, Error, string, unknown>;
68
+ /**
69
+ * `POST /<collection>/:id/{enable,disable}`. One mutation for both — the wire contract is two
70
+ * routes distinguished only by which one is called, so `vars.enabled` picks the path segment
71
+ * rather than this module carrying two near-identical mutations. `onSuccess` invalidates the same
72
+ * key {@link usePublishMutation} does, for the same reason.
73
+ */
74
+ export declare function useSetEnabledMutation(kind: VersionsKind): import('@tanstack/react-query').UseMutationResult<{
75
+ enabled: boolean;
76
+ }, Error, {
77
+ id: string;
78
+ enabled: boolean;
79
+ }, unknown>;
80
+ /**
81
+ * `POST /<collection>/:id/versions/:n/revert`, no body — overwrites the LIVE resource's
82
+ * `definition` with the archived version's content, preserving its `key`/address (HITL-4's
83
+ * pinned default; see the module docblock). This is the first mutation in this family that
84
+ * changes `definition` rather than merely appending to or flipping a flag on the version history
85
+ * (`usePublishMutation`/`useSetEnabledMutation` above do neither), so `onSuccess` invalidates
86
+ * BOTH `versionsKey(kind, id)` (the same key those two invalidate) AND the kind's own
87
+ * definition-edit key — via the shared `invalidateSavedCallable` helper
88
+ * `useSaveFunctionMutation`/`useSaveEndpointMutation` already route through
89
+ * (`../lib/save-invalidation.ts`) — or the page a user reverted FROM keeps showing the
90
+ * pre-revert draft until a manual reload. The definition key is picked by a `switch` naming all
91
+ * three arms explicitly, with no `default:` — the same reasoning `COLLECTION_PATH`'s own docblock
92
+ * gives: a derived rule would silently send one kind at another kind's key.
93
+ */
94
+ export declare function useRevertMutation(kind: VersionsKind): import('@tanstack/react-query').UseMutationResult<RevertResult, Error, {
95
+ id: string;
96
+ versionNumber: number;
97
+ }, unknown>;
98
+ /**
99
+ * `POST /<collection>/:id/versions/:n/{invoke,run}`, an EMPTY JSON body — identical to that
100
+ * kind's unversioned invoke/run route's success body, except the requested version's OWN
101
+ * `impl`/definition runs instead of the live one (T5.3.1's wire contract table). Unlike
102
+ * {@link useRevertMutation}, invoking changes no resource state, so it invalidates History ONLY
103
+ * (`onSettled`, `historyKeys.root` — a version run is a run, failed ones included, like every other
104
+ * run path) and no resource query — the caller (`VersionHistoryModal`) renders the mutation's own `data`/`error` state
105
+ * directly, and that state is naturally cleared whenever the modal remounts for a different
106
+ * version (`SettingsTool.tsx`'s `openVersion` gate fully unmounts/remounts it, never leaves it
107
+ * mounted across a prop change).
108
+ */
109
+ export declare function useInvokeVersionMutation(kind: VersionsKind): import('@tanstack/react-query').UseMutationResult<Record<string, unknown>, Error, {
110
+ id: string;
111
+ versionNumber: number;
112
+ }, unknown>;
@@ -0,0 +1,2 @@
1
+ export * from './repos/index'
2
+ export {}
package/dist/repos.mjs ADDED
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { C as s, E as t, H as u, I as o, R as r, S as n, c as i, a as l, b as y, d as c, e as S, f as M, g as R, h as f, i as w, j as E, k as d, l as k, m as p, n as D, o as m, p as v, q as I, r as Q, s as T, t as K, u as W, v as L, w as _, x as C, y as g, z as A, A as h, B as H, D as P, F as b, G as F, J as O, K as V, L as x, M as N, N as U, O as B, P as Y, Q as q, T as j, U as G, V as Z, W as z, X as J, Y as X, Z as $, _ as aa, $ as ea, a0 as sa, a1 as ta, a2 as ua, a3 as oa, a4 as ra, a5 as na, a6 as ia, a7 as la, a8 as ya, a9 as ca, aa as Sa, ab as Ma, ac as Ra, ad as fa, ae as wa, af as Ea, ag as da, ah as ka, ai as pa, aj as Da, ak as ma, al as va, am as Ia, an as Qa, ao as Ta, ap as Ka, aq as Wa, ar as La, as as _a, at as Ca, au as ga, av as Aa, aw as ha, ax as Ha, ay as Pa } from "./spec-import-HgO7ZkLZ.js";
3
+ export {
4
+ s as CALLABLE_DESCRIPTORS,
5
+ t as EMPTY_HISTORY_FILTERS,
6
+ u as HISTORY_PAGE_SIZE,
7
+ o as ID_ALPHABET,
8
+ r as RUN_FAILED_NO_REASON,
9
+ n as STEP_FAILED_NO_REASON,
10
+ i as callableKey,
11
+ l as cancelWorkflowRun,
12
+ y as classifyCancelError,
13
+ c as descriptorFor,
14
+ S as documentKey,
15
+ M as documentProvenanceState,
16
+ R as documentsKey,
17
+ f as filtersFromSearch,
18
+ w as filtersToSearch,
19
+ E as getExecutionDetail,
20
+ d as getHistory,
21
+ k as getHistoryStats,
22
+ p as getRunState,
23
+ D as getWorkflow,
24
+ m as historyKeys,
25
+ v as historyRequestQuery,
26
+ I as invalidateSavedCallable,
27
+ Q as isRunInFlight,
28
+ T as latestFixtureInput,
29
+ K as listSecrets,
30
+ W as listStepTests,
31
+ L as listWorkflows,
32
+ _ as mapRunStateToLogSteps,
33
+ C as newCallableId,
34
+ g as newId,
35
+ A as pollRunToTerminal,
36
+ h as recordStepTestRun,
37
+ H as resolveHeaderRunInput,
38
+ P as runButtonLabel,
39
+ b as runLevelErrors,
40
+ F as runStateKey,
41
+ O as runWorkflow,
42
+ V as runWorkflowSync,
43
+ x as runsKey,
44
+ N as saveStepTest,
45
+ U as sealSecret,
46
+ B as secretsKey,
47
+ Y as shouldContinuePolling,
48
+ q as startWorkflowRun,
49
+ j as stepTestsKey,
50
+ G as toLogError,
51
+ Z as useArchiveWorkflowMutation,
52
+ z as useCancelRunMutation,
53
+ J as useCreateDocumentMutation,
54
+ X as useCreateSecretMutation,
55
+ $ as useCreateVarMutation,
56
+ aa as useCreateWorkflowMutation,
57
+ ea as useDeleteDocumentMutation,
58
+ sa as useDeleteSecretMutation,
59
+ ta as useDeleteVarMutation,
60
+ ua as useDeleteWorkflowMutation,
61
+ oa as useDocumentQuery,
62
+ ra as useDocumentsQuery,
63
+ na as useExecutionDetailQuery,
64
+ ia as useHasExecutedQuery,
65
+ la as useHistoryQuery,
66
+ ya as useHistoryStatsQuery,
67
+ ca as useImportSpecMutation,
68
+ Sa as useInvokeVersionMutation,
69
+ Ma as useLiveRunQuery,
70
+ Ra as usePublishMutation,
71
+ fa as useRevertMutation,
72
+ wa as useRunWorkflowMutation,
73
+ Ea as useRunsQuery,
74
+ da as useSaveWorkflowMutation,
75
+ ka as useSealSecret,
76
+ pa as useSecretsQuery,
77
+ Da as useSetEnabledMutation,
78
+ ma as useStartRunMutation,
79
+ va as useSyncDocumentMutation,
80
+ Ia as useUpdateDocumentMutation,
81
+ Qa as useUpdateSecretMutation,
82
+ Ta as useUpdateVarMutation,
83
+ Ka as useVarsQuery,
84
+ Wa as useVersionQuery,
85
+ La as useVersionsQuery,
86
+ _a as useWorkflowQuery,
87
+ Ca as useWorkflowsQuery,
88
+ ga as varsKey,
89
+ Aa as versionKey,
90
+ ha as versionsKey,
91
+ Ha as workflowKey,
92
+ Pa as workflowsKey
93
+ };
94
+ //# sourceMappingURL=repos.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repos.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}