@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
@@ -0,0 +1,483 @@
1
+ import {
2
+ addDependency,
3
+ removeDependency
4
+ } from "./chunk-6QXLMMT3.js";
5
+ import {
6
+ condenseNpmError,
7
+ npmViewVersion
8
+ } from "./chunk-ZFDZKNGG.js";
9
+ import {
10
+ shellWord
11
+ } from "./chunk-FWD7AL6N.js";
12
+ import {
13
+ isLocalSpecifier
14
+ } from "./chunk-2GNFDZA2.js";
15
+ import {
16
+ addArgs,
17
+ installSite,
18
+ removeCommandFor
19
+ } from "./chunk-WRBKLYSJ.js";
20
+ import {
21
+ homepageOf,
22
+ installedPackageDir,
23
+ loadEntryExports,
24
+ localPathOf,
25
+ moduleKind,
26
+ packageNameOf,
27
+ readInstalledManifest
28
+ } from "./chunk-3LDULPRE.js";
29
+ import {
30
+ UsageError,
31
+ spinner,
32
+ step,
33
+ success,
34
+ warn
35
+ } from "./chunk-PTHVMXZI.js";
36
+
37
+ // src/emit/init-modules.ts
38
+ import { existsSync, readFileSync, realpathSync } from "fs";
39
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
40
+ function isOptionImport(ref) {
41
+ return "package" in ref;
42
+ }
43
+ function parseMarketplaceFlag(values) {
44
+ const packages = [];
45
+ for (const value of values) {
46
+ for (const raw of value.split(",")) {
47
+ const pkg = raw.trim();
48
+ if (pkg === "") continue;
49
+ if (pkg.startsWith("-")) {
50
+ throw new UsageError(
51
+ `\`--marketplace\`: "${pkg}" starts with a dash, so npm would read it as a flag, not a package.`,
52
+ { helpFor: { command: "init" } }
53
+ );
54
+ }
55
+ if (!packages.includes(pkg)) packages.push(pkg);
56
+ }
57
+ }
58
+ return packages;
59
+ }
60
+ function readOptionRefs(raw) {
61
+ if (typeof raw !== "object" || raw === null) return {};
62
+ const refs = {};
63
+ for (const [name, value] of Object.entries(raw)) {
64
+ if (typeof value !== "object" || value === null) continue;
65
+ const entry = value;
66
+ const pkg = entry["package"];
67
+ const exported = entry["export"];
68
+ if (typeof pkg === "string" && pkg !== "" && typeof exported === "string" && exported !== "") {
69
+ refs[name] = { package: pkg, export: exported };
70
+ continue;
71
+ }
72
+ const literal = entry["value"];
73
+ if (typeof literal === "string" || typeof literal === "number" || typeof literal === "boolean") {
74
+ refs[name] = { value: literal };
75
+ }
76
+ }
77
+ return refs;
78
+ }
79
+ var UNDECLARED_OPTIONS = {
80
+ "@xano-sdk/auth": { canonical: { value: "authn" } },
81
+ "@xano-sdk/chatbot": { authTable: { package: "@xano-sdk/auth", export: "userTable" } }
82
+ };
83
+ function wrapAt(text, width) {
84
+ const lines = [];
85
+ let line = "";
86
+ for (const word of text.split(" ")) {
87
+ if (line === "") line = word;
88
+ else if (`${line} ${word}`.length <= width) line += ` ${word}`;
89
+ else {
90
+ lines.push(line);
91
+ line = word;
92
+ }
93
+ }
94
+ if (line !== "") lines.push(line);
95
+ return lines;
96
+ }
97
+ function bindingNameFor(register) {
98
+ const bare = register.replace(/^register/, "");
99
+ return bare === "" ? "handle" : bare[0].toLowerCase() + bare.slice(1);
100
+ }
101
+ function takesSecondArgument(loaded, register) {
102
+ const fn = loaded[register];
103
+ return typeof fn === "function" && fn.length >= 2;
104
+ }
105
+ function verdictFromArity(entry, register) {
106
+ if (entry.kind !== "loaded") return { kind: "unreadable", why: entry.why };
107
+ return takesSecondArgument(entry.exports, register) ? { kind: "undeclared" } : { kind: "accounted" };
108
+ }
109
+ async function readRegistration(dir, pkg) {
110
+ const manifest = readInstalledManifest(dir, pkg);
111
+ if (manifest === null) return { unwired: "it is not in node_modules after the install" };
112
+ if (moduleKind(pkg, manifest) === "toolchain") return { toolchain: true };
113
+ const field = manifest["xanosdk"];
114
+ if (typeof field === "object" && field !== null) {
115
+ const declaration = field;
116
+ const register2 = declaration["register"];
117
+ if (typeof register2 === "string" && register2 !== "") {
118
+ const declared = declaration["options"];
119
+ return {
120
+ pkg,
121
+ register: register2,
122
+ binding: declaration["returns"] === "handle" ? bindingNameFor(register2) : null,
123
+ // The module's own declaration wins option by option, so a package that
124
+ // ships one is never second-guessed here.
125
+ options: { ...UNDECLARED_OPTIONS[pkg], ...readOptionRefs(declared) },
126
+ optionsVerdict: declared !== void 0 ? { kind: "accounted" } : verdictFromArity(await loadEntryExports(dir, pkg, manifest), register2),
127
+ source: "manifest",
128
+ docs: homepageOf(manifest)
129
+ };
130
+ }
131
+ }
132
+ const entry = await loadEntryExports(dir, pkg, manifest);
133
+ if (entry.kind !== "loaded") return { unwired: entry.why };
134
+ const loaded = entry.exports;
135
+ const names = Object.keys(loaded).filter(
136
+ (name) => /^register[A-Z]/.test(name) && typeof loaded[name] === "function"
137
+ );
138
+ if (names.length === 0) {
139
+ return {
140
+ unwired: `it exports no register* function, and its package.json has no "xanosdk" field`
141
+ };
142
+ }
143
+ if (names.length > 1) {
144
+ return {
145
+ unwired: `it exports ${names.length} register* functions (${names.join(", ")}) \u2014 its package.json needs a "xanosdk" field naming the one to call`
146
+ };
147
+ }
148
+ const register = names[0];
149
+ return {
150
+ pkg,
151
+ register,
152
+ optionsVerdict: takesSecondArgument(loaded, register) ? { kind: "undeclared" } : { kind: "accounted" },
153
+ binding: null,
154
+ options: { ...UNDECLARED_OPTIONS[pkg] },
155
+ source: "exports",
156
+ docs: homepageOf(manifest)
157
+ };
158
+ }
159
+ function renderImports(modules) {
160
+ const byPackage = /* @__PURE__ */ new Map();
161
+ const add = (pkg, name) => {
162
+ const names = byPackage.get(pkg) ?? /* @__PURE__ */ new Set();
163
+ names.add(name);
164
+ byPackage.set(pkg, names);
165
+ };
166
+ for (const m of modules) {
167
+ add(m.pkg, m.register);
168
+ for (const ref of Object.values(m.options)) {
169
+ if (isOptionImport(ref)) add(ref.package, ref.export);
170
+ }
171
+ }
172
+ return [...byPackage].map(([pkg, names]) => `import { ${[...names].sort().join(", ")} } from "${pkg}";`);
173
+ }
174
+ function renderRegisterCall(register, options, app = "app") {
175
+ const entries = Object.entries(options);
176
+ const opts = entries.length === 0 ? "" : `, { ${entries.map(([name, ref]) => `${name}: ${isOptionImport(ref) ? ref.export : JSON.stringify(ref.value)}`).join(", ")} }`;
177
+ return `${register}(${app}${opts});`;
178
+ }
179
+ function renderXanoIndexWithModules(appName, modules, unwired = [], env = []) {
180
+ const imports = renderImports(modules).join("\n");
181
+ const calls = modules.map((m) => {
182
+ const call = renderRegisterCall(m.register, m.options);
183
+ return m.binding === null ? call : `const ${m.binding} = ${call}`;
184
+ }).join("\n");
185
+ const note = [];
186
+ if (unwired.length > 0) {
187
+ note.push(
188
+ "Installed but NOT registered \u2014 each needs something this scaffold could",
189
+ "not supply. Uncomment, fill in the options, and the module is live."
190
+ );
191
+ for (const m of unwired) {
192
+ note.push("", m.pkg, ...wrapAt(`${m.reason}.`, 72).map((line) => ` ${line}`), "");
193
+ const details = `npx xanosdk marketplace details ${m.pkg}`;
194
+ const lookup = m.readme === void 0 ? `run \`${details}\`` : `see ${m.readme}`;
195
+ if (m.register === void 0) {
196
+ note.push(` // ${lookup} for the export to call`);
197
+ } else if (m.options !== void 0) {
198
+ note.push(...renderImports([{ pkg: m.pkg, register: m.register, options: m.options }]).map((l) => ` ${l}`));
199
+ note.push(` ${renderRegisterCall(m.register, m.options)}`);
200
+ } else {
201
+ note.push(
202
+ ` import { ${m.register} } from "${m.pkg}";`,
203
+ ` ${m.register}(app, { ... }); // options: ${lookup}`
204
+ );
205
+ }
206
+ }
207
+ }
208
+ const unwiredNote = note.length === 0 ? "" : `/*
209
+ ${note.map((line) => line === "" ? " *" : ` * ${line}`).join("\n").replaceAll("*/", "* /")}
210
+ */`;
211
+ const envBlock = env.length === 0 ? "" : `// Env vars the add-ons read. Set their values in xano/.env (see xano/.env.example).
212
+ app.registerWorkspace(workspaceConfig({ env: { ${env.map((name) => `${/^[A-Za-z_$][\w$]*$/.test(name) ? name : JSON.stringify(name)}: ""`).join(", ")} } }));`;
213
+ const body = [calls, envBlock, unwiredNote].filter(Boolean).map((block) => `${block}
214
+
215
+ `).join("");
216
+ const importLines = imports === "" ? "" : `${imports}
217
+ `;
218
+ const opening = wrapAt(
219
+ "A workspace is assembled by registering typed objects onto a workspace() instance and default-exporting it. " + (modules.length === 0 ? "The add-ons you picked were installed by `xanosdk init --marketplace`. None of them could be registered for you \u2014 the note below names what each one still needs." : "The add-ons below were installed by `xanosdk init --marketplace` and registered for you." + (unwired.length === 0 ? "" : " The ones that could not be registered are named under them.")),
220
+ 74
221
+ ).join("\n * ");
222
+ const handles = modules.filter((m) => m.binding !== null);
223
+ const handleNote = handles.length === 0 ? "" : `
224
+ *
225
+ * ${handles.map((m) => `\`${m.binding}\` is ${m.pkg}'s handle \u2014 its endpoints and helpers.`).join("\n * ")}`;
226
+ return `import { ${env.length === 0 ? "workspace" : "workspace, workspaceConfig"} } from "@xano/sdk";
227
+ ${importLines}
228
+ /**
229
+ * The ${appName} backend.
230
+ *
231
+ * ${opening}
232
+ *
233
+ * Each register* call mutates the workspace, so the order does not matter and
234
+ * the thing exported is the workspace itself. Add your own tables and endpoints
235
+ * beside them \u2014 xano/EXAMPLE.md walks through the first one.${handleNote}
236
+ */
237
+ const app = workspace("${appName}");
238
+
239
+ ${body}export default app;
240
+ `;
241
+ }
242
+ function isMissingPackage(stderr) {
243
+ return /\bE404\b|is not in this registry/i.test(stderr);
244
+ }
245
+ function rebaseLocalSpec(spec, from, to) {
246
+ const path = localPathOf(spec);
247
+ if (path === void 0 || isAbsolute(path)) return spec;
248
+ const abs = resolve(from, path);
249
+ if (!existsSync(abs)) {
250
+ throw new UsageError(`\`--marketplace\`: ${spec} is not on disk (looked for ${abs}).`, {
251
+ helpFor: { command: "init" }
252
+ });
253
+ }
254
+ const rel = relative(resolve(to), abs).split(sep).join("/");
255
+ const rebased = rel.startsWith("..") ? rel : `./${rel}`;
256
+ return spec.startsWith("file:") ? `file:${rebased}` : rebased;
257
+ }
258
+ function preflightPackages(specifiers, targetDir, view = npmViewVersion) {
259
+ const packages = specifiers.filter((p) => !isLocalSpecifier(p));
260
+ if (packages.length === 0) return;
261
+ step(`Checking ${packages.join(", ")} on the npm registry`);
262
+ const cwd = nearestExistingDir(targetDir);
263
+ const missing = [];
264
+ for (const specifier of packages) {
265
+ const result = view(packageNameOf(specifier), cwd);
266
+ if (!result.ok && isMissingPackage(result.stderr)) missing.push(packageNameOf(specifier));
267
+ }
268
+ if (missing.length === 0) return;
269
+ const names = [...new Set(missing)].join(", ");
270
+ throw new UsageError(
271
+ `\`--marketplace\`: the npm registry has no ${missing.length === 1 ? "package" : "packages"} named ${names}. Check the name with \`xanosdk marketplace search\`, or list what is published with \`xanosdk marketplace list\`. (A package published in the last few minutes can 404 until the registry finishes replicating it \u2014 if the name is right, retry.)`,
272
+ { helpFor: { command: "init" } }
273
+ );
274
+ }
275
+ function nearestExistingDir(dir) {
276
+ let current = resolve(dir);
277
+ for (; ; ) {
278
+ if (existsSync(current)) return current;
279
+ const parent = dirname(current);
280
+ if (parent === current) return process.cwd();
281
+ current = parent;
282
+ }
283
+ }
284
+ function wiringPointer(registration) {
285
+ const details = registration.readme === void 0 ? `run \`npx xanosdk marketplace details ${registration.pkg} --prompt\` for its wiring` : `see ${registration.readme} (from the project root) for its wiring`;
286
+ return registration.docs === void 0 ? details : `${details}, or see ${registration.docs}`;
287
+ }
288
+ function partitionRegistrations(registered, present) {
289
+ const writable = [];
290
+ const unwired = [];
291
+ for (const registration of registered) {
292
+ const missingRefs = Object.entries(registration.options).filter(
293
+ (entry) => isOptionImport(entry[1]) && !present.has(entry[1].package)
294
+ );
295
+ const missing = [...new Set(missingRefs.map(([, ref]) => ref.package))];
296
+ let reason = null;
297
+ let options;
298
+ if (missing.length > 0) {
299
+ const names = missingRefs.map(([name]) => `\`${name}\``).join(", ");
300
+ reason = `${registration.register}() needs ${names} from ${missing.join(", ")}, which this project does not have \u2014 add it with ${missing.map((pkg) => `\`npx xanosdk marketplace install ${pkg}\``).join(", ")} and wire it as that prints, uncommenting the ${registration.register}() call in xano/index.ts before its last step; or pass your own value for ${names}`;
301
+ if (registration.optionsVerdict.kind === "accounted") options = registration.options;
302
+ } else if (registration.optionsVerdict.kind === "undeclared") {
303
+ reason = `${registration.register}() takes an options argument that ${registration.pkg} does not declare \u2014 ${wiringPointer(registration)}`;
304
+ } else if (registration.optionsVerdict.kind === "unreadable") {
305
+ reason = `${registration.pkg} names ${registration.register}() but ${registration.optionsVerdict.why}, so whether the call takes options could not be settled \u2014 ${wiringPointer(registration)}`;
306
+ }
307
+ if (reason === null) {
308
+ writable.push(registration);
309
+ continue;
310
+ }
311
+ unwired.push({
312
+ pkg: registration.pkg,
313
+ reason,
314
+ ...registration.readme === void 0 ? {} : { readme: registration.readme },
315
+ register: registration.register,
316
+ ...options === void 0 ? {} : { options }
317
+ });
318
+ }
319
+ return { writable, unwired };
320
+ }
321
+ function classifyNpmFailure(output, dir) {
322
+ const target = /No matching version found for (\S+)@(.+?)\.?\s*$/m.exec(output);
323
+ if (/\bETARGET\b/.test(output) && target !== null) {
324
+ const [, pkg, range] = target;
325
+ const own = declaredRange(dir, pkg) === range;
326
+ return `npm has no published ${pkg} matching ${range}` + (own ? ` \u2014 the range this project's package.json declares for it. Point it at a published version (\`npm view ${pkg} versions\`) and run \`npm install\` again.` : ` \u2014 a range this package, or one of its dependencies, asks for.`);
327
+ }
328
+ const missing = /'((?:@[^/'\s]+\/)?[^@'\s]+)(?:@[^'\s]*)?' is not in (?:this|the npm) registry/.exec(output);
329
+ if (/\bE404\b/.test(output)) {
330
+ return missing === null ? `npm answered 404: a package this install needs is not in the registry.` : `npm answered 404: ${missing[1]} is not in the registry.`;
331
+ }
332
+ return void 0;
333
+ }
334
+ function declaredRange(dir, pkg) {
335
+ try {
336
+ const manifest = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
337
+ for (const block of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
338
+ const range = manifest[block]?.[pkg];
339
+ if (typeof range === "string") return range;
340
+ }
341
+ } catch {
342
+ }
343
+ return void 0;
344
+ }
345
+ function inProject(dir) {
346
+ const here = process.cwd();
347
+ if (resolve(dir) === resolve(here)) return "";
348
+ const rel = relative(here, resolve(dir));
349
+ return `cd ${shellWord(rel === "" || rel.startsWith("..") ? resolve(dir) : rel)} && `;
350
+ }
351
+ async function installModules(dir, packages) {
352
+ const installed = [];
353
+ const failed = [];
354
+ const reported = [];
355
+ const legacyPeer = [];
356
+ const registered = [];
357
+ const unwired = [];
358
+ const toolchain = [];
359
+ const present = /* @__PURE__ */ new Set();
360
+ const { manager } = installSite(dir);
361
+ for (const specifier of packages) {
362
+ const spin = spinner(`Installing ${specifier}`);
363
+ let result;
364
+ try {
365
+ result = await addDependency(dir, specifier, {
366
+ onLink: (member) => spin.update(`Linking ${member} into the npm workspace`),
367
+ onRetry: () => spin.update(`Installing ${specifier} (retrying with --legacy-peer-deps)`)
368
+ });
369
+ } finally {
370
+ spin.stop();
371
+ }
372
+ const { site, installSpec } = result;
373
+ const peerConflict = result.peerConflict;
374
+ if (peerConflict !== null && result.status === 0) legacyPeer.push(specifier);
375
+ if (result.status !== 0) {
376
+ failed.push(specifier);
377
+ const cause = classifyNpmFailure(result.output, dir);
378
+ const reason = condenseNpmError(result.output);
379
+ if (reason !== "") reported.push(reason);
380
+ warn(`${manager} ${[...addArgs(manager, installSpec), ...site.scope].join(" ")} failed \u2014 the module was not added.`, "module.install-failed", [
381
+ ...cause !== void 0 ? [cause] : (
382
+ // Said even though the retry's own error follows, because the retry is
383
+ // otherwise invisible: it was announced only in spinner text, which the
384
+ // spinner erases. Only when the peer conflict is still what failed.
385
+ peerConflict !== null ? [
386
+ result.retried ? `It declares a peer range this CLI does not satisfy; --legacy-peer-deps did not resolve it either.` : `It declares a peer range this CLI does not satisfy, and the install ran out of time before --legacy-peer-deps could be tried.`
387
+ ] : []
388
+ ),
389
+ ...reason === "" ? [] : [reason],
390
+ // Named, so the line is a command to paste rather than a template — and
391
+ // from inside the new project, since it is printed before the `cd`.
392
+ `Add it with \`${inProject(dir)}xanosdk marketplace install ${specifier}\` once ${manager}'s error is fixed.`
393
+ ]);
394
+ continue;
395
+ }
396
+ if (peerConflict !== null) {
397
+ warn(
398
+ `${specifier} declares a peer range this CLI does not satisfy \u2014 installed with --legacy-peer-deps.`,
399
+ "module.legacy-peer-deps"
400
+ );
401
+ }
402
+ const pkg = result.landed;
403
+ if (pkg === void 0) {
404
+ failed.push(specifier);
405
+ warn(
406
+ `${manager} reported ${specifier} installed, but ${result.recorded === void 0 ? "it is not in this project's package.json" : `${result.recorded} does not resolve from this project`} \u2014 the module was not added.`,
407
+ "module.install-failed",
408
+ [`Add it with \`${inProject(dir)}xanosdk marketplace install ${shellWord(specifier)}\`.`]
409
+ );
410
+ continue;
411
+ }
412
+ const skew = await sdkPeerSkewOf(dir, pkg);
413
+ if (skew !== null) {
414
+ failed.push(specifier);
415
+ warn(
416
+ `${specifier} requires \`@xano/sdk\` ${skew.range} \u2014 the module was not added.`,
417
+ "module.sdk-skew",
418
+ [
419
+ `This CLI is ${skew.sdkVersion}, so its hooks were built against a contract this one does not have. Upgrade the CLI, or use a ${pkg} built for it.`
420
+ ]
421
+ );
422
+ await removeQuietly(dir, pkg);
423
+ continue;
424
+ }
425
+ success(`Installed ${specifier}`);
426
+ installed.push(specifier);
427
+ present.add(pkg);
428
+ const registration = await readRegistration(dir, pkg);
429
+ const readme = isLocalSpecifier(specifier) ? localReadme(dir, pkg) : void 0;
430
+ const where = readme === void 0 ? {} : { readme };
431
+ if ("toolchain" in registration) toolchain.push(pkg);
432
+ else if ("unwired" in registration) {
433
+ const reason = readme === void 0 ? registration.unwired : `${registration.unwired} \u2014 see ${readme} (from the project root) for its wiring`;
434
+ unwired.push({ pkg, reason, ...where });
435
+ } else registered.push({ ...registration, ...where });
436
+ }
437
+ const { writable, unwired: unwritable } = partitionRegistrations(registered, present);
438
+ unwired.push(...unwritable);
439
+ return { installed, failed, reported, legacyPeer, registered: writable, unwired, toolchain };
440
+ }
441
+ function localReadme(dir, pkg) {
442
+ const at = installedPackageDir(dir, pkg);
443
+ if (at === null) return void 0;
444
+ const readme = ["README.md", "readme.md", "README"].map((name) => join(at, name)).find((path) => existsSync(path));
445
+ return relative(realpathSync(dir), readme ?? at).split(sep).join("/");
446
+ }
447
+ async function sdkPeerSkewOf(dir, pkg) {
448
+ const manifest = readInstalledManifest(dir, pkg);
449
+ if (manifest === null) return null;
450
+ const [{ sdkPeerSkew }, { readVersion }] = await Promise.all([
451
+ import("./toolchain-modules-5EAZUONB.js"),
452
+ import("./cli.js")
453
+ ]);
454
+ const sdkVersion = readVersion();
455
+ const range = sdkPeerSkew(manifest, sdkVersion);
456
+ return range === null ? null : { range, sdkVersion };
457
+ }
458
+ async function removeQuietly(dir, pkg) {
459
+ const result = await removeDependency(dir, pkg);
460
+ if (result.status === 0 && !result.stillListed) return;
461
+ warn(
462
+ `${pkg} could not be removed again \u2014 it is still in this project's dependencies.`,
463
+ "module.uninstall-failed",
464
+ [`Run \`${inProject(dir)}${removeCommandFor(dir, pkg)}\` to finish taking it out.`]
465
+ );
466
+ }
467
+
468
+ export {
469
+ isOptionImport,
470
+ parseMarketplaceFlag,
471
+ readRegistration,
472
+ renderImports,
473
+ renderRegisterCall,
474
+ renderXanoIndexWithModules,
475
+ isMissingPackage,
476
+ rebaseLocalSpec,
477
+ preflightPackages,
478
+ partitionRegistrations,
479
+ classifyNpmFailure,
480
+ inProject,
481
+ installModules
482
+ };
483
+ //# sourceMappingURL=chunk-DX4QR4B2.js.map
@@ -0,0 +1,21 @@
1
+ // src/bundle/schema.ts
2
+ function tableRefOf(column) {
3
+ if (column.type !== "int" && column.type !== "uuid") return null;
4
+ const last = column.methods?.[column.methods.length - 1];
5
+ const arg = last?.name === "@" ? last.arg?.[0] : void 0;
6
+ if (typeof arg !== "string" || !arg.startsWith("dbo=")) return null;
7
+ const guid = arg.slice("dbo=".length);
8
+ return guid === "" ? null : guid;
9
+ }
10
+ function linkedTableOf(column) {
11
+ const suffix = "_mvpschema";
12
+ if (typeof column.type !== "string" || !column.type.endsWith(suffix)) return null;
13
+ const guid = column.type.slice(0, -suffix.length);
14
+ return guid === "" ? null : guid;
15
+ }
16
+
17
+ export {
18
+ tableRefOf,
19
+ linkedTableOf
20
+ };
21
+ //# sourceMappingURL=chunk-EHP3WPEG.js.map