@w6w/embed 0.2.28 → 0.2.30

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 (48) hide show
  1. package/dist/{ConfirmModal-Pv2-A_3U.js → ConfirmModal-WqBfWftD.js} +100 -83
  2. package/dist/{ConfirmModal-Pv2-A_3U.js.map → ConfirmModal-WqBfWftD.js.map} +1 -1
  3. package/dist/{CreateFunctionModal-B3LpcuI9.js → CreateFunctionModal-CCYi9deY.js} +2 -2
  4. package/dist/{CreateFunctionModal-B3LpcuI9.js.map → CreateFunctionModal-CCYi9deY.js.map} +1 -1
  5. package/dist/{DocumentFormModal-DieWYFi4.js → DocumentFormModal-B3VudaLb.js} +3 -3
  6. package/dist/{DocumentFormModal-DieWYFi4.js.map → DocumentFormModal-B3VudaLb.js.map} +1 -1
  7. package/dist/{ImportSpecModal-xwTzj4KB.js → ImportSpecModal-C-B8Jwxk.js} +3 -3
  8. package/dist/{ImportSpecModal-xwTzj4KB.js.map → ImportSpecModal-C-B8Jwxk.js.map} +1 -1
  9. package/dist/{ModelRoutesManager-DtByS4mE.js → ModelRoutesManager-DqeY1mdP.js} +110 -106
  10. package/dist/ModelRoutesManager-DqeY1mdP.js.map +1 -0
  11. package/dist/WorkflowEditor-8NAcpjO_.js +1140 -0
  12. package/dist/WorkflowEditor-8NAcpjO_.js.map +1 -0
  13. package/dist/chrome/CallFromCodeButton.d.ts +12 -0
  14. package/dist/chrome/index.d.ts +1 -1
  15. package/dist/{editor-tools-CVYTsVFN.js → editor-tools-BIAW-wzt.js} +53 -53
  16. package/dist/{editor-tools-CVYTsVFN.js.map → editor-tools-BIAW-wzt.js.map} +1 -1
  17. package/dist/editor.mjs +1 -1
  18. package/dist/editors.mjs +51 -52
  19. package/dist/editors.mjs.map +1 -1
  20. package/dist/forms.mjs +321 -297
  21. package/dist/forms.mjs.map +1 -1
  22. package/dist/lib/recent-activity.d.ts +2 -2
  23. package/dist/lib/workflow-version.d.ts +19 -2
  24. package/dist/lists/AiKeyCreate.d.ts +20 -0
  25. package/dist/lists/CallableKindList.d.ts +17 -1
  26. package/dist/lists/CallableRowParts.d.ts +33 -0
  27. package/dist/lists/CredentialCreate.d.ts +17 -17
  28. package/dist/lists/CredentialFields.d.ts +18 -0
  29. package/dist/lists/CredentialList.d.ts +35 -3
  30. package/dist/lists.d.ts +2 -0
  31. package/dist/lists.mjs +2038 -1517
  32. package/dist/lists.mjs.map +1 -1
  33. package/dist/rail.mjs +1 -1
  34. package/dist/repos/connections.d.ts +1 -0
  35. package/dist/repos.mjs +59 -59
  36. package/dist/spec-export-BtnoV0ex.js +33 -0
  37. package/dist/spec-export-BtnoV0ex.js.map +1 -0
  38. package/dist/spec-import-FygyV8sy.js +272 -0
  39. package/dist/spec-import-FygyV8sy.js.map +1 -0
  40. package/package.json +5 -5
  41. package/src/styles.css +56 -0
  42. package/dist/ModelRoutesManager-DtByS4mE.js.map +0 -1
  43. package/dist/WorkflowEditor-CvWkVmFn.js +0 -1117
  44. package/dist/WorkflowEditor-CvWkVmFn.js.map +0 -1
  45. package/dist/spec-export-DMMET5VM.js +0 -189
  46. package/dist/spec-export-DMMET5VM.js.map +0 -1
  47. package/dist/spec-import-0B6oUewa.js +0 -116
  48. package/dist/spec-import-0B6oUewa.js.map +0 -1
package/dist/rail.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as r } from "react/jsx-runtime";
3
3
  import { useMemo as u } from "react";
4
- import { W as d, R as p, P as m, u as f, a as v, e as b, b as h } from "./editor-tools-CVYTsVFN.js";
4
+ import { W as d, R as p, P as m, u as f, a as v, e as b, b as h } from "./editor-tools-BIAW-wzt.js";
5
5
  import { r as P, a as j } from "./project-context-Tvp-La7A.js";
6
6
  const R = () => {
7
7
  };
@@ -25,6 +25,7 @@ export declare function useUpdateConnectionMutation(connectionId: string): impor
25
25
  binding?: import('@w6w/sdk/console').ConnectionBinding;
26
26
  credentialId?: string;
27
27
  credential?: Record<string, unknown>;
28
+ autoRefresh?: boolean;
28
29
  }, unknown>;
29
30
  export declare function useTestConnectionMutation(connectionId: string): import('@tanstack/react-query').UseMutationResult<ConnectionTestResult, Error, void, unknown>;
30
31
  export type { ConnectionDependents } from '@w6w/sdk/console';
package/dist/repos.mjs CHANGED
@@ -3,11 +3,11 @@ var M = Object.defineProperty;
3
3
  var S = (e, t, s) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
4
4
  var l = (e, t, s) => S(e, typeof t != "symbol" ? t + "" : t, s);
5
5
  import { E as we, H as Ie, R as _e, S as Pe, a as Ue, c as Be, b as Ne, d as We, f as Le, e as Oe, g as Ve, h as He, i as je, j as ze, k as Ge, l as Ye, m as Je, n as Xe, o as Ze, p as $e, q as et, r as tt, s as st, t as nt, u as at, v as ot, w as ut, x as rt, y as it, z as lt, A as ct, B as yt, C as dt, D as ft, F as pt, G as gt, I as Mt, J as St, K as Ct, L as Kt, M as mt, N as Qt, O as Et, P as At, Q as vt, T as xt, U as Ft, V as Rt, W as qt, X as bt, Y as kt, Z as Dt, _ as ht, $ as Tt, a0 as wt, a1 as It, a2 as _t, a3 as Pt } from "./workflows-Dz8LMjnt.js";
6
- import { c as Bt, u as Nt, a as Wt, b as Lt, d as Ot, e as Vt, f as Ht, g as jt, h as zt, v as Gt, i as Yt } from "./spec-export-DMMET5VM.js";
7
- import { l as Xt, r as Zt, s as $t, a as es, w as ts } from "./step-tests-B4E4W3ly.js";
8
- import { e as ns, f as as, g as os, h as us, i as rs, j as is, b as ls, d as cs, k as ys, u as ds, a as fs, c as ps } from "./apps-FMcQfyL2.js";
9
- import { l as Ms, s as Ss, a as Cs, u as Ks, b as ms, c as Qs, d as Es, e as As, f as vs, g as xs, h as Fs, i as Rs, v as qs } from "./vault-BSEWhMYC.js";
10
- import { d as ks, e as Ds, f as hs, g as Ts, h as ws, b as Is, i as _s, j as Ps, k as Us, u as Bs, a as Ns, l as Ws, c as Ls } from "./spec-import-0B6oUewa.js";
6
+ import { d as Bt, e as Nt, f as Wt, g as Lt, h as Ot, b as Vt, i as Ht, j as jt, k as zt, u as Gt, l as Yt, m as Jt, n as Xt, o as Zt, a as $t, p as es, c as ts, q as ss, r as ns, v as as, s as os } from "./spec-import-FygyV8sy.js";
7
+ import { l as rs, r as is, s as ls, a as cs, w as ys } from "./step-tests-B4E4W3ly.js";
8
+ import { e as fs, f as ps, g as gs, h as Ms, i as Ss, j as Cs, b as Ks, d as ms, k as Qs, u as Es, a as As, c as vs } from "./apps-FMcQfyL2.js";
9
+ import { c as Fs, u as Rs, a as qs } from "./spec-export-BtnoV0ex.js";
10
+ import { l as ks, s as Ds, a as hs, u as Ts, b as ws, c as Is, d as _s, e as Ps, f as Us, g as Bs, h as Ns, i as Ws, v as Ls } from "./vault-BSEWhMYC.js";
11
11
  import { D as Vs, d as Hs, a as js, b as zs, g as Gs, l as Ys, c as Js, e as Xs, u as Zs, f as $s, h as en, i as tn, j as sn, k as nn, m as an, n as on, o as un, p as rn } from "./data-stores-UeQvwVCa.js";
12
12
  import { b as cn, d as yn, e as dn, a as fn, c as pn, f as gn, g as Mn, h as Sn, j as Cn, i as Kn, l as mn, s as Qn, k as En, m as An, u as vn, n as xn, o as Fn } from "./callables-tOlflvbl.js";
13
13
  import { C as qn, E as bn, F as kn, I as Dn, d as hn, e as Tn, f as wn, g as In, h as _n, i as Pn, j as Un, k as Bn, l as Nn, m as Wn, o as Ln, n as On, p as Vn, q as Hn, r as jn, s as zn, t as Gn, v as Yn, u as Jn, w as Xn, b as Zn, x as $n, y as ea, z as ta, A as sa, a as na, c as aa } from "./endpoints-DArAqoLT.js";
@@ -359,13 +359,13 @@ export {
359
359
  E as agentsKey,
360
360
  so as aiKeyDefaultsKey,
361
361
  P as allContextEntriesKey,
362
- ns as appActionsKey,
363
- as as appKey,
362
+ fs as appActionsKey,
363
+ ps as appKey,
364
364
  cn as archiveCallable,
365
365
  B as assetFilesKey,
366
366
  U as assetVersionsKey,
367
- ks as buildImportBody,
368
- Ds as buildPreviewBody,
367
+ Bt as buildImportBody,
368
+ Nt as buildPreviewBody,
369
369
  yn as callableCollection,
370
370
  dn as callableHistoryRoute,
371
371
  fn as callableKey,
@@ -381,7 +381,7 @@ export {
381
381
  ra as connectionKey,
382
382
  ia as connectionsForAppKey,
383
383
  la as connectionsKey,
384
- Bt as constantsKey,
384
+ Fs as constantsKey,
385
385
  _ as contextCollectionKey,
386
386
  I as contextCollectionsKey,
387
387
  g as contextEntriesKey,
@@ -409,9 +409,9 @@ export {
409
409
  We as describeWorkflowNodes,
410
410
  hn as descriptorFor,
411
411
  wo as discoverModels,
412
- hs as documentKey,
413
- Ts as documentProvenanceState,
414
- ws as documentsKey,
412
+ Wt as documentKey,
413
+ Lt as documentProvenanceState,
414
+ Ot as documentsKey,
415
415
  Tn as endpointKey,
416
416
  wn as endpointsKey,
417
417
  no as fetchUserScopedCredentialsEnabled,
@@ -420,8 +420,8 @@ export {
420
420
  Ve as findExecution,
421
421
  In as functionKey,
422
422
  _n as functionsKey,
423
- os as getApp,
424
- us as getAppActions,
423
+ gs as getApp,
424
+ Ms as getAppActions,
425
425
  Cn as getCallable,
426
426
  da as getConnection,
427
427
  fa as getConnectionDependents,
@@ -466,8 +466,8 @@ export {
466
466
  C as listModelRoutes,
467
467
  st as listNodeSamples,
468
468
  po as listSavedTests,
469
- Ms as listSecrets,
470
- Xt as listStepTests,
469
+ ks as listSecrets,
470
+ rs as listStepTests,
471
471
  nt as listTestInputs,
472
472
  go as listTestRuns,
473
473
  at as listWorkflows,
@@ -487,7 +487,7 @@ export {
487
487
  Ba as ownershipErrorText,
488
488
  ut as pollRunToTerminal,
489
489
  G as readyContextEntries,
490
- Zt as recordStepTestRun,
490
+ is as recordStepTestRun,
491
491
  Mo as recordTestRun,
492
492
  rt as rerunExecution,
493
493
  Mu as resolveActionFields,
@@ -503,11 +503,11 @@ export {
503
503
  gt as runWorkflowSync,
504
504
  Mt as runsKey,
505
505
  Qn as saveCallable,
506
- $t as saveStepTest,
506
+ ls as saveStepTest,
507
507
  St as saveTestInput,
508
508
  So as savedTestsKey,
509
- Ss as sealSecret,
510
- Cs as secretsKey,
509
+ Ds as sealSecret,
510
+ hs as secretsKey,
511
511
  Wa as setCredentialStatus,
512
512
  Ct as shouldContinuePolling,
513
513
  T as skillKey,
@@ -517,7 +517,7 @@ export {
517
517
  Kt as startRunFromNode,
518
518
  mt as startWorkflowRun,
519
519
  Qt as stepPassRefreshDue,
520
- es as stepTestsKey,
520
+ cs as stepTestsKey,
521
521
  b as storageBindingsKey,
522
522
  D as testAgent,
523
523
  La as testCredential,
@@ -544,8 +544,8 @@ export {
544
544
  Ke as useAllContextEntriesQuery,
545
545
  $o as useAllModelCatalogQuery,
546
546
  mo as useApiCallsQuery,
547
- rs as useAppActionsQuery,
548
- is as useAppQuery,
547
+ Ss as useAppActionsQuery,
548
+ Cs as useAppQuery,
549
549
  $ as useArchiveAgent,
550
550
  Re as useArchiveAssetMutation,
551
551
  En as useArchiveCallableMutation,
@@ -565,7 +565,7 @@ export {
565
565
  Ca as useConnectionQuery,
566
566
  Ka as useConnectionsForAppQuery,
567
567
  ma as useConnectionsQuery,
568
- Nt as useConstantsQuery,
568
+ Rs as useConstantsQuery,
569
569
  ge as useContextCollectionQuery,
570
570
  pe as useContextCollectionsQuery,
571
571
  Se as useContextEntriesQuery,
@@ -575,11 +575,11 @@ export {
575
575
  me as useCreateContextEntryMutation,
576
576
  Va as useCreateCredentialMutation,
577
577
  $s as useCreateDataStoreMutation,
578
- Is as useCreateDocumentMutation,
578
+ Vt as useCreateDocumentMutation,
579
579
  tu as useCreateModelBudgetMutation,
580
580
  su as useCreateModelRouteMutation,
581
- Ks as useCreateSecretMutation,
582
- ms as useCreateVarMutation,
581
+ Ts as useCreateSecretMutation,
582
+ ws as useCreateVarMutation,
583
583
  xt as useCreateWorkflowMutation,
584
584
  Ha as useCredentialDependentsQuery,
585
585
  ja as useCredentialQuery,
@@ -591,40 +591,40 @@ export {
591
591
  xn as useDeleteCallableMutation,
592
592
  Qa as useDeleteConnectionMutation,
593
593
  Ya as useDeleteCredentialMutation,
594
- _s as useDeleteDocumentMutation,
594
+ Ht as useDeleteDocumentMutation,
595
595
  zn as useDeleteEndpointMutation,
596
596
  sn as useDeleteEntryMutation,
597
597
  Gn as useDeleteFunctionMutation,
598
598
  nu as useDeleteModelBudgetMutation,
599
599
  au as useDeleteModelRouteMutation,
600
- Qs as useDeleteSecretMutation,
601
- Es as useDeleteVarMutation,
600
+ Is as useDeleteSecretMutation,
601
+ _s as useDeleteVarMutation,
602
602
  Ft as useDeleteWorkflowMutation,
603
603
  ou as useDiscoverModelsMutation,
604
- Ps as useDocumentQuery,
605
- Us as useDocumentsQuery,
604
+ jt as useDocumentQuery,
605
+ zt as useDocumentsQuery,
606
606
  Fe as useDownloadAssetArchiveMutation,
607
607
  xe as useDownloadAssetFileMutation,
608
608
  Yn as useEndpointQuery,
609
609
  Jn as useEndpointsQuery,
610
610
  nn as useEntriesQuery,
611
- ls as useExecutionDetailQuery,
611
+ Ks as useExecutionDetailQuery,
612
612
  an as useExportCsvMutation,
613
613
  ke as useFinalizeAssetUploadMutation,
614
- cs as useFindExecution,
614
+ ms as useFindExecution,
615
615
  Xn as useFunctionQuery,
616
616
  Zn as useFunctionsQuery,
617
617
  $n as useGuardedSaveEndpointMutation,
618
618
  ea as useGuardedSaveFunctionMutation,
619
- ys as useHasExecutedQuery,
620
- ds as useHistoryQuery,
621
- fs as useHistoryStatsQuery,
619
+ Qs as useHasExecutedQuery,
620
+ Es as useHistoryQuery,
621
+ As as useHistoryStatsQuery,
622
622
  on as useImportCsvMutation,
623
- Bs as useImportSpecMutation,
623
+ Gt as useImportSpecMutation,
624
624
  un as useInsertRowMutation,
625
625
  ta as useInvokeEndpointMutation,
626
626
  sa as useInvokeFunctionMutation,
627
- Wt as useInvokeVersionMutation,
627
+ Yt as useInvokeVersionMutation,
628
628
  Rt as useLiveRunQuery,
629
629
  uu as useModelBudgetUsageQuery,
630
630
  ru as useModelBudgetsQuery,
@@ -635,12 +635,12 @@ export {
635
635
  du as useModelUsageQuery,
636
636
  re as usePatchAgentSettings,
637
637
  Eo as useProjectReliabilityQuery,
638
- Lt as usePublishMutation,
638
+ Jt as usePublishMutation,
639
639
  be as usePutAssetUploadEntryMutation,
640
640
  Ao as useReliabilityQuery,
641
641
  Ee as useRemoveEntryFromCollectionMutation,
642
- ps as useRerunExecutionMutation,
643
- Ot as useRevertMutation,
642
+ vs as useRerunExecutionMutation,
643
+ Xt as useRevertMutation,
644
644
  Ja as useRotateCredentialMutation,
645
645
  qt as useRunFromNodeMutation,
646
646
  bt as useRunStateWritesQuery,
@@ -651,20 +651,20 @@ export {
651
651
  aa as useSaveFunctionMutation,
652
652
  ht as useSaveWorkflowMutation,
653
653
  vo as useSavedTestsQuery,
654
- As as useSealSecret,
655
- vs as useSecretsQuery,
654
+ Ps as useSealSecret,
655
+ Us as useSecretsQuery,
656
656
  io as useSetAiKeyDefaultMutation,
657
657
  Xa as useSetCredentialStatusMutation,
658
- Vt as useSetEnabledMutation,
658
+ Zt as useSetEnabledMutation,
659
659
  rn as useSetEntryMutation,
660
660
  ye as useSkillQuery,
661
661
  de as useSkillVersionsQuery,
662
662
  ce as useSkillsQuery,
663
- Ns as useSpecPreviewMutation,
664
- Ht as useSpecQuery,
663
+ $t as useSpecPreviewMutation,
664
+ qs as useSpecQuery,
665
665
  Tt as useStartRunMutation,
666
666
  ie as useStorageBindingsQuery,
667
- Ws as useSyncDocumentMutation,
667
+ es as useSyncDocumentMutation,
668
668
  le as useTestAgentMutation,
669
669
  Ea as useTestConnectionMutation,
670
670
  Za as useTestCredentialMutation,
@@ -673,23 +673,23 @@ export {
673
673
  Aa as useUpdateConnectionMutation,
674
674
  Ce as useUpdateContextEntryMutation,
675
675
  $a as useUpdateCredentialMutation,
676
- Ls as useUpdateDocumentMutation,
676
+ ts as useUpdateDocumentMutation,
677
677
  fu as useUpdateModelBudgetMutation,
678
678
  pu as useUpdateModelRouteMutation,
679
- xs as useUpdateSecretMutation,
680
- Fs as useUpdateVarMutation,
679
+ Bs as useUpdateSecretMutation,
680
+ Ns as useUpdateVarMutation,
681
681
  lo as useUserScopedCredentialsEnabled,
682
- Rs as useVarsQuery,
683
- jt as useVersionQuery,
684
- zt as useVersionsQuery,
682
+ Ws as useVarsQuery,
683
+ ss as useVersionQuery,
684
+ ns as useVersionsQuery,
685
685
  wt as useWorkflowQuery,
686
686
  It as useWorkflowsQuery,
687
- qs as varsKey,
688
- Gt as versionKey,
689
- Yt as versionsKey,
687
+ Ls as varsKey,
688
+ as as versionKey,
689
+ os as versionsKey,
690
690
  eo as withCredentialMethods,
691
691
  _t as workflowKey,
692
- ts as workflowStepTestsKey,
692
+ ys as workflowStepTestsKey,
693
693
  Pt as workflowsKey
694
694
  };
695
695
  //# sourceMappingURL=repos.mjs.map
@@ -0,0 +1,33 @@
1
+ import { useQuery as s } from "@tanstack/react-query";
2
+ import { u as n } from "./client-context-CX61Bgw-.js";
3
+ import { path as a } from "@w6w/sdk";
4
+ function o() {
5
+ return ["constants"];
6
+ }
7
+ function m() {
8
+ const e = n();
9
+ return s({
10
+ queryKey: o(),
11
+ queryFn: async () => (await e.request({
12
+ method: "GET",
13
+ path: "/constants"
14
+ })).body.constants
15
+ });
16
+ }
17
+ function f(e, t, r) {
18
+ const u = n();
19
+ return s({
20
+ queryKey: ["spec", e, t],
21
+ queryFn: async () => (await u.request({
22
+ method: "GET",
23
+ path: a`/${e}/${t}/spec`
24
+ })).body.spec,
25
+ enabled: r && e !== null
26
+ });
27
+ }
28
+ export {
29
+ f as a,
30
+ o as c,
31
+ m as u
32
+ };
33
+ //# sourceMappingURL=spec-export-BtnoV0ex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-export-BtnoV0ex.js","sources":["../src/repos/constants.ts","../src/repos/spec-export.ts"],"sourcesContent":["/**\n * The `constants` domain repo — account-level, read-only values set by an\n * administrator and referenced as `{{ const.<name> }}`. There is no write\n * route; the server derives the account from the token.\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n\nexport interface Constant {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"json\";\n value: unknown;\n description: string;\n /** Computed by the server (e.g. `account_id`), not stored. */\n derived: boolean;\n}\n\n/** Query key for the constants list. */\nexport function constantsKey() {\n return [\"constants\"] as const;\n}\n\n/** The account's constants (read-only). */\nexport function useConstantsQuery() {\n const apiClient = useEmbedClient();\n return useQuery({\n queryKey: constantsKey(),\n queryFn: async () => {\n const res = await apiClient.request<{ constants: Constant[] }>({\n method: \"GET\",\n path: \"/constants\",\n });\n return res.body.constants;\n },\n });\n}\n","/**\n * The `/<collection>/:id/spec` export repo (T3.3.1) — the Settings rail's Export\n * button. A NEW file, deliberately kept out of `repos/functions.ts` /\n * `repos/endpoints.ts` (T3.1.1 owns both), exactly as T3.2.1 put `/spec/import` in\n * its own `repos/spec-import.ts` for the same reason — the two nodes never\n * collide on the same file.\n *\n * **Goes through `W6WClient.request<T>()`, never `apiClient.console.*`.** There\n * is no SDK method for this route, exactly as `repos/spec-import.ts`'s own\n * docblock records for the sibling `/spec/import` route.\n *\n * `useSpecQuery` is gated on the caller's `enabled` flag (the export modal's own\n * open state) AND `collection !== null` — never on `ctx.kind` alone, and never\n * on mount: the contract pins that opening the Settings panel must issue ZERO\n * `/spec` requests, and exactly one fires per Export click.\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { path } from \"@w6w/sdk\";\nimport { useEmbedClient } from \"../draft/client-context.ts\";\n\n/** The collections that carry a `/spec` export route — `specCollectionForKind`\n * (`../lib/rail-settings.ts`) is the sole producer of this type's values. */\nexport type SpecCollection = \"functions\" | \"endpoints\" | \"workflows\";\n\n/**\n * Mirrors T2.1.1's `SpecDocument`, also mirrored by `repos/spec-import.ts`'s\n * `SpecImportDocument` for the sibling import route: the portable document a\n * `GET /<kind>/:id/spec` export produces. Not a bare `FunctionDef`/`EndpointDef`\n * — `id` is deleted server-side (`admin/spec.ts:96-108`) and connection/var\n * references ride as re-bindable `rebind` entries, never live ids.\n */\nexport interface SpecDocument {\n specVersion: string;\n kind: \"function\" | \"endpoint\" | \"workflow\";\n callable: Record<string, unknown>;\n rebind: unknown[];\n}\n\n/**\n * `GET /<collection>/:id/spec`. `collection` is `null` for a kind the Export\n * button never renders on (`specCollectionForKind`'s `connection`\n * arm) — passing `null` disables the query regardless of `enabled`, so a\n * caller need not re-derive that guard itself.\n */\nexport function useSpecQuery(collection: SpecCollection | null, id: string, enabled: boolean) {\n const apiClient = useEmbedClient();\n return useQuery({\n queryKey: [\"spec\", collection, id],\n queryFn: async () => {\n const res = await apiClient.request<{ spec: SpecDocument }>({\n method: \"GET\",\n path: path`/${collection as SpecCollection}/${id}/spec`,\n });\n return res.body.spec;\n },\n enabled: enabled && collection !== null,\n });\n}\n"],"names":["constantsKey","useConstantsQuery","apiClient","useEmbedClient","useQuery","useSpecQuery","collection","id","enabled","path"],"mappings":";;;AAkBO,SAASA,IAAe;AAC7B,SAAO,CAAC,WAAW;AACrB;AAGO,SAASC,IAAoB;AAClC,QAAMC,IAAYC,EAAA;AAClB,SAAOC,EAAS;AAAA,IACd,UAAUJ,EAAA;AAAA,IACV,SAAS,aACK,MAAME,EAAU,QAAmC;AAAA,MAC7D,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA,CACP,GACU,KAAK;AAAA,EAClB,CACD;AACH;ACSO,SAASG,EAAaC,GAAmCC,GAAYC,GAAkB;AAC5F,QAAMN,IAAYC,EAAA;AAClB,SAAOC,EAAS;AAAA,IACd,UAAU,CAAC,QAAQE,GAAYC,CAAE;AAAA,IACjC,SAAS,aACK,MAAML,EAAU,QAAgC;AAAA,MAC1D,QAAQ;AAAA,MACR,MAAMO,KAAQH,CAA4B,IAAIC,CAAE;AAAA,IAAA,CACjD,GACU,KAAK;AAAA,IAElB,SAASC,KAAWF,MAAe;AAAA,EAAA,CACpC;AACH;"}
@@ -0,0 +1,272 @@
1
+ import { useQueryClient as a, useMutation as u, useQuery as d } from "@tanstack/react-query";
2
+ import { path as c } from "@w6w/sdk";
3
+ import { u as i } from "./client-context-CX61Bgw-.js";
4
+ import { i as w, a as y } from "./callables-tOlflvbl.js";
5
+ import { o as m, a2 as b } from "./workflows-Dz8LMjnt.js";
6
+ import { i as q } from "./spec-import-invalidation-D3retX4Q.js";
7
+ const h = (e) => y("endpoint", e), S = (e) => y("function", e), l = {
8
+ function: "functions",
9
+ workflow: "workflows",
10
+ endpoint: "endpoints"
11
+ }, K = {
12
+ function: "invoke",
13
+ endpoint: "invoke",
14
+ workflow: "run"
15
+ };
16
+ function p(e, t) {
17
+ return ["versions", e, t];
18
+ }
19
+ function C(e, t, o) {
20
+ return ["version", e, t, o];
21
+ }
22
+ function g(e, t, o) {
23
+ const n = i();
24
+ return d({
25
+ queryKey: p(e, t),
26
+ queryFn: async () => {
27
+ switch (e) {
28
+ case "workflow":
29
+ return await n.workflows.listVersions(t);
30
+ case "function":
31
+ return await n.functions.listVersions(t);
32
+ case "endpoint":
33
+ return (await n.request({
34
+ method: "GET",
35
+ path: c`/${l.endpoint}/${t}/versions`
36
+ })).body;
37
+ }
38
+ },
39
+ enabled: o && e !== null && t !== ""
40
+ });
41
+ }
42
+ function j(e, t, o, n) {
43
+ const s = i();
44
+ return d({
45
+ queryKey: C(e, t, o),
46
+ queryFn: async () => {
47
+ const r = o;
48
+ switch (e) {
49
+ case "workflow":
50
+ return await s.workflows.getVersion(t, r);
51
+ case "function":
52
+ return await s.functions.getVersion(t, r);
53
+ case "endpoint":
54
+ return (await s.request({
55
+ method: "GET",
56
+ path: c`/${l.endpoint}/${t}/versions/${String(r)}`
57
+ })).body.version;
58
+ }
59
+ },
60
+ enabled: n && e !== null && t !== "" && o !== null
61
+ });
62
+ }
63
+ function E(e) {
64
+ const t = i(), o = a();
65
+ return u({
66
+ mutationFn: async (n) => {
67
+ switch (e) {
68
+ case "workflow":
69
+ return await t.workflows.publish(n);
70
+ case "function":
71
+ return await t.functions.publish(n);
72
+ case "endpoint":
73
+ return (await t.request({
74
+ method: "POST",
75
+ path: c`/${l.endpoint}/${n}/publish`
76
+ })).body;
77
+ }
78
+ },
79
+ onSuccess: (n, s) => o.invalidateQueries({ queryKey: p(e, s) })
80
+ });
81
+ }
82
+ function D(e) {
83
+ const t = i(), o = a();
84
+ return u({
85
+ mutationFn: async (n) => {
86
+ switch (e) {
87
+ case "workflow":
88
+ return n.enabled ? await t.workflows.enable(n.id) : await t.workflows.disable(n.id), { enabled: n.enabled };
89
+ case "function":
90
+ return n.enabled ? await t.functions.enable(n.id) : await t.functions.disable(n.id), { enabled: n.enabled };
91
+ case "endpoint":
92
+ return (await t.request({
93
+ method: "POST",
94
+ path: c`/${l.endpoint}/${n.id}/${n.enabled ? "enable" : "disable"}`
95
+ })).body;
96
+ }
97
+ },
98
+ onSuccess: (n, s) => {
99
+ o.invalidateQueries({ queryKey: p(e, s.id) });
100
+ }
101
+ });
102
+ }
103
+ function I(e) {
104
+ const t = i(), o = a();
105
+ return u({
106
+ mutationFn: async (n) => {
107
+ switch (e) {
108
+ case "workflow":
109
+ return { reverted: await t.workflows.revert(n.id, n.versionNumber) };
110
+ case "function":
111
+ return { reverted: await t.functions.revert(n.id, n.versionNumber) };
112
+ case "endpoint":
113
+ return (await t.request({
114
+ method: "POST",
115
+ path: c`/${l.endpoint}/${n.id}/versions/${String(n.versionNumber)}/revert`
116
+ })).body;
117
+ }
118
+ },
119
+ onSuccess: (n, s) => {
120
+ let r;
121
+ switch (e) {
122
+ case "function":
123
+ r = S(s.id);
124
+ break;
125
+ case "workflow":
126
+ r = b(s.id);
127
+ break;
128
+ case "endpoint":
129
+ r = h(s.id);
130
+ break;
131
+ }
132
+ w(o, p(e, s.id), r);
133
+ }
134
+ });
135
+ }
136
+ function N(e) {
137
+ const t = i(), o = a();
138
+ return u({
139
+ mutationFn: async (n) => {
140
+ if (e === "workflow") {
141
+ const r = await t.workflows.runVersion(n.id, n.versionNumber, {});
142
+ return { runId: r.runId, status: r.status };
143
+ }
144
+ return (await t.request({
145
+ method: "POST",
146
+ path: c`/${l[e]}/${n.id}/versions/${String(n.versionNumber)}/${K[e]}`,
147
+ body: {}
148
+ })).body;
149
+ },
150
+ onSettled: () => o.invalidateQueries({ queryKey: m.root })
151
+ });
152
+ }
153
+ function _(e) {
154
+ return e.shared ? e.sourceRepo == null ? "pending" : "synced" : "private";
155
+ }
156
+ function $(e) {
157
+ return ["documents", e];
158
+ }
159
+ function k(e, t) {
160
+ return ["documents", "detail", e, t];
161
+ }
162
+ function R(e, t, o = !0) {
163
+ const n = i();
164
+ return d({
165
+ queryKey: k(e, t),
166
+ queryFn: async () => await n.documents.get(e, { project: t }),
167
+ enabled: o
168
+ });
169
+ }
170
+ function B(e, t = !0) {
171
+ const o = i();
172
+ return d({
173
+ queryKey: $(e),
174
+ // Cast to DocWithProvenance[], same as useDocumentQuery above: the wire
175
+ // response already carries `shared`/`source*`/`syncedAt` (repo.list()
176
+ // serializes every document the same way repo.get() does), but the SDK's
177
+ // own `Doc` type doesn't declare them yet (D-5). Without this cast,
178
+ // DocumentsPage.tsx's list rows have no type-visible way to branch on
179
+ // `d.shared` the way DocumentDetailPage.tsx already does.
180
+ queryFn: async () => await o.documents.list({ project: e }),
181
+ enabled: t
182
+ });
183
+ }
184
+ function G() {
185
+ const e = i(), t = a();
186
+ return u({
187
+ mutationFn: (o) => e.documents.create(o.input, { project: o.project }),
188
+ onSuccess: () => t.invalidateQueries({ queryKey: ["documents"] })
189
+ });
190
+ }
191
+ function L() {
192
+ const e = i(), t = a();
193
+ return u({
194
+ mutationFn: (o) => e.documents.update(o.id, o.patch, { project: o.project }),
195
+ onSuccess: () => t.invalidateQueries({ queryKey: ["documents"] })
196
+ });
197
+ }
198
+ function x() {
199
+ const e = i(), t = a();
200
+ return u({
201
+ mutationFn: (o) => e.documents.delete(o.id, { project: o.project }),
202
+ onSuccess: () => t.invalidateQueries({ queryKey: ["documents"] })
203
+ });
204
+ }
205
+ function A() {
206
+ const e = i(), t = a();
207
+ return u({
208
+ mutationFn: (o) => e.request({
209
+ method: "POST",
210
+ path: c`/documents/${o.id}/sync`,
211
+ query: { project: o.project }
212
+ }),
213
+ onSuccess: () => t.invalidateQueries({ queryKey: ["documents"] })
214
+ });
215
+ }
216
+ function f(e, t) {
217
+ return { ...e, project: t };
218
+ }
219
+ function F(e, t, o) {
220
+ return { ...f(e, t), selections: o };
221
+ }
222
+ function H(e) {
223
+ const t = i();
224
+ return u({
225
+ mutationFn: async (o) => (await t.request({
226
+ method: "POST",
227
+ path: "/spec/preview",
228
+ body: f(o, e)
229
+ })).body
230
+ });
231
+ }
232
+ function U(e, t) {
233
+ const o = i(), n = a();
234
+ return u({
235
+ mutationFn: async (s) => (await o.request({
236
+ method: "POST",
237
+ path: "/spec/import",
238
+ body: F(s.document, e, s.selections)
239
+ })).body,
240
+ // A row exists in every `201` outcome (T2.1.2 §E creates it even when
241
+ // some references stayed unresolved), so the list is stale either way —
242
+ // but ONLY the list the imported kind actually belongs to (AC-3): the
243
+ // unconditional `functionsKey` this used to invalidate left an imported
244
+ // Endpoint or Workflow's own list stale while pointlessly invalidating
245
+ // Functions.
246
+ onSuccess: (s) => q(n, s.kind, t, e)
247
+ });
248
+ }
249
+ export {
250
+ H as a,
251
+ G as b,
252
+ L as c,
253
+ F as d,
254
+ f as e,
255
+ k as f,
256
+ _ as g,
257
+ $ as h,
258
+ x as i,
259
+ R as j,
260
+ B as k,
261
+ N as l,
262
+ E as m,
263
+ I as n,
264
+ D as o,
265
+ A as p,
266
+ j as q,
267
+ g as r,
268
+ p as s,
269
+ U as u,
270
+ C as v
271
+ };
272
+ //# sourceMappingURL=spec-import-FygyV8sy.js.map