@osdk/cli 0.0.1

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 (37) hide show
  1. package/build/js/chunk-2DJZUIFP.js +7 -0
  2. package/build/js/chunk-2DJZUIFP.js.map +1 -0
  3. package/build/js/chunk-6PVNK2PW.js +13 -0
  4. package/build/js/chunk-6PVNK2PW.js.map +1 -0
  5. package/build/js/chunk-MGT3UGXW.mjs +5 -0
  6. package/build/js/chunk-MGT3UGXW.mjs.map +1 -0
  7. package/build/js/chunk-YEWM6TCR.mjs +9 -0
  8. package/build/js/chunk-YEWM6TCR.mjs.map +1 -0
  9. package/build/js/index.js +15 -0
  10. package/build/js/index.js.map +1 -0
  11. package/build/js/index.mjs +9 -0
  12. package/build/js/index.mjs.map +1 -0
  13. package/build/js/siteUploadCommand-36HAEYDG.js +37 -0
  14. package/build/js/siteUploadCommand-36HAEYDG.js.map +1 -0
  15. package/build/js/siteUploadCommand-L3QDNVWX.mjs +12 -0
  16. package/build/js/siteUploadCommand-L3QDNVWX.mjs.map +1 -0
  17. package/build/js/siteVersionsCommand-BQMPCMGZ.mjs +10 -0
  18. package/build/js/siteVersionsCommand-BQMPCMGZ.mjs.map +1 -0
  19. package/build/js/siteVersionsCommand-YSV7HQJK.js +12 -0
  20. package/build/js/siteVersionsCommand-YSV7HQJK.js.map +1 -0
  21. package/build/types/ExitProcessError.d.ts +4 -0
  22. package/build/types/cli.d.ts +5 -0
  23. package/build/types/commands/site/addSiteCommand.d.ts +7 -0
  24. package/build/types/commands/site/upload/UploadArgs.d.ts +5 -0
  25. package/build/types/commands/site/upload/index.d.ts +5 -0
  26. package/build/types/commands/site/upload/siteUploadCommand.d.mts +2 -0
  27. package/build/types/commands/site/versions/index.d.ts +4 -0
  28. package/build/types/commands/site/versions/siteVersionsCommand.d.mts +2 -0
  29. package/build/types/index.d.ts +1 -0
  30. package/build/types/net/RepositoryRid.d.ts +1 -0
  31. package/build/types/net/ThirdPartyAppRid.d.ts +1 -0
  32. package/build/types/net/createFetch.d.mts +1 -0
  33. package/build/types/net/fetchWebsiteRepositoryRid.d.mts +3 -0
  34. package/build/types/net/getSiteAssetBaseUrl.d.mts +1 -0
  35. package/build/types/net/getSiteVersions.d.mts +5 -0
  36. package/build/types/net/uploadSiteVersion.d.mts +5 -0
  37. package/package.json +57 -0
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var r=class extends Error{constructor(e,o){super(o),this.errorCode=e;}};
4
+
5
+ exports.a = r;
6
+ //# sourceMappingURL=out.js.map
7
+ //# sourceMappingURL=chunk-2DJZUIFP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ExitProcessError.ts"],"names":["ExitProcessError","errorCode","msg"],"mappings":"AAgBO,IAAMA,EAAN,cAA+B,KAAM,CAC1C,YAAYC,EAAWC,EAAK,CAC1B,MAAMA,CAAG,EACT,KAAK,UAAYD,CACnB,CACF","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 class ExitProcessError extends Error {\n constructor(errorCode, msg) {\n super(msg);\n this.errorCode = errorCode;\n }\n}"]}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var utils = require('@osdk/api/utils');
4
+ var consola = require('consola');
5
+
6
+ function c(e,o=fetch){return utils.createFetchHeaderMutator(u(o),async t=>{let s=await e();return t.set("Authorization",`Bearer ${s}`),t.set("Fetch-User-Agent",""),t})}function u(e=fetch){return function(t,s){return typeof t=="string"||t instanceof URL?consola.consola.debug(`${s?.method??"GET"}: ${t.toString().trim()}`):consola.consola.debug(`${t.method??"GET"}: ${t.url.toString().trim()}`),e(t,s).then(r=>(consola.consola.debug("Finished fetch"),r))}}async function $(e,o){let t=c(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),s=`
7
+ ${e}/third-party-application-service/api/application-websites/${o}`,r=await t(s);if(r.status>=200&&r.status<300){let i=await r.json();return consola.consola.debug(`Repository RID: ${i}`),i}throw new Error(`Unexpected response code ${r.status} (${r.statusText})`)}function b(e,o){return `${e}/artifacts/api/repositories/${o}/contents/release/siteasset`}
8
+
9
+ exports.a = c;
10
+ exports.b = $;
11
+ exports.c = b;
12
+ //# sourceMappingURL=out.js.map
13
+ //# sourceMappingURL=chunk-6PVNK2PW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/net/createFetch.mts","../../src/net/fetchWebsiteRepositoryRid.mts","../../src/net/getSiteAssetBaseUrl.mts"],"names":["createFetchHeaderMutator","consola","createFetch","tokenProvider","fetchFn","createDebugLoggingFetch","headers","token","input","init","a","fetchWebsiteRepositoryRid","baseUrl","thirdPartyAppRid","fetch","url","result","repositoryRid","getSiteAssetBaseUrl","foundryBaseUrl"],"mappings":"AAgBA,OAAS,4BAAAA,MAAgC,kBACzC,OAAS,WAAAC,MAAe,UACjB,SAASC,EAAYC,EAAeC,EAAU,MAAO,CAC1D,OAAOJ,EAAyBK,EAAwBD,CAAO,EAAG,MAAME,GAAW,CACjF,IAAMC,EAAQ,MAAMJ,EAAc,EAClC,OAAAG,EAAQ,IAAI,gBAAiB,UAAUC,CAAK,EAAE,EAC9CD,EAAQ,IAAI,mBAAoB,EAAE,EAC3BA,CACT,CAAC,CACH,CACA,SAASD,EAAwBD,EAAU,MAAO,CAChD,OAAO,SAA2BI,EAAOC,EAAM,CAC7C,OAAI,OAAOD,GAAU,UAAYA,aAAiB,IAChDP,EAAQ,MAAM,GAAGQ,GAAM,QAAU,KAAK,KAAKD,EAAM,SAAS,EAAE,KAAK,CAAC,EAAE,EAEpEP,EAAQ,MAAM,GAAGO,EAAM,QAAU,KAAK,KAAKA,EAAM,IAAI,SAAS,EAAE,KAAK,CAAC,EAAE,EAEnEJ,EAAQI,EAAOC,CAAI,EAAE,KAAKC,IAC/BT,EAAQ,MAAM,gBAAgB,EACvBS,EACR,CACH,CACF,CCtBA,OAAS,WAAAT,MAAe,UAExB,eAAsBU,EAA0BC,EAASC,EAAkB,CACzE,IAAMC,EAAQZ,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EAC5Da,EAAM;AAAA,MACRH,CAAO,6DAA6DC,CAAgB,GAClFG,EAAS,MAAMF,EAAMC,CAAG,EAC9B,GAAIC,EAAO,QAAU,KAAOA,EAAO,OAAS,IAAK,CAC/C,IAAMC,EAAgB,MAAMD,EAAO,KAAK,EACxC,OAAAf,EAAQ,MAAM,mBAAmBgB,CAAa,EAAE,EACzCA,CACT,CACA,MAAM,IAAI,MAAM,4BAA4BD,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CACpF,CCbO,SAASE,EAAoBC,EAAgBF,EAAe,CACjE,MAAO,GAAGE,CAAc,+BAA+BF,CAAa,6BACtE","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 { createFetchHeaderMutator } from \"@osdk/api/utils\";\nimport { consola } from \"consola\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createDebugLoggingFetch(fetchFn), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", \"\");\n return headers;\n });\n}\nfunction createDebugLoggingFetch(fetchFn = fetch) {\n return function debugLoggingFetch(input, init) {\n if (typeof input === \"string\" || input instanceof URL) {\n consola.debug(`${init?.method ?? \"GET\"}: ${input.toString().trim()}`);\n } else {\n consola.debug(`${input.method ?? \"GET\"}: ${input.url.toString().trim()}`);\n }\n return fetchFn(input, init).then(a => {\n consola.debug(\"Finished fetch\");\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\nimport { consola } from \"consola\";\nimport { createFetch } from \"./createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid) {\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const url = `\n ${baseUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;\n const result = await fetch(url);\n if (result.status >= 200 && result.status < 300) {\n const repositoryRid = await result.json();\n consola.debug(`Repository RID: ${repositoryRid}`);\n return repositoryRid;\n }\n throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);\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 function getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {\n return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;\n}"]}
@@ -0,0 +1,5 @@
1
+ var r=class extends Error{constructor(e,o){super(o),this.errorCode=e;}};
2
+
3
+ export { r as a };
4
+ //# sourceMappingURL=out.js.map
5
+ //# sourceMappingURL=chunk-MGT3UGXW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ExitProcessError.ts"],"names":["ExitProcessError","errorCode","msg"],"mappings":"AAgBO,IAAMA,EAAN,cAA+B,KAAM,CAC1C,YAAYC,EAAWC,EAAK,CAC1B,MAAMA,CAAG,EACT,KAAK,UAAYD,CACnB,CACF","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 class ExitProcessError extends Error {\n constructor(errorCode, msg) {\n super(msg);\n this.errorCode = errorCode;\n }\n}"]}
@@ -0,0 +1,9 @@
1
+ import { createFetchHeaderMutator } from '@osdk/api/utils';
2
+ import { consola } from 'consola';
3
+
4
+ function c(e,o=fetch){return createFetchHeaderMutator(u(o),async t=>{let s=await e();return t.set("Authorization",`Bearer ${s}`),t.set("Fetch-User-Agent",""),t})}function u(e=fetch){return function(t,s){return typeof t=="string"||t instanceof URL?consola.debug(`${s?.method??"GET"}: ${t.toString().trim()}`):consola.debug(`${t.method??"GET"}: ${t.url.toString().trim()}`),e(t,s).then(r=>(consola.debug("Finished fetch"),r))}}async function $(e,o){let t=c(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),s=`
5
+ ${e}/third-party-application-service/api/application-websites/${o}`,r=await t(s);if(r.status>=200&&r.status<300){let i=await r.json();return consola.debug(`Repository RID: ${i}`),i}throw new Error(`Unexpected response code ${r.status} (${r.statusText})`)}function b(e,o){return `${e}/artifacts/api/repositories/${o}/contents/release/siteasset`}
6
+
7
+ export { c as a, $ as b, b as c };
8
+ //# sourceMappingURL=out.js.map
9
+ //# sourceMappingURL=chunk-YEWM6TCR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/net/createFetch.mts","../../src/net/fetchWebsiteRepositoryRid.mts","../../src/net/getSiteAssetBaseUrl.mts"],"names":["createFetchHeaderMutator","consola","createFetch","tokenProvider","fetchFn","createDebugLoggingFetch","headers","token","input","init","a","fetchWebsiteRepositoryRid","baseUrl","thirdPartyAppRid","fetch","url","result","repositoryRid","getSiteAssetBaseUrl","foundryBaseUrl"],"mappings":"AAgBA,OAAS,4BAAAA,MAAgC,kBACzC,OAAS,WAAAC,MAAe,UACjB,SAASC,EAAYC,EAAeC,EAAU,MAAO,CAC1D,OAAOJ,EAAyBK,EAAwBD,CAAO,EAAG,MAAME,GAAW,CACjF,IAAMC,EAAQ,MAAMJ,EAAc,EAClC,OAAAG,EAAQ,IAAI,gBAAiB,UAAUC,CAAK,EAAE,EAC9CD,EAAQ,IAAI,mBAAoB,EAAE,EAC3BA,CACT,CAAC,CACH,CACA,SAASD,EAAwBD,EAAU,MAAO,CAChD,OAAO,SAA2BI,EAAOC,EAAM,CAC7C,OAAI,OAAOD,GAAU,UAAYA,aAAiB,IAChDP,EAAQ,MAAM,GAAGQ,GAAM,QAAU,KAAK,KAAKD,EAAM,SAAS,EAAE,KAAK,CAAC,EAAE,EAEpEP,EAAQ,MAAM,GAAGO,EAAM,QAAU,KAAK,KAAKA,EAAM,IAAI,SAAS,EAAE,KAAK,CAAC,EAAE,EAEnEJ,EAAQI,EAAOC,CAAI,EAAE,KAAKC,IAC/BT,EAAQ,MAAM,gBAAgB,EACvBS,EACR,CACH,CACF,CCtBA,OAAS,WAAAT,MAAe,UAExB,eAAsBU,EAA0BC,EAASC,EAAkB,CACzE,IAAMC,EAAQZ,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EAC5Da,EAAM;AAAA,MACRH,CAAO,6DAA6DC,CAAgB,GAClFG,EAAS,MAAMF,EAAMC,CAAG,EAC9B,GAAIC,EAAO,QAAU,KAAOA,EAAO,OAAS,IAAK,CAC/C,IAAMC,EAAgB,MAAMD,EAAO,KAAK,EACxC,OAAAf,EAAQ,MAAM,mBAAmBgB,CAAa,EAAE,EACzCA,CACT,CACA,MAAM,IAAI,MAAM,4BAA4BD,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CACpF,CCbO,SAASE,EAAoBC,EAAgBF,EAAe,CACjE,MAAO,GAAGE,CAAc,+BAA+BF,CAAa,6BACtE","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 { createFetchHeaderMutator } from \"@osdk/api/utils\";\nimport { consola } from \"consola\";\nexport function createFetch(tokenProvider, fetchFn = fetch) {\n return createFetchHeaderMutator(createDebugLoggingFetch(fetchFn), async headers => {\n const token = await tokenProvider();\n headers.set(\"Authorization\", `Bearer ${token}`);\n headers.set(\"Fetch-User-Agent\", \"\");\n return headers;\n });\n}\nfunction createDebugLoggingFetch(fetchFn = fetch) {\n return function debugLoggingFetch(input, init) {\n if (typeof input === \"string\" || input instanceof URL) {\n consola.debug(`${init?.method ?? \"GET\"}: ${input.toString().trim()}`);\n } else {\n consola.debug(`${input.method ?? \"GET\"}: ${input.url.toString().trim()}`);\n }\n return fetchFn(input, init).then(a => {\n consola.debug(\"Finished fetch\");\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\nimport { consola } from \"consola\";\nimport { createFetch } from \"./createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid) {\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const url = `\n ${baseUrl}/third-party-application-service/api/application-websites/${thirdPartyAppRid}`;\n const result = await fetch(url);\n if (result.status >= 200 && result.status < 300) {\n const repositoryRid = await result.json();\n consola.debug(`Repository RID: ${repositoryRid}`);\n return repositoryRid;\n }\n throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);\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 function getSiteAssetBaseUrl(foundryBaseUrl, repositoryRid) {\n return `${foundryBaseUrl}/artifacts/api/repositories/${repositoryRid}/contents/release/siteasset`;\n}"]}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunk2DJZUIFP_js = require('./chunk-2DJZUIFP.js');
4
+ var c = require('yargs');
5
+ var helpers = require('yargs/helpers');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var c__default = /*#__PURE__*/_interopDefault(c);
10
+
11
+ var d={command:"upload",describe:"Upload an application version",builder:o=>o.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async o=>{await(await import('./siteUploadCommand-36HAEYDG.js')).default(o);}},i=d;var s={command:"versions",describe:"List application versions",builder:o=>o,handler:async o=>{await(await import('./siteVersionsCommand-YSV7HQJK.js')).default(o);}},m=s;function a(o){return o.command("site","Manage your site",t=>{let r=t.options({appRid:{type:"string",demandOption:!0,coerce:n=>n},baseUrl:{type:"string",demandOption:!0}}).demandCommand();return r.command(m),r.command(i),r},t=>{})}async function u(o=process.argv){let t=c__default.default(helpers.hideBin(o)).env("OSDK"),r=await import('consola');a(t),t.demandCommand().strict();try{return t.parseAsync()}catch(n){n instanceof chunk2DJZUIFP_js.a&&r.consola.error(n.message);}}
12
+
13
+ exports.cli = u;
14
+ //# sourceMappingURL=out.js.map
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/addSiteCommand.ts"],"names":["yargs","hideBin","command","argv","args","upload_default","versions_default","addSiteCommand","originalYargs","a","cli","base","Consola","e","ExitProcessError"],"mappings":"wCAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,SACT,SAAU,gCACV,QAASC,GACAA,EAAK,OAAO,cAAe,CAChC,KAAM,SACN,aAAc,EAChB,CAAC,EAAE,OAAO,MAAO,CACf,KAAM,QACR,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,iCAAyB,GACxC,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,EChBR,IAAMA,EAAU,CACrB,QAAS,WACT,SAAU,4BACV,QAASC,GACAA,EAET,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,mCAA2B,GAC1C,QAAQA,CAAI,CAC5B,CACF,EACOE,EAAQJ,ECTA,SAARK,EAAgCP,EAAO,CAC5C,OAAOA,EAAM,QAAQ,OAAQ,mBAAoBQ,GAAiB,CAChE,IAAMR,EAAQQ,EAAc,QAAQ,CAClC,OAAQ,CACN,KAAM,SACN,aAAc,GACd,OAAQC,GAAKA,CACf,EACA,QAAS,CACP,KAAM,SACN,aAAc,EAChB,CACF,CAAC,EAAE,cAAc,EACjB,OAAAT,EAAM,QAAQM,CAAQ,EACtBN,EAAM,QAAQK,CAAM,EACbL,CACT,EAAGI,GAAQ,CAAC,CAAC,CACf,CHfA,eAAsBM,EAAIN,EAAO,QAAQ,KAAM,CAC7C,IAAMO,EAAOX,EAAMC,EAAQG,CAAI,CAAC,EAAE,IAAI,MAAM,EACtCQ,EAAU,KAAM,QAAO,SAAS,EAGtCL,EAAeI,CAAI,EACnBA,EAAK,cAAc,EAAE,OAAO,EAC5B,GAAI,CACF,OAAOA,EAAK,WAAW,CACzB,OAASE,EAAG,CACNA,aAAaC,GACfF,EAAQ,QAAQ,MAAMC,EAAE,OAAO,CAEnC,CACF","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 yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport addSiteCommand from \"./commands/site/addSiteCommand\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\");\n const Consola = await import(\"consola\");\n // Consola.default.level = Consola.LogLevels.debug;\n\n addSiteCommand(base);\n base.demandCommand().strict();\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n Consola.consola.error(e.message);\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 command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\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 command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\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 upload from \"./upload\";\nimport versions from \"./versions\";\nexport default function addSiteCommand(yargs) {\n return yargs.command(\"site\", \"Manage your site\", originalYargs => {\n const yargs = originalYargs.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).demandCommand();\n yargs.command(versions);\n yargs.command(upload);\n return yargs;\n }, args => {});\n}"]}
@@ -0,0 +1,9 @@
1
+ import { a as a$1 } from './chunk-MGT3UGXW.mjs';
2
+ import c from 'yargs';
3
+ import { hideBin } from 'yargs/helpers';
4
+
5
+ var d={command:"upload",describe:"Upload an application version",builder:o=>o.option("siteVersion",{type:"string",demandOption:!0}).option("dir",{type:"string"}),handler:async o=>{await(await import('./siteUploadCommand-L3QDNVWX.mjs')).default(o);}},i=d;var s={command:"versions",describe:"List application versions",builder:o=>o,handler:async o=>{await(await import('./siteVersionsCommand-BQMPCMGZ.mjs')).default(o);}},m=s;function a(o){return o.command("site","Manage your site",t=>{let r=t.options({appRid:{type:"string",demandOption:!0,coerce:n=>n},baseUrl:{type:"string",demandOption:!0}}).demandCommand();return r.command(m),r.command(i),r},t=>{})}async function u(o=process.argv){let t=c(hideBin(o)).env("OSDK"),r=await import('consola');a(t),t.demandCommand().strict();try{return t.parseAsync()}catch(n){n instanceof a$1&&r.consola.error(n.message);}}
6
+
7
+ export { u as cli };
8
+ //# sourceMappingURL=out.js.map
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli.ts","../../src/commands/site/upload/index.ts","../../src/commands/site/versions/index.ts","../../src/commands/site/addSiteCommand.ts"],"names":["yargs","hideBin","command","argv","args","upload_default","versions_default","addSiteCommand","originalYargs","a","cli","base","Consola","e","ExitProcessError"],"mappings":"yCAgBA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,IAAMC,EAAU,CACrB,QAAS,SACT,SAAU,gCACV,QAASC,GACAA,EAAK,OAAO,cAAe,CAChC,KAAM,SACN,aAAc,EAChB,CAAC,EAAE,OAAO,MAAO,CACf,KAAM,QACR,CAAC,EAEH,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,kCAAyB,GACxC,QAAQA,CAAI,CAC5B,CACF,EACOC,EAAQH,EChBR,IAAMA,EAAU,CACrB,QAAS,WACT,SAAU,4BACV,QAASC,GACAA,EAET,QAAS,MAAMC,GAAQ,CAErB,MADgB,KAAM,QAAO,oCAA2B,GAC1C,QAAQA,CAAI,CAC5B,CACF,EACOE,EAAQJ,ECTA,SAARK,EAAgCP,EAAO,CAC5C,OAAOA,EAAM,QAAQ,OAAQ,mBAAoBQ,GAAiB,CAChE,IAAMR,EAAQQ,EAAc,QAAQ,CAClC,OAAQ,CACN,KAAM,SACN,aAAc,GACd,OAAQC,GAAKA,CACf,EACA,QAAS,CACP,KAAM,SACN,aAAc,EAChB,CACF,CAAC,EAAE,cAAc,EACjB,OAAAT,EAAM,QAAQM,CAAQ,EACtBN,EAAM,QAAQK,CAAM,EACbL,CACT,EAAGI,GAAQ,CAAC,CAAC,CACf,CHfA,eAAsBM,EAAIN,EAAO,QAAQ,KAAM,CAC7C,IAAMO,EAAOX,EAAMC,EAAQG,CAAI,CAAC,EAAE,IAAI,MAAM,EACtCQ,EAAU,KAAM,QAAO,SAAS,EAGtCL,EAAeI,CAAI,EACnBA,EAAK,cAAc,EAAE,OAAO,EAC5B,GAAI,CACF,OAAOA,EAAK,WAAW,CACzB,OAASE,EAAG,CACNA,aAAaC,GACfF,EAAQ,QAAQ,MAAMC,EAAE,OAAO,CAEnC,CACF","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 yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport addSiteCommand from \"./commands/site/addSiteCommand\";\nimport { ExitProcessError } from \"./ExitProcessError.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).env(\"OSDK\");\n const Consola = await import(\"consola\");\n // Consola.default.level = Consola.LogLevels.debug;\n\n addSiteCommand(base);\n base.demandCommand().strict();\n try {\n return base.parseAsync();\n } catch (e) {\n if (e instanceof ExitProcessError) {\n Consola.consola.error(e.message);\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 command = {\n command: \"upload\",\n describe: \"Upload an application version\",\n builder: argv => {\n return argv.option(\"siteVersion\", {\n type: \"string\",\n demandOption: true\n }).option(\"dir\", {\n type: \"string\"\n });\n },\n handler: async args => {\n const command = await import(\"./siteUploadCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\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 command = {\n command: \"versions\",\n describe: \"List application versions\",\n builder: argv => {\n return argv;\n },\n handler: async args => {\n const command = await import(\"./siteVersionsCommand.mjs\");\n await command.default(args);\n }\n};\nexport default command;","/*\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 upload from \"./upload\";\nimport versions from \"./versions\";\nexport default function addSiteCommand(yargs) {\n return yargs.command(\"site\", \"Manage your site\", originalYargs => {\n const yargs = originalYargs.options({\n appRid: {\n type: \"string\",\n demandOption: true,\n coerce: a => a\n },\n baseUrl: {\n type: \"string\",\n demandOption: true\n }\n }).demandCommand();\n yargs.command(versions);\n yargs.command(upload);\n return yargs;\n }, args => {});\n}"]}
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var chunk2DJZUIFP_js = require('./chunk-2DJZUIFP.js');
4
+ var chunk6PVNK2PW_js = require('./chunk-6PVNK2PW.js');
5
+ var w = require('archiver');
6
+ var consola = require('consola');
7
+ var d = require('fs');
8
+ var stream = require('stream');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var w__default = /*#__PURE__*/_interopDefault(w);
31
+ var d__namespace = /*#__PURE__*/_interopNamespace(d);
32
+
33
+ async function f(t,i,s,l){let m=await chunk6PVNK2PW_js.b(t,i),u=`${chunk6PVNK2PW_js.c(t,m)}/versions/zip/${s}`,e=await chunk6PVNK2PW_js.a(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(u,{method:"PUT",body:l,headers:{"Content-Type":"application/octet-stream"},duplex:"half"});if(e.status>=200&&e.status<300)return consola.consola.level=consola.LogLevels.debug,consola.consola.debug("Status Text: "+e.statusText),!0;throw e.status===409?new chunk2DJZUIFP_js.a(e.status,"Version already exists"):new chunk2DJZUIFP_js.a(e.status,`Unexpected response code ${e.status} (${e.statusText})`)}async function x(t){if(t.dir==null)throw consola.consola.error("No directory specified"),new chunk2DJZUIFP_js.a(1);if(!(await d__namespace.promises.stat(t.dir)).isDirectory())throw consola.consola.error("Specified path is not a directory"),new chunk2DJZUIFP_js.a(2);consola.consola.start("Zippping site files");let s=w__default.default("zip").directory(t.dir,!1);await Promise.all([f(t.baseUrl,t.appRid,t.siteVersion,stream.Readable.toWeb(s)),s.finalize()]),consola.consola.success("Found versions");}
34
+
35
+ module.exports = x;
36
+ //# sourceMappingURL=out.js.map
37
+ //# sourceMappingURL=siteUploadCommand-36HAEYDG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/site/upload/siteUploadCommand.mts","../../src/net/uploadSiteVersion.mts"],"names":["archiver","consola","fs","Readable","LogLevels","uploadZippedSiteAsset","baseUrl","thirdPartyAppRid","version","zipFile","repositoryRid","fetchWebsiteRepositoryRid","url","getSiteAssetBaseUrl","result","createFetch","ExitProcessError","invokeSiteUpload","args","archive"],"mappings":"yFAgBA,OAAOA,MAAc,WACrB,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KACpB,OAAS,YAAAC,MAAgB,SCHzB,OAAS,WAAAF,EAAS,aAAAG,MAAiB,UAKnC,eAAsBC,EAAsBC,EAASC,EAAkBC,EAASC,EAAS,CACvF,IAAMC,EAAgB,MAAMC,EAA0BL,EAASC,CAAgB,EACzEK,EAAM,GAAGC,EAAoBP,EAASI,CAAa,CAAC,iBAAiBF,CAAO,GAE5EM,EAAS,MADDC,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EACvCH,EAAK,CAC9B,OAAQ,MACR,KAAMH,EACN,QAAS,CACP,eAAgB,0BAClB,EACA,OAAQ,MACV,CAAC,EAED,GAAIK,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAAb,EAAQ,MAAQG,EAAU,MAC1BH,EAAQ,MAAM,gBAAkBa,EAAO,UAAU,EAC1C,GACF,MAAIA,EAAO,SAAW,IACrB,IAAIE,EAAiBF,EAAO,OAAQ,wBAAwB,EAE5D,IAAIE,EAAiBF,EAAO,OAAQ,4BAA4BA,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CAEhH,CDrBA,eAAOG,EAAwCC,EAAM,CACnD,GAAIA,EAAK,KAAO,KACd,MAAAjB,EAAQ,MAAM,wBAAwB,EAChC,IAAIe,EAAiB,CAAC,EAG9B,GAAI,EADS,MAAS,WAAS,KAAKE,EAAK,GAAG,GAClC,YAAY,EACpB,MAAAjB,EAAQ,MAAM,mCAAmC,EAC3C,IAAIe,EAAiB,CAAC,EAE9Bf,EAAQ,MAAM,qBAAqB,EACnC,IAAMkB,EAAUnB,EAAS,KAAK,EAAE,UAAUkB,EAAK,IAAK,EAAK,EACzD,MAAM,QAAQ,IAAI,CAACb,EAAsBa,EAAK,QAASA,EAAK,OAAQA,EAAK,YAAaf,EAAS,MAAMgB,CAAO,CAC5G,EAAGA,EAAQ,SAAS,CAAC,CAAC,EACtBlB,EAAQ,QAAQ,gBAAgB,CAClC","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 archiver from \"archiver\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport { Readable } from \"node:stream\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { uploadZippedSiteAsset } from \"../../../net/uploadSiteVersion.mjs\";\nexport default async function invokeSiteUpload(args) {\n if (args.dir == null) {\n consola.error(\"No directory specified\");\n throw new ExitProcessError(1);\n }\n const stat = await fs.promises.stat(args.dir);\n if (!stat.isDirectory()) {\n consola.error(\"Specified path is not a directory\");\n throw new ExitProcessError(2);\n }\n consola.start(\"Zippping site files\");\n const archive = archiver(\"zip\").directory(args.dir, false);\n await Promise.all([uploadZippedSiteAsset(args.baseUrl, args.appRid, args.siteVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Found versions\");\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 { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { createFetch } from \"./createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function uploadZippedSiteAsset(baseUrl, thirdPartyAppRid, version, zipFile) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/zip/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"PUT\",\n body: zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\n consola.debug(\"Status Text: \" + result.statusText);\n return true;\n } else if (result.status === 409) {\n throw new ExitProcessError(result.status, \"Version already exists\");\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\n }\n}"]}
@@ -0,0 +1,12 @@
1
+ import { a } from './chunk-MGT3UGXW.mjs';
2
+ import { b, c, a as a$1 } from './chunk-YEWM6TCR.mjs';
3
+ import w from 'archiver';
4
+ import { consola, LogLevels } from 'consola';
5
+ import * as d from 'fs';
6
+ import { Readable } from 'stream';
7
+
8
+ async function f(t,i,s,l){let m=await b(t,i),u=`${c(t,m)}/versions/zip/${s}`,e=await a$1(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(u,{method:"PUT",body:l,headers:{"Content-Type":"application/octet-stream"},duplex:"half"});if(e.status>=200&&e.status<300)return consola.level=LogLevels.debug,consola.debug("Status Text: "+e.statusText),!0;throw e.status===409?new a(e.status,"Version already exists"):new a(e.status,`Unexpected response code ${e.status} (${e.statusText})`)}async function x(t){if(t.dir==null)throw consola.error("No directory specified"),new a(1);if(!(await d.promises.stat(t.dir)).isDirectory())throw consola.error("Specified path is not a directory"),new a(2);consola.start("Zippping site files");let s=w("zip").directory(t.dir,!1);await Promise.all([f(t.baseUrl,t.appRid,t.siteVersion,Readable.toWeb(s)),s.finalize()]),consola.success("Found versions");}
9
+
10
+ export { x as default };
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=siteUploadCommand-L3QDNVWX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/site/upload/siteUploadCommand.mts","../../src/net/uploadSiteVersion.mts"],"names":["archiver","consola","fs","Readable","LogLevels","uploadZippedSiteAsset","baseUrl","thirdPartyAppRid","version","zipFile","repositoryRid","fetchWebsiteRepositoryRid","url","getSiteAssetBaseUrl","result","createFetch","ExitProcessError","invokeSiteUpload","args","archive"],"mappings":"2FAgBA,OAAOA,MAAc,WACrB,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KACpB,OAAS,YAAAC,MAAgB,SCHzB,OAAS,WAAAF,EAAS,aAAAG,MAAiB,UAKnC,eAAsBC,EAAsBC,EAASC,EAAkBC,EAASC,EAAS,CACvF,IAAMC,EAAgB,MAAMC,EAA0BL,EAASC,CAAgB,EACzEK,EAAM,GAAGC,EAAoBP,EAASI,CAAa,CAAC,iBAAiBF,CAAO,GAE5EM,EAAS,MADDC,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EACvCH,EAAK,CAC9B,OAAQ,MACR,KAAMH,EACN,QAAS,CACP,eAAgB,0BAClB,EACA,OAAQ,MACV,CAAC,EAED,GAAIK,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAAb,EAAQ,MAAQG,EAAU,MAC1BH,EAAQ,MAAM,gBAAkBa,EAAO,UAAU,EAC1C,GACF,MAAIA,EAAO,SAAW,IACrB,IAAIE,EAAiBF,EAAO,OAAQ,wBAAwB,EAE5D,IAAIE,EAAiBF,EAAO,OAAQ,4BAA4BA,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CAEhH,CDrBA,eAAOG,EAAwCC,EAAM,CACnD,GAAIA,EAAK,KAAO,KACd,MAAAjB,EAAQ,MAAM,wBAAwB,EAChC,IAAIe,EAAiB,CAAC,EAG9B,GAAI,EADS,MAAS,WAAS,KAAKE,EAAK,GAAG,GAClC,YAAY,EACpB,MAAAjB,EAAQ,MAAM,mCAAmC,EAC3C,IAAIe,EAAiB,CAAC,EAE9Bf,EAAQ,MAAM,qBAAqB,EACnC,IAAMkB,EAAUnB,EAAS,KAAK,EAAE,UAAUkB,EAAK,IAAK,EAAK,EACzD,MAAM,QAAQ,IAAI,CAACb,EAAsBa,EAAK,QAASA,EAAK,OAAQA,EAAK,YAAaf,EAAS,MAAMgB,CAAO,CAC5G,EAAGA,EAAQ,SAAS,CAAC,CAAC,EACtBlB,EAAQ,QAAQ,gBAAgB,CAClC","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 archiver from \"archiver\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport { Readable } from \"node:stream\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { uploadZippedSiteAsset } from \"../../../net/uploadSiteVersion.mjs\";\nexport default async function invokeSiteUpload(args) {\n if (args.dir == null) {\n consola.error(\"No directory specified\");\n throw new ExitProcessError(1);\n }\n const stat = await fs.promises.stat(args.dir);\n if (!stat.isDirectory()) {\n consola.error(\"Specified path is not a directory\");\n throw new ExitProcessError(2);\n }\n consola.start(\"Zippping site files\");\n const archive = archiver(\"zip\").directory(args.dir, false);\n await Promise.all([uploadZippedSiteAsset(args.baseUrl, args.appRid, args.siteVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Found versions\");\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 { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { createFetch } from \"./createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function uploadZippedSiteAsset(baseUrl, thirdPartyAppRid, version, zipFile) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/zip/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"PUT\",\n body: zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\n consola.debug(\"Status Text: \" + result.statusText);\n return true;\n } else if (result.status === 409) {\n throw new ExitProcessError(result.status, \"Version already exists\");\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\n }\n}"]}
@@ -0,0 +1,10 @@
1
+ import { b, c, a as a$1 } from './chunk-YEWM6TCR.mjs';
2
+ import { consola } from 'consola';
3
+
4
+ async function a(e,s){let o=await b(e,s),p=`${c(e,o)}/versions`,t=await a$1(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(p);if(t.status===200)return (await t.json()).versions;throw new Error(`Unexpected response code ${t.status} (${t.statusText})`)}async function u(e){consola.start("Fetching versions");let s=await a(e.baseUrl,e.appRid);if(s.length==0){consola.warn("Successfully connected to server, but no versions were found.");return}consola.success(`Found versions:
5
+ `+s.map(o=>` * ${o}`).join(`
6
+ `));}
7
+
8
+ export { u as default };
9
+ //# sourceMappingURL=out.js.map
10
+ //# sourceMappingURL=siteVersionsCommand-BQMPCMGZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/site/versions/siteVersionsCommand.mts","../../src/net/getSiteVersions.mts"],"names":["consola","getSiteVersions","baseUrl","thirdPartyAppRid","repositoryRid","fetchWebsiteRepositoryRid","url","getSiteAssetBaseUrl","result","createFetch","invokeSiteVersionsCommand","args","versions","a"],"mappings":"kDAgBA,OAAS,WAAAA,MAAe,UCGxB,eAAsBC,EAAgBC,EAASC,EAAkB,CAC/D,IAAMC,EAAgB,MAAMC,EAA0BH,EAASC,CAAgB,EACzEG,EAAM,GAAGC,EAAoBL,EAASE,CAAa,CAAC,YAEpDI,EAAS,MADDC,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EACvCH,CAAG,EAC9B,GAAIE,EAAO,SAAW,IAEpB,OADiB,MAAMA,EAAO,KAAK,GACnB,SAEhB,MAAM,IAAI,MAAM,4BAA4BA,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CAEtF,CDZA,eAAOE,EAAiDC,EAAM,CAC5DX,EAAQ,MAAM,mBAAmB,EACjC,IAAMY,EAAW,MAAMX,EAAgBU,EAAK,QAASA,EAAK,MAAM,EAChE,GAAIC,EAAS,QAAU,EAAG,CACxBZ,EAAQ,KAAK,+DAA+D,EAC5E,MACF,CACAA,EAAQ,QAAQ;AAAA,EAAsBY,EAAS,IAAIC,GAAK,SAASA,CAAC,EAAE,EAAE,KAAK;AAAA,CAAI,CAAC,CAClF","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 { getSiteVersions } from \"../../../net/getSiteVersions.mjs\";\nexport default async function invokeSiteVersionsCommand(args) {\n consola.start(\"Fetching versions\");\n const versions = await getSiteVersions(args.baseUrl, args.appRid);\n if (versions.length == 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\\n\" + versions.map(a => ` * ${a}`).join(\"\\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 { createFetch } from \"./createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function getSiteVersions(baseUrl, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url);\n if (result.status === 200) {\n const response = await result.json();\n return response.versions;\n } else {\n throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);\n }\n}"]}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunk6PVNK2PW_js = require('./chunk-6PVNK2PW.js');
4
+ var consola = require('consola');
5
+
6
+ async function a(e,s){let o=await chunk6PVNK2PW_js.b(e,s),p=`${chunk6PVNK2PW_js.c(e,o)}/versions`,t=await chunk6PVNK2PW_js.a(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(p);if(t.status===200)return (await t.json()).versions;throw new Error(`Unexpected response code ${t.status} (${t.statusText})`)}async function u(e){consola.consola.start("Fetching versions");let s=await a(e.baseUrl,e.appRid);if(s.length==0){consola.consola.warn("Successfully connected to server, but no versions were found.");return}consola.consola.success(`Found versions:
7
+ `+s.map(o=>` * ${o}`).join(`
8
+ `));}
9
+
10
+ module.exports = u;
11
+ //# sourceMappingURL=out.js.map
12
+ //# sourceMappingURL=siteVersionsCommand-YSV7HQJK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/site/versions/siteVersionsCommand.mts","../../src/net/getSiteVersions.mts"],"names":["consola","getSiteVersions","baseUrl","thirdPartyAppRid","repositoryRid","fetchWebsiteRepositoryRid","url","getSiteAssetBaseUrl","result","createFetch","invokeSiteVersionsCommand","args","versions","a"],"mappings":"iDAgBA,OAAS,WAAAA,MAAe,UCGxB,eAAsBC,EAAgBC,EAASC,EAAkB,CAC/D,IAAMC,EAAgB,MAAMC,EAA0BH,EAASC,CAAgB,EACzEG,EAAM,GAAGC,EAAoBL,EAASE,CAAa,CAAC,YAEpDI,EAAS,MADDC,EAAY,IAAM,QAAQ,IAAI,sBAAsB,EACvCH,CAAG,EAC9B,GAAIE,EAAO,SAAW,IAEpB,OADiB,MAAMA,EAAO,KAAK,GACnB,SAEhB,MAAM,IAAI,MAAM,4BAA4BA,EAAO,MAAM,KAAKA,EAAO,UAAU,GAAG,CAEtF,CDZA,eAAOE,EAAiDC,EAAM,CAC5DX,EAAQ,MAAM,mBAAmB,EACjC,IAAMY,EAAW,MAAMX,EAAgBU,EAAK,QAASA,EAAK,MAAM,EAChE,GAAIC,EAAS,QAAU,EAAG,CACxBZ,EAAQ,KAAK,+DAA+D,EAC5E,MACF,CACAA,EAAQ,QAAQ;AAAA,EAAsBY,EAAS,IAAIC,GAAK,SAASA,CAAC,EAAE,EAAE,KAAK;AAAA,CAAI,CAAC,CAClF","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 { getSiteVersions } from \"../../../net/getSiteVersions.mjs\";\nexport default async function invokeSiteVersionsCommand(args) {\n consola.start(\"Fetching versions\");\n const versions = await getSiteVersions(args.baseUrl, args.appRid);\n if (versions.length == 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\\n\" + versions.map(a => ` * ${a}`).join(\"\\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 { createFetch } from \"./createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function getSiteVersions(baseUrl, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url);\n if (result.status === 200) {\n const response = await result.json();\n return response.versions;\n } else {\n throw new Error(`Unexpected response code ${result.status} (${result.statusText})`);\n }\n}"]}
@@ -0,0 +1,4 @@
1
+ export declare class ExitProcessError extends Error {
2
+ readonly errorCode: number;
3
+ constructor(errorCode: number, msg?: string);
4
+ }
@@ -0,0 +1,5 @@
1
+ export declare function cli(args?: string[]): Promise<{
2
+ [x: string]: unknown;
3
+ _: (string | number)[];
4
+ $0: string;
5
+ } | undefined>;
@@ -0,0 +1,7 @@
1
+ import type * as yargs from "yargs";
2
+ import type { ThirdPartyAppRid } from "../../net/ThirdPartyAppRid.js";
3
+ export interface CommonSiteArgs {
4
+ appRid: ThirdPartyAppRid;
5
+ baseUrl: string;
6
+ }
7
+ export default function addSiteCommand(yargs: yargs.Argv<{}>): yargs.Argv<{}>;
@@ -0,0 +1,5 @@
1
+ import type { CommonSiteArgs } from "../addSiteCommand";
2
+ export interface UploadArgs extends CommonSiteArgs {
3
+ siteVersion: string;
4
+ dir?: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonSiteArgs } from "../addSiteCommand";
3
+ import type { UploadArgs } from "./UploadArgs";
4
+ export declare const command: CommandModule<CommonSiteArgs, UploadArgs>;
5
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { UploadArgs } from "./UploadArgs.js";
2
+ export default function invokeSiteUpload(args: UploadArgs): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { CommandModule } from "yargs";
2
+ import type { CommonSiteArgs } from "../addSiteCommand.js";
3
+ export declare const command: CommandModule<CommonSiteArgs, CommonSiteArgs>;
4
+ export default command;
@@ -0,0 +1,2 @@
1
+ import type { CommonSiteArgs } from "../addSiteCommand.js";
2
+ export default function invokeSiteVersionsCommand(args: CommonSiteArgs): Promise<void>;
@@ -0,0 +1 @@
1
+ export { cli } from "./cli";
@@ -0,0 +1 @@
1
+ export type RepositoryRid = `ri.artifacts.main.repository.${string}`;
@@ -0,0 +1 @@
1
+ export type ThirdPartyAppRid = `ri.third-party-applications.main.application.${string}`;
@@ -0,0 +1 @@
1
+ export declare function createFetch(tokenProvider: () => Promise<string> | string, fetchFn?: typeof fetch): typeof fetch;
@@ -0,0 +1,3 @@
1
+ import type { RepositoryRid } from "./RepositoryRid.js";
2
+ import type { ThirdPartyAppRid } from "./ThirdPartyAppRid.js";
3
+ export declare function fetchWebsiteRepositoryRid(baseUrl: string, thirdPartyAppRid: ThirdPartyAppRid): Promise<RepositoryRid>;
@@ -0,0 +1 @@
1
+ export declare function getSiteAssetBaseUrl(foundryBaseUrl: string, repositoryRid: string): string;
@@ -0,0 +1,5 @@
1
+ import type { ThirdPartyAppRid } from "./ThirdPartyAppRid.js";
2
+ export interface SiteAssetVersions {
3
+ versions: string[];
4
+ }
5
+ export declare function getSiteVersions(baseUrl: string, thirdPartyAppRid: ThirdPartyAppRid): Promise<string[]>;
@@ -0,0 +1,5 @@
1
+ import type { ThirdPartyAppRid } from "./ThirdPartyAppRid.js";
2
+ export interface SiteAssetVersions {
3
+ versions: string[];
4
+ }
5
+ export declare function uploadZippedSiteAsset(baseUrl: string, thirdPartyAppRid: ThirdPartyAppRid, version: string, zipFile: ReadableStream | Blob | BufferSource): Promise<boolean>;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@osdk/cli",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "access": "public",
6
+ "license": "Apache-2.0",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./build/types/index.d.ts",
10
+ "import": "./build/js/index.mjs",
11
+ "require": "./build/js/index.js"
12
+ },
13
+ "./*": {
14
+ "types": "./build/types/public/*.d.ts",
15
+ "import": "./build/js/public/*.mjs",
16
+ "require": "./build/js/public/*.js"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "archiver": "^6.0.1",
21
+ "consola": "^3.2.3",
22
+ "yargs": "^17.7.2",
23
+ "@osdk/api": "0.0.5"
24
+ },
25
+ "devDependencies": {
26
+ "@types/archiver": "^6.0.0",
27
+ "@types/luxon": "^3.3.3",
28
+ "@types/ngeohash": "^0.6.4",
29
+ "@types/node": "^18.0.0",
30
+ "@types/yargs": "^17.0.29",
31
+ "ts-expect": "^1.3.0",
32
+ "typescript": "^5.2.2"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "keywords": [],
38
+ "bin": {
39
+ "osdk": "./build/js/cli.js"
40
+ },
41
+ "files": [
42
+ "build/types",
43
+ "build/js",
44
+ "CHANGELOG.md",
45
+ "package.json"
46
+ ],
47
+ "scripts": {
48
+ "clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
49
+ "dev:transpile": "tsup --watch",
50
+ "fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
51
+ "lint": "eslint . && dprint check --config $(find-up dprint.json)",
52
+ "test:watch": "vitest",
53
+ "transpile": "tsup",
54
+ "transpileWatch": "tsup --watch",
55
+ "typecheck": "tsc-absolute --build"
56
+ }
57
+ }