@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.
Files changed (336) hide show
  1. package/CHANGELOG.md +788 -0
  2. package/LICENSE +21 -0
  3. package/README.md +541 -0
  4. package/dist/.build-fingerprint +1 -0
  5. package/dist/agent-file-refresh-ZEMK33AX.js +38 -0
  6. package/dist/answer-shape-K67TAAPY.js +33 -0
  7. package/dist/backend-dir-2U53CIAL.js +39 -0
  8. package/dist/backend-slot-7QXW2QYC.js +28 -0
  9. package/dist/bin.d.ts +1 -0
  10. package/dist/bin.js +255 -0
  11. package/dist/branch-NCRNWQBQ.js +61 -0
  12. package/dist/branch-commands-ACIRCEQJ.js +79 -0
  13. package/dist/bundle.d.ts +223 -0
  14. package/dist/bundle.js +153 -0
  15. package/dist/capture-WAXPD7DR.js +41 -0
  16. package/dist/chunk-27GWNP2I.js +23 -0
  17. package/dist/chunk-2CMJZDCL.js +177 -0
  18. package/dist/chunk-2EZ3ZJZZ.js +302 -0
  19. package/dist/chunk-2GNFDZA2.js +390 -0
  20. package/dist/chunk-2MNLRIOX.js +11 -0
  21. package/dist/chunk-2TFRR6JV.js +104 -0
  22. package/dist/chunk-2ZUEE4EK.js +408 -0
  23. package/dist/chunk-36JUQZVQ.js +22 -0
  24. package/dist/chunk-3DRXWLJ5.js +83 -0
  25. package/dist/chunk-3JDU4VRL.js +137 -0
  26. package/dist/chunk-3KZCLN4Z.js +241 -0
  27. package/dist/chunk-3LDULPRE.js +168 -0
  28. package/dist/chunk-3M4LFYNQ.js +111 -0
  29. package/dist/chunk-3XI5CTUE.js +22 -0
  30. package/dist/chunk-3YW23UFH.js +50 -0
  31. package/dist/chunk-45UIT5T2.js +862 -0
  32. package/dist/chunk-4BW2SG2N.js +46 -0
  33. package/dist/chunk-4KHEMC32.js +79 -0
  34. package/dist/chunk-4POWHT2K.js +321 -0
  35. package/dist/chunk-4Q2GN7NW.js +192 -0
  36. package/dist/chunk-5A2PLKZB.js +70 -0
  37. package/dist/chunk-5FBYXK5P.js +159 -0
  38. package/dist/chunk-5HVXPTU4.js +323 -0
  39. package/dist/chunk-5QU2P5CA.js +304 -0
  40. package/dist/chunk-5V5XU32D.js +191 -0
  41. package/dist/chunk-5ZSO4T2G.js +10 -0
  42. package/dist/chunk-622HUCZT.js +10 -0
  43. package/dist/chunk-65HWOMGV.js +177 -0
  44. package/dist/chunk-6ELFRN3P.js +365 -0
  45. package/dist/chunk-6HO3NCSJ.js +1055 -0
  46. package/dist/chunk-6IUMKYWI.js +457 -0
  47. package/dist/chunk-6KEB3C3U.js +65 -0
  48. package/dist/chunk-6MR5TI5V.js +987 -0
  49. package/dist/chunk-6NNTNXN7.js +157 -0
  50. package/dist/chunk-6PBR37LN.js +97 -0
  51. package/dist/chunk-6QXLMMT3.js +155 -0
  52. package/dist/chunk-6ZGJCBZS.js +224 -0
  53. package/dist/chunk-73IVBKMA.js +250 -0
  54. package/dist/chunk-7G3CTU7I.js +286 -0
  55. package/dist/chunk-A3UDOZB6.js +222 -0
  56. package/dist/chunk-A6E77GDW.js +85 -0
  57. package/dist/chunk-AHJWCYQO.js +660 -0
  58. package/dist/chunk-AKNCFVKZ.js +36 -0
  59. package/dist/chunk-AM4FKL4J.js +237 -0
  60. package/dist/chunk-AN6BL47T.js +26 -0
  61. package/dist/chunk-AOSYVMUS.js +147 -0
  62. package/dist/chunk-APWXY5SL.js +182 -0
  63. package/dist/chunk-AWEIIR2U.js +218 -0
  64. package/dist/chunk-AWQ7BQTQ.js +73 -0
  65. package/dist/chunk-BAUZOWGX.js +393 -0
  66. package/dist/chunk-BHACRS6R.js +940 -0
  67. package/dist/chunk-BWPNT55T.js +680 -0
  68. package/dist/chunk-C6RIMRU4.js +187 -0
  69. package/dist/chunk-CGVQZXYG.js +263 -0
  70. package/dist/chunk-CIMQZRRE.js +162 -0
  71. package/dist/chunk-CJHQKJU4.js +113 -0
  72. package/dist/chunk-CTMO46PK.js +1897 -0
  73. package/dist/chunk-D53J55C5.js +106 -0
  74. package/dist/chunk-D7VGG3WS.js +90 -0
  75. package/dist/chunk-DAD3ONIS.js +245 -0
  76. package/dist/chunk-DGWHAVRG.js +162 -0
  77. package/dist/chunk-DX4QR4B2.js +483 -0
  78. package/dist/chunk-EHP3WPEG.js +21 -0
  79. package/dist/chunk-ELP2HMXC.js +432 -0
  80. package/dist/chunk-ERVIASGL.js +21 -0
  81. package/dist/chunk-ET4Y4XCB.js +865 -0
  82. package/dist/chunk-ETO6LGLD.js +4750 -0
  83. package/dist/chunk-EUUUMY7J.js +24 -0
  84. package/dist/chunk-FQJ2TTHP.js +218 -0
  85. package/dist/chunk-FQOF7E2E.js +133 -0
  86. package/dist/chunk-FWD7AL6N.js +21 -0
  87. package/dist/chunk-FXFV3KU6.js +138 -0
  88. package/dist/chunk-FXRQOWTE.js +171 -0
  89. package/dist/chunk-G554NZNI.js +210 -0
  90. package/dist/chunk-GSGDWJB5.js +13 -0
  91. package/dist/chunk-H2V3N23D.js +66 -0
  92. package/dist/chunk-H5C7MBCR.js +159 -0
  93. package/dist/chunk-HHN734BU.js +371 -0
  94. package/dist/chunk-HRVBLCVJ.js +243 -0
  95. package/dist/chunk-HVRUQXGD.js +1264 -0
  96. package/dist/chunk-I4F5TCJH.js +130 -0
  97. package/dist/chunk-IDOTCMDV.js +57 -0
  98. package/dist/chunk-IGOLHKWF.js +427 -0
  99. package/dist/chunk-JGE7CAWB.js +148 -0
  100. package/dist/chunk-JTUKLCXS.js +92 -0
  101. package/dist/chunk-JZGVVJSI.js +66 -0
  102. package/dist/chunk-K4WX6UUU.js +923 -0
  103. package/dist/chunk-K5BBGTYZ.js +217 -0
  104. package/dist/chunk-K6RXBGUB.js +427 -0
  105. package/dist/chunk-KTSDSD36.js +165 -0
  106. package/dist/chunk-L5JYN3NM.js +1038 -0
  107. package/dist/chunk-LIEOKXKD.js +354 -0
  108. package/dist/chunk-LLNZGEFK.js +51 -0
  109. package/dist/chunk-LPECSJ2J.js +55 -0
  110. package/dist/chunk-LQCMKAJ7.js +413 -0
  111. package/dist/chunk-LRN4ZJCQ.js +1145 -0
  112. package/dist/chunk-MJ4ZVHKN.js +17 -0
  113. package/dist/chunk-MXHSQOC4.js +3061 -0
  114. package/dist/chunk-N5GKCWE5.js +367 -0
  115. package/dist/chunk-NA3PXMEF.js +10 -0
  116. package/dist/chunk-NAQDMEHV.js +76 -0
  117. package/dist/chunk-NWKXM5RD.js +109 -0
  118. package/dist/chunk-NZOWWHU5.js +196 -0
  119. package/dist/chunk-OHX6MIUZ.js +184 -0
  120. package/dist/chunk-OOXWYAA4.js +15 -0
  121. package/dist/chunk-OPHB5ORL.js +1990 -0
  122. package/dist/chunk-OXA6PSZT.js +1725 -0
  123. package/dist/chunk-P2HAGF6H.js +73 -0
  124. package/dist/chunk-PTHVMXZI.js +3036 -0
  125. package/dist/chunk-PZ5AY32C.js +10 -0
  126. package/dist/chunk-Q325JKYB.js +189 -0
  127. package/dist/chunk-Q7DGTQ5G.js +255 -0
  128. package/dist/chunk-QCNYHBL7.js +601 -0
  129. package/dist/chunk-QO6BVGS5.js +145 -0
  130. package/dist/chunk-QXTKSOFI.js +76 -0
  131. package/dist/chunk-ROY4YAEQ.js +66 -0
  132. package/dist/chunk-RTJRZFFY.js +447 -0
  133. package/dist/chunk-SAVJUS2X.js +128 -0
  134. package/dist/chunk-SFLHVCKX.js +173 -0
  135. package/dist/chunk-STSFNCY4.js +127 -0
  136. package/dist/chunk-SWBF2LTK.js +170 -0
  137. package/dist/chunk-T5KELPAR.js +109 -0
  138. package/dist/chunk-TFFGOFVZ.js +1481 -0
  139. package/dist/chunk-TLHIFK4M.js +256 -0
  140. package/dist/chunk-TLQE7ZN3.js +156 -0
  141. package/dist/chunk-TPHWJ7UG.js +1981 -0
  142. package/dist/chunk-TRJCALW3.js +291 -0
  143. package/dist/chunk-TTEIYD5P.js +133 -0
  144. package/dist/chunk-U64O2MXY.js +407 -0
  145. package/dist/chunk-UCQ2VUTG.js +630 -0
  146. package/dist/chunk-UTI5G6OJ.js +44 -0
  147. package/dist/chunk-UVHDMMIP.js +188 -0
  148. package/dist/chunk-UZ6QQWJT.js +120 -0
  149. package/dist/chunk-VAX3UZOY.js +686 -0
  150. package/dist/chunk-W3HBUKFO.js +57 -0
  151. package/dist/chunk-WKQLGKCL.js +2823 -0
  152. package/dist/chunk-WQFNASK4.js +560 -0
  153. package/dist/chunk-WRBKLYSJ.js +224 -0
  154. package/dist/chunk-WTPZRR4I.js +17 -0
  155. package/dist/chunk-WZDJ2LLX.js +2385 -0
  156. package/dist/chunk-X2NL4KUO.js +14 -0
  157. package/dist/chunk-X4DVXBFY.js +38 -0
  158. package/dist/chunk-X677DMZM.js +7050 -0
  159. package/dist/chunk-XBKMWY7F.js +612 -0
  160. package/dist/chunk-XNCP4KYO.js +78 -0
  161. package/dist/chunk-XVBGLISP.js +35 -0
  162. package/dist/chunk-XW6KISBB.js +1192 -0
  163. package/dist/chunk-YGZHHAAB.js +8156 -0
  164. package/dist/chunk-YHEFQUQB.js +186 -0
  165. package/dist/chunk-YLDALTWZ.js +653 -0
  166. package/dist/chunk-YU4HSQW7.js +229 -0
  167. package/dist/chunk-ZDPP6RKB.js +27 -0
  168. package/dist/chunk-ZFDZKNGG.js +194 -0
  169. package/dist/chunk-ZIY7RNUT.js +49 -0
  170. package/dist/chunk-ZYJP6BOO.js +30 -0
  171. package/dist/cli.d.ts +1111 -0
  172. package/dist/cli.js +165 -0
  173. package/dist/codegen-command-VR2GWR6C.js +173 -0
  174. package/dist/codegen.d.ts +115 -0
  175. package/dist/codegen.js +19 -0
  176. package/dist/commands-GJMJ4XYZ.js +76 -0
  177. package/dist/completion-ZQLO6PB6.js +738 -0
  178. package/dist/config-MBYGCAFK.js +136 -0
  179. package/dist/deploy-command-JVZPWHMK.js +180 -0
  180. package/dist/deploy-source-3W45CXMP.js +81 -0
  181. package/dist/dev-env-sync-HN44K4D5.js +188 -0
  182. package/dist/diagnostics-UEAAHWVF.js +30 -0
  183. package/dist/display-name-hint-ABBPVQIR.js +46 -0
  184. package/dist/emit-CyhBDxli.d.ts +7007 -0
  185. package/dist/env-example-refresh-ET5HMMDW.js +126 -0
  186. package/dist/env-pull-command-TNMNB3CV.js +323 -0
  187. package/dist/env-target-O4HRKTGZ.js +40 -0
  188. package/dist/env-var-command-ZIRDCAZA.js +427 -0
  189. package/dist/ephemeral-P7F3PMAD.js +54 -0
  190. package/dist/ephemeral-command-CLJJKOFT.js +592 -0
  191. package/dist/ephemeral-state-PYCBSOGX.js +61 -0
  192. package/dist/file-lock-PT74GWYW.js +10 -0
  193. package/dist/generate-command-AYEOLA26.js +510 -0
  194. package/dist/gitignore-3SJ3WNRG.js +51 -0
  195. package/dist/guards-4EBNCZDC.js +162 -0
  196. package/dist/hosted-file-PSHJB3HX.js +28 -0
  197. package/dist/impersonate-command-5JAS3WSV.js +152 -0
  198. package/dist/import-EQSFU6JC.js +19 -0
  199. package/dist/index.d.ts +5470 -0
  200. package/dist/index.js +371 -0
  201. package/dist/init-command-X2FR4UAK.js +125 -0
  202. package/dist/init-modules-RY7UHAOL.js +50 -0
  203. package/dist/init-web-M4YZSZK6.js +42 -0
  204. package/dist/internal.d.ts +179 -0
  205. package/dist/internal.js +2634 -0
  206. package/dist/io-RC56QSN5.js +26 -0
  207. package/dist/keep-data-merge-7MPLVAVI.js +1119 -0
  208. package/dist/lambda-config-reconcile-OUZ4OYAB.js +116 -0
  209. package/dist/landed-753YLJ5H.js +40 -0
  210. package/dist/landing-record-SU52SKXU.js +61 -0
  211. package/dist/live-diff-YONW2VI3.js +65 -0
  212. package/dist/local-engine-choice-CH5X3W7E.js +79 -0
  213. package/dist/local-engine-command-Z3OL7VOD.js +766 -0
  214. package/dist/local-engine-config-5U3SC434.js +39 -0
  215. package/dist/local-engine-deploy-PCQ4SNPB.js +39 -0
  216. package/dist/local-engine-process-EHTE5LLU.js +63 -0
  217. package/dist/local-engine-state-A4FTRFAF.js +32 -0
  218. package/dist/local-engine-update-check-6L645VBL.js +162 -0
  219. package/dist/lock-MRRHW5GS.js +87 -0
  220. package/dist/lock-commands-2QG25HL7.js +963 -0
  221. package/dist/login-command-QPYRWOXZ.js +538 -0
  222. package/dist/logout-command-WOIQLDP6.js +56 -0
  223. package/dist/loop-ALIZLOSX.js +191 -0
  224. package/dist/marketplace-command-K5YL42NO.js +977 -0
  225. package/dist/marketplace-resolve-LY32JES5.js +40 -0
  226. package/dist/meta-client-YXGPW53C.js +244 -0
  227. package/dist/module-manifest-JFGHU2TC.js +38 -0
  228. package/dist/near-key.d.ts +13 -0
  229. package/dist/near-key.js +8 -0
  230. package/dist/node.d.ts +95 -0
  231. package/dist/node.js +969 -0
  232. package/dist/operation-outcome-TZSESNC7.js +51 -0
  233. package/dist/output-target-AL3I44GG.js +47 -0
  234. package/dist/package-manager-PRAHUSCN.js +34 -0
  235. package/dist/plan-disclosure-6G4MLZKD.js +114 -0
  236. package/dist/plugin-contributions-WRNY5ABG.js +28 -0
  237. package/dist/plugin-prompt-4VA3B4FF.js +20 -0
  238. package/dist/plugin-questions-JTSYA74Q.js +24 -0
  239. package/dist/plugin.d.ts +396 -0
  240. package/dist/plugin.js +1 -0
  241. package/dist/preflight-command-2T5Z36MI.js +321 -0
  242. package/dist/profile-command-AH3PIM4X.js +800 -0
  243. package/dist/profile-pointer-GRWJU3YD.js +31 -0
  244. package/dist/profile-select-74TRDEPD.js +23 -0
  245. package/dist/project-dependency-KSH63ODT.js +35 -0
  246. package/dist/project-sdk-REPPOIBD.js +24 -0
  247. package/dist/promote-command-PCWT5N6S.js +140 -0
  248. package/dist/prompt-II3F3LND.js +27 -0
  249. package/dist/publish-command-TTDUUJI5.js +414 -0
  250. package/dist/pull-command-VBO7C4S3.js +161 -0
  251. package/dist/pull-superseded-GJWLG7XO.js +20 -0
  252. package/dist/release-command-N4ZPKMHR.js +146 -0
  253. package/dist/release-ns-command-3KFDMZ6G.js +1745 -0
  254. package/dist/response-HlXahv4K.d.ts +925 -0
  255. package/dist/retry-command-AS5EVREX.js +34 -0
  256. package/dist/routes-manifest-SNWUVBT6.js +43 -0
  257. package/dist/runtime-XETHVF33.js +14 -0
  258. package/dist/scaffold.d.ts +1911 -0
  259. package/dist/scaffold.js +107 -0
  260. package/dist/secrets-file-LVZD6IIM.js +56 -0
  261. package/dist/secrets-fill-command-TTCPSVXN.js +218 -0
  262. package/dist/seed-VU7C3QYS.js +46 -0
  263. package/dist/sent-writes-N7X4OVXT.js +22 -0
  264. package/dist/source-resolve-S2XA3XZF.js +83 -0
  265. package/dist/static-host-B2Y6AG3W.js +352 -0
  266. package/dist/status-command-RUDXTF7I.js +554 -0
  267. package/dist/store-6VNCD4D7.js +20 -0
  268. package/dist/store-ARM6VMO5.js +98 -0
  269. package/dist/store-DuYfzKlW.d.ts +3144 -0
  270. package/dist/suggest-6FOOYKHG.js +12 -0
  271. package/dist/sveltekit.d.ts +154 -0
  272. package/dist/sveltekit.js +109 -0
  273. package/dist/sync-contributions-UCEROO26.js +415 -0
  274. package/dist/table-ENAVMITR.js +42 -0
  275. package/dist/tables-command-GUPXXSB5.js +156 -0
  276. package/dist/tenant-IIHPOHGP.js +42 -0
  277. package/dist/tenant-command-D5HGI2X4.js +965 -0
  278. package/dist/test-command-TIKZMDPZ.js +476 -0
  279. package/dist/tests-BGGIOK3L.js +26 -0
  280. package/dist/token-NICJUTMT.js +72 -0
  281. package/dist/toolchain-hooks-GHKLUJOH.js +96 -0
  282. package/dist/toolchain-modules-5EAZUONB.js +24 -0
  283. package/dist/tracked-backend-EIBUMDZA.js +80 -0
  284. package/dist/update-check-2W2NLDTC.js +136 -0
  285. package/dist/upgrade-command-QHNFWM7O.js +531 -0
  286. package/dist/verify-rollout-DRCK5TDD.js +61 -0
  287. package/dist/whoami-command-STGINTXH.js +51 -0
  288. package/dist/workspace-2CLHU2LK.js +93 -0
  289. package/dist/workspace-binding-56PIIPCP.js +54 -0
  290. package/dist/workspace-command-JEXQETJD.js +535 -0
  291. package/dist/workspace-env-F2RFMSC5.js +70 -0
  292. package/dist/workspace-export-OJSH2HIW.js +21 -0
  293. package/dist/writable-VA7OISSK.js +25 -0
  294. package/dist/xano-ICFUSPFR.js +42 -0
  295. package/dist/xanosdk-import-GN42TO2B.js +56 -0
  296. package/dist/xanosdk-project-S6DXJONQ.js +41 -0
  297. package/dist/xdo-CxDr2Q1C.d.ts +1371 -0
  298. package/guides/README.md +33 -0
  299. package/guides/authoring.md +921 -0
  300. package/guides/cli.md +401 -0
  301. package/guides/codegen.md +177 -0
  302. package/guides/codes.md +404 -0
  303. package/guides/coverage.md +74 -0
  304. package/guides/deploying.md +1525 -0
  305. package/guides/environment.md +400 -0
  306. package/guides/marketplace.md +415 -0
  307. package/guides/module-contract.md +558 -0
  308. package/guides/object-kinds.md +433 -0
  309. package/guides/project-structure.md +43 -0
  310. package/guides/scaffold.md +351 -0
  311. package/guides/typed-frontend.md +242 -0
  312. package/llms/client.md +63 -0
  313. package/llms/errors.md +56 -0
  314. package/llms/fields.md +176 -0
  315. package/llms/filters.md +183 -0
  316. package/llms/kinds-agent-mcp.md +30 -0
  317. package/llms/kinds-core.md +100 -0
  318. package/llms/kinds-knowledge.md +20 -0
  319. package/llms/kinds-realtime.md +76 -0
  320. package/llms/lambda.md +94 -0
  321. package/llms/legacy.md +44 -0
  322. package/llms/lock.md +40 -0
  323. package/llms/object-kinds.md +34 -0
  324. package/llms/statements-calls.md +62 -0
  325. package/llms/statements-catalog.md +320 -0
  326. package/llms/statements-data.md +66 -0
  327. package/llms/statements-runtime.md +68 -0
  328. package/llms/tests.md +59 -0
  329. package/llms/toolchain.md +16 -0
  330. package/llms/triggers.md +36 -0
  331. package/llms/values.md +29 -0
  332. package/llms-full.txt +2085 -0
  333. package/llms.txt +493 -0
  334. package/manifest.json +11224 -0
  335. package/package.json +162 -0
  336. package/types/lambda-globals.d.ts +129 -0
package/dist/node.js ADDED
@@ -0,0 +1,969 @@
1
+ import {
2
+ secretsPhrase
3
+ } from "./chunk-SAVJUS2X.js";
4
+ import {
5
+ secretsCarriedBy
6
+ } from "./chunk-45UIT5T2.js";
7
+ import "./chunk-HRVBLCVJ.js";
8
+ import "./chunk-YHEFQUQB.js";
9
+ import {
10
+ authorFiles,
11
+ exportBundleJson,
12
+ loadDefault,
13
+ parseArgs,
14
+ readsFreeName,
15
+ resolveKnowledge,
16
+ run
17
+ } from "./chunk-ETO6LGLD.js";
18
+ import "./chunk-ZIY7RNUT.js";
19
+ import {
20
+ classifyEnv,
21
+ declaredEnv,
22
+ parseEnvFile
23
+ } from "./chunk-DAD3ONIS.js";
24
+ import "./chunk-HHN734BU.js";
25
+ import "./chunk-LPECSJ2J.js";
26
+ import "./chunk-6NNTNXN7.js";
27
+ import "./chunk-QCNYHBL7.js";
28
+ import "./chunk-2ZUEE4EK.js";
29
+ import "./chunk-AN6BL47T.js";
30
+ import "./chunk-ET4Y4XCB.js";
31
+ import "./chunk-SWBF2LTK.js";
32
+ import "./chunk-UZ6QQWJT.js";
33
+ import "./chunk-A3UDOZB6.js";
34
+ import "./chunk-2MNLRIOX.js";
35
+ import "./chunk-3M4LFYNQ.js";
36
+ import "./chunk-AM4FKL4J.js";
37
+ import "./chunk-Q325JKYB.js";
38
+ import "./chunk-STSFNCY4.js";
39
+ import "./chunk-I4F5TCJH.js";
40
+ import {
41
+ allLandings
42
+ } from "./chunk-5QU2P5CA.js";
43
+ import "./chunk-ZYJP6BOO.js";
44
+ import "./chunk-QO6BVGS5.js";
45
+ import "./chunk-JZGVVJSI.js";
46
+ import "./chunk-7G3CTU7I.js";
47
+ import "./chunk-6PBR37LN.js";
48
+ import "./chunk-T5KELPAR.js";
49
+ import "./chunk-622HUCZT.js";
50
+ import "./chunk-NAQDMEHV.js";
51
+ import {
52
+ backendDirIn
53
+ } from "./chunk-5A2PLKZB.js";
54
+ import "./chunk-AHJWCYQO.js";
55
+ import "./chunk-DX4QR4B2.js";
56
+ import "./chunk-6QXLMMT3.js";
57
+ import "./chunk-ZFDZKNGG.js";
58
+ import "./chunk-FWD7AL6N.js";
59
+ import "./chunk-2GNFDZA2.js";
60
+ import "./chunk-JTUKLCXS.js";
61
+ import "./chunk-4KHEMC32.js";
62
+ import {
63
+ hostedFileResolver,
64
+ isMissingFile
65
+ } from "./chunk-U64O2MXY.js";
66
+ import {
67
+ projectRootFrom
68
+ } from "./chunk-ROY4YAEQ.js";
69
+ import {
70
+ readLockFile,
71
+ writeLockFile
72
+ } from "./chunk-P2HAGF6H.js";
73
+ import "./chunk-TLQE7ZN3.js";
74
+ import "./chunk-WRBKLYSJ.js";
75
+ import "./chunk-3LDULPRE.js";
76
+ import "./chunk-XW6KISBB.js";
77
+ import "./chunk-AWQ7BQTQ.js";
78
+ import "./chunk-EUUUMY7J.js";
79
+ import "./chunk-YLDALTWZ.js";
80
+ import "./chunk-5FBYXK5P.js";
81
+ import "./chunk-LLNZGEFK.js";
82
+ import "./chunk-QXTKSOFI.js";
83
+ import "./chunk-X2NL4KUO.js";
84
+ import {
85
+ QUERY_AGGREGATE_NAMES,
86
+ QUERY_FILTER_NAMES,
87
+ QUERY_FILTER_SPECS,
88
+ defineFunction,
89
+ every,
90
+ fileUrl,
91
+ fl,
92
+ qf
93
+ } from "./chunk-IGOLHKWF.js";
94
+ import {
95
+ TEST_EXPECT_TYPES,
96
+ expect,
97
+ respond
98
+ } from "./chunk-3KZCLN4Z.js";
99
+ import "./chunk-OPHB5ORL.js";
100
+ import "./chunk-UCQ2VUTG.js";
101
+ import "./chunk-DGWHAVRG.js";
102
+ import "./chunk-JGE7CAWB.js";
103
+ import {
104
+ LocalFileNotFoundError
105
+ } from "./chunk-PTHVMXZI.js";
106
+ import {
107
+ compile
108
+ } from "./chunk-MJ4ZVHKN.js";
109
+ import {
110
+ actionCall,
111
+ actionPackageCall,
112
+ addon,
113
+ addonCall,
114
+ agent,
115
+ agentTrigger,
116
+ aiAgentRun,
117
+ apiCall,
118
+ arrayMap,
119
+ arrayUnion,
120
+ bitwiseAnd,
121
+ bitwiseOr,
122
+ bitwiseXor,
123
+ cloudJob,
124
+ cloudJobAwait,
125
+ cloudJobStatus,
126
+ comment,
127
+ createAuthToken,
128
+ debugLog,
129
+ die,
130
+ emit,
131
+ emitBundle,
132
+ errorTrigger,
133
+ expectToThrow,
134
+ forLoop,
135
+ foreachBreak,
136
+ foreachContinue,
137
+ foreachLoop,
138
+ foreachRemove,
139
+ functionCall,
140
+ functionRun,
141
+ getRawInput,
142
+ group,
143
+ ipLookup,
144
+ knowledge,
145
+ knowledgeDir,
146
+ knowledgeFile,
147
+ mathAdd,
148
+ mathDiv,
149
+ mathMul,
150
+ mathSub,
151
+ mcpServer,
152
+ mcpServerTrigger,
153
+ middleware,
154
+ middlewareCall,
155
+ objectEntries,
156
+ objectKeys,
157
+ objectValues,
158
+ postProcess,
159
+ prompt,
160
+ realtimeChannel,
161
+ realtimeChannelTrigger,
162
+ realtimeEvent,
163
+ realtimeMessage,
164
+ realtimeServer,
165
+ realtimeServerTrigger,
166
+ realtimeTrigger,
167
+ resource,
168
+ returnValue,
169
+ s,
170
+ serializeBundle,
171
+ setVar,
172
+ switchCase,
173
+ switchStatement,
174
+ tableTrigger,
175
+ task,
176
+ taskCall,
177
+ textAppend,
178
+ textPrepend,
179
+ tool,
180
+ toolCall,
181
+ triggerCall,
182
+ tryCatch,
183
+ updateVar,
184
+ whileLoop,
185
+ workflowTest,
186
+ workflowTestCall,
187
+ workspaceTrigger
188
+ } from "./chunk-MXHSQOC4.js";
189
+ import {
190
+ query,
191
+ test,
192
+ toSearchParams
193
+ } from "./chunk-6IUMKYWI.js";
194
+ import {
195
+ typedEnv,
196
+ workspaceConfig
197
+ } from "./chunk-2CMJZDCL.js";
198
+ import {
199
+ XANO_ORIGIN,
200
+ Xano,
201
+ workspace
202
+ } from "./chunk-CTMO46PK.js";
203
+ import "./chunk-ZDPP6RKB.js";
204
+ import {
205
+ obj
206
+ } from "./chunk-K5BBGTYZ.js";
207
+ import "./chunk-LQCMKAJ7.js";
208
+ import {
209
+ apiGroup,
210
+ cond,
211
+ dbAdd,
212
+ dbAddOrEdit,
213
+ dbBulkAdd,
214
+ dbBulkDelete,
215
+ dbBulkPatch,
216
+ dbBulkUpdate,
217
+ dbDel,
218
+ dbDirectQuery,
219
+ dbEdit,
220
+ dbExternalQuery,
221
+ dbGet,
222
+ dbHas,
223
+ dbIncrement,
224
+ dbPatch,
225
+ dbQuery,
226
+ dbSchema,
227
+ dbTransaction,
228
+ dbTruncate,
229
+ guard,
230
+ ignored,
231
+ microservice
232
+ } from "./chunk-YGZHHAAB.js";
233
+ import "./chunk-XVBGLISP.js";
234
+ import "./chunk-6HO3NCSJ.js";
235
+ import "./chunk-5V5XU32D.js";
236
+ import {
237
+ isRepresentableName
238
+ } from "./chunk-GSGDWJB5.js";
239
+ import {
240
+ and,
241
+ cmp,
242
+ conditional,
243
+ expr,
244
+ mixed,
245
+ or,
246
+ seedFile,
247
+ table
248
+ } from "./chunk-HVRUQXGD.js";
249
+ import "./chunk-ERVIASGL.js";
250
+ import "./chunk-4POWHT2K.js";
251
+ import "./chunk-H2V3N23D.js";
252
+ import {
253
+ SCAFFOLD_SECRETS_REMEDY,
254
+ documentationScopeFlagLabel
255
+ } from "./chunk-3JDU4VRL.js";
256
+ import "./chunk-WTPZRR4I.js";
257
+ import "./chunk-UTI5G6OJ.js";
258
+ import {
259
+ emitDiagnostic
260
+ } from "./chunk-2EZ3ZJZZ.js";
261
+ import {
262
+ createLockContext,
263
+ emptyLock,
264
+ mergeObserved,
265
+ serializeLock,
266
+ validateLockModel
267
+ } from "./chunk-6MR5TI5V.js";
268
+ import "./chunk-5ZSO4T2G.js";
269
+ import {
270
+ hostedFile,
271
+ hostedIconOwners,
272
+ isHostedFile
273
+ } from "./chunk-XNCP4KYO.js";
274
+ import "./chunk-AKNCFVKZ.js";
275
+ import {
276
+ annotate,
277
+ statements
278
+ } from "./chunk-YU4HSQW7.js";
279
+ import "./chunk-TFFGOFVZ.js";
280
+ import "./chunk-L5JYN3NM.js";
281
+ import "./chunk-G554NZNI.js";
282
+ import {
283
+ f,
284
+ input
285
+ } from "./chunk-N5GKCWE5.js";
286
+ import {
287
+ LAMBDA_BINDINGS,
288
+ LAMBDA_CODE_FILTERS,
289
+ LAMBDA_GLOBALS,
290
+ LAMBDA_MODULE_GLOBALS,
291
+ LAMBDA_STATEMENTS,
292
+ assertLambdaBody,
293
+ auth,
294
+ c,
295
+ caught,
296
+ col,
297
+ decodeIdentifier,
298
+ decodeIdentifierEscapes,
299
+ env,
300
+ extractFunction,
301
+ filter,
302
+ inp,
303
+ lam,
304
+ lambdaSyntaxError,
305
+ lambdaValue,
306
+ out,
307
+ readFunction,
308
+ ref,
309
+ resp,
310
+ setting,
311
+ sys,
312
+ toolset,
313
+ withFilters
314
+ } from "./chunk-OXA6PSZT.js";
315
+ import {
316
+ SourceReader,
317
+ SourceShapeError,
318
+ lineOf,
319
+ maskNonCode,
320
+ tokenize
321
+ } from "./chunk-VAX3UZOY.js";
322
+ import "./chunk-NZOWWHU5.js";
323
+ import {
324
+ getLockedCanonical,
325
+ getLockedGuid,
326
+ isLockSeeded,
327
+ resetLockOverrides,
328
+ seedLockOverrides,
329
+ seededLockSource
330
+ } from "./chunk-4BW2SG2N.js";
331
+ import "./chunk-TTEIYD5P.js";
332
+ import "./chunk-CIMQZRRE.js";
333
+ import "./chunk-OHX6MIUZ.js";
334
+ import "./chunk-36JUQZVQ.js";
335
+ import "./chunk-PZ5AY32C.js";
336
+
337
+ // src/values/lambda-file.ts
338
+ import { readFileSync } from "fs";
339
+ import { dirname, isAbsolute, resolve } from "path";
340
+ import { fileURLToPath } from "url";
341
+ var PREFIX = "lam.file";
342
+ var LOADER_FRAME = /[/\\]node_modules[/\\](?:\.pnpm[/\\][^/\\]+[/\\]node_modules[/\\])?(?:vite-node|vite|vitest|tsx|ts-node|jiti|esbuild-register|@esbuild-kit)[/\\]/;
343
+ var SELF = fileURLToPath(import.meta.url);
344
+ function stackFiles() {
345
+ const previous = Error.prepareStackTrace;
346
+ let sites;
347
+ try {
348
+ Error.prepareStackTrace = (_error, callSites) => callSites;
349
+ sites = new Error().stack;
350
+ } finally {
351
+ Error.prepareStackTrace = previous;
352
+ }
353
+ if (Array.isArray(sites)) {
354
+ return sites.slice(1).map((site) => site.getFileName() ?? site.getScriptNameOrSourceURL?.() ?? "").filter((file2) => typeof file2 === "string" && file2 !== "");
355
+ }
356
+ const files = [];
357
+ for (const line of String(typeof sites === "string" ? sites : new Error().stack ?? "").split("\n").slice(1)) {
358
+ const match = /\((.*?):\d+:\d+\)\s*$/.exec(line) ?? /at (.*?):\d+:\d+\s*$/.exec(line);
359
+ if (match?.[1] !== void 0) files.push(match[1]);
360
+ }
361
+ return files;
362
+ }
363
+ function callerDir() {
364
+ const frames = [];
365
+ for (const raw of stackFiles()) {
366
+ if (raw.startsWith("node:")) continue;
367
+ const path = raw.startsWith("file:") ? fileURLToPath(raw) : raw;
368
+ if (path === SELF) continue;
369
+ frames.push(path);
370
+ }
371
+ const authored = frames.find((p) => !LOADER_FRAME.test(p));
372
+ return dirname(authored ?? frames[0] ?? process.cwd());
373
+ }
374
+ function defaultExport(source, path) {
375
+ const reader = new SourceReader(tokenize(source));
376
+ const { toks } = reader;
377
+ const at = (k2) => `${path}:${lineOf(source, reader.offset(k2))}`;
378
+ let found;
379
+ let k = 0;
380
+ try {
381
+ while (k < toks.length) {
382
+ const t = toks[k];
383
+ if (reader.isP(k, ";")) {
384
+ k++;
385
+ continue;
386
+ }
387
+ if (t.kind === "string" && (reader.isP(k + 1, ";") || toks[k + 1] === void 0 || toks[k + 1].nl)) {
388
+ k++;
389
+ continue;
390
+ }
391
+ if (reader.isId(k, "export") && reader.isId(k + 1, "default")) {
392
+ if (found !== void 0) throw new Error(`${PREFIX}: ${at(k)} has more than one \`export default\`.`);
393
+ const first = k + 2;
394
+ const head = toks[first];
395
+ if (!(reader.isP(first, "(") || reader.isP(first, "<") || head?.kind === "id" && !reader.isId(first, "class"))) {
396
+ throw new Error(
397
+ `${PREFIX}: ${at(first)} default-exports something that is not a function. Export the lambda itself: \`export default ({ $this }: LambdaBindings<"map">) => \u2026\`.`
398
+ );
399
+ }
400
+ const { end } = parseDefault(reader, first, at);
401
+ found = [reader.offset(first), toks[end - 1].end];
402
+ k = end;
403
+ continue;
404
+ }
405
+ if (isTypeOnly(reader, k)) {
406
+ k = skipTypeOnly(reader, k);
407
+ continue;
408
+ }
409
+ if (reader.isId(k, "export")) {
410
+ throw new Error(
411
+ `${PREFIX}: ${at(k)} exports something besides its default. Only the default export's BODY is sent to the engine, so a second export is undefined at runtime \u2014 the engine returns that failure as diagnostic text in the value slot rather than as an error. A lambda module is one \`export default\` function and nothing else: move it inside that function.`
412
+ );
413
+ }
414
+ if (reader.isId(k, "import")) {
415
+ throw new Error(
416
+ `${PREFIX}: ${at(k)} imports a value at the top level, which the engine never resolves \u2014 only the default export's body is sent, so the import is undefined at runtime. Use \`import type\` for types, or reach a dependency through the PRELOADED globals, which need no specifier and are the only route that works on every instance: ${LAMBDA_MODULE_GLOBALS.join(", ")} (plus ${LAMBDA_GLOBALS.join(" / ")}, fetch, Buffer, TextEncoder). A scaffolded project's \`xano/lambdas/tsconfig.json\` declares them for the type checker (\`@xano/sdk/lambda-globals\`; keep it in a tsconfig of the lambdas' own, as its globals reach the whole program).`
417
+ );
418
+ }
419
+ let n = k;
420
+ if (reader.isId(n, "async")) n++;
421
+ const declared = /^(?:const|let|var|function|class|enum)$/.test(toks[n]?.text ?? "") && reader.isId(n + 1) ? toks[n + 1].text : t.text;
422
+ throw new Error(
423
+ `${PREFIX}: ${at(k)} declares \`${declared}\` at the top level, and only the default export's BODY is sent to the engine \u2014 anything beside it is undefined at runtime, and the engine returns that failure as diagnostic text in the value slot rather than as an error. Move it inside the default-exported function.`
424
+ );
425
+ }
426
+ } catch (e) {
427
+ if (e instanceof SourceShapeError) {
428
+ throw new Error(
429
+ `${PREFIX}: could not read ${path}:${lineOf(source, e.offset)} (${e.message}), so the default export's body cannot be located with certainty. A lambda module is one \`export default\` function \u2014 \`export default ({ $var }: \u2026) => \u2026\` or \`export default function ({ $var }: \u2026) { \u2026 }\` \u2014 plus type-only imports and declarations.`
430
+ );
431
+ }
432
+ throw e;
433
+ }
434
+ if (found === void 0) {
435
+ throw new Error(
436
+ `${PREFIX}: ${path} has no \`export default\`. A lambda module is one default-exported function whose first parameter destructures the bindings \u2014 \`export default ({ $this }: LambdaBindings<"map">) => \u2026\`.`
437
+ );
438
+ }
439
+ return found;
440
+ }
441
+ function assertNoSelfReference(exported, path) {
442
+ const name = readFunction(exported, `${PREFIX}: ${path}`).name;
443
+ if (name === void 0) return;
444
+ if (!readsFreeName(maskNonCode(decodeIdentifierEscapes(exported)), decodeIdentifier(name))) return;
445
+ throw new Error(
446
+ `${PREFIX}: ${path} default-exports \`function ${name}\` and reads \`${name}\` inside it, but only the function's BODY is sent to the engine \u2014 the name is not bound at runtime, so the reference is undefined there. For recursion, declare a helper inside the body (\`const walk = (node) => \u2026walk(child)\u2026\`) and call it.`
447
+ );
448
+ }
449
+ function parseDefault(reader, first, at) {
450
+ const { end } = reader.parseFunctionExpression(first);
451
+ const next = reader.toks[end];
452
+ const declaration = reader.isId(first, "function") || reader.isId(first, "async") && reader.isId(first + 1, "function");
453
+ if (next === void 0 || reader.isP(end, ";") || declaration) return { end };
454
+ if (next.nl && !reader.continues(next)) return { end };
455
+ throw new Error(
456
+ `${PREFIX}: ${at(end)} default-exports an expression that continues past the function (\`${next.text}\`), so what is exported is not the function itself. Export the lambda itself: \`export default ({ $this }: LambdaBindings<"map">) => \u2026\`.`
457
+ );
458
+ }
459
+ function isTypeOnly(reader, k) {
460
+ const n = reader.isId(k, "export") ? k + 1 : k;
461
+ if (reader.isId(n, "interface") && reader.isId(n + 1)) return true;
462
+ if (reader.isId(n, "type") && (reader.isId(n + 1) || reader.isP(n + 1, "{") || reader.isP(n + 1, "*"))) return true;
463
+ if (n === k && reader.isId(k, "declare") && !reader.toks[k + 1]?.nl) return true;
464
+ if (n !== k || !reader.isId(k, "import")) return false;
465
+ if (reader.isId(k + 1, "type") && !(reader.isId(k + 2, "from") && reader.toks[k + 3]?.kind === "string")) return true;
466
+ if (!reader.isP(k + 1, "{")) return false;
467
+ const close = reader.close(k + 1);
468
+ const specifiers = [[]];
469
+ for (let j = k + 2; j < close; j++) {
470
+ if (reader.isP(j, ",")) specifiers.push([]);
471
+ else specifiers[specifiers.length - 1].push(j);
472
+ }
473
+ const named = specifiers.filter((s2) => s2.length > 0);
474
+ return named.length > 0 && named.every((s2) => reader.isId(s2[0], "type") && s2.length > 1);
475
+ }
476
+ function skipTypeOnly(reader, k) {
477
+ let n = reader.isId(k, "export") ? k + 1 : k;
478
+ if (reader.isId(n, "type") && reader.isId(n + 1) && (reader.isP(n + 2, "=") || reader.isP(n + 2, "<"))) {
479
+ n += 2;
480
+ if (reader.isP(n, "<")) n = reader.skipAngle(n);
481
+ if (!reader.isP(n, "=")) reader.fail("a type alias without `=`", n);
482
+ n = reader.skipType(n + 1);
483
+ return reader.isP(n, ";") ? n + 1 : n;
484
+ }
485
+ if (reader.isId(n, "interface")) {
486
+ n += 2;
487
+ if (reader.isP(n, "<")) n = reader.skipAngle(n);
488
+ if (reader.isId(n, "extends")) {
489
+ n = reader.skipType(n + 1, true);
490
+ while (reader.isP(n, ",")) n = reader.skipType(n + 1, true);
491
+ }
492
+ if (!reader.isP(n, "{")) reader.fail("an interface without a body", n);
493
+ return reader.close(n) + 1;
494
+ }
495
+ return reader.statementEnd(k);
496
+ }
497
+ function file(path, opts) {
498
+ const resolved = isAbsolute(path) ? path : resolve(callerDir(), path);
499
+ let source;
500
+ try {
501
+ source = readFileSync(resolved, "utf8");
502
+ } catch (err) {
503
+ throw new (isMissingFile(err) ? LocalFileNotFoundError : Error)(
504
+ `${PREFIX}: ${isMissingFile(err) ? "no file at" : "cannot read"} ${resolved} (resolved from ${JSON.stringify(path)}, relative to the calling module rather than the working directory).`
505
+ );
506
+ }
507
+ const [start, end] = defaultExport(source, resolved);
508
+ const exported = source.slice(start, end);
509
+ assertNoSelfReference(exported, resolved);
510
+ const { body, captureReads } = extractFunction(exported, `${PREFIX}: ${resolved}`);
511
+ assertBodyParses(body, source, start + readFunction(exported, `${PREFIX}: ${resolved}`).body[0], resolved);
512
+ return lambdaValue(body, opts, `${PREFIX}(${path})`, false, captureReads);
513
+ }
514
+ function assertBodyParses(body, source, bodyStart, path) {
515
+ const error = lambdaSyntaxError(body);
516
+ if (error === void 0) return;
517
+ const first = bodyStart + Math.max(source.slice(bodyStart).search(/\S/), 0);
518
+ const line = lineOf(source, first) + error.line - 1;
519
+ const text = source.split("\n")[line - 1] ?? error.lineText;
520
+ throw new Error(
521
+ `${PREFIX}: ${path}:${line}: the lambda body does not parse \u2014 ${error.message} (\`${text.trim()}\`). A body that does not parse cannot run.`
522
+ );
523
+ }
524
+ var lam2 = { ...lam, file };
525
+
526
+ // src/emit/write.ts
527
+ import { accessSync, chmodSync, constants, existsSync, mkdirSync, realpathSync, statSync, writeFileSync } from "fs";
528
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join, relative, resolve as resolve2 } from "path";
529
+ function writeArtifact(fn, path, opts = {}) {
530
+ writeFileSync(path, emit(fn, opts) + "\n", "utf8");
531
+ }
532
+ function writeBundle(xano, path, opts = {}) {
533
+ const declared = declaredEnv(xano.workspaceSettings());
534
+ const fileValues = opts.envFile !== void 0 ? parseEnvFile(opts.envFile, "writeBundle envFile") : {};
535
+ const badNames = [...declared.map((e) => e.name), ...Object.keys(fileValues), ...Object.keys(opts.env ?? {})].filter(
536
+ (n) => !isRepresentableName(n)
537
+ );
538
+ if (badNames.length > 0) {
539
+ throw new Error(
540
+ `writeBundle: ${[...new Set(badNames)].map((n) => JSON.stringify(n)).join(", ")} ${badNames.length === 1 ? "is not a usable env var name" : "are not usable env var names"}. A name is letters, digits and \`_\`, and does not start with a digit (e.g. STRIPE_KEY).`
541
+ );
542
+ }
543
+ const env2 = classifyEnv({
544
+ fileValues,
545
+ flagValues: { ...opts.env ?? {} },
546
+ declaredNames: declared.map((e) => e.name),
547
+ declaredValues: Object.fromEntries(declared.map((e) => [e.name, e.value]))
548
+ });
549
+ const docs = resolveDocumentationTokens(xano, opts);
550
+ const registry = authorFiles(originOf(xano))[0];
551
+ const lock = openLock(opts.lock, {
552
+ out: path,
553
+ ...opts.envFile !== void 0 ? { envFile: opts.envFile } : {},
554
+ authored: [authorFiles(new Error())[0], registry].filter((f2) => f2 !== void 0),
555
+ ...registry !== void 0 ? { registry } : {},
556
+ strict: opts.strict === true
557
+ });
558
+ const bundle = xano.export({
559
+ ...lock !== void 0 ? { lock: lock.ctx } : {},
560
+ ...opts.strict !== void 0 ? { strict: opts.strict } : {},
561
+ knowledge: resolveKnowledge(xano.knowledge()),
562
+ hostedFiles: hostedFileResolver(),
563
+ ...Object.keys(env2.values).length > 0 ? { envOverrides: env2.values } : {},
564
+ documentationTokens: docs.values,
565
+ ...docs.allowEmpty.size > 0 ? { allowEmptyDocToken: docs.allowEmpty } : {},
566
+ secretsRemedy: WRITE_BUNDLE_REMEDY
567
+ });
568
+ if (env2.clearing.length > 0) {
569
+ const one = env2.clearing.length === 1;
570
+ const message = `writeBundle: ${one ? "declared env var" : "declared env vars"} ${env2.clearing.join(", ")} ${one ? "has" : "have"} no value, so this bundle clears ${one ? "it" : "them"} if it is imported. Pass \`env: { NAME: "value" }\` or \`envFile: ${JSON.stringify(shownPath(join(lock !== void 0 ? dirname2(lock.path) : backendDirIn(projectRootFrom(registry !== void 0 ? dirname2(registry) : process.cwd())), ".env")))}\`.`;
571
+ if (opts.strict === true) throw new Error(message);
572
+ emitDiagnostic({ severity: "warning", code: "workspace-env.unsupplied", message });
573
+ }
574
+ if (env2.additions.length > 0) {
575
+ const one = env2.additions.length === 1;
576
+ const message = `writeBundle: env ${env2.additions.join(", ")} ${one ? "is" : "are"} not declared in \`workspaceConfig({ env })\` and will be ADDED if this bundle is imported. Declare ${one ? "it" : "them"} there with an empty value; if this is a typo, this is the only place you will see it.`;
577
+ if (opts.strict === true) throw new Error(message);
578
+ emitDiagnostic({ severity: "warning", code: "workspace-env.undeclared", message });
579
+ }
580
+ const owners = hostedIconOwners(bundle.payload ?? {});
581
+ if (owners.length > 0) {
582
+ emitDiagnostic({
583
+ severity: "warning",
584
+ code: "export.hosted-files-omitted",
585
+ message: `writeBundle: the bundle names hostedFile() icons whose files it does not carry: ${owners.join(", ")}. Deploying the file is refused; \`xanosdk deploy <entry>\` ships the files.`
586
+ });
587
+ }
588
+ prepareBundlePath(path);
589
+ if (lock !== void 0) lock.commit();
590
+ writeBundleFile(path, serializeBundle(bundle, opts) + "\n", secretsCarriedBy(bundle));
591
+ }
592
+ function originOf(xano) {
593
+ const origin = xano[XANO_ORIGIN];
594
+ return origin instanceof Error ? origin : new Error();
595
+ }
596
+ function prepareBundlePath(path) {
597
+ const dir = dirname2(resolve2(path));
598
+ try {
599
+ mkdirSync(dir, { recursive: true });
600
+ accessSync(existsSync(path) ? path : dir, constants.W_OK);
601
+ } catch (err) {
602
+ throw new Error(
603
+ `writeBundle: cannot write ${path} \u2014 ${err.message}. Pass a path in a directory you can write.`
604
+ );
605
+ }
606
+ }
607
+ var WRITE_BUNDLE_REMEDY = {
608
+ ...SCAFFOLD_SECRETS_REMEDY,
609
+ supply: (scope) => `documentationTokens: { ${JSON.stringify(scope)}: "<value>" }`,
610
+ allowEmpty: (scope) => `allowEmptyDocToken: [${JSON.stringify(scope)}]`
611
+ };
612
+ function resolveDocumentationTokens(xano, opts) {
613
+ const declared = xano.documentationTokenNames();
614
+ const labelOf = (d) => documentationScopeFlagLabel(d.scope);
615
+ const keyFor = (scope, option) => {
616
+ const byKey = declared.find((d) => d.key === scope);
617
+ if (byKey !== void 0) return byKey.key;
618
+ const ws = declared.find((d) => d.scope.kind === "workspace");
619
+ if (scope === "workspace" && ws !== void 0) return ws.key;
620
+ const groups2 = declared.filter((d) => d.scope.kind === "api_group" && labelOf(d) === scope);
621
+ if (groups2.length === 1) return groups2[0].key;
622
+ if (groups2.length > 1) {
623
+ throw new Error(
624
+ `writeBundle: \`${option}\` scope ${JSON.stringify(scope)} names ${groups2.length} API groups \u2014 use the key for the one you mean: ${groups2.map((d) => JSON.stringify(d.key)).join(", ")}.`
625
+ );
626
+ }
627
+ const known = [...new Set(declared.map(labelOf))];
628
+ throw new Error(
629
+ `writeBundle: \`${option}\`: no documentation gate is declared for ${JSON.stringify(scope)}.` + (known.length === 0 ? ` This workspace declares none \u2014 a gate is \`documentation: { require_token: true }\`.` : ` Declared: ${known.map((n) => JSON.stringify(n)).join(", ")}.`)
630
+ );
631
+ };
632
+ const values = /* @__PURE__ */ Object.create(null);
633
+ for (const [scope, value] of Object.entries(opts.documentationTokens ?? {})) {
634
+ if (value === void 0) continue;
635
+ const key = keyFor(scope, "documentationTokens");
636
+ if (typeof value !== "string" || value.trim() === "") {
637
+ throw new Error(
638
+ `writeBundle: \`documentationTokens\` ${JSON.stringify(scope)} is ${typeof value === "string" ? "empty" : `${value === null ? "null" : typeof value}, not a string`}. An empty value is refused: to clear a gate on purpose, say so with \`allowEmptyDocToken: [${JSON.stringify(scope)}]\`.`
639
+ );
640
+ }
641
+ values[key] = value;
642
+ }
643
+ const allowEmpty = new Set((opts.allowEmptyDocToken ?? []).map((scope) => keyFor(scope, "allowEmptyDocToken")));
644
+ const cleared = declared.filter((d) => !Object.hasOwn(values, d.key) && allowEmpty.has(d.key));
645
+ if (cleared.length > 0) {
646
+ emitDiagnostic({
647
+ severity: "warning",
648
+ code: "doc-token.cleared",
649
+ message: `writeBundle: documentation tokens for ${cleared.map((d) => JSON.stringify(labelOf(d))).join(", ")} are sent EMPTY (allowEmptyDocToken). Whatever gate the target holds for ${cleared.length === 1 ? "that doc site" : "those doc sites"} is cleared, and its docs become publicly readable.`
650
+ });
651
+ }
652
+ const unsupplied = declared.filter((d) => d.gated && !Object.hasOwn(values, d.key) && !allowEmpty.has(d.key));
653
+ if (unsupplied.some((d) => d.scope.kind === "workspace")) {
654
+ emitDiagnostic({
655
+ severity: "warning",
656
+ code: "doc-token.unsupplied",
657
+ message: `writeBundle: the workspace declares a documentation gate and no token was supplied; no \`documentation\` key is emitted, so this bundle leaves the workspace's gate as it is rather than clearing it \u2014 and cannot restore it either.`
658
+ });
659
+ }
660
+ const groups = unsupplied.filter((d) => d.scope.kind === "api_group" && !d.published);
661
+ if (groups.length > 0) {
662
+ const one = groups.length === 1;
663
+ emitDiagnostic({
664
+ severity: "warning",
665
+ code: "doc-token.unsupplied",
666
+ message: `writeBundle: ${groups.map((d) => JSON.stringify(labelOf(d))).join(", ")} ${one ? "declares" : "declare"} a documentation gate with no token. A group's \`documentation\` key is written as the engine default when it is absent, so these bytes CLEAR that gate on import. ${one ? "That group does" : "Those groups do"} not publish docs (\`swagger\` is off), so nothing is exposed. Pass \`documentationTokens: { ${JSON.stringify(labelOf(groups[0]))}: "<value>" }\`.`
667
+ });
668
+ }
669
+ return { values, allowEmpty };
670
+ }
671
+ function writeBundleFile(path, content, secrets) {
672
+ if (secrets.length === 0) {
673
+ writeFileSync(path, content, "utf8");
674
+ return;
675
+ }
676
+ writeFileSync(path, content, { encoding: "utf8", mode: 384 });
677
+ if (!statSync(path).isFile()) return;
678
+ chmodSync(path, 384);
679
+ emitDiagnostic({
680
+ severity: "warning",
681
+ code: "secrets.cleartext-export",
682
+ message: `${path} carries ${secretsPhrase(secrets)} in cleartext \u2014 written owner-only (0600); do not commit it.`
683
+ });
684
+ }
685
+ function openLock(option, hints) {
686
+ const discovered = join(backendDirIn(projectRootFrom(process.cwd())), "xano.lock");
687
+ if (option === false) {
688
+ if (existsSync(discovered) && parses(discovered)) {
689
+ throw new Error(
690
+ `writeBundle: \`lock: false\` refused \u2014 ${shownPath(discovered)} pins this project's identities, and building without it derives guids from names, so every object it pins under another guid is deleted and recreated wherever the bundle lands. Drop \`lock: false\`, or delete the lock if you mean to abandon those identities.`
691
+ );
692
+ }
693
+ return void 0;
694
+ }
695
+ if (option !== void 0 && !existsSync(dirname2(resolve2(option)))) {
696
+ const dir = relative(process.cwd(), dirname2(resolve2(option))) || dirname2(resolve2(option));
697
+ throw new Error(
698
+ `writeBundle: \`lock: ${JSON.stringify(option)}\`: ${dir}/ doesn't exist \u2014 create it, or pass a \`lock\` path in an existing directory.`
699
+ );
700
+ }
701
+ const lockPath = option !== void 0 ? resolve2(option) : defaultLockPath(discovered, hints);
702
+ if (lockPath === void 0) return void 0;
703
+ const exists = existsSync(lockPath);
704
+ const model = exists ? readLockFile(lockPath) : emptyLock();
705
+ assertSeeded(model, lockPath);
706
+ const original = exists ? serializeLock(model) : void 0;
707
+ const ctx = createLockContext(model);
708
+ const landingsDir = lockPath === discovered ? process.cwd() : projectRootFrom(dirname2(lockPath));
709
+ return {
710
+ path: lockPath,
711
+ ctx,
712
+ commit: () => {
713
+ const landed = new Set(allLandings(landingsDir, model).flatMap(([, record]) => Object.values(record).map((e) => e.guid)));
714
+ const { lock: merged } = mergeObserved(model, ctx.observed, { landedGuids: landed });
715
+ validateLockModel(merged, lockPath, ctx.observed);
716
+ if (!exists && Object.keys(merged.objects).length === 0) return;
717
+ if (serializeLock(merged) !== original) writeLockFile(lockPath, merged);
718
+ }
719
+ };
720
+ }
721
+ function defaultLockPath(discovered, hints) {
722
+ const seeded = seededLockSource();
723
+ if (seeded !== void 0) {
724
+ if (existsSync(discovered) && !samePath(discovered, seeded)) {
725
+ throw new Error(
726
+ `writeBundle: the seeded lock is ${shownPath(seeded)}, but the cwd's project has ${shownPath(discovered)} \u2014 pass \`lock: ${JSON.stringify(shownPath(seeded))}\` to name the one this bundle builds against.`
727
+ );
728
+ }
729
+ return seeded;
730
+ }
731
+ const origin = hints.registry !== void 0 ? [join(dirname2(hints.registry), "xano.lock"), join(backendDirIn(projectRootFrom(dirname2(hints.registry))), "xano.lock")] : [];
732
+ const originLock = origin.find((p) => existsSync(p));
733
+ if (existsSync(discovered)) {
734
+ if (originLock !== void 0 && !samePath(originLock, discovered)) {
735
+ throw new Error(
736
+ `writeBundle: the registry was created in the project of ${shownPath(originLock)}, but the cwd's project has ${shownPath(discovered)} \u2014 pass \`lock: ${JSON.stringify(shownPath(originLock))}\` to name the one this bundle builds against.`
737
+ );
738
+ }
739
+ return discovered;
740
+ }
741
+ const elsewhere = hints.registry !== void 0 && !samePath(projectRootFrom(dirname2(hints.registry)), projectRootFrom(process.cwd()));
742
+ if (existsSync(dirname2(discovered)) && !elsewhere) return discovered;
743
+ const nearby = [
744
+ ...hints.envFile !== void 0 ? [join(dirname2(resolve2(hints.envFile)), "xano.lock"), join(backendDirIn(projectRootFrom(dirname2(resolve2(hints.envFile)))), "xano.lock")] : [],
745
+ join(backendDirIn(projectRootFrom(dirname2(resolve2(hints.out)))), "xano.lock"),
746
+ ...hints.authored.flatMap((file2) => [join(dirname2(file2), "xano.lock"), join(backendDirIn(projectRootFrom(dirname2(file2))), "xano.lock")])
747
+ ].find((p) => existsSync(p));
748
+ if (nearby !== void 0) return nearby;
749
+ if (isLockSeeded()) {
750
+ throw new Error(
751
+ `writeBundle: a lock is seeded, but no \`xano.lock\` was found from the cwd (${process.cwd()}) \u2014 it is not inside a project with a backend directory. Pass \`lock: "<path>/xano.lock"\` (the file you seeded).`
752
+ );
753
+ }
754
+ const message = `writeBundle: built without a lock \u2014 no \`xano.lock\` was found from the cwd (${process.cwd()}), the output path, \`envFile\`, or the modules that built the registry and called this. Nothing pins identities: guids are derived from names, so a renamed object lands as a new one. Pass \`lock: "<path>/xano.lock"\` to build against one, or \`lock: false\` to build without one on purpose.`;
755
+ if (hints.strict) throw new Error(message);
756
+ emitDiagnostic({ severity: "warning", code: "lock.not-found", message });
757
+ return void 0;
758
+ }
759
+ function samePath(a, b) {
760
+ try {
761
+ return realpathSync(a) === realpathSync(b);
762
+ } catch {
763
+ return resolve2(a) === resolve2(b);
764
+ }
765
+ }
766
+ function assertSeeded(lock, lockPath) {
767
+ const unseeded = Object.entries(lock.objects).some(
768
+ ([key, e]) => !isLockSeeded() || e.guid !== void 0 && getLockedGuid(key) !== e.guid || e.canonical !== void 0 && getLockedCanonical(key) !== e.canonical
769
+ );
770
+ if (!unseeded) return;
771
+ const shown = shownPath(lockPath);
772
+ throw new Error(
773
+ `writeBundle: ${shown} pins this project's identities, but it was not seeded before the workspace module loaded, so the bundle would carry name-derived guids. Seed it first \u2014 \`seedLockOverrides(readLockFile(${JSON.stringify(shown)}))\`, then import the entry \u2014 or run \`xanosdk export <entry> --out <path>\`.`
774
+ );
775
+ }
776
+ function shownPath(path) {
777
+ for (const p of [path, realOrSelf(path)]) {
778
+ const rel = relative(process.cwd(), p);
779
+ if (rel !== "" && !rel.startsWith("..") && !isAbsolute2(rel)) return rel;
780
+ }
781
+ return path;
782
+ }
783
+ function realOrSelf(path) {
784
+ try {
785
+ return realpathSync(path);
786
+ } catch {
787
+ try {
788
+ return join(realpathSync(dirname2(path)), path.slice(dirname2(path).length + 1));
789
+ } catch {
790
+ return path;
791
+ }
792
+ }
793
+ }
794
+ function parses(lockPath) {
795
+ try {
796
+ readLockFile(lockPath);
797
+ return true;
798
+ } catch {
799
+ return false;
800
+ }
801
+ }
802
+ export {
803
+ LAMBDA_BINDINGS,
804
+ LAMBDA_CODE_FILTERS,
805
+ LAMBDA_GLOBALS,
806
+ LAMBDA_MODULE_GLOBALS,
807
+ LAMBDA_STATEMENTS,
808
+ QUERY_AGGREGATE_NAMES,
809
+ QUERY_FILTER_NAMES,
810
+ QUERY_FILTER_SPECS,
811
+ TEST_EXPECT_TYPES,
812
+ Xano,
813
+ actionCall,
814
+ actionPackageCall,
815
+ addon,
816
+ addonCall,
817
+ agent,
818
+ agentTrigger,
819
+ aiAgentRun,
820
+ and,
821
+ annotate,
822
+ apiCall,
823
+ apiGroup,
824
+ arrayMap,
825
+ arrayUnion,
826
+ assertLambdaBody,
827
+ auth,
828
+ bitwiseAnd,
829
+ bitwiseOr,
830
+ bitwiseXor,
831
+ c,
832
+ caught,
833
+ cloudJob,
834
+ cloudJobAwait,
835
+ cloudJobStatus,
836
+ cmp,
837
+ col,
838
+ comment,
839
+ compile,
840
+ cond,
841
+ conditional,
842
+ createAuthToken,
843
+ dbAdd,
844
+ dbAddOrEdit,
845
+ dbBulkAdd,
846
+ dbBulkDelete,
847
+ dbBulkPatch,
848
+ dbBulkUpdate,
849
+ dbDel,
850
+ dbDirectQuery,
851
+ dbEdit,
852
+ dbExternalQuery,
853
+ dbGet,
854
+ dbHas,
855
+ dbIncrement,
856
+ dbPatch,
857
+ dbQuery,
858
+ dbSchema,
859
+ dbTransaction,
860
+ dbTruncate,
861
+ debugLog,
862
+ defineFunction,
863
+ die,
864
+ emit,
865
+ emitBundle,
866
+ env,
867
+ errorTrigger,
868
+ every,
869
+ expect,
870
+ expectToThrow,
871
+ exportBundleJson,
872
+ expr,
873
+ f,
874
+ fileUrl,
875
+ filter,
876
+ fl,
877
+ forLoop,
878
+ foreachBreak,
879
+ foreachContinue,
880
+ foreachLoop,
881
+ foreachRemove,
882
+ functionCall,
883
+ functionRun,
884
+ getRawInput,
885
+ group,
886
+ guard,
887
+ hostedFile,
888
+ ignored,
889
+ inp,
890
+ input,
891
+ ipLookup,
892
+ isHostedFile,
893
+ knowledge,
894
+ knowledgeDir,
895
+ knowledgeFile,
896
+ lam2 as lam,
897
+ loadDefault,
898
+ mathAdd,
899
+ mathDiv,
900
+ mathMul,
901
+ mathSub,
902
+ mcpServer,
903
+ mcpServerTrigger,
904
+ microservice,
905
+ middleware,
906
+ middlewareCall,
907
+ mixed,
908
+ obj,
909
+ objectEntries,
910
+ objectKeys,
911
+ objectValues,
912
+ or,
913
+ out,
914
+ parseArgs,
915
+ postProcess,
916
+ prompt,
917
+ qf,
918
+ query,
919
+ readLockFile,
920
+ realtimeChannel,
921
+ realtimeChannelTrigger,
922
+ realtimeEvent,
923
+ realtimeMessage,
924
+ realtimeServer,
925
+ realtimeServerTrigger,
926
+ realtimeTrigger,
927
+ ref,
928
+ resetLockOverrides,
929
+ resource,
930
+ resp,
931
+ respond,
932
+ returnValue,
933
+ run,
934
+ s,
935
+ seedFile,
936
+ seedLockOverrides,
937
+ setVar,
938
+ setting,
939
+ statements,
940
+ switchCase,
941
+ switchStatement,
942
+ sys,
943
+ table,
944
+ tableTrigger,
945
+ task,
946
+ taskCall,
947
+ test,
948
+ textAppend,
949
+ textPrepend,
950
+ toSearchParams,
951
+ tool,
952
+ toolCall,
953
+ toolset,
954
+ triggerCall,
955
+ tryCatch,
956
+ typedEnv,
957
+ updateVar,
958
+ whileLoop,
959
+ withFilters,
960
+ workflowTest,
961
+ workflowTestCall,
962
+ workspace,
963
+ workspaceConfig,
964
+ workspaceTrigger,
965
+ writeArtifact,
966
+ writeBundle,
967
+ writeLockFile
968
+ };
969
+ //# sourceMappingURL=node.js.map