@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,413 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findNonJson,
|
|
3
|
+
nonJsonMessage
|
|
4
|
+
} from "./chunk-H2V3N23D.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveDocumentationTokens
|
|
7
|
+
} from "./chunk-3JDU4VRL.js";
|
|
8
|
+
import {
|
|
9
|
+
appNamesByGuid,
|
|
10
|
+
displayLockKey,
|
|
11
|
+
lockNameForObject,
|
|
12
|
+
sdkKindName
|
|
13
|
+
} from "./chunk-6MR5TI5V.js";
|
|
14
|
+
import {
|
|
15
|
+
rawDeriveGuid
|
|
16
|
+
} from "./chunk-NZOWWHU5.js";
|
|
17
|
+
import {
|
|
18
|
+
sha1Bytes
|
|
19
|
+
} from "./chunk-OHX6MIUZ.js";
|
|
20
|
+
|
|
21
|
+
// src/workspace/export.ts
|
|
22
|
+
var BUNDLE_APP = "xano";
|
|
23
|
+
var BUNDLE_VERSION_JSON = "1.03";
|
|
24
|
+
var PAYLOAD_ARRAY_KEYS = [
|
|
25
|
+
"dbo",
|
|
26
|
+
"addon",
|
|
27
|
+
"function",
|
|
28
|
+
"middleware",
|
|
29
|
+
"trigger",
|
|
30
|
+
"task",
|
|
31
|
+
"query",
|
|
32
|
+
"tool",
|
|
33
|
+
// MCP prompts and resources: after `tool` and before `toolset`, because an MCP
|
|
34
|
+
// server resolves its `prompts`/`resources` references by guid on import.
|
|
35
|
+
"prompt",
|
|
36
|
+
"resource",
|
|
37
|
+
"toolset",
|
|
38
|
+
"app",
|
|
39
|
+
// Prose an agent reads, not an object anything resolves — it references
|
|
40
|
+
// nothing and nothing references it, so its position is arbitrary.
|
|
41
|
+
"knowledge",
|
|
42
|
+
// A knowledge item's reference files. A CHILD section, not a kind of its own:
|
|
43
|
+
// each row names its parent by guid, so knowledge must precede it.
|
|
44
|
+
"knowledge_file",
|
|
45
|
+
// Realtime, in dependency order: a channel resolves its server, and a message
|
|
46
|
+
// resolves both. They sit after `app` so every object they can reference
|
|
47
|
+
// (tables for auth, api groups) is already in place.
|
|
48
|
+
"realtime_server",
|
|
49
|
+
"channel",
|
|
50
|
+
"message",
|
|
51
|
+
// A container workload. Independent of every other object — nothing
|
|
52
|
+
// references it and it references nothing — so its position is arbitrary.
|
|
53
|
+
"microservice",
|
|
54
|
+
"vault",
|
|
55
|
+
"market_item",
|
|
56
|
+
"run_install",
|
|
57
|
+
"action_package_install",
|
|
58
|
+
"env",
|
|
59
|
+
"workflow_test",
|
|
60
|
+
"service",
|
|
61
|
+
"branch"
|
|
62
|
+
];
|
|
63
|
+
function phpEncodeString(str) {
|
|
64
|
+
let out = '"';
|
|
65
|
+
for (const ch of str) {
|
|
66
|
+
const code = ch.codePointAt(0);
|
|
67
|
+
switch (ch) {
|
|
68
|
+
case '"':
|
|
69
|
+
out += "\\u0022";
|
|
70
|
+
break;
|
|
71
|
+
// JSON_HEX_QUOT
|
|
72
|
+
case "\\":
|
|
73
|
+
out += "\\\\";
|
|
74
|
+
break;
|
|
75
|
+
case "<":
|
|
76
|
+
out += "\\u003C";
|
|
77
|
+
break;
|
|
78
|
+
// JSON_HEX_TAG
|
|
79
|
+
case ">":
|
|
80
|
+
out += "\\u003E";
|
|
81
|
+
break;
|
|
82
|
+
// JSON_HEX_TAG
|
|
83
|
+
case "&":
|
|
84
|
+
out += "\\u0026";
|
|
85
|
+
break;
|
|
86
|
+
// JSON_HEX_AMP
|
|
87
|
+
case "'":
|
|
88
|
+
out += "\\u0027";
|
|
89
|
+
break;
|
|
90
|
+
// JSON_HEX_APOS
|
|
91
|
+
case "\b":
|
|
92
|
+
out += "\\b";
|
|
93
|
+
break;
|
|
94
|
+
case "\f":
|
|
95
|
+
out += "\\f";
|
|
96
|
+
break;
|
|
97
|
+
case "\n":
|
|
98
|
+
out += "\\n";
|
|
99
|
+
break;
|
|
100
|
+
case "\r":
|
|
101
|
+
out += "\\r";
|
|
102
|
+
break;
|
|
103
|
+
case " ":
|
|
104
|
+
out += "\\t";
|
|
105
|
+
break;
|
|
106
|
+
// PHP escapes the two line terminators even under JSON_UNESCAPED_UNICODE
|
|
107
|
+
// — that flag is not JSON_UNESCAPED_LINE_TERMINATORS, which the engine
|
|
108
|
+
// does not pass.
|
|
109
|
+
case "\u2028":
|
|
110
|
+
out += "\\u2028";
|
|
111
|
+
break;
|
|
112
|
+
case "\u2029":
|
|
113
|
+
out += "\\u2029";
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
out += code < 32 ? "\\u" + code.toString(16).padStart(4, "0") : ch;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return out + '"';
|
|
120
|
+
}
|
|
121
|
+
var PHP_INT_MAX = 9223372036854775807n;
|
|
122
|
+
function phpEncodeNumber(value) {
|
|
123
|
+
if (!Number.isFinite(value)) return "0";
|
|
124
|
+
const text = JSON.stringify(value);
|
|
125
|
+
if (!/[.eE]/.test(text)) {
|
|
126
|
+
const n = BigInt(text);
|
|
127
|
+
return n > PHP_INT_MAX || n < -PHP_INT_MAX - 1n ? `"${text}"` : text;
|
|
128
|
+
}
|
|
129
|
+
const [mantissaText, exponentText] = Math.abs(value).toExponential().split("e");
|
|
130
|
+
const exponent = Number(exponentText);
|
|
131
|
+
if (exponent >= -4 && exponent < 17) return text;
|
|
132
|
+
const digits = mantissaText.replace(".", "").replace(/0+$/, "") || "0";
|
|
133
|
+
const mantissa = digits.length > 1 ? `${digits[0]}.${digits.slice(1)}` : `${digits}.0`;
|
|
134
|
+
const sign = exponent < 0 ? "-" : "+";
|
|
135
|
+
return `${value < 0 ? "-" : ""}${mantissa}e${sign}${Math.abs(exponent)}`;
|
|
136
|
+
}
|
|
137
|
+
function phpJsonEncode(value) {
|
|
138
|
+
const out = [];
|
|
139
|
+
const stack = [{ value }];
|
|
140
|
+
while (stack.length > 0) {
|
|
141
|
+
const frame = stack.pop();
|
|
142
|
+
if ("lit" in frame) {
|
|
143
|
+
out.push(frame.lit);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const current = frame.value;
|
|
147
|
+
if (current === null || current === void 0) {
|
|
148
|
+
out.push("null");
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
switch (typeof current) {
|
|
152
|
+
case "string":
|
|
153
|
+
out.push(phpEncodeString(current));
|
|
154
|
+
continue;
|
|
155
|
+
case "number":
|
|
156
|
+
out.push(phpEncodeNumber(current));
|
|
157
|
+
continue;
|
|
158
|
+
case "boolean":
|
|
159
|
+
out.push(current ? "true" : "false");
|
|
160
|
+
continue;
|
|
161
|
+
case "object":
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
out.push("null");
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (Array.isArray(current)) {
|
|
168
|
+
stack.push({ lit: "]" });
|
|
169
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
170
|
+
stack.push({ value: current[i] });
|
|
171
|
+
if (i > 0) stack.push({ lit: "," });
|
|
172
|
+
}
|
|
173
|
+
stack.push({ lit: "[" });
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const obj = current;
|
|
177
|
+
const keys = Object.keys(obj).filter((key) => obj[key] !== void 0);
|
|
178
|
+
if (keys.length > 0 && keys.every((key, i) => key === String(i))) {
|
|
179
|
+
stack.push({ lit: "]" });
|
|
180
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
181
|
+
stack.push({ value: obj[keys[i]] });
|
|
182
|
+
if (i > 0) stack.push({ lit: "," });
|
|
183
|
+
}
|
|
184
|
+
stack.push({ lit: "[" });
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
stack.push({ lit: "}" });
|
|
188
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
189
|
+
const key = keys[i];
|
|
190
|
+
stack.push({ value: obj[key] });
|
|
191
|
+
stack.push({ lit: phpEncodeString(key) + ":" });
|
|
192
|
+
if (i > 0) stack.push({ lit: "," });
|
|
193
|
+
}
|
|
194
|
+
stack.push({ lit: "{" });
|
|
195
|
+
}
|
|
196
|
+
return out.join("");
|
|
197
|
+
}
|
|
198
|
+
function base64websafe(bytes) {
|
|
199
|
+
let bin = "";
|
|
200
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
201
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ".");
|
|
202
|
+
}
|
|
203
|
+
function calcSignatureJson(exportObj) {
|
|
204
|
+
const sorted = {};
|
|
205
|
+
for (const key of Object.keys(exportObj).sort()) {
|
|
206
|
+
sorted[key] = exportObj[key];
|
|
207
|
+
}
|
|
208
|
+
return base64websafe(sha1Bytes(phpJsonEncode(sorted)));
|
|
209
|
+
}
|
|
210
|
+
function signatureHolds(text) {
|
|
211
|
+
let parsed;
|
|
212
|
+
try {
|
|
213
|
+
parsed = JSON.parse(text);
|
|
214
|
+
} catch {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return false;
|
|
218
|
+
const { sig, ...unsigned } = parsed;
|
|
219
|
+
if (sig === void 0) return void 0;
|
|
220
|
+
if (sig === calcSignatureJson(unsigned)) return true;
|
|
221
|
+
const members = topLevelMembers(text);
|
|
222
|
+
if (members === void 0) return false;
|
|
223
|
+
const body = members.filter((m) => m.key !== "sig").sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0).map((m) => `${m.rawKey}:${m.rawValue}`).join(",");
|
|
224
|
+
return sig === base64websafe(sha1Bytes(`{${body}}`));
|
|
225
|
+
}
|
|
226
|
+
function topLevelMembers(text) {
|
|
227
|
+
const out = [];
|
|
228
|
+
let i = text.indexOf("{");
|
|
229
|
+
if (i === -1 || text.slice(0, i).trim() !== "") return void 0;
|
|
230
|
+
i++;
|
|
231
|
+
const skipWs = () => {
|
|
232
|
+
while (i < text.length && /\s/.test(text[i])) i++;
|
|
233
|
+
};
|
|
234
|
+
const endOfString = (from) => {
|
|
235
|
+
let j = from + 1;
|
|
236
|
+
while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
|
|
237
|
+
return j;
|
|
238
|
+
};
|
|
239
|
+
skipWs();
|
|
240
|
+
if (text[i] === "}") return out;
|
|
241
|
+
while (i < text.length) {
|
|
242
|
+
skipWs();
|
|
243
|
+
if (text[i] !== '"') return void 0;
|
|
244
|
+
const keyEnd = endOfString(i);
|
|
245
|
+
const rawKey = text.slice(i, keyEnd + 1);
|
|
246
|
+
i = keyEnd + 1;
|
|
247
|
+
skipWs();
|
|
248
|
+
if (text[i] !== ":") return void 0;
|
|
249
|
+
i++;
|
|
250
|
+
skipWs();
|
|
251
|
+
const start = i;
|
|
252
|
+
let depth = 0;
|
|
253
|
+
while (i < text.length) {
|
|
254
|
+
const ch = text[i];
|
|
255
|
+
if (ch === '"') i = endOfString(i);
|
|
256
|
+
else if (ch === "{" || ch === "[") depth++;
|
|
257
|
+
else if (ch === "}" || ch === "]") {
|
|
258
|
+
if (depth === 0) break;
|
|
259
|
+
depth--;
|
|
260
|
+
} else if (ch === "," && depth === 0) break;
|
|
261
|
+
i++;
|
|
262
|
+
}
|
|
263
|
+
out.push({ key: JSON.parse(rawKey), rawKey, rawValue: text.slice(start, i).trimEnd() });
|
|
264
|
+
if (text[i] === "}") return out;
|
|
265
|
+
i++;
|
|
266
|
+
}
|
|
267
|
+
return void 0;
|
|
268
|
+
}
|
|
269
|
+
function assertUniqueGuids(payload, lock) {
|
|
270
|
+
const seen = /* @__PURE__ */ new Map();
|
|
271
|
+
const appNames = appNamesByGuid(payload.app);
|
|
272
|
+
for (const key of PAYLOAD_ARRAY_KEYS) {
|
|
273
|
+
const arr = payload[key];
|
|
274
|
+
if (!Array.isArray(arr)) continue;
|
|
275
|
+
for (const obj of arr) {
|
|
276
|
+
if (!obj || typeof obj !== "object") continue;
|
|
277
|
+
const guid = obj.guid;
|
|
278
|
+
if (typeof guid !== "string") continue;
|
|
279
|
+
const name = obj.name;
|
|
280
|
+
const shown = typeof name === "string" ? name : "<unnamed>";
|
|
281
|
+
const label = `${sdkKindName(key, obj)} "${shown}"`;
|
|
282
|
+
const held = seen.get(guid);
|
|
283
|
+
const prev = held?.label;
|
|
284
|
+
if (held !== void 0) {
|
|
285
|
+
const pinnedBy = lock ? Object.entries(lock.objects).find(([, e]) => e.guid === guid)?.[0] : void 0;
|
|
286
|
+
const legacyQueryKey = key === "query" && held.key === key && pinnedBy !== void 0 && pinnedBy.startsWith("query:") && !pinnedBy.includes("|") ? pinnedBy : void 0;
|
|
287
|
+
const lockNote = legacyQueryKey ? legacyQueryNote(legacyQueryKey, guid, [held.obj, obj], appNames, lock) : held.key !== key ? (
|
|
288
|
+
// Two kinds never derive one guid: one of them pins it (`guid:`) — a
|
|
289
|
+
// lock entry holding it too is not a rename re-deriving a name's
|
|
290
|
+
// guid, which only ever collides within a kind (E2E pass 22).
|
|
291
|
+
` Two different kinds cannot share one identity, and no name derives another kind's guid \u2014 an explicit \`guid\` set on one of them is the other's` + (pinnedBy ? ` \u2014 lock entry ${shownEntry(pinnedBy)} pins it` : "") + `. Remove the explicit guid, or set the one the object really has.`
|
|
292
|
+
) : pinnedBy ? sameKindPinnedNote(key, guid, pinnedBy, [held, { label, obj }], appNames) : (
|
|
293
|
+
// No guid-pin advice: a lock entry is keyed by name and holds ONE
|
|
294
|
+
// guid, so two pinned guids under one name refuse at `export --lock`.
|
|
295
|
+
key === "toolset" ? ` Agents and MCP servers share ONE name space (identity is derived from the name alone, across both kinds). Rename one.` : ` Object identity is derived from (type, name) \u2014 for a query, (api group, verb, name) \u2014 so two objects of the same kind compose the same identity. Rename one.`
|
|
296
|
+
);
|
|
297
|
+
const err = new Error(`Duplicate object guid (${guid}) shared by ${prev} and ${label}.` + lockNote);
|
|
298
|
+
if (held.key !== key) Object.assign(err, { code: "SDK_KIND_CONFLICT", exitCode: 2 });
|
|
299
|
+
else if (pinnedBy !== void 0) {
|
|
300
|
+
Object.assign(err, { code: "SDK_IDENTITY_CONFLICT", exitCode: 2, lockEntry: pinnedBy });
|
|
301
|
+
}
|
|
302
|
+
throw err;
|
|
303
|
+
}
|
|
304
|
+
seen.set(guid, { label, key, obj });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function sameKindPinnedNote(payloadKey, guid, pinnedBy, pair, appNames) {
|
|
309
|
+
const keyOf = (obj) => {
|
|
310
|
+
const name = obj.name;
|
|
311
|
+
return typeof name === "string" ? `${payloadKey}:${lockNameForObject(payloadKey, obj, appNames)}` : void 0;
|
|
312
|
+
};
|
|
313
|
+
const rederives = pair.find(({ obj }) => {
|
|
314
|
+
const k = keyOf(obj);
|
|
315
|
+
return k !== void 0 && k !== pinnedBy && rawDeriveGuid(k) === guid;
|
|
316
|
+
});
|
|
317
|
+
if (rederives !== void 0) {
|
|
318
|
+
return ` This guid is pinned by lock entry ${shownEntry(pinnedBy)} \u2014 that entry was moved by \`xanosdk lock rename\`, and ${rederives.label} now re-derives the old name's guid. Pin a distinct explicit \`guid\` on ${rederives.label}, or update the lock entry.`;
|
|
319
|
+
}
|
|
320
|
+
const other = pair.find(({ obj }) => keyOf(obj) !== pinnedBy);
|
|
321
|
+
return ` This guid is pinned by lock entry ${shownEntry(pinnedBy)}, and no name derives it for ${other?.label ?? "the other object"} \u2014 an explicit \`guid\` set on it is that entry's. Remove the explicit guid, or set the one the object really has.`;
|
|
322
|
+
}
|
|
323
|
+
function shownEntry(key) {
|
|
324
|
+
const shown = displayLockKey(key);
|
|
325
|
+
return shown === key ? `"${key}"` : `"${shown}" (stored as "${key}" in xano.lock)`;
|
|
326
|
+
}
|
|
327
|
+
function legacyQueryNote(legacyKey, guid, claimants, appNames, lock) {
|
|
328
|
+
const oldName = legacyKey.slice("query:".length);
|
|
329
|
+
const names = claimants.map((o) => lockNameForObject("query", o, appNames));
|
|
330
|
+
const landed = /* @__PURE__ */ new Set();
|
|
331
|
+
for (const record of Object.values(lock?.landed ?? {})) {
|
|
332
|
+
for (const [k, e] of Object.entries(record)) if (e.guid === guid) landed.add(k);
|
|
333
|
+
}
|
|
334
|
+
const existing = names.filter((n) => landed.has(`query:${n}`));
|
|
335
|
+
const command = (n) => `\`xanosdk lock rename query ${oldName} "${n}"\``;
|
|
336
|
+
const which = existing.length === 1 ? `"${existing[0]}", which this guid landed as: ${command(existing[0])}` : `the endpoint deployed before the other was added (no landing record says which): ` + names.map(command).join(" or ");
|
|
337
|
+
return ` Lock entry "${legacyKey}" pins it by NAME ALONE \u2014 a lock written before a query's identity included its api group and verb. Both of these queries claim it. Move it onto the one that already existed \u2014 ${which} (from the project root or the lock's directory; elsewhere add \`--lock=<path>\`), then re-export: that endpoint keeps its identity and the newcomer derives its own.`;
|
|
338
|
+
}
|
|
339
|
+
function buildContentEnvelope(rows) {
|
|
340
|
+
const unsigned = {
|
|
341
|
+
app: BUNDLE_APP,
|
|
342
|
+
version: BUNDLE_VERSION_JSON,
|
|
343
|
+
type: "content",
|
|
344
|
+
payload: rows
|
|
345
|
+
};
|
|
346
|
+
return { ...unsigned, sig: calcSignatureJson(unsigned) };
|
|
347
|
+
}
|
|
348
|
+
function mergeEnvOverrides(authored, overrides) {
|
|
349
|
+
if (!overrides || Object.keys(overrides).length === 0) return authored;
|
|
350
|
+
const list = Array.isArray(authored) ? authored.map((e) => ({ ...e })) : [];
|
|
351
|
+
const byName = new Map(list.map((e) => [String(e.name), e]));
|
|
352
|
+
for (const [name, value] of Object.entries(overrides)) {
|
|
353
|
+
const prior = byName.get(name);
|
|
354
|
+
if (prior) prior.value = value;
|
|
355
|
+
else list.push({ name, value, market_item: [] });
|
|
356
|
+
}
|
|
357
|
+
return list;
|
|
358
|
+
}
|
|
359
|
+
function assertNoFunctions(payload) {
|
|
360
|
+
for (const [key, section] of Object.entries(payload)) {
|
|
361
|
+
for (const obj of Array.isArray(section) ? section : [section]) {
|
|
362
|
+
const found = findNonJson(obj);
|
|
363
|
+
if (found === void 0) continue;
|
|
364
|
+
const name = obj?.name;
|
|
365
|
+
const owner = `${key} "${typeof name === "string" ? name : "?"}"`;
|
|
366
|
+
throw new Error(nonJsonMessage(owner, found.path === "" ? owner : `${owner}, at ${found.path}`, found.value));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
function buildBundle(args) {
|
|
371
|
+
const swept = resolveDocumentationTokens({
|
|
372
|
+
workspace: args.workspace ?? {},
|
|
373
|
+
apiGroups: args.sections.app,
|
|
374
|
+
values: {}
|
|
375
|
+
});
|
|
376
|
+
const sections = swept.apiGroups === void 0 ? args.sections : { ...args.sections, app: swept.apiGroups };
|
|
377
|
+
const workspace = swept.workspace;
|
|
378
|
+
const wsEnv = mergeEnvOverrides(workspace.env, args.envOverrides);
|
|
379
|
+
const payload = { partial: false, workspace };
|
|
380
|
+
for (const key of PAYLOAD_ARRAY_KEYS) {
|
|
381
|
+
payload[key] = sections[key] ?? [];
|
|
382
|
+
}
|
|
383
|
+
if (Array.isArray(wsEnv) && wsEnv.length > 0) {
|
|
384
|
+
payload.env = wsEnv;
|
|
385
|
+
workspace.env = [];
|
|
386
|
+
}
|
|
387
|
+
assertUniqueGuids(payload, args.lock);
|
|
388
|
+
assertNoFunctions(payload);
|
|
389
|
+
const unsigned = {
|
|
390
|
+
app: BUNDLE_APP,
|
|
391
|
+
version: BUNDLE_VERSION_JSON,
|
|
392
|
+
type: args.type ?? "workspace",
|
|
393
|
+
payload,
|
|
394
|
+
...args.knowledgeRead === true && knowledgeBodiesAllEmpty(payload) ? { knowledge_read: true } : {}
|
|
395
|
+
};
|
|
396
|
+
return { ...unsigned, sig: calcSignatureJson(unsigned) };
|
|
397
|
+
}
|
|
398
|
+
function knowledgeBodiesAllEmpty(payload) {
|
|
399
|
+
const knowledge = Array.isArray(payload.knowledge) ? payload.knowledge : [];
|
|
400
|
+
const files = Array.isArray(payload.knowledge_file) ? payload.knowledge_file.length : 0;
|
|
401
|
+
return knowledge.length > 0 && files === 0 && knowledge.every((k) => k?.content === "");
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export {
|
|
405
|
+
PAYLOAD_ARRAY_KEYS,
|
|
406
|
+
phpJsonEncode,
|
|
407
|
+
calcSignatureJson,
|
|
408
|
+
signatureHolds,
|
|
409
|
+
buildContentEnvelope,
|
|
410
|
+
buildBundle,
|
|
411
|
+
knowledgeBodiesAllEmpty
|
|
412
|
+
};
|
|
413
|
+
//# sourceMappingURL=chunk-LQCMKAJ7.js.map
|