@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,531 @@
1
+ import {
2
+ assertProjectDir
3
+ } from "./chunk-3XI5CTUE.js";
4
+ import {
5
+ checkForUpgrade,
6
+ detectInstallMode,
7
+ registryUrl,
8
+ runFromPackageRunner,
9
+ suppressUpdateNotice
10
+ } from "./chunk-LIEOKXKD.js";
11
+ import {
12
+ installedSdk,
13
+ projectSdkVersion
14
+ } from "./chunk-D7VGG3WS.js";
15
+ import "./chunk-2TFRR6JV.js";
16
+ import {
17
+ readVersion
18
+ } from "./chunk-ETO6LGLD.js";
19
+ import "./chunk-ZIY7RNUT.js";
20
+ import "./chunk-DAD3ONIS.js";
21
+ import "./chunk-HHN734BU.js";
22
+ import "./chunk-LPECSJ2J.js";
23
+ import "./chunk-6NNTNXN7.js";
24
+ import "./chunk-QCNYHBL7.js";
25
+ import "./chunk-2ZUEE4EK.js";
26
+ import "./chunk-AN6BL47T.js";
27
+ import "./chunk-ET4Y4XCB.js";
28
+ import "./chunk-SWBF2LTK.js";
29
+ import "./chunk-UZ6QQWJT.js";
30
+ import "./chunk-A3UDOZB6.js";
31
+ import "./chunk-2MNLRIOX.js";
32
+ import "./chunk-3M4LFYNQ.js";
33
+ import "./chunk-AM4FKL4J.js";
34
+ import {
35
+ refreshAgentFiles
36
+ } from "./chunk-Q325JKYB.js";
37
+ import "./chunk-STSFNCY4.js";
38
+ import "./chunk-I4F5TCJH.js";
39
+ import "./chunk-5QU2P5CA.js";
40
+ import "./chunk-ZYJP6BOO.js";
41
+ import "./chunk-QO6BVGS5.js";
42
+ import "./chunk-JZGVVJSI.js";
43
+ import "./chunk-7G3CTU7I.js";
44
+ import "./chunk-6PBR37LN.js";
45
+ import {
46
+ retryCommand
47
+ } from "./chunk-T5KELPAR.js";
48
+ import "./chunk-622HUCZT.js";
49
+ import "./chunk-NAQDMEHV.js";
50
+ import "./chunk-5A2PLKZB.js";
51
+ import "./chunk-AHJWCYQO.js";
52
+ import "./chunk-DX4QR4B2.js";
53
+ import {
54
+ prepareInstallSite,
55
+ refusePlugAndPlay
56
+ } from "./chunk-6QXLMMT3.js";
57
+ import {
58
+ runNpmQuiet,
59
+ runNpmStreaming
60
+ } from "./chunk-ZFDZKNGG.js";
61
+ import "./chunk-FWD7AL6N.js";
62
+ import "./chunk-2GNFDZA2.js";
63
+ import "./chunk-JTUKLCXS.js";
64
+ import {
65
+ trackLocalWrite
66
+ } from "./chunk-4KHEMC32.js";
67
+ import "./chunk-U64O2MXY.js";
68
+ import "./chunk-ROY4YAEQ.js";
69
+ import "./chunk-P2HAGF6H.js";
70
+ import "./chunk-TLQE7ZN3.js";
71
+ import {
72
+ detectPackageManager
73
+ } from "./chunk-WRBKLYSJ.js";
74
+ import "./chunk-3LDULPRE.js";
75
+ import "./chunk-XW6KISBB.js";
76
+ import "./chunk-AWQ7BQTQ.js";
77
+ import "./chunk-EUUUMY7J.js";
78
+ import "./chunk-YLDALTWZ.js";
79
+ import "./chunk-5FBYXK5P.js";
80
+ import "./chunk-LLNZGEFK.js";
81
+ import "./chunk-QXTKSOFI.js";
82
+ import {
83
+ readEnvVar
84
+ } from "./chunk-X2NL4KUO.js";
85
+ import {
86
+ sdkDep
87
+ } from "./chunk-OPHB5ORL.js";
88
+ import "./chunk-UCQ2VUTG.js";
89
+ import "./chunk-DGWHAVRG.js";
90
+ import "./chunk-JGE7CAWB.js";
91
+ import {
92
+ CliError,
93
+ EXIT_SOURCE_UNRESOLVABLE,
94
+ blank,
95
+ detail,
96
+ isMachineOutput,
97
+ step,
98
+ style,
99
+ success,
100
+ terminalText,
101
+ warn,
102
+ writeJson
103
+ } from "./chunk-PTHVMXZI.js";
104
+ import "./chunk-MXHSQOC4.js";
105
+ import "./chunk-6IUMKYWI.js";
106
+ import "./chunk-2CMJZDCL.js";
107
+ import "./chunk-CTMO46PK.js";
108
+ import "./chunk-ZDPP6RKB.js";
109
+ import "./chunk-K5BBGTYZ.js";
110
+ import "./chunk-LQCMKAJ7.js";
111
+ import "./chunk-YGZHHAAB.js";
112
+ import "./chunk-XVBGLISP.js";
113
+ import "./chunk-6HO3NCSJ.js";
114
+ import "./chunk-5V5XU32D.js";
115
+ import "./chunk-GSGDWJB5.js";
116
+ import "./chunk-HVRUQXGD.js";
117
+ import "./chunk-ERVIASGL.js";
118
+ import "./chunk-4POWHT2K.js";
119
+ import "./chunk-H2V3N23D.js";
120
+ import "./chunk-3JDU4VRL.js";
121
+ import "./chunk-WTPZRR4I.js";
122
+ import "./chunk-UTI5G6OJ.js";
123
+ import "./chunk-2EZ3ZJZZ.js";
124
+ import "./chunk-6MR5TI5V.js";
125
+ import "./chunk-5ZSO4T2G.js";
126
+ import "./chunk-XNCP4KYO.js";
127
+ import "./chunk-AKNCFVKZ.js";
128
+ import "./chunk-YU4HSQW7.js";
129
+ import "./chunk-TFFGOFVZ.js";
130
+ import "./chunk-G554NZNI.js";
131
+ import "./chunk-N5GKCWE5.js";
132
+ import "./chunk-OXA6PSZT.js";
133
+ import "./chunk-VAX3UZOY.js";
134
+ import "./chunk-NZOWWHU5.js";
135
+ import "./chunk-4BW2SG2N.js";
136
+ import "./chunk-TTEIYD5P.js";
137
+ import "./chunk-CIMQZRRE.js";
138
+ import "./chunk-OHX6MIUZ.js";
139
+ import "./chunk-36JUQZVQ.js";
140
+ import "./chunk-PZ5AY32C.js";
141
+
142
+ // src/emit/upgrade-command.ts
143
+ import { spawnSync } from "child_process";
144
+ import { existsSync, readFileSync, realpathSync, writeFileSync } from "fs";
145
+ import { createRequire } from "module";
146
+ import { dirname, join, relative, sep } from "path";
147
+ var EXIT_UPGRADE_AVAILABLE = 7;
148
+ var PACKAGE = "@xano/sdk";
149
+ async function runUpgradeCommand(args) {
150
+ suppressUpdateNotice();
151
+ if (process.env[RECONCILE_ENV] === "1") {
152
+ writeJson({ status: "reconciled", reconciled: await reconcileDerived(process.cwd(), readVersion()) });
153
+ return;
154
+ }
155
+ const mode = detectInstallMode();
156
+ const dir = mode === "local" ? sdkProjectDir(process.cwd()) : process.cwd();
157
+ const runner = readEnvVar("XANOSDK_INSTALL_MODE")?.trim() ? void 0 : runFromPackageRunner();
158
+ if (runner !== void 0 && !(mode === "local" && declaresSdk(dir))) {
159
+ reportRunnerCopy(args, runner);
160
+ return;
161
+ }
162
+ const installed = mode === "local" ? projectSdkVersion(dir) : void 0;
163
+ const result = await checkForUpgrade(installed === void 0 ? void 0 : { current: installed });
164
+ if (result.status === "unknown") {
165
+ const message = explainUnknown(result, retryCommand(args, { command: "upgrade" }).command);
166
+ if (result.reason === "registry" && result.refused === void 0) {
167
+ throw new CliError("SDK_ERROR", message, { exitCode: EXIT_SOURCE_UNRESOLVABLE });
168
+ }
169
+ throw new Error(message);
170
+ }
171
+ if (result.status === "current") {
172
+ const ownRange = mode === "local" && !args.check && installed !== void 0 && existsSync(join(dir, "package.json"));
173
+ const reconciled = [
174
+ ...ownRange ? restoreSdkRangeSafely(dir, installed) : [],
175
+ ...ownRange && installed === readVersion() ? [...syncLockToManifest(dir), ...await reconcileDerived(dir, installed)] : []
176
+ ].filter((path, at, all) => all.indexOf(path) === at);
177
+ success(`@xano/sdk ${style.bold(result.current)} is the latest published version.`);
178
+ for (const path of reconciled) detail(`reconciled ${path}`);
179
+ if (isMachineOutput(args)) {
180
+ writeJson({ status: "current", current: result.current, latest: result.latest, installMode: mode, reconciled });
181
+ }
182
+ return;
183
+ }
184
+ if (result.status === "ahead") {
185
+ success(
186
+ `@xano/sdk ${style.bold(result.current)} is ahead of the latest published version (${result.latest}) \u2014 nothing to upgrade.`
187
+ );
188
+ if (isMachineOutput(args)) {
189
+ writeJson({ status: "ahead", current: result.current, latest: result.latest, installMode: mode });
190
+ }
191
+ return;
192
+ }
193
+ if (args.check) {
194
+ warn(
195
+ `A new @xano/sdk is available: ${style.dim(result.current)} \u2192 ${style.green(result.latest)}`,
196
+ "update.available",
197
+ [`run \`xanosdk upgrade\`, or: ${suggestedCommand(dir, mode, result.latest)}`]
198
+ );
199
+ if (isMachineOutput(args)) {
200
+ writeJson({
201
+ status: "available",
202
+ current: result.current,
203
+ latest: result.latest,
204
+ installMode: mode,
205
+ command: suggestedCommand(dir, mode, result.latest)
206
+ });
207
+ }
208
+ process.exitCode = EXIT_UPGRADE_AVAILABLE;
209
+ return;
210
+ }
211
+ await applyUpgrade(args, dir, result.current, result.latest, mode);
212
+ }
213
+ function reportRunnerCopy(args, runner) {
214
+ const current = readVersion();
215
+ success(`Nothing to upgrade: @xano/sdk ${style.bold(current)} is a temporary copy a package runner (${runner}) fetched, not an install.`);
216
+ detail(
217
+ `\`${runner} @xano/sdk@latest <command>\` runs the newest release; \`${runner} @xano/sdk@<version> <command>\` pins one.
218
+ In a project, run \`xanosdk upgrade\` there. A global CLI upgrades with \`npm i -g ${PACKAGE}@latest\`.`
219
+ );
220
+ if (isMachineOutput(args)) writeJson({ status: "not-installed", current, installMode: "runner" });
221
+ }
222
+ function suggestedCommand(dir, mode, latest) {
223
+ if (mode === "global") return `npm i -g ${PACKAGE}@${latest}`;
224
+ const manager = detectPackageManager(dir);
225
+ const dev = saveFlagFor(dir) === "--save-dev";
226
+ if (manager === "npm") return `npm i ${saveFlagFor(dir)} ${PACKAGE}@${latest}`;
227
+ return `${manager} add ${dev ? manager === "pnpm" ? "--save-dev " : "--dev " : ""}${PACKAGE}@${latest}`;
228
+ }
229
+ function explainUnknown(result, rerun) {
230
+ if (result.reason === "registry-url") {
231
+ return `XANOSDK_UPDATE_REGISTRY is ${JSON.stringify(registryUrl())}, which is not an http(s) URL, so no registry was asked.
232
+ Set it to a registry's http(s) URL for @xano/sdk's latest manifest, or unset it to use the npm registry.`;
233
+ }
234
+ if (result.reason === "registry" && result.refused !== void 0) {
235
+ return `The npm registry at ${registryUrl()} refused ${result.refused === "credential" ? "the credential your npm config holds for it" : "an unauthenticated read"} (${result.answered}).
236
+ ` + (result.refused === "credential" ? `Renew the \`//<registry host>/:_authToken\` (or \`_auth\`) line in your .npmrc \u2014 \`npm view @xano/sdk version\` reads with the same one.` : `Add a \`//<registry host>/:_authToken=\u2026\` line for it to your .npmrc (or \`npm login --registry <url>\`), as npm itself needs.`);
237
+ }
238
+ if (result.reason === "registry" && result.answered !== void 0) {
239
+ return `The npm registry at ${registryUrl()} answered with ${result.answered}, so there is no latest version to compare against.
240
+ Run \`${rerun}\` again later, or point XANOSDK_UPDATE_REGISTRY at a working mirror.`;
241
+ }
242
+ return result.reason === "registry" ? `Could not reach the npm registry at ${registryUrl()}.
243
+ Check your connection and run \`${rerun}\` again, or point XANOSDK_UPDATE_REGISTRY at a reachable mirror.` : `Could not resolve the installed @xano/sdk version, so there is nothing to compare against.
244
+ This is expected for a git build or a linked checkout \u2014 upgrade with npm directly.`;
245
+ }
246
+ async function applyUpgrade(args, dir, current, latest, mode) {
247
+ if (mode === "local") {
248
+ assertProjectDir(dir, {
249
+ what: "`xanosdk upgrade` installs into a Xano SDK project",
250
+ remedy: "cd into your project first, or set XANOSDK_INSTALL_MODE=global to upgrade the global CLI."
251
+ });
252
+ }
253
+ let scope = [];
254
+ let cwd = dir;
255
+ if (mode === "local") {
256
+ refusePlugAndPlay(dir, retryCommand(args, { command: "upgrade" }).command);
257
+ const { site, link } = await prepareInstallSite(dir);
258
+ if (link !== null && link.status !== 0) {
259
+ process.stderr.write(terminalText(link.output.trimEnd()) + "\n");
260
+ throw new Error(`Nothing was upgraded: this project could not be linked into its npm workspace (exit ${link.status}).`);
261
+ }
262
+ scope = site.scope;
263
+ cwd = site.cwd;
264
+ }
265
+ step(`Upgrading ${style.bold(PACKAGE)} ${style.dim(current)} \u2192 ${style.green(latest)}`);
266
+ const manager = mode === "local" ? detectPackageManager(dir) : "npm";
267
+ const ls = manager === "npm" ? `\`npm ls${mode === "global" ? " -g" : ""} ${PACKAGE}\`` : `the ${PACKAGE} entry in package.json`;
268
+ const check = `Check ${ls}, then run \`${retryCommand(args, { command: "upgrade" }).command}\` again \u2014 it finishes what the install left.`;
269
+ await trackLocalWrite(
270
+ { what: `the upgrade to ${PACKAGE} ${latest}`, check },
271
+ () => installAndReconcile(args, dir, current, latest, mode, manager, scope, cwd)
272
+ );
273
+ }
274
+ async function installAndReconcile(args, dir, current, latest, mode, manager, scope, cwd) {
275
+ let undo = () => {
276
+ };
277
+ let ran;
278
+ if (manager === "npm") {
279
+ const flag = mode === "global" ? "-g" : saveFlagFor(dir);
280
+ const spec = `${PACKAGE}@${latest}`;
281
+ ran = ["npm", "i", flag, spec, ...scope].join(" ");
282
+ const status = await runNpmStreaming(["i", flag, spec, "--prefer-online", ...scope], cwd, { stdout: "stderr" });
283
+ if (status !== 0) {
284
+ throw new Error(`${ran} failed (exit ${status}).`);
285
+ }
286
+ } else {
287
+ ran = [manager, "install", ...scope].join(" ");
288
+ undo = await installWithManager(manager, dir, latest, scope);
289
+ }
290
+ const installed = (mode === "local" ? installedSdk(dir)?.version : void 0) ?? latest;
291
+ if (installed === current && current !== latest) {
292
+ undo();
293
+ throw new Error(
294
+ `\`${ran}\` exited 0, but this project still has ${PACKAGE} ${current} \u2014 ${latest} was not installed` + (manager === "npm" ? "." : `, and package.json is back as it was.`) + ` What ${manager} printed above says why.`
295
+ );
296
+ }
297
+ const reconciled = mode === "local" ? reconcileProject(dir, installed, manager) : [];
298
+ blank();
299
+ success(`Upgraded to @xano/sdk ${style.bold(installed)}.`);
300
+ for (const path of reconciled) detail(`reconciled ${path}`);
301
+ if (isMachineOutput(args)) {
302
+ writeJson({ status: "upgraded", current, latest, installed, installMode: mode, reconciled });
303
+ }
304
+ }
305
+ async function installWithManager(manager, dir, latest, scope) {
306
+ const manifest = join(dir, "package.json");
307
+ const raw = readFileSync(manifest, "utf8");
308
+ const pkg = JSON.parse(raw);
309
+ const block = sdkBlock(pkg) ?? "devDependencies";
310
+ const deps = typeof pkg[block] === "object" && pkg[block] !== null ? pkg[block] : pkg[block] = {};
311
+ deps[PACKAGE] = sdkDep(latest);
312
+ writeFileSync(manifest, JSON.stringify(pkg, null, indentOf(raw)) + (raw.endsWith("\n") ? "\n" : ""));
313
+ const status = await runNpmStreaming(["install", ...scope], dir, { stdout: "stderr", manager });
314
+ if (status !== 0) {
315
+ writeFileSync(manifest, raw);
316
+ throw new Error(`\`${[manager, "install", ...scope].join(" ")}\` failed (exit ${status}) after package.json asked for ${PACKAGE} ${sdkDep(latest)}; package.json is back as it was.`);
317
+ }
318
+ return () => writeFileSync(manifest, raw);
319
+ }
320
+ function reconcileProject(dir, version, manager) {
321
+ const changed = [];
322
+ try {
323
+ if (manager === "npm") changed.push(...restoreSdkRange(dir, version));
324
+ } catch (err) {
325
+ warn(`Could not restore the ${PACKAGE} range in package.json: ${messageOf(err)}`, "upgrade.partial");
326
+ }
327
+ changed.push(...reconcileWithInstalled(dir));
328
+ return changed;
329
+ }
330
+ function restoreSdkRangeSafely(dir, version) {
331
+ try {
332
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
333
+ const block = sdkBlock(pkg);
334
+ const range = block === void 0 ? void 0 : pkg[block][PACKAGE];
335
+ if (typeof range !== "string" || !/^\^?\d+\.\d+\.\d+$/.test(range)) return [];
336
+ return restoreSdkRange(dir, version);
337
+ } catch (err) {
338
+ warn(`Could not restore the ${PACKAGE} range in package.json: ${messageOf(err)}`, "upgrade.partial");
339
+ return [];
340
+ }
341
+ }
342
+ var RECONCILE_ENV = "XANOSDK_UPGRADE_RECONCILE";
343
+ function reconcileWithInstalled(dir) {
344
+ const again = "Run `xanosdk upgrade` once more \u2014 the new CLI then refreshes AGENTS.md, the .env.example template and the route table (`npm run xano:routes`); commit what changes.";
345
+ const bin = installedBin(dir);
346
+ if (bin === void 0) {
347
+ warn(`Could not find the installed ${PACKAGE} CLI to refresh what it renders.`, "upgrade.partial", [again]);
348
+ return [];
349
+ }
350
+ const res = spawnSync(process.execPath, [bin, "upgrade", "--json"], {
351
+ cwd: dir,
352
+ encoding: "utf8",
353
+ env: { ...process.env, [RECONCILE_ENV]: "1" },
354
+ stdio: ["ignore", "pipe", "inherit"],
355
+ timeout: 12e4
356
+ });
357
+ try {
358
+ const doc = JSON.parse(res.stdout);
359
+ if (res.status === 0 && doc.status === "reconciled" && Array.isArray(doc.reconciled)) {
360
+ return doc.reconciled.filter((p) => typeof p === "string");
361
+ }
362
+ } catch {
363
+ }
364
+ warn(`The installed ${PACKAGE} CLI did not refresh what it renders (exit ${res.status ?? "none"}).`, "upgrade.partial", [again]);
365
+ return [];
366
+ }
367
+ function installedBin(dir) {
368
+ try {
369
+ const found = installedSdk(dir);
370
+ const linked = found === void 0 ? void 0 : join(found.root, "node_modules", ...PACKAGE.split("/"), "package.json");
371
+ const manifest = linked !== void 0 && existsSync(linked) ? realpathSync(linked) : createRequire(join(dir, "package.json")).resolve(`${PACKAGE}/package.json`);
372
+ const pkg = JSON.parse(readFileSync(manifest, "utf8"));
373
+ const rel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.xanosdk;
374
+ if (typeof rel !== "string") return void 0;
375
+ const bin = join(dirname(manifest), rel);
376
+ return existsSync(bin) ? bin : void 0;
377
+ } catch {
378
+ return void 0;
379
+ }
380
+ }
381
+ async function reconcileDerived(dir, version) {
382
+ const changed = [];
383
+ try {
384
+ changed.push(...refreshAgentFiles({ projectDir: dir, sdkVersion: version, explicit: true }));
385
+ } catch (err) {
386
+ warn(`Could not refresh the agent guidance blocks: ${messageOf(err)}`, "upgrade.partial");
387
+ }
388
+ try {
389
+ const { reconcileLambdaConfig } = await import("./lambda-config-reconcile-OUZ4OYAB.js");
390
+ const lambdas = reconcileLambdaConfig(dir);
391
+ changed.push(...lambdas.changed);
392
+ if (lambdas.manual.length > 0) {
393
+ warn(
394
+ "The lambda modules in xano/lambdas type-check under their own tsconfig, which loads the lambda runtime's globals \u2014 finish the steps this upgrade left to you:",
395
+ "upgrade.partial",
396
+ lambdas.manual
397
+ );
398
+ }
399
+ } catch (err) {
400
+ warn(`Could not set up the xano/lambdas type-check: ${messageOf(err)}`, "upgrade.partial");
401
+ }
402
+ try {
403
+ changed.push(...await rerenderEnvTemplate(dir));
404
+ } catch (err) {
405
+ warn(`Could not re-render the .env.example template: ${messageOf(err)}`, "upgrade.partial");
406
+ }
407
+ changed.push(...await regenerateRoutes(dir));
408
+ return changed;
409
+ }
410
+ async function rerenderEnvTemplate(dir) {
411
+ const { backendDirIn } = await import("./backend-dir-2U53CIAL.js");
412
+ const { rerenderEnvExample } = await import("./env-example-refresh-ET5HMMDW.js");
413
+ const path = join(backendDirIn(dir), ".env.example");
414
+ if (!existsSync(path)) return [];
415
+ const current = readFileSync(path, "utf8");
416
+ const names = [...current.matchAll(/^# ([A-Za-z_][A-Za-z0-9_]*)=$/gm)].map((m) => m[1]);
417
+ const next = rerenderEnvExample(current, names);
418
+ if (next === void 0 || next === current) return [];
419
+ writeFileSync(path, next);
420
+ return [relative(dir, path).split(sep).join("/")];
421
+ }
422
+ async function regenerateRoutes(dir) {
423
+ let script;
424
+ try {
425
+ script = JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).scripts?.["xano:routes"];
426
+ } catch {
427
+ return [];
428
+ }
429
+ if (typeof script !== "string") return [];
430
+ const target = /--emit[= ](\S+)/.exec(script)?.[1] ?? "xano/routes.gen.ts";
431
+ const path = join(dir, target);
432
+ const before = existsSync(path) ? readFileSync(path, "utf8") : void 0;
433
+ const { status, output } = await runNpmQuiet(["run", "--silent", "xano:routes"], dir);
434
+ if (status !== 0) {
435
+ if (output.trim() !== "") process.stderr.write(terminalText(output.endsWith("\n") ? output : `${output}
436
+ `));
437
+ warn(`\`npm run xano:routes\` failed (exit ${status}), so ${target} was not regenerated.`, "upgrade.partial", [
438
+ "Fix what it printed, then run `npm run xano:routes` and commit the result."
439
+ ]);
440
+ return [];
441
+ }
442
+ const after = existsSync(path) ? readFileSync(path, "utf8") : void 0;
443
+ return after !== before ? [target] : [];
444
+ }
445
+ function restoreSdkRange(dir, version) {
446
+ const manifest = join(dir, "package.json");
447
+ const raw = readFileSync(manifest, "utf8");
448
+ const pkg = JSON.parse(raw);
449
+ const block = sdkBlock(pkg);
450
+ if (block === void 0) return [];
451
+ const deps = pkg[block];
452
+ const want = sdkDep(version);
453
+ const changed = [];
454
+ if (deps[PACKAGE] !== want) {
455
+ deps[PACKAGE] = want;
456
+ writeFileSync(manifest, JSON.stringify(pkg, null, indentOf(raw)) + (raw.endsWith("\n") ? "\n" : ""));
457
+ changed.push("package.json");
458
+ }
459
+ if (restoreLockRange(dir, block, want)) changed.push("package-lock.json");
460
+ return changed;
461
+ }
462
+ function syncLockToManifest(dir) {
463
+ try {
464
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
465
+ const block = sdkBlock(pkg);
466
+ if (block === void 0) return [];
467
+ const range = pkg[block][PACKAGE];
468
+ return typeof range === "string" && restoreLockRange(dir, block, range) ? ["package-lock.json"] : [];
469
+ } catch (err) {
470
+ warn(`Could not bring package-lock.json's ${PACKAGE} range to package.json's: ${messageOf(err)}`, "upgrade.partial");
471
+ return [];
472
+ }
473
+ }
474
+ function restoreLockRange(dir, block, want) {
475
+ const lockPath = join(dir, "package-lock.json");
476
+ if (!existsSync(lockPath)) return false;
477
+ const raw = readFileSync(lockPath, "utf8");
478
+ const lock = JSON.parse(raw);
479
+ const root = lock.packages?.[""];
480
+ const deps = root?.[block];
481
+ if (deps === void 0 || !(PACKAGE in deps) || deps[PACKAGE] === want) return false;
482
+ deps[PACKAGE] = want;
483
+ writeFileSync(lockPath, JSON.stringify(lock, null, indentOf(raw)) + (raw.endsWith("\n") ? "\n" : ""));
484
+ return true;
485
+ }
486
+ function declaresSdk(dir) {
487
+ try {
488
+ return sdkBlock(JSON.parse(readFileSync(join(dir, "package.json"), "utf8"))) !== void 0;
489
+ } catch {
490
+ return false;
491
+ }
492
+ }
493
+ function sdkBlock(pkg) {
494
+ return ["devDependencies", "dependencies"].find((key) => {
495
+ const deps = pkg[key];
496
+ return typeof deps === "object" && deps !== null && PACKAGE in deps;
497
+ });
498
+ }
499
+ function saveFlagFor(dir) {
500
+ try {
501
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
502
+ return sdkBlock(pkg) === "dependencies" ? "--save-prod" : "--save-dev";
503
+ } catch {
504
+ return "--save-dev";
505
+ }
506
+ }
507
+ function indentOf(raw) {
508
+ return /^(\t+)"/m.exec(raw)?.[1] ?? /^( +)"/m.exec(raw)?.[1]?.length ?? 2;
509
+ }
510
+ function sdkProjectDir(start) {
511
+ let nearest;
512
+ for (let dir = start; ; dir = dirname(dir)) {
513
+ if (existsSync(join(dir, "package.json"))) {
514
+ nearest ??= dir;
515
+ try {
516
+ if (sdkBlock(JSON.parse(readFileSync(join(dir, "package.json"), "utf8"))) !== void 0) return dir;
517
+ } catch {
518
+ return dir;
519
+ }
520
+ }
521
+ if (dirname(dir) === dir) return nearest ?? start;
522
+ }
523
+ }
524
+ function messageOf(err) {
525
+ return err instanceof Error ? err.message : String(err);
526
+ }
527
+ export {
528
+ reconcileWithInstalled,
529
+ runUpgradeCommand
530
+ };
531
+ //# sourceMappingURL=upgrade-command-QHNFWM7O.js.map
@@ -0,0 +1,61 @@
1
+ import "./chunk-PZ5AY32C.js";
2
+
3
+ // src/deploy/verify-rollout.ts
4
+ var CANONICAL_HEADER = "X-Xano-Canonical";
5
+ var FAST_POLL_MS = 1e3;
6
+ var FAST_PHASE_MS = 3e4;
7
+ var SLOW_POLL_MS = 2e3;
8
+ var REQUEST_TIMEOUT_MS = 1e4;
9
+ function cacheBust(url, nonce) {
10
+ try {
11
+ const u = new URL(url);
12
+ u.searchParams.set("_xc", String(nonce));
13
+ return u.toString();
14
+ } catch {
15
+ return `${url}${url.includes("?") ? "&" : "?"}_xc=${nonce}`;
16
+ }
17
+ }
18
+ async function verifyRollout(url, canonical, opts = {}) {
19
+ const fetchFn = opts.fetchFn ?? fetch;
20
+ const now = opts.now ?? Date.now;
21
+ const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
22
+ const totalDeadlineMs = opts.totalDeadlineMs ?? 12e4;
23
+ if (url === "" || canonical === "") return { live: false };
24
+ const start = now();
25
+ for (; ; ) {
26
+ try {
27
+ const res = await fetchFn(cacheBust(url, now()), {
28
+ method: "GET",
29
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
30
+ });
31
+ if (res.headers.get(CANONICAL_HEADER) === canonical) return { live: true };
32
+ } catch {
33
+ }
34
+ const elapsed = now() - start;
35
+ if (elapsed >= totalDeadlineMs) return { live: false };
36
+ await sleep(elapsed < FAST_PHASE_MS ? FAST_POLL_MS : SLOW_POLL_MS);
37
+ }
38
+ }
39
+ async function probeFrontend(url, opts = {}) {
40
+ const fetchFn = opts.fetchFn ?? fetch;
41
+ const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
42
+ const attempts = opts.attempts ?? 3;
43
+ let last = "unknown";
44
+ for (let i = 0; i < attempts; i++) {
45
+ if (i > 0) await sleep(FAST_POLL_MS);
46
+ try {
47
+ const res = await fetchFn(cacheBust(url, Date.now()), { method: "GET", signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
48
+ await res.body?.cancel().catch(() => void 0);
49
+ if (res.ok) return "serving";
50
+ last = "down";
51
+ if (res.status < 500) return "down";
52
+ } catch {
53
+ }
54
+ }
55
+ return last;
56
+ }
57
+ export {
58
+ probeFrontend,
59
+ verifyRollout
60
+ };
61
+ //# sourceMappingURL=verify-rollout-DRCK5TDD.js.map
@@ -0,0 +1,51 @@
1
+ import {
2
+ asRejectedCredential,
3
+ fetchProfile,
4
+ profileValue,
5
+ rejectedFixCommand,
6
+ rejectedRemedy,
7
+ runWhoamiCommand,
8
+ signedInValue,
9
+ workspaceValue
10
+ } from "./chunk-UVHDMMIP.js";
11
+ import "./chunk-KTSDSD36.js";
12
+ import "./chunk-ET4Y4XCB.js";
13
+ import "./chunk-5QU2P5CA.js";
14
+ import "./chunk-ZYJP6BOO.js";
15
+ import "./chunk-QO6BVGS5.js";
16
+ import "./chunk-JZGVVJSI.js";
17
+ import "./chunk-NAQDMEHV.js";
18
+ import "./chunk-FWD7AL6N.js";
19
+ import "./chunk-TLQE7ZN3.js";
20
+ import "./chunk-XW6KISBB.js";
21
+ import "./chunk-AWQ7BQTQ.js";
22
+ import "./chunk-EUUUMY7J.js";
23
+ import "./chunk-YLDALTWZ.js";
24
+ import "./chunk-5FBYXK5P.js";
25
+ import "./chunk-LLNZGEFK.js";
26
+ import "./chunk-QXTKSOFI.js";
27
+ import "./chunk-X2NL4KUO.js";
28
+ import "./chunk-PTHVMXZI.js";
29
+ import "./chunk-UTI5G6OJ.js";
30
+ import "./chunk-2EZ3ZJZZ.js";
31
+ import "./chunk-6MR5TI5V.js";
32
+ import "./chunk-5ZSO4T2G.js";
33
+ import "./chunk-XNCP4KYO.js";
34
+ import "./chunk-TFFGOFVZ.js";
35
+ import "./chunk-NZOWWHU5.js";
36
+ import "./chunk-4BW2SG2N.js";
37
+ import "./chunk-CIMQZRRE.js";
38
+ import "./chunk-OHX6MIUZ.js";
39
+ import "./chunk-36JUQZVQ.js";
40
+ import "./chunk-PZ5AY32C.js";
41
+ export {
42
+ asRejectedCredential,
43
+ fetchProfile,
44
+ profileValue,
45
+ rejectedFixCommand,
46
+ rejectedRemedy,
47
+ runWhoamiCommand,
48
+ signedInValue,
49
+ workspaceValue
50
+ };
51
+ //# sourceMappingURL=whoami-command-STGINTXH.js.map