@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,427 @@
1
+ import {
2
+ confirm,
3
+ readStdin
4
+ } from "./chunk-65HWOMGV.js";
5
+ import {
6
+ assertOneName
7
+ } from "./chunk-ZIY7RNUT.js";
8
+ import {
9
+ WORKSPACE_ENV_FILE,
10
+ defaultWorkspaceEnvPath,
11
+ workspaceEnvPathIn
12
+ } from "./chunk-DAD3ONIS.js";
13
+ import {
14
+ memoCredential,
15
+ refuseProfileForLocal,
16
+ selectBackend
17
+ } from "./chunk-HHN734BU.js";
18
+ import {
19
+ isRealDeployment
20
+ } from "./chunk-LPECSJ2J.js";
21
+ import "./chunk-6NNTNXN7.js";
22
+ import {
23
+ actualKind,
24
+ describeBackend,
25
+ resolveSource
26
+ } from "./chunk-QCNYHBL7.js";
27
+ import "./chunk-2ZUEE4EK.js";
28
+ import "./chunk-AN6BL47T.js";
29
+ import {
30
+ getAccessToken
31
+ } from "./chunk-ET4Y4XCB.js";
32
+ import "./chunk-SWBF2LTK.js";
33
+ import "./chunk-UZ6QQWJT.js";
34
+ import "./chunk-A3UDOZB6.js";
35
+ import "./chunk-2MNLRIOX.js";
36
+ import "./chunk-3M4LFYNQ.js";
37
+ import "./chunk-AM4FKL4J.js";
38
+ import {
39
+ requireBackendSlot
40
+ } from "./chunk-STSFNCY4.js";
41
+ import "./chunk-5QU2P5CA.js";
42
+ import "./chunk-ZYJP6BOO.js";
43
+ import "./chunk-QO6BVGS5.js";
44
+ import "./chunk-JZGVVJSI.js";
45
+ import "./chunk-7G3CTU7I.js";
46
+ import {
47
+ recordAnswer,
48
+ writeTransportFailure
49
+ } from "./chunk-6PBR37LN.js";
50
+ import "./chunk-T5KELPAR.js";
51
+ import "./chunk-622HUCZT.js";
52
+ import {
53
+ contextFlags
54
+ } from "./chunk-NAQDMEHV.js";
55
+ import "./chunk-5A2PLKZB.js";
56
+ import "./chunk-AHJWCYQO.js";
57
+ import "./chunk-DX4QR4B2.js";
58
+ import "./chunk-6QXLMMT3.js";
59
+ import "./chunk-ZFDZKNGG.js";
60
+ import "./chunk-FWD7AL6N.js";
61
+ import "./chunk-2GNFDZA2.js";
62
+ import "./chunk-JTUKLCXS.js";
63
+ import {
64
+ describeWrite
65
+ } from "./chunk-4KHEMC32.js";
66
+ import "./chunk-ROY4YAEQ.js";
67
+ import "./chunk-TLQE7ZN3.js";
68
+ import "./chunk-WRBKLYSJ.js";
69
+ import "./chunk-3LDULPRE.js";
70
+ import "./chunk-XW6KISBB.js";
71
+ import "./chunk-AWQ7BQTQ.js";
72
+ import "./chunk-EUUUMY7J.js";
73
+ import {
74
+ SENT_AFTERMATH,
75
+ certificateFailureCode,
76
+ explainBindingRefusal,
77
+ fetchOrExplain,
78
+ readBodyText,
79
+ safeHttpFailure,
80
+ withWriteStatusAftermath
81
+ } from "./chunk-YLDALTWZ.js";
82
+ import "./chunk-5FBYXK5P.js";
83
+ import "./chunk-LLNZGEFK.js";
84
+ import "./chunk-QXTKSOFI.js";
85
+ import "./chunk-X2NL4KUO.js";
86
+ import "./chunk-UCQ2VUTG.js";
87
+ import "./chunk-DGWHAVRG.js";
88
+ import {
89
+ UsageError,
90
+ backendDestinationPayload,
91
+ discloseWriteTarget,
92
+ info,
93
+ isMachineOutput,
94
+ relForwardSlash,
95
+ success,
96
+ writeJson,
97
+ writeTargetPayload
98
+ } from "./chunk-PTHVMXZI.js";
99
+ import {
100
+ isRepresentableName
101
+ } from "./chunk-GSGDWJB5.js";
102
+ import "./chunk-UTI5G6OJ.js";
103
+ import "./chunk-2EZ3ZJZZ.js";
104
+ import "./chunk-6MR5TI5V.js";
105
+ import {
106
+ shellQuote
107
+ } from "./chunk-5ZSO4T2G.js";
108
+ import "./chunk-XNCP4KYO.js";
109
+ import "./chunk-TFFGOFVZ.js";
110
+ import "./chunk-NZOWWHU5.js";
111
+ import "./chunk-4BW2SG2N.js";
112
+ import "./chunk-CIMQZRRE.js";
113
+ import "./chunk-OHX6MIUZ.js";
114
+ import "./chunk-36JUQZVQ.js";
115
+ import "./chunk-PZ5AY32C.js";
116
+
117
+ // src/emit/env-var-command.ts
118
+ import { existsSync } from "fs";
119
+ import { resolve } from "path";
120
+
121
+ // src/deploy/workspace-env-var.ts
122
+ var ENV_VAR_TIMEOUT_MS = 3e4;
123
+ var SETTINGS_SCOPE_REMEDY = `This credential may lack permission to change workspace settings, which env vars are part of. An access token needs the workspace settings scope (\`workspace:settings\`); grant it, or use a credential whose role can edit this workspace's settings, then run it again.`;
124
+ var EnvVarRouteMissingError = class extends Error {
125
+ name = "EnvVarRouteMissingError";
126
+ };
127
+ function endpoint(target) {
128
+ return `${target.baseUrl.replace(/\/$/, "")}/api:meta/workspace/${target.workspaceId}/xanosdk/env/${encodeURIComponent(target.name)}`;
129
+ }
130
+ async function setWorkspaceEnvVar(auth, opts) {
131
+ return send(
132
+ auth,
133
+ opts,
134
+ {
135
+ method: "PUT",
136
+ headers: { "content-type": "application/json" },
137
+ body: JSON.stringify({ value: opts.value })
138
+ },
139
+ `set env var ${opts.name}`,
140
+ ["created", "updated"]
141
+ );
142
+ }
143
+ async function unsetWorkspaceEnvVar(auth, opts) {
144
+ return send(auth, opts, { method: "DELETE" }, `clear env var ${opts.name}`, ["deleted", "absent"]);
145
+ }
146
+ async function send(auth, target, init, action, expected) {
147
+ const url = endpoint(target);
148
+ const res = await fetchOrExplain(
149
+ url,
150
+ {
151
+ signal: AbortSignal.timeout(ENV_VAR_TIMEOUT_MS),
152
+ ...init,
153
+ headers: {
154
+ accept: "application/json",
155
+ Authorization: `Bearer ${auth.access_token}`,
156
+ ...init.headers ?? {}
157
+ }
158
+ },
159
+ action,
160
+ ENV_VAR_TIMEOUT_MS
161
+ ).catch((err) => {
162
+ throw writeTransportFailure(err);
163
+ });
164
+ const text = await readBodyText(res, action, { url, aftermath: SENT_AFTERMATH });
165
+ if (!res.ok) {
166
+ if (res.status === 404 && /unable to locate request/i.test(text)) {
167
+ throw new EnvVarRouteMissingError(
168
+ `${action} failed: ${target.baseUrl.replace(/\/$/, "")} does not support ${init.method === "DELETE" ? "clearing" : "setting"} one env var by name yet.`
169
+ );
170
+ }
171
+ const failure = safeHttpFailure(action, res, text, target.binding);
172
+ if (res.status === 403 && target.binding !== void 0 && explainBindingRefusal(target.binding) === void 0) {
173
+ throw new Error(`${failure}
174
+ ${SETTINGS_SCOPE_REMEDY}`);
175
+ }
176
+ throw new Error(withWriteStatusAftermath(failure, res.status));
177
+ }
178
+ const answer = recordAnswer(
179
+ text,
180
+ action,
181
+ url,
182
+ (row) => typeof row.action === "string" && expected.includes(row.action),
183
+ { safe: true, write: true }
184
+ );
185
+ return answer.action;
186
+ }
187
+
188
+ // src/emit/env-var-command.ts
189
+ async function runEnvVarCommand(args, verb, opts = {}) {
190
+ const help = { command: "env", subcommand: verb };
191
+ const name = args.positionals[0] ?? "";
192
+ if (name.trim() === "") {
193
+ throw new UsageError(`\`xanosdk env ${verb}\` needs the NAME of the env var.`, { helpFor: help });
194
+ }
195
+ assertOneName(name, `the NAME given to \`xanosdk env ${verb}\``, { helpFor: help, echo: false });
196
+ if (name.includes("=")) {
197
+ throw new UsageError(
198
+ verb === "unset" ? `\`xanosdk env unset\` takes only the name (\`xanosdk env unset ${name.slice(0, name.indexOf("=")) || "NAME"}\`), and a name cannot contain "=".` : `\`xanosdk env ${verb}\` takes the name and the value as separate arguments (\`xanosdk env set NAME VALUE\`), and a name cannot contain "=".`,
199
+ { hintFor: help }
200
+ );
201
+ }
202
+ if (verb === "set" && !isRepresentableName(name)) {
203
+ throw new UsageError(
204
+ `\`xanosdk env set\`: the first argument is not a usable env var name (it is not repeated here in case the arguments are swapped). A name is letters, digits and \`_\`, and does not start with a digit (e.g. STRIPE_KEY); the value comes second, or on stdin.`,
205
+ { hintFor: help }
206
+ );
207
+ }
208
+ if (verb === "set" && ["__proto__", "constructor", "prototype"].includes(name)) {
209
+ throw new UsageError(
210
+ `\`xanosdk env set\`: \`${name}\` cannot be an env var name \u2014 \`__proto__\`, \`constructor\` and \`prototype\` are reserved JavaScript object keys, as \`--env-var\` refuses them. Choose another name.`,
211
+ { hintFor: help }
212
+ );
213
+ }
214
+ const value = verb === "set" ? await readValue(args, name, help, opts) : void 0;
215
+ const destination = await resolveDestination(args, verb, opts.deps);
216
+ if (destination.real && args.yes !== true) {
217
+ info(
218
+ verb === "set" ? `${name} will be set on ${destination.label}. Every other env var there is left as it is.` : `${name} will be cleared on ${destination.label}. Every other env var there is left as it is.`
219
+ );
220
+ discloseWriteTarget(destination.disclosure);
221
+ const ok = await confirm(verb === "set" ? `Set ${name}?` : `Clear ${name}?`, {
222
+ flag: "--yes",
223
+ refusal: {
224
+ details: { verb, name, action: null, declined: false },
225
+ rerun: verb === "set" ? `printf %s "$VALUE" | xanosdk env set ${shellQuote(name)} --yes${args.json === true ? " --json" : ""}${sameDestination(args)}` : `xanosdk env ${verb} ${shellQuote(name)} --yes${args.json === true ? " --json" : ""}${sameDestination(args)}`,
226
+ ...verb === "set" ? { note: " Its value is not reprinted: pipe it in as shown, or pass it as the second argument." } : {}
227
+ }
228
+ });
229
+ if (!ok) {
230
+ info(`${verb === "set" ? "Set" : "Clear"} cancelled \u2014 nothing was written.`);
231
+ if (isMachineOutput(args)) {
232
+ writeJson({ verb, name, action: null, destination: destination.receipt, declined: true });
233
+ }
234
+ return;
235
+ }
236
+ }
237
+ const target = {
238
+ baseUrl: destination.baseUrl,
239
+ workspaceId: destination.workspaceId,
240
+ name,
241
+ binding: destination.binding
242
+ };
243
+ let action;
244
+ try {
245
+ action = await describeWrite(
246
+ {
247
+ what: `the ${verb === "set" ? "set" : "clear"} of ${name}`,
248
+ check: lostAnswerAftermath(verb, name, args).replace(/^The request was sent, so it may or may not have taken effect\. /, "")
249
+ },
250
+ () => value !== void 0 ? setWorkspaceEnvVar(destination.auth, { ...target, value }) : unsetWorkspaceEnvVar(destination.auth, target)
251
+ );
252
+ } catch (err) {
253
+ if (err instanceof EnvVarRouteMissingError) {
254
+ const cwd = opts.deps?.cwd ?? process.cwd();
255
+ const { entry, recorded } = await landedEntry(destination, cwd);
256
+ const envFile = (recorded ? relForwardSlash(cwd, defaultWorkspaceEnvPath(resolve(cwd, entry))) : relForwardSlash(cwd, workspaceEnvPathIn(cwd))) || WORKSPACE_ENV_FILE;
257
+ throw new Error(
258
+ `${err.message} ${routeMissingHint(verb, name, destination.kind, envFile, contextFlags(args), entry, args.to)}`,
259
+ { cause: err }
260
+ );
261
+ }
262
+ if (certificateFailureCode(err) !== void 0) {
263
+ const { LookupFailedError } = await import("./source-resolve-S2XA3XZF.js");
264
+ const { command, value: value2, withheld } = await notSentRerun(verb, name, args);
265
+ const head = err.message.trim().replace(/[.:]$/, "");
266
+ const refused = new LookupFailedError(head, "unreachable", destination.kind, `run \`${command}\` again${value2}`);
267
+ refused.message += withheld;
268
+ refused.cause = err;
269
+ throw refused;
270
+ }
271
+ if (err instanceof Error && err.message.includes(SENT_AFTERMATH)) {
272
+ err.message = err.message.replace(SENT_AFTERMATH, lostAnswerAftermath(verb, name, args));
273
+ } else if (err instanceof Error && err.message.endsWith(NOT_SENT_AFTERMATH)) {
274
+ err.message = err.message.slice(0, -NOT_SENT_AFTERMATH.length) + await notSentAftermath(verb, name, args);
275
+ }
276
+ throw err;
277
+ }
278
+ if (isMachineOutput(args)) {
279
+ writeJson({ verb, name, action, destination: destination.receipt, declined: false });
280
+ success(outcomeLine(name, action, destination.label));
281
+ return;
282
+ }
283
+ success(outcomeLine(name, action, destination.label));
284
+ if (!destination.real || args.yes === true) discloseWriteTarget(destination.disclosure);
285
+ }
286
+ function routeMissingHint(verb, name, kind, envFile, flags = "", entry, to) {
287
+ const file = entry === void 0 ? "" : ` ${shellQuote(entry)}`;
288
+ if (kind === "workspace" || kind === "tenant") {
289
+ const deploy = to === void 0 ? void 0 : `xanosdk deploy${file} --to ${shellQuote(to)} --env-var ${name}=...${flags}`;
290
+ return verb === "set" ? `Deploy the value with \`--env-var ${name}=...\` instead${deploy === void 0 ? "" : ` (\`${deploy}\`)`} \u2014 a merge only adds new names; \`--replace\` rewrites every one.` : `A merge deploy never removes a name; only a \`--replace\` deploy, which rewrites every env var from the deploy's own set, clears it.`;
291
+ }
292
+ const base = kind === "local-engine" ? "xanosdk deploy --local-engine" : `xanosdk deploy${file}${flags}`;
293
+ const redeploy = `\`${base}\` (or \`${base} --keep-data --reset\`) \u2014 a replace, which applies the env set it resolves and also replaces the rows with the seed rows; a \`--keep-data\` deploy without \`--reset\` keeps the live value.`;
294
+ return verb === "set" ? `Put the value in \`${envFile}\`, or pass \`--env-var ${name}=...\`, and redeploy with ${redeploy}` : `Remove ${name} from \`${envFile}\` (and from \`workspaceConfig({ env })\` if it is declared there) and redeploy with ${redeploy}`;
295
+ }
296
+ async function landedEntry(destination, cwd) {
297
+ const { readEphemeralState } = await import("./ephemeral-state-PYCBSOGX.js");
298
+ const { resolveProjectEntry } = await import("./deploy-source-3W45CXMP.js");
299
+ if (destination.kind === "ephemeral" && destination.name !== void 0) {
300
+ const entry = Object.values(readEphemeralState(cwd).environments).find((r) => r.name === destination.name)?.entry;
301
+ if (entry !== void 0 && existsSync(resolve(cwd, entry))) return { entry, recorded: true };
302
+ }
303
+ return { entry: resolveProjectEntry(cwd), recorded: false };
304
+ }
305
+ var NOT_SENT_AFTERMATH = "Nothing was sent \u2014 retry.";
306
+ async function notSentAftermath(verb, name, args) {
307
+ const { command, value, withheld } = await notSentRerun(verb, name, args);
308
+ return `Nothing was sent, so nothing changed \u2014 once it is reachable, run \`${command}\` again${value}.${withheld}`;
309
+ }
310
+ async function notSentRerun(verb, name, args) {
311
+ let command;
312
+ let withheld = "";
313
+ if (args.argv !== void 0) {
314
+ const { withoutSecretValue } = await import("./cli.js");
315
+ const { retryCommand, withheldNote } = await import("./deploy-command-JVZPWHMK.js");
316
+ const retry = retryCommand(verb === "set" ? withoutSecretValue(args) : args);
317
+ command = retry.command;
318
+ withheld = withheldNote(retry.withheld);
319
+ } else {
320
+ const to = args.to !== void 0 ? ` --to ${shellQuote(args.to)}` : "";
321
+ command = `xanosdk env ${verb} ${shellQuote(name)}${to}${contextFlags(args)}${args.yes === true ? " --yes" : ""}`;
322
+ }
323
+ const value = verb === "set" ? " with its value (not repeated here \u2014 pass it again, or pipe it on stdin)" : "";
324
+ return { command, value, withheld };
325
+ }
326
+ function lostAnswerAftermath(verb, name, args) {
327
+ const to = args.to !== void 0 ? ` --to ${shellQuote(args.to)}` : "";
328
+ const flags = contextFlags(args);
329
+ const yes = args.yes === true ? " --yes" : "";
330
+ const again = verb === "set" ? `re-run the same \`xanosdk env set ${shellQuote(name)}${to}${flags}${yes}\` command, with its value (not repeated here)` : `re-run \`xanosdk env unset ${shellQuote(name)}${to}${flags}${yes}\``;
331
+ return `The request was sent, so it may or may not have taken effect. ${verb === "set" ? "Setting" : "Clearing"} a name is safe to repeat: ${again} and it settles it either way \u2014 or see what the backend holds with \`xanosdk env pull${to === "" ? "" : ` --from ${shellQuote(args.to)}`}${flags}\`.`;
332
+ }
333
+ function outcomeLine(name, action, label) {
334
+ switch (action) {
335
+ case "created":
336
+ return `Created ${name} on ${label}.`;
337
+ case "updated":
338
+ return `Replaced the value of ${name} on ${label}.`;
339
+ case "deleted":
340
+ return `Cleared ${name} on ${label}.`;
341
+ case "absent":
342
+ return `${name} was not set on ${label} \u2014 nothing to clear.`;
343
+ }
344
+ }
345
+ async function readValue(args, name, help, opts) {
346
+ let value = args.positionals[1];
347
+ if (value === void 0) {
348
+ const piped = await (opts.readStdin ?? readStdin)();
349
+ if (piped === void 0) {
350
+ throw new UsageError(
351
+ `\`xanosdk env set ${name}\` needs a value: pass it as the second argument, or pipe it on stdin (\`printf %s "$VALUE" | xanosdk env set ${name}${sameDestination(args)}\`) to keep it out of shell history.`,
352
+ { helpFor: help }
353
+ );
354
+ }
355
+ value = piped.replace(/\r?\n$/, "");
356
+ }
357
+ if (value === "" && !args.allowEmptyEnv.includes(name)) {
358
+ throw new UsageError(
359
+ `The value for ${name} is empty \u2014 usually an unset shell variable rather than an intent. To store an empty value, re-run with \`--allow-empty-env=${name}\`; to remove the variable, use \`xanosdk env unset ${name}${sameDestination(args)}\`.`
360
+ );
361
+ }
362
+ return value;
363
+ }
364
+ function sameDestination(args) {
365
+ const to = args.to === void 0 ? "" : ` --to ${shellQuote(args.to)}`;
366
+ return args.to !== void 0 && /^local-engine\b/.test(args.to) ? to : `${to}${contextFlags(args)}`;
367
+ }
368
+ async function resolveDestination(args, verb, deps) {
369
+ const slot = requireBackendSlot("env", verb, "to");
370
+ const cwd = deps?.cwd ?? process.cwd();
371
+ const credential = memoCredential(() => getAccessToken(args));
372
+ const source = await selectBackend(slot, args.to, { credential, deps: { ...deps, cwd } });
373
+ if (source.kind === "file") {
374
+ throw new Error("Internal: `env` resolved a bundle file as a write destination.");
375
+ }
376
+ refuseProfileForLocal(args.profile, [source.kind], slot);
377
+ const resolved = await resolveSource(source, credential, { ...deps, cwd, workspaceless: "write" });
378
+ const { base, workspaceId } = resolved.target;
379
+ const real = isRealDeployment(actualKind(resolved));
380
+ if (resolved.backend.kind === "local") {
381
+ const disclosure = { kind: "local-engine", url: resolved.backend.engine.url, workspaceId };
382
+ return {
383
+ kind: resolved.kind,
384
+ auth: resolved.bearer,
385
+ baseUrl: base,
386
+ workspaceId,
387
+ label: describeBackend(resolved),
388
+ disclosure,
389
+ real,
390
+ // `kind` for every kind: the local payload's `local: true` answers "is
391
+ // this hosted", a different question from which kind received the write.
392
+ receipt: { kind: "local-engine", ...writeTargetPayload(disclosure) }
393
+ };
394
+ }
395
+ const kind = actualKind(resolved);
396
+ const parent = kind === "workspace" ? void 0 : await credential();
397
+ const receipt = parent === void 0 || kind === "workspace" ? { kind, ...writeTargetPayload({ base, workspaceId, kind }) } : backendDestinationPayload(parent, {
398
+ kind,
399
+ name: resolved.target.label,
400
+ url: base,
401
+ // Only when it says something the name does not.
402
+ ...resolved.target.display !== void 0 && resolved.target.display !== resolved.target.label ? { display: resolved.target.display } : {}
403
+ });
404
+ return {
405
+ receipt,
406
+ kind,
407
+ auth: resolved.bearer,
408
+ baseUrl: base,
409
+ workspaceId,
410
+ label: describeBackend(resolved),
411
+ // No label, for any kind: the line before it (the confirmation's "will be
412
+ // set on …" or the outcome line) already names the backend, display name
413
+ // and all — the one location-line format `publish` and `deploy` print.
414
+ // An ephemeral or tenant by the workspace it lives under, as the receipt
415
+ // names it: its own internal workspace is always #1 (E2E pass 36).
416
+ disclosure: { base, workspaceId: parent?.workspaceId ?? workspaceId, kind },
417
+ real,
418
+ name: resolved.target.label,
419
+ binding: resolved.backend.binding
420
+ };
421
+ }
422
+ export {
423
+ lostAnswerAftermath,
424
+ notSentAftermath,
425
+ runEnvVarCommand
426
+ };
427
+ //# sourceMappingURL=env-var-command-ZIRDCAZA.js.map
@@ -0,0 +1,54 @@
1
+ import {
2
+ NotAnEphemeralError,
3
+ createEphemeral,
4
+ deleteEphemeral,
5
+ expiresAtMs,
6
+ getEphemeral,
7
+ impersonateEphemeral,
8
+ isEphemeralDisabled,
9
+ isExpired,
10
+ isUnansweredPoll,
11
+ listAllEphemeral,
12
+ listEphemeral,
13
+ namedEphemeral,
14
+ projectTenant,
15
+ renameEphemeral,
16
+ tenantBaseUrl,
17
+ waitUntilReady
18
+ } from "./chunk-7G3CTU7I.js";
19
+ import "./chunk-6PBR37LN.js";
20
+ import "./chunk-NAQDMEHV.js";
21
+ import "./chunk-XW6KISBB.js";
22
+ import "./chunk-AWQ7BQTQ.js";
23
+ import "./chunk-EUUUMY7J.js";
24
+ import "./chunk-YLDALTWZ.js";
25
+ import "./chunk-5FBYXK5P.js";
26
+ import "./chunk-LLNZGEFK.js";
27
+ import "./chunk-QXTKSOFI.js";
28
+ import "./chunk-X2NL4KUO.js";
29
+ import "./chunk-PTHVMXZI.js";
30
+ import "./chunk-UTI5G6OJ.js";
31
+ import "./chunk-2EZ3ZJZZ.js";
32
+ import "./chunk-5ZSO4T2G.js";
33
+ import "./chunk-TFFGOFVZ.js";
34
+ import "./chunk-36JUQZVQ.js";
35
+ import "./chunk-PZ5AY32C.js";
36
+ export {
37
+ NotAnEphemeralError,
38
+ createEphemeral,
39
+ deleteEphemeral,
40
+ expiresAtMs,
41
+ getEphemeral,
42
+ impersonateEphemeral,
43
+ isEphemeralDisabled,
44
+ isExpired,
45
+ isUnansweredPoll,
46
+ listAllEphemeral,
47
+ listEphemeral,
48
+ namedEphemeral,
49
+ projectTenant,
50
+ renameEphemeral,
51
+ tenantBaseUrl,
52
+ waitUntilReady
53
+ };
54
+ //# sourceMappingURL=ephemeral-P7F3PMAD.js.map