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

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 +11 -0
  2. package/build/browser/chunk-5AQYUXAY.js +17 -0
  3. package/build/browser/chunk-5AQYUXAY.js.map +1 -0
  4. package/build/browser/chunk-DAYFZSC6.js +42 -0
  5. package/build/browser/chunk-DAYFZSC6.js.map +1 -0
  6. package/build/browser/chunk-IK6CLC6I.js +221 -0
  7. package/build/browser/chunk-IK6CLC6I.js.map +1 -0
  8. package/build/browser/chunk-Q2H7XAS4.js +88 -0
  9. package/build/browser/chunk-Q2H7XAS4.js.map +1 -0
  10. package/build/browser/chunk-VDO5KGGR.js +127 -0
  11. package/build/browser/chunk-VDO5KGGR.js.map +1 -0
  12. package/build/browser/handleGenerate-37Z73JKR.js +409 -0
  13. package/build/browser/handleGenerate-37Z73JKR.js.map +1 -0
  14. package/build/browser/index.js +597 -16
  15. package/build/browser/index.js.map +1 -1
  16. package/build/browser/loginFlow-622FU6FR.js +4 -0
  17. package/build/browser/loginFlow-622FU6FR.js.map +1 -0
  18. package/build/browser/siteDeployCommand-KV7OEWSZ.js +140 -0
  19. package/build/browser/siteDeployCommand-KV7OEWSZ.js.map +1 -0
  20. package/build/browser/versionDeleteCommand-JALRWV7N.js +35 -0
  21. package/build/browser/versionDeleteCommand-JALRWV7N.js.map +1 -0
  22. package/build/browser/versionGetCommand-ZWABO75R.js +29 -0
  23. package/build/browser/versionGetCommand-ZWABO75R.js.map +1 -0
  24. package/build/browser/versionListCommand-S7ZNXKLB.js +34 -0
  25. package/build/browser/versionListCommand-S7ZNXKLB.js.map +1 -0
  26. package/build/browser/versionSetCommand-D25C3HBN.js +29 -0
  27. package/build/browser/versionSetCommand-D25C3HBN.js.map +1 -0
  28. package/build/browser/versionUnsetCommand-YL7WZDYA.js +34 -0
  29. package/build/browser/versionUnsetCommand-YL7WZDYA.js.map +1 -0
  30. package/build/esm/chunk-5AQYUXAY.js +17 -0
  31. package/build/esm/chunk-5AQYUXAY.js.map +1 -0
  32. package/build/esm/chunk-DAYFZSC6.js +42 -0
  33. package/build/esm/chunk-DAYFZSC6.js.map +1 -0
  34. package/build/esm/chunk-IK6CLC6I.js +221 -0
  35. package/build/esm/chunk-IK6CLC6I.js.map +1 -0
  36. package/build/esm/chunk-Q2H7XAS4.js +88 -0
  37. package/build/esm/chunk-Q2H7XAS4.js.map +1 -0
  38. package/build/esm/chunk-VDO5KGGR.js +127 -0
  39. package/build/esm/chunk-VDO5KGGR.js.map +1 -0
  40. package/build/esm/handleGenerate-37Z73JKR.js +409 -0
  41. package/build/esm/handleGenerate-37Z73JKR.js.map +1 -0
  42. package/build/esm/index.js +597 -16
  43. package/build/esm/index.js.map +1 -1
  44. package/build/esm/loginFlow-622FU6FR.js +4 -0
  45. package/build/esm/loginFlow-622FU6FR.js.map +1 -0
  46. package/build/esm/siteDeployCommand-KV7OEWSZ.js +140 -0
  47. package/build/esm/siteDeployCommand-KV7OEWSZ.js.map +1 -0
  48. package/build/esm/versionDeleteCommand-JALRWV7N.js +35 -0
  49. package/build/esm/versionDeleteCommand-JALRWV7N.js.map +1 -0
  50. package/build/esm/versionGetCommand-ZWABO75R.js +29 -0
  51. package/build/esm/versionGetCommand-ZWABO75R.js.map +1 -0
  52. package/build/esm/versionListCommand-S7ZNXKLB.js +34 -0
  53. package/build/esm/versionListCommand-S7ZNXKLB.js.map +1 -0
  54. package/build/esm/versionSetCommand-D25C3HBN.js +29 -0
  55. package/build/esm/versionSetCommand-D25C3HBN.js.map +1 -0
  56. package/build/esm/versionUnsetCommand-YL7WZDYA.js +34 -0
  57. package/build/esm/versionUnsetCommand-YL7WZDYA.js.map +1 -0
  58. package/package.json +6 -6
  59. package/build/browser/cli.d.ts +0 -7
  60. package/build/browser/cli.d.ts.map +0 -1
  61. package/build/browser/cli.js +0 -42
  62. package/build/browser/cli.js.map +0 -1
  63. package/build/browser/commands/auth/index.d.ts +0 -5
  64. package/build/browser/commands/auth/index.d.ts.map +0 -1
  65. package/build/browser/commands/auth/index.js +0 -34
  66. package/build/browser/commands/auth/index.js.map +0 -1
  67. package/build/browser/commands/auth/login/index.d.ts +0 -5
  68. package/build/browser/commands/auth/login/index.d.ts.map +0 -1
  69. package/build/browser/commands/auth/login/index.js +0 -34
  70. package/build/browser/commands/auth/login/index.js.map +0 -1
  71. package/build/browser/commands/site/CommonSiteArgs.d.ts +0 -9
  72. package/build/browser/commands/site/CommonSiteArgs.d.ts.map +0 -1
  73. package/build/browser/commands/site/CommonSiteArgs.js +0 -17
  74. package/build/browser/commands/site/CommonSiteArgs.js.map +0 -1
  75. package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts +0 -10
  76. package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts.map +0 -1
  77. package/build/browser/commands/site/deploy/SiteDeployArgs.js +0 -17
  78. package/build/browser/commands/site/deploy/SiteDeployArgs.js.map +0 -1
  79. package/build/browser/commands/site/deploy/index.d.ts +0 -6
  80. package/build/browser/commands/site/deploy/index.d.ts.map +0 -1
  81. package/build/browser/commands/site/deploy/index.js +0 -108
  82. package/build/browser/commands/site/deploy/index.js.map +0 -1
  83. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts +0 -5
  84. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts.map +0 -1
  85. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js +0 -28
  86. package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +0 -1
  87. package/build/browser/commands/site/deploy/siteDeployCommand.d.mts +0 -10
  88. package/build/browser/commands/site/deploy/siteDeployCommand.d.mts.map +0 -1
  89. package/build/browser/commands/site/deploy/siteDeployCommand.js +0 -98
  90. package/build/browser/commands/site/deploy/siteDeployCommand.js.map +0 -1
  91. package/build/browser/commands/site/deploy/siteDeployCommand.mjs +0 -90
  92. package/build/browser/commands/site/index.d.ts +0 -6
  93. package/build/browser/commands/site/index.d.ts.map +0 -1
  94. package/build/browser/commands/site/index.js +0 -69
  95. package/build/browser/commands/site/index.js.map +0 -1
  96. package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts +0 -5
  97. package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts.map +0 -1
  98. package/build/browser/commands/site/logSiteCommandConfigFileOverride.js +0 -25
  99. package/build/browser/commands/site/logSiteCommandConfigFileOverride.js.map +0 -1
  100. package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts +0 -6
  101. package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts.map +0 -1
  102. package/build/browser/commands/site/version/delete/VersionDeleteArgs.js +0 -17
  103. package/build/browser/commands/site/version/delete/VersionDeleteArgs.js.map +0 -1
  104. package/build/browser/commands/site/version/delete/index.d.ts +0 -6
  105. package/build/browser/commands/site/version/delete/index.d.ts.map +0 -1
  106. package/build/browser/commands/site/version/delete/index.js +0 -36
  107. package/build/browser/commands/site/version/delete/index.js.map +0 -1
  108. package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts +0 -3
  109. package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts.map +0 -1
  110. package/build/browser/commands/site/version/delete/versionDeleteCommand.js +0 -41
  111. package/build/browser/commands/site/version/delete/versionDeleteCommand.js.map +0 -1
  112. package/build/browser/commands/site/version/delete/versionDeleteCommand.mjs +0 -32
  113. package/build/browser/commands/site/version/get/VersionGetArgs.d.ts +0 -4
  114. package/build/browser/commands/site/version/get/VersionGetArgs.d.ts.map +0 -1
  115. package/build/browser/commands/site/version/get/VersionGetArgs.js +0 -17
  116. package/build/browser/commands/site/version/get/VersionGetArgs.js.map +0 -1
  117. package/build/browser/commands/site/version/get/index.d.ts +0 -6
  118. package/build/browser/commands/site/version/get/index.d.ts.map +0 -1
  119. package/build/browser/commands/site/version/get/index.js +0 -28
  120. package/build/browser/commands/site/version/get/index.js.map +0 -1
  121. package/build/browser/commands/site/version/get/versionGetCommand.d.mts +0 -3
  122. package/build/browser/commands/site/version/get/versionGetCommand.d.mts.map +0 -1
  123. package/build/browser/commands/site/version/get/versionGetCommand.js +0 -36
  124. package/build/browser/commands/site/version/get/versionGetCommand.js.map +0 -1
  125. package/build/browser/commands/site/version/get/versionGetCommand.mjs +0 -32
  126. package/build/browser/commands/site/version/index.d.ts +0 -5
  127. package/build/browser/commands/site/version/index.d.ts.map +0 -1
  128. package/build/browser/commands/site/version/index.js +0 -30
  129. package/build/browser/commands/site/version/index.js.map +0 -1
  130. package/build/browser/commands/site/version/list/VersionListArgs.d.ts +0 -4
  131. package/build/browser/commands/site/version/list/VersionListArgs.d.ts.map +0 -1
  132. package/build/browser/commands/site/version/list/VersionListArgs.js +0 -17
  133. package/build/browser/commands/site/version/list/VersionListArgs.js.map +0 -1
  134. package/build/browser/commands/site/version/list/index.d.ts +0 -6
  135. package/build/browser/commands/site/version/list/index.d.ts.map +0 -1
  136. package/build/browser/commands/site/version/list/index.js +0 -28
  137. package/build/browser/commands/site/version/list/index.js.map +0 -1
  138. package/build/browser/commands/site/version/list/versionListCommand.d.mts +0 -3
  139. package/build/browser/commands/site/version/list/versionListCommand.d.mts.map +0 -1
  140. package/build/browser/commands/site/version/list/versionListCommand.js +0 -41
  141. package/build/browser/commands/site/version/list/versionListCommand.js.map +0 -1
  142. package/build/browser/commands/site/version/list/versionListCommand.mjs +0 -42
  143. package/build/browser/commands/site/version/set/VersionSetArgs.d.ts +0 -5
  144. package/build/browser/commands/site/version/set/VersionSetArgs.d.ts.map +0 -1
  145. package/build/browser/commands/site/version/set/VersionSetArgs.js +0 -17
  146. package/build/browser/commands/site/version/set/VersionSetArgs.js.map +0 -1
  147. package/build/browser/commands/site/version/set/index.d.ts +0 -6
  148. package/build/browser/commands/site/version/set/index.d.ts.map +0 -1
  149. package/build/browser/commands/site/version/set/index.js +0 -32
  150. package/build/browser/commands/site/version/set/index.js.map +0 -1
  151. package/build/browser/commands/site/version/set/versionSetCommand.d.mts +0 -3
  152. package/build/browser/commands/site/version/set/versionSetCommand.d.mts.map +0 -1
  153. package/build/browser/commands/site/version/set/versionSetCommand.js +0 -36
  154. package/build/browser/commands/site/version/set/versionSetCommand.js.map +0 -1
  155. package/build/browser/commands/site/version/set/versionSetCommand.mjs +0 -28
  156. package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts +0 -5
  157. package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts.map +0 -1
  158. package/build/browser/commands/site/version/unset/VersionUnsetArgs.js +0 -17
  159. package/build/browser/commands/site/version/unset/VersionUnsetArgs.js.map +0 -1
  160. package/build/browser/commands/site/version/unset/index.d.ts +0 -6
  161. package/build/browser/commands/site/version/unset/index.d.ts.map +0 -1
  162. package/build/browser/commands/site/version/unset/index.js +0 -32
  163. package/build/browser/commands/site/version/unset/index.js.map +0 -1
  164. package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts +0 -3
  165. package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts.map +0 -1
  166. package/build/browser/commands/site/version/unset/versionUnsetCommand.js +0 -40
  167. package/build/browser/commands/site/version/unset/versionUnsetCommand.js.map +0 -1
  168. package/build/browser/commands/site/version/unset/versionUnsetCommand.mjs +0 -32
  169. package/build/browser/consola/handlePromptCancel.d.ts +0 -2
  170. package/build/browser/consola/handlePromptCancel.d.ts.map +0 -1
  171. package/build/browser/consola/handlePromptCancel.js +0 -25
  172. package/build/browser/consola/handlePromptCancel.js.map +0 -1
  173. package/build/browser/index.d.ts +0 -2
  174. package/build/browser/index.d.ts.map +0 -1
  175. package/build/browser/net/ThirdPartyAppRid.d.ts +0 -2
  176. package/build/browser/net/ThirdPartyAppRid.d.ts.map +0 -1
  177. package/build/browser/net/ThirdPartyAppRid.js +0 -17
  178. package/build/browser/net/ThirdPartyAppRid.js.map +0 -1
  179. package/build/browser/net/UserAgent.d.ts +0 -2
  180. package/build/browser/net/UserAgent.d.ts.map +0 -1
  181. package/build/browser/net/UserAgent.js +0 -17
  182. package/build/browser/net/UserAgent.js.map +0 -1
  183. package/build/browser/net/createFetch.d.mts +0 -2
  184. package/build/browser/net/createFetch.d.mts.map +0 -1
  185. package/build/browser/net/createFetch.js +0 -66
  186. package/build/browser/net/createFetch.js.map +0 -1
  187. package/build/browser/net/createFetch.mjs +0 -71
  188. package/build/browser/net/createInternalClientContext.d.mts +0 -3
  189. package/build/browser/net/createInternalClientContext.d.mts.map +0 -1
  190. package/build/browser/net/createInternalClientContext.js +0 -22
  191. package/build/browser/net/createInternalClientContext.js.map +0 -1
  192. package/build/browser/net/createInternalClientContext.mjs +0 -21
  193. package/build/browser/net/index.d.mts +0 -3
  194. package/build/browser/net/index.d.mts.map +0 -1
  195. package/build/browser/net/index.js +0 -18
  196. package/build/browser/net/index.js.map +0 -1
  197. package/build/browser/net/index.mjs +0 -17
  198. package/build/browser/net/internalClientContext.d.mts +0 -5
  199. package/build/browser/net/internalClientContext.d.mts.map +0 -1
  200. package/build/browser/net/internalClientContext.js +0 -17
  201. package/build/browser/net/internalClientContext.js.map +0 -1
  202. package/build/browser/net/internalClientContext.mjs +0 -16
  203. package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts +0 -4
  204. package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts.map +0 -1
  205. package/build/browser/net/third-party-applications/DeployWebsiteRequest.js +0 -17
  206. package/build/browser/net/third-party-applications/DeployWebsiteRequest.js.map +0 -1
  207. package/build/browser/net/third-party-applications/DeployWebsiteRequest.mjs +0 -16
  208. package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts +0 -6
  209. package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts.map +0 -1
  210. package/build/browser/net/third-party-applications/ListVersionsResponse.js +0 -17
  211. package/build/browser/net/third-party-applications/ListVersionsResponse.js.map +0 -1
  212. package/build/browser/net/third-party-applications/ListVersionsResponse.mjs +0 -16
  213. package/build/browser/net/third-party-applications/Version.d.mts +0 -4
  214. package/build/browser/net/third-party-applications/Version.d.mts.map +0 -1
  215. package/build/browser/net/third-party-applications/Version.js +0 -17
  216. package/build/browser/net/third-party-applications/Version.js.map +0 -1
  217. package/build/browser/net/third-party-applications/Version.mjs +0 -16
  218. package/build/browser/net/third-party-applications/Website.d.mts +0 -5
  219. package/build/browser/net/third-party-applications/Website.d.mts.map +0 -1
  220. package/build/browser/net/third-party-applications/Website.js +0 -17
  221. package/build/browser/net/third-party-applications/Website.js.map +0 -1
  222. package/build/browser/net/third-party-applications/Website.mjs +0 -16
  223. package/build/browser/net/third-party-applications/deleteVersion.d.mts +0 -4
  224. package/build/browser/net/third-party-applications/deleteVersion.d.mts.map +0 -1
  225. package/build/browser/net/third-party-applications/deleteVersion.js +0 -24
  226. package/build/browser/net/third-party-applications/deleteVersion.js.map +0 -1
  227. package/build/browser/net/third-party-applications/deleteVersion.mjs +0 -23
  228. package/build/browser/net/third-party-applications/deployWebsite.d.mts +0 -6
  229. package/build/browser/net/third-party-applications/deployWebsite.d.mts.map +0 -1
  230. package/build/browser/net/third-party-applications/deployWebsite.js +0 -29
  231. package/build/browser/net/third-party-applications/deployWebsite.js.map +0 -1
  232. package/build/browser/net/third-party-applications/deployWebsite.mjs +0 -28
  233. package/build/browser/net/third-party-applications/getWebsite.d.mts +0 -5
  234. package/build/browser/net/third-party-applications/getWebsite.d.mts.map +0 -1
  235. package/build/browser/net/third-party-applications/getWebsite.js +0 -33
  236. package/build/browser/net/third-party-applications/getWebsite.js.map +0 -1
  237. package/build/browser/net/third-party-applications/getWebsite.mjs +0 -35
  238. package/build/browser/net/third-party-applications/index.d.mts +0 -11
  239. package/build/browser/net/third-party-applications/index.d.mts.map +0 -1
  240. package/build/browser/net/third-party-applications/index.js +0 -22
  241. package/build/browser/net/third-party-applications/index.js.map +0 -1
  242. package/build/browser/net/third-party-applications/index.mjs +0 -21
  243. package/build/browser/net/third-party-applications/listVersions.d.mts +0 -5
  244. package/build/browser/net/third-party-applications/listVersions.d.mts.map +0 -1
  245. package/build/browser/net/third-party-applications/listVersions.js +0 -23
  246. package/build/browser/net/third-party-applications/listVersions.js.map +0 -1
  247. package/build/browser/net/third-party-applications/listVersions.mjs +0 -22
  248. package/build/browser/net/third-party-applications/undeployWebsite.d.mts +0 -4
  249. package/build/browser/net/third-party-applications/undeployWebsite.d.mts.map +0 -1
  250. package/build/browser/net/third-party-applications/undeployWebsite.js +0 -24
  251. package/build/browser/net/third-party-applications/undeployWebsite.js.map +0 -1
  252. package/build/browser/net/third-party-applications/undeployWebsite.mjs +0 -23
  253. package/build/browser/net/third-party-applications/uploadVersion.d.mts +0 -5
  254. package/build/browser/net/third-party-applications/uploadVersion.d.mts.map +0 -1
  255. package/build/browser/net/third-party-applications/uploadVersion.js +0 -30
  256. package/build/browser/net/third-party-applications/uploadVersion.js.map +0 -1
  257. package/build/browser/net/third-party-applications/uploadVersion.mjs +0 -29
  258. package/build/browser/util/autoVersion.d.ts +0 -9
  259. package/build/browser/util/autoVersion.d.ts.map +0 -1
  260. package/build/browser/util/autoVersion.js +0 -62
  261. package/build/browser/util/autoVersion.js.map +0 -1
  262. package/build/browser/util/autoVersion.test.d.ts +0 -2
  263. package/build/browser/util/autoVersion.test.d.ts.map +0 -1
  264. package/build/browser/util/autoVersion.test.js +0 -71
  265. package/build/browser/util/autoVersion.test.js.map +0 -1
  266. package/build/browser/util/config.d.ts +0 -26
  267. package/build/browser/util/config.d.ts.map +0 -1
  268. package/build/browser/util/config.js +0 -102
  269. package/build/browser/util/config.js.map +0 -1
  270. package/build/browser/util/config.test.d.ts +0 -2
  271. package/build/browser/util/config.test.d.ts.map +0 -1
  272. package/build/browser/util/config.test.js +0 -110
  273. package/build/browser/util/config.test.js.map +0 -1
  274. package/build/browser/util/configLoader.d.ts +0 -4
  275. package/build/browser/util/configLoader.d.ts.map +0 -1
  276. package/build/browser/util/configLoader.js +0 -25
  277. package/build/browser/util/configLoader.js.map +0 -1
  278. package/build/browser/util/isValidSemver.test.d.ts +0 -2
  279. package/build/browser/util/isValidSemver.test.d.ts.map +0 -1
  280. package/build/browser/util/isValidSemver.test.js +0 -41
  281. package/build/browser/util/isValidSemver.test.js.map +0 -1
  282. package/build/browser/util/token.d.ts +0 -22
  283. package/build/browser/util/token.d.ts.map +0 -1
  284. package/build/browser/util/token.js +0 -84
  285. package/build/browser/util/token.js.map +0 -1
  286. package/build/browser/util/token.test.d.ts +0 -2
  287. package/build/browser/util/token.test.d.ts.map +0 -1
  288. package/build/browser/util/token.test.js +0 -62
  289. package/build/browser/util/token.test.js.map +0 -1
  290. package/build/browser/yargs/logConfigFileMiddleware.d.ts +0 -2
  291. package/build/browser/yargs/logConfigFileMiddleware.d.ts.map +0 -1
  292. package/build/browser/yargs/logConfigFileMiddleware.js +0 -29
  293. package/build/browser/yargs/logConfigFileMiddleware.js.map +0 -1
  294. package/build/esm/cli.js +0 -42
  295. package/build/esm/cli.js.map +0 -1
  296. package/build/esm/commands/auth/index.js +0 -34
  297. package/build/esm/commands/auth/index.js.map +0 -1
  298. package/build/esm/commands/auth/login/index.js +0 -34
  299. package/build/esm/commands/auth/login/index.js.map +0 -1
  300. package/build/esm/commands/site/CommonSiteArgs.js +0 -17
  301. package/build/esm/commands/site/CommonSiteArgs.js.map +0 -1
  302. package/build/esm/commands/site/deploy/SiteDeployArgs.js +0 -17
  303. package/build/esm/commands/site/deploy/SiteDeployArgs.js.map +0 -1
  304. package/build/esm/commands/site/deploy/index.js +0 -108
  305. package/build/esm/commands/site/deploy/index.js.map +0 -1
  306. package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js +0 -28
  307. package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +0 -1
  308. package/build/esm/commands/site/deploy/siteDeployCommand.js +0 -98
  309. package/build/esm/commands/site/deploy/siteDeployCommand.js.map +0 -1
  310. package/build/esm/commands/site/deploy/siteDeployCommand.mjs +0 -90
  311. package/build/esm/commands/site/index.js +0 -69
  312. package/build/esm/commands/site/index.js.map +0 -1
  313. package/build/esm/commands/site/logSiteCommandConfigFileOverride.js +0 -25
  314. package/build/esm/commands/site/logSiteCommandConfigFileOverride.js.map +0 -1
  315. package/build/esm/commands/site/version/delete/VersionDeleteArgs.js +0 -17
  316. package/build/esm/commands/site/version/delete/VersionDeleteArgs.js.map +0 -1
  317. package/build/esm/commands/site/version/delete/index.js +0 -36
  318. package/build/esm/commands/site/version/delete/index.js.map +0 -1
  319. package/build/esm/commands/site/version/delete/versionDeleteCommand.js +0 -41
  320. package/build/esm/commands/site/version/delete/versionDeleteCommand.js.map +0 -1
  321. package/build/esm/commands/site/version/delete/versionDeleteCommand.mjs +0 -32
  322. package/build/esm/commands/site/version/get/VersionGetArgs.js +0 -17
  323. package/build/esm/commands/site/version/get/VersionGetArgs.js.map +0 -1
  324. package/build/esm/commands/site/version/get/index.js +0 -28
  325. package/build/esm/commands/site/version/get/index.js.map +0 -1
  326. package/build/esm/commands/site/version/get/versionGetCommand.js +0 -36
  327. package/build/esm/commands/site/version/get/versionGetCommand.js.map +0 -1
  328. package/build/esm/commands/site/version/get/versionGetCommand.mjs +0 -32
  329. package/build/esm/commands/site/version/index.js +0 -30
  330. package/build/esm/commands/site/version/index.js.map +0 -1
  331. package/build/esm/commands/site/version/list/VersionListArgs.js +0 -17
  332. package/build/esm/commands/site/version/list/VersionListArgs.js.map +0 -1
  333. package/build/esm/commands/site/version/list/index.js +0 -28
  334. package/build/esm/commands/site/version/list/index.js.map +0 -1
  335. package/build/esm/commands/site/version/list/versionListCommand.js +0 -41
  336. package/build/esm/commands/site/version/list/versionListCommand.js.map +0 -1
  337. package/build/esm/commands/site/version/list/versionListCommand.mjs +0 -42
  338. package/build/esm/commands/site/version/set/VersionSetArgs.js +0 -17
  339. package/build/esm/commands/site/version/set/VersionSetArgs.js.map +0 -1
  340. package/build/esm/commands/site/version/set/index.js +0 -32
  341. package/build/esm/commands/site/version/set/index.js.map +0 -1
  342. package/build/esm/commands/site/version/set/versionSetCommand.js +0 -36
  343. package/build/esm/commands/site/version/set/versionSetCommand.js.map +0 -1
  344. package/build/esm/commands/site/version/set/versionSetCommand.mjs +0 -28
  345. package/build/esm/commands/site/version/unset/VersionUnsetArgs.js +0 -17
  346. package/build/esm/commands/site/version/unset/VersionUnsetArgs.js.map +0 -1
  347. package/build/esm/commands/site/version/unset/index.js +0 -32
  348. package/build/esm/commands/site/version/unset/index.js.map +0 -1
  349. package/build/esm/commands/site/version/unset/versionUnsetCommand.js +0 -40
  350. package/build/esm/commands/site/version/unset/versionUnsetCommand.js.map +0 -1
  351. package/build/esm/commands/site/version/unset/versionUnsetCommand.mjs +0 -32
  352. package/build/esm/consola/handlePromptCancel.js +0 -25
  353. package/build/esm/consola/handlePromptCancel.js.map +0 -1
  354. package/build/esm/net/ThirdPartyAppRid.js +0 -17
  355. package/build/esm/net/ThirdPartyAppRid.js.map +0 -1
  356. package/build/esm/net/UserAgent.js +0 -17
  357. package/build/esm/net/UserAgent.js.map +0 -1
  358. package/build/esm/net/createFetch.js +0 -66
  359. package/build/esm/net/createFetch.js.map +0 -1
  360. package/build/esm/net/createFetch.mjs +0 -71
  361. package/build/esm/net/createInternalClientContext.js +0 -22
  362. package/build/esm/net/createInternalClientContext.js.map +0 -1
  363. package/build/esm/net/createInternalClientContext.mjs +0 -21
  364. package/build/esm/net/index.js +0 -18
  365. package/build/esm/net/index.js.map +0 -1
  366. package/build/esm/net/index.mjs +0 -17
  367. package/build/esm/net/internalClientContext.js +0 -17
  368. package/build/esm/net/internalClientContext.js.map +0 -1
  369. package/build/esm/net/internalClientContext.mjs +0 -16
  370. package/build/esm/net/third-party-applications/DeployWebsiteRequest.js +0 -17
  371. package/build/esm/net/third-party-applications/DeployWebsiteRequest.js.map +0 -1
  372. package/build/esm/net/third-party-applications/DeployWebsiteRequest.mjs +0 -16
  373. package/build/esm/net/third-party-applications/ListVersionsResponse.js +0 -17
  374. package/build/esm/net/third-party-applications/ListVersionsResponse.js.map +0 -1
  375. package/build/esm/net/third-party-applications/ListVersionsResponse.mjs +0 -16
  376. package/build/esm/net/third-party-applications/Version.js +0 -17
  377. package/build/esm/net/third-party-applications/Version.js.map +0 -1
  378. package/build/esm/net/third-party-applications/Version.mjs +0 -16
  379. package/build/esm/net/third-party-applications/Website.js +0 -17
  380. package/build/esm/net/third-party-applications/Website.js.map +0 -1
  381. package/build/esm/net/third-party-applications/Website.mjs +0 -16
  382. package/build/esm/net/third-party-applications/deleteVersion.js +0 -24
  383. package/build/esm/net/third-party-applications/deleteVersion.js.map +0 -1
  384. package/build/esm/net/third-party-applications/deleteVersion.mjs +0 -23
  385. package/build/esm/net/third-party-applications/deployWebsite.js +0 -29
  386. package/build/esm/net/third-party-applications/deployWebsite.js.map +0 -1
  387. package/build/esm/net/third-party-applications/deployWebsite.mjs +0 -28
  388. package/build/esm/net/third-party-applications/getWebsite.js +0 -33
  389. package/build/esm/net/third-party-applications/getWebsite.js.map +0 -1
  390. package/build/esm/net/third-party-applications/getWebsite.mjs +0 -35
  391. package/build/esm/net/third-party-applications/index.js +0 -22
  392. package/build/esm/net/third-party-applications/index.js.map +0 -1
  393. package/build/esm/net/third-party-applications/index.mjs +0 -21
  394. package/build/esm/net/third-party-applications/listVersions.js +0 -23
  395. package/build/esm/net/third-party-applications/listVersions.js.map +0 -1
  396. package/build/esm/net/third-party-applications/listVersions.mjs +0 -22
  397. package/build/esm/net/third-party-applications/undeployWebsite.js +0 -24
  398. package/build/esm/net/third-party-applications/undeployWebsite.js.map +0 -1
  399. package/build/esm/net/third-party-applications/undeployWebsite.mjs +0 -23
  400. package/build/esm/net/third-party-applications/uploadVersion.js +0 -30
  401. package/build/esm/net/third-party-applications/uploadVersion.js.map +0 -1
  402. package/build/esm/net/third-party-applications/uploadVersion.mjs +0 -29
  403. package/build/esm/util/autoVersion.js +0 -62
  404. package/build/esm/util/autoVersion.js.map +0 -1
  405. package/build/esm/util/autoVersion.test.js +0 -71
  406. package/build/esm/util/autoVersion.test.js.map +0 -1
  407. package/build/esm/util/config.js +0 -102
  408. package/build/esm/util/config.js.map +0 -1
  409. package/build/esm/util/config.test.js +0 -110
  410. package/build/esm/util/config.test.js.map +0 -1
  411. package/build/esm/util/configLoader.js +0 -25
  412. package/build/esm/util/configLoader.js.map +0 -1
  413. package/build/esm/util/isValidSemver.test.js +0 -41
  414. package/build/esm/util/isValidSemver.test.js.map +0 -1
  415. package/build/esm/util/token.js +0 -84
  416. package/build/esm/util/token.js.map +0 -1
  417. package/build/esm/util/token.test.js +0 -62
  418. package/build/esm/util/token.test.js.map +0 -1
  419. package/build/esm/yargs/logConfigFileMiddleware.js +0 -29
  420. package/build/esm/yargs/logConfigFileMiddleware.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @osdk/cli
2
2
 
3
+ ## 0.24.0-beta.14
4
+
5
+ ### Minor Changes
6
+
7
+ - ff790c5: Rollup dependencies
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [dc25fb4]
12
+ - @osdk/generator@2.0.0-beta.15
13
+
3
14
  ## 0.24.0-beta.13
4
15
 
5
16
  ### Minor Changes
@@ -0,0 +1,17 @@
1
+ import { init_esm_shims } from './chunk-DAYFZSC6.js';
2
+ import { consola } from 'consola';
3
+
4
+ // src/consola/handlePromptCancel.ts
5
+ init_esm_shims();
6
+ function handlePromptCancel(promptResponse) {
7
+ const isFalse = typeof promptResponse === "boolean" && !promptResponse;
8
+ const isSigInt = typeof promptResponse === "symbol" && promptResponse.toString() === "Symbol(clack:cancel)";
9
+ if (isSigInt || isFalse) {
10
+ consola.fail("Operation cancelled");
11
+ process.exit(0);
12
+ }
13
+ }
14
+
15
+ export { handlePromptCancel };
16
+ //# sourceMappingURL=chunk-5AQYUXAY.js.map
17
+ //# sourceMappingURL=chunk-5AQYUXAY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/consola/handlePromptCancel.ts"],"names":[],"mappings":";;;;AAAA,cAAA,EAAA,CAAA;AAiBO,SAAS,mBAAmB,cAAgB,EAAA;AACjD,EAAA,MAAM,OAAU,GAAA,OAAO,cAAmB,KAAA,SAAA,IAAa,CAAC,cAAA,CAAA;AAExD,EAAA,MAAM,WAAW,OAAO,cAAA,KAAmB,QAAY,IAAA,cAAA,CAAe,UAAe,KAAA,sBAAA,CAAA;AACrF,EAAA,IAAI,YAAY,OAAS,EAAA;AACvB,IAAA,OAAA,CAAQ,KAAK,qBAAqB,CAAA,CAAA;AAClC,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GAChB;AACF","file":"chunk-5AQYUXAY.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 */\n\nimport { consola } from \"consola\";\nexport function handlePromptCancel(promptResponse) {\n const isFalse = typeof promptResponse === \"boolean\" && !promptResponse;\n // https://github.com/unjs/consola/issues/251\n const isSigInt = typeof promptResponse === \"symbol\" && promptResponse.toString() === \"Symbol(clack:cancel)\";\n if (isSigInt || isFalse) {\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}"]}
@@ -0,0 +1,42 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+
34
+ // ../../node_modules/.pnpm/tsup@8.2.3_@microsoft+api-extractor@7.47.0_@types+node@20.14.10__jiti@1.21.6_postcss@8.4.39_typescript@5.5.3_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js
35
+ var init_esm_shims = __esm({
36
+ "../../node_modules/.pnpm/tsup@8.2.3_@microsoft+api-extractor@7.47.0_@types+node@20.14.10__jiti@1.21.6_postcss@8.4.39_typescript@5.5.3_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js"() {
37
+ }
38
+ });
39
+
40
+ export { __commonJS, __export, __toESM, init_esm_shims };
41
+ //# sourceMappingURL=chunk-DAYFZSC6.js.map
42
+ //# sourceMappingURL=chunk-DAYFZSC6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/tsup@8.2.3_@microsoft+api-extractor@7.47.0_@types+node@20.14.10__jiti@1.21.6_postcss@8.4.39_typescript@5.5.3_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA;AAAA,EAAA,wLAAA,GAAA;AAAA,GAAA;AAAA,CAAA","file":"chunk-DAYFZSC6.js","sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url';\nimport path from 'path';\nconst getFilename = () => fileURLToPath(import.meta.url);\nconst getDirname = () => path.dirname(getFilename());\nexport const __dirname = /* @__PURE__ */getDirname();\nexport const __filename = /* @__PURE__ */getFilename();"]}
@@ -0,0 +1,221 @@
1
+ import { ExitProcessError } from './chunk-Q2H7XAS4.js';
2
+ import { init_esm_shims, __export } from './chunk-DAYFZSC6.js';
3
+ import { PalantirApiError, createFetchHeaderMutator, createFetchOrThrow } from '@osdk/shared.net';
4
+ import { consola } from 'consola';
5
+ import { promises } from 'fs';
6
+ import path from 'path';
7
+
8
+ // src/net/createInternalClientContext.mts
9
+ init_esm_shims();
10
+ function createInternalClientContext(foundryUrl, tokenProvider) {
11
+ return {
12
+ tokenProvider,
13
+ foundryUrl
14
+ };
15
+ }
16
+
17
+ // src/net/third-party-applications/index.mts
18
+ var third_party_applications_exports = {};
19
+ __export(third_party_applications_exports, {
20
+ deleteVersion: () => deleteVersion,
21
+ deployWebsite: () => deployWebsite,
22
+ getWebsite: () => getWebsite,
23
+ listVersions: () => listVersions,
24
+ undeployWebsite: () => undeployWebsite,
25
+ uploadVersion: () => uploadVersion
26
+ });
27
+ init_esm_shims();
28
+
29
+ // src/net/third-party-applications/deleteVersion.mts
30
+ init_esm_shims();
31
+
32
+ // src/net/createFetch.mts
33
+ init_esm_shims();
34
+
35
+ // src/net/UserAgent.ts
36
+ init_esm_shims();
37
+ var USER_AGENT = `osdk-cli/${"0.24.0-beta.14"}`;
38
+
39
+ // src/net/createFetch.mts
40
+ function createFetch(tokenProvider, fetchFn = fetch) {
41
+ return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async (headers) => {
42
+ const token = await tokenProvider();
43
+ headers.set("Authorization", `Bearer ${token}`);
44
+ headers.set("Fetch-User-Agent", USER_AGENT);
45
+ return headers;
46
+ });
47
+ }
48
+ function createErrorExitingFetch(fetchFn = fetch) {
49
+ return function errorExitingFetch(input, init) {
50
+ return fetchFn(input, init).catch(handleFetchError);
51
+ };
52
+ }
53
+ function handleFetchError(e) {
54
+ if (!(e instanceof PalantirApiError)) {
55
+ throw new ExitProcessError(1, "Unexpected fetch error");
56
+ }
57
+ let tip;
58
+ if (e.statusCode === 401) {
59
+ tip = "Check your token is valid and has not expired or been disabled";
60
+ } else if (e.statusCode === 403) {
61
+ tip = "Check your token has the required scopes for this operation";
62
+ }
63
+ let message = e.message;
64
+ if (e.errorName === "CannotDeleteDeployedVersion") {
65
+ message = "The site version to delete is live and cannot be deleted";
66
+ tip = "Run the `site version set` command to change the live site version";
67
+ } else if (e.errorName === "InvalidVersion") {
68
+ message = "The site version is invalid and must be a valid SemVer string";
69
+ } else if (e.errorName === "VersionAlreadyExists") {
70
+ message = "The site version already exists";
71
+ } else if (e.errorName === "VersionNotFound") {
72
+ message = "The site version could not be found";
73
+ }
74
+ throw new ExitProcessError(1, message, tip, e);
75
+ }
76
+ function createRequestLoggingFetch(fetchFn = fetch) {
77
+ return function requestLoggingFetch(input, init) {
78
+ const requestLog = typeof input === "string" || input instanceof URL ? `${init?.method ?? "GET"}: ${input.toString().trim()}` : `${input.method ?? "GET"}: ${input.url.toString().trim()}`;
79
+ consola.trace(requestLog);
80
+ return fetchFn(input, init).then((a) => {
81
+ consola.trace(`FINISH ${requestLog}`);
82
+ return a;
83
+ });
84
+ };
85
+ }
86
+
87
+ // src/net/third-party-applications/deleteVersion.mts
88
+ async function deleteVersion(ctx, thirdPartyAppRid, version) {
89
+ const fetch2 = createFetch(ctx.tokenProvider);
90
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions/${version}?preview=true`;
91
+ await fetch2(url, {
92
+ method: "DELETE"
93
+ });
94
+ }
95
+
96
+ // src/net/third-party-applications/deployWebsite.mts
97
+ init_esm_shims();
98
+ async function deployWebsite(ctx, thirdPartyAppRid, request) {
99
+ const fetch2 = createFetch(ctx.tokenProvider);
100
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/deploy?preview=true`;
101
+ const result = await fetch2(url, {
102
+ method: "POST",
103
+ body: JSON.stringify(request),
104
+ headers: {
105
+ "Content-Type": "application/json"
106
+ }
107
+ });
108
+ return result.json();
109
+ }
110
+
111
+ // src/net/third-party-applications/getWebsite.mts
112
+ init_esm_shims();
113
+ async function getWebsite(ctx, thirdPartyAppRid) {
114
+ const fetch2 = createFetch(ctx.tokenProvider);
115
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website?preview=true`;
116
+ try {
117
+ const result = await fetch2(url);
118
+ return result.json();
119
+ } catch (e) {
120
+ if (e instanceof ExitProcessError && e.originalError != null && e.originalError instanceof PalantirApiError && e.originalError.errorName === "WebsiteNotFound") {
121
+ return void 0;
122
+ }
123
+ throw e;
124
+ }
125
+ }
126
+
127
+ // src/net/third-party-applications/listVersions.mts
128
+ init_esm_shims();
129
+ async function listVersions(ctx, thirdPartyAppRid) {
130
+ const fetch2 = createFetch(ctx.tokenProvider);
131
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions?preview=true`;
132
+ const result = await fetch2(url);
133
+ return result.json();
134
+ }
135
+
136
+ // src/net/third-party-applications/undeployWebsite.mts
137
+ init_esm_shims();
138
+ async function undeployWebsite(ctx, thirdPartyAppRid) {
139
+ const fetch2 = createFetch(ctx.tokenProvider);
140
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/undeploy?preview=true`;
141
+ await fetch2(url, {
142
+ method: "POST"
143
+ });
144
+ }
145
+
146
+ // src/net/third-party-applications/uploadVersion.mts
147
+ init_esm_shims();
148
+ async function uploadVersion(ctx, thirdPartyAppRid, version, zipFile) {
149
+ const fetch2 = createFetch(ctx.tokenProvider);
150
+ const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions/upload?version=${version}&preview=true`;
151
+ const result = await fetch2(url, {
152
+ method: "POST",
153
+ body: zipFile,
154
+ headers: {
155
+ "Content-Type": "application/octet-stream"
156
+ },
157
+ duplex: "half"
158
+ // Node hates me
159
+ });
160
+ return result.json();
161
+ }
162
+
163
+ // src/net/index.mts
164
+ init_esm_shims();
165
+
166
+ // src/util/token.ts
167
+ init_esm_shims();
168
+ var TOKEN_ENV_VARS = ["FOUNDRY_TOKEN", "FOUNDRY_SDK_AUTH_TOKEN"];
169
+ async function loadToken(token, tokenFile) {
170
+ if (token) {
171
+ consola.debug(`Using token from --token option`);
172
+ validate(token);
173
+ return token;
174
+ }
175
+ if (tokenFile) {
176
+ const loadedToken = await loadTokenFile(tokenFile);
177
+ consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);
178
+ validate(loadedToken.token);
179
+ return loadedToken.token;
180
+ }
181
+ for (const envVar of TOKEN_ENV_VARS) {
182
+ const environmentToken = process.env[envVar];
183
+ if (environmentToken) {
184
+ consola.debug(`Using token from ${envVar} environment variable`);
185
+ validate(environmentToken);
186
+ if (envVar === "FOUNDRY_SDK_AUTH_TOKEN") {
187
+ consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);
188
+ }
189
+ return environmentToken;
190
+ }
191
+ }
192
+ throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);
193
+ }
194
+ async function loadTokenFile(filePath) {
195
+ let token;
196
+ let resolvedPath;
197
+ try {
198
+ resolvedPath = path.resolve(filePath);
199
+ token = await promises.readFile(resolvedPath, "utf8");
200
+ token = token.trim();
201
+ } catch (error) {
202
+ throw new ExitProcessError(2, `Unable to read token file "${filePath}": ${error}`);
203
+ }
204
+ return {
205
+ filePath: resolvedPath,
206
+ token
207
+ };
208
+ }
209
+ function validate(token) {
210
+ if (!isJWT(token)) {
211
+ throw new ExitProcessError(2, `Token does not appear to be a JWT`);
212
+ }
213
+ }
214
+ function isJWT(token) {
215
+ const jwtPattern = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
216
+ return jwtPattern.test(token);
217
+ }
218
+
219
+ export { createInternalClientContext, loadToken, third_party_applications_exports };
220
+ //# sourceMappingURL=chunk-IK6CLC6I.js.map
221
+ //# sourceMappingURL=chunk-IK6CLC6I.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/net/createInternalClientContext.mts","../../src/net/third-party-applications/index.mts","../../src/net/third-party-applications/deleteVersion.mts","../../src/net/createFetch.mts","../../src/net/UserAgent.ts","../../src/net/third-party-applications/deployWebsite.mts","../../src/net/third-party-applications/getWebsite.mts","../../src/net/third-party-applications/listVersions.mts","../../src/net/third-party-applications/undeployWebsite.mts","../../src/net/third-party-applications/uploadVersion.mts","../../src/net/index.mts","../../src/util/token.ts"],"names":["fetch","PalantirApiError","consola","fsPromises"],"mappings":";;;;;;;;AAAA,cAAA,EAAA,CAAA;AAgBO,SAAS,2BAAA,CAA4B,YAAY,aAAe,EAAA;AACrE,EAAO,OAAA;AAAA,IACL,aAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF,CAAA;;;ACrBA,IAAA,gCAAA,GAAA,GAAA;AAAA,QAAA,CAAA,gCAAA,EAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,EAAA,UAAA,EAAA,MAAA,UAAA;AAAA,EAAA,YAAA,EAAA,MAAA,YAAA;AAAA,EAAA,eAAA,EAAA,MAAA,eAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,CAAA,CAAA,CAAA;AAAA,cAAA,EA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CAAA,KAAK,CAAG,EAAA;AACjB,IAAM,MAAA,IAAI,gBAAiB,CAAA,CAAA,EAAG,CAAmC,iCAAA,CAAA,CAAA,CAAA;AAAA,GACnE;AACF,CAAA;AACA,SAAS,MAAM,KAAO,EAAA;AAEpB,EAAA,MAAM,UAAa,GAAA,kDAAA,CAAA;AACnB,EAAO,OAAA,UAAA,CAAW,KAAK,KAAK,CAAA,CAAA;AAC9B","file":"chunk-IK6CLC6I.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 */\n\nexport function createInternalClientContext(foundryUrl, tokenProvider) {\n return {\n tokenProvider,\n foundryUrl\n };\n}","/*\n * Copyright 2024 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 */\n\nexport { deleteVersion } from \"./deleteVersion.mjs\";\nexport { deployWebsite } from \"./deployWebsite.mjs\";\nexport { getWebsite } from \"./getWebsite.mjs\";\nexport { listVersions } from \"./listVersions.mjs\";\nexport { undeployWebsite } from \"./undeployWebsite.mjs\";\nexport { uploadVersion } from \"./uploadVersion.mjs\";","/*\n * Copyright 2024 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 */\n\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function deleteVersion(ctx, thirdPartyAppRid, version) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions/${version}?preview=true`;\n await fetch(url, {\n method: \"DELETE\"\n });\n}","/*\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 */\n\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { createFetchHeaderMutator, createFetchOrThrow, PalantirApiError } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport { USER_AGENT } from \"./UserAgent.js\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createRequestLoggingFetch(createErrorExitingFetch(createFetchOrThrow(fetchFn))), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", USER_AGENT);\n return headers;\n });\n}\nfunction createErrorExitingFetch(fetchFn = fetch) {\n return function errorExitingFetch(input, init) {\n return fetchFn(input, init).catch(handleFetchError);\n };\n}\nfunction handleFetchError(e) {\n if (!(e instanceof PalantirApiError)) {\n throw new ExitProcessError(1, \"Unexpected fetch error\");\n }\n let tip;\n if (e.statusCode === 401) {\n tip = \"Check your token is valid and has not expired or been disabled\";\n } else if (e.statusCode === 403) {\n tip = \"Check your token has the required scopes for this operation\";\n }\n let message = e.message;\n if (e.errorName === \"CannotDeleteDeployedVersion\") {\n message = \"The site version to delete is live and cannot be deleted\";\n tip = \"Run the `site version set` command to change the live site version\";\n } else if (e.errorName === \"InvalidVersion\") {\n message = \"The site version is invalid and must be a valid SemVer string\";\n } else if (e.errorName === \"VersionAlreadyExists\") {\n message = \"The site version already exists\";\n } else if (e.errorName === \"VersionNotFound\") {\n message = \"The site version could not be found\";\n }\n throw new ExitProcessError(1, message, tip, e);\n}\nfunction createRequestLoggingFetch(fetchFn = fetch) {\n return function requestLoggingFetch(input, init) {\n const requestLog = typeof input === \"string\" || input instanceof URL ? `${init?.method ?? \"GET\"}: ${input.toString().trim()}` : `${input.method ?? \"GET\"}: ${input.url.toString().trim()}`;\n consola.trace(requestLog);\n return fetchFn(input, init).then(a => {\n consola.trace(`FINISH ${requestLog}`);\n return a;\n });\n };\n}","/*\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 */\n\nexport const USER_AGENT = `osdk-cli/${process.env.PACKAGE_VERSION}`;","/*\n * Copyright 2024 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 */\n\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function deployWebsite(ctx, thirdPartyAppRid, request) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/deploy?preview=true`;\n const result = await fetch(url, {\n method: \"POST\",\n body: JSON.stringify(request),\n headers: {\n \"Content-Type\": \"application/json\"\n }\n });\n return result.json();\n}","/*\n * Copyright 2024 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 */\n\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { PalantirApiError } from \"@osdk/shared.net\";\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function getWebsite(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website?preview=true`;\n try {\n const result = await fetch(url);\n return result.json();\n } catch (e) {\n // Revisit this error handling in the API\n if (e instanceof ExitProcessError && e.originalError != null && e.originalError instanceof PalantirApiError && e.originalError.errorName === \"WebsiteNotFound\") {\n return undefined;\n }\n throw e;\n }\n}","/*\n * Copyright 2024 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 */\n\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function listVersions(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions?preview=true`;\n const result = await fetch(url);\n return result.json();\n}","/*\n * Copyright 2024 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 */\n\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function undeployWebsite(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/undeploy?preview=true`;\n await fetch(url, {\n method: \"POST\"\n });\n}","/*\n * Copyright 2024 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 */\n\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function uploadVersion(ctx, thirdPartyAppRid, version, zipFile) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions/upload?version=${version}&preview=true`;\n const result = await fetch(url, {\n method: \"POST\",\n body: zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n return result.json();\n}","/*\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 */\n\nexport { createInternalClientContext } from \"./createInternalClientContext.mjs\";\nexport * as thirdPartyApplications from \"./third-party-applications/index.mjs\";","/*\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 */\n\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\nimport { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nconst TOKEN_ENV_VARS = [\"FOUNDRY_TOKEN\", \"FOUNDRY_SDK_AUTH_TOKEN\"];\n\n/**\n * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.\n * @param token The token as a string.\n * @param tokenFile The path to the token file.\n * @returns The token as a string.\n * @throws An error if no token is found.\n */\nexport async function loadToken(token, tokenFile) {\n if (token) {\n consola.debug(`Using token from --token option`);\n validate(token);\n return token;\n }\n if (tokenFile) {\n const loadedToken = await loadTokenFile(tokenFile);\n consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);\n validate(loadedToken.token);\n return loadedToken.token;\n }\n for (const envVar of TOKEN_ENV_VARS) {\n const environmentToken = process.env[envVar];\n if (environmentToken) {\n consola.debug(`Using token from ${envVar} environment variable`);\n validate(environmentToken);\n if (envVar === \"FOUNDRY_SDK_AUTH_TOKEN\") {\n consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);\n }\n return environmentToken;\n }\n }\n throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);\n}\n/**\n * Reads a JWT Auth Token from a file.\n * @param filePath The path to the token file.\n * @returns The token as a string.\n * @throws An error if the file cannot be read.\n */\nexport async function loadTokenFile(filePath) {\n let token;\n let resolvedPath;\n try {\n resolvedPath = path.resolve(filePath);\n token = await fsPromises.readFile(resolvedPath, \"utf8\");\n token = token.trim();\n } catch (error) {\n throw new ExitProcessError(2, `Unable to read token file \"${filePath}\": ${error}`);\n }\n return {\n filePath: resolvedPath,\n token\n };\n}\nexport function validate(token) {\n if (!isJWT(token)) {\n throw new ExitProcessError(2, `Token does not appear to be a JWT`);\n }\n}\nfunction isJWT(token) {\n // https://stackoverflow.com/a/65755789\n const jwtPattern = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\n return jwtPattern.test(token);\n}"]}
@@ -0,0 +1,88 @@
1
+ import { init_esm_shims } from './chunk-DAYFZSC6.js';
2
+ import { consola } from 'consola';
3
+ import { colorize } from 'consola/utils';
4
+ import yargs from 'yargs';
5
+ import { hideBin } from 'yargs/helpers';
6
+ import { valid } from 'semver';
7
+
8
+ // ../cli.common/build/esm/ExitProcessError.js
9
+ init_esm_shims();
10
+ var ExitProcessError = class extends Error {
11
+ errorCode;
12
+ msg;
13
+ tip;
14
+ originalError;
15
+ constructor(errorCode, msg, tip, originalError) {
16
+ super(msg);
17
+ this.errorCode = errorCode;
18
+ this.msg = msg;
19
+ this.tip = tip;
20
+ this.originalError = originalError;
21
+ }
22
+ };
23
+
24
+ // ../cli.common/build/esm/YargsCheckError.js
25
+ init_esm_shims();
26
+ var YargsCheckError = class extends Error {
27
+ constructor(msg) {
28
+ super(msg);
29
+ }
30
+ };
31
+
32
+ // ../cli.common/build/esm/index.js
33
+ init_esm_shims();
34
+
35
+ // ../cli.common/build/esm/getYargsBase.js
36
+ init_esm_shims();
37
+
38
+ // ../cli.common/build/esm/yargs/logLevelMiddleware.js
39
+ init_esm_shims();
40
+ var firstTime = true;
41
+ async function logLevelMiddleware(args) {
42
+ if (firstTime) {
43
+ firstTime = false;
44
+ consola.level = 3 + args.verbose;
45
+ if (consola.level > 3) {
46
+ consola.debug(`Verbose logging enabled (${consola.level === 4 ? "debug" : "trace"})
47
+ `);
48
+ }
49
+ }
50
+ }
51
+
52
+ // ../cli.common/build/esm/getYargsBase.js
53
+ function getYargsBase(args) {
54
+ return yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env("OSDK").version(false).option("verbose", {
55
+ alias: "v",
56
+ type: "boolean",
57
+ description: "Enable verbose logging",
58
+ count: true
59
+ }).demandCommand().middleware(logLevelMiddleware, true).strict().fail(async (msg, err, argv) => {
60
+ if (err instanceof ExitProcessError) {
61
+ consola.error(err.message);
62
+ if (err.tip != null) {
63
+ consola.log(colorize("bold", `\u{1F4A1} Tip: ${err.tip}`));
64
+ consola.log("");
65
+ }
66
+ consola.debug(err.stack);
67
+ } else {
68
+ if (err && err instanceof YargsCheckError === false) {
69
+ throw err;
70
+ } else {
71
+ argv.showHelp();
72
+ consola.log("");
73
+ consola.error(msg);
74
+ }
75
+ }
76
+ process.exit(1);
77
+ });
78
+ }
79
+
80
+ // ../cli.common/build/esm/util/isValidSemver.js
81
+ init_esm_shims();
82
+ function isValidSemver(semverString) {
83
+ return valid(semverString) != null;
84
+ }
85
+
86
+ export { ExitProcessError, YargsCheckError, getYargsBase, isValidSemver };
87
+ //# sourceMappingURL=chunk-Q2H7XAS4.js.map
88
+ //# sourceMappingURL=chunk-Q2H7XAS4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../cli.common/build/esm/ExitProcessError.js","../../../cli.common/build/esm/YargsCheckError.js","../../../cli.common/build/esm/index.js","../../../cli.common/build/esm/getYargsBase.js","../../../cli.common/build/esm/yargs/logLevelMiddleware.js","../../../cli.common/build/esm/util/isValidSemver.js"],"names":["consola"],"mappings":";;;;;;;;AAAA,cAAA,EAAA,CAAA;AAea,IAAA,gBAAA,GAAN,cAA+B,KAAM,CAAA;AAAA,EAC1C,SAAA,CAAA;AAAA,EACA,GAAA,CAAA;AAAA,EACA,GAAA,CAAA;AAAA,EACA,aAAA,CAAA;AAAA,EACA,WAAY,CAAA,SAAA,EAAW,GAAK,EAAA,GAAA,EAAK,aAAe,EAAA;AAC9C,IAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,SAAY,GAAA,SAAA,CAAA;AACjB,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA,CAAA;AACX,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA,CAAA;AACX,IAAA,IAAA,CAAK,aAAgB,GAAA,aAAA,CAAA;AAAA,GACvB;AACF,EAAA;;;AC3BA,cAAA,EAAA,CAAA;AAea,IAAA,eAAA,GAAN,cAA8B,KAAM,CAAA;AAAA,EACzC,YAAY,GAAK,EAAA;AACf,IAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAAA,GACX;AACF,EAAA;;;ACnBA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAgBA,IAAI,SAAY,GAAA,IAAA,CAAA;AAChB,eAAsB,mBAAmB,IAAM,EAAA;AAC7C,EAAA,IAAI,SAAW,EAAA;AACb,IAAY,SAAA,GAAA,KAAA,CAAA;AACZ,IAAQ,OAAA,CAAA,KAAA,GAAQ,IAAI,IAAK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AACnD,QAAM,MAAA,GAAA,CAAA;AAAA,OACD,MAAA;AACL,QAAA,IAAA,CAAK,QAAS,EAAA,CAAA;AACd,QAAAA,OAAAA,CAAQ,IAAI,EAAE,CAAA,CAAA;AACd,QAAAA,OAAAA,CAAQ,MAAM,GAAG,CAAA,CAAA;AAAA,OACnB;AAAA,KACF;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AACH,CAAA;;;AE/CA,cAAA,EAAA,CAAA;AAgBO,SAAS,cAAc,YAAc,EAAA;AAC1C,EAAO,OAAA,KAAA,CAAM,YAAY,CAAK,IAAA,IAAA,CAAA;AAChC","file":"chunk-Q2H7XAS4.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 */\nexport class ExitProcessError extends Error {\n errorCode;\n msg;\n tip;\n originalError;\n constructor(errorCode, msg, tip, originalError) {\n super(msg);\n this.errorCode = errorCode;\n this.msg = msg;\n this.tip = tip;\n this.originalError = originalError;\n }\n}","/*\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 */\nexport class YargsCheckError extends Error {\n constructor(msg) {\n super(msg);\n }\n}","/*\n * Copyright 2024 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 */\nexport { ExitProcessError } from \"./ExitProcessError.js\";\nexport { getYargsBase } from \"./getYargsBase.js\";\nexport { isValidSemver } from \"./util/isValidSemver.js\";\nexport { YargsCheckError } from \"./YargsCheckError.js\";","/*\n * Copyright 2024 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 { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nimport { logLevelMiddleware } from \"./yargs/logLevelMiddleware.js\";\nimport { YargsCheckError } from \"./YargsCheckError.js\";\nexport function getYargsBase(args) {\n return yargs(hideBin(args)).wrap(Math.min(150, yargs().terminalWidth())).env(\"OSDK\").version(false).option(\"verbose\", {\n alias: \"v\",\n type: \"boolean\",\n description: \"Enable verbose logging\",\n count: true\n }).demandCommand().middleware(logLevelMiddleware, true).strict().fail(async (msg, err, argv) => {\n if (err instanceof ExitProcessError) {\n consola.error(err.message);\n if (err.tip != null) {\n consola.log(colorize(\"bold\", `💡 Tip: ${err.tip}`));\n consola.log(\"\");\n }\n consola.debug(err.stack);\n } else {\n if (err && err instanceof YargsCheckError === false) {\n throw err;\n } else {\n argv.showHelp();\n consola.log(\"\");\n consola.error(msg);\n }\n }\n process.exit(1);\n });\n}","/*\n * Copyright 2024 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 { consola } from \"consola\";\nlet firstTime = true;\nexport async function logLevelMiddleware(args) {\n if (firstTime) {\n firstTime = false;\n consola.level = 3 + args.verbose; // so 1 -v is debug logs and -vv is trace\n if (consola.level > 3) {\n consola.debug(`Verbose logging enabled (${consola.level === 4 ? \"debug\" : \"trace\"})\\n`);\n }\n }\n}","/*\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 { valid } from \"semver\";\nexport function isValidSemver(semverString) {\n return valid(semverString) != null;\n}"]}
@@ -0,0 +1,127 @@
1
+ import { init_esm_shims } from './chunk-DAYFZSC6.js';
2
+ import consola from 'consola';
3
+ import { getRandomValues, subtle } from 'crypto';
4
+ import { createServer } from 'http';
5
+ import { join } from 'path/posix';
6
+ import { exit } from 'process';
7
+ import { parse } from 'url';
8
+ import open from 'open';
9
+
10
+ // ../cli.common/build/esm/public/loginFlow.js
11
+ init_esm_shims();
12
+
13
+ // ../cli.common/build/esm/commands/auth/login/loginFlow.js
14
+ init_esm_shims();
15
+
16
+ // ../cli.common/build/esm/commands/auth/login/token.js
17
+ init_esm_shims();
18
+ function isTokenErrorResponse(response) {
19
+ return response.error != null;
20
+ }
21
+
22
+ // ../cli.common/build/esm/commands/auth/login/loginFlow.js
23
+ var BROWSER_PROMPT_TIME_MS = 60 * 1e3;
24
+ async function invokeLoginFlow(args) {
25
+ consola.start(`Authenticating using application id: ${args.clientId}`);
26
+ const redirectUrl = "http://localhost:8080/auth/callback";
27
+ const port = parse(redirectUrl).port;
28
+ let resolve;
29
+ const authCode = new Promise((_res) => {
30
+ resolve = _res;
31
+ });
32
+ const server = createServer((req, res) => {
33
+ const query = parse(req.url, true).query;
34
+ res.end("Authenticated");
35
+ resolve(query["code"]);
36
+ });
37
+ server.on("error", (e) => {
38
+ if (e.code === "EADDRINUSE") {
39
+ consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);
40
+ server.close();
41
+ exit(1);
42
+ }
43
+ });
44
+ server.listen(port);
45
+ const clientId = args.clientId;
46
+ const state = generateRandomString();
47
+ const codeVerifier = generateRandomString();
48
+ const codeChallenge = await generateCodeChallenge(codeVerifier);
49
+ const authorizeUrl = generateAuthorizeUrl(args.foundryUrl, clientId, state, redirectUrl, codeChallenge);
50
+ try {
51
+ await open(authorizeUrl);
52
+ } catch {
53
+ consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);
54
+ }
55
+ const browserPrompt = setTimeout(() => {
56
+ consola.warn(`Still waiting for the authentication to complete. Please open a browser to ${authorizeUrl}`);
57
+ }, BROWSER_PROMPT_TIME_MS);
58
+ const code = await authCode;
59
+ server.close();
60
+ clearTimeout(browserPrompt);
61
+ const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.foundryUrl, codeVerifier);
62
+ if (isTokenErrorResponse(token)) {
63
+ consola.error("Unable to authenticate", token.error, token.error_description);
64
+ exit(1);
65
+ }
66
+ consola.success(`Successfully authenticated!`);
67
+ return token;
68
+ }
69
+ function generateRandomString(length = 128) {
70
+ const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
71
+ let output = [];
72
+ let array = new Uint8Array(1);
73
+ const maxIndex = 256 - 256 % characters.length;
74
+ while (output.length < length) {
75
+ getRandomValues(array);
76
+ if (array[0] < maxIndex) {
77
+ output.push(characters[array[0] % characters.length]);
78
+ }
79
+ }
80
+ return output.join("");
81
+ }
82
+ async function generateCodeChallenge(codeVerifier) {
83
+ const data = new TextEncoder().encode(codeVerifier);
84
+ const digest = await subtle.digest("SHA-256", data);
85
+ const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
86
+ return {
87
+ codeChallenge,
88
+ codeChallengeMethod: "S256"
89
+ };
90
+ }
91
+ function generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {
92
+ const queryParams = new URLSearchParams();
93
+ queryParams.append("client_id", clientId);
94
+ queryParams.append("response_type", "code");
95
+ queryParams.append("state", state);
96
+ queryParams.append("redirect_uri", redirectUrl);
97
+ queryParams.append("code_challenge", codeChallenge.codeChallenge);
98
+ queryParams.append("code_challenge_method", codeChallenge.codeChallengeMethod);
99
+ queryParams.append("scope", ["offline_access", "api:read-data"].join(" "));
100
+ return join(baseUrl, "multipass", "api", "oauth2", "authorize") + `?` + queryParams.toString();
101
+ }
102
+ async function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {
103
+ const body = new URLSearchParams();
104
+ body.append("client_id", clientId);
105
+ body.append("grant_type", "authorization_code");
106
+ body.append("code", code);
107
+ body.append("redirect_uri", redirectUrl);
108
+ body.append("code_verifier", codeVerifier);
109
+ const tokenUrl = join(baseUrl, "multipass", "api", "oauth2", "token") + `?state=${codeVerifier}`;
110
+ try {
111
+ const response = await fetch(tokenUrl, {
112
+ body: body.toString(),
113
+ headers: {
114
+ "Content-Type": "application/x-www-form-urlencoded"
115
+ },
116
+ method: "POST"
117
+ });
118
+ const responseText = await response.json();
119
+ return responseText;
120
+ } catch (e) {
121
+ throw new Error(`Failed to get token: ${e?.cause?.toString() ?? e?.toString() ?? "Unknown error"}`);
122
+ }
123
+ }
124
+
125
+ export { invokeLoginFlow };
126
+ //# sourceMappingURL=chunk-VDO5KGGR.js.map
127
+ //# sourceMappingURL=chunk-VDO5KGGR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../cli.common/build/esm/public/loginFlow.js","../../../cli.common/build/esm/commands/auth/login/loginFlow.js","../../../cli.common/build/esm/commands/auth/login/token.js"],"names":[],"mappings":";;;;;;;;;;AAAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAeO,SAAS,qBAAqB,QAAU,EAAA;AAC7C,EAAA,OAAO,SAAS,KAAS,IAAA,IAAA,CAAA;AAC3B,CAAA;;;ADMA,IAAM,yBAAyB,EAAK,GAAA,GAAA,CAAA;AACpC,eAAsB,gBAAgB,IAAM,EAAA;AAC1C,EAAA,OAAA,CAAQ,KAAM,CAAA,CAAA,qCAAA,EAAwC,IAAK,CAAA,QAAQ,CAAE,CAAA,CAAA,CAAA;AACrE,EAAA,MAAM,WAAc,GAAA,qCAAA,CAAA;AACpB,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,WAAW,CAAE,CAAA,IAAA,CAAA;AAChC,EAAI,IAAA,OAAA,CAAA;AACJ,EAAM,MAAA,QAAA,GAAW,IAAI,OAAA,CAAQ,CAAQ,IAAA,KAAA;AACnC,IAAU,OAAA,GAAA,IAAA,CAAA;AAAA,GACX,CAAA,CAAA;AACD,EAAA,MAAM,MAAS,GAAA,YAAA,CAAa,CAAC,GAAA,EAAK,GAAQ,KAAA;AACxC,IAAA,MAAM,KAAQ,GAAA,KAAA,CAAM,GAAI,CAAA,GAAA,EAAK,IAAI,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CAAA;AACA,eAAe,wBAAyB,CAAA,QAAA,EAAU,WAAa,EAAA,IAAA,EAAM,SAAS,YAAc,EAAA;AAC1F,EAAM,MAAA,IAAA,GAAO,IAAI,eAAgB,EAAA,CAAA;AACjC,EAAK,IAAA,CAAA,MAAA,CAAO,aAAa,QAAQ,CAAA,CAAA;AACjC,EAAK,IAAA,CAAA,MAAA,CAAO,cAAc,oBAAoB,CAAA,CAAA;AAC9C,EAAK,IAAA,CAAA,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAA;AACxB,EAAK,IAAA,CAAA,MAAA,CAAO,gBAAgB,WAAW,CAAA,CAAA;AACvC,EAAK,IAAA,CAAA,MAAA,CAAO,iBAAiB,YAAY,CAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,KAAK,OAAS,EAAA,WAAA,EAAa,OAAO,QAAU,EAAA,OAAO,CAAI,GAAA,CAAA,OAAA,EAAU,YAAY,CAAA,CAAA,CAAA;AAC9F,EAAI,IAAA;AACF,IAAM,MAAA,QAAA,GAAW,MAAM,KAAA,CAAM,QAAU,EAAA;AAAA,MACrC,IAAA,EAAM,KAAK,QAAS,EAAA;AAAA,MACpB,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,mCAAA;AAAA,OAClB;AAAA,MACA,MAAQ,EAAA,MAAA;AAAA,KACT,CAAA,CAAA;AACD,IAAM,MAAA,YAAA,GAAe,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACzC,IAAO,OAAA,YAAA,CAAA;AAAA,WACA,CAAG,EAAA;AACV,IAAM,MAAA,IAAI,KAAM,CAAA,CAAA,qBAAA,EAAwB,CAAG,EAAA,KAAA,EAAO,QAAS,EAAA,IAAK,CAAG,EAAA,QAAA,EAAc,IAAA,eAAe,CAAE,CAAA,CAAA,CAAA;AAAA,GACpG;AACF","file":"chunk-VDO5KGGR.js","sourcesContent":["/*\n * Copyright 2024 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 */\nexport { invokeLoginFlow as default } from \"../commands/auth/login/loginFlow.js\";","/*\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 consola from \"consola\";\nimport { getRandomValues, subtle } from \"node:crypto\";\nimport { createServer } from \"node:http\";\nimport { join } from \"node:path/posix\";\nimport { exit } from \"node:process\";\nimport { parse } from \"node:url\";\nimport open from \"open\";\nimport { isTokenErrorResponse } from \"./token.js\";\nconst BROWSER_PROMPT_TIME_MS = 60 * 1000;\nexport async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.clientId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.clientId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.foundryUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n // nag the user if we didn't get an auth token for a relatively long time\n const browserPrompt = setTimeout(() => {\n consola.warn(`Still waiting for the authentication to complete. Please open a browser to ${authorizeUrl}`);\n }, BROWSER_PROMPT_TIME_MS);\n const code = await authCode;\n server.close();\n clearTimeout(browserPrompt);\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.foundryUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod: \"S256\"\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e?.cause?.toString() ?? e?.toString() ?? \"Unknown error\"}`);\n }\n}","/*\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 */\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}