@osdk/cli 0.25.0-beta.24 → 0.25.0-beta.26

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 (68) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/esm/{chunk-A75R3CG3.js → chunk-E54HEYOJ.js} +7 -3
  3. package/build/esm/chunk-E54HEYOJ.js.map +1 -0
  4. package/build/esm/chunk-I7LYTQVK.js +28 -0
  5. package/build/esm/chunk-I7LYTQVK.js.map +1 -0
  6. package/build/esm/{chunk-JJ3PTQQF.js → chunk-IFVGRX2I.js} +86 -4
  7. package/build/esm/chunk-IFVGRX2I.js.map +1 -0
  8. package/build/esm/{handleGenerate-4M4IJLDH.js → handleGenerate-MQ6KGQOR.js} +26 -24
  9. package/build/esm/handleGenerate-MQ6KGQOR.js.map +1 -0
  10. package/build/esm/index.js +255 -43
  11. package/build/esm/index.js.map +1 -1
  12. package/build/esm/{siteDeployCommand-K6P5V63N.js → siteDeployCommand-FTBIPGEM.js} +4 -4
  13. package/build/esm/{siteDeployCommand-K6P5V63N.js.map → siteDeployCommand-FTBIPGEM.js.map} +1 -1
  14. package/build/esm/versionDeleteCommand-2WGNK2O2.js +49 -0
  15. package/build/esm/versionDeleteCommand-2WGNK2O2.js.map +1 -0
  16. package/build/esm/{versionDeleteCommand-L3KQCIA5.js → versionDeleteCommand-AHCKSR52.js} +3 -3
  17. package/build/esm/{versionDeleteCommand-L3KQCIA5.js.map → versionDeleteCommand-AHCKSR52.js.map} +1 -1
  18. package/build/esm/{versionGetCommand-ZN3TMDNT.js → versionGetCommand-UUR5NT3X.js} +3 -3
  19. package/build/esm/{versionGetCommand-ZN3TMDNT.js.map → versionGetCommand-UUR5NT3X.js.map} +1 -1
  20. package/build/esm/versionInfoCommand-X7FLLHPQ.js +27 -0
  21. package/build/esm/versionInfoCommand-X7FLLHPQ.js.map +1 -0
  22. package/build/esm/versionListCommand-YSILHJ2M.js +34 -0
  23. package/build/esm/versionListCommand-YSILHJ2M.js.map +1 -0
  24. package/build/esm/{versionListCommand-IPV2XYUS.js → versionListCommand-ZLNWGKST.js} +3 -3
  25. package/build/esm/{versionListCommand-IPV2XYUS.js.map → versionListCommand-ZLNWGKST.js.map} +1 -1
  26. package/build/esm/{versionSetCommand-3JNUMKPJ.js → versionSetCommand-OGLUPAGA.js} +3 -3
  27. package/build/esm/{versionSetCommand-3JNUMKPJ.js.map → versionSetCommand-OGLUPAGA.js.map} +1 -1
  28. package/build/esm/{versionUnsetCommand-2MVI4QSF.js → versionUnsetCommand-3SWYETJT.js} +3 -3
  29. package/build/esm/{versionUnsetCommand-2MVI4QSF.js.map → versionUnsetCommand-3SWYETJT.js.map} +1 -1
  30. package/build/esm/widgetSetDeployCommand-KSSTV7H6.js +92 -0
  31. package/build/esm/widgetSetDeployCommand-KSSTV7H6.js.map +1 -0
  32. package/build/types/commands/site/deploy/{logDeployCommandConfigFileOverride.d.ts → logSiteDeployCommandConfigFileOverride.d.ts} +1 -1
  33. package/build/types/commands/widgetset/CommonWidgetSetArgs.d.ts +8 -0
  34. package/build/types/commands/widgetset/deploy/WidgetSetDeployArgs.d.ts +6 -0
  35. package/build/types/commands/widgetset/deploy/index.d.ts +5 -0
  36. package/build/types/commands/widgetset/deploy/logWidgetSetDeployCommandConfigFileOverride.d.ts +4 -0
  37. package/build/types/commands/widgetset/deploy/widgetSetDeployCommand.d.mts +2 -0
  38. package/build/types/commands/widgetset/index.d.ts +5 -0
  39. package/build/types/commands/widgetset/logWidgetSetCommandConfigFileOverride.d.ts +4 -0
  40. package/build/types/commands/widgetset/version/delete/VersionDeleteArgs.d.ts +5 -0
  41. package/build/types/commands/widgetset/version/delete/index.d.ts +5 -0
  42. package/build/types/commands/widgetset/version/delete/versionDeleteCommand.d.mts +2 -0
  43. package/build/types/commands/widgetset/version/index.d.ts +4 -0
  44. package/build/types/commands/widgetset/version/info/VersionInfoArgs.d.ts +4 -0
  45. package/build/types/commands/widgetset/version/info/index.d.ts +5 -0
  46. package/build/types/commands/widgetset/version/info/versionInfoCommand.d.mts +2 -0
  47. package/build/types/commands/widgetset/version/list/VersionListArgs.d.ts +2 -0
  48. package/build/types/commands/widgetset/version/list/index.d.ts +5 -0
  49. package/build/types/commands/widgetset/version/list/versionListCommand.d.mts +2 -0
  50. package/build/types/net/StemmaRepositoryRid.d.ts +1 -0
  51. package/build/types/net/WidgetSetRid.d.ts +1 -0
  52. package/build/types/net/index.d.mts +1 -0
  53. package/build/types/net/widget-registry/ListWidgetSetReleasesResponse.d.mts +5 -0
  54. package/build/types/net/widget-registry/WidgetSetLocator.d.mts +16 -0
  55. package/build/types/net/widget-registry/WidgetSetRelease.d.mts +13 -0
  56. package/build/types/net/widget-registry/deleteSiteVersion.d.mts +4 -0
  57. package/build/types/net/widget-registry/deleteWidgetSetRelease.d.mts +3 -0
  58. package/build/types/net/widget-registry/getWidgetSetRelease.d.mts +4 -0
  59. package/build/types/net/widget-registry/index.d.mts +8 -0
  60. package/build/types/net/widget-registry/listWidgetSetReleases.d.mts +4 -0
  61. package/build/types/net/widget-registry/publishManifest.d.mts +4 -0
  62. package/build/types/net/widget-registry/uploadSiteVersion.d.mts +4 -0
  63. package/build/types/util/configLoader.d.ts +3 -1
  64. package/build/types/yargs/logConfigFileMiddleware.d.ts +1 -1
  65. package/package.json +15 -14
  66. package/build/esm/chunk-A75R3CG3.js.map +0 -1
  67. package/build/esm/chunk-JJ3PTQQF.js.map +0 -1
  68. package/build/esm/handleGenerate-4M4IJLDH.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-JJ3PTQQF.js';
1
+ import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-IFVGRX2I.js';
2
2
  import './chunk-DIMPWQUF.js';
3
3
  import './chunk-4H3N4CJV.js';
4
4
  import { init_esm_shims } from './chunk-MGJFR5AW.js';
@@ -26,5 +26,5 @@ async function versionSetCommand({
26
26
  }
27
27
 
28
28
  export { versionSetCommand as default };
29
- //# sourceMappingURL=versionSetCommand-3JNUMKPJ.js.map
30
- //# sourceMappingURL=versionSetCommand-3JNUMKPJ.js.map
29
+ //# sourceMappingURL=versionSetCommand-OGLUPAGA.js.map
30
+ //# sourceMappingURL=versionSetCommand-OGLUPAGA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/site/version/set/versionSetCommand.mts"],"names":[],"mappings":";;;;;;;AAAA,cAAA,EAAA,CAAA;AAmBA,eAAO,iBAAyC,CAAA;AAAA,EAC9C,OAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AACF,CAAG,EAAA;AACD,EAAA,OAAA,CAAQ,MAAM,CAAsB,oBAAA,CAAA,CAAA,CAAA;AACpC,EAAA,MAAM,WAAc,GAAA,MAAM,SAAU,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACpD,EAAA,MAAM,gBAAgB,MAAM,WAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,2BAA4B,CAAA,UAAA,EAAY,aAAa,CAAA,CAAA;AACvE,EAAA,IAAI,OAAS,EAAA;AACX,IAAM,MAAA,gCAAA,CAAuB,aAAc,CAAA,SAAA,EAAW,WAAa,EAAA;AAAA,MACjE,OAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACA,EAAQ,OAAA,CAAA,OAAA,CAAQ,CAAuB,oBAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAClD","file":"versionSetCommand-3JNUMKPJ.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\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionSetCommand({\n version,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n consola.start(`Setting live version`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n if (version) {\n await thirdPartyApplications.deployWebsite(clientCtx, application, {\n version\n });\n }\n consola.success(`Set live version to ${version}`);\n}"]}
1
+ {"version":3,"sources":["../../src/commands/site/version/set/versionSetCommand.mts"],"names":[],"mappings":";;;;;;;AAAA,cAAA,EAAA,CAAA;AAmBA,eAAO,iBAAyC,CAAA;AAAA,EAC9C,OAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AACF,CAAG,EAAA;AACD,EAAA,OAAA,CAAQ,MAAM,CAAsB,oBAAA,CAAA,CAAA,CAAA;AACpC,EAAA,MAAM,WAAc,GAAA,MAAM,SAAU,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACpD,EAAA,MAAM,gBAAgB,MAAM,WAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,2BAA4B,CAAA,UAAA,EAAY,aAAa,CAAA,CAAA;AACvE,EAAA,IAAI,OAAS,EAAA;AACX,IAAM,MAAA,gCAAA,CAAuB,aAAc,CAAA,SAAA,EAAW,WAAa,EAAA;AAAA,MACjE,OAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACA,EAAQ,OAAA,CAAA,OAAA,CAAQ,CAAuB,oBAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAClD","file":"versionSetCommand-OGLUPAGA.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\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionSetCommand({\n version,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n consola.start(`Setting live version`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n if (version) {\n await thirdPartyApplications.deployWebsite(clientCtx, application, {\n version\n });\n }\n consola.success(`Set live version to ${version}`);\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { handlePromptCancel } from './chunk-Z4H6TTTJ.js';
2
- import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-JJ3PTQQF.js';
2
+ import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-IFVGRX2I.js';
3
3
  import './chunk-DIMPWQUF.js';
4
4
  import './chunk-4H3N4CJV.js';
5
5
  import { init_esm_shims } from './chunk-MGJFR5AW.js';
@@ -31,5 +31,5 @@ ${colorize("bold", "Your site will no longer be accessible until a new live site
31
31
  }
32
32
 
33
33
  export { versionUnsetCommand as default };
34
- //# sourceMappingURL=versionUnsetCommand-2MVI4QSF.js.map
35
- //# sourceMappingURL=versionUnsetCommand-2MVI4QSF.js.map
34
+ //# sourceMappingURL=versionUnsetCommand-3SWYETJT.js.map
35
+ //# sourceMappingURL=versionUnsetCommand-3SWYETJT.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/site/version/unset/versionUnsetCommand.mts"],"names":[],"mappings":";;;;;;;;;AAAA,cAAA,EAAA,CAAA;AAqBA,eAAO,mBAA2C,CAAA;AAAA,EAChD,GAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AACF,CAAG,EAAA;AACD,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAM,MAAA,SAAA,GAAY,MAAM,OAAA,CAAQ,MAAO,CAAA,CAAA;AAAA,EAA0D,QAAS,CAAA,MAAA,EAAQ,8EAA8E,CAAC,CAAI,CAAA,EAAA;AAAA,MACnM,IAAM,EAAA,SAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,kBAAA,CAAmB,SAAS,CAAA,CAAA;AAAA,GAC9B;AACA,EAAA,MAAM,WAAc,GAAA,MAAM,SAAU,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACpD,EAAA,MAAM,gBAAgB,MAAM,WAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,2BAA4B,CAAA,UAAA,EAAY,aAAa,CAAA,CAAA;AACvE,EAAA,OAAA,CAAQ,MAAM,4BAA4B,CAAA,CAAA;AAC1C,EAAM,MAAA,gCAAA,CAAuB,eAAgB,CAAA,SAAA,EAAW,WAAW,CAAA,CAAA;AACnE,EAAA,OAAA,CAAQ,QAAQ,2BAA2B,CAAA,CAAA;AAC7C","file":"versionUnsetCommand-2MVI4QSF.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\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionUnsetCommand({\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to clear the live site version?\\n${colorize(\"bold\", \"Your site will no longer be accessible until a new live site version is set.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Clearing live site version\");\n await thirdPartyApplications.undeployWebsite(clientCtx, application);\n consola.success(\"Cleared live site version\");\n}"]}
1
+ {"version":3,"sources":["../../src/commands/site/version/unset/versionUnsetCommand.mts"],"names":[],"mappings":";;;;;;;;;AAAA,cAAA,EAAA,CAAA;AAqBA,eAAO,mBAA2C,CAAA;AAAA,EAChD,GAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AACF,CAAG,EAAA;AACD,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAM,MAAA,SAAA,GAAY,MAAM,OAAA,CAAQ,MAAO,CAAA,CAAA;AAAA,EAA0D,QAAS,CAAA,MAAA,EAAQ,8EAA8E,CAAC,CAAI,CAAA,EAAA;AAAA,MACnM,IAAM,EAAA,SAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,kBAAA,CAAmB,SAAS,CAAA,CAAA;AAAA,GAC9B;AACA,EAAA,MAAM,WAAc,GAAA,MAAM,SAAU,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACpD,EAAA,MAAM,gBAAgB,MAAM,WAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,2BAA4B,CAAA,UAAA,EAAY,aAAa,CAAA,CAAA;AACvE,EAAA,OAAA,CAAQ,MAAM,4BAA4B,CAAA,CAAA;AAC1C,EAAM,MAAA,gCAAA,CAAuB,eAAgB,CAAA,SAAA,EAAW,WAAW,CAAA,CAAA;AACnE,EAAA,OAAA,CAAQ,QAAQ,2BAA2B,CAAA,CAAA;AAC7C","file":"versionUnsetCommand-3SWYETJT.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\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionUnsetCommand({\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to clear the live site version?\\n${colorize(\"bold\", \"Your site will no longer be accessible until a new live site version is set.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Clearing live site version\");\n await thirdPartyApplications.undeployWebsite(clientCtx, application);\n consola.success(\"Cleared live site version\");\n}"]}
@@ -0,0 +1,92 @@
1
+ import { loadToken, createInternalClientContext, widget_registry_exports } from './chunk-IFVGRX2I.js';
2
+ import './chunk-DIMPWQUF.js';
3
+ import { MANIFEST_FILE_LOCATION } from './chunk-I7LYTQVK.js';
4
+ import { ExitProcessError } from './chunk-4H3N4CJV.js';
5
+ import { init_esm_shims } from './chunk-MGJFR5AW.js';
6
+ import archiver from 'archiver';
7
+ import { consola } from 'consola';
8
+ import * as fs from 'fs';
9
+ import path from 'path';
10
+ import { Readable } from 'stream';
11
+ import prettyBytes from 'pretty-bytes';
12
+
13
+ // src/commands/widgetset/deploy/widgetSetDeployCommand.mts
14
+ init_esm_shims();
15
+ async function widgetSetDeployCommand({
16
+ widgetSet,
17
+ foundryUrl,
18
+ directory,
19
+ repository,
20
+ token,
21
+ tokenFile
22
+ }) {
23
+ const loadedToken = await loadToken(token, tokenFile);
24
+ const tokenProvider = () => loadedToken;
25
+ const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
26
+ consola.debug(`Using directory for widget set files: "${path.resolve(directory)}`);
27
+ const stat = await fs.promises.stat(directory);
28
+ if (!stat.isDirectory()) {
29
+ throw new ExitProcessError(2, "Specified path exists but is not a directory");
30
+ }
31
+ const widgetSetVersion = await findWidgetSetVersion(directory);
32
+ consola.info(`Found version from manifest: ${widgetSetVersion}`);
33
+ consola.start("Zipping widget set files");
34
+ const archive = archiver("zip").directory(directory, false);
35
+ logArchiveStats(archive);
36
+ let deployRid = widgetSet;
37
+ if (repository != null) {
38
+ deployRid = repository;
39
+ consola.debug(`Deploying to repository ${repository} for ${widgetSet}`);
40
+ }
41
+ consola.start("Uploading widget set files");
42
+ await Promise.all([widget_registry_exports.uploadSiteVersion(
43
+ clientCtx,
44
+ deployRid,
45
+ widgetSetVersion,
46
+ Readable.toWeb(archive)
47
+ // This cast is because the dom fetch doesn't align type wise with streams
48
+ ), archive.finalize()]);
49
+ consola.success("Upload complete");
50
+ consola.start("Publishing widget set manifest");
51
+ try {
52
+ await widget_registry_exports.publishManifest(clientCtx, deployRid, widgetSetVersion);
53
+ consola.success(`Deployed ${widgetSetVersion} successfully`);
54
+ } catch (e) {
55
+ consola.fail("Failed to publish manifest, cleaning up");
56
+ await widget_registry_exports.deleteSiteVersion(clientCtx, deployRid, widgetSetVersion);
57
+ throw e;
58
+ }
59
+ }
60
+ async function findWidgetSetVersion(directory) {
61
+ try {
62
+ const manifestContent = await fs.promises.readFile(path.resolve(directory, MANIFEST_FILE_LOCATION), "utf8");
63
+ const manifest = JSON.parse(manifestContent);
64
+ if (manifest.widgetSet == null || manifest.widgetSet.version == null) {
65
+ throw new Error(`Unable to find widget set version in manifest`);
66
+ }
67
+ return manifest.widgetSet.version;
68
+ } catch (e) {
69
+ throw new ExitProcessError(2, `Unable to process manifest at ${MANIFEST_FILE_LOCATION}${e instanceof Error ? `: ${e.message}` : ""}`);
70
+ }
71
+ }
72
+ function logArchiveStats(archive) {
73
+ let archiveStats = {
74
+ fileCount: 0,
75
+ bytes: 0
76
+ };
77
+ archive.on("progress", (progress) => {
78
+ archiveStats = {
79
+ fileCount: progress.entries.total,
80
+ bytes: progress.fs.totalBytes
81
+ };
82
+ });
83
+ archive.on("finish", () => {
84
+ consola.info(`Zipped ${prettyBytes(archiveStats.bytes, {
85
+ binary: true
86
+ })} total over ${archiveStats.fileCount} files`);
87
+ });
88
+ }
89
+
90
+ export { widgetSetDeployCommand as default };
91
+ //# sourceMappingURL=widgetSetDeployCommand-KSSTV7H6.js.map
92
+ //# sourceMappingURL=widgetSetDeployCommand-KSSTV7H6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/widgetset/deploy/widgetSetDeployCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,cAAA,EAAA,CAAA;AA0BA,eAAO,sBAA8C,CAAA;AAAA,EACnD,SAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AACF,CAAG,EAAA;AACD,EAAA,MAAM,WAAc,GAAA,MAAM,SAAU,CAAA,KAAA,EAAO,SAAS,CAAA,CAAA;AACpD,EAAA,MAAM,gBAAgB,MAAM,WAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,2BAA4B,CAAA,UAAA,EAAY,aAAa,CAAA,CAAA;AACvE,EAAA,OAAA,CAAQ,MAAM,CAA0C,uCAAA,EAAA,IAAA,CAAK,OAAQ,CAAA,SAAS,CAAC,CAAE,CAAA,CAAA,CAAA;AACj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,EAAA,CAAA;AAAA,GACT,CAAA;AACA,EAAQ,OAAA,CAAA,EAAA,CAAG,YAAY,CAAY,QAAA,KAAA;AACjC,IAAe,YAAA,GAAA;AAAA,MACb,SAAA,EAAW,SAAS,OAAQ,CAAA,KAAA;AAAA,MAC5B,KAAA,EAAO,SAAS,EAAG,CAAA,UAAA;AAAA,KACrB,CAAA;AAAA,GACD,CAAA,CAAA;AACD,EAAQ,OAAA,CAAA,EAAA,CAAG,UAAU,MAAM;AACzB,IAAA,OAAA,CAAQ,IAAK,CAAA,CAAA,OAAA,EAAU,WAAY,CAAA,YAAA,CAAa,KAAO,EAAA;AAAA,MACrD,MAAQ,EAAA,IAAA;AAAA,KACT,CAAC,CAAe,YAAA,EAAA,YAAA,CAAa,SAAS,CAAQ,MAAA,CAAA,CAAA,CAAA;AAAA,GAChD,CAAA,CAAA;AACH","file":"widgetSetDeployCommand-KSSTV7H6.js","sourcesContent":["/*\n * Copyright 2025 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 { createInternalClientContext, widgetRegistry } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { MANIFEST_FILE_LOCATION } from \"@osdk/widget-api.unstable\";\nimport archiver from \"archiver\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport prettyBytes from \"pretty-bytes\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function widgetSetDeployCommand({\n widgetSet,\n foundryUrl,\n directory,\n repository,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.debug(`Using directory for widget set files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n const widgetSetVersion = await findWidgetSetVersion(directory);\n consola.info(`Found version from manifest: ${widgetSetVersion}`);\n consola.start(\"Zipping widget set files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n let deployRid = widgetSet;\n if (repository != null) {\n deployRid = repository;\n consola.debug(`Deploying to repository ${repository} for ${widgetSet}`);\n }\n consola.start(\"Uploading widget set files\");\n await Promise.all([widgetRegistry.uploadSiteVersion(clientCtx, deployRid, widgetSetVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesn't align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Upload complete\");\n consola.start(\"Publishing widget set manifest\");\n try {\n await widgetRegistry.publishManifest(clientCtx, deployRid, widgetSetVersion);\n consola.success(`Deployed ${widgetSetVersion} successfully`);\n } catch (e) {\n consola.fail(\"Failed to publish manifest, cleaning up\");\n await widgetRegistry.deleteSiteVersion(clientCtx, deployRid, widgetSetVersion);\n throw e;\n }\n}\nasync function findWidgetSetVersion(directory) {\n try {\n const manifestContent = await fs.promises.readFile(path.resolve(directory, MANIFEST_FILE_LOCATION), \"utf8\");\n const manifest = JSON.parse(manifestContent);\n if (manifest.widgetSet == null || manifest.widgetSet.version == null) {\n throw new Error(`Unable to find widget set version in manifest`);\n }\n return manifest.widgetSet.version;\n } catch (e) {\n throw new ExitProcessError(2, `Unable to process manifest at ${MANIFEST_FILE_LOCATION}${e instanceof Error ? `: ${e.message}` : \"\"}`);\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.info(`Zipped ${prettyBytes(archiveStats.bytes, {\n binary: true\n })} total over ${archiveStats.fileCount} files`);\n });\n}"]}
@@ -1,4 +1,4 @@
1
1
  import type { SiteConfig } from "@osdk/foundry-config-json";
2
2
  import type { Arguments } from "yargs";
3
3
  import type { SiteDeployArgs } from "./SiteDeployArgs.js";
4
- export declare function logDeployCommandConfigFileOverride(args: Arguments<SiteDeployArgs>, config: SiteConfig | undefined): Promise<void>;
4
+ export declare function logSiteDeployCommandConfigFileOverride(args: Arguments<SiteDeployArgs>, config: SiteConfig | undefined): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import type { CliCommonArgs } from "@osdk/cli.common";
2
+ import type { WidgetSetRid } from "../../net/WidgetSetRid.js";
3
+ export interface CommonWidgetSetArgs extends CliCommonArgs {
4
+ widgetSet: WidgetSetRid;
5
+ foundryUrl: string;
6
+ token?: string;
7
+ tokenFile?: string;
8
+ }
@@ -0,0 +1,6 @@
1
+ import type { StemmaRepositoryRid } from "../../../net/StemmaRepositoryRid.js";
2
+ import type { CommonWidgetSetArgs } from "../CommonWidgetSetArgs.js";
3
+ export interface WidgetSetDeployArgs extends CommonWidgetSetArgs {
4
+ directory: string;
5
+ repository?: StemmaRepositoryRid;
6
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonWidgetSetArgs } from "../CommonWidgetSetArgs.js";
3
+ import type { WidgetSetDeployArgs } from "./WidgetSetDeployArgs.js";
4
+ declare const command: CommandModule<CommonWidgetSetArgs, WidgetSetDeployArgs>;
5
+ export default command;
@@ -0,0 +1,4 @@
1
+ import type { WidgetSetConfig } from "@osdk/foundry-config-json";
2
+ import type { Arguments } from "yargs";
3
+ import type { WidgetSetDeployArgs } from "./WidgetSetDeployArgs.js";
4
+ export declare function logWidgetSetDeployCommandConfigFileOverride(args: Arguments<WidgetSetDeployArgs>, config: WidgetSetConfig | undefined): void;
@@ -0,0 +1,2 @@
1
+ import type { WidgetSetDeployArgs } from "./WidgetSetDeployArgs.js";
2
+ export default function widgetSetDeployCommand({ widgetSet, foundryUrl, directory, repository, token, tokenFile }: WidgetSetDeployArgs): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { type CliCommonArgs } from "@osdk/cli.common";
2
+ import type { CommandModule } from "yargs";
3
+ import type { CommonWidgetSetArgs } from "./CommonWidgetSetArgs.js";
4
+ declare const command: CommandModule<CliCommonArgs, CommonWidgetSetArgs>;
5
+ export default command;
@@ -0,0 +1,4 @@
1
+ import type { FoundryConfig } from "@osdk/foundry-config-json";
2
+ import type { Arguments } from "yargs";
3
+ import type { CommonWidgetSetArgs } from "./CommonWidgetSetArgs.js";
4
+ export declare function logWidgetSetCommandConfigFileOverride(args: Arguments<CommonWidgetSetArgs>, config: FoundryConfig<"widgetSet"> | undefined): void;
@@ -0,0 +1,5 @@
1
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
2
+ export interface VersionDeleteArgs extends CommonWidgetSetArgs {
3
+ version: string;
4
+ yes?: boolean;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
3
+ import type { VersionDeleteArgs } from "./VersionDeleteArgs.js";
4
+ declare const command: CommandModule<CommonWidgetSetArgs, VersionDeleteArgs>;
5
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { VersionDeleteArgs } from "./VersionDeleteArgs.js";
2
+ export default function versionDeleteCommand({ version, yes, widgetSet, foundryUrl, token, tokenFile }: VersionDeleteArgs): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonWidgetSetArgs } from "../CommonWidgetSetArgs.js";
3
+ declare const command: CommandModule<CommonWidgetSetArgs, CommonWidgetSetArgs>;
4
+ export default command;
@@ -0,0 +1,4 @@
1
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
2
+ export interface VersionInfoArgs extends CommonWidgetSetArgs {
3
+ version: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
3
+ import type { VersionInfoArgs } from "./VersionInfoArgs.js";
4
+ declare const command: CommandModule<CommonWidgetSetArgs, VersionInfoArgs>;
5
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { VersionInfoArgs } from "./VersionInfoArgs.js";
2
+ export default function versionInfoCommand({ version, foundryUrl, widgetSet, token, tokenFile }: VersionInfoArgs): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
2
+ export interface VersionListArgs extends CommonWidgetSetArgs {}
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonWidgetSetArgs } from "../../CommonWidgetSetArgs.js";
3
+ import type { VersionListArgs } from "./VersionListArgs.js";
4
+ declare const command: CommandModule<CommonWidgetSetArgs, VersionListArgs>;
5
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { VersionListArgs } from "./VersionListArgs.js";
2
+ export default function versionListCommand({ foundryUrl, widgetSet, token, tokenFile }: VersionListArgs): Promise<void>;
@@ -0,0 +1 @@
1
+ export type StemmaRepositoryRid = `ri.stemma.${string}.repository.${string}`;
@@ -0,0 +1 @@
1
+ export type WidgetSetRid = `ri.widgetregistry..widget-set.${string}`;
@@ -1,2 +1,3 @@
1
1
  export { createInternalClientContext } from "./createInternalClientContext.mjs";
2
2
  export * as thirdPartyApplications from "./third-party-applications/index.mjs";
3
+ export * as widgetRegistry from "./widget-registry/index.mjs";
@@ -0,0 +1,5 @@
1
+ import type { WidgetSetRelease } from "./WidgetSetRelease.mjs";
2
+ export interface ListWidgetSetReleasesResponse {
3
+ releases: Array<WidgetSetRelease>;
4
+ nextPageToken?: string;
5
+ }
@@ -0,0 +1,16 @@
1
+ export type WidgetSetLocator = WidgetSetLocator_InternalSitesLayout | WidgetSetLocator_ExternalSitesLayout;
2
+ export interface WidgetSetLocator_InternalSitesLayout {
3
+ type: "internalSitesLayout";
4
+ internalSitesLayout: InternalSitesLayoutLocator;
5
+ }
6
+ export interface WidgetSetLocator_ExternalSitesLayout {
7
+ type: "externalSitesLayout";
8
+ externalSitesLayout: ExternalSitesLayoutLocator;
9
+ }
10
+ export interface InternalSitesLayoutLocator {
11
+ version: string;
12
+ }
13
+ export interface ExternalSitesLayoutLocator {
14
+ repositoryRid: string;
15
+ version: string;
16
+ }
@@ -0,0 +1,13 @@
1
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
2
+ import type { WidgetSetLocator } from "./WidgetSetLocator.mjs";
3
+ export interface WidgetSetRelease {
4
+ widgetSetRid: WidgetSetRid;
5
+ widgetSetVersion: string;
6
+ locator: WidgetSetLocator;
7
+ attribution: {
8
+ userId: string;
9
+ timestamp: string;
10
+ };
11
+ description?: string;
12
+ widgetRids: string[];
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { StemmaRepositoryRid } from "../StemmaRepositoryRid.js";
3
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
4
+ export declare function deleteSiteVersion(ctx: InternalClientContext, repositoryRid: WidgetSetRid | StemmaRepositoryRid, version: string): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
3
+ export declare function deleteWidgetSetRelease(ctx: InternalClientContext, widgetSetRid: WidgetSetRid, version: string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
3
+ import type { WidgetSetRelease } from "./WidgetSetRelease.mjs";
4
+ export declare function getWidgetSetRelease(ctx: InternalClientContext, widgetSetRid: WidgetSetRid, version: string): Promise<WidgetSetRelease>;
@@ -0,0 +1,8 @@
1
+ export { deleteSiteVersion } from "./deleteSiteVersion.mjs";
2
+ export { deleteWidgetSetRelease } from "./deleteWidgetSetRelease.mjs";
3
+ export { getWidgetSetRelease } from "./getWidgetSetRelease.mjs";
4
+ export { listWidgetSetReleases } from "./listWidgetSetReleases.mjs";
5
+ export type { ListWidgetSetReleasesResponse } from "./ListWidgetSetReleasesResponse.mjs";
6
+ export { publishManifest } from "./publishManifest.mjs";
7
+ export { uploadSiteVersion } from "./uploadSiteVersion.mjs";
8
+ export type { WidgetSetRelease } from "./WidgetSetRelease.mjs";
@@ -0,0 +1,4 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
3
+ import type { ListWidgetSetReleasesResponse } from "./ListWidgetSetReleasesResponse.mjs";
4
+ export declare function listWidgetSetReleases(ctx: InternalClientContext, widgetSetRid: WidgetSetRid): Promise<ListWidgetSetReleasesResponse>;
@@ -0,0 +1,4 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { StemmaRepositoryRid } from "../StemmaRepositoryRid.js";
3
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
4
+ export declare function publishManifest(ctx: InternalClientContext, repositoryRid: WidgetSetRid | StemmaRepositoryRid, version: string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { InternalClientContext } from "../internalClientContext.mjs";
2
+ import type { StemmaRepositoryRid } from "../StemmaRepositoryRid.js";
3
+ import type { WidgetSetRid } from "../WidgetSetRid.js";
4
+ export declare function uploadSiteVersion(ctx: InternalClientContext, repositoryRid: WidgetSetRid | StemmaRepositoryRid, version: string, zipFile: ReadableStream | Blob | BufferSource): Promise<void>;
@@ -1,3 +1,5 @@
1
1
  import type { LoadedFoundryConfig } from "@osdk/foundry-config-json";
2
- declare function getConfig(): Promise<LoadedFoundryConfig<"site"> | undefined>;
2
+ declare function getConfig(type: "site"): Promise<LoadedFoundryConfig<"site"> | undefined>;
3
+ declare function getConfig(type: "widgetSet"): Promise<LoadedFoundryConfig<"widgetSet"> | undefined>;
4
+ declare function getConfig(type: "site" | "widgetSet"): Promise<LoadedFoundryConfig<"site" | "widgetSet"> | undefined>;
3
5
  export default getConfig;
@@ -1 +1 @@
1
- export declare function logConfigFileMiddleware(): Promise<void>;
1
+ export declare function logConfigFileMiddleware(type: "site" | "widgetSet"): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/cli",
3
- "version": "0.25.0-beta.24",
3
+ "version": "0.25.0-beta.26",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -25,15 +25,15 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@arethetypeswrong/cli": "^0.17.3",
29
- "ajv": "^8.13.0",
30
- "archiver": "^7.0.1",
31
- "consola": "^3.2.3",
32
- "open": "^10.1.0",
33
- "pretty-bytes": "^6.1.1",
34
- "semver": "^7.6.3",
35
- "tslib": "^2.6.3",
36
- "yargs": "^17.7.2"
28
+ "@arethetypeswrong/cli": "0.17.3",
29
+ "ajv": "8.13.0",
30
+ "archiver": "7.0.1",
31
+ "consola": "3.2.3",
32
+ "open": "10.1.0",
33
+ "pretty-bytes": "6.1.1",
34
+ "semver": "7.6.3",
35
+ "tslib": "2.6.3",
36
+ "yargs": "17.7.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/archiver": "^6.0.2",
@@ -43,13 +43,14 @@
43
43
  "@types/yargs": "^17.0.29",
44
44
  "ts-expect": "^1.3.0",
45
45
  "typescript": "~5.5.4",
46
- "@osdk/cli.common": "~0.25.0-beta.24",
47
- "@osdk/cli.cmd.typescript": "~0.25.0-beta.24",
48
- "@osdk/foundry-config-json": "~0.1.0-beta.2",
46
+ "@osdk/cli.cmd.typescript": "~0.25.0-beta.26",
47
+ "@osdk/cli.common": "~0.25.0-beta.26",
48
+ "@osdk/foundry-config-json": "~1.0.0-beta.4",
49
49
  "@osdk/monorepo.tsconfig": "~0.0.0",
50
+ "@osdk/monorepo.api-extractor": "~0.0.0",
50
51
  "@osdk/shared.net.errors": "~2.1.0-beta.2",
51
52
  "@osdk/shared.net.fetch": "~1.1.0-beta.3",
52
- "@osdk/monorepo.api-extractor": "~0.0.0"
53
+ "@osdk/widget-api.unstable": "~2.0.0-beta.11"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../foundry-config-json/build/esm/autoVersion.js","../../../foundry-config-json/build/esm/index.js","../../../foundry-config-json/build/esm/config.js"],"names":["fsPromises","findUp"],"mappings":";;;;;;;;;AAAA,cAAA,EAAA,CAAA;AAqBa,IAAA,gBAAA,GAAN,cAA+B,KAAM,CAAA;AAAA,EAC1C,WAAA,CAAY,KAAK,GAAK,EAAA;AACpB,IAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AACT,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA,CAAA;AACX,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA,CAAA;AAAA,GACb;AACF,EAAA;AASA,eAAsB,YAAY,MAAQ,EAAA;AACxC,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,cAAA;AACH,MAAO,OAAA,sBAAA,CAAuB,OAAO,SAAS,CAAA,CAAA;AAAA,IAChD,KAAK,cAAA;AACH,MAAA,OAAO,sBAAuB,EAAA,CAAA;AAAA,IAChC;AACE,MAAA,MAAM,IAAI,KAAM,CAAA,CAAA,iCAAA,EAAoC,KAAK,SAAU,CAAA,MAAM,CAAC,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACjF;AACF,CAAA;AACA,eAAe,sBAAA,CAAuB,YAAY,EAAI,EAAA;AACpD,EAAM,MAAA,CAAC,aAAa,WAAW,CAAA,GAAI,cAAc,EAAK,GAAA,CAAC,WAAW,IAAI,MAAA,CAAO,IAAI,SAAS,CAAA,CAAE,CAAC,CAAI,GAAA,CAAC,QAAW,IAAI,MAAA,CAAO,KAAK,CAAC,CAAA,CAAA;AAC9H,E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ved.\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 { findUp } from \"find-up\";\nimport { exec } from \"node:child_process\";\nimport { promises as fsPromises } from \"node:fs\";\nimport { promisify } from \"node:util\";\nimport { valid } from \"semver\";\nexport class AutoVersionError extends Error {\n constructor(msg, tip) {\n super(msg);\n this.msg = msg;\n this.tip = tip;\n }\n}\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(config) {\n switch (config.type) {\n case \"git-describe\":\n return gitDescribeAutoVersion(config.tagPrefix);\n case \"package-json\":\n return packageJsonAutoVersion();\n default:\n throw new Error(`Unexpected auto version config: (${JSON.stringify(config)})`);\n }\n}\nasync function gitDescribeAutoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n validateVersion(version);\n return version;\n}\nasync function packageJsonAutoVersion() {\n const packageJsonPath = await findUp(\"package.json\");\n if (!packageJsonPath) {\n throw new AutoVersionError(`Couldn't find package.json file in the current working directory or its parents: ${process.cwd()}`);\n }\n let packageJson;\n try {\n const fileContent = await fsPromises.readFile(packageJsonPath, \"utf-8\");\n packageJson = JSON.parse(fileContent);\n } catch (error) {\n throw new AutoVersionError(`Couldn't read or parse package.json file ${packageJsonPath}. Error: ${error}`);\n }\n const version = packageJson.version;\n validateVersion(version);\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new AutoVersionError(\"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new AutoVersionError(`Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new AutoVersionError(`Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new AutoVersionError(`Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}\nfunction validateVersion(version) {\n if (valid(version) == null) {\n throw new AutoVersionError(`The version string ${version} is not SemVer compliant.`);\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 { autoVersion, AutoVersionError } from \"./autoVersion.js\";\nexport { loadFoundryConfig } from \"./config.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 */\n\nimport { promises as fsPromises } from \"node:fs\";\nimport { extname } from \"node:path\";\nconst CONFIG_FILE_NAMES = [\"foundry.config.json\"];\nconst FOUNDRY_SITE_CONFIG_SCHEMA = {\n type: \"object\",\n properties: {\n foundryUrl: {\n type: \"string\"\n },\n site: {\n type: \"object\",\n properties: {\n application: {\n type: \"string\"\n },\n directory: {\n type: \"string\"\n },\n autoVersion: {\n type: \"object\",\n nullable: true,\n oneOf: [{\n properties: {\n type: {\n const: \"git-describe\",\n type: \"string\"\n },\n tagPrefix: {\n type: \"string\",\n nullable: true\n }\n }\n }, {\n properties: {\n type: {\n const: \"package-json\",\n type: \"string\"\n }\n }\n }],\n required: [\"type\"]\n },\n uploadOnly: {\n type: \"boolean\",\n nullable: true\n }\n },\n required: [\"application\", \"directory\"]\n }\n },\n required: [\"foundryUrl\", \"site\"],\n additionalProperties: false\n};\nconst FOUNDRY_WIDGET_SET_CONFIG_SCHEMA = {\n type: \"object\",\n properties: {\n foundryUrl: {\n type: \"string\"\n },\n widgetSet: {\n type: \"object\",\n properties: {\n rid: {\n type: \"string\"\n },\n directory: {\n type: \"string\"\n },\n autoVersion: FOUNDRY_SITE_CONFIG_SCHEMA.properties.site.properties.autoVersion,\n uploadOnly: {\n type: \"boolean\",\n nullable: true\n }\n },\n required: [\"rid\", \"directory\"]\n }\n },\n required: [\"foundryUrl\", \"widgetSet\"],\n additionalProperties: false\n};\nconst FOUNDRY_CONFIG_SCHEMA = {\n site: FOUNDRY_SITE_CONFIG_SCHEMA,\n widgetSet: FOUNDRY_WIDGET_SET_CONFIG_SCHEMA\n};\n\n/**\n * Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.\n * @returns A promise that resolves to the configuration JSON object, or undefined if not found.\n * @throws Will throw an error if the configuration file is found but cannot be read or parsed.\n */\n\nexport async function loadFoundryConfig(type) {\n const ajvModule = await import(\"ajv\");\n const Ajv = ajvModule.default.default; // https://github.com/ajv-validator/ajv/issues/2132\n const ajv = new Ajv({\n allErrors: true\n });\n const validate = ajv.compile(FOUNDRY_CONFIG_SCHEMA[type]);\n const {\n findUp\n } = await import(\"find-up\");\n const configFilePath = await findUp(CONFIG_FILE_NAMES);\n if (configFilePath) {\n let foundryConfig;\n try {\n const fileContent = await fsPromises.readFile(configFilePath, \"utf-8\");\n foundryConfig = parseConfigFile(fileContent, configFilePath);\n } catch (error) {\n throw new Error(`Couldn't read or parse config file ${configFilePath}. Error: ${error}`);\n }\n if (!validate(foundryConfig)) {\n throw new Error(`The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);\n }\n return {\n foundryConfig,\n configFilePath\n };\n }\n return undefined;\n}\nfunction parseConfigFile(fileContent, configFilePath) {\n const extension = extname(configFilePath);\n switch (extension) {\n case \".json\":\n return JSON.parse(fileContent);\n default:\n throw new Error(`Unsupported file extension: ${extension} for config file.`);\n }\n}"]}
@@ -1 +0,0 @@
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/uploadSnapshotVersion.mts","../../src/net/third-party-applications/uploadVersion.mts","../../src/net/index.mts","../../src/util/token.ts"],"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A,KACT;AAAA,GACF;AACA,EAAM,MAAA,IAAI,iBAAiB,CAAG,EAAA,CAAA,eAAA,CAAA,EAAmB,+DAA+D,cAAe,CAAA,CAAC,CAAC,CAAuB,qBAAA,CAAA,CAAA,CAAA;AAC1J,CAAA;AAOA,eAAsB,cAAc,QAAU,EAAA;AAC5C,EAAI,IAAA,KAAA,CAAA;AACJ,EAAI,IAAA,YAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAe,YAAA,GAAA,IAAA,CAAK,QAAQ,QAAQ,CAAA,CAAA;AACpC,IAAA,KAAA,GAAQ,MAAMC,QAAA,CAAW,QAAS,CAAA,YAAA,EAAc,MAAM,CAAA,CAAA;AACtD,IAAA,KAAA,GAAQ,MAAM,IAAK,EAAA,CAAA;AAAA,WACZ,KAAO,EAAA;AACd,IAAA,MAAM,IAAI,gBAAiB,CAAA,CAAA,EAAG,8BAA8B,QAAQ,CAAA,GAAA,EAAM,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,GACnF;AACA,EAAO,OAAA;AAAA,IACL,QAAU,EAAA,YAAA;AAAA,IACV,KAAA;AAAA,GACF,CAAA;AACF,CAAA;AACO,SAAS,SAAS,KAAO,EAAA;AAC9B,EAAI,IAAA,CAAC,KAAM,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-JJ3PTQQF.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 { uploadSnapshotVersion } from \"./uploadSnapshotVersion.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 { PalantirApiError } from \"@osdk/shared.net.errors\";\nimport { createFetchHeaderMutator, createFetchOrThrow } from \"@osdk/shared.net.fetch\";\nimport { consola } from \"consola\";\nimport prettyBytes from \"pretty-bytes\";\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 } else if (e.statusCode === 404) {\n tip = \"The resource may not exist or your token may not have the required scopes to load it\";\n }\n let 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 } else if (e.errorName === \"VersionLimitExceeded\") {\n const {\n versionLimit\n } = e.parameters ?? {};\n const versionLimitPart = versionLimit != null ? ` (Limit: ${versionLimit} versions)` : \"\";\n message = `The site contains too many versions${versionLimitPart}`;\n tip = \"Run the `site version delete` command to delete an old version and try again\";\n } else if (e.errorName === \"FileCountLimitExceeded\") {\n const {\n fileCountLimit\n } = e.parameters ?? {};\n const fileCountLimitPart = fileCountLimit != null ? ` (Limit: ${fileCountLimit} files)` : \"\";\n message = `The .zip file contains too many files${fileCountLimitPart}`;\n tip = \"Reduce the number of files in the production build to below the limit\";\n } else if (e.errorName === \"FileSizeLimitExceeded\") {\n const {\n currentFilePath,\n currentFileSizeBytes,\n fileSizeBytesLimit\n } = e.parameters ?? {};\n const currentFilePathPart = currentFilePath != null ? ` \"${currentFilePath}\"` : \"\";\n const currentFileSizePart = currentFileSizeBytes != null ? ` (${prettyBytes(parseInt(currentFileSizeBytes), {\n binary: true\n })})` : \"\";\n const fileSizeLimitPart = fileSizeBytesLimit != null ? ` (Limit: ${prettyBytes(parseInt(fileSizeBytesLimit), {\n binary: true\n })})` : \"\";\n message = `The .zip file contains a file${currentFilePathPart}${currentFileSizePart} that is too large${fileSizeLimitPart}`;\n tip = \"Ensure all files in the production build are below the size limit\";\n } else {\n const {\n errorCode,\n errorName,\n errorInstanceId,\n parameters\n } = e;\n // Include extra info about the original API error in CLI error messages\n // https://www.palantir.com/docs/foundry/api/general/overview/errors/\n message = `${e.message}\\n\\n${JSON.stringify({\n errorCode,\n errorName,\n errorInstanceId,\n parameters\n }, null, 2)}`;\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.errors\";\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 await 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 uploadSnapshotVersion(ctx, thirdPartyAppRid, version, snapshotId, zipFile) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `${ctx.foundryUrl}/api/v2/thirdPartyApplications/${thirdPartyAppRid}/website/versions/uploadSnapshot?version=${version}&preview=true${snapshotId !== \"\" ? `&snapshotIdentifier=${snapshotId}` : \"\"}`;\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 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}"]}