@xano/sdk 1.0.0
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/CHANGELOG.md +788 -0
- package/LICENSE +21 -0
- package/README.md +541 -0
- package/dist/.build-fingerprint +1 -0
- package/dist/agent-file-refresh-ZEMK33AX.js +38 -0
- package/dist/answer-shape-K67TAAPY.js +33 -0
- package/dist/backend-dir-2U53CIAL.js +39 -0
- package/dist/backend-slot-7QXW2QYC.js +28 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +255 -0
- package/dist/branch-NCRNWQBQ.js +61 -0
- package/dist/branch-commands-ACIRCEQJ.js +79 -0
- package/dist/bundle.d.ts +223 -0
- package/dist/bundle.js +153 -0
- package/dist/capture-WAXPD7DR.js +41 -0
- package/dist/chunk-27GWNP2I.js +23 -0
- package/dist/chunk-2CMJZDCL.js +177 -0
- package/dist/chunk-2EZ3ZJZZ.js +302 -0
- package/dist/chunk-2GNFDZA2.js +390 -0
- package/dist/chunk-2MNLRIOX.js +11 -0
- package/dist/chunk-2TFRR6JV.js +104 -0
- package/dist/chunk-2ZUEE4EK.js +408 -0
- package/dist/chunk-36JUQZVQ.js +22 -0
- package/dist/chunk-3DRXWLJ5.js +83 -0
- package/dist/chunk-3JDU4VRL.js +137 -0
- package/dist/chunk-3KZCLN4Z.js +241 -0
- package/dist/chunk-3LDULPRE.js +168 -0
- package/dist/chunk-3M4LFYNQ.js +111 -0
- package/dist/chunk-3XI5CTUE.js +22 -0
- package/dist/chunk-3YW23UFH.js +50 -0
- package/dist/chunk-45UIT5T2.js +862 -0
- package/dist/chunk-4BW2SG2N.js +46 -0
- package/dist/chunk-4KHEMC32.js +79 -0
- package/dist/chunk-4POWHT2K.js +321 -0
- package/dist/chunk-4Q2GN7NW.js +192 -0
- package/dist/chunk-5A2PLKZB.js +70 -0
- package/dist/chunk-5FBYXK5P.js +159 -0
- package/dist/chunk-5HVXPTU4.js +323 -0
- package/dist/chunk-5QU2P5CA.js +304 -0
- package/dist/chunk-5V5XU32D.js +191 -0
- package/dist/chunk-5ZSO4T2G.js +10 -0
- package/dist/chunk-622HUCZT.js +10 -0
- package/dist/chunk-65HWOMGV.js +177 -0
- package/dist/chunk-6ELFRN3P.js +365 -0
- package/dist/chunk-6HO3NCSJ.js +1055 -0
- package/dist/chunk-6IUMKYWI.js +457 -0
- package/dist/chunk-6KEB3C3U.js +65 -0
- package/dist/chunk-6MR5TI5V.js +987 -0
- package/dist/chunk-6NNTNXN7.js +157 -0
- package/dist/chunk-6PBR37LN.js +97 -0
- package/dist/chunk-6QXLMMT3.js +155 -0
- package/dist/chunk-6ZGJCBZS.js +224 -0
- package/dist/chunk-73IVBKMA.js +250 -0
- package/dist/chunk-7G3CTU7I.js +286 -0
- package/dist/chunk-A3UDOZB6.js +222 -0
- package/dist/chunk-A6E77GDW.js +85 -0
- package/dist/chunk-AHJWCYQO.js +660 -0
- package/dist/chunk-AKNCFVKZ.js +36 -0
- package/dist/chunk-AM4FKL4J.js +237 -0
- package/dist/chunk-AN6BL47T.js +26 -0
- package/dist/chunk-AOSYVMUS.js +147 -0
- package/dist/chunk-APWXY5SL.js +182 -0
- package/dist/chunk-AWEIIR2U.js +218 -0
- package/dist/chunk-AWQ7BQTQ.js +73 -0
- package/dist/chunk-BAUZOWGX.js +393 -0
- package/dist/chunk-BHACRS6R.js +940 -0
- package/dist/chunk-BWPNT55T.js +680 -0
- package/dist/chunk-C6RIMRU4.js +187 -0
- package/dist/chunk-CGVQZXYG.js +263 -0
- package/dist/chunk-CIMQZRRE.js +162 -0
- package/dist/chunk-CJHQKJU4.js +113 -0
- package/dist/chunk-CTMO46PK.js +1897 -0
- package/dist/chunk-D53J55C5.js +106 -0
- package/dist/chunk-D7VGG3WS.js +90 -0
- package/dist/chunk-DAD3ONIS.js +245 -0
- package/dist/chunk-DGWHAVRG.js +162 -0
- package/dist/chunk-DX4QR4B2.js +483 -0
- package/dist/chunk-EHP3WPEG.js +21 -0
- package/dist/chunk-ELP2HMXC.js +432 -0
- package/dist/chunk-ERVIASGL.js +21 -0
- package/dist/chunk-ET4Y4XCB.js +865 -0
- package/dist/chunk-ETO6LGLD.js +4750 -0
- package/dist/chunk-EUUUMY7J.js +24 -0
- package/dist/chunk-FQJ2TTHP.js +218 -0
- package/dist/chunk-FQOF7E2E.js +133 -0
- package/dist/chunk-FWD7AL6N.js +21 -0
- package/dist/chunk-FXFV3KU6.js +138 -0
- package/dist/chunk-FXRQOWTE.js +171 -0
- package/dist/chunk-G554NZNI.js +210 -0
- package/dist/chunk-GSGDWJB5.js +13 -0
- package/dist/chunk-H2V3N23D.js +66 -0
- package/dist/chunk-H5C7MBCR.js +159 -0
- package/dist/chunk-HHN734BU.js +371 -0
- package/dist/chunk-HRVBLCVJ.js +243 -0
- package/dist/chunk-HVRUQXGD.js +1264 -0
- package/dist/chunk-I4F5TCJH.js +130 -0
- package/dist/chunk-IDOTCMDV.js +57 -0
- package/dist/chunk-IGOLHKWF.js +427 -0
- package/dist/chunk-JGE7CAWB.js +148 -0
- package/dist/chunk-JTUKLCXS.js +92 -0
- package/dist/chunk-JZGVVJSI.js +66 -0
- package/dist/chunk-K4WX6UUU.js +923 -0
- package/dist/chunk-K5BBGTYZ.js +217 -0
- package/dist/chunk-K6RXBGUB.js +427 -0
- package/dist/chunk-KTSDSD36.js +165 -0
- package/dist/chunk-L5JYN3NM.js +1038 -0
- package/dist/chunk-LIEOKXKD.js +354 -0
- package/dist/chunk-LLNZGEFK.js +51 -0
- package/dist/chunk-LPECSJ2J.js +55 -0
- package/dist/chunk-LQCMKAJ7.js +413 -0
- package/dist/chunk-LRN4ZJCQ.js +1145 -0
- package/dist/chunk-MJ4ZVHKN.js +17 -0
- package/dist/chunk-MXHSQOC4.js +3061 -0
- package/dist/chunk-N5GKCWE5.js +367 -0
- package/dist/chunk-NA3PXMEF.js +10 -0
- package/dist/chunk-NAQDMEHV.js +76 -0
- package/dist/chunk-NWKXM5RD.js +109 -0
- package/dist/chunk-NZOWWHU5.js +196 -0
- package/dist/chunk-OHX6MIUZ.js +184 -0
- package/dist/chunk-OOXWYAA4.js +15 -0
- package/dist/chunk-OPHB5ORL.js +1990 -0
- package/dist/chunk-OXA6PSZT.js +1725 -0
- package/dist/chunk-P2HAGF6H.js +73 -0
- package/dist/chunk-PTHVMXZI.js +3036 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-Q325JKYB.js +189 -0
- package/dist/chunk-Q7DGTQ5G.js +255 -0
- package/dist/chunk-QCNYHBL7.js +601 -0
- package/dist/chunk-QO6BVGS5.js +145 -0
- package/dist/chunk-QXTKSOFI.js +76 -0
- package/dist/chunk-ROY4YAEQ.js +66 -0
- package/dist/chunk-RTJRZFFY.js +447 -0
- package/dist/chunk-SAVJUS2X.js +128 -0
- package/dist/chunk-SFLHVCKX.js +173 -0
- package/dist/chunk-STSFNCY4.js +127 -0
- package/dist/chunk-SWBF2LTK.js +170 -0
- package/dist/chunk-T5KELPAR.js +109 -0
- package/dist/chunk-TFFGOFVZ.js +1481 -0
- package/dist/chunk-TLHIFK4M.js +256 -0
- package/dist/chunk-TLQE7ZN3.js +156 -0
- package/dist/chunk-TPHWJ7UG.js +1981 -0
- package/dist/chunk-TRJCALW3.js +291 -0
- package/dist/chunk-TTEIYD5P.js +133 -0
- package/dist/chunk-U64O2MXY.js +407 -0
- package/dist/chunk-UCQ2VUTG.js +630 -0
- package/dist/chunk-UTI5G6OJ.js +44 -0
- package/dist/chunk-UVHDMMIP.js +188 -0
- package/dist/chunk-UZ6QQWJT.js +120 -0
- package/dist/chunk-VAX3UZOY.js +686 -0
- package/dist/chunk-W3HBUKFO.js +57 -0
- package/dist/chunk-WKQLGKCL.js +2823 -0
- package/dist/chunk-WQFNASK4.js +560 -0
- package/dist/chunk-WRBKLYSJ.js +224 -0
- package/dist/chunk-WTPZRR4I.js +17 -0
- package/dist/chunk-WZDJ2LLX.js +2385 -0
- package/dist/chunk-X2NL4KUO.js +14 -0
- package/dist/chunk-X4DVXBFY.js +38 -0
- package/dist/chunk-X677DMZM.js +7050 -0
- package/dist/chunk-XBKMWY7F.js +612 -0
- package/dist/chunk-XNCP4KYO.js +78 -0
- package/dist/chunk-XVBGLISP.js +35 -0
- package/dist/chunk-XW6KISBB.js +1192 -0
- package/dist/chunk-YGZHHAAB.js +8156 -0
- package/dist/chunk-YHEFQUQB.js +186 -0
- package/dist/chunk-YLDALTWZ.js +653 -0
- package/dist/chunk-YU4HSQW7.js +229 -0
- package/dist/chunk-ZDPP6RKB.js +27 -0
- package/dist/chunk-ZFDZKNGG.js +194 -0
- package/dist/chunk-ZIY7RNUT.js +49 -0
- package/dist/chunk-ZYJP6BOO.js +30 -0
- package/dist/cli.d.ts +1111 -0
- package/dist/cli.js +165 -0
- package/dist/codegen-command-VR2GWR6C.js +173 -0
- package/dist/codegen.d.ts +115 -0
- package/dist/codegen.js +19 -0
- package/dist/commands-GJMJ4XYZ.js +76 -0
- package/dist/completion-ZQLO6PB6.js +738 -0
- package/dist/config-MBYGCAFK.js +136 -0
- package/dist/deploy-command-JVZPWHMK.js +180 -0
- package/dist/deploy-source-3W45CXMP.js +81 -0
- package/dist/dev-env-sync-HN44K4D5.js +188 -0
- package/dist/diagnostics-UEAAHWVF.js +30 -0
- package/dist/display-name-hint-ABBPVQIR.js +46 -0
- package/dist/emit-CyhBDxli.d.ts +7007 -0
- package/dist/env-example-refresh-ET5HMMDW.js +126 -0
- package/dist/env-pull-command-TNMNB3CV.js +323 -0
- package/dist/env-target-O4HRKTGZ.js +40 -0
- package/dist/env-var-command-ZIRDCAZA.js +427 -0
- package/dist/ephemeral-P7F3PMAD.js +54 -0
- package/dist/ephemeral-command-CLJJKOFT.js +592 -0
- package/dist/ephemeral-state-PYCBSOGX.js +61 -0
- package/dist/file-lock-PT74GWYW.js +10 -0
- package/dist/generate-command-AYEOLA26.js +510 -0
- package/dist/gitignore-3SJ3WNRG.js +51 -0
- package/dist/guards-4EBNCZDC.js +162 -0
- package/dist/hosted-file-PSHJB3HX.js +28 -0
- package/dist/impersonate-command-5JAS3WSV.js +152 -0
- package/dist/import-EQSFU6JC.js +19 -0
- package/dist/index.d.ts +5470 -0
- package/dist/index.js +371 -0
- package/dist/init-command-X2FR4UAK.js +125 -0
- package/dist/init-modules-RY7UHAOL.js +50 -0
- package/dist/init-web-M4YZSZK6.js +42 -0
- package/dist/internal.d.ts +179 -0
- package/dist/internal.js +2634 -0
- package/dist/io-RC56QSN5.js +26 -0
- package/dist/keep-data-merge-7MPLVAVI.js +1119 -0
- package/dist/lambda-config-reconcile-OUZ4OYAB.js +116 -0
- package/dist/landed-753YLJ5H.js +40 -0
- package/dist/landing-record-SU52SKXU.js +61 -0
- package/dist/live-diff-YONW2VI3.js +65 -0
- package/dist/local-engine-choice-CH5X3W7E.js +79 -0
- package/dist/local-engine-command-Z3OL7VOD.js +766 -0
- package/dist/local-engine-config-5U3SC434.js +39 -0
- package/dist/local-engine-deploy-PCQ4SNPB.js +39 -0
- package/dist/local-engine-process-EHTE5LLU.js +63 -0
- package/dist/local-engine-state-A4FTRFAF.js +32 -0
- package/dist/local-engine-update-check-6L645VBL.js +162 -0
- package/dist/lock-MRRHW5GS.js +87 -0
- package/dist/lock-commands-2QG25HL7.js +963 -0
- package/dist/login-command-QPYRWOXZ.js +538 -0
- package/dist/logout-command-WOIQLDP6.js +56 -0
- package/dist/loop-ALIZLOSX.js +191 -0
- package/dist/marketplace-command-K5YL42NO.js +977 -0
- package/dist/marketplace-resolve-LY32JES5.js +40 -0
- package/dist/meta-client-YXGPW53C.js +244 -0
- package/dist/module-manifest-JFGHU2TC.js +38 -0
- package/dist/near-key.d.ts +13 -0
- package/dist/near-key.js +8 -0
- package/dist/node.d.ts +95 -0
- package/dist/node.js +969 -0
- package/dist/operation-outcome-TZSESNC7.js +51 -0
- package/dist/output-target-AL3I44GG.js +47 -0
- package/dist/package-manager-PRAHUSCN.js +34 -0
- package/dist/plan-disclosure-6G4MLZKD.js +114 -0
- package/dist/plugin-contributions-WRNY5ABG.js +28 -0
- package/dist/plugin-prompt-4VA3B4FF.js +20 -0
- package/dist/plugin-questions-JTSYA74Q.js +24 -0
- package/dist/plugin.d.ts +396 -0
- package/dist/plugin.js +1 -0
- package/dist/preflight-command-2T5Z36MI.js +321 -0
- package/dist/profile-command-AH3PIM4X.js +800 -0
- package/dist/profile-pointer-GRWJU3YD.js +31 -0
- package/dist/profile-select-74TRDEPD.js +23 -0
- package/dist/project-dependency-KSH63ODT.js +35 -0
- package/dist/project-sdk-REPPOIBD.js +24 -0
- package/dist/promote-command-PCWT5N6S.js +140 -0
- package/dist/prompt-II3F3LND.js +27 -0
- package/dist/publish-command-TTDUUJI5.js +414 -0
- package/dist/pull-command-VBO7C4S3.js +161 -0
- package/dist/pull-superseded-GJWLG7XO.js +20 -0
- package/dist/release-command-N4ZPKMHR.js +146 -0
- package/dist/release-ns-command-3KFDMZ6G.js +1745 -0
- package/dist/response-HlXahv4K.d.ts +925 -0
- package/dist/retry-command-AS5EVREX.js +34 -0
- package/dist/routes-manifest-SNWUVBT6.js +43 -0
- package/dist/runtime-XETHVF33.js +14 -0
- package/dist/scaffold.d.ts +1911 -0
- package/dist/scaffold.js +107 -0
- package/dist/secrets-file-LVZD6IIM.js +56 -0
- package/dist/secrets-fill-command-TTCPSVXN.js +218 -0
- package/dist/seed-VU7C3QYS.js +46 -0
- package/dist/sent-writes-N7X4OVXT.js +22 -0
- package/dist/source-resolve-S2XA3XZF.js +83 -0
- package/dist/static-host-B2Y6AG3W.js +352 -0
- package/dist/status-command-RUDXTF7I.js +554 -0
- package/dist/store-6VNCD4D7.js +20 -0
- package/dist/store-ARM6VMO5.js +98 -0
- package/dist/store-DuYfzKlW.d.ts +3144 -0
- package/dist/suggest-6FOOYKHG.js +12 -0
- package/dist/sveltekit.d.ts +154 -0
- package/dist/sveltekit.js +109 -0
- package/dist/sync-contributions-UCEROO26.js +415 -0
- package/dist/table-ENAVMITR.js +42 -0
- package/dist/tables-command-GUPXXSB5.js +156 -0
- package/dist/tenant-IIHPOHGP.js +42 -0
- package/dist/tenant-command-D5HGI2X4.js +965 -0
- package/dist/test-command-TIKZMDPZ.js +476 -0
- package/dist/tests-BGGIOK3L.js +26 -0
- package/dist/token-NICJUTMT.js +72 -0
- package/dist/toolchain-hooks-GHKLUJOH.js +96 -0
- package/dist/toolchain-modules-5EAZUONB.js +24 -0
- package/dist/tracked-backend-EIBUMDZA.js +80 -0
- package/dist/update-check-2W2NLDTC.js +136 -0
- package/dist/upgrade-command-QHNFWM7O.js +531 -0
- package/dist/verify-rollout-DRCK5TDD.js +61 -0
- package/dist/whoami-command-STGINTXH.js +51 -0
- package/dist/workspace-2CLHU2LK.js +93 -0
- package/dist/workspace-binding-56PIIPCP.js +54 -0
- package/dist/workspace-command-JEXQETJD.js +535 -0
- package/dist/workspace-env-F2RFMSC5.js +70 -0
- package/dist/workspace-export-OJSH2HIW.js +21 -0
- package/dist/writable-VA7OISSK.js +25 -0
- package/dist/xano-ICFUSPFR.js +42 -0
- package/dist/xanosdk-import-GN42TO2B.js +56 -0
- package/dist/xanosdk-project-S6DXJONQ.js +41 -0
- package/dist/xdo-CxDr2Q1C.d.ts +1371 -0
- package/guides/README.md +33 -0
- package/guides/authoring.md +921 -0
- package/guides/cli.md +401 -0
- package/guides/codegen.md +177 -0
- package/guides/codes.md +404 -0
- package/guides/coverage.md +74 -0
- package/guides/deploying.md +1525 -0
- package/guides/environment.md +400 -0
- package/guides/marketplace.md +415 -0
- package/guides/module-contract.md +558 -0
- package/guides/object-kinds.md +433 -0
- package/guides/project-structure.md +43 -0
- package/guides/scaffold.md +351 -0
- package/guides/typed-frontend.md +242 -0
- package/llms/client.md +63 -0
- package/llms/errors.md +56 -0
- package/llms/fields.md +176 -0
- package/llms/filters.md +183 -0
- package/llms/kinds-agent-mcp.md +30 -0
- package/llms/kinds-core.md +100 -0
- package/llms/kinds-knowledge.md +20 -0
- package/llms/kinds-realtime.md +76 -0
- package/llms/lambda.md +94 -0
- package/llms/legacy.md +44 -0
- package/llms/lock.md +40 -0
- package/llms/object-kinds.md +34 -0
- package/llms/statements-calls.md +62 -0
- package/llms/statements-catalog.md +320 -0
- package/llms/statements-data.md +66 -0
- package/llms/statements-runtime.md +68 -0
- package/llms/tests.md +59 -0
- package/llms/toolchain.md +16 -0
- package/llms/triggers.md +36 -0
- package/llms/values.md +29 -0
- package/llms-full.txt +2085 -0
- package/llms.txt +493 -0
- package/manifest.json +11224 -0
- package/package.json +162 -0
- package/types/lambda-globals.d.ts +129 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readDeployed
|
|
3
|
+
} from "./chunk-LPECSJ2J.js";
|
|
4
|
+
import {
|
|
5
|
+
isProjectDir
|
|
6
|
+
} from "./chunk-6NNTNXN7.js";
|
|
7
|
+
import {
|
|
8
|
+
LookupFailedError,
|
|
9
|
+
SourceError,
|
|
10
|
+
resolveSource
|
|
11
|
+
} from "./chunk-QCNYHBL7.js";
|
|
12
|
+
import {
|
|
13
|
+
NotSignedInError
|
|
14
|
+
} from "./chunk-ET4Y4XCB.js";
|
|
15
|
+
import {
|
|
16
|
+
otherCredentialRefusal
|
|
17
|
+
} from "./chunk-SWBF2LTK.js";
|
|
18
|
+
import {
|
|
19
|
+
getEngineRecord
|
|
20
|
+
} from "./chunk-3M4LFYNQ.js";
|
|
21
|
+
import {
|
|
22
|
+
commandPath,
|
|
23
|
+
parseSlot,
|
|
24
|
+
refusedKind,
|
|
25
|
+
slotValueMissing
|
|
26
|
+
} from "./chunk-STSFNCY4.js";
|
|
27
|
+
import {
|
|
28
|
+
getEnvironment,
|
|
29
|
+
readEphemeralState,
|
|
30
|
+
unreadableEphemeralState
|
|
31
|
+
} from "./chunk-5QU2P5CA.js";
|
|
32
|
+
import {
|
|
33
|
+
ENV_CREDENTIAL_VARS,
|
|
34
|
+
ORIGIN_READ_ONLY_BY_REFRESH,
|
|
35
|
+
contextFlags,
|
|
36
|
+
credentialFileFlagFor,
|
|
37
|
+
recordedByEnvCredential,
|
|
38
|
+
typedCredentialFlags
|
|
39
|
+
} from "./chunk-NAQDMEHV.js";
|
|
40
|
+
import {
|
|
41
|
+
backendDirIn
|
|
42
|
+
} from "./chunk-5A2PLKZB.js";
|
|
43
|
+
import {
|
|
44
|
+
globalAuthFilePath,
|
|
45
|
+
localAuthFilePath,
|
|
46
|
+
loginCommand,
|
|
47
|
+
profileAddCommand,
|
|
48
|
+
readCredentialFile,
|
|
49
|
+
recordedCredentialPath
|
|
50
|
+
} from "./chunk-XW6KISBB.js";
|
|
51
|
+
import {
|
|
52
|
+
UsageError,
|
|
53
|
+
displayPath,
|
|
54
|
+
pastePath,
|
|
55
|
+
sourceSpellings
|
|
56
|
+
} from "./chunk-PTHVMXZI.js";
|
|
57
|
+
import {
|
|
58
|
+
shellQuote
|
|
59
|
+
} from "./chunk-5ZSO4T2G.js";
|
|
60
|
+
|
|
61
|
+
// src/emit/tracked-backend.ts
|
|
62
|
+
import { existsSync, readdirSync } from "fs";
|
|
63
|
+
import { join, relative } from "path";
|
|
64
|
+
function memoCredential(provider) {
|
|
65
|
+
let pending;
|
|
66
|
+
return () => pending ??= provider();
|
|
67
|
+
}
|
|
68
|
+
async function selectBackend(slot, raw, ctx) {
|
|
69
|
+
if (raw !== void 0) return parseSlot(slot, raw);
|
|
70
|
+
if (slot.selector.default === "none") throw slotValueMissing(slot);
|
|
71
|
+
if (slot.selector.default !== "tracked") {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Internal: \`${commandPath(slot.command, slot.subcommand)}\`'s ${slot.spelling} defaults to "${slot.selector.default}", which the caller resolves itself \u2014 not the tracked backend.`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const cwd = ctx.deps?.cwd ?? process.cwd();
|
|
77
|
+
const env = ctx.deps?.env ?? process.env;
|
|
78
|
+
const pointer = readDeployed(cwd)?.kind;
|
|
79
|
+
if (pointer !== void 0) refuseUnservable(slot, pointer);
|
|
80
|
+
const state = readEphemeralState(cwd);
|
|
81
|
+
let scope;
|
|
82
|
+
if (pointer === "ephemeral") {
|
|
83
|
+
scope = await ctx.credential();
|
|
84
|
+
} else if (pointer === void 0 && Object.keys(state.environments).length > 0) {
|
|
85
|
+
scope = await silently(ctx.credential);
|
|
86
|
+
}
|
|
87
|
+
const decided = decide({ cwd, pointer, state, scope, engineRecorded: getEngineRecord(cwd, env) !== void 0 }, slot);
|
|
88
|
+
if ("refusal" in decided) {
|
|
89
|
+
const { reachableFirst } = await import("./env-target-O4HRKTGZ.js");
|
|
90
|
+
throw await reachableFirst(decided.refusal, scope);
|
|
91
|
+
}
|
|
92
|
+
refuseUnservable(slot, decided.kind);
|
|
93
|
+
return { kind: decided.kind };
|
|
94
|
+
}
|
|
95
|
+
async function resolveBackend(slot, raw, ctx) {
|
|
96
|
+
const credential = memoCredential(ctx.credential);
|
|
97
|
+
const source = await selectBackend(slot, raw, { ...ctx, credential });
|
|
98
|
+
if (source.kind === "file") {
|
|
99
|
+
throw new Error(`Internal: \`${commandPath(slot.command, slot.subcommand)}\` resolved a bundle file; read it before resolving a backend.`);
|
|
100
|
+
}
|
|
101
|
+
if (source.kind === "local-engine") refuseProfileForLocal(ctx.profile, [source.kind], slot);
|
|
102
|
+
return resolveSource(source, credential, { ...ctx.deps, cwd: ctx.deps?.cwd ?? process.cwd() }).catch((err) => {
|
|
103
|
+
throw lookupRetry(err, slot);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function lookupRetry(err, slot) {
|
|
107
|
+
if (!(err instanceof LookupFailedError)) return err;
|
|
108
|
+
return err.withRerun(`xanosdk ${commandPath(slot.command, slot.subcommand)} \u2026`, " as you ran it");
|
|
109
|
+
}
|
|
110
|
+
function refuseProfileForLocal(profile, kinds, slot, flags = typedCredentialFlags()) {
|
|
111
|
+
if (kinds.some((k) => k !== "local-engine")) return;
|
|
112
|
+
const why = "and a local engine takes none \u2014 it is reached with the engine's own bearer.";
|
|
113
|
+
const or = slot === void 0 ? "or drop `--local-engine` to deploy to a hosted backend." : `or ${nameOne(slot, "a hosted backend", true)}.`;
|
|
114
|
+
if (profile !== void 0) {
|
|
115
|
+
throw new UsageError(`\`--profile ${profile}\` selects a Xano credential, ${why} Drop \`--profile\`, ${or}`, hintOpts(slot));
|
|
116
|
+
}
|
|
117
|
+
if (flags.authFile !== void 0) {
|
|
118
|
+
throw new UsageError(`\`--config ${flags.authFile}\` names a Xano credential file, ${why} Drop \`--config\`, ${or}`, hintOpts(slot));
|
|
119
|
+
}
|
|
120
|
+
if (flags.local === true) {
|
|
121
|
+
throw new UsageError(`\`--local\` selects the project-local Xano credential file, ${why} Drop \`--local\`, ${or}`, hintOpts(slot));
|
|
122
|
+
}
|
|
123
|
+
if (flags.authHost !== void 0) {
|
|
124
|
+
throw new UsageError(`\`--origin\` names a Xano sign-in server, ${why} ${ORIGIN_READ_ONLY_BY_REFRESH}`, hintOpts(slot));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function readTrackedBackend(opts) {
|
|
128
|
+
const decided = decide(
|
|
129
|
+
{
|
|
130
|
+
cwd: opts.cwd,
|
|
131
|
+
pointer: readDeployed(opts.cwd)?.kind,
|
|
132
|
+
state: readEphemeralState(opts.cwd),
|
|
133
|
+
scope: opts.scope,
|
|
134
|
+
engineRecorded: getEngineRecord(opts.cwd, opts.env ?? process.env) !== void 0
|
|
135
|
+
},
|
|
136
|
+
void 0
|
|
137
|
+
);
|
|
138
|
+
if ("refusal" in decided) return { kind: null, via: null, reason: decided.refusal.message };
|
|
139
|
+
return { kind: decided.kind, via: decided.via, reason: null };
|
|
140
|
+
}
|
|
141
|
+
function decide(facts, slot) {
|
|
142
|
+
const { cwd, pointer, state, scope, engineRecorded } = facts;
|
|
143
|
+
const ephemeralHere = scope !== void 0 && getEnvironment(state, scope) !== void 0;
|
|
144
|
+
if (pointer === "local-engine") {
|
|
145
|
+
return engineRecorded ? { kind: "local-engine", via: "pointer" } : { refusal: noEngineRecorded(slot) };
|
|
146
|
+
}
|
|
147
|
+
if (pointer === "ephemeral") {
|
|
148
|
+
if (scope === void 0) return { refusal: signedOut(slot, state) };
|
|
149
|
+
return ephemeralHere ? { kind: "ephemeral", via: "pointer" } : { refusal: untracked(cwd, state, scope, slot, true) };
|
|
150
|
+
}
|
|
151
|
+
if (ephemeralHere) return { kind: "ephemeral", via: "fallback" };
|
|
152
|
+
if (engineRecorded) return { kind: "local-engine", via: "fallback" };
|
|
153
|
+
if (scope !== void 0) return { refusal: untracked(cwd, state, scope, slot, false) };
|
|
154
|
+
return { refusal: nothingTracked(cwd, slot, Object.keys(state.environments).length > 0, state) };
|
|
155
|
+
}
|
|
156
|
+
async function silently(credential) {
|
|
157
|
+
try {
|
|
158
|
+
return await credential();
|
|
159
|
+
} catch (err) {
|
|
160
|
+
if (err instanceof NotSignedInError) return void 0;
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function refuseUnservable(slot, kind) {
|
|
165
|
+
const refusal = refusedKind(slot, kind, "tracked");
|
|
166
|
+
if (refusal !== void 0) throw refusal;
|
|
167
|
+
if (!slot.selector.accepted.includes(kind)) {
|
|
168
|
+
throw new UsageError(
|
|
169
|
+
`This project last deployed to ${KIND_PHRASE[kind]}, which \`xanosdk ${commandPath(slot.command, slot.subcommand)}\` does not take. Name one with \`${slot.spelling}\`: ${sourceSpellings(slot.selector.accepted)}.`,
|
|
170
|
+
hintOpts(slot)
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
var KIND_PHRASE = {
|
|
175
|
+
ephemeral: "an ephemeral",
|
|
176
|
+
"local-engine": "a local engine"
|
|
177
|
+
};
|
|
178
|
+
function hintOpts(slot) {
|
|
179
|
+
if (slot === void 0) return {};
|
|
180
|
+
return {
|
|
181
|
+
hintFor: slot.subcommand === void 0 ? { command: slot.command } : { command: slot.command, subcommand: slot.subcommand }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function nameOne(slot, what = "a backend", hostedOnly = false) {
|
|
185
|
+
if (slot === void 0) return `name ${what} on the command explicitly`;
|
|
186
|
+
const spellings = sourceSpellings(
|
|
187
|
+
hostedOnly ? slot.selector.accepted.filter((k) => k !== "local-engine" && k !== "file") : slot.selector.accepted
|
|
188
|
+
);
|
|
189
|
+
if (!slot.spelling.startsWith("--")) {
|
|
190
|
+
const verb = slot.subcommand === void 0 ? slot.command : `${slot.command} ${slot.subcommand}`;
|
|
191
|
+
return `name ${what} as its argument (\`xanosdk ${verb} ${slot.spelling}\`): ${spellings}`;
|
|
192
|
+
}
|
|
193
|
+
return `name ${what} with \`${slot.spelling}\`: ${spellings}`;
|
|
194
|
+
}
|
|
195
|
+
function bothDeploys(cwd) {
|
|
196
|
+
const flags = contextFlags();
|
|
197
|
+
const entry = cwd === void 0 ? "" : soleNestedEntry(cwd);
|
|
198
|
+
const hosted = /(^| )--local( |$)/.test(flags) ? "an ephemeral, with the project-local credential" : "an ephemeral";
|
|
199
|
+
return `\`xanosdk deploy${entry}${flags}\` (${hosted}) or \`xanosdk deploy${entry} --local-engine\` (a local engine on this machine)`;
|
|
200
|
+
}
|
|
201
|
+
function untracked(cwd, state, scope, slot, pointer) {
|
|
202
|
+
const other = otherCredentialRefusal(state, scope, `or ${nameOne(slot)}`, hintOpts(slot));
|
|
203
|
+
if (other !== void 0) return other;
|
|
204
|
+
if (pointer) {
|
|
205
|
+
const unreadable = unreadableEphemeralState(cwd);
|
|
206
|
+
if (unreadable !== void 0) {
|
|
207
|
+
return new SourceError(
|
|
208
|
+
`This project last deployed to an ephemeral, but its record ${displayPath(unreadable)} is unreadable. \`xanosdk ephemeral list${contextFlags()}\` finds the ephemeral it recorded \u2014 then ${nameOne(slot, "it")}.`,
|
|
209
|
+
"gone",
|
|
210
|
+
"ephemeral"
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
return new SourceError(
|
|
214
|
+
`This project last deployed to an ephemeral, but the last one is gone (deleted or expired). Run \`xanosdk deploy${contextFlags()}\` to create one \u2014 or \`xanosdk deploy --local-engine\` for a local engine \u2014 or ${nameOne(slot)}.`,
|
|
215
|
+
"gone",
|
|
216
|
+
"ephemeral"
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
return nothingTracked(cwd, slot, false);
|
|
220
|
+
}
|
|
221
|
+
var NothingTrackedError = class extends UsageError {
|
|
222
|
+
};
|
|
223
|
+
function nothingTracked(cwd, slot, ephemeralRecordedElsewhere, state) {
|
|
224
|
+
const nested = ephemeralRecordedElsewhere ? [] : nestedTrackedBackends(cwd);
|
|
225
|
+
if (nested.length > 0) {
|
|
226
|
+
const takesEntry = slot?.command === "release" && slot.subcommand === "create" && !isProjectDir(cwd);
|
|
227
|
+
const shown = nested.map((n) => `\`${n.dir}\`${n.entry === void 0 ? "" : ` (deployed from ${n.entry})`}`);
|
|
228
|
+
const one = nested.length === 1 ? nested[0] : void 0;
|
|
229
|
+
return new NothingTrackedError(
|
|
230
|
+
`This directory has no backend to default to: nothing deployed from here. ` + (one !== void 0 ? `The backend below it at ${shown[0]} did, and its record is kept beside it. Run the command from there (\`cd ${shellQuote(one.dir)}\`)` + (takesEntry && one.entry !== void 0 ? `, or name its entry with \`--entry=${shellQuote(one.entry)}\`` : "") + `, or ${nameOne(slot)}.` : `Backends below it did, each with its record kept beside it: ${shown.join(", ")}. Run the command from the one you mean (\`cd <dir>\`)` + (takesEntry ? `, or name its entry with \`--entry=<entry>\`` : "") + `, or ${nameOne(slot)}.`),
|
|
231
|
+
hintOpts(slot)
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
const flags = state === void 0 ? void 0 : recordedCredentialFlags(state);
|
|
235
|
+
const signIn = !ephemeralRecordedElsewhere ? "" : flags !== void 0 ? flags.env ? ` An ephemeral is recorded under ${flags.who} \u2014 set ${ENV_CREDENTIAL_VARS} for that workspace again to reach it.` : flags.signIn ? ` An ephemeral is recorded under ${flags.who}, which no credential file holds \u2014 add it again with ${flags.flags} to reach it.` : ` An ephemeral is recorded under ${flags.who}, and no credential is signed in \u2014 re-run with \`${flags.flags}\` to reach it.` : ` An ephemeral is recorded, but no credential is signed in to look it up \u2014 \`${runLogin()}\` reaches it.`;
|
|
236
|
+
return new NothingTrackedError(
|
|
237
|
+
`This project has no backend to default to: it has not deployed to an ephemeral under this credential or to a local engine from this directory.${signIn} Deploy first with ${bothDeploys(cwd)}, or ${nameOne(slot)}.`,
|
|
238
|
+
hintOpts(slot)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
function soleNestedEntry(cwd) {
|
|
242
|
+
if (existsSync(join(backendDirIn(cwd), "index.ts"))) return "";
|
|
243
|
+
const entries = nestedBackendEntries(cwd, 2);
|
|
244
|
+
return entries.length === 1 ? ` ${shellQuote(entries[0])}` : "";
|
|
245
|
+
}
|
|
246
|
+
function nestedBackendEntries(cwd, limit = 10) {
|
|
247
|
+
const entries = [];
|
|
248
|
+
const walk = (dir, depth) => {
|
|
249
|
+
if (depth > NESTED_DEPTH || entries.length >= limit) return;
|
|
250
|
+
let names;
|
|
251
|
+
try {
|
|
252
|
+
names = readdirSync(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
253
|
+
} catch {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
for (const name of names.sort()) {
|
|
257
|
+
if (name === "node_modules" || name.startsWith(".")) continue;
|
|
258
|
+
const child = join(dir, name);
|
|
259
|
+
const entry = join(backendDirIn(child), "index.ts");
|
|
260
|
+
if (existsSync(entry)) entries.push(entry);
|
|
261
|
+
else walk(child, depth + 1);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
walk(cwd, 1);
|
|
265
|
+
return entries.slice(0, limit).map((entry) => pastePath(relative(cwd, entry)));
|
|
266
|
+
}
|
|
267
|
+
var NESTED_DEPTH = 4;
|
|
268
|
+
function nestedTrackedBackends(cwd) {
|
|
269
|
+
const found = [];
|
|
270
|
+
const walk = (dir, depth) => {
|
|
271
|
+
if (depth > NESTED_DEPTH || found.length >= 10) return;
|
|
272
|
+
let names;
|
|
273
|
+
try {
|
|
274
|
+
names = readdirSync(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
275
|
+
} catch {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
for (const name of names.sort()) {
|
|
279
|
+
if (name === "node_modules" || name.startsWith(".")) continue;
|
|
280
|
+
const child = join(dir, name);
|
|
281
|
+
const state = readEphemeralState(child);
|
|
282
|
+
const records = Object.values(state.environments);
|
|
283
|
+
if (readDeployed(child) !== void 0 || records.length > 0) {
|
|
284
|
+
const entry = records.find((r) => typeof r.entry === "string")?.entry;
|
|
285
|
+
found.push({
|
|
286
|
+
dir: pastePath(relative(cwd, child)),
|
|
287
|
+
...entry === void 0 ? {} : { entry: pastePath(relative(cwd, join(child, entry))) }
|
|
288
|
+
});
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
walk(child, depth + 1);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
walk(cwd, 1);
|
|
295
|
+
return found;
|
|
296
|
+
}
|
|
297
|
+
function noEngineRecorded(slot) {
|
|
298
|
+
const named = slot === void 0 ? "name one on the command" : slot.spelling.startsWith("--") ? `name one with \`${slot.spelling} local-engine:<name>\`` : `name one: \`xanosdk ${slot.subcommand === void 0 ? slot.command : `${slot.command} ${slot.subcommand}`} local-engine:<name>\``;
|
|
299
|
+
return new SourceError(
|
|
300
|
+
`This project last deployed to a local engine, but no engine is recorded for this directory. Run \`xanosdk deploy --local-engine\` to stand one up, or \`xanosdk local-engine list\` to see what is running and ${named}. \`xanosdk deploy${contextFlags()}\` still deploys to an ephemeral.`,
|
|
301
|
+
"gone",
|
|
302
|
+
"local-engine"
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
function signedOut(slot, state) {
|
|
306
|
+
const flags = recordedCredentialFlags(state);
|
|
307
|
+
return new UsageError(
|
|
308
|
+
`This project last deployed to an ephemeral, and no credential is signed in to look it up. ` + (flags?.env ? `It is recorded under ${flags.who} \u2014 set ${ENV_CREDENTIAL_VARS} for that workspace again, or ${nameOne(slot)}.` : flags?.signIn ? `It is recorded under ${flags.who}, which no credential file holds \u2014 add it again with ${flags.flags}; or ${nameOne(slot)}.` : flags !== void 0 ? `It is recorded under ${flags.who} \u2014 re-run with \`${flags.flags}\`, or ${nameOne(slot)}.` : `Run \`${runLogin()}\`, or ${nameOne(slot)}.`),
|
|
309
|
+
hintOpts(slot)
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
function runLogin() {
|
|
313
|
+
return `xanosdk login${contextFlags()}`;
|
|
314
|
+
}
|
|
315
|
+
function recordedCredentialFlags(state) {
|
|
316
|
+
const seen = /* @__PURE__ */ new Map();
|
|
317
|
+
const entries = Object.entries(state.environments);
|
|
318
|
+
for (const [key, record] of entries) {
|
|
319
|
+
if (!key.includes("/")) return void 0;
|
|
320
|
+
const profile2 = key.slice(0, key.indexOf("/"));
|
|
321
|
+
const env2 = recordedByEnvCredential(record);
|
|
322
|
+
seen.set(`${env2 ? "env" : profile2}\0${record.credential_file ?? ""}`, { profile: profile2, file: record.credential_file, env: env2 });
|
|
323
|
+
}
|
|
324
|
+
if (seen.size !== 1) return void 0;
|
|
325
|
+
const [{ profile, file, env }] = [...seen.values()];
|
|
326
|
+
if (env) return { who: "the environment credential", flags: "", env: true };
|
|
327
|
+
if (!profileStored(profile, file)) {
|
|
328
|
+
const [key, record] = entries.length === 1 ? entries[0] : [void 0, void 0];
|
|
329
|
+
const target = {
|
|
330
|
+
path: file !== void 0 ? recordedCredentialPath(file) ?? void 0 : void 0,
|
|
331
|
+
instance: key === void 0 ? void 0 : record?.instance ?? `https://${key.split("/").slice(1, -1).join("/")}`,
|
|
332
|
+
workspaceId: key?.slice(key.lastIndexOf("/") + 1)
|
|
333
|
+
};
|
|
334
|
+
return {
|
|
335
|
+
who: `profile "${profile}"`,
|
|
336
|
+
flags: `\`${loginCommand(profile, target)}\` (OAuth), or \`${profileAddCommand(profile, target)}\` (meta API token)`,
|
|
337
|
+
signIn: true
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
who: `profile "${profile}"`,
|
|
342
|
+
flags: `--profile ${profile}${file !== void 0 ? credentialFileFlagFor(file) : ""}`
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function recordedFilePath(file) {
|
|
346
|
+
if (file === void 0 || file === "shared") return void 0;
|
|
347
|
+
return file === "local" ? localAuthFilePath() : file;
|
|
348
|
+
}
|
|
349
|
+
function profileStored(profile, file) {
|
|
350
|
+
const paths = file === void 0 ? [globalAuthFilePath(), localAuthFilePath()] : [recordedFilePath(file) ?? globalAuthFilePath()];
|
|
351
|
+
for (const path of paths) {
|
|
352
|
+
try {
|
|
353
|
+
const stored = readCredentialFile(path);
|
|
354
|
+
if (stored !== null && Object.hasOwn(stored.profiles, profile)) return true;
|
|
355
|
+
} catch {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export {
|
|
363
|
+
memoCredential,
|
|
364
|
+
selectBackend,
|
|
365
|
+
resolveBackend,
|
|
366
|
+
refuseProfileForLocal,
|
|
367
|
+
readTrackedBackend,
|
|
368
|
+
NothingTrackedError,
|
|
369
|
+
nestedBackendEntries
|
|
370
|
+
};
|
|
371
|
+
//# sourceMappingURL=chunk-HHN734BU.js.map
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_DOCUMENTATION,
|
|
3
|
+
LEGACY_REALTIME
|
|
4
|
+
} from "./chunk-2CMJZDCL.js";
|
|
5
|
+
import {
|
|
6
|
+
identityNamesByGuid,
|
|
7
|
+
lockNameForObject,
|
|
8
|
+
sdkKindName
|
|
9
|
+
} from "./chunk-6MR5TI5V.js";
|
|
10
|
+
|
|
11
|
+
// src/codegen/omissions.ts
|
|
12
|
+
function omissionSeverity(reason) {
|
|
13
|
+
return reason === "unmodeled" ? "warning" : "notice";
|
|
14
|
+
}
|
|
15
|
+
var UNSUPPORTED_SECTIONS = {
|
|
16
|
+
vault: {
|
|
17
|
+
label: "stored files",
|
|
18
|
+
reason: "stored-file",
|
|
19
|
+
detail: 'a file\'s bytes are not carried into the generated tree; to ship one from the project, put it in the repo and point the field at `hostedFile("./<file>", import.meta.url)`'
|
|
20
|
+
},
|
|
21
|
+
// These three were tagged `unmodeled`, which their own detail lines contradict:
|
|
22
|
+
// none of them is an object type the SDK failed to model. They are records of
|
|
23
|
+
// what was done to the workspace, owned by the instance that did it.
|
|
24
|
+
market_item: { label: "marketplace records", reason: "instance-owned", detail: "marketplace provenance is owned by the instance" },
|
|
25
|
+
run_install: { label: "install runs", reason: "instance-owned", detail: "install runs are instance history, not workspace source" },
|
|
26
|
+
action_package_install: {
|
|
27
|
+
label: "action-package installs",
|
|
28
|
+
reason: "instance-owned",
|
|
29
|
+
detail: "action-package installs are owned by the instance"
|
|
30
|
+
},
|
|
31
|
+
service: { label: "services", reason: "unmodeled", detail: "services are not modeled by this SDK" },
|
|
32
|
+
branch: { label: "branches", reason: "server-managed", detail: "branches are instance state, not workspace source" }
|
|
33
|
+
};
|
|
34
|
+
var WORKSPACE_OMITTED_KEYS = {
|
|
35
|
+
// --- private key material ---
|
|
36
|
+
iv: { label: "encryption material", reason: "secret", detail: "instance crypto material" },
|
|
37
|
+
salt: { label: "encryption salt", reason: "secret", detail: "instance crypto material" },
|
|
38
|
+
secret: { label: "encryption secret", reason: "secret", detail: "instance crypto material" },
|
|
39
|
+
crypto: { label: "encryption keys", reason: "secret", detail: "instance crypto material" },
|
|
40
|
+
mesh0: { label: "integration API keys", reason: "secret", detail: "integration API keys" },
|
|
41
|
+
git: { label: "git integration keys", reason: "secret", detail: "integration deploy keys" },
|
|
42
|
+
// --- assigned and owned by the instance ---
|
|
43
|
+
id: { label: "workspace id", reason: "server-managed", detail: "instance-assigned workspace id" },
|
|
44
|
+
guid: {
|
|
45
|
+
label: "workspace guid",
|
|
46
|
+
reason: "server-managed",
|
|
47
|
+
derived: true,
|
|
48
|
+
detail: "instance-assigned workspace guid; the generated tree re-derives its own from the workspace name rather than carrying it"
|
|
49
|
+
},
|
|
50
|
+
checksum: { label: "checksum", reason: "server-managed", detail: "derived by the engine on save" },
|
|
51
|
+
created_at: { label: "created time", reason: "server-managed", detail: "engine timestamp" },
|
|
52
|
+
updated_at: { label: "updated time", reason: "server-managed", detail: "engine timestamp" },
|
|
53
|
+
deleted_at: { label: "deleted time", reason: "server-managed", detail: "engine timestamp" },
|
|
54
|
+
domain_prefix: {
|
|
55
|
+
label: "routing prefix",
|
|
56
|
+
reason: "server-managed",
|
|
57
|
+
detail: "instance-assigned routing prefix; redeploying it to another tenant would claim its hostnames"
|
|
58
|
+
},
|
|
59
|
+
branch: { label: "current branch", reason: "server-managed", detail: "current-branch pointer, instance state" },
|
|
60
|
+
release: { label: "current release", reason: "server-managed", detail: "release pointer, instance state" },
|
|
61
|
+
user: { label: "owning user", reason: "server-managed", detail: "owning-user record" },
|
|
62
|
+
usage: { label: "usage counters", reason: "server-managed", detail: "usage counters, instance state" },
|
|
63
|
+
features: { label: "feature flags", reason: "server-managed", detail: "instance feature flags" },
|
|
64
|
+
installed_services: { label: "installed services", reason: "server-managed", detail: "per-branch installed service ids" },
|
|
65
|
+
provision: { label: "provisioning state", reason: "server-managed", detail: "provisioning progress, instance state" },
|
|
66
|
+
well_known: { label: "well-known records", reason: "server-managed", detail: "well-known hosting records, instance state" },
|
|
67
|
+
tailor_experience: { label: "onboarding answers", reason: "server-managed", detail: "onboarding survey answers" },
|
|
68
|
+
require_setup: { label: "setup state", reason: "server-managed", detail: "onboarding state" },
|
|
69
|
+
disabled: { label: "disable flag", reason: "server-managed", detail: "instance-level workspace disable flag" },
|
|
70
|
+
jumpstart: { label: "starter state", reason: "server-managed", detail: "onboarding state" },
|
|
71
|
+
sql_schema_name: { label: "database schema name", reason: "server-managed", detail: "physical schema name, instance-assigned" },
|
|
72
|
+
connect: { label: "connection state", reason: "server-managed", detail: "third-party connection state" },
|
|
73
|
+
// --- carried elsewhere in the bundle ---
|
|
74
|
+
env: {
|
|
75
|
+
label: "env vars",
|
|
76
|
+
reason: "relocated",
|
|
77
|
+
emptied: true,
|
|
78
|
+
detail: "workspace env vars are carried in the bundle's own env set, where the import reads them; they are verified there"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var WORKSPACE_DEFAULTED_KEYS = {
|
|
82
|
+
use_custom_names: (v) => v === false,
|
|
83
|
+
// The two blocks the wipe was expressible through. Omitting either emits
|
|
84
|
+
// no key, so both need recognising here for the same reason the four below do:
|
|
85
|
+
// the engine materializes them on save, so a stored default is ten lines
|
|
86
|
+
// nobody wrote — and verification reads this table, so a tree that leaves the
|
|
87
|
+
// default behind compares equal rather than reporting a loss.
|
|
88
|
+
documentation: isDefaultDocumentation,
|
|
89
|
+
realtime: isDefaultLegacyRealtime,
|
|
90
|
+
defaults: (v) => isRecord(v) && Object.keys(v).length === 1 && v.db_primary_key === "int",
|
|
91
|
+
datasources: (v) => Array.isArray(v) && v.length === 0,
|
|
92
|
+
datasource_live: (v) => isRecord(v) && Object.keys(v).length === 2 && v.color === "#008000" && v.show_banner === false,
|
|
93
|
+
middleware: (v) => isRecord(v) && Object.values(v).every((list) => Array.isArray(list) && list.length === 0),
|
|
94
|
+
history: isDefaultWorkspaceHistory
|
|
95
|
+
};
|
|
96
|
+
function isDefaultDocumentation(value) {
|
|
97
|
+
return matchesDefault(value, DEFAULT_DOCUMENTATION, { whitelist: isEmptyWhitelist });
|
|
98
|
+
}
|
|
99
|
+
function isEmptyWhitelist(value) {
|
|
100
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
101
|
+
return isRecord(value) && Object.keys(value).length === 0;
|
|
102
|
+
}
|
|
103
|
+
function isDefaultLegacyRealtime(value) {
|
|
104
|
+
return matchesDefault(value, LEGACY_REALTIME, {
|
|
105
|
+
channels: (v) => Array.isArray(v) && v.length === 0
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function matchesDefault(value, defaults, loose = {}) {
|
|
109
|
+
if (!isRecord(value)) return false;
|
|
110
|
+
return Object.entries(value).every(([key, member]) => {
|
|
111
|
+
if (!Object.hasOwn(defaults, key)) return false;
|
|
112
|
+
const predicate = Object.hasOwn(loose, key) ? loose[key] : void 0;
|
|
113
|
+
return predicate ? predicate(member) : deepEqualDefault(member, defaults[key]);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function deepEqualDefault(a, b) {
|
|
117
|
+
if (a === b) return true;
|
|
118
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
119
|
+
return a.length === b.length && a.every((item, i) => deepEqualDefault(item, b[i]));
|
|
120
|
+
}
|
|
121
|
+
if (!isRecord(a) || !isRecord(b)) return false;
|
|
122
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
123
|
+
return [...keys].every((k) => deepEqualDefault(a[k], b[k]));
|
|
124
|
+
}
|
|
125
|
+
function isRecord(value) {
|
|
126
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
127
|
+
}
|
|
128
|
+
function subtractDefaults(value, fallback) {
|
|
129
|
+
if (deepEqualDefault(value, fallback)) return void 0;
|
|
130
|
+
if (!isRecord(value) || !isRecord(fallback)) return value;
|
|
131
|
+
const out = {};
|
|
132
|
+
for (const [key, member] of Object.entries(value)) {
|
|
133
|
+
const kept = Object.hasOwn(fallback, key) ? subtractDefaults(member, fallback[key]) : member;
|
|
134
|
+
if (kept !== void 0) out[key] = kept;
|
|
135
|
+
}
|
|
136
|
+
return Object.keys(out).length === 0 ? void 0 : out;
|
|
137
|
+
}
|
|
138
|
+
var HISTORY_DEFAULT_OFF = /* @__PURE__ */ new Set(["function", "middleware", "trigger", "message"]);
|
|
139
|
+
function isDefaultWorkspaceHistory(value) {
|
|
140
|
+
if (!isRecord(value)) return false;
|
|
141
|
+
return Object.entries(value).every(([key, member]) => {
|
|
142
|
+
const enabled = key.endsWith("_enabled");
|
|
143
|
+
if (!enabled && !key.endsWith("_limit")) return false;
|
|
144
|
+
const type = key.slice(0, key.lastIndexOf("_"));
|
|
145
|
+
return enabled ? member === !HISTORY_DEFAULT_OFF.has(type) : member === 100;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function isWorkspaceKeyAtDefault(key, value) {
|
|
149
|
+
const predicate = Object.hasOwn(WORKSPACE_DEFAULTED_KEYS, key) ? WORKSPACE_DEFAULTED_KEYS[key] : void 0;
|
|
150
|
+
return predicate !== void 0 && predicate(value);
|
|
151
|
+
}
|
|
152
|
+
function sectionOmission(key) {
|
|
153
|
+
return Object.hasOwn(UNSUPPORTED_SECTIONS, key) ? UNSUPPORTED_SECTIONS[key] : void 0;
|
|
154
|
+
}
|
|
155
|
+
function workspaceKeyOmission(key) {
|
|
156
|
+
return Object.hasOwn(WORKSPACE_OMITTED_KEYS, key) ? WORKSPACE_OMITTED_KEYS[key] : void 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// src/codegen/labels.ts
|
|
160
|
+
var NOUNS = {
|
|
161
|
+
query: ["query", "queries"],
|
|
162
|
+
env: ["env var", "env vars"],
|
|
163
|
+
knowledge: ["knowledge item", "knowledge items"],
|
|
164
|
+
knowledge_file: ["knowledge file", "knowledge files"],
|
|
165
|
+
addon: ["addon", "addons"]
|
|
166
|
+
};
|
|
167
|
+
function countOf(n, singular, plural = `${singular}s`) {
|
|
168
|
+
return `${n} ${n === 1 ? singular : plural}`;
|
|
169
|
+
}
|
|
170
|
+
function decodedCounts(payload) {
|
|
171
|
+
const out = [];
|
|
172
|
+
for (const [key, section] of Object.entries(payload)) {
|
|
173
|
+
if (!Array.isArray(section) || section.length === 0) continue;
|
|
174
|
+
if (key === "toolset") {
|
|
175
|
+
const agents = section.filter((r) => r?.type === "agent").length;
|
|
176
|
+
if (agents > 0) out.push(["agent", countOf(agents, "agent")]);
|
|
177
|
+
if (section.length - agents > 0) out.push(["mcpServer", countOf(section.length - agents, "mcpServer")]);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const policy = sectionOmission(key);
|
|
181
|
+
if (policy !== void 0) {
|
|
182
|
+
out.push([policy.label, `${section.length} ${policy.label}`]);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const noun = Object.hasOwn(NOUNS, key) ? NOUNS[key] : void 0;
|
|
186
|
+
const kind = sdkKindName(key);
|
|
187
|
+
out.push([kind, noun !== void 0 ? countOf(section.length, noun[0], noun[1]) : countOf(section.length, kind)]);
|
|
188
|
+
}
|
|
189
|
+
return out.sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0).map(([, phrase]) => phrase);
|
|
190
|
+
}
|
|
191
|
+
var repeatedNames = /* @__PURE__ */ new WeakMap();
|
|
192
|
+
function identityName(payload, payloadKey, stored) {
|
|
193
|
+
if (payloadKey === "knowledge_file") return knowledgeFileName(payload, stored);
|
|
194
|
+
const name = String(stored?.name ?? "");
|
|
195
|
+
let repeats = repeatedNames.get(payload);
|
|
196
|
+
if (repeats === void 0) {
|
|
197
|
+
repeats = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const [key, section] of Object.entries(payload)) {
|
|
199
|
+
if (!Array.isArray(section)) continue;
|
|
200
|
+
const seen = /* @__PURE__ */ new Set();
|
|
201
|
+
const twice = /* @__PURE__ */ new Set();
|
|
202
|
+
for (const row of section) {
|
|
203
|
+
const n = String(row?.name ?? "");
|
|
204
|
+
if (seen.has(n)) twice.add(n);
|
|
205
|
+
seen.add(n);
|
|
206
|
+
}
|
|
207
|
+
repeats.set(key, twice);
|
|
208
|
+
}
|
|
209
|
+
repeatedNames.set(payload, repeats);
|
|
210
|
+
}
|
|
211
|
+
if (!repeats.get(payloadKey)?.has(name)) return name;
|
|
212
|
+
return lockNameForObject(payloadKey, stored, identityNamesByGuid(payload));
|
|
213
|
+
}
|
|
214
|
+
function knowledgeFileName(payload, stored) {
|
|
215
|
+
const { path, knowledge } = stored ?? {};
|
|
216
|
+
const items = Array.isArray(payload.knowledge) ? payload.knowledge : [];
|
|
217
|
+
const item = items.find((k) => k?.guid === knowledge?.id);
|
|
218
|
+
const rel = String(path ?? "").replace(/^knowledge-refs\/[^/]+\//, "");
|
|
219
|
+
return item?.name === void 0 ? rel : `${String(item.name)}/${rel}`;
|
|
220
|
+
}
|
|
221
|
+
var WORKSPACE_SETTINGS = "workspace settings";
|
|
222
|
+
function reportObjectLabel(payloadKey, name) {
|
|
223
|
+
if (payloadKey === "workspace") {
|
|
224
|
+
const policy = workspaceKeyOmission(name);
|
|
225
|
+
return `${WORKSPACE_SETTINGS} (${policy?.label ?? name})`;
|
|
226
|
+
}
|
|
227
|
+
const section = sectionOmission(payloadKey);
|
|
228
|
+
if (section !== void 0) return `${section.label}: ${name}`;
|
|
229
|
+
return `${sdkKindName(payloadKey)}:${name}`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export {
|
|
233
|
+
omissionSeverity,
|
|
234
|
+
UNSUPPORTED_SECTIONS,
|
|
235
|
+
subtractDefaults,
|
|
236
|
+
isWorkspaceKeyAtDefault,
|
|
237
|
+
sectionOmission,
|
|
238
|
+
workspaceKeyOmission,
|
|
239
|
+
decodedCounts,
|
|
240
|
+
identityName,
|
|
241
|
+
reportObjectLabel
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=chunk-HRVBLCVJ.js.map
|