@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,390 @@
1
+ import {
2
+ declaredDependencies,
3
+ readProjectManifest,
4
+ readToolchainBlock
5
+ } from "./chunk-JTUKLCXS.js";
6
+ import {
7
+ localPackageName,
8
+ packageNameOf
9
+ } from "./chunk-3LDULPRE.js";
10
+ import {
11
+ parseJsonAnswer,
12
+ serverMessage,
13
+ statusLabel
14
+ } from "./chunk-YLDALTWZ.js";
15
+ import {
16
+ readEnvVar
17
+ } from "./chunk-X2NL4KUO.js";
18
+ import {
19
+ CliError,
20
+ EXIT_SOURCE_UNRESOLVABLE,
21
+ info
22
+ } from "./chunk-PTHVMXZI.js";
23
+ import {
24
+ suggest
25
+ } from "./chunk-UTI5G6OJ.js";
26
+
27
+ // src/emit/marketplace-catalogue.ts
28
+ var DEFAULT_BASE_URL = "https://xare-rvr8-mnnt.dev.xano.io";
29
+ var CATALOGUE_TIMEOUT_MS = 3e4;
30
+ function baseUrl() {
31
+ return readEnvVar("XANOSDK_MARKETPLACE_URL") ?? DEFAULT_BASE_URL;
32
+ }
33
+ function asString(v) {
34
+ return typeof v === "string" && v !== "" ? v : void 0;
35
+ }
36
+ function asStringArray(v) {
37
+ return Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : [];
38
+ }
39
+ function asBoolean(v) {
40
+ return typeof v === "boolean" ? v : void 0;
41
+ }
42
+ function asRecord(v) {
43
+ return typeof v === "object" && v !== null && !Array.isArray(v) ? v : void 0;
44
+ }
45
+ function projectRow(raw) {
46
+ return {
47
+ id: typeof raw.id === "number" ? raw.id : void 0,
48
+ slug: asString(raw.slug),
49
+ npm_package: asString(raw.npm_package),
50
+ title: asString(raw.title),
51
+ tagline: asString(raw.tagline),
52
+ tags: asStringArray(raw.tags),
53
+ repo_url: asString(raw.repo_url),
54
+ docs_url: asString(raw.docs_url),
55
+ // Closed set: an unknown kind is not passed through for a caller to guess at.
56
+ kind: raw.kind === "workspace" || raw.kind === "toolchain" ? raw.kind : void 0
57
+ };
58
+ }
59
+ function projectRequirements(v) {
60
+ if (!Array.isArray(v)) return [];
61
+ return v.map((entry) => typeof entry === "string" ? entry : asString(asRecord(entry)?.text)).filter((t) => t !== void 0);
62
+ }
63
+ function projectIncludes(v) {
64
+ if (!Array.isArray(v)) return [];
65
+ return v.flatMap((entry) => {
66
+ const rec = asRecord(entry);
67
+ if (rec === void 0) return [];
68
+ return [{ kind: asString(rec.kind), name: asString(rec.name), summary: asString(rec.summary) }];
69
+ });
70
+ }
71
+ function projectModule(raw) {
72
+ return {
73
+ ...projectRow(raw),
74
+ description: asString(raw.description),
75
+ includes: projectIncludes(raw.includes),
76
+ requirements: projectRequirements(raw.requirements),
77
+ register_snippet: asString(raw.register_snippet),
78
+ agent_prompt: asString(raw.agent_prompt),
79
+ listed: asBoolean(raw.listed),
80
+ deleted: asBoolean(raw.deleted)
81
+ };
82
+ }
83
+ var ModuleNotFoundError = class extends Error {
84
+ name = "ModuleNotFoundError";
85
+ constructor(message) {
86
+ super(message);
87
+ }
88
+ };
89
+ var CatalogueHttpError = class extends Error {
90
+ constructor(status, detail, message) {
91
+ super(message);
92
+ this.status = status;
93
+ this.detail = detail;
94
+ }
95
+ status;
96
+ detail;
97
+ name = "CatalogueHttpError";
98
+ };
99
+ var CatalogueUnreachableError = class extends Error {
100
+ name = "CatalogueUnreachableError";
101
+ exitCode = EXIT_SOURCE_UNRESOLVABLE;
102
+ };
103
+ function isCatalogueOutage(err) {
104
+ return err instanceof CatalogueUnreachableError || err instanceof CatalogueHttpError && err.status >= 500;
105
+ }
106
+ async function read(path, params) {
107
+ let url;
108
+ try {
109
+ url = new URL(path, baseUrl());
110
+ } catch {
111
+ throw new Error(
112
+ `XANOSDK_MARKETPLACE_URL is not a valid URL: ${JSON.stringify(process.env.XANOSDK_MARKETPLACE_URL)}`
113
+ );
114
+ }
115
+ for (const [key, value] of Object.entries(params ?? {})) {
116
+ url.searchParams.set(key, value);
117
+ }
118
+ let res;
119
+ try {
120
+ res = await fetch(url.href, {
121
+ headers: { accept: "application/json" },
122
+ signal: AbortSignal.timeout(CATALOGUE_TIMEOUT_MS)
123
+ });
124
+ } catch (err) {
125
+ throw new CatalogueUnreachableError(
126
+ `Could not reach the marketplace catalogue at ${url.origin} \u2014 ${err instanceof Error ? err.message : String(err)}`
127
+ );
128
+ }
129
+ const text = await res.text();
130
+ if (!res.ok) {
131
+ const detail = serverMessage(text);
132
+ throw new CatalogueHttpError(
133
+ res.status,
134
+ detail,
135
+ `The marketplace catalogue returned ${statusLabel(res)} for ${url.pathname}` + (detail !== void 0 ? `:
136
+ ${detail}` : ".")
137
+ );
138
+ }
139
+ return parseJsonAnswer(text, "Reading the marketplace catalogue", url.href);
140
+ }
141
+ function describe(value) {
142
+ if (value === null) return "null";
143
+ if (Array.isArray(value)) return "an array";
144
+ if (typeof value === "object") {
145
+ const keys = Object.keys(value);
146
+ return `an object with keys ${keys.length > 0 ? keys.join(", ") : "(none)"}`;
147
+ }
148
+ return typeof value;
149
+ }
150
+ function expectArray(value, path) {
151
+ if (!Array.isArray(value)) {
152
+ throw new Error(`Expected ${path} to return a list of modules, got ${describe(value)}.`);
153
+ }
154
+ return value.flatMap((entry) => {
155
+ const rec = asRecord(entry);
156
+ return rec === void 0 ? [] : [rec];
157
+ });
158
+ }
159
+ async function fetchCatalogue() {
160
+ const path = "/api:marketplace/plugins";
161
+ return expectArray(await read(path), path).filter((raw) => raw.deleted !== true).map(projectModule);
162
+ }
163
+ var SEARCHED = ["title", "slug", "npm_package", "tagline", "description"];
164
+ async function searchCatalogue(query) {
165
+ const needle = query.toLowerCase();
166
+ return (await fetchCatalogue()).filter(
167
+ (mod) => SEARCHED.some((column) => {
168
+ const value = mod[column];
169
+ return typeof value === "string" && value.toLowerCase().includes(needle);
170
+ })
171
+ );
172
+ }
173
+ async function fetchModule(pkg) {
174
+ const path = "/api:marketplace/plugins-details";
175
+ let body;
176
+ try {
177
+ body = await read(path, { package: pkg });
178
+ } catch (err) {
179
+ if (err instanceof CatalogueHttpError && err.status === 404) {
180
+ throw new ModuleNotFoundError(err.detail ?? "No module is published under that name.");
181
+ }
182
+ throw err;
183
+ }
184
+ if (body === null) {
185
+ throw new ModuleNotFoundError("No module is published under that name.");
186
+ }
187
+ const raw = asRecord(body);
188
+ if (raw === void 0) {
189
+ throw new Error(`Expected ${path} to return one module, got ${describe(body)}.`);
190
+ }
191
+ return projectModule(raw);
192
+ }
193
+
194
+ // src/emit/marketplace-resolve.ts
195
+ var FIRST_PARTY_SCOPE = "@xano-sdk/";
196
+ function isLocalSpecifier(spec) {
197
+ return /^(file|git|git\+[a-z]+|https?|link|workspace):/i.test(spec) || /^[./~]/.test(spec) || /\.(tgz|tar\.gz)$/i.test(spec);
198
+ }
199
+ var MarketplaceModuleNotFoundError = class extends Error {
200
+ name = "MarketplaceModuleNotFoundError";
201
+ exitCode = EXIT_SOURCE_UNRESOLVABLE;
202
+ /** The near name to type — the failure document's `suggestion` (the first of {@link suggestions}). */
203
+ suggestion;
204
+ /** Every near name, one per missed name, when there is more than one. */
205
+ suggestions;
206
+ /**
207
+ * Of a list lookup ({@link resolveMarketplaceSpecs}): every name's package,
208
+ * each missed one swapped for the listed module it is one slip from — set
209
+ * only when every miss has one. What a caller spells its corrected
210
+ * commands from.
211
+ */
212
+ corrected;
213
+ constructor(message, near = []) {
214
+ super(message);
215
+ this.suggestion = near[0];
216
+ this.suggestions = near.length > 1 ? [...near] : void 0;
217
+ }
218
+ };
219
+ function searchHint(name) {
220
+ const query = name.startsWith(FIRST_PARTY_SCOPE) ? name.slice(FIRST_PARTY_SCOPE.length) : name;
221
+ return `Run \`xanosdk marketplace search ${query}\` to find the module's real name, or \`xanosdk marketplace list\` for every one.`;
222
+ }
223
+ async function missHint(names) {
224
+ let byName;
225
+ try {
226
+ byName = spellingsOf((await fetchCatalogue()).flatMap((row) => row.npm_package === void 0 ? [] : [row.npm_package]));
227
+ } catch {
228
+ return { text: searchHint(names[0]), near: [], modules: [] };
229
+ }
230
+ const near = nearNames(names, byName);
231
+ if (near.length === 0) return { text: searchHint(names[0]), near: [], modules: [] };
232
+ return {
233
+ text: `Did you mean ${saidNear(near, names.length)}? \`xanosdk marketplace list\` lists every module.`,
234
+ near: near.map((n) => n.hit),
235
+ modules: near
236
+ };
237
+ }
238
+ async function notFound(head, names) {
239
+ return (await notFoundWith(head, names)).err;
240
+ }
241
+ async function notFoundWith(head, names) {
242
+ const hint = await missHint(names);
243
+ return { err: new MarketplaceModuleNotFoundError(`${head} ${hint.text}`, hint.near), modules: hint.modules };
244
+ }
245
+ function spellingsOf(packages) {
246
+ const byName = /* @__PURE__ */ new Map();
247
+ for (const pkg of packages) {
248
+ byName.set(pkg, pkg);
249
+ if (pkg.startsWith(FIRST_PARTY_SCOPE)) byName.set(pkg.slice(FIRST_PARTY_SCOPE.length), pkg);
250
+ }
251
+ return byName;
252
+ }
253
+ function nearPackage(name, packages) {
254
+ const byName = spellingsOf(packages);
255
+ const exact = byName.get(name);
256
+ if (exact !== void 0 && exact !== name) return { name, hit: exact, pkg: exact };
257
+ return nearNames([name], byName)[0];
258
+ }
259
+ function nearNames(names, byName) {
260
+ const spellings = [...byName.keys()];
261
+ return names.flatMap((name) => {
262
+ const bare = name.startsWith(FIRST_PARTY_SCOPE) ? name.slice(FIRST_PARTY_SCOPE.length) : name;
263
+ const hit = suggest(bare, spellings) ?? suggest(name, spellings);
264
+ return hit === void 0 || hit === name ? [] : [{ name, hit, pkg: byName.get(hit) }];
265
+ });
266
+ }
267
+ function saidNear(near, of) {
268
+ return near.map(({ name, hit, pkg }) => `\`${hit}\`${pkg === hit ? "" : ` (${pkg})`}${of > 1 ? ` for ${name}` : ""}`).join(", ");
269
+ }
270
+ async function resolveMarketplaceSpec(spec, command) {
271
+ if (isLocalSpecifier(spec)) return spec;
272
+ const name = packageNameOf(spec);
273
+ const version = spec.length > name.length ? spec.slice(name.length) : "";
274
+ let mod;
275
+ try {
276
+ mod = await fetchModule(name);
277
+ } catch (err) {
278
+ if (err instanceof ModuleNotFoundError) {
279
+ throw await notFound(
280
+ `\`${command}\`: ${name} is not in the Xano SDK marketplace, so nothing was installed.`,
281
+ [name]
282
+ );
283
+ }
284
+ if (name.startsWith(FIRST_PARTY_SCOPE)) return spec;
285
+ const message = `\`${command}\`: could not reach the Xano SDK marketplace to confirm that ${name} is a module (${err instanceof Error ? err.message : String(err)}), so nothing was installed. An \`${FIRST_PARTY_SCOPE}\` module installs by its full name without it.`;
286
+ throw isCatalogueOutage(err) ? new CatalogueUnreachableError(message) : new Error(message);
287
+ }
288
+ if (mod.deleted === true) {
289
+ throw new MarketplaceModuleNotFoundError(
290
+ `\`${command}\`: ${mod.npm_package ?? name} has been removed from the Xano SDK marketplace, so nothing was installed. Run \`xanosdk marketplace list\` for the modules that are published.`
291
+ );
292
+ }
293
+ const pkg = mod.npm_package ?? name;
294
+ if (pkg !== name) info(`${name} is the marketplace module ${pkg}.`);
295
+ return `${pkg}${version}`;
296
+ }
297
+ async function resolveMarketplaceSpecs(specs, command) {
298
+ const resolved = [];
299
+ const missing = [];
300
+ for (const spec of specs) {
301
+ try {
302
+ resolved.push(await resolveMarketplaceSpec(spec, command));
303
+ } catch (err) {
304
+ if (!(err instanceof MarketplaceModuleNotFoundError)) throw err;
305
+ if (specs.length === 1) throw err;
306
+ missing.push(packageNameOf(spec));
307
+ resolved.push(void 0);
308
+ }
309
+ }
310
+ if (missing.length > 0) {
311
+ const { err, modules } = await notFoundWith(
312
+ `\`${command}\`: ${missing.join(", ")} ${missing.length === 1 ? "is" : "are"} not in the Xano SDK marketplace, so nothing was installed.`,
313
+ missing
314
+ );
315
+ const fix = new Map(modules.map((m) => [m.name, m.pkg]));
316
+ if (missing.every((name) => fix.has(name))) {
317
+ err.corrected = specs.map((spec, i) => resolved[i] ?? fix.get(packageNameOf(spec)));
318
+ }
319
+ throw err;
320
+ }
321
+ return resolved;
322
+ }
323
+ async function resolveProjectModule(spec, dir) {
324
+ return (await resolveProjectModuleListing(spec, dir)).pkg;
325
+ }
326
+ async function resolveProjectModuleListing(spec, dir) {
327
+ const manifest = readProjectManifest(dir);
328
+ const known = /* @__PURE__ */ new Set([
329
+ ...manifest === null ? [] : declaredDependencies(manifest),
330
+ ...Object.keys(readToolchainBlock(dir, manifest))
331
+ ]);
332
+ if (isLocalSpecifier(spec)) {
333
+ const name = localPackageName(spec, dir);
334
+ if (name === void 0) return { pkg: spec, listing: "unknown" };
335
+ return { pkg: name, listing: known.has(name) ? "project" : "unknown" };
336
+ }
337
+ if (known.has(spec)) return { pkg: spec, listing: "project" };
338
+ let mod;
339
+ try {
340
+ mod = await fetchModule(spec);
341
+ } catch (err) {
342
+ return { pkg: spec, listing: err instanceof ModuleNotFoundError ? "unlisted" : "unknown" };
343
+ }
344
+ if (mod.deleted === true && !known.has(mod.npm_package ?? spec)) return { pkg: spec, listing: "unlisted" };
345
+ const pkg = mod.npm_package ?? spec;
346
+ if (pkg !== spec) info(`${spec} is the marketplace module ${pkg}.`);
347
+ return { pkg, listing: known.has(pkg) ? "project" : "catalogue" };
348
+ }
349
+ async function notInMarketplaceError(command, name) {
350
+ return notFound(
351
+ `\`${command}\`: ${name} is not in the Xano SDK marketplace.`,
352
+ [name]
353
+ );
354
+ }
355
+ async function unlistedModuleError(command, name) {
356
+ return notFound(
357
+ `\`${command}\`: ${name} is not a dependency of this project and not in the Xano SDK marketplace.`,
358
+ [name]
359
+ );
360
+ }
361
+ async function withCatalogueRerun(err, args, command) {
362
+ if (!isCatalogueOutage(err)) return err;
363
+ const { retryCommand } = await import("./retry-command-AS5EVREX.js");
364
+ const rerun = retryCommand(args, { command }).command;
365
+ return new CliError("SDK_ERROR", `${err.message}
366
+ Run \`${rerun}\` again once it answers.`, {
367
+ exitCode: EXIT_SOURCE_UNRESOLVABLE,
368
+ details: { reason: "catalogue-unreachable", rerun },
369
+ cause: err
370
+ });
371
+ }
372
+
373
+ export {
374
+ ModuleNotFoundError,
375
+ fetchCatalogue,
376
+ searchCatalogue,
377
+ fetchModule,
378
+ FIRST_PARTY_SCOPE,
379
+ isLocalSpecifier,
380
+ MarketplaceModuleNotFoundError,
381
+ nearPackage,
382
+ resolveMarketplaceSpec,
383
+ resolveMarketplaceSpecs,
384
+ resolveProjectModule,
385
+ resolveProjectModuleListing,
386
+ notInMarketplaceError,
387
+ unlistedModuleError,
388
+ withCatalogueRerun
389
+ };
390
+ //# sourceMappingURL=chunk-2GNFDZA2.js.map
@@ -0,0 +1,11 @@
1
+ // src/util/timestamp.ts
2
+ function asTimestamp(v) {
3
+ if (typeof v !== "string" || v === "") return void 0;
4
+ const parsed = new Date(v);
5
+ return Number.isNaN(parsed.getTime()) ? v : parsed.toISOString();
6
+ }
7
+
8
+ export {
9
+ asTimestamp
10
+ };
11
+ //# sourceMappingURL=chunk-2MNLRIOX.js.map
@@ -0,0 +1,104 @@
1
+ // src/emit/semver.ts
2
+ function parseSemver(v) {
3
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
4
+ if (!m) return null;
5
+ return {
6
+ nums: [Number(m[1]), Number(m[2]), Number(m[3])],
7
+ pre: m[4] ? m[4].split(".") : []
8
+ };
9
+ }
10
+ function compareSemver(a, b) {
11
+ for (let i = 0; i < 3; i++) {
12
+ if (a.nums[i] !== b.nums[i]) return a.nums[i] > b.nums[i] ? 1 : -1;
13
+ }
14
+ if (a.pre.length === 0) return b.pre.length === 0 ? 0 : 1;
15
+ if (b.pre.length === 0) return -1;
16
+ return comparePre(a.pre, b.pre);
17
+ }
18
+ function comparePre(a, b) {
19
+ const len = Math.max(a.length, b.length);
20
+ for (let i = 0; i < len; i++) {
21
+ if (i >= a.length) return -1;
22
+ if (i >= b.length) return 1;
23
+ const x = a[i];
24
+ const y = b[i];
25
+ const xn = /^\d+$/.test(x);
26
+ const yn = /^\d+$/.test(y);
27
+ if (xn && yn) {
28
+ if (Number(x) !== Number(y)) return Number(x) < Number(y) ? -1 : 1;
29
+ } else if (xn !== yn) {
30
+ return xn ? -1 : 1;
31
+ } else if (x !== y) {
32
+ return x < y ? -1 : 1;
33
+ }
34
+ }
35
+ return 0;
36
+ }
37
+ function satisfiesRange(version, range) {
38
+ const v = parseSemver(version);
39
+ if (!v || v.pre.length > 0) return null;
40
+ const text = range.trim();
41
+ if (text === "" || text === "*" || text === "x" || text === "X") return true;
42
+ let unknown = false;
43
+ for (const group of text.split("||")) {
44
+ const result = satisfiesAll(v, group);
45
+ if (result === true) return true;
46
+ if (result === null) unknown = true;
47
+ }
48
+ return unknown ? null : false;
49
+ }
50
+ function satisfiesAll(v, group) {
51
+ const tokens = group.trim().replace(/(>=|<=|>|<|=|\^|~)\s+/g, "$1").split(/\s+/).filter((t) => t !== "");
52
+ if (tokens.length === 0) return true;
53
+ if (tokens.some((t) => t === "-" || t.startsWith("-"))) return null;
54
+ let unknown = false;
55
+ for (const token of tokens) {
56
+ const result = satisfiesComparator(v, token);
57
+ if (result === false) return false;
58
+ if (result === null) unknown = true;
59
+ }
60
+ return unknown ? null : true;
61
+ }
62
+ function satisfiesComparator(v, token) {
63
+ if (token === "*" || token === "x" || token === "X") return true;
64
+ const m = /^(>=|<=|>|<|=|\^|~)?\s*(.+)$/.exec(token);
65
+ if (!m) return null;
66
+ const op = m[1] ?? "=";
67
+ const target = parseSemver(m[2]);
68
+ if (!target || target.pre.length > 0) return null;
69
+ const cmp = compareSemver(v, target);
70
+ switch (op) {
71
+ case ">=":
72
+ return cmp >= 0;
73
+ case ">":
74
+ return cmp > 0;
75
+ case "<=":
76
+ return cmp <= 0;
77
+ case "<":
78
+ return cmp < 0;
79
+ case "=":
80
+ return cmp === 0;
81
+ // `^` allows changes that do not modify the left-most NON-ZERO field, which
82
+ // is why `^0.0.30` is an exact pin and `^0.2.3` stops at 0.3.0.
83
+ case "^":
84
+ return cmp >= 0 && compareSemver(v, { nums: caretCeiling(target), pre: [] }) < 0;
85
+ // `~` allows patch-level changes: `~1.2.3` stops at 1.3.0.
86
+ case "~":
87
+ return cmp >= 0 && compareSemver(v, { nums: [target.nums[0], target.nums[1] + 1, 0], pre: [] }) < 0;
88
+ default:
89
+ return null;
90
+ }
91
+ }
92
+ function caretCeiling(target) {
93
+ const [major, minor, patch] = target.nums;
94
+ if (major !== 0) return [major + 1, 0, 0];
95
+ if (minor !== 0) return [0, minor + 1, 0];
96
+ return [0, 0, patch + 1];
97
+ }
98
+
99
+ export {
100
+ parseSemver,
101
+ compareSemver,
102
+ satisfiesRange
103
+ };
104
+ //# sourceMappingURL=chunk-2TFRR6JV.js.map