@osdk/create-app 0.19.0-beta.6 → 0.19.0-beta.7

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 (224) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/esm-AQEYRLX5.js +383 -0
  3. package/build/browser/esm-AQEYRLX5.js.map +1 -0
  4. package/build/browser/esm-FVYIHZAJ.js +375 -0
  5. package/build/browser/esm-FVYIHZAJ.js.map +1 -0
  6. package/build/browser/esm-NCHOZ6BO.js +1176 -0
  7. package/build/browser/esm-NCHOZ6BO.js.map +1 -0
  8. package/build/browser/esm-NPLFBOV7.js +908 -0
  9. package/build/browser/esm-NPLFBOV7.js.map +1 -0
  10. package/build/browser/esm-SNM7M67J.js +253 -0
  11. package/build/browser/esm-SNM7M67J.js.map +1 -0
  12. package/build/browser/esm-UJCFN4M3.js +456 -0
  13. package/build/browser/esm-UJCFN4M3.js.map +1 -0
  14. package/build/browser/index.js +540 -18
  15. package/build/browser/index.js.map +1 -1
  16. package/build/esm/esm-AQEYRLX5.js +383 -0
  17. package/build/esm/esm-AQEYRLX5.js.map +1 -0
  18. package/build/esm/esm-FVYIHZAJ.js +375 -0
  19. package/build/esm/esm-FVYIHZAJ.js.map +1 -0
  20. package/build/esm/esm-NCHOZ6BO.js +1176 -0
  21. package/build/esm/esm-NCHOZ6BO.js.map +1 -0
  22. package/build/esm/esm-NPLFBOV7.js +908 -0
  23. package/build/esm/esm-NPLFBOV7.js.map +1 -0
  24. package/build/esm/esm-SNM7M67J.js +253 -0
  25. package/build/esm/esm-SNM7M67J.js.map +1 -0
  26. package/build/esm/esm-UJCFN4M3.js +456 -0
  27. package/build/esm/esm-UJCFN4M3.js.map +1 -0
  28. package/build/esm/index.js +540 -18
  29. package/build/esm/index.js.map +1 -1
  30. package/package.json +9 -9
  31. package/build/browser/cli.d.ts +0 -2
  32. package/build/browser/cli.d.ts.map +0 -1
  33. package/build/browser/cli.js +0 -95
  34. package/build/browser/cli.js.map +0 -1
  35. package/build/browser/cli.test.d.ts +0 -2
  36. package/build/browser/cli.test.d.ts.map +0 -1
  37. package/build/browser/cli.test.js +0 -59
  38. package/build/browser/cli.test.js.map +0 -1
  39. package/build/browser/consola.d.ts +0 -3
  40. package/build/browser/consola.d.ts.map +0 -1
  41. package/build/browser/consola.js +0 -28
  42. package/build/browser/consola.js.map +0 -1
  43. package/build/browser/generate/generateEnv.d.ts +0 -13
  44. package/build/browser/generate/generateEnv.d.ts.map +0 -1
  45. package/build/browser/generate/generateEnv.js +0 -50
  46. package/build/browser/generate/generateEnv.js.map +0 -1
  47. package/build/browser/generate/generateEnv.test.d.ts +0 -2
  48. package/build/browser/generate/generateEnv.test.d.ts.map +0 -1
  49. package/build/browser/generate/generateEnv.test.js +0 -70
  50. package/build/browser/generate/generateEnv.test.js.map +0 -1
  51. package/build/browser/generate/generateFoundryConfigJson.d.ts +0 -6
  52. package/build/browser/generate/generateFoundryConfigJson.d.ts.map +0 -1
  53. package/build/browser/generate/generateFoundryConfigJson.js +0 -33
  54. package/build/browser/generate/generateFoundryConfigJson.js.map +0 -1
  55. package/build/browser/generate/generateFoundryConfigJson.test.d.ts +0 -2
  56. package/build/browser/generate/generateFoundryConfigJson.test.d.ts.map +0 -1
  57. package/build/browser/generate/generateFoundryConfigJson.test.js +0 -38
  58. package/build/browser/generate/generateFoundryConfigJson.test.js.map +0 -1
  59. package/build/browser/generate/generateNpmRc.d.ts +0 -5
  60. package/build/browser/generate/generateNpmRc.d.ts.map +0 -1
  61. package/build/browser/generate/generateNpmRc.js +0 -27
  62. package/build/browser/generate/generateNpmRc.js.map +0 -1
  63. package/build/browser/generate/generateNpmRc.test.d.ts +0 -2
  64. package/build/browser/generate/generateNpmRc.test.d.ts.map +0 -1
  65. package/build/browser/generate/generateNpmRc.test.js +0 -28
  66. package/build/browser/generate/generateNpmRc.test.js.map +0 -1
  67. package/build/browser/highlight.d.ts +0 -3
  68. package/build/browser/highlight.d.ts.map +0 -1
  69. package/build/browser/highlight.js +0 -23
  70. package/build/browser/highlight.js.map +0 -1
  71. package/build/browser/index.d.ts +0 -5
  72. package/build/browser/index.d.ts.map +0 -1
  73. package/build/browser/prompts/promptApplicationRid.d.ts +0 -4
  74. package/build/browser/prompts/promptApplicationRid.d.ts.map +0 -1
  75. package/build/browser/prompts/promptApplicationRid.js +0 -31
  76. package/build/browser/prompts/promptApplicationRid.js.map +0 -1
  77. package/build/browser/prompts/promptApplicationRid.test.d.ts +0 -2
  78. package/build/browser/prompts/promptApplicationRid.test.d.ts.map +0 -1
  79. package/build/browser/prompts/promptApplicationRid.test.js +0 -48
  80. package/build/browser/prompts/promptApplicationRid.test.js.map +0 -1
  81. package/build/browser/prompts/promptApplicationUrl.d.ts +0 -5
  82. package/build/browser/prompts/promptApplicationUrl.d.ts.map +0 -1
  83. package/build/browser/prompts/promptApplicationUrl.js +0 -50
  84. package/build/browser/prompts/promptApplicationUrl.js.map +0 -1
  85. package/build/browser/prompts/promptApplicationUrl.test.d.ts +0 -2
  86. package/build/browser/prompts/promptApplicationUrl.test.d.ts.map +0 -1
  87. package/build/browser/prompts/promptApplicationUrl.test.js +0 -68
  88. package/build/browser/prompts/promptApplicationUrl.test.js.map +0 -1
  89. package/build/browser/prompts/promptClientId.d.ts +0 -4
  90. package/build/browser/prompts/promptClientId.d.ts.map +0 -1
  91. package/build/browser/prompts/promptClientId.js +0 -31
  92. package/build/browser/prompts/promptClientId.js.map +0 -1
  93. package/build/browser/prompts/promptClientId.test.d.ts +0 -2
  94. package/build/browser/prompts/promptClientId.test.d.ts.map +0 -1
  95. package/build/browser/prompts/promptClientId.test.js +0 -47
  96. package/build/browser/prompts/promptClientId.test.js.map +0 -1
  97. package/build/browser/prompts/promptCorsProxy.d.ts +0 -4
  98. package/build/browser/prompts/promptCorsProxy.d.ts.map +0 -1
  99. package/build/browser/prompts/promptCorsProxy.js +0 -29
  100. package/build/browser/prompts/promptCorsProxy.js.map +0 -1
  101. package/build/browser/prompts/promptCorsProxy.test.d.ts +0 -2
  102. package/build/browser/prompts/promptCorsProxy.test.d.ts.map +0 -1
  103. package/build/browser/prompts/promptCorsProxy.test.js +0 -44
  104. package/build/browser/prompts/promptCorsProxy.test.js.map +0 -1
  105. package/build/browser/prompts/promptFoundryUrl.d.ts +0 -4
  106. package/build/browser/prompts/promptFoundryUrl.d.ts.map +0 -1
  107. package/build/browser/prompts/promptFoundryUrl.js +0 -31
  108. package/build/browser/prompts/promptFoundryUrl.js.map +0 -1
  109. package/build/browser/prompts/promptFoundryUrl.test.d.ts +0 -2
  110. package/build/browser/prompts/promptFoundryUrl.test.d.ts.map +0 -1
  111. package/build/browser/prompts/promptFoundryUrl.test.js +0 -55
  112. package/build/browser/prompts/promptFoundryUrl.test.js.map +0 -1
  113. package/build/browser/prompts/promptOsdkPackage.d.ts +0 -4
  114. package/build/browser/prompts/promptOsdkPackage.d.ts.map +0 -1
  115. package/build/browser/prompts/promptOsdkPackage.js +0 -31
  116. package/build/browser/prompts/promptOsdkPackage.js.map +0 -1
  117. package/build/browser/prompts/promptOsdkPackage.test.d.ts +0 -2
  118. package/build/browser/prompts/promptOsdkPackage.test.d.ts.map +0 -1
  119. package/build/browser/prompts/promptOsdkPackage.test.js +0 -48
  120. package/build/browser/prompts/promptOsdkPackage.test.js.map +0 -1
  121. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts +0 -4
  122. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts.map +0 -1
  123. package/build/browser/prompts/promptOsdkRegistryUrl.js +0 -31
  124. package/build/browser/prompts/promptOsdkRegistryUrl.js.map +0 -1
  125. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts +0 -2
  126. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts.map +0 -1
  127. package/build/browser/prompts/promptOsdkRegistryUrl.test.js +0 -54
  128. package/build/browser/prompts/promptOsdkRegistryUrl.test.js.map +0 -1
  129. package/build/browser/prompts/promptOverwrite.d.ts +0 -5
  130. package/build/browser/prompts/promptOverwrite.d.ts.map +0 -1
  131. package/build/browser/prompts/promptOverwrite.js +0 -53
  132. package/build/browser/prompts/promptOverwrite.js.map +0 -1
  133. package/build/browser/prompts/promptOverwrite.test.d.ts +0 -2
  134. package/build/browser/prompts/promptOverwrite.test.d.ts.map +0 -1
  135. package/build/browser/prompts/promptOverwrite.test.js +0 -55
  136. package/build/browser/prompts/promptOverwrite.test.js.map +0 -1
  137. package/build/browser/prompts/promptProject.d.ts +0 -4
  138. package/build/browser/prompts/promptProject.d.ts.map +0 -1
  139. package/build/browser/prompts/promptProject.js +0 -32
  140. package/build/browser/prompts/promptProject.js.map +0 -1
  141. package/build/browser/prompts/promptProject.test.d.ts +0 -2
  142. package/build/browser/prompts/promptProject.test.d.ts.map +0 -1
  143. package/build/browser/prompts/promptProject.test.js +0 -47
  144. package/build/browser/prompts/promptProject.test.js.map +0 -1
  145. package/build/browser/prompts/promptTemplate.d.ts +0 -6
  146. package/build/browser/prompts/promptTemplate.d.ts.map +0 -1
  147. package/build/browser/prompts/promptTemplate.js +0 -45
  148. package/build/browser/prompts/promptTemplate.js.map +0 -1
  149. package/build/browser/prompts/promptTemplate.test.d.ts +0 -2
  150. package/build/browser/prompts/promptTemplate.test.d.ts.map +0 -1
  151. package/build/browser/prompts/promptTemplate.test.js +0 -48
  152. package/build/browser/prompts/promptTemplate.test.js.map +0 -1
  153. package/build/browser/run.d.ts +0 -16
  154. package/build/browser/run.d.ts.map +0 -1
  155. package/build/browser/run.js +0 -132
  156. package/build/browser/run.js.map +0 -1
  157. package/build/browser/templates.d.ts +0 -23
  158. package/build/browser/templates.d.ts.map +0 -1
  159. package/build/browser/templates.js +0 -56
  160. package/build/browser/templates.js.map +0 -1
  161. package/build/esm/cli.js +0 -95
  162. package/build/esm/cli.js.map +0 -1
  163. package/build/esm/cli.test.js +0 -59
  164. package/build/esm/cli.test.js.map +0 -1
  165. package/build/esm/consola.js +0 -28
  166. package/build/esm/consola.js.map +0 -1
  167. package/build/esm/generate/generateEnv.js +0 -50
  168. package/build/esm/generate/generateEnv.js.map +0 -1
  169. package/build/esm/generate/generateEnv.test.js +0 -70
  170. package/build/esm/generate/generateEnv.test.js.map +0 -1
  171. package/build/esm/generate/generateFoundryConfigJson.js +0 -33
  172. package/build/esm/generate/generateFoundryConfigJson.js.map +0 -1
  173. package/build/esm/generate/generateFoundryConfigJson.test.js +0 -38
  174. package/build/esm/generate/generateFoundryConfigJson.test.js.map +0 -1
  175. package/build/esm/generate/generateNpmRc.js +0 -27
  176. package/build/esm/generate/generateNpmRc.js.map +0 -1
  177. package/build/esm/generate/generateNpmRc.test.js +0 -28
  178. package/build/esm/generate/generateNpmRc.test.js.map +0 -1
  179. package/build/esm/highlight.js +0 -23
  180. package/build/esm/highlight.js.map +0 -1
  181. package/build/esm/prompts/promptApplicationRid.js +0 -31
  182. package/build/esm/prompts/promptApplicationRid.js.map +0 -1
  183. package/build/esm/prompts/promptApplicationRid.test.js +0 -48
  184. package/build/esm/prompts/promptApplicationRid.test.js.map +0 -1
  185. package/build/esm/prompts/promptApplicationUrl.js +0 -50
  186. package/build/esm/prompts/promptApplicationUrl.js.map +0 -1
  187. package/build/esm/prompts/promptApplicationUrl.test.js +0 -68
  188. package/build/esm/prompts/promptApplicationUrl.test.js.map +0 -1
  189. package/build/esm/prompts/promptClientId.js +0 -31
  190. package/build/esm/prompts/promptClientId.js.map +0 -1
  191. package/build/esm/prompts/promptClientId.test.js +0 -47
  192. package/build/esm/prompts/promptClientId.test.js.map +0 -1
  193. package/build/esm/prompts/promptCorsProxy.js +0 -29
  194. package/build/esm/prompts/promptCorsProxy.js.map +0 -1
  195. package/build/esm/prompts/promptCorsProxy.test.js +0 -44
  196. package/build/esm/prompts/promptCorsProxy.test.js.map +0 -1
  197. package/build/esm/prompts/promptFoundryUrl.js +0 -31
  198. package/build/esm/prompts/promptFoundryUrl.js.map +0 -1
  199. package/build/esm/prompts/promptFoundryUrl.test.js +0 -55
  200. package/build/esm/prompts/promptFoundryUrl.test.js.map +0 -1
  201. package/build/esm/prompts/promptOsdkPackage.js +0 -31
  202. package/build/esm/prompts/promptOsdkPackage.js.map +0 -1
  203. package/build/esm/prompts/promptOsdkPackage.test.js +0 -48
  204. package/build/esm/prompts/promptOsdkPackage.test.js.map +0 -1
  205. package/build/esm/prompts/promptOsdkRegistryUrl.js +0 -31
  206. package/build/esm/prompts/promptOsdkRegistryUrl.js.map +0 -1
  207. package/build/esm/prompts/promptOsdkRegistryUrl.test.js +0 -54
  208. package/build/esm/prompts/promptOsdkRegistryUrl.test.js.map +0 -1
  209. package/build/esm/prompts/promptOverwrite.js +0 -53
  210. package/build/esm/prompts/promptOverwrite.js.map +0 -1
  211. package/build/esm/prompts/promptOverwrite.test.js +0 -55
  212. package/build/esm/prompts/promptOverwrite.test.js.map +0 -1
  213. package/build/esm/prompts/promptProject.js +0 -32
  214. package/build/esm/prompts/promptProject.js.map +0 -1
  215. package/build/esm/prompts/promptProject.test.js +0 -47
  216. package/build/esm/prompts/promptProject.test.js.map +0 -1
  217. package/build/esm/prompts/promptTemplate.js +0 -45
  218. package/build/esm/prompts/promptTemplate.js.map +0 -1
  219. package/build/esm/prompts/promptTemplate.test.js +0 -48
  220. package/build/esm/prompts/promptTemplate.test.js.map +0 -1
  221. package/build/esm/run.js +0 -132
  222. package/build/esm/run.js.map +0 -1
  223. package/build/esm/templates.js +0 -56
  224. package/build/esm/templates.js.map +0 -1
@@ -1,31 +0,0 @@
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 { consola } from "../consola.js";
17
- import { italic } from "../highlight.js";
18
- export async function promptClientId({
19
- clientId
20
- }) {
21
- while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {
22
- if (clientId != null) {
23
- consola.fail("Please enter a valid OAuth client ID");
24
- }
25
- clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:\n${italic("(Example: 2650385ab6c5e0df3b44aff776b00a42)")}`, {
26
- type: "text"
27
- });
28
- }
29
- return clientId;
30
- }
31
- //# sourceMappingURL=promptClientId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptClientId.js","names":["consola","italic","promptClientId","clientId","test","fail","prompt","type"],"sources":["promptClientId.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 { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptClientId({ clientId }) {\n while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {\n if (clientId != null) {\n consola.fail(\"Please enter a valid OAuth client ID\");\n }\n clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:\\n${italic(\"(Example: 2650385ab6c5e0df3b44aff776b00a42)\")}`, { type: \"text\" });\n }\n return clientId;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAO,eAAeC,cAAcA,CAAC;EAAEC;AAAS,CAAC,EAAE;EAC/C,OAAOA,QAAQ,IAAI,IAAI,IAAI,CAAC,aAAa,CAACC,IAAI,CAACD,QAAQ,CAAC,EAAE;IACtD,IAAIA,QAAQ,IAAI,IAAI,EAAE;MAClBH,OAAO,CAACK,IAAI,CAAC,sCAAsC,CAAC;IACxD;IACAF,QAAQ,GAAG,MAAMH,OAAO,CAACM,MAAM,CAAC,2EAA2EL,MAAM,CAAC,6CAA6C,CAAC,EAAE,EAAE;MAAEM,IAAI,EAAE;IAAO,CAAC,CAAC;EACzL;EACA,OAAOJ,QAAQ;AACnB","ignoreList":[]}
@@ -1,47 +0,0 @@
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 { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { promptClientId } from "./promptClientId.js";
19
- vi.mock("../consola.js");
20
- afterEach(() => {
21
- vi.restoreAllMocks();
22
- });
23
- test("it accepts valid client id from prompt", async () => {
24
- vi.mocked(consola).prompt.mockResolvedValueOnce("123abc");
25
- expect(await promptClientId({})).toEqual("123abc");
26
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
27
- });
28
- test("it prompts again if answered value is invalid", async () => {
29
- vi.mocked(consola).prompt.mockResolvedValueOnce("***invalid***");
30
- vi.mocked(consola).prompt.mockResolvedValueOnce("123abc");
31
- expect(await promptClientId({})).toEqual("123abc");
32
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(2);
33
- });
34
- test("it accepts valid initial value without prompt", async () => {
35
- expect(await promptClientId({
36
- clientId: "123abc"
37
- })).toEqual("123abc");
38
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
39
- });
40
- test("it prompts if initial value is invalid", async () => {
41
- vi.mocked(consola).prompt.mockResolvedValueOnce("123abc");
42
- expect(await promptClientId({
43
- clientId: "***invalid***"
44
- })).toEqual("123abc");
45
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
46
- });
47
- //# sourceMappingURL=promptClientId.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptClientId.test.js","names":["afterEach","expect","test","vi","consola","promptClientId","mock","restoreAllMocks","mocked","prompt","mockResolvedValueOnce","toEqual","toHaveBeenCalledTimes","clientId","not","toHaveBeenCalled"],"sources":["promptClientId.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 { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptClientId } from \"./promptClientId.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\ntest(\"it accepts valid client id from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"123abc\");\n expect(await promptClientId({})).toEqual(\"123abc\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it prompts again if answered value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"***invalid***\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"123abc\");\n expect(await promptClientId({})).toEqual(\"123abc\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(2);\n});\ntest(\"it accepts valid initial value without prompt\", async () => {\n expect(await promptClientId({ clientId: \"123abc\" })).toEqual(\"123abc\");\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"123abc\");\n expect(await promptClientId({ clientId: \"***invalid***\" })).toEqual(\"123abc\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,cAAc,QAAQ,qBAAqB;AACpDF,EAAE,CAACG,IAAI,CAAC,eAAe,CAAC;AACxBN,SAAS,CAAC,MAAM;EACZG,EAAE,CAACI,eAAe,CAAC,CAAC;AACxB,CAAC,CAAC;AACFL,IAAI,CAAC,wCAAwC,EAAE,YAAY;EACvDC,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAACC,qBAAqB,CAAC,QAAQ,CAAC;EACzDT,MAAM,CAAC,MAAMI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAACM,OAAO,CAAC,QAAQ,CAAC;EAClDV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AACFV,IAAI,CAAC,+CAA+C,EAAE,YAAY;EAC9DC,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAACC,qBAAqB,CAAC,eAAe,CAAC;EAChEP,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAACC,qBAAqB,CAAC,QAAQ,CAAC;EACzDT,MAAM,CAAC,MAAMI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAACM,OAAO,CAAC,QAAQ,CAAC;EAClDV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AACFV,IAAI,CAAC,+CAA+C,EAAE,YAAY;EAC9DD,MAAM,CAAC,MAAMI,cAAc,CAAC;IAAEQ,QAAQ,EAAE;EAAS,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,QAAQ,CAAC;EACtEV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACK,GAAG,CAACC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC;AACFb,IAAI,CAAC,wCAAwC,EAAE,YAAY;EACvDC,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAACC,qBAAqB,CAAC,QAAQ,CAAC;EACzDT,MAAM,CAAC,MAAMI,cAAc,CAAC;IAAEQ,QAAQ,EAAE;EAAgB,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,QAAQ,CAAC;EAC7EV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,29 +0,0 @@
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 { consola } from "../consola.js";
17
- import { italic } from "../highlight.js";
18
- export async function promptCorsProxy({
19
- corsProxy
20
- }) {
21
- if (corsProxy != null) {
22
- return corsProxy;
23
- }
24
- return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?\n${italic("This is required if your enrollment has not allowed localhost for CORS.")}`, {
25
- type: "confirm",
26
- initial: false
27
- });
28
- }
29
- //# sourceMappingURL=promptCorsProxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptCorsProxy.js","names":["consola","italic","promptCorsProxy","corsProxy","prompt","type","initial"],"sources":["promptCorsProxy.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 { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptCorsProxy({ corsProxy }) {\n if (corsProxy != null) {\n return corsProxy;\n }\n return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?\\n${italic(\"This is required if your enrollment has not allowed localhost for CORS.\")}`, { type: \"confirm\", initial: false });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAO,eAAeC,eAAeA,CAAC;EAAEC;AAAU,CAAC,EAAE;EACjD,IAAIA,SAAS,IAAI,IAAI,EAAE;IACnB,OAAOA,SAAS;EACpB;EACA,OAAOH,OAAO,CAACI,MAAM,CAAC,4EAA4EH,MAAM,CAAC,yEAAyE,CAAC,EAAE,EAAE;IAAEI,IAAI,EAAE,SAAS;IAAEC,OAAO,EAAE;EAAM,CAAC,CAAC;AAC/N","ignoreList":[]}
@@ -1,44 +0,0 @@
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 { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { promptCorsProxy } from "./promptCorsProxy.js";
19
- vi.mock("../consola.js");
20
- vi.mock("node:fs");
21
- afterEach(() => {
22
- vi.restoreAllMocks();
23
- });
24
- test("it accepts 'corsProxy' true from prompt", async () => {
25
- vi.mocked(consola).prompt.mockResolvedValueOnce(true);
26
- expect(await promptCorsProxy({})).toBe(true);
27
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
28
- });
29
- test("it accepts 'corsProxy' false from prompt", async () => {
30
- vi.mocked(consola).prompt.mockResolvedValueOnce(false);
31
- expect(await promptCorsProxy({})).toBe(false);
32
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
33
- });
34
- test("it accepts initial value without prompt", async () => {
35
- expect(await promptCorsProxy({
36
- corsProxy: true
37
- })).toBe(true);
38
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
39
- expect(await promptCorsProxy({
40
- corsProxy: false
41
- })).toBe(false);
42
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
43
- });
44
- //# sourceMappingURL=promptCorsProxy.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptCorsProxy.test.js","names":["afterEach","expect","test","vi","consola","promptCorsProxy","mock","restoreAllMocks","mocked","prompt","mockResolvedValueOnce","toBe","toHaveBeenCalledTimes","corsProxy","not","toHaveBeenCalled"],"sources":["promptCorsProxy.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 { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptCorsProxy } from \"./promptCorsProxy.js\";\nvi.mock(\"../consola.js\");\nvi.mock(\"node:fs\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\ntest(\"it accepts 'corsProxy' true from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(true);\n expect(await promptCorsProxy({})).toBe(true);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it accepts 'corsProxy' false from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(false);\n expect(await promptCorsProxy({})).toBe(false);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it accepts initial value without prompt\", async () => {\n expect(await promptCorsProxy({ corsProxy: true })).toBe(true);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n expect(await promptCorsProxy({ corsProxy: false })).toBe(false);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,eAAe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,CAAC,CAAC,CAACF,IAAI,CAAC,KAAK,CAAC;EAC/DV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACK,GAAG,CAACC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC","ignoreList":[]}
@@ -1,31 +0,0 @@
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 { consola } from "../consola.js";
17
- import { italic } from "../highlight.js";
18
- export async function promptFoundryUrl({
19
- foundryUrl
20
- }) {
21
- while (foundryUrl == null || !foundryUrl.startsWith("https://")) {
22
- if (foundryUrl != null) {
23
- consola.fail("Please enter a valid Foundry URL");
24
- }
25
- foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\n${italic("(Example: https://example.palantirfoundry.com)")}`, {
26
- type: "text"
27
- });
28
- }
29
- return foundryUrl.replace(/\/$/, "");
30
- }
31
- //# sourceMappingURL=promptFoundryUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptFoundryUrl.js","names":["consola","italic","promptFoundryUrl","foundryUrl","startsWith","fail","prompt","type","replace"],"sources":["promptFoundryUrl.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 { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({ foundryUrl }) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, { type: \"text\" });\n }\n return foundryUrl.replace(/\\/$/, \"\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAO,eAAeC,gBAAgBA,CAAC;EAAEC;AAAW,CAAC,EAAE;EACnD,OAAOA,UAAU,IAAI,IAAI,IAAI,CAACA,UAAU,CAACC,UAAU,CAAC,UAAU,CAAC,EAAE;IAC7D,IAAID,UAAU,IAAI,IAAI,EAAE;MACpBH,OAAO,CAACK,IAAI,CAAC,kCAAkC,CAAC;IACpD;IACAF,UAAU,GAAG,MAAMH,OAAO,CAACM,MAAM,CAAC,0CAA0CL,MAAM,CAAC,gDAAgD,CAAC,EAAE,EAAE;MAAEM,IAAI,EAAE;IAAO,CAAC,CAAC;EAC7J;EACA,OAAOJ,UAAU,CAACK,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
@@ -1,55 +0,0 @@
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 { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { promptFoundryUrl } from "./promptFoundryUrl.js";
19
- vi.mock("../consola.js");
20
- afterEach(() => {
21
- vi.restoreAllMocks();
22
- });
23
- const valid = "https://example.palantirfoundry.com";
24
- test("it accepts valid foundry url from prompt", async () => {
25
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
26
- expect(await promptFoundryUrl({})).toEqual(valid);
27
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
28
- });
29
- test("it prompts again if answered value is invalid", async () => {
30
- vi.mocked(consola).prompt.mockResolvedValueOnce("invalid");
31
- vi.mocked(consola).prompt.mockResolvedValueOnce("ftp://abc.com");
32
- vi.mocked(consola).prompt.mockResolvedValueOnce("http://abc.com");
33
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
34
- expect(await promptFoundryUrl({})).toEqual(valid);
35
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(4);
36
- });
37
- test("it accepts valid initial value without prompt", async () => {
38
- expect(await promptFoundryUrl({
39
- foundryUrl: valid
40
- })).toEqual(valid);
41
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
42
- });
43
- test("it prompts if initial value is invalid", async () => {
44
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
45
- expect(await promptFoundryUrl({
46
- foundryUrl: "invalid"
47
- })).toEqual(valid);
48
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
49
- });
50
- test("it strips trailing slash from url", async () => {
51
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid + "/");
52
- expect(await promptFoundryUrl({})).toEqual(valid);
53
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
54
- });
55
- //# sourceMappingURL=promptFoundryUrl.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptFoundryUrl.test.js","names":["afterEach","expect","test","vi","consola","promptFoundryUrl","mock","restoreAllMocks","valid","mocked","prompt","mockResolvedValueOnce","toEqual","toHaveBeenCalledTimes","foundryUrl","not","toHaveBeenCalled"],"sources":["promptFoundryUrl.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 { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptFoundryUrl } from \"./promptFoundryUrl.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\nconst valid = \"https://example.palantirfoundry.com\";\ntest(\"it accepts valid foundry url from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptFoundryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it prompts again if answered value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"invalid\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"ftp://abc.com\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"http://abc.com\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptFoundryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(4);\n});\ntest(\"it accepts valid initial value without prompt\", async () => {\n expect(await promptFoundryUrl({ foundryUrl: valid })).toEqual(valid);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptFoundryUrl({ foundryUrl: \"invalid\" })).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it strips trailing slash from url\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid + \"/\");\n expect(await promptFoundryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,gBAAgB,QAAQ,uBAAuB;AACxDF,EAAE,CAACG,IAAI,CAAC,eAAe,CAAC;AACxBN,SAAS,CAAC,MAAM;EACZG,EAAE,CAACI,eAAe,CAAC,CAAC;AACxB,CAAC,CAAC;AACF,MAAMC,KAAK,GAAG,qCAAqC;AACnDN,IAAI,CAAC,0CAA0C,EAAE,YAAY;EACzDC,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,qBAAqB,CAACH,KAAK,CAAC;EACtDP,MAAM,CAAC,MAAMI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAACO,OAAO,CAACJ,KAAK,CAAC;EACjDP,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AACFX,IAAI,CAAC,+CAA+C,EAAE,YAAY;EAC9DC,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,qBAAqB,CAAC,SAAS,CAAC;EAC1DR,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,qBAAqB,CAAC,eAAe,CAAC;EAChER,E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C,CAAC,CAAC,CAACO,OAAO,CAACJ,KAAK,CAAC;EACjDP,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,31 +0,0 @@
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 { consola } from "../consola.js";
17
- import { italic } from "../highlight.js";
18
- export async function promptOsdkPackage({
19
- osdkPackage
20
- }) {
21
- while (osdkPackage == null || !/^@[a-z0-9-]+\/sdk$/.test(osdkPackage)) {
22
- if (osdkPackage != null) {
23
- consola.fail("Please enter a valid OSDK package name");
24
- }
25
- osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:\n${italic("(Example: @my-app/sdk)")}`, {
26
- type: "text"
27
- });
28
- }
29
- return osdkPackage;
30
- }
31
- //# sourceMappingURL=promptOsdkPackage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptOsdkPackage.js","names":["consola","italic","promptOsdkPackage","osdkPackage","test","fail","prompt","type"],"sources":["promptOsdkPackage.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 { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({ osdkPackage }) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:\\n${italic(\"(Example: @my-app/sdk)\")}`, { type: \"text\" });\n }\n return osdkPackage;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAO,eAAeC,iBAAiBA,CAAC;EAAEC;AAAY,CAAC,EAAE;EACrD,OAAOA,WAAW,IAAI,IAAI,IAAI,CAAC,oBAAoB,CAACC,IAAI,CAACD,WAAW,CAAC,EAAE;IACnE,IAAIA,WAAW,IAAI,IAAI,EAAE;MACrBH,OAAO,CAACK,IAAI,CAAC,wCAAwC,CAAC;IAC1D;IACAF,WAAW,GAAG,MAAMH,OAAO,CAACM,MAAM,CAAC,6EAA6EL,MAAM,CAAC,wBAAwB,CAAC,EAAE,EAAE;MAAEM,IAAI,EAAE;IAAO,CAAC,CAAC;EACzK;EACA,OAAOJ,WAAW;AACtB","ignoreList":[]}
@@ -1,48 +0,0 @@
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 { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { promptOsdkPackage } from "./promptOsdkPackage.js";
19
- vi.mock("../consola.js");
20
- afterEach(() => {
21
- vi.restoreAllMocks();
22
- });
23
- test("it accepts valid osdk package from prompt", async () => {
24
- vi.mocked(consola).prompt.mockResolvedValueOnce("@myapp/sdk");
25
- expect(await promptOsdkPackage({})).toEqual("@myapp/sdk");
26
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
27
- });
28
- test("it prompts again if answered value is invalid", async () => {
29
- vi.mocked(consola).prompt.mockResolvedValueOnce("some-package");
30
- vi.mocked(consola).prompt.mockResolvedValueOnce("@some/package");
31
- vi.mocked(consola).prompt.mockResolvedValueOnce("@myapp/sdk");
32
- expect(await promptOsdkPackage({})).toEqual("@myapp/sdk");
33
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(3);
34
- });
35
- test("it accepts valid initial value without prompt", async () => {
36
- expect(await promptOsdkPackage({
37
- osdkPackage: "@myapp/sdk"
38
- })).toEqual("@myapp/sdk");
39
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
40
- });
41
- test("it prompts if initial value is invalid", async () => {
42
- vi.mocked(consola).prompt.mockResolvedValueOnce("@myapp/sdk");
43
- expect(await promptOsdkPackage({
44
- osdkPackage: "some-package"
45
- })).toEqual("@myapp/sdk");
46
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
47
- });
48
- //# sourceMappingURL=promptOsdkPackage.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptOsdkPackage.test.js","names":["afterEach","expect","test","vi","consola","promptOsdkPackage","mock","restoreAllMocks","mocked","prompt","mockResolvedValueOnce","toEqual","toHaveBeenCalledTimes","osdkPackage","not","toHaveBeenCalled"],"sources":["promptOsdkPackage.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 { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptOsdkPackage } from \"./promptOsdkPackage.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\ntest(\"it accepts valid osdk package from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"@myapp/sdk\");\n expect(await promptOsdkPackage({})).toEqual(\"@myapp/sdk\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it prompts again if answered value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"some-package\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"@some/package\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"@myapp/sdk\");\n expect(await promptOsdkPackage({})).toEqual(\"@myapp/sdk\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(3);\n});\ntest(\"it accepts valid initial value without prompt\", async () => {\n expect(await promptOsdkPackage({ osdkPackage: \"@myapp/sdk\" })).toEqual(\"@myapp/sdk\");\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"@myapp/sdk\");\n expect(await promptOsdkPackage({ osdkPackage: \"some-package\" })).toEqual(\"@myapp/sdk\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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EQ,WAAW,EAAE;EAAa,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,YAAY,CAAC;EACpFV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACK,GAAG,CAACC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC;AACFb,IAAI,CAAC,wCAAwC,EAAE,YAAY;EACvDC,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAACC,qBAAqB,CAAC,YAAY,CAAC;EAC7DT,MAAM,CAAC,MAAMI,iBAAiB,CAAC;IAAEQ,WAAW,EAAE;EAAe,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,YAAY,CAAC;EACtFV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,31 +0,0 @@
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 { consola } from "../consola.js";
17
- import { italic } from "../highlight.js";
18
- export async function promptOsdkRegistryUrl({
19
- osdkRegistryUrl
20
- }) {
21
- while (osdkRegistryUrl == null || !/^https:\/\/[^/]+\/artifacts\/api\/repositories\/ri\.artifacts\.[^/]+\/contents\/release\/npm\/?$/.test(osdkRegistryUrl)) {
22
- if (osdkRegistryUrl != null) {
23
- consola.fail("Please enter a valid NPM registry URL to install your OSDK package");
24
- }
25
- osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:\n${italic("(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)")}`, {
26
- type: "text"
27
- });
28
- }
29
- return osdkRegistryUrl.replace(/\/$/, "");
30
- }
31
- //# sourceMappingURL=promptOsdkRegistryUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptOsdkRegistryUrl.js","names":["consola","italic","promptOsdkRegistryUrl","osdkRegistryUrl","test","fail","prompt","type","replace"],"sources":["promptOsdkRegistryUrl.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 { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({ osdkRegistryUrl }) {\n while (osdkRegistryUrl == null\n || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.artifacts\\.[^/]+\\/contents\\/release\\/npm\\/?$/\n .test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, { type: \"text\" });\n }\n return osdkRegistryUrl.replace(/\\/$/, \"\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAO,eAAeC,qBAAqBA,CAAC;EAAEC;AAAgB,CAAC,EAAE;EAC7D,OAAOA,eAAe,IAAI,IAAI,IACvB,CAAC,kGAAkG,CACjGC,IAAI,CAACD,eAAe,CAAC,EAAE;IAC5B,IAAIA,eAAe,IAAI,IAAI,EAAE;MACzBH,OAAO,CAACK,IAAI,CAAC,oEAAoE,CAAC;IACtF;IACAF,eAAe,GAAG,MAAMH,OAAO,CAACM,MAAM,CAAC,oFAAoFL,MAAM,CAAC,kKAAkK,CAAC,EAAE,EAAE;MAAEM,IAAI,EAAE;IAAO,CAAC,CAAC;EAC9T;EACA,OAAOJ,eAAe,CAACK,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAC7C","ignoreList":[]}
@@ -1,54 +0,0 @@
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 { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { promptOsdkRegistryUrl } from "./promptOsdkRegistryUrl.js";
19
- vi.mock("../consola.js");
20
- afterEach(() => {
21
- vi.restoreAllMocks();
22
- });
23
- const valid = "https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm";
24
- test("it accepts valid osdk registry url from prompt", async () => {
25
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
26
- expect(await promptOsdkRegistryUrl({})).toEqual(valid);
27
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
28
- });
29
- test("it prompts again if answered value is invalid", async () => {
30
- vi.mocked(consola).prompt.mockResolvedValueOnce("invalid");
31
- vi.mocked(consola).prompt.mockResolvedValueOnce("https://abc.com/something");
32
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
33
- expect(await promptOsdkRegistryUrl({})).toEqual(valid);
34
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(3);
35
- });
36
- test("it accepts valid initial value without prompt", async () => {
37
- expect(await promptOsdkRegistryUrl({
38
- osdkRegistryUrl: valid
39
- })).toEqual(valid);
40
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
41
- });
42
- test("it prompts if initial value is invalid", async () => {
43
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid);
44
- expect(await promptOsdkRegistryUrl({
45
- osdkRegistryUrl: "invalid"
46
- })).toEqual(valid);
47
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
48
- });
49
- test("it strips trailing slash from url", async () => {
50
- vi.mocked(consola).prompt.mockResolvedValueOnce(valid + "/");
51
- expect(await promptOsdkRegistryUrl({})).toEqual(valid);
52
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
53
- });
54
- //# sourceMappingURL=promptOsdkRegistryUrl.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptOsdkRegistryUrl.test.js","names":["afterEach","expect","test","vi","consola","promptOsdkRegistryUrl","mock","restoreAllMocks","valid","mocked","prompt","mockResolvedValueOnce","toEqual","toHaveBeenCalledTimes","osdkRegistryUrl","not","toHaveBeenCalled"],"sources":["promptOsdkRegistryUrl.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 { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptOsdkRegistryUrl } from \"./promptOsdkRegistryUrl.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\nconst valid = \"https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm\";\ntest(\"it accepts valid osdk registry url from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptOsdkRegistryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it prompts again if answered value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"invalid\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"https://abc.com/something\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptOsdkRegistryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(3);\n});\ntest(\"it accepts valid initial value without prompt\", async () => {\n expect(await promptOsdkRegistryUrl({ osdkRegistryUrl: valid })).toEqual(valid);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid);\n expect(await promptOsdkRegistryUrl({ osdkRegistryUrl: \"invalid\" })).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it strips trailing slash from url\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(valid + \"/\");\n expect(await promptOsdkRegistryUrl({})).toEqual(valid);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"A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,CAAC,CAAC;AACFX,IAAI,CAAC,+CAA+C,EAAE,YAAY;EAC9DD,MAAM,CAAC,MAAMI,qBAAqB,CAAC;IAAES,eAAe,EAAEN;EAAM,CAAC,CAAC,CAAC,CAACI,OAAO,CAACJ,KAAK,CAAC;EAC9EP,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACK,GAAG,CAACC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC;AACFd,IAAI,CAAC,wCAAwC,EAAE,YAAY;EACvDC,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,qBAAqB,CAACH,KAAK,CAAC;EACtDP,MAAM,CAAC,MAAMI,qBAAqB,CAAC;IAAES,eAAe,EAAE;EAAU,CAAC,CAAC,CAAC,CAACF,OAAO,CAACJ,KAAK,CAAC;EAClFP,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AACFX,IAAI,CAAC,mCAAmC,EAAE,YAAY;EAClDC,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,qBAAqB,CAACH,KAAK,GAAG,GAAG,CAAC;EAC5DP,MAAM,CAAC,MAAMI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAACO,OAAO,CAACJ,KAAK,CAAC;EACtDP,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,53 +0,0 @@
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 fs from "node:fs";
17
- import path from "node:path";
18
- import { consola } from "../consola.js";
19
- import { green } from "../highlight.js";
20
- export async function promptOverwrite({
21
- project,
22
- overwrite
23
- }) {
24
- if (overwrite != null) {
25
- return overwrite;
26
- }
27
- if (!fs.existsSync(path.join(process.cwd(), project))) {
28
- return true;
29
- }
30
- const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {
31
- type: "select",
32
- options: [{
33
- label: "Remove existing files and continue",
34
- value: "overwrite"
35
- }, {
36
- label: "Ignore files and continue",
37
- value: "ignore"
38
- }, {
39
- label: "Cancel",
40
- value: "cancel"
41
- }]
42
- });
43
- switch (result) {
44
- case "overwrite":
45
- return true;
46
- case "ignore":
47
- return false;
48
- case "cancel":
49
- consola.fail("Operation cancelled");
50
- process.exit(0);
51
- }
52
- }
53
- //# sourceMappingURL=promptOverwrite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptOverwrite.js","names":["fs","path","consola","green","promptOverwrite","project","overwrite","existsSync","join","process","cwd","result","prompt","type","options","label","value","fail","exit"],"sources":["promptOverwrite.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 fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({ project, overwrite, }) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = (await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [\n { label: \"Remove existing files and continue\", value: \"overwrite\" },\n { label: \"Ignore files and continue\", value: \"ignore\" },\n { label: \"Cancel\", value: \"cancel\" },\n ],\n }));\n switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,OAAO,eAAeC,eAAeA,CAAC;EAAEC,OAAO;EAAEC;AAAW,CAAC,EAAE;EAC3D,IAAIA,SAAS,IAAI,IAAI,EAAE;IACnB,OAAOA,SAAS;EACpB;EACA,IAAI,CAACN,EAAE,CAACO,UAAU,CAACN,IAAI,CAACO,IAAI,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEL,OAAO,CAAC,CAAC,EAAE;IACnD,OAAO,IAAI;EACf;EACA,MAAMM,MAAM,GAAI,MAAMT,OAAO,CAACU,MAAM,CAAC,iBAAiBT,KAAK,CAACE,OAAO,CAAC,wDAAwD,EAAE;IAC1HQ,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,CACL;MAAEC,KAAK,EAAE,oCAAoC;MAAEC,KAAK,EAAE;IAAY,CAAC,EACnE;MAAED,KAAK,EAAE,2BAA2B;MAAEC,KAAK,EAAE;IAAS,CAAC,EACvD;MAAED,KAAK,EAAE,QAAQ;MAAEC,KAAK,EAAE;IAAS,CAAC;EAE5C,CAAC,CAAE;EACH,QAAQL,MAAM;IACV,KAAK,WAAW;MACZ,OAAO,IAAI;IACf,KAAK,QAAQ;MACT,OAAO,KAAK;IAChB,KAAK,QAAQ;MACTT,OAAO,CAACe,IAAI,CAAC,qBAAqB,CAAC;MACnCR,OAAO,CAACS,IAAI,CAAC,CAAC,CAAC;EACvB;AACJ","ignoreList":[]}
@@ -1,55 +0,0 @@
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 fs from "node:fs";
17
- import { afterEach, expect, test, vi } from "vitest";
18
- import { consola } from "../consola.js";
19
- import { promptOverwrite } from "./promptOverwrite.js";
20
- vi.mock("../consola.js");
21
- vi.mock("node:fs");
22
- afterEach(() => {
23
- vi.restoreAllMocks();
24
- });
25
- test("it accepts valid 'overwrite' from prompt", async () => {
26
- vi.mocked(fs.existsSync).mockReturnValueOnce(true);
27
- vi.mocked(consola).prompt.mockResolvedValueOnce("overwrite");
28
- expect(await promptOverwrite({
29
- project: "abc"
30
- })).toBe(true);
31
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
32
- });
33
- test("it accepts valid 'ignore' from prompt", async () => {
34
- vi.mocked(fs.existsSync).mockReturnValueOnce(true);
35
- vi.mocked(consola).prompt.mockResolvedValueOnce("ignore");
36
- expect(await promptOverwrite({
37
- project: "abc"
38
- })).toBe(false);
39
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
40
- });
41
- test("it accepts initial value without prompt", async () => {
42
- expect(await promptOverwrite({
43
- project: "abc",
44
- overwrite: true
45
- })).toBe(true);
46
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
47
- });
48
- test("it returns true if project does not already exist", async () => {
49
- vi.mocked(fs.existsSync).mockReturnValueOnce(false);
50
- expect(await promptOverwrite({
51
- project: "abc"
52
- })).toBe(true);
53
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
54
- });
55
- //# sourceMappingURL=promptOverwrite.test.js.map