@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,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveProjectEntry
|
|
3
|
+
} from "./chunk-AOSYVMUS.js";
|
|
4
|
+
import {
|
|
5
|
+
isUnusablePin,
|
|
6
|
+
readPin,
|
|
7
|
+
writePin
|
|
8
|
+
} from "./chunk-6ELFRN3P.js";
|
|
9
|
+
import {
|
|
10
|
+
ENGINE_RELEASES_URL_ENV,
|
|
11
|
+
EngineReleaseNotFoundError,
|
|
12
|
+
usesCustomReleaseManager
|
|
13
|
+
} from "./chunk-APWXY5SL.js";
|
|
14
|
+
import {
|
|
15
|
+
LOCAL_ENGINE_OVERRIDE_ENV,
|
|
16
|
+
engineOverrideFromEnv,
|
|
17
|
+
resolveEnginePlatform,
|
|
18
|
+
resolveEngineSource
|
|
19
|
+
} from "./chunk-AM4FKL4J.js";
|
|
20
|
+
import {
|
|
21
|
+
ORIGIN_READ_ONLY_BY_REFRESH
|
|
22
|
+
} from "./chunk-NAQDMEHV.js";
|
|
23
|
+
import {
|
|
24
|
+
UsageError,
|
|
25
|
+
info,
|
|
26
|
+
warn
|
|
27
|
+
} from "./chunk-PTHVMXZI.js";
|
|
28
|
+
|
|
29
|
+
// src/emit/local-engine-choice.ts
|
|
30
|
+
function refuseCredentialFlagsForLocal(args, kinds) {
|
|
31
|
+
if (kinds.some((k) => k !== "local-engine")) return;
|
|
32
|
+
const why = "and a local engine takes none \u2014 it is reached with the engine's own bearer.";
|
|
33
|
+
const or = "or deploy from a hosted backend that reads it.";
|
|
34
|
+
const refuse = (message) => {
|
|
35
|
+
throw new UsageError(message, { hintFor: { command: "deploy" } });
|
|
36
|
+
};
|
|
37
|
+
if (args.authFile !== void 0) {
|
|
38
|
+
refuse(`\`--config ${args.authFile}\` names a Xano credential file, ${why} Drop \`--config\`, ${or}`);
|
|
39
|
+
}
|
|
40
|
+
if (args.local === true) {
|
|
41
|
+
refuse(`\`--local\` selects the project-local Xano credential file, ${why} Drop \`--local\`, ${or}`);
|
|
42
|
+
}
|
|
43
|
+
if (args.authHost !== void 0) {
|
|
44
|
+
refuse(`\`--origin\` names a Xano sign-in server, ${why} ${ORIGIN_READ_ONLY_BY_REFRESH}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function chooseLocalEngine(flagValue, dir, machineOutput) {
|
|
48
|
+
if (flagValue !== void 0 && flagValue !== "") {
|
|
49
|
+
const source = resolveEngineSource(flagValue);
|
|
50
|
+
announceOverride(source, "--local-engine", "run `--local-engine` bare to go back to it");
|
|
51
|
+
return { source, pinWrite: void 0, pin: "none", override: "flag" };
|
|
52
|
+
}
|
|
53
|
+
const fromEnv = engineOverrideFromEnv();
|
|
54
|
+
if (fromEnv !== void 0) {
|
|
55
|
+
announceOverride(fromEnv, LOCAL_ENGINE_OVERRIDE_ENV, "unset the variable to go back to it");
|
|
56
|
+
return { source: fromEnv, pinWrite: void 0, pin: "none", override: "env" };
|
|
57
|
+
}
|
|
58
|
+
if (usesCustomReleaseManager()) {
|
|
59
|
+
info(
|
|
60
|
+
`Running the latest engine from ${ENGINE_RELEASES_URL_ENV} instead of this project's pinned engine, downloaded fresh each deploy. The pin is left as is; unset the variable to go back to it.`
|
|
61
|
+
);
|
|
62
|
+
return { source: resolveEngineSource(void 0), pinWrite: void 0, pin: "none", override: "releases-url" };
|
|
63
|
+
}
|
|
64
|
+
const pin = readPin(dir, {
|
|
65
|
+
warn: (message) => warn(
|
|
66
|
+
`${message} This deploy runs the latest local engine and the field is left as written \u2014 set it to a version like "v0.1.5", or run \`xanosdk local-engine update\` to pin one.`,
|
|
67
|
+
"local-engine.version-invalid"
|
|
68
|
+
)
|
|
69
|
+
});
|
|
70
|
+
if (isUnusablePin(pin)) {
|
|
71
|
+
return { source: resolveEngineSource(void 0), pinWrite: void 0, pin: "unchanged" };
|
|
72
|
+
}
|
|
73
|
+
if (pin === void 0 && resolveProjectEntry(dir) === void 0) {
|
|
74
|
+
warn(
|
|
75
|
+
`No package.json in ${dir}, and it is not a Xano SDK project, so the local engine was not pinned \u2014 this deploy runs the latest engine.`,
|
|
76
|
+
"local-engine.not-pinned"
|
|
77
|
+
);
|
|
78
|
+
return { source: resolveEngineSource(void 0), pinWrite: void 0, pin: "none" };
|
|
79
|
+
}
|
|
80
|
+
if (pin === null || pin === void 0) {
|
|
81
|
+
return { source: resolveEngineSource(void 0), pinWrite: "create", pin: "none" };
|
|
82
|
+
}
|
|
83
|
+
const keep = {
|
|
84
|
+
source: resolveEngineSource(void 0, process.env, pin),
|
|
85
|
+
pinWrite: void 0,
|
|
86
|
+
pin: "unchanged"
|
|
87
|
+
};
|
|
88
|
+
const platform = resolveEnginePlatform();
|
|
89
|
+
if (platform === void 0) return keep;
|
|
90
|
+
const check = await import("./local-engine-update-check-6L645VBL.js");
|
|
91
|
+
const latest = await check.latestKnownVersion({ platform });
|
|
92
|
+
if (latest === void 0) return keep;
|
|
93
|
+
const decision = check.decideUpdate({
|
|
94
|
+
pin,
|
|
95
|
+
latest,
|
|
96
|
+
interactive: check.isInteractive({ machineOutput }),
|
|
97
|
+
declined: check.declinedVersion(dir)
|
|
98
|
+
});
|
|
99
|
+
if (decision === "keep") return keep;
|
|
100
|
+
if (decision === "notify") {
|
|
101
|
+
info(check.updateNoticeText(pin, latest));
|
|
102
|
+
return keep;
|
|
103
|
+
}
|
|
104
|
+
const { confirm } = await import("./prompt-II3F3LND.js");
|
|
105
|
+
const yes = await confirm(check.updatePromptText(pin, latest), {
|
|
106
|
+
flag: "`xanosdk local-engine update`",
|
|
107
|
+
refusal: { details: { updated: false }, rerun: "xanosdk local-engine update" }
|
|
108
|
+
});
|
|
109
|
+
if (!yes) {
|
|
110
|
+
check.recordDeclined(dir, latest);
|
|
111
|
+
return keep;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
source: resolveEngineSource(void 0, process.env, latest),
|
|
115
|
+
pinWrite: "move",
|
|
116
|
+
pin: "unchanged"
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function announceOverride(source, from, back) {
|
|
120
|
+
const what = source.kind === "release" ? `engine ${source.version ?? "latest"}` : /^https?:\/\//i.test(source.source) ? "the engine at the URL" : `the engine archive ${source.source}`;
|
|
121
|
+
info(`Running ${what} from ${from} instead of this project's pinned engine. The pin is left as is; ${back}.`);
|
|
122
|
+
}
|
|
123
|
+
function explainOverrideFailure(choice, err) {
|
|
124
|
+
const override = choice.override;
|
|
125
|
+
const message = err instanceof Error ? err.message : void 0;
|
|
126
|
+
const missing = err instanceof EngineReleaseNotFoundError || (message?.includes("has no archive for") ?? false);
|
|
127
|
+
if (override !== "flag" && override !== "env" || message === void 0 || !missing) throw err;
|
|
128
|
+
const what = message.split("\n")[0];
|
|
129
|
+
const remedy = override === "flag" ? "Check the version, or drop it: `xanosdk deploy --local-engine` (bare) runs this project's pinned engine, and `xanosdk local-engine update` moves that pin to the latest release." : `Check ${LOCAL_ENGINE_OVERRIDE_ENV}, or unset it to run this project's pinned engine.`;
|
|
130
|
+
const text = `${what}
|
|
131
|
+
${remedy}`;
|
|
132
|
+
throw err instanceof EngineReleaseNotFoundError ? new EngineReleaseNotFoundError(text, { cause: err }) : new Error(text, { cause: err });
|
|
133
|
+
}
|
|
134
|
+
function pinAfterAcquire(choice, dir) {
|
|
135
|
+
let outcome = choice.pin;
|
|
136
|
+
let written;
|
|
137
|
+
let failure;
|
|
138
|
+
return {
|
|
139
|
+
onAcquired: (acquired) => {
|
|
140
|
+
if (choice.pinWrite === void 0 || acquired.version === void 0) return;
|
|
141
|
+
try {
|
|
142
|
+
const result = writePin(dir, acquired.version);
|
|
143
|
+
outcome = choice.pinWrite === "create" ? "created" : "moved";
|
|
144
|
+
written = { path: result.path, version: acquired.version, created: result.created };
|
|
145
|
+
} catch (err) {
|
|
146
|
+
failure = err.message;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
outcome: () => outcome,
|
|
150
|
+
announce: () => announceLocalEnginePin({ choice, written, failure })
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function announceLocalEnginePin(ctx) {
|
|
154
|
+
const { choice, written, failure } = ctx;
|
|
155
|
+
if (written !== void 0) {
|
|
156
|
+
info(pinWrittenText({ ...written, moved: choice.pinWrite === "move" }));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (failure !== void 0) warn(`The local engine version was not pinned: ${failure}`, "local-engine.not-pinned");
|
|
160
|
+
}
|
|
161
|
+
function pinWrittenText(written) {
|
|
162
|
+
const what = written.created ? `Created ${written.path} to pin local engine ${written.version}` : `${written.moved ? "Moved the local engine pin to" : "Pinned local engine"} ${written.version} in ${written.path}`;
|
|
163
|
+
return `${what} \u2014 commit it so everyone on this project runs the same engine.`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
refuseCredentialFlagsForLocal,
|
|
168
|
+
chooseLocalEngine,
|
|
169
|
+
explainOverrideFailure,
|
|
170
|
+
pinAfterAcquire,
|
|
171
|
+
pinWrittenText
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=chunk-SFLHVCKX.js.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BARE,
|
|
3
|
+
COMMANDS,
|
|
4
|
+
UsageError,
|
|
5
|
+
getCommand,
|
|
6
|
+
getSubcommand,
|
|
7
|
+
isKindShaped,
|
|
8
|
+
parseSource,
|
|
9
|
+
sourceSpellings
|
|
10
|
+
} from "./chunk-PTHVMXZI.js";
|
|
11
|
+
|
|
12
|
+
// src/emit/backend-slot.ts
|
|
13
|
+
function commandPath(command, subcommand) {
|
|
14
|
+
return subcommand === void 0 ? command : `${command} ${subcommand}`;
|
|
15
|
+
}
|
|
16
|
+
function slotsOf(command, subcommand, spec) {
|
|
17
|
+
const out = [];
|
|
18
|
+
const at = subcommand === void 0 ? { command } : { command, subcommand };
|
|
19
|
+
for (const arg of spec.args ?? []) {
|
|
20
|
+
if (arg.selector !== void 0) out.push({ ...at, spelling: `<${arg.name}>`, selector: arg.selector });
|
|
21
|
+
}
|
|
22
|
+
for (const ref of spec.flags ?? []) {
|
|
23
|
+
if (typeof ref === "string" || ref.selector === void 0) continue;
|
|
24
|
+
out.push({ ...at, spelling: `--${ref.key}`, flag: ref.key, selector: ref.selector });
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
function allBackendSlots() {
|
|
29
|
+
const out = [];
|
|
30
|
+
for (const [name, raw] of Object.entries(COMMANDS)) {
|
|
31
|
+
const spec = raw;
|
|
32
|
+
out.push(...slotsOf(name, void 0, spec));
|
|
33
|
+
for (const [verb, sub] of Object.entries(spec.subcommands ?? {})) out.push(...slotsOf(name, verb, sub));
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
function backendSlot(command, subcommand, role) {
|
|
38
|
+
const spec = subcommand === void 0 ? getCommand(command) : getSubcommand(command, subcommand);
|
|
39
|
+
if (spec === void 0) return void 0;
|
|
40
|
+
return slotsOf(command, subcommand, spec).find((s) => s.selector.role === role);
|
|
41
|
+
}
|
|
42
|
+
function backendSlotForFlag(command, subcommand, key) {
|
|
43
|
+
if (command === void 0) return void 0;
|
|
44
|
+
const spec = subcommand === void 0 ? getCommand(command) : getSubcommand(command, subcommand);
|
|
45
|
+
if (spec === void 0) return void 0;
|
|
46
|
+
return slotsOf(command, subcommand, spec).find((s) => s.flag === key);
|
|
47
|
+
}
|
|
48
|
+
function requireBackendSlot(command, subcommand, role) {
|
|
49
|
+
const slot = backendSlot(command, subcommand, role);
|
|
50
|
+
if (slot === void 0) {
|
|
51
|
+
throw new Error(`\`${commandPath(command, subcommand)}\` declares no \`${role}\` selector slot in commands.ts.`);
|
|
52
|
+
}
|
|
53
|
+
return slot;
|
|
54
|
+
}
|
|
55
|
+
var ROLE_NOUN = {
|
|
56
|
+
from: "a source",
|
|
57
|
+
to: "a destination",
|
|
58
|
+
on: "a backend",
|
|
59
|
+
subject: "a backend"
|
|
60
|
+
};
|
|
61
|
+
var KIND_PHRASE = {
|
|
62
|
+
workspace: "the workspace",
|
|
63
|
+
ephemeral: "an ephemeral",
|
|
64
|
+
"local-engine": "a local engine",
|
|
65
|
+
tenant: "a tenant",
|
|
66
|
+
release: "a release",
|
|
67
|
+
file: "a bundle file"
|
|
68
|
+
};
|
|
69
|
+
function helpFor(slot) {
|
|
70
|
+
return slot.subcommand === void 0 ? { command: slot.command } : { command: slot.command, subcommand: slot.subcommand };
|
|
71
|
+
}
|
|
72
|
+
function slotValueMissing(slot) {
|
|
73
|
+
const accepted = `${ROLE_NOUN[slot.selector.role]}: ${sourceSpellings(slot.selector.accepted)}`;
|
|
74
|
+
if (!slot.spelling.startsWith("--")) {
|
|
75
|
+
return new UsageError(
|
|
76
|
+
`\`xanosdk ${commandPath(slot.command, slot.subcommand)}\`: missing required ${slot.spelling} \u2014 ${accepted}.`,
|
|
77
|
+
{ helpFor: helpFor(slot) }
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return new UsageError(`${slot.spelling} expects ${accepted}.`, { helpFor: helpFor(slot) });
|
|
81
|
+
}
|
|
82
|
+
function kindOf(raw) {
|
|
83
|
+
if (isKindShaped(raw)) return raw.slice(0, raw.indexOf(":"));
|
|
84
|
+
return BARE.includes(raw) ? raw : void 0;
|
|
85
|
+
}
|
|
86
|
+
function exampleOf(slot) {
|
|
87
|
+
if (!slot.spelling.startsWith("--")) return "";
|
|
88
|
+
const pick = slot.selector.accepted.includes("ephemeral") ? "ephemeral" : slot.selector.accepted.find((k) => slot.selector.refused?.[k] === void 0 && k !== "file");
|
|
89
|
+
return pick === void 0 ? "" : `, for example \`${slot.spelling} ${pick}\``;
|
|
90
|
+
}
|
|
91
|
+
function refusedKind(slot, kind, origin) {
|
|
92
|
+
const declared = slot.selector.refused?.[kind];
|
|
93
|
+
if (declared === void 0) return void 0;
|
|
94
|
+
const typedName = origin === "tracked" ? "" : origin.typed.includes(":") ? origin.typed.slice(origin.typed.indexOf(":") + 1).trim() : origin.name ?? "";
|
|
95
|
+
const reason = typedName === "" ? declared : declared.split(`<${kind} name>`).join(typedName);
|
|
96
|
+
const path = commandPath(slot.command, slot.subcommand);
|
|
97
|
+
const accepted = sourceSpellings(slot.selector.accepted);
|
|
98
|
+
const plural = SELECTOR_NOUN[slot.selector.role].plural;
|
|
99
|
+
const lead = origin === "tracked" ? `This project last deployed to ${KIND_PHRASE[kind]}, which \`xanosdk ${path}\` cannot serve: ${reason}. Name another with \`${slot.spelling}\`${exampleOf(slot)}. ${plural} are ${accepted}.` : `"${origin.typed}" names ${KIND_PHRASE[kind]}, which \`xanosdk ${path}\` cannot serve: ${reason}. ${plural} are ${accepted}.`;
|
|
100
|
+
return new UsageError(lead, { hintFor: helpFor(slot) });
|
|
101
|
+
}
|
|
102
|
+
function parseSlot(slot, raw, name) {
|
|
103
|
+
const kind = kindOf(raw);
|
|
104
|
+
if (kind !== void 0) {
|
|
105
|
+
const refusal = refusedKind(slot, kind, name === void 0 ? { typed: raw } : { typed: raw, name });
|
|
106
|
+
if (refusal !== void 0) throw refusal;
|
|
107
|
+
}
|
|
108
|
+
return parseSource(raw, slot.selector.accepted, helpFor(slot), SELECTOR_NOUN[slot.selector.role]);
|
|
109
|
+
}
|
|
110
|
+
var SELECTOR_NOUN = {
|
|
111
|
+
from: { singular: "source", plural: "Sources" },
|
|
112
|
+
to: { singular: "destination", plural: "Destinations" },
|
|
113
|
+
on: { singular: "backend", plural: "Backends" },
|
|
114
|
+
subject: { singular: "backend", plural: "Backends" }
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
commandPath,
|
|
119
|
+
allBackendSlots,
|
|
120
|
+
backendSlot,
|
|
121
|
+
backendSlotForFlag,
|
|
122
|
+
requireBackendSlot,
|
|
123
|
+
slotValueMissing,
|
|
124
|
+
refusedKind,
|
|
125
|
+
parseSlot
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=chunk-STSFNCY4.js.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
environmentKey,
|
|
3
|
+
getEnvironment,
|
|
4
|
+
readEphemeralState
|
|
5
|
+
} from "./chunk-5QU2P5CA.js";
|
|
6
|
+
import {
|
|
7
|
+
andList
|
|
8
|
+
} from "./chunk-622HUCZT.js";
|
|
9
|
+
import {
|
|
10
|
+
ENV_CREDENTIAL_VARS,
|
|
11
|
+
contextFlags,
|
|
12
|
+
credentialFileFlagFor,
|
|
13
|
+
credentialFileOf,
|
|
14
|
+
recordedByEnvCredential
|
|
15
|
+
} from "./chunk-NAQDMEHV.js";
|
|
16
|
+
import {
|
|
17
|
+
loginCommand,
|
|
18
|
+
profileAddCommand,
|
|
19
|
+
recordedCredentialPath,
|
|
20
|
+
recordedProfileStored
|
|
21
|
+
} from "./chunk-XW6KISBB.js";
|
|
22
|
+
import {
|
|
23
|
+
findPointerFile,
|
|
24
|
+
readPointerFile
|
|
25
|
+
} from "./chunk-5FBYXK5P.js";
|
|
26
|
+
import {
|
|
27
|
+
DEFAULT_PROFILE
|
|
28
|
+
} from "./chunk-QXTKSOFI.js";
|
|
29
|
+
import {
|
|
30
|
+
readEnvVar
|
|
31
|
+
} from "./chunk-X2NL4KUO.js";
|
|
32
|
+
import {
|
|
33
|
+
CliError,
|
|
34
|
+
EXIT_SOURCE_UNRESOLVABLE,
|
|
35
|
+
UsageError
|
|
36
|
+
} from "./chunk-PTHVMXZI.js";
|
|
37
|
+
|
|
38
|
+
// src/emit/env-target.ts
|
|
39
|
+
var ENV_CREDENTIAL_NAMES = ["XANO_INSTANCE_URL", "XANO_WORKSPACE_ID", "XANO_META_TOKEN", "XANO_REFRESH_TOKEN", "XANO_CLIENT_ID"];
|
|
40
|
+
function projectPin() {
|
|
41
|
+
try {
|
|
42
|
+
const file = findPointerFile(process.cwd());
|
|
43
|
+
return file === void 0 ? void 0 : readPointerFile(file);
|
|
44
|
+
} catch {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function resolveEphemeralName(auth, name, cwd = process.cwd()) {
|
|
49
|
+
const state = readEphemeralState(cwd);
|
|
50
|
+
const tracked = getEnvironment(state, auth)?.name;
|
|
51
|
+
const resolved = name ?? tracked;
|
|
52
|
+
if (resolved === void 0 || resolved === "") {
|
|
53
|
+
const other = otherCredentialRefusal(
|
|
54
|
+
state,
|
|
55
|
+
auth,
|
|
56
|
+
`or name one with \`ephemeral:<name>\` (\`xanosdk ephemeral list${contextFlags()}\` shows them)`
|
|
57
|
+
);
|
|
58
|
+
if (other !== void 0) throw await reachableFirst(other, auth);
|
|
59
|
+
throw new CliError(
|
|
60
|
+
"SDK_ERROR",
|
|
61
|
+
`No ephemeral environment to target. Name one with \`ephemeral:<name>\` (\`xanosdk ephemeral list${contextFlags()}\` shows the ones that exist), or run \`xanosdk deploy${contextFlags()}\` first \u2014 this project then remembers the env it deployed to, which is what bare \`ephemeral\` reads.`,
|
|
62
|
+
{ exitCode: EXIT_SOURCE_UNRESOLVABLE }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return resolved;
|
|
66
|
+
}
|
|
67
|
+
function otherCredentialRefusal(state, scope, tail, opts = {}) {
|
|
68
|
+
const mine = environmentKey(scope);
|
|
69
|
+
const others = Object.keys(state.environments).filter((k) => k !== mine && k !== String(scope.workspaceId));
|
|
70
|
+
if (others.length === 0) return void 0;
|
|
71
|
+
const workspaceOf = (key) => key.slice(key.lastIndexOf("/") + 1);
|
|
72
|
+
const profileOf = (key) => key.includes("/") ? key.slice(0, key.indexOf("/")) : void 0;
|
|
73
|
+
const quoted = (names) => names.map((n) => `"${n}"`).join(", ");
|
|
74
|
+
const fromEnv = scope.profile === void 0;
|
|
75
|
+
const current = scope.profile?.name ?? DEFAULT_PROFILE;
|
|
76
|
+
const envMade = fromEnv ? [] : others.filter((k) => recordedByEnvCredential(state.environments[k]));
|
|
77
|
+
const underOther = others.filter((k) => {
|
|
78
|
+
const p = profileOf(k);
|
|
79
|
+
return p !== void 0 && p !== current && !envMade.includes(k);
|
|
80
|
+
});
|
|
81
|
+
const sameWorkspace = underOther.filter((k) => workspaceOf(k) === String(scope.workspaceId));
|
|
82
|
+
const reachable = sameWorkspace.length > 0 ? sameWorkspace : underOther;
|
|
83
|
+
const profiles = [...new Set(reachable.map((k) => profileOf(k)))];
|
|
84
|
+
const files = [...new Set(reachable.map((k) => state.environments[k]?.credential_file))];
|
|
85
|
+
const runFile = credentialFileOf();
|
|
86
|
+
const known = files.length === 1 ? files[0] : void 0;
|
|
87
|
+
const fileFlag = known !== void 0 && known !== runFile ? credentialFileFlagFor(known) : "";
|
|
88
|
+
const fileNote = known === void 0 && runFile !== void 0 && runFile !== "shared" ? ` (${profiles.length === 1 ? "it" : "they"} may live in another credential file than this run read \u2014 add that file's \`--config <path>\` if so)` : known === "shared" && runFile !== void 0 && runFile !== "shared" ? ` (without \`--config\`/\`--local\`: ${profiles.length === 1 ? "it lives" : "they live"} in this machine's shared credential file)` : "";
|
|
89
|
+
const profileFlag = `${profiles.length === 1 ? `--profile ${profiles[0]}` : "--profile <name>"}${fileFlag}`;
|
|
90
|
+
const goneKey = reachable.length === 1 ? reachable[0] : void 0;
|
|
91
|
+
const goneTarget = {
|
|
92
|
+
path: known !== void 0 ? recordedCredentialPath(known) ?? void 0 : void 0,
|
|
93
|
+
instance: goneKey === void 0 ? void 0 : state.environments[goneKey]?.instance ?? `https://${goneKey.split("/").slice(1, -1).join("/")}`,
|
|
94
|
+
workspaceId: goneKey === void 0 ? void 0 : workspaceOf(goneKey)
|
|
95
|
+
};
|
|
96
|
+
const gone = profiles.length === 1 && known !== void 0 && !recordedProfileStored(profiles[0], known) ? `\`${loginCommand(profiles[0], goneTarget)}\` (OAuth), or \`${profileAddCommand(profiles[0], goneTarget)}\` (meta API token)` : void 0;
|
|
97
|
+
const setVars = ENV_CREDENTIAL_NAMES.filter((v) => readEnvVar(v) !== void 0);
|
|
98
|
+
const pinned = profiles.length === 1 && fileFlag === "" && projectPin() === profiles[0];
|
|
99
|
+
const remedy = fromEnv ? `This run acts as the credential in the environment, which outranks every stored profile \u2014 run without it (unset ${andList(setVars.length > 0 ? setVars : ENV_CREDENTIAL_NAMES.slice(0, 3))}) ` + (gone !== void 0 ? `and add that profile again with ${gone} \u2014 it is no longer stored` : pinned ? `to act as that profile, which this project's xano.profile.json already pins` : `and with \`${profileFlag}\` to act as ${profiles.length === 1 ? "that profile" : "one of them"}${fileNote}`) : gone !== void 0 ? `That profile is no longer stored \u2014 add it again with ${gone}` : `Re-run with \`${profileFlag}\` for that profile${fileNote}`;
|
|
100
|
+
if (sameWorkspace.length > 0) {
|
|
101
|
+
return new UsageError(
|
|
102
|
+
`This project tracks its ephemeral under a different credential profile (${quoted(profiles)}), not the one this command is acting as. ${remedy}, ${tail}.`,
|
|
103
|
+
opts
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (underOther.length > 0) {
|
|
107
|
+
const workspaces2 = [...new Set(underOther.map(workspaceOf))].join(", ");
|
|
108
|
+
return sendsElsewhere(new UsageError(
|
|
109
|
+
`This project tracks its ephemeral under a different credential profile (${quoted(profiles)}) and workspace (${workspaces2}) than the ones this command is acting as (workspace ${scope.workspaceId}). ${remedy}, ${tail}.`,
|
|
110
|
+
opts
|
|
111
|
+
));
|
|
112
|
+
}
|
|
113
|
+
if (envMade.length > 0) {
|
|
114
|
+
const workspaces2 = [...new Set(envMade.map(workspaceOf))].join(", ");
|
|
115
|
+
return sendsElsewhere(new UsageError(
|
|
116
|
+
`This project tracks its ephemeral under the environment credential (workspace ${workspaces2}), not the profile this command is acting as. Set ${ENV_CREDENTIAL_VARS} for that workspace to act as it, ${tail}.`,
|
|
117
|
+
opts
|
|
118
|
+
));
|
|
119
|
+
}
|
|
120
|
+
const here = hostOf(scope.instance);
|
|
121
|
+
const hostOfKey = (key) => {
|
|
122
|
+
const parts = key.split("/");
|
|
123
|
+
return parts.length >= 3 ? parts.slice(1, -1).join("/") : void 0;
|
|
124
|
+
};
|
|
125
|
+
const sameHost = others.filter((k) => (hostOfKey(k) ?? here) === here);
|
|
126
|
+
if (sameHost.length === 0) {
|
|
127
|
+
const hosts = [...new Set(others.map((k) => hostOfKey(k)))].join(", ");
|
|
128
|
+
return new UsageError(
|
|
129
|
+
`No ephemeral is tracked on ${here} \u2014 run \`xanosdk deploy${contextFlags()}\` to create one there, ${tail}. (This project's record is for ${hosts}.)`,
|
|
130
|
+
opts
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const workspaces = [...new Set(sameHost.map(workspaceOf))].join(", ");
|
|
134
|
+
const login = `${current !== DEFAULT_PROFILE ? `xanosdk login -p ${current}` : "xanosdk login"}${credentialFileFlagFor(credentialFileOf() ?? "shared")}`;
|
|
135
|
+
const signIn = fromEnv ? `Point the environment credential at the workspace it belongs to, or run without it and sign in to that workspace` : `Sign in to the workspace it belongs to (\`${login}\`)`;
|
|
136
|
+
return sendsElsewhere(new UsageError(
|
|
137
|
+
`This project tracks its ephemeral under a different workspace than the one you are signed in to on ${here} (workspace ${scope.workspaceId}) \u2014 its record is for workspace ${workspaces}. ${signIn}, ${tail}.`,
|
|
138
|
+
opts
|
|
139
|
+
));
|
|
140
|
+
}
|
|
141
|
+
var SENDS_ELSEWHERE = /* @__PURE__ */ new WeakSet();
|
|
142
|
+
async function reachableFirst(refusal, auth) {
|
|
143
|
+
if (!(refusal instanceof Error) || !SENDS_ELSEWHERE.has(refusal)) return refusal;
|
|
144
|
+
if (auth === void 0 || !("access_token" in auth)) return refusal;
|
|
145
|
+
const { refuseUnreachableWorkspace } = await import("./workspace-binding-56PIIPCP.js");
|
|
146
|
+
try {
|
|
147
|
+
await refuseUnreachableWorkspace(auth);
|
|
148
|
+
} catch (unreachable) {
|
|
149
|
+
return unreachable;
|
|
150
|
+
}
|
|
151
|
+
return refusal;
|
|
152
|
+
}
|
|
153
|
+
function sendsElsewhere(refusal) {
|
|
154
|
+
SENDS_ELSEWHERE.add(refusal);
|
|
155
|
+
return refusal;
|
|
156
|
+
}
|
|
157
|
+
function hostOf(instance) {
|
|
158
|
+
try {
|
|
159
|
+
return new URL(instance).host;
|
|
160
|
+
} catch {
|
|
161
|
+
return instance.replace(/\//g, "_");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
resolveEphemeralName,
|
|
167
|
+
otherCredentialRefusal,
|
|
168
|
+
reachableFirst
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=chunk-SWBF2LTK.js.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
andList
|
|
3
|
+
} from "./chunk-622HUCZT.js";
|
|
4
|
+
import {
|
|
5
|
+
contextFlags,
|
|
6
|
+
isCredentialStoreCommand
|
|
7
|
+
} from "./chunk-NAQDMEHV.js";
|
|
8
|
+
import {
|
|
9
|
+
shellQuote
|
|
10
|
+
} from "./chunk-5ZSO4T2G.js";
|
|
11
|
+
|
|
12
|
+
// src/emit/retry-command.ts
|
|
13
|
+
var CREDENTIAL_VALUE_FLAGS = /* @__PURE__ */ new Set(["--config", "--profile", "-p"]);
|
|
14
|
+
var SECRET_VALUE_FLAGS = /* @__PURE__ */ new Map([
|
|
15
|
+
["--env-var", "key"],
|
|
16
|
+
["--doc-token", "key"],
|
|
17
|
+
["--origin", "whole"]
|
|
18
|
+
]);
|
|
19
|
+
var SECRET_POSITIONALS = /* @__PURE__ */ new Map([
|
|
20
|
+
["env set", { value: 1, name: 0 }]
|
|
21
|
+
]);
|
|
22
|
+
var STDIN_VALUE = "$VALUE";
|
|
23
|
+
var ASSIGNED = /^([A-Za-z_][A-Za-z0-9_]*)=/;
|
|
24
|
+
function secretPositional(args) {
|
|
25
|
+
const spec = SECRET_POSITIONALS.get(`${args.command}${args.subcommand === void 0 ? "" : ` ${args.subcommand}`}`);
|
|
26
|
+
const argv = args.argv;
|
|
27
|
+
if (spec === void 0 || argv === void 0) return void 0;
|
|
28
|
+
const locate = (index) => {
|
|
29
|
+
const word = args.positionals[index];
|
|
30
|
+
if (word === void 0) return void 0;
|
|
31
|
+
if (args.positionalArgv !== void 0) {
|
|
32
|
+
const at = args.positionalArgv[index];
|
|
33
|
+
return at !== void 0 && argv[at] === word ? at : void 0;
|
|
34
|
+
}
|
|
35
|
+
const found = argv.lastIndexOf(word);
|
|
36
|
+
return found === -1 ? void 0 : found;
|
|
37
|
+
};
|
|
38
|
+
const value = locate(spec.value);
|
|
39
|
+
if (value !== void 0) return { at: value };
|
|
40
|
+
const name = locate(spec.name);
|
|
41
|
+
const assigned = name === void 0 ? null : ASSIGNED.exec(argv[name]);
|
|
42
|
+
return name !== void 0 && assigned !== null ? { at: name, keep: assigned[1] } : void 0;
|
|
43
|
+
}
|
|
44
|
+
var CREATE_ONLY_FLAGS = /* @__PURE__ */ new Set(["--expires-hours"]);
|
|
45
|
+
function retryCommand(args, opts = {}) {
|
|
46
|
+
const createOnly = opts.creates === true ? /* @__PURE__ */ new Set() : CREATE_ONLY_FLAGS;
|
|
47
|
+
const flags = contextFlags(args, {
|
|
48
|
+
credentialStore: isCredentialStoreCommand({ command: args.command ?? opts.command?.split(" ")[0] })
|
|
49
|
+
});
|
|
50
|
+
const add = (opts.add ?? []).filter((f) => !(args.argv ?? []).includes(f));
|
|
51
|
+
if (args.argv === void 0) {
|
|
52
|
+
return { command: `xanosdk ${opts.command ?? "deploy"}${add.map((f) => ` ${f}`).join("")}${flags}`, withheld: [] };
|
|
53
|
+
}
|
|
54
|
+
const drop = new Set(opts.drop ?? []);
|
|
55
|
+
const kept = [];
|
|
56
|
+
const withheld = [];
|
|
57
|
+
const secretAt = secretPositional(args);
|
|
58
|
+
for (let i = 0; i < args.argv.length; i++) {
|
|
59
|
+
const token = args.argv[i];
|
|
60
|
+
if (i === secretAt?.at) {
|
|
61
|
+
if (secretAt.keep !== void 0) kept.push(shellQuote(secretAt.keep));
|
|
62
|
+
withheld.push(STDIN_VALUE);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const eq = token.indexOf("=");
|
|
66
|
+
const spelling = token.startsWith("-") && eq !== -1 ? token.slice(0, eq) : token;
|
|
67
|
+
const attached = spelling !== token;
|
|
68
|
+
const secret = SECRET_VALUE_FLAGS.get(spelling);
|
|
69
|
+
if (secret !== void 0) {
|
|
70
|
+
const value = attached ? token.slice(eq + 1) : args.argv[i + 1];
|
|
71
|
+
if (!attached) i += 1;
|
|
72
|
+
const key = secret === "key" && value !== void 0 && value.includes("=") ? value.slice(0, value.indexOf("=")) : void 0;
|
|
73
|
+
withheld.push(key !== void 0 && key !== "" ? `${spelling} ${key}` : spelling);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (CREDENTIAL_VALUE_FLAGS.has(spelling) || createOnly.has(spelling) || drop.has(spelling)) {
|
|
77
|
+
if (!attached && (CREDENTIAL_VALUE_FLAGS.has(spelling) || createOnly.has(spelling))) i += 1;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (token === "--local") continue;
|
|
81
|
+
kept.push(shellQuote(token));
|
|
82
|
+
}
|
|
83
|
+
const stdin = secretAt === void 0 ? "" : `printf %s "${STDIN_VALUE}" | `;
|
|
84
|
+
return { command: `${stdin}xanosdk ${[...kept, ...add].join(" ")}${flags}`, withheld };
|
|
85
|
+
}
|
|
86
|
+
function yesRerun(args, command) {
|
|
87
|
+
const retry = retryCommand(args, { add: ["--yes"], creates: true, command });
|
|
88
|
+
return { rerun: retry.command, note: withheldNote(retry.withheld) };
|
|
89
|
+
}
|
|
90
|
+
function pipedYes(args) {
|
|
91
|
+
return args?.yes === true || process.stdin.isTTY !== true ? " --yes" : "";
|
|
92
|
+
}
|
|
93
|
+
function withheldNote(withheld) {
|
|
94
|
+
const stdin = withheld.includes(STDIN_VALUE) ? ` The value is not reprinted: set \`VALUE\` to it and the command pipes it in, or pass it as the second argument.` : "";
|
|
95
|
+
const flags = withheld.filter((w) => w !== STDIN_VALUE);
|
|
96
|
+
if (flags.length === 0) return stdin;
|
|
97
|
+
const named = andList(flags.map((w) => `\`${w}\``));
|
|
98
|
+
return ` It leaves out ${named}: ${flags.length === 1 ? "its value is" : "their values are"} not reprinted, so pass ${flags.length === 1 ? "it" : "them"} again (or keep env values in the backend's \`.env\` and documentation tokens in its \`.secrets.json\`, which a deploy reads).` + stdin;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
SECRET_POSITIONALS,
|
|
103
|
+
STDIN_VALUE,
|
|
104
|
+
retryCommand,
|
|
105
|
+
yesRerun,
|
|
106
|
+
pipedYes,
|
|
107
|
+
withheldNote
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=chunk-T5KELPAR.js.map
|