@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,766 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pinWrittenText
|
|
3
|
+
} from "./chunk-SFLHVCKX.js";
|
|
4
|
+
import {
|
|
5
|
+
acquireEngine,
|
|
6
|
+
restartMismatchedEngine
|
|
7
|
+
} from "./chunk-XBKMWY7F.js";
|
|
8
|
+
import {
|
|
9
|
+
confirm
|
|
10
|
+
} from "./chunk-65HWOMGV.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveProjectEntry
|
|
13
|
+
} from "./chunk-AOSYVMUS.js";
|
|
14
|
+
import "./chunk-CJHQKJU4.js";
|
|
15
|
+
import "./chunk-3DRXWLJ5.js";
|
|
16
|
+
import "./chunk-X4DVXBFY.js";
|
|
17
|
+
import {
|
|
18
|
+
cachedEngineEntry,
|
|
19
|
+
engineVersion,
|
|
20
|
+
engineVersionToken,
|
|
21
|
+
findOrphanedEngineProcesses,
|
|
22
|
+
listEngines,
|
|
23
|
+
stopAllEngines,
|
|
24
|
+
stopEngineNamed,
|
|
25
|
+
stopOrphanedEngineProcesses
|
|
26
|
+
} from "./chunk-BAUZOWGX.js";
|
|
27
|
+
import {
|
|
28
|
+
diskBytes,
|
|
29
|
+
listLegacyCacheDirs,
|
|
30
|
+
listOverrideEntries,
|
|
31
|
+
listReleaseEntries,
|
|
32
|
+
readEngineEntry,
|
|
33
|
+
readPin,
|
|
34
|
+
writePin
|
|
35
|
+
} from "./chunk-6ELFRN3P.js";
|
|
36
|
+
import "./chunk-NA3PXMEF.js";
|
|
37
|
+
import {
|
|
38
|
+
ENGINE_RELEASES_URL_ENV,
|
|
39
|
+
normalizeEngineVersion,
|
|
40
|
+
resolveEngineRelease,
|
|
41
|
+
usesCustomReleaseManager
|
|
42
|
+
} from "./chunk-APWXY5SL.js";
|
|
43
|
+
import "./chunk-2TFRR6JV.js";
|
|
44
|
+
import "./chunk-LPECSJ2J.js";
|
|
45
|
+
import {
|
|
46
|
+
NO_CREDENTIAL,
|
|
47
|
+
SourceError,
|
|
48
|
+
resolveSource
|
|
49
|
+
} from "./chunk-QCNYHBL7.js";
|
|
50
|
+
import "./chunk-2ZUEE4EK.js";
|
|
51
|
+
import "./chunk-AN6BL47T.js";
|
|
52
|
+
import "./chunk-SWBF2LTK.js";
|
|
53
|
+
import "./chunk-UZ6QQWJT.js";
|
|
54
|
+
import "./chunk-A3UDOZB6.js";
|
|
55
|
+
import "./chunk-2MNLRIOX.js";
|
|
56
|
+
import {
|
|
57
|
+
clearEngineRecordsNamed,
|
|
58
|
+
listEngineRecords
|
|
59
|
+
} from "./chunk-3M4LFYNQ.js";
|
|
60
|
+
import {
|
|
61
|
+
SUPPORTED_PLATFORMS,
|
|
62
|
+
engineRunHome,
|
|
63
|
+
legacyRuntimeDirs,
|
|
64
|
+
localEngineBinDir,
|
|
65
|
+
resolveEnginePlatform
|
|
66
|
+
} from "./chunk-AM4FKL4J.js";
|
|
67
|
+
import "./chunk-5QU2P5CA.js";
|
|
68
|
+
import "./chunk-ZYJP6BOO.js";
|
|
69
|
+
import "./chunk-QO6BVGS5.js";
|
|
70
|
+
import "./chunk-JZGVVJSI.js";
|
|
71
|
+
import "./chunk-7G3CTU7I.js";
|
|
72
|
+
import "./chunk-6PBR37LN.js";
|
|
73
|
+
import {
|
|
74
|
+
yesRerun
|
|
75
|
+
} from "./chunk-T5KELPAR.js";
|
|
76
|
+
import "./chunk-622HUCZT.js";
|
|
77
|
+
import "./chunk-NAQDMEHV.js";
|
|
78
|
+
import "./chunk-5A2PLKZB.js";
|
|
79
|
+
import "./chunk-AHJWCYQO.js";
|
|
80
|
+
import "./chunk-DX4QR4B2.js";
|
|
81
|
+
import "./chunk-6QXLMMT3.js";
|
|
82
|
+
import "./chunk-ZFDZKNGG.js";
|
|
83
|
+
import "./chunk-FWD7AL6N.js";
|
|
84
|
+
import "./chunk-2GNFDZA2.js";
|
|
85
|
+
import "./chunk-JTUKLCXS.js";
|
|
86
|
+
import "./chunk-4KHEMC32.js";
|
|
87
|
+
import "./chunk-ROY4YAEQ.js";
|
|
88
|
+
import "./chunk-TLQE7ZN3.js";
|
|
89
|
+
import "./chunk-WRBKLYSJ.js";
|
|
90
|
+
import "./chunk-3LDULPRE.js";
|
|
91
|
+
import "./chunk-XW6KISBB.js";
|
|
92
|
+
import "./chunk-AWQ7BQTQ.js";
|
|
93
|
+
import "./chunk-EUUUMY7J.js";
|
|
94
|
+
import "./chunk-YLDALTWZ.js";
|
|
95
|
+
import "./chunk-5FBYXK5P.js";
|
|
96
|
+
import "./chunk-LLNZGEFK.js";
|
|
97
|
+
import "./chunk-QXTKSOFI.js";
|
|
98
|
+
import "./chunk-X2NL4KUO.js";
|
|
99
|
+
import "./chunk-UCQ2VUTG.js";
|
|
100
|
+
import "./chunk-DGWHAVRG.js";
|
|
101
|
+
import {
|
|
102
|
+
UsageError,
|
|
103
|
+
detail,
|
|
104
|
+
info,
|
|
105
|
+
isMachineOutput,
|
|
106
|
+
link,
|
|
107
|
+
printHuman,
|
|
108
|
+
stdoutStyle,
|
|
109
|
+
success,
|
|
110
|
+
unknownSubcommand,
|
|
111
|
+
warn,
|
|
112
|
+
writeJson
|
|
113
|
+
} from "./chunk-PTHVMXZI.js";
|
|
114
|
+
import "./chunk-LQCMKAJ7.js";
|
|
115
|
+
import "./chunk-H2V3N23D.js";
|
|
116
|
+
import "./chunk-3JDU4VRL.js";
|
|
117
|
+
import {
|
|
118
|
+
suggest,
|
|
119
|
+
suggestAll
|
|
120
|
+
} from "./chunk-UTI5G6OJ.js";
|
|
121
|
+
import "./chunk-2EZ3ZJZZ.js";
|
|
122
|
+
import "./chunk-6MR5TI5V.js";
|
|
123
|
+
import "./chunk-5ZSO4T2G.js";
|
|
124
|
+
import "./chunk-XNCP4KYO.js";
|
|
125
|
+
import "./chunk-TFFGOFVZ.js";
|
|
126
|
+
import "./chunk-NZOWWHU5.js";
|
|
127
|
+
import "./chunk-4BW2SG2N.js";
|
|
128
|
+
import "./chunk-CIMQZRRE.js";
|
|
129
|
+
import "./chunk-OHX6MIUZ.js";
|
|
130
|
+
import "./chunk-36JUQZVQ.js";
|
|
131
|
+
import "./chunk-PZ5AY32C.js";
|
|
132
|
+
|
|
133
|
+
// src/emit/local-engine-command.ts
|
|
134
|
+
import { readdirSync, rmSync } from "fs";
|
|
135
|
+
import { basename, join } from "path";
|
|
136
|
+
async function runLocalEngineCommand(args, opts = {}) {
|
|
137
|
+
switch (args.subcommand) {
|
|
138
|
+
case "list":
|
|
139
|
+
return runList(args, opts);
|
|
140
|
+
case "token":
|
|
141
|
+
return runToken(args, opts);
|
|
142
|
+
case "stop":
|
|
143
|
+
return runStop(args, opts);
|
|
144
|
+
case "update":
|
|
145
|
+
return runUpdate(args, opts);
|
|
146
|
+
case "cache":
|
|
147
|
+
return runCache(args, opts);
|
|
148
|
+
default:
|
|
149
|
+
throw unknownSubcommand("local-engine", args.subcommand, args.positionals);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function cachedEngine(env, exclude = /* @__PURE__ */ new Set()) {
|
|
153
|
+
return cachedEngineEntry(env, process.cwd(), exclude);
|
|
154
|
+
}
|
|
155
|
+
async function runList(args, opts) {
|
|
156
|
+
const env = opts.env ?? process.env;
|
|
157
|
+
const entry = cachedEngine(env);
|
|
158
|
+
const orphans = findOrphanedEngineProcesses(sweepOptions(opts, env)).map((p) => p.pid);
|
|
159
|
+
if (entry === void 0) return report([], args, orphans);
|
|
160
|
+
const running = listEngines({ entry, env, run: opts.run });
|
|
161
|
+
const byName = new Map(listEngineRecords(env).map((r) => [r.name, r]));
|
|
162
|
+
let cached;
|
|
163
|
+
const rows = running.map((engine) => {
|
|
164
|
+
const record = byName.get(engine.name);
|
|
165
|
+
const row = {
|
|
166
|
+
name: engine.name,
|
|
167
|
+
url: engine.url,
|
|
168
|
+
workspaceId: engine.workspaceId,
|
|
169
|
+
startedByXanoSdk: record !== void 0
|
|
170
|
+
};
|
|
171
|
+
if (record === void 0) return row;
|
|
172
|
+
row.project = record.project;
|
|
173
|
+
if (record.engineDigest !== entry.digest) {
|
|
174
|
+
cached ??= engineVersionToken(engineVersion({ entry, env, run: opts.run })) ?? "unknown";
|
|
175
|
+
row.engineMismatch = { startedFrom: startedFrom(record), cached };
|
|
176
|
+
}
|
|
177
|
+
return row;
|
|
178
|
+
});
|
|
179
|
+
report(rows, args, orphans);
|
|
180
|
+
}
|
|
181
|
+
function startedFrom(record) {
|
|
182
|
+
return record.engineVersion ?? `engine ${record.engineDigest.slice(0, 12)}`;
|
|
183
|
+
}
|
|
184
|
+
function report(rows, args, orphans = []) {
|
|
185
|
+
if (orphans.length > 0) {
|
|
186
|
+
info(
|
|
187
|
+
`${orphans.length === 1 ? "A process" : `${orphans.length} processes`} a crashed local engine left running (pid ${orphans.join(", ")}) \u2014 \`xanosdk local-engine stop --all\` stops ${orphans.length === 1 ? "it" : "them"}.`
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
if (isMachineOutput(args)) {
|
|
191
|
+
writeJson({ engines: rows, ...orphans.length === 0 ? {} : { orphanedProcesses: orphans } });
|
|
192
|
+
reportMismatches(rows);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const s = stdoutStyle();
|
|
196
|
+
if (rows.length === 0) {
|
|
197
|
+
process.stdout.write("No local engine is running\n");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const lines = rows.map((row) => {
|
|
201
|
+
const owner = row.startedByXanoSdk ? s.dim(row.project ?? "") : s.yellow("foreign \u2014 not started by xanosdk");
|
|
202
|
+
return ` ${s.bold(row.name)} ${s.cyan(row.url)} ${owner}`;
|
|
203
|
+
});
|
|
204
|
+
printHuman(lines.join("\n") + "\n");
|
|
205
|
+
reportMismatches(rows);
|
|
206
|
+
}
|
|
207
|
+
function reportMismatches(rows) {
|
|
208
|
+
for (const row of rows) {
|
|
209
|
+
if (row.engineMismatch === void 0) continue;
|
|
210
|
+
const { startedFrom: from, cached } = row.engineMismatch;
|
|
211
|
+
const running = from.startsWith("engine ") ? from : `engine ${from}`;
|
|
212
|
+
warn(
|
|
213
|
+
`${row.name} is running ${running}, but the engine cached here is ${cached}.`,
|
|
214
|
+
"local-engine.stale",
|
|
215
|
+
[
|
|
216
|
+
`Deploy its project again with \`xanosdk deploy --local-engine\` to restart it on that project's pinned engine, or stop it with \`xanosdk local-engine stop ${row.name}\`.`
|
|
217
|
+
]
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async function runStop(args, opts) {
|
|
222
|
+
const env = opts.env ?? process.env;
|
|
223
|
+
const name = args.positionals[0];
|
|
224
|
+
if (args.all && name !== void 0 && name !== "") {
|
|
225
|
+
throw new UsageError(
|
|
226
|
+
`\`xanosdk local-engine stop\` takes a name or \`--all\`, not both \u2014 \`--all\` already covers "${name}". Drop one of them.`,
|
|
227
|
+
{ hintFor: { command: "local-engine", subcommand: "stop" } }
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
if (args.all) return runStopAll(args, opts, env);
|
|
231
|
+
if (name === void 0 || name === "") {
|
|
232
|
+
throw new UsageError(
|
|
233
|
+
`\`xanosdk local-engine stop\` needs the name of an engine, or \`--all\` for every engine xanosdk started on this machine, across projects. Run \`xanosdk local-engine list\` to see them.`,
|
|
234
|
+
{ hintFor: { command: "local-engine", subcommand: "stop" } }
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
const assignment = /^([A-Za-z_][A-Za-z0-9_]*)=/.exec(name);
|
|
238
|
+
if (assignment !== null) {
|
|
239
|
+
throw new UsageError(
|
|
240
|
+
`"${assignment[1]}=\u2026" is not a local engine name. Run \`xanosdk local-engine list\` to see what is running.`,
|
|
241
|
+
{ hintFor: { command: "local-engine", subcommand: "stop" } }
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
return runStopNamed(name, args, opts, env);
|
|
245
|
+
}
|
|
246
|
+
async function runStopNamed(name, args, opts, env) {
|
|
247
|
+
const entry = cachedEngine(env);
|
|
248
|
+
const outcome = entry === void 0 ? { name, stopped: false, clearedProjects: clearEngineRecordsNamed(name, env) } : stopEngineNamed(name, { entry, env, run: opts.run });
|
|
249
|
+
if (!outcome.stopped) {
|
|
250
|
+
info(`"${name}" is not running \u2014 nothing to stop${clearedSuffix(outcome)}.`);
|
|
251
|
+
const nearest = entry === void 0 ? void 0 : nearestRunning(name, entry, env, opts);
|
|
252
|
+
if (nearest !== void 0) detail(`Did you mean \`${nearest}\`? It is running: \`xanosdk local-engine stop ${nearest}\`.`);
|
|
253
|
+
else detail("Run `xanosdk local-engine list` to see what is running.");
|
|
254
|
+
if (isMachineOutput(args)) writeJson({ ...outcome, alreadyStopped: true, ...nearest === void 0 ? {} : { suggestion: nearest } });
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
success(`Stopped ${name}${clearedSuffix(outcome)}`);
|
|
258
|
+
if (isMachineOutput(args)) writeJson({ ...outcome, alreadyStopped: false });
|
|
259
|
+
}
|
|
260
|
+
function nearestRunning(name, entry, env, opts) {
|
|
261
|
+
try {
|
|
262
|
+
return suggest(name, listEngines({ entry, env, run: opts.run }).map((e) => e.name));
|
|
263
|
+
} catch {
|
|
264
|
+
return void 0;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async function runStopAll(args, opts, env) {
|
|
268
|
+
const entry = cachedEngine(env);
|
|
269
|
+
if (entry === void 0) {
|
|
270
|
+
const orphans = stopOrphanedEngineProcesses(sweepOptions(opts, env));
|
|
271
|
+
return reportStopAll({ stopped: [], foreign: [], orphans }, clearOrphanRecords(env), args);
|
|
272
|
+
}
|
|
273
|
+
const outcome = stopAllEngines({ entry, run: opts.run, ...sweepOptions(opts, env) });
|
|
274
|
+
reportStopAll(outcome, clearOrphanRecords(env), args);
|
|
275
|
+
}
|
|
276
|
+
function sweepOptions(opts, env) {
|
|
277
|
+
return {
|
|
278
|
+
env,
|
|
279
|
+
...opts.processes === void 0 ? {} : { processes: opts.processes },
|
|
280
|
+
...opts.signal === void 0 ? {} : { signal: opts.signal },
|
|
281
|
+
...opts.orphanWaitMs === void 0 ? {} : { waitMs: opts.orphanWaitMs }
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function reportOrphanSweep(orphans) {
|
|
285
|
+
const n = orphans.stopped.length;
|
|
286
|
+
if (n > 0) {
|
|
287
|
+
success(
|
|
288
|
+
`Stopped ${n} process${n === 1 ? "" : "es"} a crashed local engine left running (pid ${orphans.stopped.join(", ")}).`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
if (orphans.stillRunning.length > 0) {
|
|
292
|
+
detail(
|
|
293
|
+
`Still exiting after the wait: pid ${orphans.stillRunning.join(", ")} \u2014 run \`xanosdk local-engine stop --all\` again in a moment.`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function clearOrphanRecords(env) {
|
|
298
|
+
const cleared = [];
|
|
299
|
+
for (const name of new Set(listEngineRecords(env).map((r) => r.name))) {
|
|
300
|
+
cleared.push(...clearEngineRecordsNamed(name, env));
|
|
301
|
+
}
|
|
302
|
+
return cleared;
|
|
303
|
+
}
|
|
304
|
+
function reportStopAll(outcome, staleProjects, args) {
|
|
305
|
+
for (const stop of outcome.stopped) {
|
|
306
|
+
if (stop.stopped) success(`Stopped ${stop.name}${clearedSuffix(stop)}`);
|
|
307
|
+
else warn(`${stop.name} was listed as running but did not stop${clearedSuffix(stop)}.`, "local-engine.stop-failed");
|
|
308
|
+
}
|
|
309
|
+
if (outcome.foreign.length > 0) {
|
|
310
|
+
warn(
|
|
311
|
+
`Left running, not started by xanosdk: ${outcome.foreign.join(", ")}`,
|
|
312
|
+
"local-engine.foreign",
|
|
313
|
+
["Name one explicitly \u2014 `xanosdk local-engine stop <name>` \u2014 to stop it anyway."]
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
reportOrphanSweep(outcome.orphans);
|
|
317
|
+
if (staleProjects.length > 0) {
|
|
318
|
+
detail(`Cleared ${staleProjects.length} stale record${staleProjects.length === 1 ? "" : "s"}.`);
|
|
319
|
+
}
|
|
320
|
+
const swept = outcome.orphans.stopped.length + outcome.orphans.stillRunning.length;
|
|
321
|
+
if (outcome.stopped.length === 0 && outcome.foreign.length === 0 && swept === 0) {
|
|
322
|
+
info("No local engine is running \u2014 nothing to stop.");
|
|
323
|
+
}
|
|
324
|
+
if (isMachineOutput(args)) {
|
|
325
|
+
writeJson({ ...outcome, staleProjects, alreadyStopped: outcome.stopped.length === 0 && swept === 0 });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function clearedSuffix(outcome) {
|
|
329
|
+
const n = outcome.clearedProjects.length;
|
|
330
|
+
if (n === 0) return "";
|
|
331
|
+
return n === 1 ? " (cleared its local record)" : ` (cleared its record in ${n} projects)`;
|
|
332
|
+
}
|
|
333
|
+
async function runToken(args, opts) {
|
|
334
|
+
const engine = await targetEngine(args, opts, "read a token from");
|
|
335
|
+
if (args.json) {
|
|
336
|
+
writeJson({ name: engine.name, url: engine.url, workspaceId: engine.workspaceId, token: engine.token });
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
process.stdout.write(engine.token + "\n");
|
|
340
|
+
}
|
|
341
|
+
function targetEngine(args, opts, doing) {
|
|
342
|
+
return resolveLiveEngine(args.positionals[0], opts, doing);
|
|
343
|
+
}
|
|
344
|
+
async function resolveLiveEngine(named, opts, doing) {
|
|
345
|
+
const env = opts.env ?? process.env;
|
|
346
|
+
const entry = cachedEngine(env);
|
|
347
|
+
if (entry === void 0) {
|
|
348
|
+
throw new SourceError(
|
|
349
|
+
`No engine is cached on this machine, so there is nothing here to ${doing}.
|
|
350
|
+
Run \`xanosdk deploy --local-engine\` to fetch one if you meant to use a local engine.`,
|
|
351
|
+
"gone",
|
|
352
|
+
"local-engine"
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
const resolved = await resolveSource(
|
|
356
|
+
named === void 0 || named === "" ? { kind: "local-engine" } : { kind: "local-engine", name: named },
|
|
357
|
+
NO_CREDENTIAL,
|
|
358
|
+
// A lifecycle verb manages the engine itself; "deploy still reaches an
|
|
359
|
+
// ephemeral" answers a question nobody running it asked.
|
|
360
|
+
// The name is this verb's bare positional, so a near one is suggested bare.
|
|
361
|
+
{ env, listEngines: () => listEngines({ entry, env, run: opts.run }), deployFallback: false, bareName: true }
|
|
362
|
+
);
|
|
363
|
+
if (resolved.backend.kind !== "local") throw new Error("Internal: a local engine resolved to a hosted backend.");
|
|
364
|
+
return resolved.backend.engine;
|
|
365
|
+
}
|
|
366
|
+
async function runUpdate(args, opts) {
|
|
367
|
+
const env = opts.env ?? process.env;
|
|
368
|
+
const dir = process.cwd();
|
|
369
|
+
if (usesCustomReleaseManager(env)) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`${ENGINE_RELEASES_URL_ENV} names a custom release manager, and its engines are never pinned \u2014 so the pin was left as is.
|
|
372
|
+
Unset it to move the pin, or keep deploying with it set to run that manager's latest.`
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
const read = readPin(dir, { warn: (message) => warn(message, "local-engine.pin-unusable") });
|
|
376
|
+
if (read === void 0 && resolveProjectEntry(dir) === void 0) {
|
|
377
|
+
throw new Error(
|
|
378
|
+
`No package.json in ${dir}, and it is not a Xano SDK project, so there is no engine pin to move.
|
|
379
|
+
Run this from the project's root.`
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
const current = typeof read === "object" || read === void 0 ? null : read;
|
|
383
|
+
const fetch = opts.fetch === void 0 ? {} : { fetch: opts.fetch };
|
|
384
|
+
const target = await requestedEngineVersion(args.engineVersion ?? "latest", opts, env, "update to");
|
|
385
|
+
if (current === target) {
|
|
386
|
+
success(`Already on ${target} \u2014 nothing to update.`);
|
|
387
|
+
if (isMachineOutput(args)) {
|
|
388
|
+
writeJson({ from: current, to: target, changed: false, pinPath: join(dir, "package.json"), restarted: null });
|
|
389
|
+
}
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const acquired = await acquireEngine({
|
|
393
|
+
spec: { kind: "release", version: target },
|
|
394
|
+
env,
|
|
395
|
+
...fetch,
|
|
396
|
+
...opts.platform === void 0 ? {} : { platform: opts.platform },
|
|
397
|
+
...opts.arch === void 0 ? {} : { arch: opts.arch }
|
|
398
|
+
});
|
|
399
|
+
const pin = writePin(dir, target);
|
|
400
|
+
const replaced = await restartMismatchedEngine({
|
|
401
|
+
dir,
|
|
402
|
+
acquired,
|
|
403
|
+
env,
|
|
404
|
+
...opts.run === void 0 ? {} : { run: opts.run },
|
|
405
|
+
...opts.spawn === void 0 ? {} : { spawn: opts.spawn }
|
|
406
|
+
});
|
|
407
|
+
const devEnv = replaced === void 0 ? void 0 : await repointDevEnvAfterRestart(dir, replaced);
|
|
408
|
+
success(`Local engine ${current ?? "(unpinned)"} \u2192 ${target}`);
|
|
409
|
+
info(pinWrittenText({ path: pin.path, version: target, created: pin.created, moved: current !== null }));
|
|
410
|
+
if (replaced !== void 0) {
|
|
411
|
+
info(`Restarted ${replaced.name} on ${target}. It starts empty \u2014 run your deploy to seed it.`);
|
|
412
|
+
if (replaced.url !== replaced.previousUrl) {
|
|
413
|
+
info("New local engine URL:");
|
|
414
|
+
link(replaced.url);
|
|
415
|
+
}
|
|
416
|
+
if (devEnv !== void 0) {
|
|
417
|
+
detail(`Pointed ${devEnv.label} at the restarted engine (${devEnv.variable}) \u2014 restart your dev server to pick it up.`);
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
detail(`No engine is running for this project; the next \`xanosdk deploy --local-engine\` starts ${target}.`);
|
|
421
|
+
}
|
|
422
|
+
if (isMachineOutput(args)) {
|
|
423
|
+
writeJson({
|
|
424
|
+
from: current,
|
|
425
|
+
to: target,
|
|
426
|
+
changed: true,
|
|
427
|
+
pinPath: pin.path,
|
|
428
|
+
restarted: replaced?.name ?? null,
|
|
429
|
+
url: replaced?.url ?? null
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function repointDevEnvAfterRestart(dir, restarted) {
|
|
434
|
+
if (restarted.previousUrl === void 0) return void 0;
|
|
435
|
+
const { repointDevEnv } = await import("./dev-env-sync-HN44K4D5.js");
|
|
436
|
+
try {
|
|
437
|
+
return repointDevEnv(dir, restarted.previousUrl, restarted.url);
|
|
438
|
+
} catch (err) {
|
|
439
|
+
warn(err instanceof Error ? err.message : String(err), "dev-env.sync-failed");
|
|
440
|
+
return void 0;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
async function requestedEngineVersion(requested, opts, env, purpose) {
|
|
444
|
+
if (requested.trim() !== "latest") {
|
|
445
|
+
try {
|
|
446
|
+
return normalizeEngineVersion(requested);
|
|
447
|
+
} catch (err) {
|
|
448
|
+
const clearing = purpose === "clear";
|
|
449
|
+
throw new UsageError(
|
|
450
|
+
(err instanceof Error ? err.message : String(err)) + (clearing ? " `cache clear` also takes `override`, or an override's `src-\u2026` id from `cache list`." : ""),
|
|
451
|
+
{ hintFor: { command: "local-engine", subcommand: clearing ? "cache" : "update" } }
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const platform = resolveEnginePlatform(opts.platform ?? process.platform, opts.arch ?? process.arch);
|
|
456
|
+
if (platform === void 0) {
|
|
457
|
+
throw new Error(
|
|
458
|
+
`There is no local engine build for ${opts.platform ?? process.platform} ${opts.arch ?? process.arch} \u2014 it runs on ${SUPPORTED_PLATFORMS.join(", ")} and nothing else, so there is no engine to ${purpose}. \`xanosdk deploy\` reaches an ephemeral from anywhere.`
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
const fetch = opts.fetch === void 0 ? {} : { fetch: opts.fetch };
|
|
462
|
+
return (await resolveEngineRelease({ platform, env, ...fetch })).version;
|
|
463
|
+
}
|
|
464
|
+
var CACHE_ACTIONS = ["list", "clear"];
|
|
465
|
+
async function runCache(args, opts) {
|
|
466
|
+
const action = args.positionals[0];
|
|
467
|
+
if (action === "list") {
|
|
468
|
+
if (args.engineVersion !== void 0) {
|
|
469
|
+
throw new UsageError(
|
|
470
|
+
"`xanosdk local-engine cache list` takes no `--version` \u2014 it lists every cached engine. `cache clear --version <v>` is the one that takes it.",
|
|
471
|
+
{ helpFor: { command: "local-engine", subcommand: "cache" } }
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
if (args.legacyRuntime) {
|
|
475
|
+
throw new UsageError(
|
|
476
|
+
"`xanosdk local-engine cache list` takes no `--legacy-runtime` \u2014 it lists the earlier runtime copy when there is one. `cache clear --legacy-runtime` is the one that takes it.",
|
|
477
|
+
{ helpFor: { command: "local-engine", subcommand: "cache" } }
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
return runCacheList(args, opts);
|
|
481
|
+
}
|
|
482
|
+
if (action === "clear") return runCacheClear(args, opts);
|
|
483
|
+
throw new UsageError(
|
|
484
|
+
`\`xanosdk local-engine cache\`: ${action === void 0 || action === "" ? "no action given" : `unknown action "${action}"`} \u2014 it takes ${CACHE_ACTIONS.join(" or ")}.`,
|
|
485
|
+
{
|
|
486
|
+
helpFor: { command: "local-engine", subcommand: "cache" },
|
|
487
|
+
suggestion: action === void 0 ? void 0 : suggest(action, CACHE_ACTIONS)
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
function cachedEntries(env) {
|
|
492
|
+
return [...listReleaseEntries(env), ...listOverrideEntries(env)];
|
|
493
|
+
}
|
|
494
|
+
function enginesByDigest(running, env) {
|
|
495
|
+
const records = new Map(listEngineRecords(env).map((r) => [r.name, r]));
|
|
496
|
+
const out = /* @__PURE__ */ new Map();
|
|
497
|
+
for (const engine of running) {
|
|
498
|
+
const digest = records.get(engine.name)?.engineDigest;
|
|
499
|
+
if (digest === void 0) continue;
|
|
500
|
+
out.set(digest, [...out.get(digest) ?? [], engine.name]);
|
|
501
|
+
}
|
|
502
|
+
return out;
|
|
503
|
+
}
|
|
504
|
+
function entryLabel(entry) {
|
|
505
|
+
return entry.version ?? `override (${basename(entry.dir)})`;
|
|
506
|
+
}
|
|
507
|
+
async function runCacheList(args, opts) {
|
|
508
|
+
const env = opts.env ?? process.env;
|
|
509
|
+
const entries = cachedEntries(env);
|
|
510
|
+
const legacy = listLegacyCacheDirs(env);
|
|
511
|
+
const runtime = runtimeRows(env);
|
|
512
|
+
if (entries.length === 0 && legacy.length === 0 && runtime.length === 0) {
|
|
513
|
+
if (isMachineOutput(args)) writeJson({ entries: [] });
|
|
514
|
+
else info("No local engine is cached \u2014 `xanosdk deploy --local-engine` fetches one.");
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
let running = [];
|
|
518
|
+
const binary = cachedEngine(env);
|
|
519
|
+
if (binary !== void 0) {
|
|
520
|
+
try {
|
|
521
|
+
running = listEngines({ entry: binary, env, ...opts.run === void 0 ? {} : { run: opts.run } });
|
|
522
|
+
} catch (err) {
|
|
523
|
+
warn(`Could not list running engines, so none are shown: ${err.message.split("\n")[0]}`, "local-engine.list-failed");
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const using = enginesByDigest(running, env);
|
|
527
|
+
const onRuntime = running.map((e) => e.name);
|
|
528
|
+
const rows = [
|
|
529
|
+
...entries.map((entry) => ({
|
|
530
|
+
version: entry.version ?? "override",
|
|
531
|
+
source: entry.source,
|
|
532
|
+
id: basename(entry.dir),
|
|
533
|
+
bytes: diskBytes(entry.dir),
|
|
534
|
+
engines: using.get(entry.digest) ?? []
|
|
535
|
+
})),
|
|
536
|
+
...legacy.map((dir) => ({
|
|
537
|
+
version: "legacy",
|
|
538
|
+
source: "legacy",
|
|
539
|
+
id: basename(dir),
|
|
540
|
+
bytes: diskBytes(dir),
|
|
541
|
+
engines: []
|
|
542
|
+
})),
|
|
543
|
+
...runtime.map((row) => row.source === "runtime" ? { ...row, engines: onRuntime } : row)
|
|
544
|
+
];
|
|
545
|
+
if (isMachineOutput(args)) {
|
|
546
|
+
writeJson({ entries: rows });
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const s = stdoutStyle();
|
|
550
|
+
const labels = rows.map(
|
|
551
|
+
(row, i) => i < entries.length ? entryLabel(entries[i]) : row.source === "runtime" ? "unpacked runtime" : row.source === "legacy-runtime" ? (
|
|
552
|
+
// Its full path goes LAST: as the label it padded every row to its length.
|
|
553
|
+
"earlier runtime copy"
|
|
554
|
+
) : `old layout (${row.id})`
|
|
555
|
+
);
|
|
556
|
+
const sizes = rows.map((row) => formatBytes(row.bytes));
|
|
557
|
+
const labelWidth = Math.max(0, ...labels.map((l) => l.length));
|
|
558
|
+
const sizeWidth = Math.max(0, ...sizes.map((z) => z.length));
|
|
559
|
+
const lines = rows.map((row, i) => {
|
|
560
|
+
const on = row.engines.length > 0 ? ` ${s.cyan(`running: ${row.engines.join(", ")}`)}` : row.source === "legacy-runtime" ? ` ${s.dim(row.id)}` : "";
|
|
561
|
+
const size = sizes[i].padStart(sizeWidth);
|
|
562
|
+
return ` ${s.bold(labels[i].padEnd(labelWidth))} ${s.dim(size)}${on}`;
|
|
563
|
+
});
|
|
564
|
+
printHuman(lines.join("\n") + "\n");
|
|
565
|
+
if (legacy.length > 0) {
|
|
566
|
+
detail("Old-layout directories are never run \u2014 `xanosdk local-engine cache clear` removes them.");
|
|
567
|
+
}
|
|
568
|
+
if (runtime.some((r) => r.source === "runtime")) {
|
|
569
|
+
detail("The unpacked runtime is what the engines run from \u2014 `xanosdk local-engine cache clear` removes it with the engines.");
|
|
570
|
+
}
|
|
571
|
+
if (runtime.some((r) => r.source === "legacy-runtime")) {
|
|
572
|
+
detail(
|
|
573
|
+
"An earlier runtime copy was left in your own cache directory by an earlier version, and nothing runs from it \u2014 `xanosdk local-engine cache clear --legacy-runtime` removes it."
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function runtimeRows(env) {
|
|
578
|
+
const rows = [];
|
|
579
|
+
const home = engineRunHome(env);
|
|
580
|
+
const bytes = diskBytes(home);
|
|
581
|
+
if (bytes > 0) rows.push({ version: "runtime", source: "runtime", id: home, bytes, engines: [] });
|
|
582
|
+
for (const dir of legacyRuntimeDirs(env)) {
|
|
583
|
+
rows.push({ version: "legacy-runtime", source: "legacy-runtime", id: dir, bytes: diskBytes(dir), engines: [] });
|
|
584
|
+
}
|
|
585
|
+
return rows;
|
|
586
|
+
}
|
|
587
|
+
async function runCacheClear(args, opts) {
|
|
588
|
+
const env = opts.env ?? process.env;
|
|
589
|
+
if (args.legacyRuntime) return clearLegacyRuntime(args, env);
|
|
590
|
+
const bin = localEngineBinDir(env);
|
|
591
|
+
const requested = args.engineVersion?.trim();
|
|
592
|
+
const override = requested !== void 0 && (requested === "override" || requested.startsWith("src-"));
|
|
593
|
+
const version = requested === void 0 || override ? void 0 : await requestedEngineVersion(requested, opts, env, "clear");
|
|
594
|
+
const label = override ? requested === "override" ? "the override engine" : requested : version;
|
|
595
|
+
let doomed;
|
|
596
|
+
let dirs;
|
|
597
|
+
if (version !== void 0 || override) {
|
|
598
|
+
const hits = override ? listOverrideEntries(env).filter((e) => requested === "override" || basename(e.dir) === requested) : [readEngineEntry({ version }, env)].filter((e) => e !== void 0);
|
|
599
|
+
if (hits.length === 0) {
|
|
600
|
+
const cached = cachedEntries(env).map(entryLabel);
|
|
601
|
+
const near = requested === "override" ? [] : suggestAll(label ?? requested ?? "", cached.filter((c) => !c.startsWith("override")));
|
|
602
|
+
const clear = (v) => `\`xanosdk local-engine cache clear --version ${v}\``;
|
|
603
|
+
info(
|
|
604
|
+
`${requested === "override" ? "No override engine is cached" : `${label} is not cached`} \u2014 nothing to clear. ` + (cached.length === 0 ? "No engine is cached." : `Cached: ${cached.join(", ")}.`) + (near.length === 0 ? "" : ` Did you mean ${near.join(" or ")}? ${near.map(clear).join(" or ")}.`)
|
|
605
|
+
);
|
|
606
|
+
if (isMachineOutput(args)) {
|
|
607
|
+
writeJson({
|
|
608
|
+
stopped: [],
|
|
609
|
+
removed: [],
|
|
610
|
+
bytesFreed: 0,
|
|
611
|
+
alreadyGone: true,
|
|
612
|
+
cached,
|
|
613
|
+
...near.length === 0 ? {} : { suggestion: near[0] },
|
|
614
|
+
...near.length > 1 ? { suggestions: near } : {}
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
doomed = hits;
|
|
620
|
+
dirs = hits.map((e) => e.dir);
|
|
621
|
+
} else {
|
|
622
|
+
doomed = cachedEntries(env);
|
|
623
|
+
let names = [];
|
|
624
|
+
try {
|
|
625
|
+
names = readdirSync(bin);
|
|
626
|
+
} catch {
|
|
627
|
+
}
|
|
628
|
+
dirs = names.map((n) => join(bin, n));
|
|
629
|
+
}
|
|
630
|
+
const last = label !== void 0 && cachedEntries(env).every((e) => dirs.includes(e.dir));
|
|
631
|
+
const runtime = label === void 0 || last ? engineRunHome(env) : void 0;
|
|
632
|
+
const runtimeBytes = runtime === void 0 ? 0 : diskBytes(runtime);
|
|
633
|
+
if (dirs.length === 0 && runtimeBytes === 0) {
|
|
634
|
+
info("Nothing is cached \u2014 nothing to clear.");
|
|
635
|
+
if (isMachineOutput(args)) writeJson({ stopped: [], removed: [], bytesFreed: 0, alreadyGone: true });
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
const stopped = stopEnginesOn(doomed, label === void 0, env, opts.run);
|
|
639
|
+
const stillRunning = runtimeBytes === 0 ? [] : enginesStillRunning(env, opts.run);
|
|
640
|
+
const labelOf = (d) => {
|
|
641
|
+
const entry = doomed.find((e) => e.dir === d);
|
|
642
|
+
return entry === void 0 ? basename(d) : entryLabel(entry);
|
|
643
|
+
};
|
|
644
|
+
const items = dirs.map((d) => ({ name: labelOf(d), bytes: diskBytes(d) }));
|
|
645
|
+
for (const d of dirs) rmSync(d, { recursive: true, force: true });
|
|
646
|
+
const removed = dirs.map((d) => basename(d));
|
|
647
|
+
const runtimeRemoved = runtime !== void 0 && runtimeBytes > 0 && stillRunning.length === 0;
|
|
648
|
+
if (runtimeRemoved) {
|
|
649
|
+
items.push({ name: "unpacked runtime", bytes: diskBytes(runtime) });
|
|
650
|
+
rmSync(runtime, { recursive: true, force: true });
|
|
651
|
+
}
|
|
652
|
+
const bytesFreed = items.reduce((sum, item) => sum + item.bytes, 0);
|
|
653
|
+
for (const stop of stopped) {
|
|
654
|
+
if (stop.stopped) success(`Stopped ${stop.name} \u2014 it ran on an engine being removed`);
|
|
655
|
+
else warn(`${stop.name} was listed as running but did not stop. Stop it with \`xanosdk local-engine stop ${stop.name}\`.`, "local-engine.stop-failed");
|
|
656
|
+
}
|
|
657
|
+
const what = [
|
|
658
|
+
...removed.length === 0 ? [] : [label ?? `${removed.length} cached engine director${removed.length === 1 ? "y" : "ies"}`],
|
|
659
|
+
...runtimeRemoved ? [last ? "the unpacked runtime, since no cached engine is left to run it" : "the unpacked runtime"] : []
|
|
660
|
+
];
|
|
661
|
+
if (what.length > 0) {
|
|
662
|
+
success(`Removed ${what.join(" and ")} \u2014 freed ${formatBytes(bytesFreed)}`);
|
|
663
|
+
if (items.length > 1) for (const item of items) detail(`${item.name}: ${formatBytes(item.bytes)}`);
|
|
664
|
+
if (runtimeRemoved && stopped.some((s) => s.stopped)) {
|
|
665
|
+
detail(
|
|
666
|
+
"The runtime also held the stopped engines' own data, which left with them \u2014 so its size here can be smaller than `cache list` showed while they ran."
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (runtimeBytes > 0 && !runtimeRemoved) {
|
|
671
|
+
warn(
|
|
672
|
+
`Kept the unpacked runtime (${formatBytes(runtimeBytes)}): ${stillRunning.join(", ")} ${stillRunning.length === 1 ? "is" : "are"} still running on it. Stop every engine (\`xanosdk local-engine stop --all\`), then run \`xanosdk local-engine cache clear\` again.`,
|
|
673
|
+
"local-engine.runtime-kept"
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
if (stopped.length > 0) {
|
|
677
|
+
detail("The next `xanosdk deploy --local-engine` fetches its engine again and restarts it.");
|
|
678
|
+
}
|
|
679
|
+
if (isMachineOutput(args)) {
|
|
680
|
+
writeJson({ stopped: stopped.map((o) => o.name), removed, runtimeRemoved, items, bytesFreed, alreadyGone: false });
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
function enginesStillRunning(env, run) {
|
|
684
|
+
const binary = cachedEngine(env);
|
|
685
|
+
if (binary === void 0) return [];
|
|
686
|
+
try {
|
|
687
|
+
return listEngines({ entry: binary, env, ...run === void 0 ? {} : { run } }).map((e) => e.name);
|
|
688
|
+
} catch {
|
|
689
|
+
return ["an engine that could not be listed"];
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
async function clearLegacyRuntime(args, env) {
|
|
693
|
+
if (args.engineVersion !== void 0) {
|
|
694
|
+
throw new UsageError("`--legacy-runtime` clears the earlier runtime copy, not a cached version \u2014 drop `--version`.", {
|
|
695
|
+
hintFor: { command: "local-engine", subcommand: "cache" }
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
const dirs = legacyRuntimeDirs(env);
|
|
699
|
+
if (dirs.length === 0) {
|
|
700
|
+
info("No earlier runtime copy is in your cache directory \u2014 nothing to clear.");
|
|
701
|
+
if (isMachineOutput(args)) writeJson({ stopped: [], removed: [], bytesFreed: 0, alreadyGone: true });
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const bytes = dirs.reduce((sum, d) => sum + diskBytes(d), 0);
|
|
705
|
+
if (!args.yes) {
|
|
706
|
+
const ok = await confirm(`Delete ${dirs.join(", ")} (${formatBytes(bytes)}), the runtime copy an earlier version left?`, {
|
|
707
|
+
flag: "--yes",
|
|
708
|
+
refusal: { details: { removed: [], bytesFreed: 0 }, ...yesRerun(args, "local-engine cache clear --legacy-runtime") }
|
|
709
|
+
});
|
|
710
|
+
if (!ok) {
|
|
711
|
+
info("Nothing was deleted.");
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
for (const d of dirs) rmSync(d, { recursive: true, force: true });
|
|
716
|
+
if (isMachineOutput(args)) {
|
|
717
|
+
writeJson({ stopped: [], removed: dirs, bytesFreed: bytes, alreadyGone: false });
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
success(`Removed the earlier runtime copy \u2014 freed ${formatBytes(bytes)}`);
|
|
721
|
+
}
|
|
722
|
+
function stopEnginesOn(doomed, everything, env, run) {
|
|
723
|
+
const binary = cachedEngine(env, new Set(doomed.map((e) => e.dir))) ?? cachedEngine(env);
|
|
724
|
+
if (binary === void 0) return [];
|
|
725
|
+
const seam = { entry: binary, env, ...run === void 0 ? {} : { run } };
|
|
726
|
+
let running;
|
|
727
|
+
try {
|
|
728
|
+
running = listEngines(seam);
|
|
729
|
+
} catch (err) {
|
|
730
|
+
warn(
|
|
731
|
+
`Could not list running engines, so none were stopped: ${err.message.split("\n")[0]}
|
|
732
|
+
Any engine still running on a removed version keeps running \u2014 stop it with \`xanosdk local-engine stop <name>\`.`,
|
|
733
|
+
"local-engine.list-failed"
|
|
734
|
+
);
|
|
735
|
+
return [];
|
|
736
|
+
}
|
|
737
|
+
const records = new Map(listEngineRecords(env).map((r) => [r.name, r]));
|
|
738
|
+
const digests = new Set(doomed.map((e) => e.digest));
|
|
739
|
+
return running.filter((engine) => {
|
|
740
|
+
const record = records.get(engine.name);
|
|
741
|
+
return record !== void 0 && (everything || digests.has(record.engineDigest));
|
|
742
|
+
}).map((engine) => {
|
|
743
|
+
try {
|
|
744
|
+
return stopEngineNamed(engine.name, seam);
|
|
745
|
+
} catch {
|
|
746
|
+
return { name: engine.name, stopped: false, clearedProjects: [] };
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function formatBytes(bytes) {
|
|
751
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
752
|
+
let n = bytes;
|
|
753
|
+
let unit = 0;
|
|
754
|
+
while (n >= 1024 && unit < units.length - 1) {
|
|
755
|
+
n /= 1024;
|
|
756
|
+
unit++;
|
|
757
|
+
}
|
|
758
|
+
return unit === 0 ? `${n} B` : `${n.toFixed(1)} ${units[unit]}`;
|
|
759
|
+
}
|
|
760
|
+
export {
|
|
761
|
+
reportOrphanSweep,
|
|
762
|
+
resolveLiveEngine,
|
|
763
|
+
runLocalEngineCommand,
|
|
764
|
+
sweepOptions
|
|
765
|
+
};
|
|
766
|
+
//# sourceMappingURL=local-engine-command-Z3OL7VOD.js.map
|