@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,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
conditionalEntryHint,
|
|
3
|
+
describeEntry,
|
|
4
|
+
describeStatementEntry,
|
|
5
|
+
isStatementEntry,
|
|
6
|
+
isVarName
|
|
7
|
+
} from "./chunk-CIMQZRRE.js";
|
|
8
|
+
|
|
9
|
+
// src/values/mock.ts
|
|
10
|
+
function isWrapped(e) {
|
|
11
|
+
return typeof e === "object" && e !== null && typeof e.tag !== "string";
|
|
12
|
+
}
|
|
13
|
+
function encodeMockMap(mock) {
|
|
14
|
+
const out = {};
|
|
15
|
+
if (typeof mock !== "object" || mock === null || Array.isArray(mock)) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`\`mock\` must be a { "<test name>": value } record, keyed by the name of each test it applies to \u2014 got ${describeEntry(mock)}.`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
for (const [testName, entry] of Object.entries(mock)) {
|
|
21
|
+
const wrapped = isWrapped(entry);
|
|
22
|
+
const value = wrapped ? entry.value : entry;
|
|
23
|
+
if (typeof value?.tag !== "string") {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`mock for test "${testName}": expected a tagged value (\`c.*\`/\`ref\`/\u2026) or \`{ value, enabled }\`, got ${describeEntry(entry)}. A mock stores \`{value,tag,filters}\` copied off this argument, so a plain JS value encodes an empty mock that silently returns nothing when the test runs.`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
out[testName] = {
|
|
29
|
+
value: value.value,
|
|
30
|
+
tag: value.tag,
|
|
31
|
+
filters: value.filters,
|
|
32
|
+
enabled: wrapped ? entry.enabled ?? true : true
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/statements/statement.ts
|
|
39
|
+
function readableStatementName(storedName) {
|
|
40
|
+
return storedName.replace(/^mvp:/, "");
|
|
41
|
+
}
|
|
42
|
+
function assertAnnotations(stmt) {
|
|
43
|
+
if (stmt.as != null && typeof stmt.as !== "string") {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Statement "${statementLabel(stmt.name)}": argument \`as\` must be the variable name as a string \u2014 got ${describeEntry(stmt.as)}.`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
if (typeof stmt.as === "string" && stmt.as !== "" && !isVarName(stmt.as)) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Statement "${statementLabel(stmt.name)}": argument \`as\` is ${JSON.stringify(stmt.as)}, which is not a variable name \u2014 use a letter or underscore, then letters, digits and underscores (e.g. "order_total")${stmt.as.startsWith("$") ? `; \`as\` takes the bare name, without the "$"` : ""}.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (stmt.disabled != null && typeof stmt.disabled !== "boolean") {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Statement "${statementLabel(stmt.name)}": option \`disabled\` must be true or false \u2014 got ${describeEntry(stmt.disabled)}.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (stmt.description != null && typeof stmt.description !== "string") {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Statement "${statementLabel(stmt.name)}": option \`description\` must be a string \u2014 got ${describeEntry(stmt.description)}.`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var ANNOTATION_KEYS = /* @__PURE__ */ Object.keys({ disabled: 1, description: 1, mock: 1 });
|
|
65
|
+
var OPTION_KEYS = /* @__PURE__ */ Object.keys({ disabled: 1, description: 1, mock: 1, asFilters: 1 });
|
|
66
|
+
function annotate(stmt, a) {
|
|
67
|
+
if (a?.disabled !== void 0 && a.disabled !== null) stmt.disabled = a.disabled;
|
|
68
|
+
if (a?.description !== void 0 && a.description !== null) stmt.description = a.description;
|
|
69
|
+
assertAnnotations(stmt);
|
|
70
|
+
if (a?.mock !== void 0 && a.mock !== null) {
|
|
71
|
+
try {
|
|
72
|
+
stmt.mocks = encodeMockMap(a.mock);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
throw new Error(`Statement "${statementLabel(stmt.name)}": ${err.message}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (a?.asFilters !== void 0 && a.asFilters !== null) assertFilterList(stmt, a.asFilters);
|
|
78
|
+
if (a?.asFilters !== void 0 && a.asFilters !== null && a.asFilters.length > 0) {
|
|
79
|
+
assertBindsAs(stmt, "asFilters");
|
|
80
|
+
stmt.output = { ...stmt.output ?? {}, filters: a.asFilters };
|
|
81
|
+
}
|
|
82
|
+
return stmt;
|
|
83
|
+
}
|
|
84
|
+
function assertBindsAs(stmt, option) {
|
|
85
|
+
if (stmt.as) return;
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Statement "${statementLabel(stmt.name)}" binds no \`as\` variable, so \`${option}\` has nothing to filter. Bind the result with \`as\` first, or drop the option.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function assertFilterList(stmt, list) {
|
|
91
|
+
const where = `Statement "${statementLabel(stmt.name)}": argument "asFilters`;
|
|
92
|
+
if (!Array.isArray(list)) {
|
|
93
|
+
throw new Error(`${where}" must be an array of filters (\`fl.*\`) \u2014 got ${describeEntry(list)}.`);
|
|
94
|
+
}
|
|
95
|
+
list.forEach((f, i) => {
|
|
96
|
+
if (typeof f !== "object" || f === null || typeof f.name !== "string") {
|
|
97
|
+
throw new Error(`${where}[${i}]" must be a filter (\`fl.*\`) \u2014 got ${describeEntry(f)}.`);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function statements(...items) {
|
|
102
|
+
return items;
|
|
103
|
+
}
|
|
104
|
+
var RAW_ENVELOPE = /* @__PURE__ */ Symbol.for("xanosdk.statement.rawEnvelope");
|
|
105
|
+
var registry = /* @__PURE__ */ new Map();
|
|
106
|
+
var factoryPaths = /* @__PURE__ */ new Map();
|
|
107
|
+
var namesByFactory = /* @__PURE__ */ new Map();
|
|
108
|
+
function registerStatement(name, factory, path) {
|
|
109
|
+
registry.set(name, factory);
|
|
110
|
+
namesByFactory.set(factory, name);
|
|
111
|
+
if (path !== void 0 && !factoryPaths.has(name)) factoryPaths.set(name, path);
|
|
112
|
+
}
|
|
113
|
+
function registerFactoryPaths(tree, prefix, seen = /* @__PURE__ */ new Set()) {
|
|
114
|
+
if (tree === null || typeof tree !== "object" && typeof tree !== "function" || seen.has(tree)) return;
|
|
115
|
+
seen.add(tree);
|
|
116
|
+
const name = namesByFactory.get(tree);
|
|
117
|
+
if (name !== void 0 && !factoryPaths.has(name)) factoryPaths.set(name, prefix);
|
|
118
|
+
for (const [key, child] of Object.entries(tree)) {
|
|
119
|
+
registerFactoryPaths(child, `${prefix}.${key}`, seen);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function statementLabel(storedName) {
|
|
123
|
+
return factoryPaths.get(storedName) ?? readableStatementName(storedName);
|
|
124
|
+
}
|
|
125
|
+
function assertStatementList(owner, where, list) {
|
|
126
|
+
if (!Array.isArray(list)) {
|
|
127
|
+
throw new Error(`${owner}: \`${where}\` must be an array of statements (\`s.*\`) \u2014 got ${describeEntry(list)}.`);
|
|
128
|
+
}
|
|
129
|
+
list.forEach((entry, i) => {
|
|
130
|
+
if (isStatementEntry(entry)) return;
|
|
131
|
+
throw new Error(
|
|
132
|
+
`${owner}: \`${where}[${i}]\` must be a statement (\`s.*\`) \u2014 got ${describeStatementEntry(entry)}.${conditionalEntryHint(entry)}`
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function encodeStack(kind, name, stack) {
|
|
137
|
+
if (stack === void 0 || stack === null) return [];
|
|
138
|
+
assertStatementList(`${kind} "${name ?? "?"}"`, "stack", stack);
|
|
139
|
+
return stack.map(encodeStatement);
|
|
140
|
+
}
|
|
141
|
+
function isRegisteredStatement(name) {
|
|
142
|
+
return registry.has(name);
|
|
143
|
+
}
|
|
144
|
+
function getStatementFactory(name) {
|
|
145
|
+
const factory = registry.get(name);
|
|
146
|
+
if (!factory) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Unknown statement "${readableStatementName(name)}": no factory is registered for it in this copy of @xano/sdk.`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return factory;
|
|
152
|
+
}
|
|
153
|
+
function fullInputEntry(raw) {
|
|
154
|
+
const e = raw ?? {};
|
|
155
|
+
return {
|
|
156
|
+
name: e.name,
|
|
157
|
+
value: e.value,
|
|
158
|
+
tag: e.tag,
|
|
159
|
+
filters: e.filters ?? [],
|
|
160
|
+
ignore: e.ignore ?? false,
|
|
161
|
+
expand: e.expand ?? false,
|
|
162
|
+
children: e.children ?? []
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
var marks = /* @__PURE__ */ new WeakMap();
|
|
166
|
+
function markStatement(stmt, mark) {
|
|
167
|
+
marks.set(stmt, mark);
|
|
168
|
+
}
|
|
169
|
+
function statementMark(stmt) {
|
|
170
|
+
return marks.get(stmt);
|
|
171
|
+
}
|
|
172
|
+
function encodeStatement(stmt) {
|
|
173
|
+
const encoded = encodeStatementBytes(stmt);
|
|
174
|
+
const mark = marks.get(stmt);
|
|
175
|
+
if (mark) marks.set(encoded, mark);
|
|
176
|
+
return encoded;
|
|
177
|
+
}
|
|
178
|
+
function encodeStatementBytes(stmt) {
|
|
179
|
+
const rawEnvelope = stmt[RAW_ENVELOPE];
|
|
180
|
+
if (rawEnvelope !== void 0) return rawEnvelope;
|
|
181
|
+
if (!isRegisteredStatement(stmt.name)) {
|
|
182
|
+
throw new Error(
|
|
183
|
+
`Cannot encode unregistered statement "${readableStatementName(stmt.name)}": it is not registered in this copy of @xano/sdk. A def is encoded by the SDK copy that built it \u2014 when two copies are loaded (a global \`xanosdk\` and a project install), run the project's own (\`npx xanosdk\`), or encode through the def's own workspace.`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
assertAnnotations(stmt);
|
|
187
|
+
const output = {
|
|
188
|
+
items: [],
|
|
189
|
+
filters: [],
|
|
190
|
+
customize: false,
|
|
191
|
+
...stmt.output ?? {}
|
|
192
|
+
};
|
|
193
|
+
const sr = stmt.settings_registry;
|
|
194
|
+
const settings_registry = sr == null || Array.isArray(sr) && sr.length === 0 ? null : sr;
|
|
195
|
+
return {
|
|
196
|
+
as: stmt.as ?? "",
|
|
197
|
+
name: stmt.name,
|
|
198
|
+
_xsid: "",
|
|
199
|
+
addon: stmt.addon ?? [],
|
|
200
|
+
input: (stmt.input ?? []).map(fullInputEntry),
|
|
201
|
+
mocks: stmt.mocks ?? {},
|
|
202
|
+
output,
|
|
203
|
+
context: stmt.context,
|
|
204
|
+
runtime: stmt.runtime ?? null,
|
|
205
|
+
disabled: stmt.disabled ?? false,
|
|
206
|
+
description: stmt.description ?? "",
|
|
207
|
+
settings_registry
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export {
|
|
212
|
+
encodeMockMap,
|
|
213
|
+
readableStatementName,
|
|
214
|
+
ANNOTATION_KEYS,
|
|
215
|
+
OPTION_KEYS,
|
|
216
|
+
annotate,
|
|
217
|
+
statements,
|
|
218
|
+
RAW_ENVELOPE,
|
|
219
|
+
registerStatement,
|
|
220
|
+
registerFactoryPaths,
|
|
221
|
+
statementLabel,
|
|
222
|
+
encodeStack,
|
|
223
|
+
isRegisteredStatement,
|
|
224
|
+
getStatementFactory,
|
|
225
|
+
markStatement,
|
|
226
|
+
statementMark,
|
|
227
|
+
encodeStatement
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=chunk-YU4HSQW7.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveRef
|
|
3
|
+
} from "./chunk-NZOWWHU5.js";
|
|
4
|
+
|
|
5
|
+
// src/refs/auth.ts
|
|
6
|
+
function resolveAuthRef(hostLabel, host, auth) {
|
|
7
|
+
if (auth === void 0 || auth === false || auth === null) return false;
|
|
8
|
+
if (auth === true) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
`${hostLabel} "${host}": \`auth: true\` is no longer supported. Pass the auth table (e.g. \`auth: user\` for a \`table({ auth: true })\`) or its numeric id.`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
if (typeof auth === "number") {
|
|
14
|
+
if (!Number.isInteger(auth) || auth <= 0) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`${hostLabel} "${host}": numeric \`auth\` must be a positive integer \`dbo.id\` (got ${auth}). Use \`false\` for no auth, or pass the auth table def/name.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return auth;
|
|
20
|
+
}
|
|
21
|
+
return resolveRef("dbo", auth);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
resolveAuthRef
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=chunk-ZDPP6RKB.js.map
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// src/emit/npm.ts
|
|
2
|
+
import { spawn, spawnSync } from "child_process";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
function findNpmCli(nodeExecPath = process.execPath) {
|
|
6
|
+
const bin = dirname(nodeExecPath);
|
|
7
|
+
const tail = ["node_modules", "npm", "bin", "npm-cli.js"];
|
|
8
|
+
const candidates = [
|
|
9
|
+
join(bin, ...tail),
|
|
10
|
+
join(bin, "..", "lib", ...tail),
|
|
11
|
+
join(bin, "..", "libexec", "lib", ...tail)
|
|
12
|
+
];
|
|
13
|
+
return candidates.find((c) => existsSync(c));
|
|
14
|
+
}
|
|
15
|
+
function npmCommand(platform, args, nodeExecPath = process.execPath, resolveNpmCli = findNpmCli) {
|
|
16
|
+
if (platform !== "win32") return { file: "npm", args, shell: false };
|
|
17
|
+
const cli = resolveNpmCli(nodeExecPath);
|
|
18
|
+
if (cli !== void 0) return { file: nodeExecPath, args: [cli, ...args], shell: false };
|
|
19
|
+
return { file: "npm.cmd", args: args.map(quoteForCmd), shell: true };
|
|
20
|
+
}
|
|
21
|
+
function quoteForCmd(arg) {
|
|
22
|
+
if (arg !== "" && !/[\s"&|<>^()%!]/.test(arg)) return arg;
|
|
23
|
+
const escaped = arg.replace(/(\\*)"/g, '$1$1""').replace(/(\\*)$/, "$1$1");
|
|
24
|
+
return `"${escaped}"`;
|
|
25
|
+
}
|
|
26
|
+
function runNpm(args, cwd, opts) {
|
|
27
|
+
const stdout = opts?.stdout === "stderr" ? 2 : "inherit";
|
|
28
|
+
const npm = managerCommand(opts?.manager, args);
|
|
29
|
+
const res = spawnSync(npm.file, [...npm.args], {
|
|
30
|
+
cwd,
|
|
31
|
+
stdio: ["inherit", stdout, "inherit"],
|
|
32
|
+
shell: npm.shell,
|
|
33
|
+
// Bounded on the same budget as the captured runs. This one STREAMS to the
|
|
34
|
+
// user's terminal, so a stall is at least visible — but visible is not the
|
|
35
|
+
// same as escapable in CI, where nobody is there to press Ctrl-C.
|
|
36
|
+
timeout: opts?.timeoutMs ?? NPM_RUN_TIMEOUT_MS,
|
|
37
|
+
killSignal: "SIGKILL"
|
|
38
|
+
});
|
|
39
|
+
return res.status ?? 1;
|
|
40
|
+
}
|
|
41
|
+
function runNpmStreaming(args, cwd, opts) {
|
|
42
|
+
const stdout = opts?.stdout === "stderr" ? 2 : "inherit";
|
|
43
|
+
const npm = managerCommand(opts?.manager, args);
|
|
44
|
+
return new Promise((resolve) => {
|
|
45
|
+
const child = spawn(npm.file, [...npm.args], { cwd, stdio: ["inherit", stdout, "inherit"], shell: npm.shell });
|
|
46
|
+
const timer = setTimeout(() => child.kill("SIGKILL"), opts?.timeoutMs ?? NPM_RUN_TIMEOUT_MS);
|
|
47
|
+
const settle = (status) => {
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
resolve(status);
|
|
50
|
+
};
|
|
51
|
+
child.once("error", () => settle(1));
|
|
52
|
+
child.once("close", (code) => settle(code ?? 1));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function managerCommand(manager, args) {
|
|
56
|
+
if (manager === void 0 || manager === "npm") return npmCommand(process.platform, args);
|
|
57
|
+
if (process.platform !== "win32") return { file: manager, args, shell: false };
|
|
58
|
+
return { file: `${manager}.cmd`, args: args.map(quoteForCmd), shell: true };
|
|
59
|
+
}
|
|
60
|
+
function runNpmQuiet(args, cwd, opts = {}) {
|
|
61
|
+
return captureCommand(managerCommand(opts.manager, args), cwd, opts);
|
|
62
|
+
}
|
|
63
|
+
var NPM_RUN_TIMEOUT_MS = 10 * 6e4;
|
|
64
|
+
function isPeerConflict(stderr) {
|
|
65
|
+
return /ERESOLVE|peer dep|peerinvalid/i.test(stderr);
|
|
66
|
+
}
|
|
67
|
+
function captureCommand(npm, cwd, opts = {}) {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
const child = spawn(npm.file, [...npm.args], {
|
|
70
|
+
cwd,
|
|
71
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
72
|
+
shell: npm.shell
|
|
73
|
+
});
|
|
74
|
+
let output = "";
|
|
75
|
+
const budget = opts.timeoutMs ?? NPM_RUN_TIMEOUT_MS;
|
|
76
|
+
let timedOut = false;
|
|
77
|
+
let escalation;
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
timedOut = true;
|
|
80
|
+
child.kill("SIGTERM");
|
|
81
|
+
escalation = setTimeout(() => {
|
|
82
|
+
child.kill("SIGKILL");
|
|
83
|
+
detach();
|
|
84
|
+
done(stalled());
|
|
85
|
+
}, 5e3);
|
|
86
|
+
escalation.unref();
|
|
87
|
+
}, budget);
|
|
88
|
+
timer.unref();
|
|
89
|
+
const done = (result) => {
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
if (escalation !== void 0) clearTimeout(escalation);
|
|
92
|
+
resolve(result);
|
|
93
|
+
};
|
|
94
|
+
const detach = () => {
|
|
95
|
+
child.stdout?.destroy();
|
|
96
|
+
child.stderr?.destroy();
|
|
97
|
+
child.unref();
|
|
98
|
+
};
|
|
99
|
+
const stalled = () => {
|
|
100
|
+
const reason = `npm timed out after ${Math.round(budget / 1e3)}s and was killed. A registry that accepts the connection and then says nothing looks exactly like this.`;
|
|
101
|
+
return { status: 1, output: output !== "" ? `${output}
|
|
102
|
+
${reason}` : reason };
|
|
103
|
+
};
|
|
104
|
+
const collect = (stream) => {
|
|
105
|
+
stream?.setEncoding("utf8");
|
|
106
|
+
stream?.on("data", (chunk) => {
|
|
107
|
+
output += chunk;
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
collect(child.stdout);
|
|
111
|
+
collect(child.stderr);
|
|
112
|
+
child.on("error", (error) => {
|
|
113
|
+
done({ status: 1, output: output !== "" ? output : describeSpawnFailure(npm.file, error) });
|
|
114
|
+
});
|
|
115
|
+
child.on("close", (code) => {
|
|
116
|
+
const status = code ?? 1;
|
|
117
|
+
if (timedOut) {
|
|
118
|
+
const killed = stalled();
|
|
119
|
+
done({ ...killed, status: status === 0 ? 1 : status });
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
done({
|
|
123
|
+
// A failure with nothing to show still has to say something, and the
|
|
124
|
+
// something must be about THIS command: npm silenced by a `loglevel`
|
|
125
|
+
// in .npmrc, or killed by a signal, prints nothing at all.
|
|
126
|
+
output: output !== "" ? output : `npm exited ${status} without printing anything.`,
|
|
127
|
+
status
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function npmViewVersion(pkg, cwd) {
|
|
133
|
+
const npm = npmCommand(process.platform, ["view", pkg, "version"]);
|
|
134
|
+
const res = spawnSync(npm.file, [...npm.args], {
|
|
135
|
+
cwd,
|
|
136
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
137
|
+
encoding: "utf8",
|
|
138
|
+
shell: npm.shell,
|
|
139
|
+
// Bounded, like every other outbound call in this CLI. A registry that
|
|
140
|
+
// accepts the connection and then says nothing — a stalled proxy, a
|
|
141
|
+
// captive portal — would otherwise hang the command with no way out but
|
|
142
|
+
// Ctrl-C, and this one runs BEFORE the user has been asked anything.
|
|
143
|
+
timeout: NPM_VIEW_TIMEOUT_MS,
|
|
144
|
+
killSignal: "SIGKILL"
|
|
145
|
+
});
|
|
146
|
+
const stderr = (res.stderr ?? "").trim();
|
|
147
|
+
const version = (res.stdout ?? "").trim();
|
|
148
|
+
if ((res.status ?? 1) !== 0 || version === "") {
|
|
149
|
+
if (stderr !== "") return { ok: false, stderr };
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
stderr: res.error !== void 0 ? describeSpawnFailure(npm.file, res.error) : "npm exited without reporting a version."
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return { ok: true, version };
|
|
156
|
+
}
|
|
157
|
+
var NPM_VIEW_TIMEOUT_MS = 3e4;
|
|
158
|
+
function describeSpawnFailure(file, error) {
|
|
159
|
+
return `Could not run ${file}: ${error.message}`;
|
|
160
|
+
}
|
|
161
|
+
function condenseNpmError(stderr) {
|
|
162
|
+
const kept = [];
|
|
163
|
+
for (const line of stderr.split("\n")) {
|
|
164
|
+
const body = line.replace(/^npm (?:error|ERR!)\s?/, "");
|
|
165
|
+
if (body.trim() === "") continue;
|
|
166
|
+
if (/^\s*at\s/.test(body)) continue;
|
|
167
|
+
if (/^\s{2,}\S+:\s/.test(body)) continue;
|
|
168
|
+
if (/^\s*[{}],?\s*$/.test(body)) continue;
|
|
169
|
+
if (/^A complete log of this run can be found in: .*\*\*\*/.test(body.trim())) {
|
|
170
|
+
kept.push(`${line.slice(0, line.indexOf(body))}A complete log of this run is in npm's debug log directory (\`_logs\` under \`npm config get cache\`); npm masked part of the path it printed.`);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
kept.push(/\{\s*$/.test(body) ? line.replace(/\s*\{\s*$/, "") : line);
|
|
174
|
+
}
|
|
175
|
+
return kept.join("\n").trim();
|
|
176
|
+
}
|
|
177
|
+
function sameNpmFailure(a, b) {
|
|
178
|
+
return a === b || npmFailureKey(a) === npmFailureKey(b);
|
|
179
|
+
}
|
|
180
|
+
function npmFailureKey(reason) {
|
|
181
|
+
return reason.replace(/https?:\/\/\S+/g, "<url>").replace(/'(?:@[^/'\s]+\/)?[^@'\s]+@[^'\s]*'/g, "'<package>'").replace(/(?:[A-Za-z]:)?[\\/]\S*\.log\b/g, "<log>").replace(/\d{4}-\d{2}-\d{2}T[\d_:.-]+Z?/g, "<time>");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
runNpm,
|
|
186
|
+
runNpmStreaming,
|
|
187
|
+
runNpmQuiet,
|
|
188
|
+
NPM_RUN_TIMEOUT_MS,
|
|
189
|
+
isPeerConflict,
|
|
190
|
+
npmViewVersion,
|
|
191
|
+
condenseNpmError,
|
|
192
|
+
sameNpmFailure
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=chunk-ZFDZKNGG.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
retryCommand,
|
|
3
|
+
withheldNote
|
|
4
|
+
} from "./chunk-T5KELPAR.js";
|
|
5
|
+
import {
|
|
6
|
+
checkOneName,
|
|
7
|
+
setRunNameContext
|
|
8
|
+
} from "./chunk-PTHVMXZI.js";
|
|
9
|
+
import {
|
|
10
|
+
shellQuote
|
|
11
|
+
} from "./chunk-5ZSO4T2G.js";
|
|
12
|
+
|
|
13
|
+
// src/emit/name-argument.ts
|
|
14
|
+
var SLOT = "XANOSDKNAMESLOT";
|
|
15
|
+
function assertOneName(value, what, opts = {}) {
|
|
16
|
+
const { args } = opts;
|
|
17
|
+
checkOneName(value, what, {
|
|
18
|
+
...opts.helpFor === void 0 ? {} : { helpFor: opts.helpFor },
|
|
19
|
+
...opts.echo === void 0 ? {} : { echo: opts.echo },
|
|
20
|
+
...runContextOf(args)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function runContextOf(args) {
|
|
24
|
+
return {
|
|
25
|
+
...args?.command === void 0 ? {} : { verb: `xanosdk ${args.command}${args.subcommand === void 0 ? "" : ` ${args.subcommand}`}` },
|
|
26
|
+
loop: (raw, prefix, names) => loopOver(raw, prefix, names, args)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function noteRunArgs(args) {
|
|
30
|
+
setRunNameContext(args === void 0 ? void 0 : runContextOf(args));
|
|
31
|
+
}
|
|
32
|
+
function loopOver(value, prefix, names, args) {
|
|
33
|
+
if (args?.argv === void 0) return void 0;
|
|
34
|
+
const argv = args.argv;
|
|
35
|
+
const at = argv.findIndex((t) => t === value || t.startsWith("--") && t.endsWith(`=${value}`));
|
|
36
|
+
if (at === -1) return void 0;
|
|
37
|
+
const token = argv[at];
|
|
38
|
+
const swapped = argv.map((t, i) => i === at ? `${token.slice(0, token.length - value.length)}${prefix}${SLOT}` : t);
|
|
39
|
+
const { command, withheld } = retryCommand({ ...args, argv: swapped });
|
|
40
|
+
const note = withheldNote(withheld).trim();
|
|
41
|
+
return `for n in ${names.map(shellQuote).join(" ")}; do ${command.replace(SLOT, '"$n"')}; done${note === "" ? "" : `
|
|
42
|
+
${note}`}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
assertOneName,
|
|
47
|
+
noteRunArgs
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=chunk-ZIY7RNUT.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/deploy/keep-data.ts
|
|
2
|
+
function readFilledMarker(value) {
|
|
3
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
4
|
+
const { url, at } = value;
|
|
5
|
+
if (typeof url !== "string" || url === "" || typeof at !== "number") return void 0;
|
|
6
|
+
return { url, at };
|
|
7
|
+
}
|
|
8
|
+
function withValidFilled(record) {
|
|
9
|
+
const { filled, ...rest } = record;
|
|
10
|
+
const marker = readFilledMarker(filled);
|
|
11
|
+
return marker === void 0 ? rest : { ...rest, filled: marker };
|
|
12
|
+
}
|
|
13
|
+
function filledAt(url) {
|
|
14
|
+
return { url, at: Date.now() };
|
|
15
|
+
}
|
|
16
|
+
function selectDeployArm(input) {
|
|
17
|
+
if (!input.keepData) return { arm: "replace" };
|
|
18
|
+
if (input.reset) return { arm: "replace", skipped: "reset" };
|
|
19
|
+
if (input.created) return { arm: "replace", skipped: input.hadRecord ? "recreated" : "new" };
|
|
20
|
+
if (input.priorFilled === void 0) return { arm: "replace", skipped: "never-filled" };
|
|
21
|
+
if (input.priorFilled.url !== input.url) return { arm: "replace", skipped: "recreated" };
|
|
22
|
+
return { arm: "merge" };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
withValidFilled,
|
|
27
|
+
filledAt,
|
|
28
|
+
selectDeployArm
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-ZYJP6BOO.js.map
|