@osdk/cli 0.24.0-beta.12 → 0.24.0-beta.13

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 (420) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/browser/cli.d.ts +7 -0
  3. package/build/browser/cli.d.ts.map +1 -0
  4. package/build/browser/cli.js +42 -0
  5. package/build/browser/cli.js.map +1 -0
  6. package/build/browser/commands/auth/index.d.ts +5 -0
  7. package/build/browser/commands/auth/index.d.ts.map +1 -0
  8. package/build/browser/commands/auth/index.js +34 -0
  9. package/build/browser/commands/auth/index.js.map +1 -0
  10. package/build/browser/commands/auth/login/index.d.ts +5 -0
  11. package/build/browser/commands/auth/login/index.d.ts.map +1 -0
  12. package/build/browser/commands/auth/login/index.js +34 -0
  13. package/build/browser/commands/auth/login/index.js.map +1 -0
  14. package/build/browser/commands/site/CommonSiteArgs.d.ts +9 -0
  15. package/build/browser/commands/site/CommonSiteArgs.d.ts.map +1 -0
  16. package/build/browser/commands/site/CommonSiteArgs.js +17 -0
  17. package/build/browser/commands/site/CommonSiteArgs.js.map +1 -0
  18. package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts +10 -0
  19. package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts.map +1 -0
  20. package/build/browser/commands/site/deploy/SiteDeployArgs.js +17 -0
  21. package/build/browser/commands/site/deploy/SiteDeployArgs.js.map +1 -0
  22. package/build/browser/commands/site/deploy/index.d.ts +6 -0
  23. package/build/browser/commands/site/deploy/index.d.ts.map +1 -0
  24. package/build/browser/commands/site/deploy/index.js +108 -0
  25. package/build/browser/commands/site/deploy/index.js.map +1 -0
  26. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts +5 -0
  27. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts.map +1 -0
  28. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js +28 -0
  29. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +1 -0
  30. package/build/browser/commands/site/deploy/siteDeployCommand.d.mts +10 -0
  31. package/build/browser/commands/site/deploy/siteDeployCommand.d.mts.map +1 -0
  32. package/build/browser/commands/site/deploy/siteDeployCommand.js +98 -0
  33. package/build/browser/commands/site/deploy/siteDeployCommand.js.map +1 -0
  34. package/build/browser/commands/site/deploy/siteDeployCommand.mjs +90 -0
  35. package/build/browser/commands/site/index.d.ts +6 -0
  36. package/build/browser/commands/site/index.d.ts.map +1 -0
  37. package/build/browser/commands/site/index.js +69 -0
  38. package/build/browser/commands/site/index.js.map +1 -0
  39. package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts +5 -0
  40. package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts.map +1 -0
  41. package/build/browser/commands/site/logSiteCommandConfigFileOverride.js +25 -0
  42. package/build/browser/commands/site/logSiteCommandConfigFileOverride.js.map +1 -0
  43. package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts +6 -0
  44. package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts.map +1 -0
  45. package/build/browser/commands/site/version/delete/VersionDeleteArgs.js +17 -0
  46. package/build/browser/commands/site/version/delete/VersionDeleteArgs.js.map +1 -0
  47. package/build/browser/commands/site/version/delete/index.d.ts +6 -0
  48. package/build/browser/commands/site/version/delete/index.d.ts.map +1 -0
  49. package/build/browser/commands/site/version/delete/index.js +36 -0
  50. package/build/browser/commands/site/version/delete/index.js.map +1 -0
  51. package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts +3 -0
  52. package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts.map +1 -0
  53. package/build/browser/commands/site/version/delete/versionDeleteCommand.js +41 -0
  54. package/build/browser/commands/site/version/delete/versionDeleteCommand.js.map +1 -0
  55. package/build/browser/commands/site/version/delete/versionDeleteCommand.mjs +32 -0
  56. package/build/browser/commands/site/version/get/VersionGetArgs.d.ts +4 -0
  57. package/build/browser/commands/site/version/get/VersionGetArgs.d.ts.map +1 -0
  58. package/build/browser/commands/site/version/get/VersionGetArgs.js +17 -0
  59. package/build/browser/commands/site/version/get/VersionGetArgs.js.map +1 -0
  60. package/build/browser/commands/site/version/get/index.d.ts +6 -0
  61. package/build/browser/commands/site/version/get/index.d.ts.map +1 -0
  62. package/build/browser/commands/site/version/get/index.js +28 -0
  63. package/build/browser/commands/site/version/get/index.js.map +1 -0
  64. package/build/browser/commands/site/version/get/versionGetCommand.d.mts +3 -0
  65. package/build/browser/commands/site/version/get/versionGetCommand.d.mts.map +1 -0
  66. package/build/browser/commands/site/version/get/versionGetCommand.js +36 -0
  67. package/build/browser/commands/site/version/get/versionGetCommand.js.map +1 -0
  68. package/build/browser/commands/site/version/get/versionGetCommand.mjs +32 -0
  69. package/build/browser/commands/site/version/index.d.ts +5 -0
  70. package/build/browser/commands/site/version/index.d.ts.map +1 -0
  71. package/build/browser/commands/site/version/index.js +30 -0
  72. package/build/browser/commands/site/version/index.js.map +1 -0
  73. package/build/browser/commands/site/version/list/VersionListArgs.d.ts +4 -0
  74. package/build/browser/commands/site/version/list/VersionListArgs.d.ts.map +1 -0
  75. package/build/browser/commands/site/version/list/VersionListArgs.js +17 -0
  76. package/build/browser/commands/site/version/list/VersionListArgs.js.map +1 -0
  77. package/build/browser/commands/site/version/list/index.d.ts +6 -0
  78. package/build/browser/commands/site/version/list/index.d.ts.map +1 -0
  79. package/build/browser/commands/site/version/list/index.js +28 -0
  80. package/build/browser/commands/site/version/list/index.js.map +1 -0
  81. package/build/browser/commands/site/version/list/versionListCommand.d.mts +3 -0
  82. package/build/browser/commands/site/version/list/versionListCommand.d.mts.map +1 -0
  83. package/build/browser/commands/site/version/list/versionListCommand.js +41 -0
  84. package/build/browser/commands/site/version/list/versionListCommand.js.map +1 -0
  85. package/build/browser/commands/site/version/list/versionListCommand.mjs +42 -0
  86. package/build/browser/commands/site/version/set/VersionSetArgs.d.ts +5 -0
  87. package/build/browser/commands/site/version/set/VersionSetArgs.d.ts.map +1 -0
  88. package/build/browser/commands/site/version/set/VersionSetArgs.js +17 -0
  89. package/build/browser/commands/site/version/set/VersionSetArgs.js.map +1 -0
  90. package/build/browser/commands/site/version/set/index.d.ts +6 -0
  91. package/build/browser/commands/site/version/set/index.d.ts.map +1 -0
  92. package/build/browser/commands/site/version/set/index.js +32 -0
  93. package/build/browser/commands/site/version/set/index.js.map +1 -0
  94. package/build/browser/commands/site/version/set/versionSetCommand.d.mts +3 -0
  95. package/build/browser/commands/site/version/set/versionSetCommand.d.mts.map +1 -0
  96. package/build/browser/commands/site/version/set/versionSetCommand.js +36 -0
  97. package/build/browser/commands/site/version/set/versionSetCommand.js.map +1 -0
  98. package/build/browser/commands/site/version/set/versionSetCommand.mjs +28 -0
  99. package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts +5 -0
  100. package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts.map +1 -0
  101. package/build/browser/commands/site/version/unset/VersionUnsetArgs.js +17 -0
  102. package/build/browser/commands/site/version/unset/VersionUnsetArgs.js.map +1 -0
  103. package/build/browser/commands/site/version/unset/index.d.ts +6 -0
  104. package/build/browser/commands/site/version/unset/index.d.ts.map +1 -0
  105. package/build/browser/commands/site/version/unset/index.js +32 -0
  106. package/build/browser/commands/site/version/unset/index.js.map +1 -0
  107. package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts +3 -0
  108. package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts.map +1 -0
  109. package/build/browser/commands/site/version/unset/versionUnsetCommand.js +40 -0
  110. package/build/browser/commands/site/version/unset/versionUnsetCommand.js.map +1 -0
  111. package/build/browser/commands/site/version/unset/versionUnsetCommand.mjs +32 -0
  112. package/build/browser/consola/handlePromptCancel.d.ts +2 -0
  113. package/build/browser/consola/handlePromptCancel.d.ts.map +1 -0
  114. package/build/browser/consola/handlePromptCancel.js +25 -0
  115. package/build/browser/consola/handlePromptCancel.js.map +1 -0
  116. package/build/browser/index.d.ts +2 -0
  117. package/build/browser/index.d.ts.map +1 -0
  118. package/build/browser/index.js +16 -588
  119. package/build/browser/index.js.map +1 -1
  120. package/build/browser/net/ThirdPartyAppRid.d.ts +2 -0
  121. package/build/browser/net/ThirdPartyAppRid.d.ts.map +1 -0
  122. package/build/browser/net/ThirdPartyAppRid.js +17 -0
  123. package/build/browser/net/ThirdPartyAppRid.js.map +1 -0
  124. package/build/browser/net/UserAgent.d.ts +2 -0
  125. package/build/browser/net/UserAgent.d.ts.map +1 -0
  126. package/build/browser/net/UserAgent.js +17 -0
  127. package/build/browser/net/UserAgent.js.map +1 -0
  128. package/build/browser/net/createFetch.d.mts +2 -0
  129. package/build/browser/net/createFetch.d.mts.map +1 -0
  130. package/build/browser/net/createFetch.js +66 -0
  131. package/build/browser/net/createFetch.js.map +1 -0
  132. package/build/browser/net/createFetch.mjs +71 -0
  133. package/build/browser/net/createInternalClientContext.d.mts +3 -0
  134. package/build/browser/net/createInternalClientContext.d.mts.map +1 -0
  135. package/build/browser/net/createInternalClientContext.js +22 -0
  136. package/build/browser/net/createInternalClientContext.js.map +1 -0
  137. package/build/browser/net/createInternalClientContext.mjs +21 -0
  138. package/build/browser/net/index.d.mts +3 -0
  139. package/build/browser/net/index.d.mts.map +1 -0
  140. package/build/browser/net/index.js +18 -0
  141. package/build/browser/net/index.js.map +1 -0
  142. package/build/browser/net/index.mjs +17 -0
  143. package/build/browser/net/internalClientContext.d.mts +5 -0
  144. package/build/browser/net/internalClientContext.d.mts.map +1 -0
  145. package/build/browser/net/internalClientContext.js +17 -0
  146. package/build/browser/net/internalClientContext.js.map +1 -0
  147. package/build/browser/net/internalClientContext.mjs +16 -0
  148. package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts +4 -0
  149. package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts.map +1 -0
  150. package/build/browser/net/third-party-applications/DeployWebsiteRequest.js +17 -0
  151. package/build/browser/net/third-party-applications/DeployWebsiteRequest.js.map +1 -0
  152. package/build/browser/net/third-party-applications/DeployWebsiteRequest.mjs +16 -0
  153. package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts +6 -0
  154. package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts.map +1 -0
  155. package/build/browser/net/third-party-applications/ListVersionsResponse.js +17 -0
  156. package/build/browser/net/third-party-applications/ListVersionsResponse.js.map +1 -0
  157. package/build/browser/net/third-party-applications/ListVersionsResponse.mjs +16 -0
  158. package/build/browser/net/third-party-applications/Version.d.mts +4 -0
  159. package/build/browser/net/third-party-applications/Version.d.mts.map +1 -0
  160. package/build/browser/net/third-party-applications/Version.js +17 -0
  161. package/build/browser/net/third-party-applications/Version.js.map +1 -0
  162. package/build/browser/net/third-party-applications/Version.mjs +16 -0
  163. package/build/browser/net/third-party-applications/Website.d.mts +5 -0
  164. package/build/browser/net/third-party-applications/Website.d.mts.map +1 -0
  165. package/build/browser/net/third-party-applications/Website.js +17 -0
  166. package/build/browser/net/third-party-applications/Website.js.map +1 -0
  167. package/build/browser/net/third-party-applications/Website.mjs +16 -0
  168. package/build/browser/net/third-party-applications/deleteVersion.d.mts +4 -0
  169. package/build/browser/net/third-party-applications/deleteVersion.d.mts.map +1 -0
  170. package/build/browser/net/third-party-applications/deleteVersion.js +24 -0
  171. package/build/browser/net/third-party-applications/deleteVersion.js.map +1 -0
  172. package/build/browser/net/third-party-applications/deleteVersion.mjs +23 -0
  173. package/build/browser/net/third-party-applications/deployWebsite.d.mts +6 -0
  174. package/build/browser/net/third-party-applications/deployWebsite.d.mts.map +1 -0
  175. package/build/browser/net/third-party-applications/deployWebsite.js +29 -0
  176. package/build/browser/net/third-party-applications/deployWebsite.js.map +1 -0
  177. package/build/browser/net/third-party-applications/deployWebsite.mjs +28 -0
  178. package/build/browser/net/third-party-applications/getWebsite.d.mts +5 -0
  179. package/build/browser/net/third-party-applications/getWebsite.d.mts.map +1 -0
  180. package/build/browser/net/third-party-applications/getWebsite.js +33 -0
  181. package/build/browser/net/third-party-applications/getWebsite.js.map +1 -0
  182. package/build/browser/net/third-party-applications/getWebsite.mjs +35 -0
  183. package/build/browser/net/third-party-applications/index.d.mts +11 -0
  184. package/build/browser/net/third-party-applications/index.d.mts.map +1 -0
  185. package/build/browser/net/third-party-applications/index.js +22 -0
  186. package/build/browser/net/third-party-applications/index.js.map +1 -0
  187. package/build/browser/net/third-party-applications/index.mjs +21 -0
  188. package/build/browser/net/third-party-applications/listVersions.d.mts +5 -0
  189. package/build/browser/net/third-party-applications/listVersions.d.mts.map +1 -0
  190. package/build/browser/net/third-party-applications/listVersions.js +23 -0
  191. package/build/browser/net/third-party-applications/listVersions.js.map +1 -0
  192. package/build/browser/net/third-party-applications/listVersions.mjs +22 -0
  193. package/build/browser/net/third-party-applications/undeployWebsite.d.mts +4 -0
  194. package/build/browser/net/third-party-applications/undeployWebsite.d.mts.map +1 -0
  195. package/build/browser/net/third-party-applications/undeployWebsite.js +24 -0
  196. package/build/browser/net/third-party-applications/undeployWebsite.js.map +1 -0
  197. package/build/browser/net/third-party-applications/undeployWebsite.mjs +23 -0
  198. package/build/browser/net/third-party-applications/uploadVersion.d.mts +5 -0
  199. package/build/browser/net/third-party-applications/uploadVersion.d.mts.map +1 -0
  200. package/build/browser/net/third-party-applications/uploadVersion.js +30 -0
  201. package/build/browser/net/third-party-applications/uploadVersion.js.map +1 -0
  202. package/build/browser/net/third-party-applications/uploadVersion.mjs +29 -0
  203. package/build/browser/util/autoVersion.d.ts +9 -0
  204. package/build/browser/util/autoVersion.d.ts.map +1 -0
  205. package/build/browser/util/autoVersion.js +62 -0
  206. package/build/browser/util/autoVersion.js.map +1 -0
  207. package/build/browser/util/autoVersion.test.d.ts +2 -0
  208. package/build/browser/util/autoVersion.test.d.ts.map +1 -0
  209. package/build/browser/util/autoVersion.test.js +71 -0
  210. package/build/browser/util/autoVersion.test.js.map +1 -0
  211. package/build/browser/util/config.d.ts +26 -0
  212. package/build/browser/util/config.d.ts.map +1 -0
  213. package/build/browser/util/config.js +102 -0
  214. package/build/browser/util/config.js.map +1 -0
  215. package/build/browser/util/config.test.d.ts +2 -0
  216. package/build/browser/util/config.test.d.ts.map +1 -0
  217. package/build/browser/util/config.test.js +110 -0
  218. package/build/browser/util/config.test.js.map +1 -0
  219. package/build/browser/util/configLoader.d.ts +4 -0
  220. package/build/browser/util/configLoader.d.ts.map +1 -0
  221. package/build/browser/util/configLoader.js +25 -0
  222. package/build/browser/util/configLoader.js.map +1 -0
  223. package/build/browser/util/isValidSemver.test.d.ts +2 -0
  224. package/build/browser/util/isValidSemver.test.d.ts.map +1 -0
  225. package/build/browser/util/isValidSemver.test.js +41 -0
  226. package/build/browser/util/isValidSemver.test.js.map +1 -0
  227. package/build/browser/util/token.d.ts +22 -0
  228. package/build/browser/util/token.d.ts.map +1 -0
  229. package/build/browser/util/token.js +84 -0
  230. package/build/browser/util/token.js.map +1 -0
  231. package/build/browser/util/token.test.d.ts +2 -0
  232. package/build/browser/util/token.test.d.ts.map +1 -0
  233. package/build/browser/util/token.test.js +62 -0
  234. package/build/browser/util/token.test.js.map +1 -0
  235. package/build/browser/yargs/logConfigFileMiddleware.d.ts +2 -0
  236. package/build/browser/yargs/logConfigFileMiddleware.d.ts.map +1 -0
  237. package/build/browser/yargs/logConfigFileMiddleware.js +29 -0
  238. package/build/browser/yargs/logConfigFileMiddleware.js.map +1 -0
  239. package/build/esm/cli.js +42 -0
  240. package/build/esm/cli.js.map +1 -0
  241. package/build/esm/commands/auth/index.js +34 -0
  242. package/build/esm/commands/auth/index.js.map +1 -0
  243. package/build/esm/commands/auth/login/index.js +34 -0
  244. package/build/esm/commands/auth/login/index.js.map +1 -0
  245. package/build/esm/commands/site/CommonSiteArgs.js +17 -0
  246. package/build/esm/commands/site/CommonSiteArgs.js.map +1 -0
  247. package/build/esm/commands/site/deploy/SiteDeployArgs.js +17 -0
  248. package/build/esm/commands/site/deploy/SiteDeployArgs.js.map +1 -0
  249. package/build/esm/commands/site/deploy/index.js +108 -0
  250. package/build/esm/commands/site/deploy/index.js.map +1 -0
  251. package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js +28 -0
  252. package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +1 -0
  253. package/build/esm/commands/site/deploy/siteDeployCommand.js +98 -0
  254. package/build/esm/commands/site/deploy/siteDeployCommand.js.map +1 -0
  255. package/build/esm/commands/site/deploy/siteDeployCommand.mjs +90 -0
  256. package/build/esm/commands/site/index.js +69 -0
  257. package/build/esm/commands/site/index.js.map +1 -0
  258. package/build/esm/commands/site/logSiteCommandConfigFileOverride.js +25 -0
  259. package/build/esm/commands/site/logSiteCommandConfigFileOverride.js.map +1 -0
  260. package/build/esm/commands/site/version/delete/VersionDeleteArgs.js +17 -0
  261. package/build/esm/commands/site/version/delete/VersionDeleteArgs.js.map +1 -0
  262. package/build/esm/commands/site/version/delete/index.js +36 -0
  263. package/build/esm/commands/site/version/delete/index.js.map +1 -0
  264. package/build/esm/commands/site/version/delete/versionDeleteCommand.js +41 -0
  265. package/build/esm/commands/site/version/delete/versionDeleteCommand.js.map +1 -0
  266. package/build/esm/commands/site/version/delete/versionDeleteCommand.mjs +32 -0
  267. package/build/esm/commands/site/version/get/VersionGetArgs.js +17 -0
  268. package/build/esm/commands/site/version/get/VersionGetArgs.js.map +1 -0
  269. package/build/esm/commands/site/version/get/index.js +28 -0
  270. package/build/esm/commands/site/version/get/index.js.map +1 -0
  271. package/build/esm/commands/site/version/get/versionGetCommand.js +36 -0
  272. package/build/esm/commands/site/version/get/versionGetCommand.js.map +1 -0
  273. package/build/esm/commands/site/version/get/versionGetCommand.mjs +32 -0
  274. package/build/esm/commands/site/version/index.js +30 -0
  275. package/build/esm/commands/site/version/index.js.map +1 -0
  276. package/build/esm/commands/site/version/list/VersionListArgs.js +17 -0
  277. package/build/esm/commands/site/version/list/VersionListArgs.js.map +1 -0
  278. package/build/esm/commands/site/version/list/index.js +28 -0
  279. package/build/esm/commands/site/version/list/index.js.map +1 -0
  280. package/build/esm/commands/site/version/list/versionListCommand.js +41 -0
  281. package/build/esm/commands/site/version/list/versionListCommand.js.map +1 -0
  282. package/build/esm/commands/site/version/list/versionListCommand.mjs +42 -0
  283. package/build/esm/commands/site/version/set/VersionSetArgs.js +17 -0
  284. package/build/esm/commands/site/version/set/VersionSetArgs.js.map +1 -0
  285. package/build/esm/commands/site/version/set/index.js +32 -0
  286. package/build/esm/commands/site/version/set/index.js.map +1 -0
  287. package/build/esm/commands/site/version/set/versionSetCommand.js +36 -0
  288. package/build/esm/commands/site/version/set/versionSetCommand.js.map +1 -0
  289. package/build/esm/commands/site/version/set/versionSetCommand.mjs +28 -0
  290. package/build/esm/commands/site/version/unset/VersionUnsetArgs.js +17 -0
  291. package/build/esm/commands/site/version/unset/VersionUnsetArgs.js.map +1 -0
  292. package/build/esm/commands/site/version/unset/index.js +32 -0
  293. package/build/esm/commands/site/version/unset/index.js.map +1 -0
  294. package/build/esm/commands/site/version/unset/versionUnsetCommand.js +40 -0
  295. package/build/esm/commands/site/version/unset/versionUnsetCommand.js.map +1 -0
  296. package/build/esm/commands/site/version/unset/versionUnsetCommand.mjs +32 -0
  297. package/build/esm/consola/handlePromptCancel.js +25 -0
  298. package/build/esm/consola/handlePromptCancel.js.map +1 -0
  299. package/build/esm/index.js +16 -588
  300. package/build/esm/index.js.map +1 -1
  301. package/build/esm/net/ThirdPartyAppRid.js +17 -0
  302. package/build/esm/net/ThirdPartyAppRid.js.map +1 -0
  303. package/build/esm/net/UserAgent.js +17 -0
  304. package/build/esm/net/UserAgent.js.map +1 -0
  305. package/build/esm/net/createFetch.js +66 -0
  306. package/build/esm/net/createFetch.js.map +1 -0
  307. package/build/esm/net/createFetch.mjs +71 -0
  308. package/build/esm/net/createInternalClientContext.js +22 -0
  309. package/build/esm/net/createInternalClientContext.js.map +1 -0
  310. package/build/esm/net/createInternalClientContext.mjs +21 -0
  311. package/build/esm/net/index.js +18 -0
  312. package/build/esm/net/index.js.map +1 -0
  313. package/build/esm/net/index.mjs +17 -0
  314. package/build/esm/net/internalClientContext.js +17 -0
  315. package/build/esm/net/internalClientContext.js.map +1 -0
  316. package/build/esm/net/internalClientContext.mjs +16 -0
  317. package/build/esm/net/third-party-applications/DeployWebsiteRequest.js +17 -0
  318. package/build/esm/net/third-party-applications/DeployWebsiteRequest.js.map +1 -0
  319. package/build/esm/net/third-party-applications/DeployWebsiteRequest.mjs +16 -0
  320. package/build/esm/net/third-party-applications/ListVersionsResponse.js +17 -0
  321. package/build/esm/net/third-party-applications/ListVersionsResponse.js.map +1 -0
  322. package/build/esm/net/third-party-applications/ListVersionsResponse.mjs +16 -0
  323. package/build/esm/net/third-party-applications/Version.js +17 -0
  324. package/build/esm/net/third-party-applications/Version.js.map +1 -0
  325. package/build/esm/net/third-party-applications/Version.mjs +16 -0
  326. package/build/esm/net/third-party-applications/Website.js +17 -0
  327. package/build/esm/net/third-party-applications/Website.js.map +1 -0
  328. package/build/esm/net/third-party-applications/Website.mjs +16 -0
  329. package/build/esm/net/third-party-applications/deleteVersion.js +24 -0
  330. package/build/esm/net/third-party-applications/deleteVersion.js.map +1 -0
  331. package/build/esm/net/third-party-applications/deleteVersion.mjs +23 -0
  332. package/build/esm/net/third-party-applications/deployWebsite.js +29 -0
  333. package/build/esm/net/third-party-applications/deployWebsite.js.map +1 -0
  334. package/build/esm/net/third-party-applications/deployWebsite.mjs +28 -0
  335. package/build/esm/net/third-party-applications/getWebsite.js +33 -0
  336. package/build/esm/net/third-party-applications/getWebsite.js.map +1 -0
  337. package/build/esm/net/third-party-applications/getWebsite.mjs +35 -0
  338. package/build/esm/net/third-party-applications/index.js +22 -0
  339. package/build/esm/net/third-party-applications/index.js.map +1 -0
  340. package/build/esm/net/third-party-applications/index.mjs +21 -0
  341. package/build/esm/net/third-party-applications/listVersions.js +23 -0
  342. package/build/esm/net/third-party-applications/listVersions.js.map +1 -0
  343. package/build/esm/net/third-party-applications/listVersions.mjs +22 -0
  344. package/build/esm/net/third-party-applications/undeployWebsite.js +24 -0
  345. package/build/esm/net/third-party-applications/undeployWebsite.js.map +1 -0
  346. package/build/esm/net/third-party-applications/undeployWebsite.mjs +23 -0
  347. package/build/esm/net/third-party-applications/uploadVersion.js +30 -0
  348. package/build/esm/net/third-party-applications/uploadVersion.js.map +1 -0
  349. package/build/esm/net/third-party-applications/uploadVersion.mjs +29 -0
  350. package/build/esm/util/autoVersion.js +62 -0
  351. package/build/esm/util/autoVersion.js.map +1 -0
  352. package/build/esm/util/autoVersion.test.js +71 -0
  353. package/build/esm/util/autoVersion.test.js.map +1 -0
  354. package/build/esm/util/config.js +102 -0
  355. package/build/esm/util/config.js.map +1 -0
  356. package/build/esm/util/config.test.js +110 -0
  357. package/build/esm/util/config.test.js.map +1 -0
  358. package/build/esm/util/configLoader.js +25 -0
  359. package/build/esm/util/configLoader.js.map +1 -0
  360. package/build/esm/util/isValidSemver.test.js +41 -0
  361. package/build/esm/util/isValidSemver.test.js.map +1 -0
  362. package/build/esm/util/token.js +84 -0
  363. package/build/esm/util/token.js.map +1 -0
  364. package/build/esm/util/token.test.js +62 -0
  365. package/build/esm/util/token.test.js.map +1 -0
  366. package/build/esm/yargs/logConfigFileMiddleware.js +29 -0
  367. package/build/esm/yargs/logConfigFileMiddleware.js.map +1 -0
  368. package/package.json +8 -10
  369. package/build/browser/chunk-5AQYUXAY.js +0 -17
  370. package/build/browser/chunk-5AQYUXAY.js.map +0 -1
  371. package/build/browser/chunk-DAYFZSC6.js +0 -42
  372. package/build/browser/chunk-DAYFZSC6.js.map +0 -1
  373. package/build/browser/chunk-FHGPBDJE.js +0 -221
  374. package/build/browser/chunk-FHGPBDJE.js.map +0 -1
  375. package/build/browser/chunk-SBJIY4HI.js +0 -67
  376. package/build/browser/chunk-SBJIY4HI.js.map +0 -1
  377. package/build/browser/chunk-XJLUGCCS.js +0 -120
  378. package/build/browser/chunk-XJLUGCCS.js.map +0 -1
  379. package/build/browser/handleGenerate-5ANBXHY3-NRCPE7IO.js +0 -633
  380. package/build/browser/handleGenerate-5ANBXHY3-NRCPE7IO.js.map +0 -1
  381. package/build/browser/loginFlow-X2LB2TEP.js +0 -4
  382. package/build/browser/loginFlow-X2LB2TEP.js.map +0 -1
  383. package/build/browser/siteDeployCommand-OYNFXM4G.js +0 -140
  384. package/build/browser/siteDeployCommand-OYNFXM4G.js.map +0 -1
  385. package/build/browser/versionDeleteCommand-I6JJR3KD.js +0 -35
  386. package/build/browser/versionDeleteCommand-I6JJR3KD.js.map +0 -1
  387. package/build/browser/versionGetCommand-LVG3FBW5.js +0 -29
  388. package/build/browser/versionGetCommand-LVG3FBW5.js.map +0 -1
  389. package/build/browser/versionListCommand-VZQDE6LT.js +0 -34
  390. package/build/browser/versionListCommand-VZQDE6LT.js.map +0 -1
  391. package/build/browser/versionSetCommand-RSTHOATA.js +0 -29
  392. package/build/browser/versionSetCommand-RSTHOATA.js.map +0 -1
  393. package/build/browser/versionUnsetCommand-TCIPMVDP.js +0 -34
  394. package/build/browser/versionUnsetCommand-TCIPMVDP.js.map +0 -1
  395. package/build/esm/chunk-5AQYUXAY.js +0 -17
  396. package/build/esm/chunk-5AQYUXAY.js.map +0 -1
  397. package/build/esm/chunk-DAYFZSC6.js +0 -42
  398. package/build/esm/chunk-DAYFZSC6.js.map +0 -1
  399. package/build/esm/chunk-FHGPBDJE.js +0 -221
  400. package/build/esm/chunk-FHGPBDJE.js.map +0 -1
  401. package/build/esm/chunk-SBJIY4HI.js +0 -67
  402. package/build/esm/chunk-SBJIY4HI.js.map +0 -1
  403. package/build/esm/chunk-XJLUGCCS.js +0 -120
  404. package/build/esm/chunk-XJLUGCCS.js.map +0 -1
  405. package/build/esm/handleGenerate-5ANBXHY3-NRCPE7IO.js +0 -633
  406. package/build/esm/handleGenerate-5ANBXHY3-NRCPE7IO.js.map +0 -1
  407. package/build/esm/loginFlow-X2LB2TEP.js +0 -4
  408. package/build/esm/loginFlow-X2LB2TEP.js.map +0 -1
  409. package/build/esm/siteDeployCommand-OYNFXM4G.js +0 -140
  410. package/build/esm/siteDeployCommand-OYNFXM4G.js.map +0 -1
  411. package/build/esm/versionDeleteCommand-I6JJR3KD.js +0 -35
  412. package/build/esm/versionDeleteCommand-I6JJR3KD.js.map +0 -1
  413. package/build/esm/versionGetCommand-LVG3FBW5.js +0 -29
  414. package/build/esm/versionGetCommand-LVG3FBW5.js.map +0 -1
  415. package/build/esm/versionListCommand-VZQDE6LT.js +0 -34
  416. package/build/esm/versionListCommand-VZQDE6LT.js.map +0 -1
  417. package/build/esm/versionSetCommand-RSTHOATA.js +0 -29
  418. package/build/esm/versionSetCommand-RSTHOATA.js.map +0 -1
  419. package/build/esm/versionUnsetCommand-TCIPMVDP.js +0 -34
  420. package/build/esm/versionUnsetCommand-TCIPMVDP.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the
3
+ * latest tag (without any filtering) and if the tag starts with "v", it will be removed.
4
+ * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.
5
+ * @returns A promise that resolves to the version string.
6
+ * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.
7
+ */
8
+ export declare function autoVersion(tagPrefix?: string): Promise<string>;
9
+ //# sourceMappingURL=autoVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoVersion.d.ts","sourceRoot":"","sources":["../../../src/util/autoVersion.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,SAAS,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAezE"}
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ExitProcessError, isValidSemver } from "@osdk/cli.common";
17
+ import { exec } from "node:child_process";
18
+ import { promisify } from "node:util";
19
+ /**
20
+ * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the
21
+ * latest tag (without any filtering) and if the tag starts with "v", it will be removed.
22
+ * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.
23
+ * @returns A promise that resolves to the version string.
24
+ * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.
25
+ */
26
+ export async function autoVersion(tagPrefix = "") {
27
+ const [matchPrefix, prefixRegex] = tagPrefix !== "" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];
28
+ const gitVersion = await gitDescribe(matchPrefix);
29
+ const version = gitVersion.trim().replace(prefixRegex, "");
30
+ if (!isValidSemver(version)) {
31
+ throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);
32
+ }
33
+ return version;
34
+ }
35
+ async function gitDescribe(matchPrefix) {
36
+ let gitVersion;
37
+ try {
38
+ const execAsync = promisify(exec);
39
+ const {
40
+ stdout
41
+ } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match="${matchPrefix}*"` : ""}`, {
42
+ encoding: "utf8"
43
+ });
44
+ gitVersion = stdout;
45
+ } catch (error) {
46
+ if (error instanceof Error) {
47
+ const errorMessage = error.message.toLowerCase();
48
+ if (errorMessage.includes("not recognized") || errorMessage.includes("command not found") || errorMessage.includes("no such file or directory")) {
49
+ throw new ExitProcessError(2, "Unable to determine auto version using git-describe as git is not installed or found in the PATH.", `You can set up git and try again or supply a --version option to set the version manually`);
50
+ }
51
+ if (errorMessage.includes("fatal: not a git repository")) {
52
+ throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);
53
+ }
54
+ if (errorMessage.includes("fatal: no names found, cannot describe anything.")) {
55
+ throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);
56
+ }
57
+ }
58
+ throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);
59
+ }
60
+ return gitVersion;
61
+ }
62
+ //# sourceMappingURL=autoVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoVersion.js","names":["ExitProcessError","isValidSemver","exec","promisify","autoVersion","tagPrefix","matchPrefix","prefixRegex","RegExp","undefined","gitVersion","gitDescribe","version","trim","replace","execAsync","stdout","encoding","error","Error","errorMessage","message","toLowerCase","includes"],"sources":["autoVersion.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\"\n ? [tagPrefix, new RegExp(`^${tagPrefix}`)]\n : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const { stdout } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, { encoding: \"utf8\" });\n gitVersion = stdout;\n }\n catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\")\n || errorMessage.includes(\"command not found\")\n || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,aAAa,QAAQ,kBAAkB;AAClE,SAASC,IAAI,QAAQ,oBAAoB;AACzC,SAASC,SAAS,QAAQ,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,WAAWA,CAACC,SAAS,GAAG,EAAE,EAAE;EAC9C,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAGF,SAAS,KAAK,EAAE,GAC7C,CAACA,SAAS,EAAE,IAAIG,MAAM,CAAC,IAAIH,SAAS,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AIoB,YAAY,CAACG,QAAQ,CAAC,kDAAkD,CAAC,EAAE;QAC3E,MAAM,IAAIvB,gBAAgB,CAAC,CAAC,EAAE,qFAAqF,EAAE,gIAAgI,CAAC;MAC1P;IACJ;IACA,MAAM,IAAIA,gBAAgB,CAAC,CAAC,EAAE,wDAAwDkB,KAAK,GAAG,EAAE,+DAA+D,CAAC;EACpK;EACA,OAAOR,UAAU;AACrB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=autoVersion.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoVersion.test.d.ts","sourceRoot":"","sources":["../../../src/util/autoVersion.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { exec } from "node:child_process";
17
+ import { promisify } from "node:util";
18
+ import { describe, expect, it, vi } from "vitest";
19
+ import { autoVersion } from "./autoVersion.js";
20
+ vi.mock("node:child_process");
21
+ const execAsync = promisify(exec);
22
+ describe("autoVersion", () => {
23
+ const execMock = vi.mocked(execAsync);
24
+ const execReturnValue = out => ({
25
+ stdout: out,
26
+ stderr: ""
27
+ });
28
+ it("should return a valid SemVer version from git describe", async () => {
29
+ execMock.mockResolvedValue(execReturnValue("1.2.3"));
30
+ const version = await autoVersion();
31
+ expect(version).toBe("1.2.3");
32
+ });
33
+ it("should replace default prefix v from git describe output", async () => {
34
+ execMock.mockResolvedValue(execReturnValue("v1.2.3"));
35
+ const version = await autoVersion();
36
+ expect(version).toBe("1.2.3");
37
+ });
38
+ it("should replace the prefix from the found git tag", async () => {
39
+ execMock.mockResolvedValue(execReturnValue("@package@1.2.3"));
40
+ const version = await autoVersion("@package@");
41
+ expect(version).toBe("1.2.3");
42
+ });
43
+ it("should only replace the prefix if found at the start of the tag only", async () => {
44
+ execMock.mockResolvedValue(execReturnValue("1.2.3-package"));
45
+ const version = await autoVersion("-package");
46
+ expect(version).toBe("1.2.3-package");
47
+ });
48
+ it("should throw an error if git describe returns a non-SemVer string", async () => {
49
+ execMock.mockResolvedValue(execReturnValue("not-semver"));
50
+ await expect(autoVersion()).rejects.toThrowError();
51
+ });
52
+ it("should throw an error if git isn't found", async () => {
53
+ execMock.mockImplementation(() => {
54
+ throw new Error("Command not found");
55
+ });
56
+ await expect(autoVersion()).rejects.toThrowError("git is not installed");
57
+ });
58
+ it("should throw an error if the current directory is not a git repository", async () => {
59
+ execMock.mockImplementation(() => {
60
+ throw new Error("fatal: not a git repository");
61
+ });
62
+ await expect(autoVersion()).rejects.toThrowError("the current directory is not a git repository");
63
+ });
64
+ it("should throw an error if no git tags are found", async () => {
65
+ execMock.mockImplementation(() => {
66
+ throw new Error("fatal: no names found, cannot describe anything.");
67
+ });
68
+ await expect(autoVersion()).rejects.toThrowError("no matching tags were found.");
69
+ });
70
+ });
71
+ //# sourceMappingURL=autoVersion.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoVersion.test.js","names":["exec","promisify","describe","expect","it","vi","autoVersion","mock","execAsync","execMock","mocked","execReturnValue","out","stdout","stderr","mockResolvedValue","version","toBe","rejects","toThrowError","mockImplementation","Error"],"sources":["autoVersion.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { describe, expect, it, vi } from \"vitest\";\nimport { autoVersion } from \"./autoVersion.js\";\nvi.mock(\"node:child_process\");\nconst execAsync = promisify(exec);\ndescribe(\"autoVersion\", () => {\n const execMock = vi.mocked(execAsync);\n const execReturnValue = (out) => ({ stdout: out, stderr: \"\" });\n it(\"should return a valid SemVer version from git describe\", async () => {\n const validGitVersion = \"1.2.3\";\n execMock.mockResolvedValue(execReturnValue(validGitVersion));\n const version = await autoVersion();\n expect(version).toBe(\"1.2.3\");\n });\n it(\"should replace default prefix v from git describe output\", async () => {\n const validGitVersion = \"v1.2.3\";\n execMock.mockResolvedValue(execReturnValue(validGitVersion));\n const version = await autoVersion();\n expect(version).toBe(\"1.2.3\");\n });\n it(\"should replace the prefix from the found git tag\", async () => {\n const validGitVersion = \"@package@1.2.3\";\n execMock.mockResolvedValue(execReturnValue(validGitVersion));\n const version = await autoVersion(\"@package@\");\n expect(version).toBe(\"1.2.3\");\n });\n it(\"should only replace the prefix if found at the start of the tag only\", async () => {\n const validGitVersion = \"1.2.3-package\";\n execMock.mockResolvedValue(execReturnValue(validGitVersion));\n const version = await autoVersion(\"-package\");\n expect(version).toBe(\"1.2.3-package\");\n });\n it(\"should throw an error if git describe returns a non-SemVer string\", async () => {\n const nonSemVerGitVersion = \"not-semver\";\n execMock.mockResolvedValue(execReturnValue(nonSemVerGitVersion));\n await expect(autoVersion()).rejects.toThrowError();\n });\n it(\"should throw an error if git isn't found\", async () => {\n execMock.mockImplementation(() => {\n throw new Error(\"Command not found\");\n });\n await expect(autoVersion()).rejects.toThrowError(\"git is not installed\");\n });\n it(\"should throw an error if the current directory is not a git repository\", async () => {\n execMock.mockImplementation(() => {\n throw new Error(\"fatal: not a git repository\");\n });\n await expect(autoVersion()).rejects.toThrowError(\"the current directory is not a git repository\");\n });\n it(\"should throw an error if no git tags are found\", async () => {\n execMock.mockImplementation(() => {\n throw new Error(\"fatal: no names found, cannot describe anything.\");\n });\n await expect(autoVersion()).rejects.toThrowError(\"no matching tags were found.\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,oBAAoB;AACzC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AACjD,SAASC,WAAW,QAAQ,kBAAkB;AAC9CD,EAAE,CAACE,IAAI,CAAC,oBAAoB,CAAC;AAC7B,MAAMC,SAAS,GAAGP,SAAS,CAACD,IAAI,CAAC;AACjCE,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC1B,MAAMO,QAAQ,GAAGJ,EAAE,CAACK,MAAM,CAACF,SAAS,CAAC;EACrC,MAAMG,eAAe,GAAIC,GAAG,KAAM;IAAEC,MAAM,EAAED,GAAG;IAAEE,MAAM,EAAE;EAAG,CAAC,CAAC;EAC9DV,EAAE,CAAC,wDAAwD,EAAE,YAAY;IAErEK,QAAQ,CAACM,iBAAiB,CAACJ,eAAe,CADlB,OACkC,CAAC,CAAC;IAC5D,MAAMK,OAAO,GAAG,MAAMV,WAAW,CAAC,CAAC;IACnCH,MAAM,CAACa,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACjC,CAAC,CAAC;EACFb,EAAE,CAAC,0DAA0D,EAAE,YAAY;IAEvEK,QAAQ,CAACM,iBAAiB,CAACJ,eAAe,CADlB,QACkC,CAAC,CAAC;IAC5D,MAAMK,OAAO,GAAG,MAAMV,WAAW,CAAC,CAAC;IACnCH,MAAM,CAACa,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACjC,CAAC,CAAC;EACFb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,EAAE,YAAY;IAC7DK,QAAQ,CAACW,kBAAkB,CAAC,MAAM;MAC9B,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;IACvE,CAAC,CAAC;IACF,MAAMlB,MAAM,CAACG,WAAW,CAAC,CAAC,CAAC,CAACY,OAAO,CAACC,YAAY,CAAC,8BAA8B,CAAC;EACpF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ export interface GitDescribeAutoVersionConfig {
2
+ type: "git-describe";
3
+ tagPrefix?: string;
4
+ }
5
+ export type AutoVersionConfig = GitDescribeAutoVersionConfig;
6
+ export type AutoVersionConfigType = AutoVersionConfig["type"];
7
+ export interface SiteConfig {
8
+ application: string;
9
+ directory: string;
10
+ autoVersion?: AutoVersionConfig;
11
+ }
12
+ export interface FoundryConfig {
13
+ foundryUrl: string;
14
+ site: SiteConfig;
15
+ }
16
+ export interface LoadedFoundryConfig {
17
+ foundryConfig: FoundryConfig;
18
+ configFilePath: string;
19
+ }
20
+ /**
21
+ * Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.
22
+ * @returns A promise that resolves to the configuration JSON object, or undefined if not found.
23
+ * @throws Will throw an error if the configuration file is found but cannot be read or parsed.
24
+ */
25
+ export declare function loadFoundryConfig(): Promise<LoadedFoundryConfig | undefined>;
26
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/util/config.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC9D,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;CACxB;AAoCD;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAChD,mBAAmB,GAAG,SAAS,CAChC,CAkCA"}
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ExitProcessError } from "@osdk/cli.common";
17
+ import { promises as fsPromises } from "node:fs";
18
+ import { extname } from "node:path";
19
+ const CONFIG_FILE_NAMES = ["foundry.config.json"];
20
+ const CONFIG_FILE_SCHEMA = {
21
+ type: "object",
22
+ properties: {
23
+ foundryUrl: {
24
+ type: "string"
25
+ },
26
+ site: {
27
+ type: "object",
28
+ properties: {
29
+ application: {
30
+ type: "string"
31
+ },
32
+ directory: {
33
+ type: "string"
34
+ },
35
+ autoVersion: {
36
+ type: "object",
37
+ nullable: true,
38
+ oneOf: [{
39
+ properties: {
40
+ type: {
41
+ const: "git-describe",
42
+ type: "string"
43
+ },
44
+ tagPrefix: {
45
+ type: "string",
46
+ nullable: true
47
+ }
48
+ }
49
+ }],
50
+ required: ["type"]
51
+ }
52
+ },
53
+ required: ["application", "directory"]
54
+ }
55
+ },
56
+ required: ["foundryUrl", "site"],
57
+ additionalProperties: false
58
+ };
59
+ /**
60
+ * Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.
61
+ * @returns A promise that resolves to the configuration JSON object, or undefined if not found.
62
+ * @throws Will throw an error if the configuration file is found but cannot be read or parsed.
63
+ */
64
+ export async function loadFoundryConfig() {
65
+ const ajvModule = await import("ajv");
66
+ const Ajv = ajvModule.default.default; // https://github.com/ajv-validator/ajv/issues/2132
67
+ const ajv = new Ajv({
68
+ allErrors: true
69
+ });
70
+ const validate = ajv.compile(CONFIG_FILE_SCHEMA);
71
+ const {
72
+ findUp
73
+ } = await import("find-up");
74
+ const configFilePath = await findUp(CONFIG_FILE_NAMES);
75
+ if (configFilePath) {
76
+ let foundryConfig;
77
+ try {
78
+ const fileContent = await fsPromises.readFile(configFilePath, "utf-8");
79
+ foundryConfig = parseConfigFile(fileContent, configFilePath);
80
+ } catch (error) {
81
+ throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}. Error: ${error}`);
82
+ }
83
+ if (!validate(foundryConfig)) {
84
+ throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);
85
+ }
86
+ return {
87
+ foundryConfig,
88
+ configFilePath
89
+ };
90
+ }
91
+ return undefined;
92
+ }
93
+ function parseConfigFile(fileContent, configFilePath) {
94
+ const extension = extname(configFilePath);
95
+ switch (extension) {
96
+ case ".json":
97
+ return JSON.parse(fileContent);
98
+ default:
99
+ throw new ExitProcessError(2, `Unsupported file extension: ${extension} for config file.`);
100
+ }
101
+ }
102
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","names":["ExitProcessError","promises","fsPromises","extname","CONFIG_FILE_NAMES","CONFIG_FILE_SCHEMA","type","properties","foundryUrl","site","application","directory","autoVersion","nullable","oneOf","const","tagPrefix","required","additionalProperties","loadFoundryConfig","ajvModule","Ajv","default","ajv","allErrors","validate","compile","findUp","configFilePath","foundryConfig","fileContent","readFile","parseConfigFile","error","errorsText","errors","undefined","extension","JSON","parse"],"sources":["config.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { promises as fsPromises } from \"node:fs\";\nimport { extname } from \"node:path\";\nconst CONFIG_FILE_NAMES = [\n \"foundry.config.json\",\n];\nconst CONFIG_FILE_SCHEMA = {\n type: \"object\",\n properties: {\n foundryUrl: { type: \"string\" },\n site: {\n type: \"object\",\n properties: {\n application: { type: \"string\" },\n directory: { type: \"string\" },\n autoVersion: {\n type: \"object\",\n nullable: true,\n oneOf: [\n {\n properties: {\n type: { const: \"git-describe\", type: \"string\" },\n tagPrefix: { type: \"string\", nullable: true },\n },\n },\n ],\n required: [\"type\"],\n },\n },\n required: [\"application\", \"directory\"],\n },\n },\n required: [\"foundryUrl\", \"site\"],\n additionalProperties: false,\n};\n/**\n * Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.\n * @returns A promise that resolves to the configuration JSON object, or undefined if not found.\n * @throws Will throw an error if the configuration file is found but cannot be read or parsed.\n */\nexport async function loadFoundryConfig() {\n const ajvModule = await import(\"ajv\");\n const Ajv = ajvModule.default.default; // https://github.com/ajv-validator/ajv/issues/2132\n const ajv = new Ajv({ allErrors: true });\n const validate = ajv.compile(CONFIG_FILE_SCHEMA);\n const { findUp } = await import(\"find-up\");\n const configFilePath = await findUp(CONFIG_FILE_NAMES);\n if (configFilePath) {\n let foundryConfig;\n try {\n const fileContent = await fsPromises.readFile(configFilePath, \"utf-8\");\n foundryConfig = parseConfigFile(fileContent, configFilePath);\n }\n catch (error) {\n throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}. Error: ${error}`);\n }\n if (!validate(foundryConfig)) {\n throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);\n }\n return { foundryConfig, configFilePath };\n }\n return undefined;\n}\nfunction parseConfigFile(fileContent, configFilePath) {\n const extension = extname(configFilePath);\n switch (extension) {\n case \".json\":\n return JSON.parse(fileContent);\n default:\n throw new ExitProcessError(2, `Unsupported file extension: ${extension} for config file.`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,SAASC,OAAO,QAAQ,WAAW;AACnC,MAAMC,iBAAiB,GAAG,CACtB,qBAAqB,CACxB;AACD,MAAMC,kBAAkB,GAAG;EACvBC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE;IACRC,UAAU,EAAE;MAAEF,IAAI,EAAE;IAAS,CAAC;IAC9BG,IAAI,EAAE;MACFH,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACRG,WAAW,EAAE;UAAEJ,IAAI,EAAE;QAAS,CAAC;QAC/BK,SAAS,EAAE;UAAEL,IAAI,EAAE;QAAS,CAAC;QAC7BM,WAAW,EAAE;UACTN,IAAI,EAAE,QAAQ;UACdO,QAAQ,EAAE,IAAI;UACdC,KAAK,EAAE,CACH;YACIP,UAAU,EAAE;cACRD,IAAI,EAAE;gBAAES,KAAK,EAAE,cAAc;gBAAET,IAAI,EAAE;cAAS,CAAC;cAC/CU,SAAS,EAAE;gBAAEV,IAAI,EAAE,QAAQ;gBAAEO,QAAQ,EAAE;cAAK;YAChD;UACJ,CAA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AOQ,SAAS;AACpB;AACA,SAASJ,eAAeA,CAACF,WAAW,EAAEF,cAAc,EAAE;EAClD,MAAMS,SAAS,GAAGlC,OAAO,CAACyB,cAAc,CAAC;EACzC,QAAQS,SAAS;IACb,KAAK,OAAO;MACR,OAAOC,IAAI,CAACC,KAAK,CAACT,WAAW,CAAC;IAClC;MACI,MAAM,IAAI9B,gBAAgB,CAAC,CAAC,EAAE,+BAA+BqC,SAAS,mBAAmB,CAAC;EAClG;AACJ","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../../../src/util/config.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { findUp } from "find-up";
17
+ import { promises as fsPromises } from "node:fs";
18
+ import { extname } from "node:path";
19
+ import { beforeEach, describe, expect, it, vi } from "vitest";
20
+ import { loadFoundryConfig } from "./config.js";
21
+ vi.mock("find-up");
22
+ vi.mock("node:fs");
23
+ vi.mock("node:path");
24
+ describe("loadFoundryConfig", () => {
25
+ beforeEach(() => {
26
+ vi.mocked(findUp).mockResolvedValue("/path/foundry.config.json");
27
+ vi.mocked(extname).mockReturnValue(".json");
28
+ });
29
+ it("should load and parse the configuration file correctly", async () => {
30
+ const correctConfig = {
31
+ foundryUrl: "http://localhost",
32
+ site: {
33
+ application: "test-app",
34
+ directory: "/test/directory",
35
+ autoVersion: {
36
+ type: "git-describe"
37
+ }
38
+ }
39
+ };
40
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(correctConfig));
41
+ await expect(loadFoundryConfig()).resolves.toEqual({
42
+ configFilePath: "/path/foundry.config.json",
43
+ foundryConfig: {
44
+ ...correctConfig
45
+ }
46
+ });
47
+ });
48
+ it("should throw an error if autoVersion type isn't allowed", async () => {
49
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
50
+ foundryUrl: "http://localhost",
51
+ site: {
52
+ application: "test-app",
53
+ directory: "/test/directory",
54
+ autoVersion: {
55
+ type: "invalid"
56
+ }
57
+ }
58
+ }));
59
+ await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
60
+ });
61
+ it("should throw an error if autoVersion type is missing", async () => {
62
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
63
+ foundryUrl: "http://localhost",
64
+ site: {
65
+ application: "test-app",
66
+ directory: "/test/directory",
67
+ autoVersion: {}
68
+ }
69
+ }));
70
+ await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
71
+ });
72
+ it("should throw an error if the configuration file cannot be read", async () => {
73
+ vi.mocked(fsPromises.readFile).mockRejectedValue(new Error("Read error"));
74
+ await expect(loadFoundryConfig()).rejects.toThrow("Couldn't read or parse config");
75
+ });
76
+ it("should throw an error if the site key isn't found", async () => {
77
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
78
+ foundryUrl: "http://localhost"
79
+ }));
80
+ await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
81
+ });
82
+ it("should throw an error if the site configuration is missing required keys", async () => {
83
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
84
+ foundryUrl: "http://localhost",
85
+ site: {
86
+ directory: "/test/directory"
87
+ }
88
+ }));
89
+ await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
90
+ });
91
+ it("should throw an error if foundryUrl isn't set on top level", async () => {
92
+ vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
93
+ site: {
94
+ foundryUrl: "http://localhost",
95
+ directory: "/test/directory",
96
+ application: "test-app"
97
+ }
98
+ }));
99
+ await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
100
+ });
101
+ it("should return undefined if the configuration file is not found", async () => {
102
+ vi.mocked(findUp).mockResolvedValue(undefined);
103
+ await expect(loadFoundryConfig()).resolves.toBeUndefined();
104
+ });
105
+ it("should throw if config file extension isn't supported", async () => {
106
+ vi.mocked(extname).mockResolvedValue(".yaml");
107
+ await expect(loadFoundryConfig()).rejects.toThrow("Unsupported file extension:");
108
+ });
109
+ });
110
+ //# sourceMappingURL=config.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.test.js","names":["findUp","promises","fsPromises","extname","beforeEach","describe","expect","it","vi","loadFoundryConfig","mock","mocked","mockResolvedValue","mockReturnValue","correctConfig","foundryUrl","site","application","directory","autoVersion","type","readFile","JSON","stringify","resolves","toEqual","configFilePath","foundryConfig","rejects","toThrow","mockRejectedValue","Error","undefined","toBeUndefined"],"sources":["config.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { findUp } from \"find-up\";\nimport { promises as fsPromises } from \"node:fs\";\nimport { extname } from \"node:path\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { loadFoundryConfig } from \"./config.js\";\nvi.mock(\"find-up\");\nvi.mock(\"node:fs\");\nvi.mock(\"node:path\");\ndescribe(\"loadFoundryConfig\", () => {\n beforeEach(() => {\n vi.mocked(findUp).mockResolvedValue(\"/path/foundry.config.json\");\n vi.mocked(extname).mockReturnValue(\".json\");\n });\n it(\"should load and parse the configuration file correctly\", async () => {\n const correctConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {\n type: \"git-describe\",\n },\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(correctConfig));\n await expect(loadFoundryConfig()).resolves.toEqual({\n configFilePath: \"/path/foundry.config.json\",\n foundryConfig: {\n ...correctConfig,\n },\n });\n });\n it(\"should throw an error if autoVersion type isn't allowed\", async () => {\n const inCorrectConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {\n type: \"invalid\",\n },\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(inCorrectConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if autoVersion type is missing\", async () => {\n const inCorrectConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {},\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(inCorrectConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if the configuration file cannot be read\", async () => {\n vi.mocked(fsPromises.readFile).mockRejectedValue(new Error(\"Read error\"));\n await expect(loadFoundryConfig()).rejects.toThrow(\"Couldn't read or parse config\");\n });\n it(\"should throw an error if the site key isn't found\", async () => {\n const fakeConfig = {\n foundryUrl: \"http://localhost\",\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if the site configuration is missing required keys\", async () => {\n const fakeConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n directory: \"/test/directory\",\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if foundryUrl isn't set on top level\", async () => {\n const fakeConfig = {\n site: {\n foundryUrl: \"http://localhost\",\n directory: \"/test/directory\",\n application: \"test-app\",\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should return undefined if the configuration file is not found\", async () => {\n vi.mocked(findUp).mockResolvedValue(undefined);\n await expect(loadFoundryConfig()).resolves.toBeUndefined();\n });\n it(\"should throw if config file extension isn't supported\", async () => {\n vi.mocked(extname).mockResolvedValue(\".yaml\");\n await expect(loadFoundryConfig()).rejects.toThrow(\"Unsupported file extension:\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,iBAAiB,QAAQ,aAAa;AAC/CD,EAAE,CAACE,IAAI,CAAC,SAAS,CAAC;AAClBF,EAAE,CAACE,IAAI,CAAC,SAAS,CAAC;AAClBF,EAAE,CAACE,IAAI,CAAC,WAAW,CAAC;AACpBL,QAAQ,CAAC,mBAAmB,EAAE,MAAM;EAChCD,UAAU,CAAC,MAAM;IACbI,EAAE,CAACG,MAAM,CAACX,MAAM,CAAC,CAACY,iBAAiB,CAAC,2BAA2B,CAAC;IAChEJ,EAAE,CAACG,MAAM,CAACR,OAAO,CAAC,CAACU,eAAe,CAAC,O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ACU,IAAI,CAACC,SAAS,CAP5C;MACfP,IAAI,EAAE;QACFD,UAAU,EAAE,kBAAkB;QAC9BG,SAAS,EAAE,iBAAiB;QAC5BD,WAAW,EAAE;MACjB;IACJ,CAC0E,CAAC,CAAC;IAC5E,MAAMX,MAAM,CAACG,iBAAiB,CAAC,CAAC,CAAC,CAACmB,OAAO,CAACC,OAAO,CAAC,uCAAuC,CAAC;EAC9F,CAAC,CAAC;EACFtB,EAAE,CAAC,gEAAgE,EAAE,YAAY;IAC7EC,EAAE,CAACG,MAAM,CAACX,MAAM,CAAC,CAACY,iBAAiB,CAACoB,SAAS,CAAC;IAC9C,MAAM1B,MAAM,CAACG,iBAAiB,CAAC,CAAC,CAAC,CAACe,QAAQ,CAACS,aAAa,CAAC,CAAC;EAC9D,CAAC,CAAC;EACF1B,EAAE,CAAC,uDAAuD,EAAE,YAAY;IACpEC,EAAE,CAACG,MAAM,CAACR,OAAO,CAAC,CAACS,iBAAiB,CAAC,OAAO,CAAC;IAC7C,MAAMN,MAAM,CAACG,iBAAiB,CAAC,CAAC,CAAC,CAACmB,OAAO,CAACC,OAAO,CAAC,6BAA6B,CAAC;EACpF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { LoadedFoundryConfig } from "./config.js";
2
+ declare function getConfig(): Promise<LoadedFoundryConfig | undefined>;
3
+ export default getConfig;
4
+ //# sourceMappingURL=configLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../../src/util/configLoader.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMvD,iBAAS,SAAS,IAAI,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAK7D;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { loadFoundryConfig } from "./config.js";
17
+ let configPromise = undefined;
18
+ function getConfig() {
19
+ if (configPromise == null) {
20
+ configPromise = loadFoundryConfig();
21
+ }
22
+ return configPromise;
23
+ }
24
+ export default getConfig;
25
+ //# sourceMappingURL=configLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configLoader.js","names":["loadFoundryConfig","configPromise","undefined","getConfig"],"sources":["configLoader.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { loadFoundryConfig } from \"./config.js\";\nlet configPromise = undefined;\nfunction getConfig() {\n if (configPromise == null) {\n configPromise = loadFoundryConfig();\n }\n return configPromise;\n}\nexport default getConfig;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,aAAa;AAC/C,IAAIC,aAAa,GAAGC,SAAS;AAC7B,SAASC,SAASA,CAAA,EAAG;EACjB,IAAIF,aAAa,IAAI,IAAI,EAAE;IACvBA,aAAa,GAAGD,iBAAiB,CAAC,CAAC;EACvC;EACA,OAAOC,aAAa;AACxB;AACA,eAAeE,SAAS","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isValidSemver.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValidSemver.test.d.ts","sourceRoot":"","sources":["../../../src/util/isValidSemver.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { isValidSemver } from "@osdk/cli.common";
17
+ import { describe, expect, it } from "vitest";
18
+ describe("isValidSemver", () => {
19
+ it("should return true for a valid SemVer version", () => {
20
+ expect(isValidSemver("1.0.0")).toBe(true);
21
+ });
22
+ it("should return true for a valid SemVer version with prerelease", () => {
23
+ expect(isValidSemver("1.0.0-alpha.1")).toBe(true);
24
+ });
25
+ it("should return true for a valid SemVer version with build metadata", () => {
26
+ expect(isValidSemver("1.0.0+20130313144700")).toBe(true);
27
+ });
28
+ it("should return false for a version missing patch number", () => {
29
+ expect(isValidSemver("1.0")).toBe(false);
30
+ });
31
+ it("should return false for a version with non-numeric components", () => {
32
+ expect(isValidSemver("1.a.b")).toBe(false);
33
+ });
34
+ it("should return false for a version with a single number", () => {
35
+ expect(isValidSemver("1")).toBe(false);
36
+ });
37
+ it("should return false for a completely non-compliant string", () => {
38
+ expect(isValidSemver("not-a-version")).toBe(false);
39
+ });
40
+ });
41
+ //# sourceMappingURL=isValidSemver.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValidSemver.test.js","names":["isValidSemver","describe","expect","it","toBe"],"sources":["isValidSemver.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { isValidSemver } from \"@osdk/cli.common\";\nimport { describe, expect, it } from \"vitest\";\ndescribe(\"isValidSemver\", () => {\n it(\"should return true for a valid SemVer version\", () => {\n const validVersion = \"1.0.0\";\n expect(isValidSemver(validVersion)).toBe(true);\n });\n it(\"should return true for a valid SemVer version with prerelease\", () => {\n const validVersionWithPrerelease = \"1.0.0-alpha.1\";\n expect(isValidSemver(validVersionWithPrerelease)).toBe(true);\n });\n it(\"should return true for a valid SemVer version with build metadata\", () => {\n const validVersionWithBuild = \"1.0.0+20130313144700\";\n expect(isValidSemver(validVersionWithBuild)).toBe(true);\n });\n it(\"should return false for a version missing patch number\", () => {\n const invalidVersionMissingPatch = \"1.0\";\n expect(isValidSemver(invalidVersionMissingPatch)).toBe(false);\n });\n it(\"should return false for a version with non-numeric components\", () => {\n const invalidVersionNonNumeric = \"1.a.b\";\n expect(isValidSemver(invalidVersionNonNumeric)).toBe(false);\n });\n it(\"should return false for a version with a single number\", () => {\n const invalidVersionNonNumeric = \"1\";\n expect(isValidSemver(invalidVersionNonNumeric)).toBe(false);\n });\n it(\"should return false for a completely non-compliant string\", () => {\n const nonCompliantString = \"not-a-version\";\n expect(isValidSemver(nonCompliantString)).toBe(false);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,kBAAkB;AAChD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7CF,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5BE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IAEtDD,MAAM,CAACF,aAAa,CADC,OACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAClD,CAAC,CAAC;EACFD,EAAE,CAAC,+DAA+D,EAAE,MAAM;IAEtED,MAAM,CAACF,aAAa,CADe,eACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAChE,CAAC,CAAC;EACFD,EAAE,CAAC,mEAAmE,EAAE,MAAM;IAE1ED,MAAM,CAACF,aAAa,CADU,sBACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAC3D,CAAC,CAAC;EACFD,EAAE,CAAC,wDAAwD,EAAE,MAAM;IAE/DD,MAAM,CAACF,aAAa,CADe,KACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EACjE,CAAC,CAAC;EACFD,EAAE,CAAC,+DAA+D,EAAE,MAAM;IAEtED,MAAM,CAACF,aAAa,CADa,OACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EAC/D,CAAC,CAAC;EACFD,EAAE,CAAC,wDAAwD,EAAE,MAAM;IAE/DD,MAAM,CAACF,aAAa,CADa,GACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EAC/D,CAAC,CAAC;EACFD,EAAE,CAAC,2DAA2D,EAAE,MAAM;IAElED,MAAM,CAACF,aAAa,CADO,eACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EACzD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.
3
+ * @param token The token as a string.
4
+ * @param tokenFile The path to the token file.
5
+ * @returns The token as a string.
6
+ * @throws An error if no token is found.
7
+ */
8
+ export declare function loadToken(token?: string, tokenFile?: string): Promise<string>;
9
+ interface LoadedToken {
10
+ filePath: string;
11
+ token: string;
12
+ }
13
+ /**
14
+ * Reads a JWT Auth Token from a file.
15
+ * @param filePath The path to the token file.
16
+ * @returns The token as a string.
17
+ * @throws An error if the file cannot be read.
18
+ */
19
+ export declare function loadTokenFile(filePath: string): Promise<LoadedToken>;
20
+ export declare function validate(token: string): void;
21
+ export {};
22
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/util/token.ts"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAqCjB;AAED,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AACD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAe1E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI5C"}