@osdk/cli 0.0.16 → 0.0.17
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.
- package/CHANGELOG.md +10 -0
- package/build/js/chunk-2DZBTS5E.cjs +129 -0
- package/build/js/chunk-2DZBTS5E.cjs.map +1 -0
- package/build/js/chunk-CIVC2ZV3.mjs +175 -0
- package/build/js/chunk-CIVC2ZV3.mjs.map +1 -0
- package/build/js/chunk-E2SEJZTC.mjs +9 -0
- package/build/js/chunk-GTNZA5UY.mjs +11 -0
- package/build/js/chunk-GTNZA5UY.mjs.map +1 -0
- package/build/js/chunk-HQDDGVB7.cjs +11 -0
- package/build/js/chunk-HYF3CTKZ.cjs +13 -0
- package/build/js/chunk-HYF3CTKZ.cjs.map +1 -0
- package/build/js/chunk-JFDXL5SV.mjs +122 -0
- package/build/js/chunk-JFDXL5SV.mjs.map +1 -0
- package/build/js/chunk-VZM34PGO.cjs +180 -0
- package/build/js/chunk-VZM34PGO.cjs.map +1 -0
- package/build/js/handleGenerate-ER4YF43Z.mjs +89 -0
- package/build/js/handleGenerate-ER4YF43Z.mjs.map +1 -0
- package/build/js/handleGenerate-UTCLNZQO.cjs +111 -0
- package/build/js/handleGenerate-UTCLNZQO.cjs.map +1 -0
- package/build/js/handleSiteDeploy-7E5BNDQO.cjs +30 -0
- package/build/js/handleSiteDeploy-7E5BNDQO.cjs.map +1 -0
- package/build/js/handleSiteDeploy-ZFWLLEFU.mjs +28 -0
- package/build/js/handleSiteDeploy-ZFWLLEFU.mjs.map +1 -0
- package/build/js/index.cjs +290 -23
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +273 -6
- package/build/js/index.mjs.map +1 -1
- package/build/js/loginFlow-BZDDHHT5.cjs +10 -0
- package/build/js/loginFlow-KGLTXVZ6.mjs +4 -0
- package/build/js/siteDeleteCommand-FIB7KBAY.mjs +13 -0
- package/build/js/siteDeleteCommand-FIB7KBAY.mjs.map +1 -0
- package/build/js/siteDeleteCommand-UGHBNEC4.cjs +15 -0
- package/build/js/siteDeleteCommand-UGHBNEC4.cjs.map +1 -0
- package/build/js/siteUploadCommand-5VEJTNOQ.mjs +33 -0
- package/build/js/siteUploadCommand-5VEJTNOQ.mjs.map +1 -0
- package/build/js/siteUploadCommand-OEM2U44I.cjs +58 -0
- package/build/js/siteUploadCommand-OEM2U44I.cjs.map +1 -0
- package/build/js/siteVersionsCommand-HP4IUW56.cjs +29 -0
- package/build/js/siteVersionsCommand-HP4IUW56.cjs.map +1 -0
- package/build/js/siteVersionsCommand-X666N6ZP.mjs +27 -0
- package/build/js/siteVersionsCommand-X666N6ZP.mjs.map +1 -0
- package/build/types/commands/typescript/generate/TypescriptGenerateArgs.d.ts +1 -0
- package/package.json +4 -4
- package/build/js/chunk-MGT3UGXW.mjs +0 -5
- package/build/js/chunk-MGT3UGXW.mjs.map +0 -1
- package/build/js/chunk-TSZWWATC.mjs +0 -12
- package/build/js/chunk-TSZWWATC.mjs.map +0 -1
- package/build/js/chunk-UOKM237I.cjs +0 -17
- package/build/js/chunk-UOKM237I.cjs.map +0 -1
- package/build/js/chunk-V4QJCMF6.cjs +0 -7
- package/build/js/chunk-V4QJCMF6.cjs.map +0 -1
- package/build/js/chunk-X6QW63OH.cjs +0 -7
- package/build/js/chunk-XIJ2ZQRX.mjs +0 -5
- package/build/js/chunk-YHQGXNMB.mjs +0 -13
- package/build/js/chunk-YHQGXNMB.mjs.map +0 -1
- package/build/js/chunk-Z6SJPM6K.cjs +0 -20
- package/build/js/chunk-Z6SJPM6K.cjs.map +0 -1
- package/build/js/handleGenerate-4RFQDCQF.mjs +0 -13
- package/build/js/handleGenerate-4RFQDCQF.mjs.map +0 -1
- package/build/js/handleGenerate-6FGD7TOT.cjs +0 -35
- package/build/js/handleGenerate-6FGD7TOT.cjs.map +0 -1
- package/build/js/handleSiteDeploy-257ZNTYA.cjs +0 -12
- package/build/js/handleSiteDeploy-257ZNTYA.cjs.map +0 -1
- package/build/js/handleSiteDeploy-QCMJWAYI.mjs +0 -10
- package/build/js/handleSiteDeploy-QCMJWAYI.mjs.map +0 -1
- package/build/js/loginFlow-JIH374QN.mjs +0 -4
- package/build/js/loginFlow-MPM6J3CY.cjs +0 -10
- package/build/js/siteDeleteCommand-NY5W7NE3.cjs +0 -12
- package/build/js/siteDeleteCommand-NY5W7NE3.cjs.map +0 -1
- package/build/js/siteDeleteCommand-ZKHKGVVF.mjs +0 -10
- package/build/js/siteDeleteCommand-ZKHKGVVF.mjs.map +0 -1
- package/build/js/siteUploadCommand-OHSOCUL6.cjs +0 -38
- package/build/js/siteUploadCommand-OHSOCUL6.cjs.map +0 -1
- package/build/js/siteUploadCommand-PZEJVKRE.mjs +0 -13
- package/build/js/siteUploadCommand-PZEJVKRE.mjs.map +0 -1
- package/build/js/siteVersionsCommand-IE5QH56U.cjs +0 -13
- package/build/js/siteVersionsCommand-IE5QH56U.cjs.map +0 -1
- package/build/js/siteVersionsCommand-NVJD5BDH.mjs +0 -11
- package/build/js/siteVersionsCommand-NVJD5BDH.mjs.map +0 -1
- /package/build/js/{chunk-X6QW63OH.cjs.map → chunk-E2SEJZTC.mjs.map} +0 -0
- /package/build/js/{chunk-XIJ2ZQRX.mjs.map → chunk-HQDDGVB7.cjs.map} +0 -0
- /package/build/js/{loginFlow-JIH374QN.mjs.map → loginFlow-BZDDHHT5.cjs.map} +0 -0
- /package/build/js/{loginFlow-MPM6J3CY.cjs.map → loginFlow-KGLTXVZ6.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"open": "^9.1.0",
|
|
25
25
|
"yargs": "^17.7.2",
|
|
26
26
|
"@osdk/api": "1.0.1",
|
|
27
|
-
"@osdk/
|
|
28
|
-
"@osdk/
|
|
29
|
-
"@osdk/
|
|
27
|
+
"@osdk/generator": "1.0.2",
|
|
28
|
+
"@osdk/shared.net": "1.0.1",
|
|
29
|
+
"@osdk/gateway": "1.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/archiver": "^6.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
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}"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { a as a$2 } from './chunk-MGT3UGXW.mjs';
|
|
2
|
-
import { a as a$1 } from './chunk-XIJ2ZQRX.mjs';
|
|
3
|
-
import { conjureFetch } from 'conjure-lite';
|
|
4
|
-
import { consola, LogLevels } from 'consola';
|
|
5
|
-
import { createFetchHeaderMutator } from '@osdk/shared.net';
|
|
6
|
-
|
|
7
|
-
var d={};a$1(d,{clearDeployedVersion:()=>x,getContentSecurityPolicyAdditions:()=>h,getDeployedVersion:()=>S,getRegisteredSiteDomains:()=>g,getRequestedSiteDomains:()=>D,previewContentSecurityPolicy:()=>T,putContentSecurityPolicyAdditions:()=>$,requestSiteDomainForRepository:()=>v,unregisterSiteDomain:()=>F,updateDeployedVersion:()=>R});async function x(e,t){return conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"DELETE")}async function h(e,t){return conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/additions`,"GET")}async function S(e,t){return conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"GET")}async function g(e,t){return conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/registered`,"GET")}async function D(e,t){return conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/requested`,"GET")}async function T(e,t,o){return conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/preview`,"POST",o)}async function $(e,t,o){return conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/additions`,"PUT",o)}async function v(e,t,o){return conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/submit-registration`,"POST",o)}async function F(e,t,o){return conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/unregister`,"POST",o)}async function R(e,t,o){return conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"PUT",o)}var P={};a$1(P,{SiteAssetArtifactsService:()=>l});var l={};a$1(l,{deleteSiteVersion:()=>A,fetchSiteVersions:()=>w,uploadZippedSiteAsset:()=>j});function n(e,t=fetch){return createFetchHeaderMutator(z(t),async o=>{let r=await e();return o.set("Authorization",`Bearer ${r}`),o.set("Fetch-User-Agent",""),o})}function z(e=fetch){return function(o,r){return typeof o=="string"||o instanceof URL?consola.debug(`${r?.method??"GET"}: ${o.toString().trim()}`):consola.debug(`${o.method??"GET"}: ${o.url.toString().trim()}`),e(o,r).then(s=>(consola.debug("Finished fetch"),s))}}async function a(e,t){let o=n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),r=`
|
|
8
|
-
${e}/third-party-application-service/api/application-websites/${t}`,s=await o(r);if(s.status>=200&&s.status<300){let i=await s.json();return consola.debug(`Repository RID: ${i}`),i}throw new Error(`Unexpected response code ${s.status} (${s.statusText})`)}function m(e,t){return `${e}/artifacts/api/repositories/${t}/contents/release/siteasset`}async function A(e,t,o){let r=await a(e,t),s=`${m(e,r)}/versions/${o}`,c=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(s,{method:"DELETE"});if(c.status>=200&&c.status<300)return consola.level=LogLevels.debug,consola.debug(`${c.status} - Status Text: '${c.statusText}'`),!0;throw new a$2(c.status,`Unexpected response code ${c.status} (${c.statusText})`)}async function w(e,t){let o=await a(e,t),r=`${m(e,o)}/versions`,i=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(r);if(i.status===200)return (await i.json()).versions;throw new Error(`Unexpected response code ${i.status} (${i.statusText})`)}async function j(e,t,o,r){let s=await a(e,t),i=`${m(e,s)}/versions/zip/${o}`,p=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(i,{method:"PUT",body:r,headers:{"Content-Type":"application/octet-stream"},duplex:"half"});if(p.status>=200&&p.status<300)return consola.level=LogLevels.debug,consola.debug("Status Text: "+p.statusText),!0;throw p.status===409?new a$2(p.status,"Version already exists"):new a$2(p.status,`Unexpected response code ${p.status} (${p.statusText})`)}function M(e,t){return {fetchFn:n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),baseUrl:e,servicePath:t}}var V={};a$1(V,{fetchWebsiteRepositoryRid:()=>a});
|
|
9
|
-
|
|
10
|
-
export { d as a, P as b, M as c, V as d };
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=chunk-TSZWWATC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deleteSiteDeployment.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deploySite.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/getDeployedVersion.ts","../../src/generated/artifacts-sites/SitesDomainRegistryService/getRegisteredDomains.ts","../../src/net/artifacts/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts","../../src/net/createFetch.mts","../../src/net/third-party-application-service/fetchWebsiteRepositoryRid.mts","../../src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts","../../src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts","../../src/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.mts","../../src/net/createConjureContext.mts","../../src/net/third-party-application-service/index.mts"],"names":["ArtifactsSitesAdminV2Service_exports","__export","clearDeployedVersion","getContentSecurityPolicyAdditions","getDeployedVersion","getRegisteredSiteDomains","getRequestedSiteDomains","previewContentSecurityPolicy","putContentSecurityPolicyAdditions","requestSiteDomainForRepository","unregisterSiteDomain","updateDeployedVersion","conjureFetch","ctx","repositoryRid","request","contentSecurityPolicyAdditions","version","artifacts_exports","SiteAssetArtifactsService_exports","deleteSiteVersion","fetchSiteVersions","uploadZippedSiteAsset","consola","LogLevels","createFetchHeaderMutator","createFetch","tokenProvider","fetchFn","createDebugLoggingFetch","headers","token","input","init","a","fetchWebsiteRepositoryRid","baseUrl","thirdPartyAppRid","fetch","url","result","getSiteAssetBaseUrl","foundryBaseUrl","ExitProcessError","zipFile","createConjureContext","servicePath","third_party_application_service_exports"],"mappings":"kFAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,sCAAAC,EAAA,uBAAAC,EAAA,6BAAAC,EAAA,4BAAAC,EAAA,iCAAAC,EAAA,sCAAAC,EAAA,mCAAAC,EAAA,yBAAAC,EAAA,0BAAAC,ICgBA,OAAS,gBAAAC,MAAoB,eAQ7B,eAAsBV,EAAqBW,EAAKC,EAAe,CAC7D,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,oBAAqB,QAAQ,CACnG,CCVA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBT,EAAkCU,EAAKC,EAAe,CAC1E,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,iBAAkB,KAAK,CAC7F,CCRA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBR,EAAmBS,EAAKC,EAAe,CAC3D,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,oBAAqB,KAAK,CAChG,CCRA,OAAS,gBAAAF,MAAoB,eAO7B,eAAsBP,EAAyBQ,EAAKC,EAAe,CACjE,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,sBAAuB,KAAK,CAClG,CCTA,OAAS,gBAAAF,MAAoB,eAQ7B,eAAsBN,EAAwBO,EAAKC,EAAe,CAChE,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,qBAAsB,KAAK,CACjG,CCVA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBL,EAA6BM,EAAKC,EAAeC,EAAS,CAC9E,OAAOH,EAAaC,EAAK,8BAA8BC,CAAa,eAAgB,OAAQC,CAAO,CACrG,CCRA,OAAS,gBAAAH,MAAoB,eAM7B,eAAsBJ,EAAkCK,EAAKC,EAAeE,EAAg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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 { clearDeployedVersion } from \"./ArtifactsSitesAdminV2Service/clearDeployedVersion.js\";\nexport { getContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.js\";\nexport { getDeployedVersion } from \"./ArtifactsSitesAdminV2Service/getDeployedVersion.js\";\nexport { getRegisteredSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.js\";\nexport { getRequestedSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRequestedSiteDomains.js\";\nexport { previewContentSecurityPolicy } from \"./ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.js\";\nexport { putContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.js\";\nexport { requestSiteDomainForRepository } from \"./ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.js\";\nexport { unregisterSiteDomain } from \"./ArtifactsSitesAdminV2Service/unregisterSiteDomain.js\";\nexport { updateDeployedVersion } from \"./ArtifactsSitesAdminV2Service/updateDeployedVersion.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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Clears the deployed version while leaving the associated domain, visiting the associated domain in this state\n * will return an error.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function clearDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the CSP additions configured for a repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the deployed version that will be served for a given siteasset repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been successfully registered with the given repository. Visiting a successfully\n * registered domain should serve the registered repository assets.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRegisteredSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been requested for a given repository. For control panel domains that require\n * an approval, this will also include pending requests. Closed/rejected requests will only be included as long\n * as their domain hasn't been re-requested for another repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRequestedSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Preview what the CSP that will be served with the site looks like.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function previewContentSecurityPolicy(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Set the CSP additions configured for a repository.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"PUT\", contentSecurityPolicyAdditions);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Requests the registration of a domain with the provided repository, this will result in an approvals task\n * getting created for approval by an admin.\n *\n * Once the task has been approved, visiting the domain will serve the deployed version, if any is deployed.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function requestSiteDomainForRepository(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Unregisters a domain from a repository, visiting the domain will no longer serve the repository assets.\n *\n * Depending on how the domain for the repository was setup, this might also result in deleting the domain\n * itself.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function unregisterSiteDomain(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the asset version of the siteasset repository that will be served.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function updateDeployedVersion(ctx, repositoryRid, version) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"PUT\", version);\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 { conjureFetch } from \"conjure-lite\";\nexport async function deleteSiteDeployment(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\nexport async function deploySite(ctx, deploySiteRequest) {\n return conjureFetch(ctx, `/sites/admin/deploy`, \"POST\", deploySiteRequest);\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 { conjureFetch } from \"conjure-lite\";\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}/deployedVersion`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Get all registered domains regardless of whether they're in use or not.\n */\nexport async function getRegisteredDomains(ctx) {\n return conjureFetch(ctx, `/sites/configRegisteredDomains/list`, \"GET\");\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 * as SiteAssetArtifactsService from \"./SiteAssetArtifactsService/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\nexport { deleteSiteVersion } from \"./deleteSiteVersion.mjs\";\nexport { fetchSiteVersions } from \"./fetchSiteVersions.mjs\";\nexport { uploadZippedSiteAsset } from \"./uploadSiteVersion.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 { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function deleteSiteVersion(baseUrl, thirdPartyAppRid, version) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\n consola.debug(`${result.status} - Status Text: '${result.statusText}'`);\n return true;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetchHeaderMutator } from \"@osdk/shared.net\";\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}","/*\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 \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function fetchSiteVersions(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}","/*\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 \"../../third-party-application-service/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}","/*\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\";\nexport function createConjureContext(baseUrl, servicePath) {\n return {\n fetchFn: createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN),\n baseUrl,\n servicePath\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 { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkV4QJCMF6_cjs = require('./chunk-V4QJCMF6.cjs');
|
|
4
|
-
var chunkX6QW63OH_cjs = require('./chunk-X6QW63OH.cjs');
|
|
5
|
-
var conjureLite = require('conjure-lite');
|
|
6
|
-
var consola = require('consola');
|
|
7
|
-
var shared_net = require('@osdk/shared.net');
|
|
8
|
-
|
|
9
|
-
var d={};chunkX6QW63OH_cjs.a(d,{clearDeployedVersion:()=>x,getContentSecurityPolicyAdditions:()=>h,getDeployedVersion:()=>S,getRegisteredSiteDomains:()=>g,getRequestedSiteDomains:()=>D,previewContentSecurityPolicy:()=>T,putContentSecurityPolicyAdditions:()=>$,requestSiteDomainForRepository:()=>v,unregisterSiteDomain:()=>F,updateDeployedVersion:()=>R});async function x(e,t){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"DELETE")}async function h(e,t){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/additions`,"GET")}async function S(e,t){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"GET")}async function g(e,t){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/registered`,"GET")}async function D(e,t){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/requested`,"GET")}async function T(e,t,o){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/preview`,"POST",o)}async function $(e,t,o){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/csp/additions`,"PUT",o)}async function v(e,t,o){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/submit-registration`,"POST",o)}async function F(e,t,o){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/domains/unregister`,"POST",o)}async function R(e,t,o){return conjureLite.conjureFetch(e,`/sites/v2/admin/repository/${t}/deployed-version`,"PUT",o)}var P={};chunkX6QW63OH_cjs.a(P,{SiteAssetArtifactsService:()=>l});var l={};chunkX6QW63OH_cjs.a(l,{deleteSiteVersion:()=>A,fetchSiteVersions:()=>w,uploadZippedSiteAsset:()=>j});function n(e,t=fetch){return shared_net.createFetchHeaderMutator(z(t),async o=>{let r=await e();return o.set("Authorization",`Bearer ${r}`),o.set("Fetch-User-Agent",""),o})}function z(e=fetch){return function(o,r){return typeof o=="string"||o instanceof URL?consola.consola.debug(`${r?.method??"GET"}: ${o.toString().trim()}`):consola.consola.debug(`${o.method??"GET"}: ${o.url.toString().trim()}`),e(o,r).then(s=>(consola.consola.debug("Finished fetch"),s))}}async function a(e,t){let o=n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),r=`
|
|
10
|
-
${e}/third-party-application-service/api/application-websites/${t}`,s=await o(r);if(s.status>=200&&s.status<300){let i=await s.json();return consola.consola.debug(`Repository RID: ${i}`),i}throw new Error(`Unexpected response code ${s.status} (${s.statusText})`)}function m(e,t){return `${e}/artifacts/api/repositories/${t}/contents/release/siteasset`}async function A(e,t,o){let r=await a(e,t),s=`${m(e,r)}/versions/${o}`,c=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(s,{method:"DELETE"});if(c.status>=200&&c.status<300)return consola.consola.level=consola.LogLevels.debug,consola.consola.debug(`${c.status} - Status Text: '${c.statusText}'`),!0;throw new chunkV4QJCMF6_cjs.a(c.status,`Unexpected response code ${c.status} (${c.statusText})`)}async function w(e,t){let o=await a(e,t),r=`${m(e,o)}/versions`,i=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(r);if(i.status===200)return (await i.json()).versions;throw new Error(`Unexpected response code ${i.status} (${i.statusText})`)}async function j(e,t,o,r){let s=await a(e,t),i=`${m(e,s)}/versions/zip/${o}`,p=await n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN)(i,{method:"PUT",body:r,headers:{"Content-Type":"application/octet-stream"},duplex:"half"});if(p.status>=200&&p.status<300)return consola.consola.level=consola.LogLevels.debug,consola.consola.debug("Status Text: "+p.statusText),!0;throw p.status===409?new chunkV4QJCMF6_cjs.a(p.status,"Version already exists"):new chunkV4QJCMF6_cjs.a(p.status,`Unexpected response code ${p.status} (${p.statusText})`)}function M(e,t){return {fetchFn:n(()=>process.env.FOUNDRY_SDK_AUTH_TOKEN),baseUrl:e,servicePath:t}}var V={};chunkX6QW63OH_cjs.a(V,{fetchWebsiteRepositoryRid:()=>a});
|
|
11
|
-
|
|
12
|
-
exports.a = d;
|
|
13
|
-
exports.b = P;
|
|
14
|
-
exports.c = M;
|
|
15
|
-
exports.d = V;
|
|
16
|
-
//# sourceMappingURL=out.js.map
|
|
17
|
-
//# sourceMappingURL=chunk-UOKM237I.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/clearDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/getRequestedSiteDomains.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/unregisterSiteDomain.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminV2Service/updateDeployedVersion.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deleteSiteDeployment.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/deploySite.ts","../../src/generated/artifacts-sites/ArtifactsSitesAdminService/getDeployedVersion.ts","../../src/generated/artifacts-sites/SitesDomainRegistryService/getRegisteredDomains.ts","../../src/net/artifacts/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/index.mts","../../src/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.mts","../../src/net/createFetch.mts","../../src/net/third-party-application-service/fetchWebsiteRepositoryRid.mts","../../src/net/artifacts/SiteAssetArtifactsService/getSiteAssetBaseUrl.mts","../../src/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.mts","../../src/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.mts","../../src/net/createConjureContext.mts","../../src/net/third-party-application-service/index.mts"],"names":["ArtifactsSitesAdminV2Service_exports","__export","clearDeployedVersion","getContentSecurityPolicyAdditions","getDeployedVersion","getRegisteredSiteDomains","getRequestedSiteDomains","previewContentSecurityPolicy","putContentSecurityPolicyAdditions","requestSiteDomainForRepository","unregisterSiteDomain","updateDeployedVersion","conjureFetch","ctx","repositoryRid","request","contentSecurityPolicyAdditions","version","artifacts_exports","SiteAssetArtifactsService_exports","deleteSiteVersion","fetchSiteVersions","uploadZippedSiteAsset","consola","LogLevels","createFetchHeaderMutator","createFetch","tokenProvider","fetchFn","createDebugLoggingFetch","headers","token","input","init","a","fetchWebsiteRepositoryRid","baseUrl","thirdPartyAppRid","fetch","url","result","getSiteAssetBaseUrl","foundryBaseUrl","ExitProcessError","zipFile","createConjureContext","servicePath","third_party_application_service_exports"],"mappings":"kFAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,sCAAAC,EAAA,uBAAAC,EAAA,6BAAAC,EAAA,4BAAAC,EAAA,iCAAAC,EAAA,sCAAAC,EAAA,mCAAAC,EAAA,yBAAAC,EAAA,0BAAAC,ICgBA,OAAS,gBAAAC,MAAoB,eAQ7B,eAAsBV,EAAqBW,EAAKC,EAAe,CAC7D,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,oBAAqB,QAAQ,CACnG,CCVA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBT,EAAkCU,EAAKC,EAAe,CAC1E,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,iBAAkB,KAAK,CAC7F,CCRA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBR,EAAmBS,EAAKC,EAAe,CAC3D,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,oBAAqB,KAAK,CAChG,CCRA,OAAS,gBAAAF,MAAoB,eAO7B,eAAsBP,EAAyBQ,EAAKC,EAAe,CACjE,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,sBAAuB,KAAK,CAClG,CCTA,OAAS,gBAAAF,MAAoB,eAQ7B,eAAsBN,EAAwBO,EAAKC,EAAe,CAChE,OAAOF,EAAaC,EAAK,8BAA8BC,CAAa,qBAAsB,KAAK,CACjG,CCVA,OAAS,gBAAAF,MAAoB,eAM7B,eAAsBL,EAA6BM,EAAKC,EAAeC,EAAS,CAC9E,OAAOH,EAAaC,EAAK,8BAA8BC,CAAa,eAAgB,OAAQC,CAAO,CACrG,CCRA,OAAS,gBAAAH,MAAo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AA9C,EAAA8C,EAAA,+BAAAZ","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 { clearDeployedVersion } from \"./ArtifactsSitesAdminV2Service/clearDeployedVersion.js\";\nexport { getContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/getContentSecurityPolicyAdditions.js\";\nexport { getDeployedVersion } from \"./ArtifactsSitesAdminV2Service/getDeployedVersion.js\";\nexport { getRegisteredSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRegisteredSiteDomains.js\";\nexport { getRequestedSiteDomains } from \"./ArtifactsSitesAdminV2Service/getRequestedSiteDomains.js\";\nexport { previewContentSecurityPolicy } from \"./ArtifactsSitesAdminV2Service/previewContentSecurityPolicy.js\";\nexport { putContentSecurityPolicyAdditions } from \"./ArtifactsSitesAdminV2Service/putContentSecurityPolicyAdditions.js\";\nexport { requestSiteDomainForRepository } from \"./ArtifactsSitesAdminV2Service/requestSiteDomainForRepository.js\";\nexport { unregisterSiteDomain } from \"./ArtifactsSitesAdminV2Service/unregisterSiteDomain.js\";\nexport { updateDeployedVersion } from \"./ArtifactsSitesAdminV2Service/updateDeployedVersion.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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Clears the deployed version while leaving the associated domain, visiting the associated domain in this state\n * will return an error.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function clearDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the CSP additions configured for a repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getContentSecurityPolicyAdditions(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get the deployed version that will be served for a given siteasset repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been successfully registered with the given repository. Visiting a successfully\n * registered domain should serve the registered repository assets.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRegisteredSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/registered`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Get domains that have been requested for a given repository. For control panel domains that require\n * an approval, this will also include pending requests. Closed/rejected requests will only be included as long\n * as their domain hasn't been re-requested for another repository.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function getRequestedSiteDomains(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/requested`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Preview what the CSP that will be served with the site looks like.\n *\n * artifacts:sites:read-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function previewContentSecurityPolicy(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/preview`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Set the CSP additions configured for a repository.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function putContentSecurityPolicyAdditions(ctx, repositoryRid, contentSecurityPolicyAdditions) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/csp/additions`, \"PUT\", contentSecurityPolicyAdditions);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Requests the registration of a domain with the provided repository, this will result in an approvals task\n * getting created for approval by an admin.\n *\n * Once the task has been approved, visiting the domain will serve the deployed version, if any is deployed.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function requestSiteDomainForRepository(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/submit-registration`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Unregisters a domain from a repository, visiting the domain will no longer serve the repository assets.\n *\n * Depending on how the domain for the repository was setup, this might also result in deleting the domain\n * itself.\n *\n * artifacts:sites:manage-domains permission is needed on the repository rid to call this endpoint.\n */\nexport async function unregisterSiteDomain(ctx, repositoryRid, request) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/domains/unregister`, \"POST\", request);\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 { conjureFetch } from \"conjure-lite\";\n/**\n * Sets the asset version of the siteasset repository that will be served.\n *\n * artifacts:sites:write-deployment-info permission is needed on the repository rid to call this endpoint.\n */\nexport async function updateDeployedVersion(ctx, repositoryRid, version) {\n return conjureFetch(ctx, `/sites/v2/admin/repository/${repositoryRid}/deployed-version`, \"PUT\", version);\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 { conjureFetch } from \"conjure-lite\";\nexport async function deleteSiteDeployment(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}`, \"DELETE\");\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 { conjureFetch } from \"conjure-lite\";\nexport async function deploySite(ctx, deploySiteRequest) {\n return conjureFetch(ctx, `/sites/admin/deploy`, \"POST\", deploySiteRequest);\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 { conjureFetch } from \"conjure-lite\";\nexport async function getDeployedVersion(ctx, repositoryRid) {\n return conjureFetch(ctx, `/sites/admin/${repositoryRid}/deployedVersion`, \"GET\");\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 { conjureFetch } from \"conjure-lite\";\n\n/**\n * Get all registered domains regardless of whether they're in use or not.\n */\nexport async function getRegisteredDomains(ctx) {\n return conjureFetch(ctx, `/sites/configRegisteredDomains/list`, \"GET\");\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 * as SiteAssetArtifactsService from \"./SiteAssetArtifactsService/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\nexport { deleteSiteVersion } from \"./deleteSiteVersion.mjs\";\nexport { fetchSiteVersions } from \"./fetchSiteVersions.mjs\";\nexport { uploadZippedSiteAsset } from \"./uploadSiteVersion.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 { consola, LogLevels } from \"consola\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { createFetch } from \"../../createFetch.mjs\";\nimport { fetchWebsiteRepositoryRid } from \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function deleteSiteVersion(baseUrl, thirdPartyAppRid, version) {\n const repositoryRid = await fetchWebsiteRepositoryRid(baseUrl, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(baseUrl, repositoryRid)}/versions/${version}`;\n const fetch = createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\n consola.level = LogLevels.debug;\n consola.debug(`${result.status} - Status Text: '${result.statusText}'`);\n return true;\n } else {\n throw new ExitProcessError(result.status, `Unexpected response code ${result.status} (${result.statusText})`);\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 { createFetchHeaderMutator } from \"@osdk/shared.net\";\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}","/*\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 \"../../third-party-application-service/fetchWebsiteRepositoryRid.mjs\";\nimport { getSiteAssetBaseUrl } from \"./getSiteAssetBaseUrl.mjs\";\nexport async function fetchSiteVersions(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}","/*\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 \"../../third-party-application-service/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}","/*\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\";\nexport function createConjureContext(baseUrl, servicePath) {\n return {\n fetchFn: createFetch(() => process.env.FOUNDRY_SDK_AUTH_TOKEN),\n baseUrl,\n servicePath\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 { fetchWebsiteRepositoryRid } from \"./fetchWebsiteRepositoryRid.mjs\";"]}
|
|
@@ -1 +0,0 @@
|
|
|
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}"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import s from 'consola';
|
|
2
|
-
import { getRandomValues, subtle } from 'crypto';
|
|
3
|
-
import { createServer } from 'http';
|
|
4
|
-
import x from 'open';
|
|
5
|
-
import { join } from 'path/posix';
|
|
6
|
-
import { exit } from 'process';
|
|
7
|
-
import { parse } from 'url';
|
|
8
|
-
|
|
9
|
-
function h(t){return t.error!=null}async function T(t){s.start(`Authenticating using application id: ${t.applicationId}`);let o="http://localhost:8080/auth/callback",n=parse(o).port,r,a=new Promise(c=>{r=c;}),e=createServer((c,_)=>{let S=parse(c.url,!0).query;_.end("Authenticated"),r(S.code);});e.on("error",c=>{c.code==="EADDRINUSE"&&(s.error(`Port ${n} is already in use, unable to perform authentication flow.`),e.close(),exit(1));}),e.listen(n);let p=t.applicationId,i=g(),d=g(),y=await A(d),u=R(t.baseUrl,p,i,o,y);try{await x(u);}catch{s.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${u}`);}let U=await a;e.close();let l=await E(p,o,U,t.baseUrl,d);return h(l)&&(s.error("Unable to authenticate",l.error,l.error_description),exit(1)),s.success("Successfully authenticated!"),l}function g(t=128){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=[],r=new Uint8Array(1),a=256-256%o.length;for(;n.length<t;)getRandomValues(r),r[0]<a&&n.push(o[r[0]%o.length]);return n.join("")}async function A(t){let o=new TextEncoder().encode(t),n=await subtle.digest("SHA-256",o),r="S256";return {codeChallenge:btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,""),codeChallengeMethod:r}}function R(t,o,n,r,a){let e=new URLSearchParams;return e.append("client_id",o),e.append("response_type","code"),e.append("state",n),e.append("redirect_uri",r),e.append("code_challenge",a.codeChallenge),e.append("code_challenge_method",a.codeChallengeMethod),e.append("scope",["offline_access","api:read-data"].join(" ")),join(t,"multipass","api","oauth2","authorize")+"?"+e.toString()}async function E(t,o,n,r,a){let e=new URLSearchParams;e.append("client_id",t),e.append("grant_type","authorization_code"),e.append("code",n),e.append("redirect_uri",o),e.append("code_verifier",a);let p=join(r,"multipass","api","oauth2","token")+`?state=${a}`;try{return await(await fetch(p,{body:e.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"})).json()}catch(i){throw new Error(`Failed to get token: ${i?i.toString():"Unknown error"}`)}}
|
|
10
|
-
|
|
11
|
-
export { T as a };
|
|
12
|
-
//# sourceMappingURL=out.js.map
|
|
13
|
-
//# sourceMappingURL=chunk-YHQGXNMB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/auth/login/loginFlow.ts","../../src/commands/auth/login/token.ts"],"names":["consola","getRandomValues","subtle","createServer","open","join","exit","parse","isTokenErrorResponse","response","invokeLoginFlow","args","redirectUrl","port","resolve","authCode","_res","server","req","res","query","e","clientId","state","generateRandomString","codeVerifier","codeChallenge","generateCodeChallenge","authorizeUrl","generateAuthorizeUrl","code","token","getTokenWithCodeVerifier","length","characters","output","array","maxIndex","data","digest","codeChallengeMethod","baseUrl","queryParams","body","tokenUrl"],"mappings":"AAiBA,OAAOA,MAAa,UACpB,OAAS,mBAAAC,EAAiB,UAAAC,MAAc,SACxC,OAAS,gBAAAC,MAAoB,OAC7B,OAAOC,MAAU,OACjB,OAAS,QAAAC,MAAY,aACrB,OAAS,QAAAC,MAAY,UACrB,OAAS,SAAAC,MAAa,MCPf,SAASC,EAAqBC,EAAU,CAC7C,OAAOA,EAAS,OAAS,IAC3B,CDOA,eAAOC,EAAuCC,EAAM,CAClDX,EAAQ,MAAM,wCAAwCW,EAAK,aAAa,EAAE,EAC1E,IAAMC,EAAc,sCACdC,EAAON,EAAMK,CAAW,EAAE,KAC5BE,EACEC,EAAW,IAAI,QAAQC,GAAQ,CACnCF,EAAUE,CACZ,CAAC,EACKC,EAASd,EAAa,CAACe,EAAKC,IAAQ,CACxC,IAAMC,EAAQb,EAAMW,EAAI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Ae,EAAE,CAC9E,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\n// eslint-disable-next-line import/no-named-as-default\nimport consola from \"consola\";\nimport { getRandomValues, subtle } from \"crypto\";\nimport { createServer } from \"http\";\nimport open from \"open\";\nimport { join } from \"path/posix\";\nimport { exit } from \"process\";\nimport { parse } from \"url\";\nimport { isTokenErrorResponse } from \"./token.js\";\nexport default async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n const code = await authCode;\n server.close();\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e ? e.toString() : \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var s = require('consola');
|
|
4
|
-
var crypto = require('crypto');
|
|
5
|
-
var http = require('http');
|
|
6
|
-
var x = require('open');
|
|
7
|
-
var posix = require('path/posix');
|
|
8
|
-
var process = require('process');
|
|
9
|
-
var url = require('url');
|
|
10
|
-
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
var s__default = /*#__PURE__*/_interopDefault(s);
|
|
14
|
-
var x__default = /*#__PURE__*/_interopDefault(x);
|
|
15
|
-
|
|
16
|
-
function h(t){return t.error!=null}async function T(t){s__default.default.start(`Authenticating using application id: ${t.applicationId}`);let o="http://localhost:8080/auth/callback",n=url.parse(o).port,r,a=new Promise(c=>{r=c;}),e=http.createServer((c,_)=>{let S=url.parse(c.url,!0).query;_.end("Authenticated"),r(S.code);});e.on("error",c=>{c.code==="EADDRINUSE"&&(s__default.default.error(`Port ${n} is already in use, unable to perform authentication flow.`),e.close(),process.exit(1));}),e.listen(n);let p=t.applicationId,i=g(),d=g(),y=await A(d),u=R(t.baseUrl,p,i,o,y);try{await x__default.default(u);}catch{s__default.default.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${u}`);}let U=await a;e.close();let l=await E(p,o,U,t.baseUrl,d);return h(l)&&(s__default.default.error("Unable to authenticate",l.error,l.error_description),process.exit(1)),s__default.default.success("Successfully authenticated!"),l}function g(t=128){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=[],r=new Uint8Array(1),a=256-256%o.length;for(;n.length<t;)crypto.getRandomValues(r),r[0]<a&&n.push(o[r[0]%o.length]);return n.join("")}async function A(t){let o=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",o),r="S256";return {codeChallenge:btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,""),codeChallengeMethod:r}}function R(t,o,n,r,a){let e=new URLSearchParams;return e.append("client_id",o),e.append("response_type","code"),e.append("state",n),e.append("redirect_uri",r),e.append("code_challenge",a.codeChallenge),e.append("code_challenge_method",a.codeChallengeMethod),e.append("scope",["offline_access","api:read-data"].join(" ")),posix.join(t,"multipass","api","oauth2","authorize")+"?"+e.toString()}async function E(t,o,n,r,a){let e=new URLSearchParams;e.append("client_id",t),e.append("grant_type","authorization_code"),e.append("code",n),e.append("redirect_uri",o),e.append("code_verifier",a);let p=posix.join(r,"multipass","api","oauth2","token")+`?state=${a}`;try{return await(await fetch(p,{body:e.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"})).json()}catch(i){throw new Error(`Failed to get token: ${i?i.toString():"Unknown error"}`)}}
|
|
17
|
-
|
|
18
|
-
exports.a = T;
|
|
19
|
-
//# sourceMappingURL=out.js.map
|
|
20
|
-
//# sourceMappingURL=chunk-Z6SJPM6K.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/auth/login/loginFlow.ts","../../src/commands/auth/login/token.ts"],"names":["consola","getRandomValues","subtle","createServer","open","join","exit","parse","isTokenErrorResponse","response","invokeLoginFlow","args","redirectUrl","port","resolve","authCode","_res","server","req","res","query","e","clientId","state","generateRandomString","codeVerifier","codeChallenge","generateCodeChallenge","authorizeUrl","generateAuthorizeUrl","code","token","getTokenWithCodeVerifier","length","characters","output","array","maxIndex","data","digest","codeChallengeMethod","baseUrl","queryParams","body","tokenUrl"],"mappings":"AAiBA,OAAOA,MAAa,UACpB,OAAS,mBAAAC,EAAiB,UAAAC,MAAc,SACxC,OAAS,gBAAAC,MAAoB,OAC7B,OAAOC,MAAU,OACjB,OAAS,QAAAC,MAAY,aACrB,OAAS,QAAAC,MAAY,UACrB,OAAS,SAAAC,MAAa,MCPf,SAASC,EAAqBC,EAAU,CAC7C,OAAOA,EAAS,OAAS,IAC3B,CDOA,eAAOC,EAAuCC,EAAM,CAClDX,EAAQ,MAAM,wCAAwCW,EAAK,aAAa,EAAE,EAC1E,IAAMC,EAAc,sCACdC,EAAON,EAAMK,CAAW,EAAE,KAC5BE,EACEC,EAAW,IAAI,QAAQC,GAAQ,CACnCF,EAAUE,CACZ,CAAC,EACKC,EAASd,EAAa,CAACe,EAAKC,IAAQ,CACxC,IAAMC,EAAQb,EAAMW,EAAI,IAAK,EAAI,EAAE,MACnCC,EAAI,IAAI,eAAe,EACvBL,EAAQM,EAAM,IAAO,CACvB,CAAC,EACDH,EAAO,GAAG,QAASI,GAAK,CAClBA,EAAE,OAAS,eACbrB,EAAQ,MAAM,QAAQa,CAAI,4DAA4D,EACtFI,EAAO,MAAM,EACbX,EAAK,CAAC,EAEV,CAAC,EACDW,EAAO,OAAOJ,CAAI,EAClB,IAAMS,EAAWX,EAAK,cAChBY,EAAQC,EAAqB,EAC7BC,EAAeD,EAAqB,EACpCE,EAAgB,MAAMC,EAAsBF,CAAY,EACxDG,EAAeC,EAAqBlB,EAAK,QAASW,EAAUC,EAAOX,EAAac,CAAa,EACnG,GAAI,CACF,MAAMtB,EAAKwB,CAAY,CACzB,MAAQ,CACN5B,EAAQ,KAAK,oFAAoF4B,CAAY,EAAE,CACjH,CACA,IAAME,EAAO,MAAMf,E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AC,iBAAkB,eAAe,EAAE,KAAK,GAAG,CAAC,EAClErC,EAAKoC,EAAS,YAAa,MAAO,SAAU,WAAW,EAAI,IAAMC,EAAY,SAAS,CAC/F,CACA,eAAeV,EAAyBV,EAAUV,EAAakB,EAAMW,EAAShB,EAAc,CAC1F,IAAMkB,EAAO,IAAI,gBACjBA,EAAK,OAAO,YAAarB,CAAQ,EACjCqB,EAAK,OAAO,aAAc,oBAAoB,EAC9CA,EAAK,OAAO,OAAQb,CAAI,EACxBa,EAAK,OAAO,eAAgB/B,CAAW,EACvC+B,EAAK,OAAO,gBAAiBlB,CAAY,EACzC,IAAMmB,EAAWvC,EAAKoC,EAAS,YAAa,MAAO,SAAU,OAAO,EAAI,UAAUhB,CAAY,GAC9F,GAAI,CASF,OADqB,MAPJ,MAAM,MAAMmB,EAAU,CACrC,KAAMD,EAAK,SAAS,EACpB,QAAS,CACP,eAAgB,mCAClB,EACA,OAAQ,MACV,CAAC,GACmC,KAAK,CAE3C,OAAStB,EAAG,CACV,MAAM,IAAI,MAAM,wBAAwBA,EAAIA,EAAE,SAAS,EAAI,eAAe,EAAE,CAC9E,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\n// eslint-disable-next-line import/no-named-as-default\nimport consola from \"consola\";\nimport { getRandomValues, subtle } from \"crypto\";\nimport { createServer } from \"http\";\nimport open from \"open\";\nimport { join } from \"path/posix\";\nimport { exit } from \"process\";\nimport { parse } from \"url\";\nimport { isTokenErrorResponse } from \"./token.js\";\nexport default async function invokeLoginFlow(args) {\n consola.start(`Authenticating using application id: ${args.applicationId}`);\n const redirectUrl = \"http://localhost:8080/auth/callback\";\n const port = parse(redirectUrl).port;\n let resolve;\n const authCode = new Promise(_res => {\n resolve = _res;\n });\n const server = createServer((req, res) => {\n const query = parse(req.url, true).query;\n res.end(\"Authenticated\");\n resolve(query[\"code\"]);\n });\n server.on(\"error\", e => {\n if (e.code === \"EADDRINUSE\") {\n consola.error(`Port ${port} is already in use, unable to perform authentication flow.`);\n server.close();\n exit(1);\n }\n });\n server.listen(port);\n const clientId = args.applicationId;\n const state = generateRandomString();\n const codeVerifier = generateRandomString();\n const codeChallenge = await generateCodeChallenge(codeVerifier);\n const authorizeUrl = generateAuthorizeUrl(args.baseUrl, clientId, state, redirectUrl, codeChallenge);\n try {\n await open(authorizeUrl);\n } catch {\n consola.warn(`Unable to open browser, please open this url in your browser to to authenticate: ${authorizeUrl}`);\n }\n const code = await authCode;\n server.close();\n const token = await getTokenWithCodeVerifier(clientId, redirectUrl, code, args.baseUrl, codeVerifier);\n if (isTokenErrorResponse(token)) {\n consola.error(\"Unable to authenticate\", token.error, token.error_description);\n exit(1);\n }\n consola.success(`Successfully authenticated!`);\n return token;\n}\nfunction generateRandomString(length = 128) {\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~\";\n let output = [];\n let array = new Uint8Array(1);\n const maxIndex = 256 - 256 % characters.length;\n while (output.length < length) {\n getRandomValues(array);\n if (array[0] < maxIndex) {\n output.push(characters[array[0] % characters.length]);\n }\n }\n return output.join(\"\");\n}\nasync function generateCodeChallenge(codeVerifier) {\n const data = new TextEncoder().encode(codeVerifier);\n const digest = await subtle.digest(\"SHA-256\", data);\n const codeChallengeMethod = \"S256\";\n const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest))).replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=/g, \"\");\n return {\n codeChallenge,\n codeChallengeMethod\n };\n}\nfunction generateAuthorizeUrl(baseUrl, clientId, state, redirectUrl, codeChallenge) {\n const queryParams = new URLSearchParams();\n queryParams.append(\"client_id\", clientId);\n queryParams.append(\"response_type\", \"code\");\n queryParams.append(\"state\", state);\n queryParams.append(\"redirect_uri\", redirectUrl);\n queryParams.append(\"code_challenge\", codeChallenge.codeChallenge);\n queryParams.append(\"code_challenge_method\", codeChallenge.codeChallengeMethod);\n queryParams.append(\"scope\", [\"offline_access\", \"api:read-data\"].join(\" \"));\n return join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"authorize\") + `?` + queryParams.toString();\n}\nasync function getTokenWithCodeVerifier(clientId, redirectUrl, code, baseUrl, codeVerifier) {\n const body = new URLSearchParams();\n body.append(\"client_id\", clientId);\n body.append(\"grant_type\", \"authorization_code\");\n body.append(\"code\", code);\n body.append(\"redirect_uri\", redirectUrl);\n body.append(\"code_verifier\", codeVerifier);\n const tokenUrl = join(baseUrl, \"multipass\", \"api\", \"oauth2\", \"token\") + `?state=${codeVerifier}`;\n try {\n const response = await fetch(tokenUrl, {\n body: body.toString(),\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n method: \"POST\"\n });\n const responseText = await response.json();\n return responseText;\n } catch (e) {\n throw new Error(`Failed to get token: ${e ? e.toString() : \"Unknown error\"}`);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isTokenErrorResponse(response) {\n return response.error != null;\n}"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-YHQGXNMB.mjs';
|
|
2
|
-
import './chunk-XIJ2ZQRX.mjs';
|
|
3
|
-
import { listOntologiesV2, getOntologyFullMetadata } from '@osdk/gateway/requests';
|
|
4
|
-
import { generateClientSdkVersionTwoPointZero, generateClientSdkVersionOneDotOne } from '@osdk/generator';
|
|
5
|
-
import { createClientContext, createOpenApiRequest } from '@osdk/shared.net';
|
|
6
|
-
import { consola } from 'consola';
|
|
7
|
-
import * as a from 'fs';
|
|
8
|
-
|
|
9
|
-
async function y(t){if(t.ontologyPath)await h(t);else if(t.stack&&t.clientId)await F(t);else throw new Error("Must have specified ontologyPath or stack and clientId");consola.info("OSDK Generated!");}async function h(t){let e=JSON.parse(await a.promises.readFile(t.ontologyPath,"utf-8"));await d(e,t);}async function F(t){let{stack:e,clientId:o}=t,i=await a$1({applicationId:o,baseUrl:e,verbose:0}),{fetch:l}=createClientContext({metadata:{userAgent:"@osdk/cli/0.0.0 ()"}},t.stack,()=>i.access_token);try{let n=await listOntologiesV2(createOpenApiRequest(e,l));n.data.length!==1&&consola.error(`Could not look up ontology with these credentials. Found ${n.data.length} ontologies.`);let f=await getOntologyFullMetadata(createOpenApiRequest(e,l),n.data[0].apiName);await d(f,t);}catch(n){consola.error("Failed to download the ontology",n);}}async function d(t,e){e.beta?await generateClientSdkVersionTwoPointZero(t,{writeFile:(o,i)=>a.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a.promises.mkdir(o,i);}},e.outDir,e.packageType):await generateClientSdkVersionOneDotOne(t,{writeFile:(o,i)=>a.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a.promises.mkdir(o,i);}},e.outDir,e.packageType);}
|
|
10
|
-
|
|
11
|
-
export { y as default };
|
|
12
|
-
//# sourceMappingURL=out.js.map
|
|
13
|
-
//# sourceMappingURL=handleGenerate-4RFQDCQF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["getOntologyFullMetadata","listOntologiesV2","generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","createClientContext","createOpenApiRequest","consola","fs","handleGenerate","args","generateFromLocalFile","generateFromStack","ontology","generateClientSdk","stack","clientId","token","invokeLoginFlow","fetch","ontologies","e","path","contents","options"],"mappings":"sEAgBA,OAAS,2BAAAA,EAAyB,oBAAAC,MAAwB,yBAC1D,OAAS,qCAAAC,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,uBAAAC,EAAqB,wBAAAC,MAA4B,mBAC1D,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KAEpB,eAAOC,EAAsCC,EAAM,CACjD,GAAIA,EAAK,aACP,MAAMC,EAAsBD,CAAI,UACvBA,EAAK,OAASA,EAAK,SAC5B,MAAME,EAAkBF,CAAI,MAE5B,OAAM,IAAI,MAAM,wDAAwD,EAE1EH,EAAQ,KAAK,iBAAiB,CAChC,CACA,eAAeI,EAAsBD,EAAM,CACzC,IAAMG,EAAW,KAAK,MAAM,MAAS,WAAS,SAASH,EAAK,aAAc,OAAO,CAAC,EAClF,MAAMI,EAAkBD,EAAUH,CAAI,CACxC,CACA,eAAeE,EAAkBF,EAAM,CACrC,GAAM,CACJ,MAAAK,EACA,SAAAC,CACF,EAAIN,EACEO,EAAQ,MAAMC,EAAgB,CAClC,cAAeF,EACf,QAASD,EACT,QAAS,CACX,CAAC,EACK,CACJ,MAAAI,CACF,EAAId,EAAoB,CACtB,SAAU,CACR,UAAW,oBACb,CACF,EAAGK,EAAK,MAAO,IAAMO,EAAM,YAAY,EACvC,GAAI,CACF,IAAMG,EAAa,MAAMlB,EAAiBI,EAAqBS,EAAOI,CAAK,CAAC,EACxEC,EAAW,KAAK,SAAW,GAC7Bb,EAAQ,MAAM,4DAA4Da,EAAW,KAAK,MAAM,cAAc,EAEhH,IAAMP,EAAW,MAAMZ,EAAwBK,EAAqBS,EAAOI,CAAK,EAAGC,EAAW,KAAK,CAAC,EAAE,OAAO,EAC7G,MAAMN,EAAkBD,EAAUH,CAAI,CACxC,OAASW,EAAG,CACVd,EAAQ,MAAM,kCAAmCc,CAAC,CACpD,CACF,CACA,eAAeP,EAAkBD,EAAUH,EAAM,CAC3CA,EAAK,KACP,MAAMN,EAAqCS,EAAU,CACnD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAMP,EAAkCU,EAAU,CAChD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,CAEpC","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 { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n if (args.ontologyPath) {\n await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n consola.info(\"OSDK Generated!\");\n}\nasync function generateFromLocalFile(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to download the ontology\", e);\n }\n}\nasync function generateClientSdk(ontology, args) {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n}"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkZ6SJPM6K_cjs = require('./chunk-Z6SJPM6K.cjs');
|
|
4
|
-
require('./chunk-X6QW63OH.cjs');
|
|
5
|
-
var requests = require('@osdk/gateway/requests');
|
|
6
|
-
var generator = require('@osdk/generator');
|
|
7
|
-
var shared_net = require('@osdk/shared.net');
|
|
8
|
-
var consola = require('consola');
|
|
9
|
-
var a = require('fs');
|
|
10
|
-
|
|
11
|
-
function _interopNamespace(e) {
|
|
12
|
-
if (e && e.__esModule) return e;
|
|
13
|
-
var n = Object.create(null);
|
|
14
|
-
if (e) {
|
|
15
|
-
Object.keys(e).forEach(function (k) {
|
|
16
|
-
if (k !== 'default') {
|
|
17
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return e[k]; }
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n.default = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var a__namespace = /*#__PURE__*/_interopNamespace(a);
|
|
30
|
-
|
|
31
|
-
async function y(t){if(t.ontologyPath)await h(t);else if(t.stack&&t.clientId)await F(t);else throw new Error("Must have specified ontologyPath or stack and clientId");consola.consola.info("OSDK Generated!");}async function h(t){let e=JSON.parse(await a__namespace.promises.readFile(t.ontologyPath,"utf-8"));await d(e,t);}async function F(t){let{stack:e,clientId:o}=t,i=await chunkZ6SJPM6K_cjs.a({applicationId:o,baseUrl:e,verbose:0}),{fetch:l}=shared_net.createClientContext({metadata:{userAgent:"@osdk/cli/0.0.0 ()"}},t.stack,()=>i.access_token);try{let n=await requests.listOntologiesV2(shared_net.createOpenApiRequest(e,l));n.data.length!==1&&consola.consola.error(`Could not look up ontology with these credentials. Found ${n.data.length} ontologies.`);let f=await requests.getOntologyFullMetadata(shared_net.createOpenApiRequest(e,l),n.data[0].apiName);await d(f,t);}catch(n){consola.consola.error("Failed to download the ontology",n);}}async function d(t,e){e.beta?await generator.generateClientSdkVersionTwoPointZero(t,{writeFile:(o,i)=>a__namespace.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a__namespace.promises.mkdir(o,i);}},e.outDir,e.packageType):await generator.generateClientSdkVersionOneDotOne(t,{writeFile:(o,i)=>a__namespace.promises.writeFile(o,i,"utf-8"),mkdir:async(o,i)=>{await a__namespace.promises.mkdir(o,i);}},e.outDir,e.packageType);}
|
|
32
|
-
|
|
33
|
-
module.exports = y;
|
|
34
|
-
//# sourceMappingURL=out.js.map
|
|
35
|
-
//# sourceMappingURL=handleGenerate-6FGD7TOT.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":["getOntologyFullMetadata","listOntologiesV2","generateClientSdkVersionOneDotOne","generateClientSdkVersionTwoPointZero","createClientContext","createOpenApiRequest","consola","fs","handleGenerate","args","generateFromLocalFile","generateFromStack","ontology","generateClientSdk","stack","clientId","token","invokeLoginFlow","fetch","ontologies","e","path","contents","options"],"mappings":"sEAgBA,OAAS,2BAAAA,EAAyB,oBAAAC,MAAwB,yBAC1D,OAAS,qCAAAC,EAAmC,wCAAAC,MAA4C,kBACxF,OAAS,uBAAAC,EAAqB,wBAAAC,MAA4B,mBAC1D,OAAS,WAAAC,MAAe,UACxB,UAAYC,MAAQ,KAEpB,eAAOC,EAAsCC,EAAM,CACjD,GAAIA,EAAK,aACP,MAAMC,EAAsBD,CAAI,UACvBA,EAAK,OAASA,EAAK,SAC5B,MAAME,EAAkBF,CAAI,MAE5B,OAAM,IAAI,MAAM,wDAAwD,EAE1EH,EAAQ,KAAK,iBAAiB,CAChC,CACA,eAAeI,EAAsBD,EAAM,CACzC,IAAMG,EAAW,KAAK,MAAM,MAAS,WAAS,SAASH,EAAK,aAAc,OAAO,CAAC,EAClF,MAAMI,EAAkBD,EAAUH,CAAI,CACxC,CACA,eAAeE,EAAkBF,EAAM,CACrC,GAAM,CACJ,MAAAK,EACA,SAAAC,CACF,EAAIN,EACEO,EAAQ,MAAMC,EAAgB,CAClC,cAAeF,EACf,QAASD,EACT,QAAS,CACX,CAAC,EACK,CACJ,MAAAI,CACF,EAAId,EAAoB,CACtB,SAAU,CACR,UAAW,oBACb,CACF,EAAGK,EAAK,MAAO,IAAMO,EAAM,YAAY,EACvC,GAAI,CACF,IAAMG,EAAa,MAAMlB,EAAiBI,EAAqBS,EAAOI,CAAK,CAAC,EACxEC,EAAW,KAAK,SAAW,GAC7Bb,EAAQ,MAAM,4DAA4Da,EAAW,KAAK,MAAM,cAAc,EAEhH,IAAMP,EAAW,MAAMZ,EAAwBK,EAAqBS,EAAOI,CAAK,EAAGC,EAAW,KAAK,CAAC,EAAE,OAAO,EAC7G,MAAMN,EAAkBD,EAAUH,CAAI,CACxC,OAASW,EAAG,CACVd,EAAQ,MAAM,kCAAmCc,CAAC,CACpD,CACF,CACA,eAAeP,EAAkBD,EAAUH,EAAM,CAC3CA,EAAK,KACP,MAAMN,EAAqCS,EAAU,CACnD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,EAEhC,MAAMP,EAAkCU,EAAU,CAChD,UAAW,CAACS,EAAMC,IACN,WAAS,UAAUD,EAAMC,EAAU,OAAO,EAEtD,MAAO,MAAOD,EAAME,IAAY,CAC9B,MAAS,WAAS,MAAMF,EAAME,CAAO,CACvC,CACF,EAAGd,EAAK,OAAQA,EAAK,WAAW,CAEpC","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 { getOntologyFullMetadata, listOntologiesV2 } from \"@osdk/gateway/requests\";\nimport { generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero } from \"@osdk/generator\";\nimport { createClientContext, createOpenApiRequest } from \"@osdk/shared.net\";\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs\";\nimport invokeLoginFlow from \"../../auth/login/loginFlow.js\";\nexport default async function handleGenerate(args) {\n if (args.ontologyPath) {\n await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n consola.info(\"OSDK Generated!\");\n}\nasync function generateFromLocalFile(args) {\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId\n } = args;\n const token = await invokeLoginFlow({\n applicationId: clientId,\n baseUrl: stack,\n verbose: 0\n });\n const {\n fetch\n } = createClientContext({\n metadata: {\n userAgent: \"@osdk/cli/0.0.0 ()\"\n }\n }, args.stack, () => token.access_token);\n try {\n const ontologies = await listOntologiesV2(createOpenApiRequest(stack, fetch));\n if (ontologies.data.length !== 1) {\n consola.error(`Could not look up ontology with these credentials. Found ${ontologies.data.length} ontologies.`);\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to download the ontology\", e);\n }\n}\nasync function generateClientSdk(ontology, args) {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, {\n writeFile: (path, contents) => {\n return fs.promises.writeFile(path, contents, \"utf-8\");\n },\n mkdir: async (path, options) => {\n await fs.promises.mkdir(path, options);\n }\n }, args.outDir, args.packageType);\n }\n}"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkUOKM237I_cjs = require('./chunk-UOKM237I.cjs');
|
|
4
|
-
require('./chunk-V4QJCMF6.cjs');
|
|
5
|
-
require('./chunk-X6QW63OH.cjs');
|
|
6
|
-
var consola = require('consola');
|
|
7
|
-
|
|
8
|
-
async function f({siteVersion:t,appRid:c,baseUrl:i,clearVersion:n}){let o=await chunkUOKM237I_cjs.d.fetchWebsiteRepositoryRid(i,c),s=chunkUOKM237I_cjs.c(i,"/artifacts/api");t?await chunkUOKM237I_cjs.a.updateDeployedVersion(s,o,{siteVersion:{version:t}}):n&&await chunkUOKM237I_cjs.a.clearDeployedVersion(s,o),consola.consola.success("Deploy successful");}
|
|
9
|
-
|
|
10
|
-
module.exports = f;
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=handleSiteDeploy-257ZNTYA.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/deploy/handleSiteDeploy.mts"],"names":["consola","handleSiteDeploy","version","appRid","baseUrl","clearVersion","repositoryRid","third_party_application_service_exports","ctx","createConjureContext","ArtifactsSitesAdminV2Service_exports"],"mappings":"iHAgBA,OAAS,WAAAA,MAAe,UAExB,eAAOC,EAAwC,CAC7C,YAAaC,EACb,OAAAC,EACA,QAAAC,EACA,aAAAC,CACF,EAAG,CACD,IAAMC,EAAgB,MAAMC,EAA6B,0BAA0BH,EAASD,CAAM,EAC5FK,EAAMC,EAAqBL,EAAS,gBAAgB,EACtDF,EACF,MAAMQ,EAA6B,sBAAsBF,EAAKF,EAAe,CAC3E,YAAa,CACX,QAAAJ,CACF,CACF,CAAC,EACQG,GACT,MAAMK,EAA6B,qBAAqBF,EAAKF,CAAa,EAE5EN,EAAQ,QAAQ,mBAAmB,CACrC","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 { ArtifactsSitesAdminV2Service, createConjureContext, thirdPartyApplicationService } from \"#net\";\nexport default async function handleSiteDeploy({\n siteVersion: version,\n appRid,\n baseUrl,\n clearVersion\n}) {\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(baseUrl, appRid);\n const ctx = createConjureContext(baseUrl, \"/artifacts/api\");\n if (version) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version\n }\n });\n } else if (clearVersion) {\n await ArtifactsSitesAdminV2Service.clearDeployedVersion(ctx, repositoryRid);\n }\n consola.success(\"Deploy successful\");\n}"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { d, c, a } from './chunk-TSZWWATC.mjs';
|
|
2
|
-
import './chunk-MGT3UGXW.mjs';
|
|
3
|
-
import './chunk-XIJ2ZQRX.mjs';
|
|
4
|
-
import { consola } from 'consola';
|
|
5
|
-
|
|
6
|
-
async function f({siteVersion:t,appRid:c$1,baseUrl:i,clearVersion:n}){let o=await d.fetchWebsiteRepositoryRid(i,c$1),s=c(i,"/artifacts/api");t?await a.updateDeployedVersion(s,o,{siteVersion:{version:t}}):n&&await a.clearDeployedVersion(s,o),consola.success("Deploy successful");}
|
|
7
|
-
|
|
8
|
-
export { f as default };
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=handleSiteDeploy-QCMJWAYI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/deploy/handleSiteDeploy.mts"],"names":["consola","handleSiteDeploy","version","appRid","baseUrl","clearVersion","repositoryRid","third_party_application_service_exports","ctx","createConjureContext","ArtifactsSitesAdminV2Service_exports"],"mappings":"iHAgBA,OAAS,WAAAA,MAAe,UAExB,eAAOC,EAAwC,CAC7C,YAAaC,EACb,OAAAC,EACA,QAAAC,EACA,aAAAC,CACF,EAAG,CACD,IAAMC,EAAgB,MAAMC,EAA6B,0BAA0BH,EAASD,CAAM,EAC5FK,EAAMC,EAAqBL,EAAS,gBAAgB,EACtDF,EACF,MAAMQ,EAA6B,sBAAsBF,EAAKF,EAAe,CAC3E,YAAa,CACX,QAAAJ,CACF,CACF,CAAC,EACQG,GACT,MAAMK,EAA6B,qBAAqBF,EAAKF,CAAa,EAE5EN,EAAQ,QAAQ,mBAAmB,CACrC","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 { ArtifactsSitesAdminV2Service, createConjureContext, thirdPartyApplicationService } from \"#net\";\nexport default async function handleSiteDeploy({\n siteVersion: version,\n appRid,\n baseUrl,\n clearVersion\n}) {\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(baseUrl, appRid);\n const ctx = createConjureContext(baseUrl, \"/artifacts/api\");\n if (version) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version\n }\n });\n } else if (clearVersion) {\n await ArtifactsSitesAdminV2Service.clearDeployedVersion(ctx, repositoryRid);\n }\n consola.success(\"Deploy successful\");\n}"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkUOKM237I_cjs = require('./chunk-UOKM237I.cjs');
|
|
4
|
-
require('./chunk-V4QJCMF6.cjs');
|
|
5
|
-
require('./chunk-X6QW63OH.cjs');
|
|
6
|
-
var consola = require('consola');
|
|
7
|
-
|
|
8
|
-
async function i(e){await chunkUOKM237I_cjs.b.SiteAssetArtifactsService.deleteSiteVersion(e.baseUrl,e.appRid,e.siteVersion),consola.consola.success("Delete successful");}
|
|
9
|
-
|
|
10
|
-
module.exports = i;
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=siteDeleteCommand-NY5W7NE3.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/delete/siteDeleteCommand.mts"],"names":["consola","siteDeleteCommand","args","artifacts_exports"],"mappings":"mGAgBA,OAAS,WAAAA,MAAe,UAExB,eAAOC,EAAyCC,EAAM,CACpD,MAAMC,EAAU,0BAA0B,kBAAkBD,EAAK,QAASA,EAAK,OAAQA,EAAK,WAAW,EACvGF,EAAQ,QAAQ,mBAAmB,CACrC","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 { artifacts } from \"../../../net/index.mjs\";\nexport default async function siteDeleteCommand(args) {\n await artifacts.SiteAssetArtifactsService.deleteSiteVersion(args.baseUrl, args.appRid, args.siteVersion);\n consola.success(\"Delete successful\");\n}"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { b } from './chunk-TSZWWATC.mjs';
|
|
2
|
-
import './chunk-MGT3UGXW.mjs';
|
|
3
|
-
import './chunk-XIJ2ZQRX.mjs';
|
|
4
|
-
import { consola } from 'consola';
|
|
5
|
-
|
|
6
|
-
async function i(e){await b.SiteAssetArtifactsService.deleteSiteVersion(e.baseUrl,e.appRid,e.siteVersion),consola.success("Delete successful");}
|
|
7
|
-
|
|
8
|
-
export { i as default };
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=siteDeleteCommand-ZKHKGVVF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/site/delete/siteDeleteCommand.mts"],"names":["consola","siteDeleteCommand","args","artifacts_exports"],"mappings":"mGAgBA,OAAS,WAAAA,MAAe,UAExB,eAAOC,EAAyCC,EAAM,CACpD,MAAMC,EAAU,0BAA0B,kBAAkBD,EAAK,QAASA,EAAK,OAAQA,EAAK,WAAW,EACvGF,EAAQ,QAAQ,mBAAmB,CACrC","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 { artifacts } from \"../../../net/index.mjs\";\nexport default async function siteDeleteCommand(args) {\n await artifacts.SiteAssetArtifactsService.deleteSiteVersion(args.baseUrl, args.appRid, args.siteVersion);\n consola.success(\"Delete successful\");\n}"]}
|