@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,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
projectSdkVersion
|
|
3
|
+
} from "./chunk-D7VGG3WS.js";
|
|
4
|
+
import {
|
|
5
|
+
compareSemver,
|
|
6
|
+
parseSemver
|
|
7
|
+
} from "./chunk-2TFRR6JV.js";
|
|
8
|
+
import {
|
|
9
|
+
readVersion
|
|
10
|
+
} from "./chunk-ETO6LGLD.js";
|
|
11
|
+
import {
|
|
12
|
+
registerSecret
|
|
13
|
+
} from "./chunk-AWQ7BQTQ.js";
|
|
14
|
+
import {
|
|
15
|
+
readPathEnvVar
|
|
16
|
+
} from "./chunk-EUUUMY7J.js";
|
|
17
|
+
import {
|
|
18
|
+
serverMessage
|
|
19
|
+
} from "./chunk-YLDALTWZ.js";
|
|
20
|
+
import {
|
|
21
|
+
atomicWrite
|
|
22
|
+
} from "./chunk-LLNZGEFK.js";
|
|
23
|
+
import {
|
|
24
|
+
envFlagSet,
|
|
25
|
+
readEnvVar
|
|
26
|
+
} from "./chunk-X2NL4KUO.js";
|
|
27
|
+
import {
|
|
28
|
+
blank,
|
|
29
|
+
noteRunWarning,
|
|
30
|
+
style,
|
|
31
|
+
warn
|
|
32
|
+
} from "./chunk-PTHVMXZI.js";
|
|
33
|
+
|
|
34
|
+
// src/emit/update-check.ts
|
|
35
|
+
import { existsSync, readFileSync, mkdirSync } from "fs";
|
|
36
|
+
import { homedir } from "os";
|
|
37
|
+
import { dirname, join } from "path";
|
|
38
|
+
import { createRequire } from "module";
|
|
39
|
+
import { fileURLToPath } from "url";
|
|
40
|
+
function registryUrl() {
|
|
41
|
+
const override = readEnvVar("XANOSDK_UPDATE_REGISTRY");
|
|
42
|
+
if (override !== void 0) return override;
|
|
43
|
+
return `${npmRegistry().replace(/\/+$/, "")}/@xano/sdk/latest`;
|
|
44
|
+
}
|
|
45
|
+
var DEFAULT_REGISTRY = "https://registry.npmjs.org/";
|
|
46
|
+
function npmRegistry(env = process.env, cwd = process.cwd()) {
|
|
47
|
+
const { fromEnv, configs } = npmConfig(env, cwd);
|
|
48
|
+
for (const key of ["@xano:registry", "registry"]) {
|
|
49
|
+
const value = (key === "registry" ? fromEnv("registry") : void 0) ?? configs.find((c) => c.has(key))?.get(key);
|
|
50
|
+
if (value !== void 0 && value !== "") return value;
|
|
51
|
+
}
|
|
52
|
+
return DEFAULT_REGISTRY;
|
|
53
|
+
}
|
|
54
|
+
function npmConfig(env, cwd) {
|
|
55
|
+
const fromEnv = (key) => {
|
|
56
|
+
const value = env[`npm_config_${key}`] ?? env[`NPM_CONFIG_${key.toUpperCase()}`];
|
|
57
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
58
|
+
};
|
|
59
|
+
const files = [projectNpmrc(cwd), fromEnv("userconfig") ?? join(homedir(), ".npmrc")];
|
|
60
|
+
const prefix = fromEnv("prefix");
|
|
61
|
+
if (prefix !== void 0) files.push(join(prefix, "etc", "npmrc"));
|
|
62
|
+
return { fromEnv, configs: files.flatMap((file) => file === void 0 ? [] : [readNpmrc(file, env)]) };
|
|
63
|
+
}
|
|
64
|
+
function npmAuthHeader(url, env = process.env, cwd = process.cwd()) {
|
|
65
|
+
let parsed;
|
|
66
|
+
try {
|
|
67
|
+
parsed = new URL(url);
|
|
68
|
+
} catch {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
const { fromEnv, configs } = npmConfig(env, cwd);
|
|
72
|
+
const get = (key) => {
|
|
73
|
+
const value = fromEnv(key) ?? configs.find((c) => c.has(key))?.get(key);
|
|
74
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
75
|
+
};
|
|
76
|
+
const parts = parsed.pathname.split("/").filter(Boolean);
|
|
77
|
+
for (let n = parts.length; n >= 0; n--) {
|
|
78
|
+
const nerf = `//${parsed.host}/${parts.slice(0, n).map((p) => `${p}/`).join("")}`;
|
|
79
|
+
const header = credentialAt(nerf, get);
|
|
80
|
+
if (header !== void 0) return header;
|
|
81
|
+
}
|
|
82
|
+
const defaultHost = new URL(npmRegistry(env, cwd)).host;
|
|
83
|
+
return parsed.host === defaultHost ? credentialAt("", get) : void 0;
|
|
84
|
+
}
|
|
85
|
+
function credentialAt(prefix, get) {
|
|
86
|
+
const key = (name) => prefix === "" ? name : `${prefix}:${name}`;
|
|
87
|
+
const token = get(key("_authToken"));
|
|
88
|
+
registerSecret(token);
|
|
89
|
+
if (token !== void 0) return `Bearer ${token}`;
|
|
90
|
+
const auth = get(key("_auth"));
|
|
91
|
+
registerSecret(auth);
|
|
92
|
+
if (auth !== void 0) return `Basic ${auth}`;
|
|
93
|
+
const user = get(key("username"));
|
|
94
|
+
const password = get(key("_password"));
|
|
95
|
+
registerSecret(password);
|
|
96
|
+
if (user !== void 0 && password !== void 0) {
|
|
97
|
+
return `Basic ${Buffer.from(`${user}:${Buffer.from(password, "base64").toString("utf8")}`).toString("base64")}`;
|
|
98
|
+
}
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
function projectNpmrc(cwd) {
|
|
102
|
+
let dir = cwd;
|
|
103
|
+
for (; ; ) {
|
|
104
|
+
if (existsSync(join(dir, "package.json"))) return join(dir, ".npmrc");
|
|
105
|
+
const parent = dirname(dir);
|
|
106
|
+
if (parent === dir) return void 0;
|
|
107
|
+
dir = parent;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function readNpmrc(file, env) {
|
|
111
|
+
const out = /* @__PURE__ */ new Map();
|
|
112
|
+
let text;
|
|
113
|
+
try {
|
|
114
|
+
text = readFileSync(file, "utf8");
|
|
115
|
+
} catch {
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
for (const line of text.split(/\r?\n/)) {
|
|
119
|
+
const m = /^\s*([^#;=\s][^=]*?)\s*=\s*(.*?)\s*$/.exec(line);
|
|
120
|
+
if (m === null) continue;
|
|
121
|
+
const value = m[2].replace(/^(["'])(.*)\1$/, "$2").replace(/\$\{([^}]+)\}/g, (_, name) => env[name] ?? "");
|
|
122
|
+
out.set(m[1], value);
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
function registryUrlIsHttp() {
|
|
127
|
+
try {
|
|
128
|
+
const { protocol } = new URL(registryUrl());
|
|
129
|
+
return protocol === "https:" || protocol === "http:";
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function cachePath() {
|
|
135
|
+
return readPathEnvVar("XANOSDK_UPDATE_CACHE") ?? join(homedir(), ".xanosdk", "update-check.json");
|
|
136
|
+
}
|
|
137
|
+
var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
|
|
138
|
+
var FETCH_TIMEOUT_MS = 2e3;
|
|
139
|
+
var CHECK_TIMEOUT_MS = 1e4;
|
|
140
|
+
function isNewer(candidate, current) {
|
|
141
|
+
const a = parseSemver(candidate);
|
|
142
|
+
const b = parseSemver(current);
|
|
143
|
+
if (!a || !b) return false;
|
|
144
|
+
return compareSemver(a, b) > 0;
|
|
145
|
+
}
|
|
146
|
+
function readCache() {
|
|
147
|
+
const path = cachePath();
|
|
148
|
+
if (!existsSync(path)) return void 0;
|
|
149
|
+
try {
|
|
150
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
151
|
+
if (parsed.registry === registryUrl() && typeof parsed.latest === "string" && // A cache written before the registry's answer was validated can hold
|
|
152
|
+
// anything; one that is not a version answers nothing.
|
|
153
|
+
parseSemver(parsed.latest) !== null && typeof parsed.checkedAt === "number") {
|
|
154
|
+
return { registry: parsed.registry, latest: parsed.latest, checkedAt: parsed.checkedAt };
|
|
155
|
+
}
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
function writeCache(cache) {
|
|
161
|
+
try {
|
|
162
|
+
const path = cachePath();
|
|
163
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
164
|
+
atomicWrite(path, JSON.stringify(cache, null, 2) + "\n");
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async function fetchLatest(timeoutMs = FETCH_TIMEOUT_MS) {
|
|
169
|
+
const got = await fetchLatestOrWhy(timeoutMs);
|
|
170
|
+
return "latest" in got ? got.latest : null;
|
|
171
|
+
}
|
|
172
|
+
async function fetchLatestOrWhy(timeoutMs) {
|
|
173
|
+
if (!registryUrlIsHttp()) return {};
|
|
174
|
+
const authorization = npmAuthHeader(registryUrl());
|
|
175
|
+
let res;
|
|
176
|
+
try {
|
|
177
|
+
res = await fetch(registryUrl(), {
|
|
178
|
+
headers: { accept: "application/json", ...authorization === void 0 ? {} : { authorization } },
|
|
179
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
180
|
+
});
|
|
181
|
+
} catch {
|
|
182
|
+
return {};
|
|
183
|
+
}
|
|
184
|
+
if (res.status === 401 || res.status === 403) {
|
|
185
|
+
return { answered: `HTTP ${res.status}`, refused: authorization === void 0 ? "no-credential" : "credential" };
|
|
186
|
+
}
|
|
187
|
+
let text = "";
|
|
188
|
+
try {
|
|
189
|
+
text = await res.text();
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
const said = serverMessage(text);
|
|
193
|
+
if (!res.ok) return { answered: `HTTP ${res.status}${said === void 0 ? "" : ` \u2014 ${said}`}` };
|
|
194
|
+
let version;
|
|
195
|
+
try {
|
|
196
|
+
version = JSON.parse(text).version;
|
|
197
|
+
} catch {
|
|
198
|
+
}
|
|
199
|
+
if (typeof version === "string" && parseSemver(version) !== null) return { latest: version };
|
|
200
|
+
if (typeof version === "string") {
|
|
201
|
+
const shown = version.length > 40 ? `${version.slice(0, 40)}\u2026` : version;
|
|
202
|
+
return { answered: `a version field that is not a version (${JSON.stringify(shown)})` };
|
|
203
|
+
}
|
|
204
|
+
return { answered: `a body that holds no version${said === void 0 ? "" : ` \u2014 ${said}`}` };
|
|
205
|
+
}
|
|
206
|
+
var noticeSuppressed = false;
|
|
207
|
+
function suppressUpdateNotice() {
|
|
208
|
+
noticeSuppressed = true;
|
|
209
|
+
}
|
|
210
|
+
function disabled() {
|
|
211
|
+
return Boolean(
|
|
212
|
+
noticeSuppressed || envFlagSet("XANOSDK_NO_UPDATE_CHECK") || envFlagSet("NO_UPDATE_NOTIFIER") || process.env.CI
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
async function resolveUpdateNotice(opts) {
|
|
216
|
+
if (!opts?.force && disabled()) return null;
|
|
217
|
+
const current = opts?.current ?? readVersion();
|
|
218
|
+
if (current === "unknown") return null;
|
|
219
|
+
const cache = readCache();
|
|
220
|
+
let latest = cache?.latest;
|
|
221
|
+
const now = Date.now();
|
|
222
|
+
if (!cache || now - cache.checkedAt > CHECK_INTERVAL_MS) {
|
|
223
|
+
const fetched = await fetchLatest();
|
|
224
|
+
if (fetched) {
|
|
225
|
+
latest = fetched;
|
|
226
|
+
writeCache({ registry: registryUrl(), latest: fetched, checkedAt: now });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return latest && isNewer(latest, current) ? { current, latest } : null;
|
|
230
|
+
}
|
|
231
|
+
async function checkForUpgrade(opts) {
|
|
232
|
+
const current = opts?.current ?? readVersion();
|
|
233
|
+
if (current === "unknown") return { status: "unknown", reason: "local-version" };
|
|
234
|
+
if (!registryUrlIsHttp()) return { status: "unknown", reason: "registry-url" };
|
|
235
|
+
const got = await fetchLatestOrWhy(CHECK_TIMEOUT_MS);
|
|
236
|
+
if (!("latest" in got)) {
|
|
237
|
+
return {
|
|
238
|
+
status: "unknown",
|
|
239
|
+
reason: "registry",
|
|
240
|
+
...got.answered === void 0 ? {} : { answered: got.answered },
|
|
241
|
+
..."refused" in got && got.refused !== void 0 ? { refused: got.refused } : {}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const latest = got.latest;
|
|
245
|
+
writeCache({ registry: registryUrl(), latest, checkedAt: Date.now() });
|
|
246
|
+
const status = isNewer(latest, current) ? "available" : isNewer(current, latest) ? "ahead" : "current";
|
|
247
|
+
return { status, current, latest };
|
|
248
|
+
}
|
|
249
|
+
function detectInstallMode() {
|
|
250
|
+
const override = readEnvVar("XANOSDK_INSTALL_MODE")?.trim();
|
|
251
|
+
if (override === "global" || override === "local") return override;
|
|
252
|
+
try {
|
|
253
|
+
const requireFromCwd = createRequire(join(process.cwd(), "package.json"));
|
|
254
|
+
return packageRunnerOf(requireFromCwd.resolve("@xano/sdk/package.json")) === void 0 ? "local" : "global";
|
|
255
|
+
} catch {
|
|
256
|
+
return "global";
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function packageRunnerOf(path) {
|
|
260
|
+
for (const seg of path.split(/[\\/]/)) {
|
|
261
|
+
if (seg === "_npx") return "npx";
|
|
262
|
+
if (seg === "dlx") return "pnpm dlx";
|
|
263
|
+
if (/^dlx-\d+$/.test(seg)) return "yarn dlx";
|
|
264
|
+
if (seg.startsWith("bunx-")) return "bunx";
|
|
265
|
+
}
|
|
266
|
+
return void 0;
|
|
267
|
+
}
|
|
268
|
+
function isPackageRunnerPath(path) {
|
|
269
|
+
return packageRunnerOf(path) !== void 0;
|
|
270
|
+
}
|
|
271
|
+
function runFromPackageRunner() {
|
|
272
|
+
return packageRunnerOf(fileURLToPath(import.meta.url));
|
|
273
|
+
}
|
|
274
|
+
function upgradeCommand(mode) {
|
|
275
|
+
return mode === "global" ? "npm i -g @xano/sdk@latest" : "xanosdk upgrade";
|
|
276
|
+
}
|
|
277
|
+
function nudgeBaseline() {
|
|
278
|
+
const running = readVersion();
|
|
279
|
+
if (detectInstallMode() !== "local") return { current: running };
|
|
280
|
+
const project = projectSdkVersion(process.cwd());
|
|
281
|
+
return project === void 0 || project === running ? { current: running } : { current: project, cli: running };
|
|
282
|
+
}
|
|
283
|
+
function nudgeFor(latest) {
|
|
284
|
+
const { current, cli } = nudgeBaseline();
|
|
285
|
+
if (current === "unknown") return null;
|
|
286
|
+
if (isNewer(latest, current)) {
|
|
287
|
+
return { message: `A new @xano/sdk is available: ${style.dim(current)} \u2192 ${style.green(latest)}`, remedy: "update: xanosdk upgrade" };
|
|
288
|
+
}
|
|
289
|
+
if (cli !== void 0 && isNewer(latest, cli)) {
|
|
290
|
+
return {
|
|
291
|
+
message: `This project's @xano/sdk ${current} is current, but the CLI you ran is ${style.dim(cli)} (latest ${style.green(latest)}) \u2014 your global CLI is older`,
|
|
292
|
+
remedy: "update: npm i -g @xano/sdk@latest"
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
function printUpdateNotice(notice) {
|
|
298
|
+
blank();
|
|
299
|
+
warn(`A new @xano/sdk is available: ${style.dim(notice.current)} \u2192 ${style.green(notice.latest)}`, "update.available", [
|
|
300
|
+
`update: xanosdk upgrade`
|
|
301
|
+
]);
|
|
302
|
+
}
|
|
303
|
+
function routeUpdateNoticeToDocument() {
|
|
304
|
+
try {
|
|
305
|
+
if (disabled() || process.stderr.isTTY !== true) return;
|
|
306
|
+
suppressUpdateNotice();
|
|
307
|
+
const latest = readCache()?.latest;
|
|
308
|
+
const nudge = latest === void 0 ? null : nudgeFor(latest);
|
|
309
|
+
if (nudge !== null) noteRunWarning("update.available", `${stripAnsi(nudge.message)}
|
|
310
|
+
${nudge.remedy}`);
|
|
311
|
+
} catch {
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function stripAnsi(text) {
|
|
315
|
+
return text.replace(/\x1b\[[0-9;]*m/g, "");
|
|
316
|
+
}
|
|
317
|
+
function runExitedClean(code = process.exitCode) {
|
|
318
|
+
return code === void 0 || code === 0;
|
|
319
|
+
}
|
|
320
|
+
async function maybeNotifyUpdate() {
|
|
321
|
+
try {
|
|
322
|
+
if (disabled() || process.stderr.isTTY !== true || !runExitedClean()) return;
|
|
323
|
+
const { current, cli } = nudgeBaseline();
|
|
324
|
+
const notice = await resolveUpdateNotice({ current: cli !== void 0 && isNewer(current, cli) ? cli : current });
|
|
325
|
+
const nudge = notice === null ? null : nudgeFor(notice.latest);
|
|
326
|
+
if (nudge !== null) {
|
|
327
|
+
blank();
|
|
328
|
+
warn(nudge.message, "update.available", [nudge.remedy]);
|
|
329
|
+
}
|
|
330
|
+
} catch {
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export {
|
|
335
|
+
registryUrl,
|
|
336
|
+
npmRegistry,
|
|
337
|
+
npmAuthHeader,
|
|
338
|
+
registryUrlIsHttp,
|
|
339
|
+
isNewer,
|
|
340
|
+
suppressUpdateNotice,
|
|
341
|
+
resolveUpdateNotice,
|
|
342
|
+
checkForUpgrade,
|
|
343
|
+
detectInstallMode,
|
|
344
|
+
packageRunnerOf,
|
|
345
|
+
isPackageRunnerPath,
|
|
346
|
+
runFromPackageRunner,
|
|
347
|
+
upgradeCommand,
|
|
348
|
+
nudgeBaseline,
|
|
349
|
+
printUpdateNotice,
|
|
350
|
+
routeUpdateNoticeToDocument,
|
|
351
|
+
runExitedClean,
|
|
352
|
+
maybeNotifyUpdate
|
|
353
|
+
};
|
|
354
|
+
//# sourceMappingURL=chunk-LIEOKXKD.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/util/atomic-write.ts
|
|
2
|
+
import { accessSync, constants, lstatSync, readlinkSync, statSync, writeFileSync, renameSync, rmSync } from "fs";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
function atomicWrite(path, contents, opts) {
|
|
5
|
+
const target = linkTarget(path);
|
|
6
|
+
const mode = opts?.mode ?? existingMode(target);
|
|
7
|
+
const tmp = `${target}.tmp-${process.pid}`;
|
|
8
|
+
try {
|
|
9
|
+
writeFileSync(tmp, contents, mode !== void 0 ? { encoding: "utf8", mode } : "utf8");
|
|
10
|
+
renameSync(tmp, target);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
rmSync(tmp, { force: true });
|
|
13
|
+
throw err;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function linkTarget(path) {
|
|
17
|
+
let current = path;
|
|
18
|
+
for (let hops = 0; hops < 40; hops++) {
|
|
19
|
+
let isLink;
|
|
20
|
+
try {
|
|
21
|
+
isLink = lstatSync(current).isSymbolicLink();
|
|
22
|
+
} catch {
|
|
23
|
+
return current;
|
|
24
|
+
}
|
|
25
|
+
if (!isLink) return current;
|
|
26
|
+
current = resolve(dirname(current), readlinkSync(current));
|
|
27
|
+
}
|
|
28
|
+
return current;
|
|
29
|
+
}
|
|
30
|
+
function existingMode(path) {
|
|
31
|
+
try {
|
|
32
|
+
return statSync(path).mode & 4095;
|
|
33
|
+
} catch {
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function assertWritable(path) {
|
|
38
|
+
try {
|
|
39
|
+
accessSync(path, constants.W_OK);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
if (err.code === "ENOENT") return;
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
atomicWrite,
|
|
48
|
+
linkTarget,
|
|
49
|
+
assertWritable
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-LLNZGEFK.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureGitignored
|
|
3
|
+
} from "./chunk-XW6KISBB.js";
|
|
4
|
+
import {
|
|
5
|
+
atomicWrite
|
|
6
|
+
} from "./chunk-LLNZGEFK.js";
|
|
7
|
+
|
|
8
|
+
// src/deploy/deployed-state.ts
|
|
9
|
+
import { mkdirSync, readFileSync, rmSync } from "fs";
|
|
10
|
+
import { dirname, join, resolve } from "path";
|
|
11
|
+
var DEPLOYED_KINDS = ["ephemeral", "local-engine"];
|
|
12
|
+
function isRealDeployment(kind) {
|
|
13
|
+
return kind === "workspace" || kind === "tenant";
|
|
14
|
+
}
|
|
15
|
+
function deployedStatePath(dir) {
|
|
16
|
+
return join(resolve(dir), ".xano", "deployed.json");
|
|
17
|
+
}
|
|
18
|
+
function readDeployed(dir) {
|
|
19
|
+
let text;
|
|
20
|
+
try {
|
|
21
|
+
text = readFileSync(deployedStatePath(dir), "utf8");
|
|
22
|
+
} catch {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = JSON.parse(text);
|
|
28
|
+
} catch {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return void 0;
|
|
32
|
+
const kind = parsed.kind;
|
|
33
|
+
if (typeof kind !== "string" || !DEPLOYED_KINDS.includes(kind)) return void 0;
|
|
34
|
+
const at = parsed.deployedAt;
|
|
35
|
+
return { version: 1, kind, deployedAt: typeof at === "string" ? at : "" };
|
|
36
|
+
}
|
|
37
|
+
function recordDeployed(dir, kind, now = /* @__PURE__ */ new Date()) {
|
|
38
|
+
if (isRealDeployment(kind)) return false;
|
|
39
|
+
if (!DEPLOYED_KINDS.includes(kind)) {
|
|
40
|
+
throw new Error(`Internal: "${kind}" is not a backend a deploy records as the tracked default.`);
|
|
41
|
+
}
|
|
42
|
+
const path = deployedStatePath(dir);
|
|
43
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
44
|
+
const pointer = { version: 1, kind, deployedAt: now.toISOString() };
|
|
45
|
+
atomicWrite(path, JSON.stringify(pointer, null, 2) + "\n");
|
|
46
|
+
ensureGitignored(path);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
isRealDeployment,
|
|
52
|
+
readDeployed,
|
|
53
|
+
recordDeployed
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=chunk-LPECSJ2J.js.map
|