@shopify/cli-kit 0.0.0-nightly-20230110194301

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 (488) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +63 -0
  3. package/assets/auth-error.html +23 -0
  4. package/assets/empty-url.html +23 -0
  5. package/assets/favicon.svg +26 -0
  6. package/assets/missing-code.html +23 -0
  7. package/assets/missing-state.html +23 -0
  8. package/assets/style.css +58 -0
  9. package/assets/success.html +20 -0
  10. package/dist/api/admin.d.ts +3 -0
  11. package/dist/api/admin.js +56 -0
  12. package/dist/api/admin.js.map +1 -0
  13. package/dist/api/common.d.ts +21 -0
  14. package/dist/api/common.js +87 -0
  15. package/dist/api/common.js.map +1 -0
  16. package/dist/api/graphql/all_app_extension_registrations.d.ts +20 -0
  17. package/dist/api/graphql/all_app_extension_registrations.js +20 -0
  18. package/dist/api/graphql/all_app_extension_registrations.js.map +1 -0
  19. package/dist/api/graphql/all_dev_stores_by_org.d.ts +18 -0
  20. package/dist/api/graphql/all_dev_stores_by_org.js +21 -0
  21. package/dist/api/graphql/all_dev_stores_by_org.js.map +1 -0
  22. package/dist/api/graphql/all_orgs.d.ts +12 -0
  23. package/dist/api/graphql/all_orgs.js +14 -0
  24. package/dist/api/graphql/all_orgs.js.map +1 -0
  25. package/dist/api/graphql/convert_dev_to_test_store.d.ts +16 -0
  26. package/dist/api/graphql/convert_dev_to_test_store.js +13 -0
  27. package/dist/api/graphql/convert_dev_to_test_store.js.map +1 -0
  28. package/dist/api/graphql/create_app.d.ts +29 -0
  29. package/dist/api/graphql/create_app.js +33 -0
  30. package/dist/api/graphql/create_app.js.map +1 -0
  31. package/dist/api/graphql/create_deployment.d.ts +33 -0
  32. package/dist/api/graphql/create_deployment.js +25 -0
  33. package/dist/api/graphql/create_deployment.js.map +1 -0
  34. package/dist/api/graphql/extension_create.d.ts +30 -0
  35. package/dist/api/graphql/extension_create.js +26 -0
  36. package/dist/api/graphql/extension_create.js.map +1 -0
  37. package/dist/api/graphql/extension_specifications.d.ts +27 -0
  38. package/dist/api/graphql/extension_specifications.js +22 -0
  39. package/dist/api/graphql/extension_specifications.js.map +1 -0
  40. package/dist/api/graphql/find_app.d.ts +14 -0
  41. package/dist/api/graphql/find_app.js +17 -0
  42. package/dist/api/graphql/find_app.js.map +1 -0
  43. package/dist/api/graphql/find_org.d.ts +18 -0
  44. package/dist/api/graphql/find_org.js +21 -0
  45. package/dist/api/graphql/find_org.js.map +1 -0
  46. package/dist/api/graphql/find_org_basic.d.ts +11 -0
  47. package/dist/api/graphql/find_org_basic.js +14 -0
  48. package/dist/api/graphql/find_org_basic.js.map +1 -0
  49. package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
  50. package/dist/api/graphql/find_store_by_domain.js +24 -0
  51. package/dist/api/graphql/find_store_by_domain.js.map +1 -0
  52. package/dist/api/graphql/functions/api_schema_definition.d.ts +9 -0
  53. package/dist/api/graphql/functions/api_schema_definition.js +7 -0
  54. package/dist/api/graphql/functions/api_schema_definition.js.map +1 -0
  55. package/dist/api/graphql/functions/app_function_set.d.ts +30 -0
  56. package/dist/api/graphql/functions/app_function_set.js +38 -0
  57. package/dist/api/graphql/functions/app_function_set.js.map +1 -0
  58. package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
  59. package/dist/api/graphql/functions/function_service_proxy.js +7 -0
  60. package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
  61. package/dist/api/graphql/functions/upload_url_generate.d.ts +12 -0
  62. package/dist/api/graphql/functions/upload_url_generate.js +11 -0
  63. package/dist/api/graphql/functions/upload_url_generate.js.map +1 -0
  64. package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
  65. package/dist/api/graphql/generate_signed_upload_url.js +15 -0
  66. package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
  67. package/dist/api/graphql/get_urls.d.ts +10 -0
  68. package/dist/api/graphql/get_urls.js +10 -0
  69. package/dist/api/graphql/get_urls.js.map +1 -0
  70. package/dist/api/graphql/get_variant_id.d.ts +17 -0
  71. package/dist/api/graphql/get_variant_id.js +20 -0
  72. package/dist/api/graphql/get_variant_id.js.map +1 -0
  73. package/dist/api/graphql/index.d.ts +21 -0
  74. package/dist/api/graphql/index.js +22 -0
  75. package/dist/api/graphql/index.js.map +1 -0
  76. package/dist/api/graphql/update_draft.d.ts +33 -0
  77. package/dist/api/graphql/update_draft.js +24 -0
  78. package/dist/api/graphql/update_draft.js.map +1 -0
  79. package/dist/api/graphql/update_urls.d.ts +14 -0
  80. package/dist/api/graphql/update_urls.js +12 -0
  81. package/dist/api/graphql/update_urls.js.map +1 -0
  82. package/dist/api/identity.d.ts +1 -0
  83. package/dist/api/identity.js +41 -0
  84. package/dist/api/identity.js.map +1 -0
  85. package/dist/api/oxygen.d.ts +5 -0
  86. package/dist/api/oxygen.js +30 -0
  87. package/dist/api/oxygen.js.map +1 -0
  88. package/dist/api/partners.d.ts +14 -0
  89. package/dist/api/partners.js +44 -0
  90. package/dist/api/partners.js.map +1 -0
  91. package/dist/api.d.ts +6 -0
  92. package/dist/api.js +7 -0
  93. package/dist/api.js.map +1 -0
  94. package/dist/cli.d.ts +8 -0
  95. package/dist/cli.js +18 -0
  96. package/dist/cli.js.map +1 -0
  97. package/dist/constants.d.ts +52 -0
  98. package/dist/constants.js +71 -0
  99. package/dist/constants.js.map +1 -0
  100. package/dist/content-tokens.d.ts +44 -0
  101. package/dist/content-tokens.js +105 -0
  102. package/dist/content-tokens.js.map +1 -0
  103. package/dist/environment/fqdn.d.ts +29 -0
  104. package/dist/environment/fqdn.js +72 -0
  105. package/dist/environment/fqdn.js.map +1 -0
  106. package/dist/environment/local.d.ts +92 -0
  107. package/dist/environment/local.js +169 -0
  108. package/dist/environment/local.js.map +1 -0
  109. package/dist/environment/service.d.ts +4 -0
  110. package/dist/environment/service.js +19 -0
  111. package/dist/environment/service.js.map +1 -0
  112. package/dist/environment/spin-cache.d.ts +2 -0
  113. package/dist/environment/spin-cache.js +8 -0
  114. package/dist/environment/spin-cache.js.map +1 -0
  115. package/dist/environment/spin.d.ts +50 -0
  116. package/dist/environment/spin.js +99 -0
  117. package/dist/environment/spin.js.map +1 -0
  118. package/dist/environment/utilities.d.ts +8 -0
  119. package/dist/environment/utilities.js +19 -0
  120. package/dist/environment/utilities.js.map +1 -0
  121. package/dist/environment.d.ts +7 -0
  122. package/dist/environment.js +8 -0
  123. package/dist/environment.js.map +1 -0
  124. package/dist/error.d.ts +68 -0
  125. package/dist/error.js +143 -0
  126. package/dist/error.js.map +1 -0
  127. package/dist/file.d.ts +98 -0
  128. package/dist/file.js +216 -0
  129. package/dist/file.js.map +1 -0
  130. package/dist/git.d.ts +36 -0
  131. package/dist/git.js +133 -0
  132. package/dist/git.js.map +1 -0
  133. package/dist/http/fetch.d.ts +22 -0
  134. package/dist/http/fetch.js +44 -0
  135. package/dist/http/fetch.js.map +1 -0
  136. package/dist/http/formdata.d.ts +3 -0
  137. package/dist/http/formdata.js +6 -0
  138. package/dist/http/formdata.js.map +1 -0
  139. package/dist/http/graphql.d.ts +13 -0
  140. package/dist/http/graphql.js +12 -0
  141. package/dist/http/graphql.js.map +1 -0
  142. package/dist/http.d.ts +27 -0
  143. package/dist/http.js +32 -0
  144. package/dist/http.js.map +1 -0
  145. package/dist/index.d.ts +24 -0
  146. package/dist/index.js +25 -0
  147. package/dist/index.js.map +1 -0
  148. package/dist/metadata.d.ts +53 -0
  149. package/dist/metadata.js +62 -0
  150. package/dist/metadata.js.map +1 -0
  151. package/dist/monorail.d.ts +100 -0
  152. package/dist/monorail.js +39 -0
  153. package/dist/monorail.js.map +1 -0
  154. package/dist/network/api.d.ts +2 -0
  155. package/dist/network/api.js +2 -0
  156. package/dist/network/api.js.map +1 -0
  157. package/dist/network/service.d.ts +14 -0
  158. package/dist/network/service.js +11 -0
  159. package/dist/network/service.js.map +1 -0
  160. package/dist/npm.d.ts +27 -0
  161. package/dist/npm.js +20 -0
  162. package/dist/npm.js.map +1 -0
  163. package/dist/output.d.ts +129 -0
  164. package/dist/output.js +310 -0
  165. package/dist/output.js.map +1 -0
  166. package/dist/path.d.ts +25 -0
  167. package/dist/path.js +48 -0
  168. package/dist/path.js.map +1 -0
  169. package/dist/plugins.d.ts +73 -0
  170. package/dist/plugins.js +49 -0
  171. package/dist/plugins.js.map +1 -0
  172. package/dist/private/common/json.d.ts +6 -0
  173. package/dist/private/common/json.js +2 -0
  174. package/dist/private/common/json.js.map +1 -0
  175. package/dist/private/common/lodash.d.ts +47 -0
  176. package/dist/private/common/lodash.js +2 -0
  177. package/dist/private/common/lodash.js.map +1 -0
  178. package/dist/private/node/analytics.d.ts +27 -0
  179. package/dist/private/node/analytics.js +57 -0
  180. package/dist/private/node/analytics.js.map +1 -0
  181. package/dist/private/node/ui/alert.d.ts +2 -0
  182. package/dist/private/node/ui/alert.js +18 -0
  183. package/dist/private/node/ui/alert.js.map +1 -0
  184. package/dist/private/node/ui/components/Alert.d.ts +17 -0
  185. package/dist/private/node/ui/components/Alert.js +21 -0
  186. package/dist/private/node/ui/components/Alert.js.map +1 -0
  187. package/dist/private/node/ui/components/Alert.test.d.ts +1 -0
  188. package/dist/private/node/ui/components/Alert.test.js +95 -0
  189. package/dist/private/node/ui/components/Alert.test.js.map +1 -0
  190. package/dist/private/node/ui/components/Banner.d.ts +8 -0
  191. package/dist/private/node/ui/components/Banner.js +41 -0
  192. package/dist/private/node/ui/components/Banner.js.map +1 -0
  193. package/dist/private/node/ui/components/Banner.test.d.ts +1 -0
  194. package/dist/private/node/ui/components/Banner.test.js +52 -0
  195. package/dist/private/node/ui/components/Banner.test.js.map +1 -0
  196. package/dist/private/node/ui/components/Command.d.ts +9 -0
  197. package/dist/private/node/ui/components/Command.js +13 -0
  198. package/dist/private/node/ui/components/Command.js.map +1 -0
  199. package/dist/private/node/ui/components/Command.test.d.ts +1 -0
  200. package/dist/private/node/ui/components/Command.test.js +11 -0
  201. package/dist/private/node/ui/components/Command.test.js.map +1 -0
  202. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +47 -0
  203. package/dist/private/node/ui/components/ConcurrentOutput.js +86 -0
  204. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
  205. package/dist/private/node/ui/components/ConcurrentOutput.test.d.ts +1 -0
  206. package/dist/private/node/ui/components/ConcurrentOutput.test.js +54 -0
  207. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -0
  208. package/dist/private/node/ui/components/FatalError.d.ts +7 -0
  209. package/dist/private/node/ui/components/FatalError.js +54 -0
  210. package/dist/private/node/ui/components/FatalError.js.map +1 -0
  211. package/dist/private/node/ui/components/FatalError.test.d.ts +1 -0
  212. package/dist/private/node/ui/components/FatalError.test.js +119 -0
  213. package/dist/private/node/ui/components/FatalError.test.js.map +1 -0
  214. package/dist/private/node/ui/components/FilePath.d.ts +9 -0
  215. package/dist/private/node/ui/components/FilePath.js +13 -0
  216. package/dist/private/node/ui/components/FilePath.js.map +1 -0
  217. package/dist/private/node/ui/components/FilePath.test.d.ts +1 -0
  218. package/dist/private/node/ui/components/FilePath.test.js +11 -0
  219. package/dist/private/node/ui/components/FilePath.test.js.map +1 -0
  220. package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
  221. package/dist/private/node/ui/components/FullScreen.js +32 -0
  222. package/dist/private/node/ui/components/FullScreen.js.map +1 -0
  223. package/dist/private/node/ui/components/Link.d.ts +10 -0
  224. package/dist/private/node/ui/components/Link.js +15 -0
  225. package/dist/private/node/ui/components/Link.js.map +1 -0
  226. package/dist/private/node/ui/components/Link.test.d.ts +1 -0
  227. package/dist/private/node/ui/components/Link.test.js +22 -0
  228. package/dist/private/node/ui/components/Link.test.js.map +1 -0
  229. package/dist/private/node/ui/components/List.d.ts +13 -0
  230. package/dist/private/node/ui/components/List.js +19 -0
  231. package/dist/private/node/ui/components/List.js.map +1 -0
  232. package/dist/private/node/ui/components/List.test.d.ts +1 -0
  233. package/dist/private/node/ui/components/List.test.js +34 -0
  234. package/dist/private/node/ui/components/List.test.js.map +1 -0
  235. package/dist/private/node/ui/components/SelectInput.d.ts +12 -0
  236. package/dist/private/node/ui/components/SelectInput.js +87 -0
  237. package/dist/private/node/ui/components/SelectInput.js.map +1 -0
  238. package/dist/private/node/ui/components/SelectInput.test.d.ts +1 -0
  239. package/dist/private/node/ui/components/SelectInput.test.js +230 -0
  240. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -0
  241. package/dist/private/node/ui/components/SelectPrompt.d.ts +11 -0
  242. package/dist/private/node/ui/components/SelectPrompt.js +34 -0
  243. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
  244. package/dist/private/node/ui/components/SelectPrompt.test.d.ts +1 -0
  245. package/dist/private/node/ui/components/SelectPrompt.test.js +74 -0
  246. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
  247. package/dist/private/node/ui/components/Table.d.ts +8 -0
  248. package/dist/private/node/ui/components/Table.js +17 -0
  249. package/dist/private/node/ui/components/Table.js.map +1 -0
  250. package/dist/private/node/ui/components/Tasks.d.ts +10 -0
  251. package/dist/private/node/ui/components/Tasks.js +27 -0
  252. package/dist/private/node/ui/components/Tasks.js.map +1 -0
  253. package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
  254. package/dist/private/node/ui/components/Tasks.test.js +50 -0
  255. package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
  256. package/dist/private/node/ui/components/TextAnimation.d.ts +9 -0
  257. package/dist/private/node/ui/components/TextAnimation.js +35 -0
  258. package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
  259. package/dist/private/node/ui/components/TextInput.d.ts +9 -0
  260. package/dist/private/node/ui/components/TextInput.js +74 -0
  261. package/dist/private/node/ui/components/TextInput.js.map +1 -0
  262. package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
  263. package/dist/private/node/ui/components/TextInput.test.js +139 -0
  264. package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
  265. package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
  266. package/dist/private/node/ui/components/TextPrompt.js +52 -0
  267. package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
  268. package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
  269. package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
  270. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
  271. package/dist/private/node/ui/components/TokenizedText.d.ts +36 -0
  272. package/dist/private/node/ui/components/TokenizedText.js +70 -0
  273. package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
  274. package/dist/private/node/ui/components/TokenizedText.test.d.ts +1 -0
  275. package/dist/private/node/ui/components/TokenizedText.test.js +44 -0
  276. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -0
  277. package/dist/private/node/ui/components/UserInput.d.ts +10 -0
  278. package/dist/private/node/ui/components/UserInput.js +11 -0
  279. package/dist/private/node/ui/components/UserInput.js.map +1 -0
  280. package/dist/private/node/ui/components/UserInput.test.d.ts +1 -0
  281. package/dist/private/node/ui/components/UserInput.test.js +11 -0
  282. package/dist/private/node/ui/components/UserInput.test.js.map +1 -0
  283. package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
  284. package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
  285. package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
  286. package/dist/private/node/ui/hooks/use-layout.d.ts +6 -0
  287. package/dist/private/node/ui/hooks/use-layout.js +30 -0
  288. package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
  289. package/dist/private/node/ui.d.ts +23 -0
  290. package/dist/private/node/ui.js +53 -0
  291. package/dist/private/node/ui.js.map +1 -0
  292. package/dist/public/common/array.d.ts +37 -0
  293. package/dist/public/common/array.js +51 -0
  294. package/dist/public/common/array.js.map +1 -0
  295. package/dist/public/common/collection.d.ts +23 -0
  296. package/dist/public/common/collection.js +29 -0
  297. package/dist/public/common/collection.js.map +1 -0
  298. package/dist/public/common/function.d.ts +30 -0
  299. package/dist/public/common/function.js +40 -0
  300. package/dist/public/common/function.js.map +1 -0
  301. package/dist/public/common/lang.d.ts +16 -0
  302. package/dist/public/common/lang.js +22 -0
  303. package/dist/public/common/lang.js.map +1 -0
  304. package/dist/public/common/object.d.ts +32 -0
  305. package/dist/public/common/object.js +45 -0
  306. package/dist/public/common/object.js.map +1 -0
  307. package/dist/public/common/string.d.ts +6 -0
  308. package/dist/public/common/string.js +109 -0
  309. package/dist/public/common/string.js.map +1 -0
  310. package/dist/public/common/url.d.ts +7 -0
  311. package/dist/public/common/url.js +17 -0
  312. package/dist/public/common/url.js.map +1 -0
  313. package/dist/public/node/abort.d.ts +16 -0
  314. package/dist/public/node/abort.js +17 -0
  315. package/dist/public/node/abort.js.map +1 -0
  316. package/dist/public/node/analytics.d.ts +13 -0
  317. package/dist/public/node/analytics.js +82 -0
  318. package/dist/public/node/analytics.js.map +1 -0
  319. package/dist/public/node/archiver.d.ts +9 -0
  320. package/dist/public/node/archiver.js +34 -0
  321. package/dist/public/node/archiver.js.map +1 -0
  322. package/dist/public/node/base-command.d.ts +26 -0
  323. package/dist/public/node/base-command.js +172 -0
  324. package/dist/public/node/base-command.js.map +1 -0
  325. package/dist/public/node/checksum.d.ts +20 -0
  326. package/dist/public/node/checksum.js +32 -0
  327. package/dist/public/node/checksum.js.map +1 -0
  328. package/dist/public/node/cli.d.ts +29 -0
  329. package/dist/public/node/cli.js +106 -0
  330. package/dist/public/node/cli.js.map +1 -0
  331. package/dist/public/node/colors.d.ts +2 -0
  332. package/dist/public/node/colors.js +3 -0
  333. package/dist/public/node/colors.js.map +1 -0
  334. package/dist/public/node/dot-env.d.ts +42 -0
  335. package/dist/public/node/dot-env.js +67 -0
  336. package/dist/public/node/dot-env.js.map +1 -0
  337. package/dist/public/node/error-handler.d.ts +41 -0
  338. package/dist/public/node/error-handler.js +198 -0
  339. package/dist/public/node/error-handler.js.map +1 -0
  340. package/dist/public/node/error.d.ts +4 -0
  341. package/dist/public/node/error.js +5 -0
  342. package/dist/public/node/error.js.map +1 -0
  343. package/dist/public/node/framework.d.ts +8 -0
  344. package/dist/public/node/framework.js +135 -0
  345. package/dist/public/node/framework.js.map +1 -0
  346. package/dist/public/node/fs.d.ts +17 -0
  347. package/dist/public/node/fs.js +21 -0
  348. package/dist/public/node/fs.js.map +1 -0
  349. package/dist/public/node/github.d.ts +50 -0
  350. package/dist/public/node/github.js +71 -0
  351. package/dist/public/node/github.js.map +1 -0
  352. package/dist/public/node/hooks/postrun.d.ts +2 -0
  353. package/dist/public/node/hooks/postrun.js +9 -0
  354. package/dist/public/node/hooks/postrun.js.map +1 -0
  355. package/dist/public/node/hooks/prerun.d.ts +12 -0
  356. package/dist/public/node/hooks/prerun.js +66 -0
  357. package/dist/public/node/hooks/prerun.js.map +1 -0
  358. package/dist/public/node/node-package-manager.d.ts +243 -0
  359. package/dist/public/node/node-package-manager.js +369 -0
  360. package/dist/public/node/node-package-manager.js.map +1 -0
  361. package/dist/public/node/os.d.ts +16 -0
  362. package/dist/public/node/os.js +77 -0
  363. package/dist/public/node/os.js.map +1 -0
  364. package/dist/public/node/plugins/tunnel.d.ts +47 -0
  365. package/dist/public/node/plugins/tunnel.js +19 -0
  366. package/dist/public/node/plugins/tunnel.js.map +1 -0
  367. package/dist/public/node/presets.d.ts +8 -0
  368. package/dist/public/node/presets.js +26 -0
  369. package/dist/public/node/presets.js.map +1 -0
  370. package/dist/public/node/result.d.ts +94 -0
  371. package/dist/public/node/result.js +134 -0
  372. package/dist/public/node/result.js.map +1 -0
  373. package/dist/public/node/ruby.d.ts +38 -0
  374. package/dist/public/node/ruby.js +234 -0
  375. package/dist/public/node/ruby.js.map +1 -0
  376. package/dist/public/node/semver.d.ts +3 -0
  377. package/dist/public/node/semver.js +6 -0
  378. package/dist/public/node/semver.js.map +1 -0
  379. package/dist/public/node/tcp.d.ts +5 -0
  380. package/dist/public/node/tcp.js +35 -0
  381. package/dist/public/node/tcp.js.map +1 -0
  382. package/dist/public/node/ui.d.ts +184 -0
  383. package/dist/public/node/ui.js +203 -0
  384. package/dist/public/node/ui.js.map +1 -0
  385. package/dist/schema.d.ts +1 -0
  386. package/dist/schema.js +2 -0
  387. package/dist/schema.js.map +1 -0
  388. package/dist/secure-store.d.ts +19 -0
  389. package/dist/secure-store.js +63 -0
  390. package/dist/secure-store.js.map +1 -0
  391. package/dist/session/authorize.d.ts +7 -0
  392. package/dist/session/authorize.js +52 -0
  393. package/dist/session/authorize.js.map +1 -0
  394. package/dist/session/device-authorization.d.ts +32 -0
  395. package/dist/session/device-authorization.js +92 -0
  396. package/dist/session/device-authorization.js.map +1 -0
  397. package/dist/session/exchange.d.ts +48 -0
  398. package/dist/session/exchange.js +159 -0
  399. package/dist/session/exchange.js.map +1 -0
  400. package/dist/session/identity.d.ts +3 -0
  401. package/dist/session/identity.js +58 -0
  402. package/dist/session/identity.js.map +1 -0
  403. package/dist/session/post-auth.d.ts +13 -0
  404. package/dist/session/post-auth.js +62 -0
  405. package/dist/session/post-auth.js.map +1 -0
  406. package/dist/session/redirect-listener.d.ts +34 -0
  407. package/dist/session/redirect-listener.js +106 -0
  408. package/dist/session/redirect-listener.js.map +1 -0
  409. package/dist/session/schema.d.ts +175 -0
  410. package/dist/session/schema.js +60 -0
  411. package/dist/session/schema.js.map +1 -0
  412. package/dist/session/scopes.d.ts +16 -0
  413. package/dist/session/scopes.js +53 -0
  414. package/dist/session/scopes.js.map +1 -0
  415. package/dist/session/store.d.ts +24 -0
  416. package/dist/session/store.js +89 -0
  417. package/dist/session/store.js.map +1 -0
  418. package/dist/session/token.d.ts +40 -0
  419. package/dist/session/token.js +22 -0
  420. package/dist/session/token.js.map +1 -0
  421. package/dist/session/validate.d.ts +17 -0
  422. package/dist/session/validate.js +65 -0
  423. package/dist/session/validate.js.map +1 -0
  424. package/dist/session.d.ts +96 -0
  425. package/dist/session.js +293 -0
  426. package/dist/session.js.map +1 -0
  427. package/dist/store/schema.d.ts +3 -0
  428. package/dist/store/schema.js +27 -0
  429. package/dist/store/schema.js.map +1 -0
  430. package/dist/store.d.ts +53 -0
  431. package/dist/store.js +134 -0
  432. package/dist/store.js.map +1 -0
  433. package/dist/string.d.ts +28 -0
  434. package/dist/string.js +77 -0
  435. package/dist/string.js.map +1 -0
  436. package/dist/system.d.ts +51 -0
  437. package/dist/system.js +128 -0
  438. package/dist/system.js.map +1 -0
  439. package/dist/template.d.ts +11 -0
  440. package/dist/template.js +50 -0
  441. package/dist/template.js.map +1 -0
  442. package/dist/testing/output.d.ts +10 -0
  443. package/dist/testing/output.js +16 -0
  444. package/dist/testing/output.js.map +1 -0
  445. package/dist/testing/store.d.ts +7 -0
  446. package/dist/testing/store.js +26 -0
  447. package/dist/testing/store.js.map +1 -0
  448. package/dist/testing/ui.d.ts +5 -0
  449. package/dist/testing/ui.js +23 -0
  450. package/dist/testing/ui.js.map +1 -0
  451. package/dist/toml.d.ts +3 -0
  452. package/dist/toml.js +8 -0
  453. package/dist/toml.js.map +1 -0
  454. package/dist/tsconfig.tsbuildinfo +1 -0
  455. package/dist/typing/deep-required.d.ts +12 -0
  456. package/dist/typing/deep-required.js +2 -0
  457. package/dist/typing/deep-required.js.map +1 -0
  458. package/dist/typing/overloaded-parameters.d.ts +6 -0
  459. package/dist/typing/overloaded-parameters.js +2 -0
  460. package/dist/typing/overloaded-parameters.js.map +1 -0
  461. package/dist/typing/pick-by-prefix.d.ts +12 -0
  462. package/dist/typing/pick-by-prefix.js +2 -0
  463. package/dist/typing/pick-by-prefix.js.map +1 -0
  464. package/dist/typing/simple-definitions.d.ts +4 -0
  465. package/dist/typing/simple-definitions.js +2 -0
  466. package/dist/typing/simple-definitions.js.map +1 -0
  467. package/dist/ui/executor.d.ts +14 -0
  468. package/dist/ui/executor.js +90 -0
  469. package/dist/ui/executor.js.map +1 -0
  470. package/dist/ui/inquirer/autocomplete.d.ts +11 -0
  471. package/dist/ui/inquirer/autocomplete.js +110 -0
  472. package/dist/ui/inquirer/autocomplete.js.map +1 -0
  473. package/dist/ui/inquirer/input.d.ts +16 -0
  474. package/dist/ui/inquirer/input.js +45 -0
  475. package/dist/ui/inquirer/input.js.map +1 -0
  476. package/dist/ui/inquirer/password.d.ts +7 -0
  477. package/dist/ui/inquirer/password.js +8 -0
  478. package/dist/ui/inquirer/password.js.map +1 -0
  479. package/dist/ui/inquirer/select.d.ts +14 -0
  480. package/dist/ui/inquirer/select.js +26 -0
  481. package/dist/ui/inquirer/select.js.map +1 -0
  482. package/dist/ui.d.ts +54 -0
  483. package/dist/ui.js +128 -0
  484. package/dist/ui.js.map +1 -0
  485. package/dist/vscode.d.ts +8 -0
  486. package/dist/vscode.js +36 -0
  487. package/dist/vscode.js.map +1 -0
  488. package/package.json +177 -0
@@ -0,0 +1,105 @@
1
+ import { relativize as relativizePath } from './path.js';
2
+ import colors from './public/node/colors.js';
3
+ import { stringifyMessage } from './output.js';
4
+ import terminalLink from 'terminal-link';
5
+ import cjs from 'color-json';
6
+ export class ContentToken {
7
+ constructor(value) {
8
+ this.value = value;
9
+ }
10
+ }
11
+ export class RawContentToken extends ContentToken {
12
+ output() {
13
+ return this.value;
14
+ }
15
+ }
16
+ export class LinkContentToken extends ContentToken {
17
+ constructor(value, link) {
18
+ super(value);
19
+ this.link = link;
20
+ }
21
+ output() {
22
+ const text = colors.green(stringifyMessage(this.value));
23
+ const url = this.link ?? '';
24
+ return terminalLink(text, url, { fallback: () => `${text} ( ${url} )` });
25
+ }
26
+ }
27
+ export class CommandContentToken extends ContentToken {
28
+ output() {
29
+ return colors.bold(colors.yellow(stringifyMessage(this.value)));
30
+ }
31
+ }
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ export class JsonContentToken extends ContentToken {
34
+ output() {
35
+ try {
36
+ return cjs(stringifyMessage(this.value) ?? {});
37
+ // eslint-disable-next-line no-catch-all/no-catch-all
38
+ }
39
+ catch (_) {
40
+ return JSON.stringify(stringifyMessage(this.value) ?? {}, null, 2);
41
+ }
42
+ }
43
+ }
44
+ export class LinesDiffContentToken extends ContentToken {
45
+ output() {
46
+ return this.value
47
+ .map((part) => {
48
+ if (part.added) {
49
+ return part.value
50
+ .split(/\n/)
51
+ .filter((line) => line !== '')
52
+ .map((line) => {
53
+ return colors.green(`+ ${line}\n`);
54
+ });
55
+ }
56
+ else if (part.removed) {
57
+ return part.value
58
+ .split(/\n/)
59
+ .filter((line) => line !== '')
60
+ .map((line) => {
61
+ return colors.magenta(`- ${line}\n`);
62
+ });
63
+ }
64
+ else {
65
+ return part.value;
66
+ }
67
+ })
68
+ .flat();
69
+ }
70
+ }
71
+ export class ColorContentToken extends ContentToken {
72
+ constructor(value, color) {
73
+ super(value);
74
+ this.color = color;
75
+ }
76
+ output() {
77
+ return this.color(stringifyMessage(this.value));
78
+ }
79
+ }
80
+ export class ErrorContentToken extends ContentToken {
81
+ output() {
82
+ return colors.bold.redBright(stringifyMessage(this.value));
83
+ }
84
+ }
85
+ export class PathContentToken extends ContentToken {
86
+ output() {
87
+ return relativizePath(stringifyMessage(this.value));
88
+ }
89
+ }
90
+ export class HeadingContentToken extends ContentToken {
91
+ output() {
92
+ return colors.bold.underline(stringifyMessage(this.value));
93
+ }
94
+ }
95
+ export class SubHeadingContentToken extends ContentToken {
96
+ output() {
97
+ return colors.underline(stringifyMessage(this.value));
98
+ }
99
+ }
100
+ export class ItalicContentToken extends ContentToken {
101
+ output() {
102
+ return colors.italic(stringifyMessage(this.value));
103
+ }
104
+ }
105
+ //# sourceMappingURL=content-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-tokens.js","sourceRoot":"","sources":["../src/content-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,cAAc,EAAC,MAAM,WAAW,CAAA;AACtD,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5C,OAAO,EAAU,gBAAgB,EAAC,MAAM,aAAa,CAAA;AACrD,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,GAAG,MAAM,YAAY,CAAA;AAG5B,MAAM,OAAgB,YAAY;IAGhC,YAAY,K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C,CAAA;IAC5D,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,YAAqB;IACzD,MAAM;QACJ,OAAO,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,YAAqB;IAC5D,MAAM;QACJ,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5D,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,YAAqB;IAC/D,MAAM;QACJ,OAAO,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,YAAqB;IAC3D,MAAM;QACJ,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACpD,CAAC;CACF","sourcesContent":["import {relativize as relativizePath} from './path.js'\nimport colors from './public/node/colors.js'\nimport {Message, stringifyMessage} from './output.js'\nimport terminalLink from 'terminal-link'\nimport cjs from 'color-json'\nimport type {Change} from 'diff'\n\nexport abstract class ContentToken<T> {\n value: T\n\n constructor(value: T) {\n this.value = value\n }\n\n abstract output(): string | string[]\n}\n\nexport class RawContentToken extends ContentToken<string> {\n output(): string {\n return this.value\n }\n}\n\nexport class LinkContentToken extends ContentToken<Message> {\n link: string\n\n constructor(value: Message, link: string) {\n super(value)\n this.link = link\n }\n\n output() {\n const text = colors.green(stringifyMessage(this.value))\n const url = this.link ?? ''\n return terminalLink(text, url, {fallback: () => `${text} ( ${url} )`})\n }\n}\n\nexport class CommandContentToken extends ContentToken<Message> {\n output(): string {\n return colors.bold(colors.yellow(stringifyMessage(this.value)))\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class JsonContentToken extends ContentToken<any> {\n output(): string {\n try {\n return cjs(stringifyMessage(this.value) ?? {})\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (_) {\n return JSON.stringify(stringifyMessage(this.value) ?? {}, null, 2)\n }\n }\n}\n\nexport class LinesDiffContentToken extends ContentToken<Change[]> {\n output(): string[] {\n return this.value\n .map((part) => {\n if (part.added) {\n return part.value\n .split(/\\n/)\n .filter((line) => line !== '')\n .map((line) => {\n return colors.green(`+ ${line}\\n`)\n })\n } else if (part.removed) {\n return part.value\n .split(/\\n/)\n .filter((line) => line !== '')\n .map((line) => {\n return colors.magenta(`- ${line}\\n`)\n })\n } else {\n return part.value\n }\n })\n .flat()\n }\n}\n\nexport class ColorContentToken extends ContentToken<Message> {\n color: (text: string) => string\n\n constructor(value: Message, color: (text: string) => string) {\n super(value)\n this.color = color\n }\n\n output(): string {\n return this.color(stringifyMessage(this.value))\n }\n}\n\nexport class ErrorContentToken extends ContentToken<Message> {\n output(): string {\n return colors.bold.redBright(stringifyMessage(this.value))\n }\n}\n\nexport class PathContentToken extends ContentToken<Message> {\n output(): string {\n return relativizePath(stringifyMessage(this.value))\n }\n}\n\nexport class HeadingContentToken extends ContentToken<Message> {\n output(): string {\n return colors.bold.underline(stringifyMessage(this.value))\n }\n}\n\nexport class SubHeadingContentToken extends ContentToken<Message> {\n output(): string {\n return colors.underline(stringifyMessage(this.value))\n }\n}\n\nexport class ItalicContentToken extends ContentToken<Message> {\n output(): string {\n return colors.italic(stringifyMessage(this.value))\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { Abort } from '../error.js';
2
+ export declare const CouldntObtainPartnersSpinFQDNError: Abort;
3
+ export declare const CouldntObtainIdentitySpinFQDNError: Abort;
4
+ export declare const CouldntObtainShopifySpinFQDNError: Abort;
5
+ export declare const NotProvidedStoreFQDNError: Abort;
6
+ /**
7
+ * It returns the Partners' API service we should interact with.
8
+ * @returns Fully-qualified domain of the partners service we should interact with.
9
+ */
10
+ export declare function partners(): Promise<string>;
11
+ /**
12
+ * It returns the Identity service we should interact with.
13
+ * @returns Fully-qualified domain of the Identity service we should interact with.
14
+ */
15
+ export declare function identity(): Promise<string>;
16
+ /**
17
+ * It returns the Shopify service we should interact with.
18
+ * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.
19
+ * @returns Fully-qualified domain of the Shopify service we should interact with.
20
+ */
21
+ export declare function shopify(options?: {
22
+ storeFqdn?: string;
23
+ }): Promise<string>;
24
+ /**
25
+ * Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing
26
+ * @param store - Original store name provided by the user
27
+ * @returns a valid store fqdn
28
+ */
29
+ export declare function normalizeStoreName(store: string): Promise<string>;
@@ -0,0 +1,72 @@
1
+ import { fqdn, fqdn as spinFqdn } from './spin.js';
2
+ import { isSpinEnvironment, serviceEnvironment } from './service.js';
3
+ import { Abort } from '../error.js';
4
+ export const CouldntObtainPartnersSpinFQDNError = new Abort("Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.");
5
+ export const CouldntObtainIdentitySpinFQDNError = new Abort("Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.");
6
+ export const CouldntObtainShopifySpinFQDNError = new Abort("Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.");
7
+ export const NotProvidedStoreFQDNError = new Abort("Couldn't obtain the Shopify FQDN because the store FQDN was not provided.");
8
+ /**
9
+ * It returns the Partners' API service we should interact with.
10
+ * @returns Fully-qualified domain of the partners service we should interact with.
11
+ */
12
+ export async function partners() {
13
+ const environment = serviceEnvironment();
14
+ const productionFqdn = 'partners.shopify.com';
15
+ switch (environment) {
16
+ case 'local':
17
+ return 'partners.myshopify.io';
18
+ case 'spin':
19
+ return `partners.${await spinFqdn()}`;
20
+ default:
21
+ return productionFqdn;
22
+ }
23
+ }
24
+ /**
25
+ * It returns the Identity service we should interact with.
26
+ * @returns Fully-qualified domain of the Identity service we should interact with.
27
+ */
28
+ export async function identity() {
29
+ const environment = serviceEnvironment();
30
+ const productionFqdn = 'accounts.shopify.com';
31
+ switch (environment) {
32
+ case 'local':
33
+ return 'identity.myshopify.io';
34
+ case 'spin':
35
+ return `identity.${await spinFqdn()}`;
36
+ default:
37
+ return productionFqdn;
38
+ }
39
+ }
40
+ /**
41
+ * It returns the Shopify service we should interact with.
42
+ * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.
43
+ * @returns Fully-qualified domain of the Shopify service we should interact with.
44
+ */
45
+ export async function shopify(options = {}) {
46
+ const environment = serviceEnvironment();
47
+ switch (environment) {
48
+ case 'local':
49
+ return 'shopify.myshopify.io';
50
+ case 'spin':
51
+ return `identity.${await spinFqdn()}`;
52
+ default:
53
+ if (options.storeFqdn) {
54
+ return options.storeFqdn;
55
+ }
56
+ else {
57
+ throw NotProvidedStoreFQDNError;
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing
63
+ * @param store - Original store name provided by the user
64
+ * @returns a valid store fqdn
65
+ */
66
+ export async function normalizeStoreName(store) {
67
+ const storeFqdn = store.replace(/^https?:\/\//, '').replace(/\/$/, '');
68
+ const addDomain = async (storeFqdn) => isSpinEnvironment() ? `${storeFqdn}.shopify.${await fqdn()}` : `${storeFqdn}.myshopify.com`;
69
+ const containDomain = (storeFqdn) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev');
70
+ return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn);
71
+ }
72
+ //# sourceMappingURL=fqdn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../src/environment/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAA;AAClE,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,MAAM,CA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CAAC,SAAS,CAAA;aACzB;iBAAM;gBACL,MAAM,yBAAyB,CAAA;aAChC;KACJ;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAa;IACpD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACtE,MAAM,SAAS,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE,CAC5C,iBAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,YAAY,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,gBAAgB,CAAA;IAC7F,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACnH,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AACpE,CAAC","sourcesContent":["import {fqdn, fqdn as spinFqdn} from './spin.js'\nimport {isSpinEnvironment, serviceEnvironment} from './service.js'\nimport {Abort} from '../error.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new Abort(\n \"Couldn't obtain the Shopify FQDN because the store FQDN was not provided.\",\n)\n\n/**\n * It returns the Partners' API service we should interact with.\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partners(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'partners.shopify.com'\n switch (environment) {\n case 'local':\n return 'partners.myshopify.io'\n case 'spin':\n return `partners.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n * @returns Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identity(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'accounts.shopify.com'\n switch (environment) {\n case 'local':\n return 'identity.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Shopify service we should interact with.\n * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.\n * @returns Fully-qualified domain of the Shopify service we should interact with.\n */\nexport async function shopify(options: {storeFqdn?: string} = {}): Promise<string> {\n const environment = serviceEnvironment()\n switch (environment) {\n case 'local':\n return 'shopify.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n if (options.storeFqdn) {\n return options.storeFqdn\n } else {\n throw NotProvidedStoreFQDNError\n }\n }\n}\n\n/**\n * Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing\n * @param store - Original store name provided by the user\n * @returns a valid store fqdn\n */\nexport async function normalizeStoreName(store: string) {\n const storeFqdn = store.replace(/^https?:\\/\\//, '').replace(/\\/$/, '')\n const addDomain = async (storeFqdn: string) =>\n isSpinEnvironment() ? `${storeFqdn}.shopify.${await fqdn()}` : `${storeFqdn}.myshopify.com`\n const containDomain = (storeFqdn: string) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev')\n return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn)\n}\n"]}
@@ -0,0 +1,92 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * It returns true if the terminal is interactive.
4
+ * @returns True if the terminal is interactive.
5
+ */
6
+ export declare function isTerminalInteractive(): boolean;
7
+ /**
8
+ * Returns the path to the user's home directory.
9
+ * @returns The path to the user's home directory.
10
+ */
11
+ export declare function homeDirectory(): string;
12
+ /**
13
+ * Returns true if the CLI is running in debug mode.
14
+ * @param env - The environment variables from the environment of the current process.
15
+ * @returns true if SHOPIFY_ENV is development
16
+ */
17
+ export declare function isDevelopment(env?: NodeJS.ProcessEnv): boolean;
18
+ /**
19
+ * Returns true if the CLI is running in verbose mode.
20
+ * @param env - The environment variables from the environment of the current process.
21
+ * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed
22
+ */
23
+ export declare function isVerbose(env?: NodeJS.ProcessEnv): boolean;
24
+ /**
25
+ * Returns true if the environment in which the CLI is running is either
26
+ * a local environment (where dev is present) or a cloud environment (spin).
27
+ * @returns True if the CLI is used in a Shopify environment.
28
+ */
29
+ export declare function isShopify(env?: NodeJS.ProcessEnv): Promise<boolean>;
30
+ /**
31
+ * This variable is used when running unit tests to indicate that the CLI's business logic
32
+ * is run as a subject of a unit test. We can use this variable to disable output through
33
+ * the standard streams.
34
+ * @param env - The environment variables from the environment of the current process.
35
+ * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.
36
+ */
37
+ export declare function isUnitTest(env?: NodeJS.ProcessEnv): boolean;
38
+ /**
39
+ * Returns true if reporting analytics is enabled.
40
+ * @param env - The environment variables from the environment of the current process.
41
+ * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.
42
+ */
43
+ export declare function analyticsDisabled(env?: NodeJS.ProcessEnv): boolean;
44
+ /** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */
45
+ export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
46
+ export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
47
+ export declare function useDeviceAuth(env?: NodeJS.ProcessEnv): boolean;
48
+ export declare function useFunctionMatching(env?: NodeJS.ProcessEnv): boolean;
49
+ export declare function useThemeBundling(env?: NodeJS.ProcessEnv): boolean;
50
+ export declare function gitpodURL(env?: NodeJS.ProcessEnv): string | undefined;
51
+ export declare function codespaceURL(env?: NodeJS.ProcessEnv): string | undefined;
52
+ /**
53
+ * Checks if the CLI is run from a cloud environment
54
+ *
55
+ * @param env - Environment variables used when the cli is launched
56
+ *
57
+ * @returns True in case the CLI is run from a cloud environment
58
+ */
59
+ export declare function isCloudEnvironment(env?: NodeJS.ProcessEnv): boolean;
60
+ /**
61
+ * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of
62
+ * them. Platform name 'localhost' is returned otherwise
63
+ *
64
+ * @param env - Environment variables used when the cli is launched
65
+ *
66
+ * @returns Cloud platform information
67
+ */
68
+ export declare function cloudEnvironment(env?: NodeJS.ProcessEnv): {
69
+ platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost';
70
+ editor: boolean;
71
+ };
72
+ /**
73
+ * Returns whether the environment has Git available.
74
+ * @returns A promise that resolves with the value.
75
+ */
76
+ export declare function hasGit(): Promise<boolean>;
77
+ /**
78
+ * Gets info on the CI platform the CLI is running on, if applicable
79
+ */
80
+ export declare function ciPlatform(env?: NodeJS.ProcessEnv): {
81
+ isCI: true;
82
+ name: string;
83
+ } | {
84
+ isCI: false;
85
+ name?: undefined;
86
+ };
87
+ /**
88
+ * Returns the first mac address found
89
+ *
90
+ * @returns Mac address
91
+ */
92
+ export declare function macAddress(): Promise<string>;
@@ -0,0 +1,169 @@
1
+ import { isTruthy, isSet } from './utilities.js';
2
+ import { isSpin } from './spin.js';
3
+ import constants from '../constants.js';
4
+ import { exists as fileExists } from '../file.js';
5
+ import { exec } from '../system.js';
6
+ import isInteractive from 'is-interactive';
7
+ import macaddress from 'macaddress';
8
+ import { homedir } from 'os';
9
+ /**
10
+ * It returns true if the terminal is interactive.
11
+ * @returns True if the terminal is interactive.
12
+ */
13
+ export function isTerminalInteractive() {
14
+ return isInteractive();
15
+ }
16
+ /**
17
+ * Returns the path to the user's home directory.
18
+ * @returns The path to the user's home directory.
19
+ */
20
+ export function homeDirectory() {
21
+ return homedir();
22
+ }
23
+ /**
24
+ * Returns true if the CLI is running in debug mode.
25
+ * @param env - The environment variables from the environment of the current process.
26
+ * @returns true if SHOPIFY_ENV is development
27
+ */
28
+ export function isDevelopment(env = process.env) {
29
+ return env[constants.environmentVariables.env] === 'development';
30
+ }
31
+ /**
32
+ * Returns true if the CLI is running in verbose mode.
33
+ * @param env - The environment variables from the environment of the current process.
34
+ * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed
35
+ */
36
+ export function isVerbose(env = process.env) {
37
+ return isTruthy(env[constants.environmentVariables.verbose]) || process.argv.includes('--verbose');
38
+ }
39
+ /**
40
+ * Returns true if the environment in which the CLI is running is either
41
+ * a local environment (where dev is present) or a cloud environment (spin).
42
+ * @returns True if the CLI is used in a Shopify environment.
43
+ */
44
+ export async function isShopify(env = process.env) {
45
+ if (Object.prototype.hasOwnProperty.call(env, constants.environmentVariables.runAsUser)) {
46
+ return !isTruthy(env[constants.environmentVariables.runAsUser]);
47
+ }
48
+ const devInstalled = await fileExists(constants.paths.executables.dev);
49
+ return devInstalled || isSpin(env);
50
+ }
51
+ /**
52
+ * This variable is used when running unit tests to indicate that the CLI's business logic
53
+ * is run as a subject of a unit test. We can use this variable to disable output through
54
+ * the standard streams.
55
+ * @param env - The environment variables from the environment of the current process.
56
+ * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.
57
+ */
58
+ export function isUnitTest(env = process.env) {
59
+ return isTruthy(env[constants.environmentVariables.unitTest]);
60
+ }
61
+ /**
62
+ * Returns true if reporting analytics is enabled.
63
+ * @param env - The environment variables from the environment of the current process.
64
+ * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.
65
+ */
66
+ export function analyticsDisabled(env = process.env) {
67
+ return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDevelopment(env);
68
+ }
69
+ /** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */
70
+ export function alwaysLogAnalytics(env = process.env) {
71
+ return isTruthy(env[constants.environmentVariables.alwaysLogAnalytics]);
72
+ }
73
+ export function firstPartyDev(env = process.env) {
74
+ return isTruthy(env[constants.environmentVariables.firstPartyDev]);
75
+ }
76
+ export function useDeviceAuth(env = process.env) {
77
+ return isTruthy(env[constants.environmentVariables.deviceAuth]) || isCloudEnvironment(env);
78
+ }
79
+ export function useFunctionMatching(env = process.env) {
80
+ return isTruthy(env[constants.environmentVariables.functionMatching]);
81
+ }
82
+ export function useThemeBundling(env = process.env) {
83
+ return isTruthy(env[constants.environmentVariables.themeBundling]);
84
+ }
85
+ // https://www.gitpod.io/docs/environment-variables#default-environment-variables
86
+ export function gitpodURL(env = process.env) {
87
+ return env[constants.environmentVariables.gitpod];
88
+ }
89
+ // https://docs.github.com/en/codespaces/developing-in-codespaces/default-environment-variables-for-your-codespace#list-of-default-environment-variables
90
+ export function codespaceURL(env = process.env) {
91
+ return env[constants.environmentVariables.codespaceName];
92
+ }
93
+ /**
94
+ * Checks if the CLI is run from a cloud environment
95
+ *
96
+ * @param env - Environment variables used when the cli is launched
97
+ *
98
+ * @returns True in case the CLI is run from a cloud environment
99
+ */
100
+ export function isCloudEnvironment(env = process.env) {
101
+ return cloudEnvironment(env).platform !== 'localhost';
102
+ }
103
+ /**
104
+ * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of
105
+ * them. Platform name 'localhost' is returned otherwise
106
+ *
107
+ * @param env - Environment variables used when the cli is launched
108
+ *
109
+ * @returns Cloud platform information
110
+ */
111
+ export function cloudEnvironment(env = process.env) {
112
+ if (isSet(env[constants.environmentVariables.codespaces])) {
113
+ return { platform: 'codespaces', editor: true };
114
+ }
115
+ if (isSet(env[constants.environmentVariables.gitpod])) {
116
+ return { platform: 'gitpod', editor: true };
117
+ }
118
+ if (isSpin(env)) {
119
+ return { platform: 'spin', editor: false };
120
+ }
121
+ return { platform: 'localhost', editor: false };
122
+ }
123
+ /**
124
+ * Returns whether the environment has Git available.
125
+ * @returns A promise that resolves with the value.
126
+ */
127
+ export async function hasGit() {
128
+ try {
129
+ await exec('git', ['--version']);
130
+ return true;
131
+ // eslint-disable-next-line no-catch-all/no-catch-all
132
+ }
133
+ catch {
134
+ return false;
135
+ }
136
+ }
137
+ /**
138
+ * Gets info on the CI platform the CLI is running on, if applicable
139
+ */
140
+ export function ciPlatform(env = process.env) {
141
+ if (isTruthy(env.CI)) {
142
+ let name = 'unknown';
143
+ if (isTruthy(env.CIRCLECI)) {
144
+ name = 'circleci';
145
+ }
146
+ else if (isSet(env.GITHUB_ACTION)) {
147
+ name = 'github';
148
+ }
149
+ else if (isTruthy(env.GITLAB_CI)) {
150
+ name = 'gitlab';
151
+ }
152
+ return {
153
+ isCI: true,
154
+ name,
155
+ };
156
+ }
157
+ return {
158
+ isCI: false,
159
+ };
160
+ }
161
+ /**
162
+ * Returns the first mac address found
163
+ *
164
+ * @returns Mac address
165
+ */
166
+ export function macAddress() {
167
+ return macaddress.one();
168
+ }
169
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/environment/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,IAAI,CAAA;AAE1B;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,EAAE,CAAA;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,U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IAAI,GAAG,QAAQ,CAAA;SAChB;aAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,GAAG,QAAQ,CAAA;SAChB;QAED,OAAO;YACL,IAAI,EAAE,IAAI;YACV,IAAI;SACL,CAAA;KACF;IACD,OAAO;QACL,IAAI,EAAE,KAAK;KACZ,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAA;AACzB,CAAC","sourcesContent":["import {isTruthy, isSet} from './utilities.js'\nimport {isSpin} from './spin.js'\nimport constants from '../constants.js'\nimport {exists as fileExists} from '../file.js'\nimport {exec} from '../system.js'\nimport isInteractive from 'is-interactive'\nimport macaddress from 'macaddress'\nimport {homedir} from 'os'\n\n/**\n * It returns true if the terminal is interactive.\n * @returns True if the terminal is interactive.\n */\nexport function isTerminalInteractive(): boolean {\n return isInteractive()\n}\n\n/**\n * Returns the path to the user's home directory.\n * @returns The path to the user's home directory.\n */\nexport function homeDirectory(): string {\n return homedir()\n}\n\n/**\n * Returns true if the CLI is running in debug mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_ENV is development\n */\nexport function isDevelopment(env = process.env): boolean {\n return env[constants.environmentVariables.env] === 'development'\n}\n\n/**\n * Returns true if the CLI is running in verbose mode.\n * @param env - The environment variables from the environment of the current process.\n * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed\n */\nexport function isVerbose(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.verbose]) || process.argv.includes('--verbose')\n}\n\n/**\n * Returns true if the environment in which the CLI is running is either\n * a local environment (where dev is present) or a cloud environment (spin).\n * @returns True if the CLI is used in a Shopify environment.\n */\nexport async function isShopify(env = process.env): Promise<boolean> {\n if (Object.prototype.hasOwnProperty.call(env, constants.environmentVariables.runAsUser)) {\n return !isTruthy(env[constants.environmentVariables.runAsUser])\n }\n const devInstalled = await fileExists(constants.paths.executables.dev)\n return devInstalled || isSpin(env)\n}\n\n/**\n * This variable is used when running unit tests to indicate that the CLI's business logic\n * is run as a subject of a unit test. We can use this variable to disable output through\n * the standard streams.\n * @param env - The environment variables from the environment of the current process.\n * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.\n */\nexport function isUnitTest(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.unitTest])\n}\n\n/**\n * Returns true if reporting analytics is enabled.\n * @param env - The environment variables from the environment of the current process.\n * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy or debug mode is enabled.\n */\nexport function analyticsDisabled(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.noAnalytics]) || isDevelopment(env)\n}\n\n/** Returns true if reporting analytics should always happen, regardless of DEBUG mode etc. */\nexport function alwaysLogAnalytics(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.alwaysLogAnalytics])\n}\n\nexport function firstPartyDev(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.firstPartyDev])\n}\n\nexport function useDeviceAuth(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.deviceAuth]) || isCloudEnvironment(env)\n}\n\nexport function useFunctionMatching(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.functionMatching])\n}\n\nexport function useThemeBundling(env = process.env): boolean {\n return isTruthy(env[constants.environmentVariables.themeBundling])\n}\n\n// https://www.gitpod.io/docs/environment-variables#default-environment-variables\nexport function gitpodURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.gitpod]\n}\n\n// https://docs.github.com/en/codespaces/developing-in-codespaces/default-environment-variables-for-your-codespace#list-of-default-environment-variables\nexport function codespaceURL(env = process.env): string | undefined {\n return env[constants.environmentVariables.codespaceName]\n}\n\n/**\n * Checks if the CLI is run from a cloud environment\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns True in case the CLI is run from a cloud environment\n */\nexport function isCloudEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n return cloudEnvironment(env).platform !== 'localhost'\n}\n\n/**\n * Returns the cloud environment platform name and if the platform support online IDE in case the CLI is run from one of\n * them. Platform name 'localhost' is returned otherwise\n *\n * @param env - Environment variables used when the cli is launched\n *\n * @returns Cloud platform information\n */\nexport function cloudEnvironment(env: NodeJS.ProcessEnv = process.env): {\n platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost'\n editor: boolean\n} {\n if (isSet(env[constants.environmentVariables.codespaces])) {\n return {platform: 'codespaces', editor: true}\n }\n if (isSet(env[constants.environmentVariables.gitpod])) {\n return {platform: 'gitpod', editor: true}\n }\n if (isSpin(env)) {\n return {platform: 'spin', editor: false}\n }\n return {platform: 'localhost', editor: false}\n}\n\n/**\n * Returns whether the environment has Git available.\n * @returns A promise that resolves with the value.\n */\nexport async function hasGit(): Promise<boolean> {\n try {\n await exec('git', ['--version'])\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Gets info on the CI platform the CLI is running on, if applicable\n */\nexport function ciPlatform(env = process.env): {isCI: true; name: string} | {isCI: false; name?: undefined} {\n if (isTruthy(env.CI)) {\n let name = 'unknown'\n if (isTruthy(env.CIRCLECI)) {\n name = 'circleci'\n } else if (isSet(env.GITHUB_ACTION)) {\n name = 'github'\n } else if (isTruthy(env.GITLAB_CI)) {\n name = 'gitlab'\n }\n\n return {\n isCI: true,\n name,\n }\n }\n return {\n isCI: false,\n }\n}\n\n/**\n * Returns the first mac address found\n *\n * @returns Mac address\n */\nexport function macAddress() {\n return macaddress.one()\n}\n"]}
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import { Environment } from '../network/service.js';
3
+ export declare function serviceEnvironment(env?: NodeJS.ProcessEnv): Environment;
4
+ export declare function isSpinEnvironment(env?: NodeJS.ProcessEnv): boolean;
@@ -0,0 +1,19 @@
1
+ import { isSpin } from './spin.js';
2
+ import constants from '../constants.js';
3
+ import { Environment } from '../network/service.js';
4
+ export function serviceEnvironment(env = process.env) {
5
+ const value = env[constants.environmentVariables.serviceEnv];
6
+ if (value === 'local') {
7
+ return Environment.Local;
8
+ }
9
+ else if (value === 'spin' || isSpin(env)) {
10
+ return Environment.Spin;
11
+ }
12
+ else {
13
+ return Environment.Production;
14
+ }
15
+ }
16
+ export function isSpinEnvironment(env = process.env) {
17
+ return serviceEnvironment(env) === Environment.Spin;
18
+ }
19
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/environment/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAA;AAEjD,MAAM,UAAU,kBAAkB,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IAClD,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;IAC5D,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,OAAO,WAAW,CAAC,KAAK,CAAA;KACzB;SAAM,IAAI,KAAK,KAAK,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;QAC1C,OAAO,WAAW,CAAC,IAAI,CAAA;KACxB;SAAM;QACL,OAAO,WAAW,CAAC,UAAU,CAAA;KAC9B;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IACjD,OAAO,kBAAkB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,IAAI,CAAA;AACrD,CAAC","sourcesContent":["import {isSpin} from './spin.js'\nimport constants from '../constants.js'\nimport {Environment} from '../network/service.js'\n\nexport function serviceEnvironment(env = process.env): Environment {\n const value = env[constants.environmentVariables.serviceEnv]\n if (value === 'local') {\n return Environment.Local\n } else if (value === 'spin' || isSpin(env)) {\n return Environment.Spin\n } else {\n return Environment.Production\n }\n}\n\nexport function isSpinEnvironment(env = process.env): boolean {\n return serviceEnvironment(env) === Environment.Spin\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function getCachedSpinFqdn(): string | undefined;
2
+ export declare function setCachedSpinFqdn(fqdn: string): void;
@@ -0,0 +1,8 @@
1
+ let cachedSpinFQDN;
2
+ export function getCachedSpinFqdn() {
3
+ return cachedSpinFQDN;
4
+ }
5
+ export function setCachedSpinFqdn(fqdn) {
6
+ cachedSpinFQDN = fqdn;
7
+ }
8
+ //# sourceMappingURL=spin-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spin-cache.js","sourceRoot":"","sources":["../../src/environment/spin-cache.ts"],"names":[],"mappings":"AAAA,IAAI,cAAsB,CAAA;AAE1B,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,cAAc,GAAG,IAAI,CAAA;AACvB,CAAC","sourcesContent":["let cachedSpinFQDN: string\n\nexport function getCachedSpinFqdn(): string | undefined {\n return cachedSpinFQDN\n}\n\nexport function setCachedSpinFqdn(fqdn: string) {\n cachedSpinFQDN = fqdn\n}\n"]}
@@ -0,0 +1,50 @@
1
+ /// <reference types="node" />
2
+ import { Abort } from '../error.js';
3
+ export declare const SpinInstanceNotFound: (spinInstance: string | undefined, error: string) => Abort;
4
+ /**
5
+ * When ran in a Spin environment, it returns the fqdn of the instance.
6
+ *
7
+ * Will cache the value of the Spin FQDN during the execution of the CLI.
8
+ * To avoid multiple calls to `readSync` or `show`
9
+ * @returns fqdn of the Spin environment.
10
+ */
11
+ export declare function fqdn(env?: NodeJS.ProcessEnv): Promise<string>;
12
+ /**
13
+ * Runs "spin show" and returns the JSON-parsed output.
14
+ * @param spinInstance - When it's undefined, we'll fetch the latest one.
15
+ * @returns The JSON-parsed output of the Spin CLI.
16
+ * @throws Any error raised from the underlying Spin CLI.
17
+ */
18
+ export declare function show(spinInstance: string | undefined, env?: NodeJS.ProcessEnv): Promise<{
19
+ fqdn: string;
20
+ }>;
21
+ /**
22
+ * Returns true if the CLI is running in a Spin environment.
23
+ * @param env - Environment variables
24
+ * @returns True if the CLI is running in a Spin environment.
25
+ */
26
+ export declare function isSpin(env?: NodeJS.ProcessEnv): boolean;
27
+ /**
28
+ * Returns the value of the SPIN_INSTANCE environment variable.
29
+ * @param env - Environment variables
30
+ * @returns The value of the SPIN_INSTANCE environment variable.
31
+ */
32
+ export declare function instance(env?: NodeJS.ProcessEnv): string | undefined;
33
+ /**
34
+ * Returns the value of the SPIN_WORKSPACE environment variable.
35
+ * @param env - Environment variables
36
+ * @returns The value of the SPIN_WORKSPACE environment variable.
37
+ */
38
+ export declare function workspace(env?: NodeJS.ProcessEnv): string | undefined;
39
+ /**
40
+ * Returns the value of the SPIN_NAMESPACE environment variable.
41
+ * @param env - Environment variables
42
+ * @returns The value of the SPIN_NAMESPACE environment variable.
43
+ */
44
+ export declare function namespace(env?: NodeJS.ProcessEnv): string | undefined;
45
+ /**
46
+ * Returns the value of the SPIN_HOST environment variable.
47
+ * @param env - Environment variables
48
+ * @returns The value of the SPIN_HOST environment variable.
49
+ */
50
+ export declare function host(env?: NodeJS.ProcessEnv): string | undefined;