@osdk/cli 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/build/js/{chunk-GTNZA5UY.mjs → chunk-CLAEREOL.mjs} +4 -2
  2. package/build/js/chunk-CLAEREOL.mjs.map +1 -0
  3. package/build/js/chunk-GX2IOTA6.mjs +10 -0
  4. package/build/js/{chunk-N6K26UR4.mjs.map → chunk-GX2IOTA6.mjs.map} +1 -1
  5. package/build/js/{chunk-JFDXL5SV.mjs → chunk-HD6SVFKA.mjs} +5 -5
  6. package/build/js/chunk-HD6SVFKA.mjs.map +1 -0
  7. package/build/js/{chunk-HYF3CTKZ.cjs → chunk-HZ3XILMW.cjs} +4 -2
  8. package/build/js/chunk-HZ3XILMW.cjs.map +1 -0
  9. package/build/js/{chunk-XNYKWAIE.mjs → chunk-M5JTX7RC.mjs} +35 -16
  10. package/build/js/chunk-M5JTX7RC.mjs.map +1 -0
  11. package/build/js/{chunk-D7QHLGEU.cjs → chunk-NJJ5VSTS.cjs} +41 -22
  12. package/build/js/chunk-NJJ5VSTS.cjs.map +1 -0
  13. package/build/js/{chunk-2DZBTS5E.cjs → chunk-TZGNA5WR.cjs} +5 -5
  14. package/build/js/chunk-TZGNA5WR.cjs.map +1 -0
  15. package/build/js/chunk-UE2TMWJL.cjs +12 -0
  16. package/build/js/{chunk-X2S4O5ZR.cjs.map → chunk-UE2TMWJL.cjs.map} +1 -1
  17. package/build/js/{handleGenerate-FHM4MFPH.cjs → handleGenerate-EGYMVXVW.cjs} +11 -11
  18. package/build/js/handleGenerate-EGYMVXVW.cjs.map +1 -0
  19. package/build/js/{handleGenerate-7QGFIWKO.mjs → handleGenerate-OBJOC2XY.mjs} +10 -10
  20. package/build/js/handleGenerate-OBJOC2XY.mjs.map +1 -0
  21. package/build/js/index.cjs +68 -33
  22. package/build/js/index.cjs.map +1 -1
  23. package/build/js/index.mjs +64 -29
  24. package/build/js/index.mjs.map +1 -1
  25. package/build/js/loginFlow-5ZAMXQKE.cjs +10 -0
  26. package/build/js/loginFlow-BWWZBM36.mjs +4 -0
  27. package/build/js/{siteDeployCommand-QKPJEL4X.cjs → siteDeployCommand-5DBNGRT3.cjs} +45 -28
  28. package/build/js/siteDeployCommand-5DBNGRT3.cjs.map +1 -0
  29. package/build/js/{siteDeployCommand-4S2UQKJP.mjs → siteDeployCommand-D62CVVEY.mjs} +38 -21
  30. package/build/js/siteDeployCommand-D62CVVEY.mjs.map +1 -0
  31. package/build/js/{versionDeleteCommand-DGB5NTFM.mjs → versionDeleteCommand-F255OTHE.mjs} +3 -3
  32. package/build/js/{versionDeleteCommand-S7AXTY46.cjs → versionDeleteCommand-SKJ7OBNI.cjs} +6 -6
  33. package/build/js/{versionGetCommand-Y2VR2WKH.cjs → versionGetCommand-LVE7IZL3.cjs} +8 -8
  34. package/build/js/{versionGetCommand-OR4RLOLM.mjs → versionGetCommand-VHIOZCA7.mjs} +3 -3
  35. package/build/js/{versionListCommand-5KM5PFYL.cjs → versionListCommand-JNYLJ45G.cjs} +11 -9
  36. package/build/js/versionListCommand-JNYLJ45G.cjs.map +1 -0
  37. package/build/js/{versionListCommand-LPPGQCQF.mjs → versionListCommand-W4A2FA43.mjs} +6 -4
  38. package/build/js/versionListCommand-W4A2FA43.mjs.map +1 -0
  39. package/build/js/{versionSetCommand-LHOVVI6U.mjs → versionSetCommand-JLILKOKN.mjs} +3 -3
  40. package/build/js/{versionSetCommand-VD3L5DOV.cjs → versionSetCommand-PLKTCPWX.cjs} +8 -8
  41. package/build/js/{versionUnsetCommand-V3ZVCGSI.cjs → versionUnsetCommand-PGU2S3WS.cjs} +8 -8
  42. package/build/js/{versionUnsetCommand-ISMMMWWZ.mjs → versionUnsetCommand-Q6YWVVAI.mjs} +3 -3
  43. package/build/types/ExitProcessError.d.ts +3 -1
  44. package/build/types/commands/auth/CommonAuthArgs.d.ts +1 -1
  45. package/build/types/commands/auth/login/LoginArgs.d.ts +1 -1
  46. package/build/types/commands/site/deploy/SiteDeployArgs.d.ts +2 -1
  47. package/build/types/commands/site/deploy/siteDeployCommand.d.mts +8 -1
  48. package/build/types/commands/typescript/generate/TypescriptGenerateArgs.d.ts +1 -1
  49. package/build/types/net/UserAgent.d.ts +1 -0
  50. package/build/types/util/config.d.ts +2 -2
  51. package/build/types/util/token.d.ts +2 -2
  52. package/changelog/0.7.0/pr-50.v2.yml +5 -0
  53. package/changelog/0.7.0/pr-52.v2.yml +5 -0
  54. package/changelog/0.7.0/pr-55.v2.yml +5 -0
  55. package/changelog/0.7.0/pr-61.v2.yml +5 -0
  56. package/changelog/0.7.0/pr-63.v2.yml +5 -0
  57. package/package.json +9 -3
  58. package/build/js/chunk-2DZBTS5E.cjs.map +0 -1
  59. package/build/js/chunk-D7QHLGEU.cjs.map +0 -1
  60. package/build/js/chunk-GTNZA5UY.mjs.map +0 -1
  61. package/build/js/chunk-HYF3CTKZ.cjs.map +0 -1
  62. package/build/js/chunk-JFDXL5SV.mjs.map +0 -1
  63. package/build/js/chunk-N6K26UR4.mjs +0 -9
  64. package/build/js/chunk-X2S4O5ZR.cjs +0 -11
  65. package/build/js/chunk-XNYKWAIE.mjs.map +0 -1
  66. package/build/js/handleGenerate-7QGFIWKO.mjs.map +0 -1
  67. package/build/js/handleGenerate-FHM4MFPH.cjs.map +0 -1
  68. package/build/js/loginFlow-BZDDHHT5.cjs +0 -10
  69. package/build/js/loginFlow-KGLTXVZ6.mjs +0 -4
  70. package/build/js/siteDeployCommand-4S2UQKJP.mjs.map +0 -1
  71. package/build/js/siteDeployCommand-QKPJEL4X.cjs.map +0 -1
  72. package/build/js/versionListCommand-5KM5PFYL.cjs.map +0 -1
  73. package/build/js/versionListCommand-LPPGQCQF.mjs.map +0 -1
  74. /package/build/js/{loginFlow-BZDDHHT5.cjs.map → loginFlow-5ZAMXQKE.cjs.map} +0 -0
  75. /package/build/js/{loginFlow-KGLTXVZ6.mjs.map → loginFlow-BWWZBM36.mjs.map} +0 -0
  76. /package/build/js/{versionDeleteCommand-DGB5NTFM.mjs.map → versionDeleteCommand-F255OTHE.mjs.map} +0 -0
  77. /package/build/js/{versionDeleteCommand-S7AXTY46.cjs.map → versionDeleteCommand-SKJ7OBNI.cjs.map} +0 -0
  78. /package/build/js/{versionGetCommand-OR4RLOLM.mjs.map → versionGetCommand-LVE7IZL3.cjs.map} +0 -0
  79. /package/build/js/{versionGetCommand-Y2VR2WKH.cjs.map → versionGetCommand-VHIOZCA7.mjs.map} +0 -0
  80. /package/build/js/{versionSetCommand-LHOVVI6U.mjs.map → versionSetCommand-JLILKOKN.mjs.map} +0 -0
  81. /package/build/js/{versionSetCommand-VD3L5DOV.cjs.map → versionSetCommand-PLKTCPWX.cjs.map} +0 -0
  82. /package/build/js/{versionUnsetCommand-ISMMMWWZ.mjs.map → versionUnsetCommand-PGU2S3WS.cjs.map} +0 -0
  83. /package/build/js/{versionUnsetCommand-V3ZVCGSI.cjs.map → versionUnsetCommand-Q6YWVVAI.mjs.map} +0 -0
@@ -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/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/createInternalClientContext.mts","../../src/net/third-party-application-service/index.mts","../../src/util/token.ts"],"names":["conjureFetch","consola","fetch"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,SAAS,oBAAoB;AAQ7B,eAAsB,qBAAqB,KAAK,eAAe;AAC7D,SAAO,aAAa,KAAK,8BAA8B,aAAa,qBAAqB,QAAQ;AACnG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,kCAAkC,KAAK,eAAe;AAC1E,SAAOA,cAAa,KAAK,8BAA8B,aAAa,kBAAkB,KAAK;AAC7F;;;ACRA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,mBAAmB,KAAK,eAAe;AAC3D,SAAOA,cAAa,KAAK,8BAA8B,aAAa,qBAAqB,KAAK;AAChG;;;ACRA,SAAS,gBAAAA,qBAAoB;AAO7B,eAAsB,yBAAyB,KAAK,eAAe;AACjE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,uBAAuB,KAAK;AAClG;;;ACTA,SAAS,gBAAAA,qBAAoB;AAQ7B,eAAsB,wBAAwB,KAAK,eAAe;AAChE,SAAOA,cAAa,KAAK,8BAA8B,aAAa,sBAAsB,KAAK;AACjG;;;ACVA,SAAS,gBAAAA,qBAAoB;AAM7B,eAAsB,6BAA6B,KAA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AAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,EACF;AACF;AACO,SAAS,SAAS,OAAO;AAC9B,MAAI,CAAC,MAAM,KAAK,GAAG;AACjB,UAAM,IAAI,iBAAiB,GAAG,mCAAmC;AAAA,EACnE;AACF;AACA,SAAS,MAAM,OAAO;AAEpB,QAAM,aAAa;AACnB,SAAO,WAAW,KAAK,KAAK;AAC9B","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\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 } 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(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"DELETE\"\n });\n if (result.status >= 200 && result.status < 300) {\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 { ExitProcessError } from \"../../ExitProcessError.js\";\nimport { createFetch } from \"../createFetch.mjs\";\nexport async function fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid) {\n const fetch = createFetch(ctx.tokenProvider);\n const url = `\n ${ctx.foundryUrl}/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 ExitProcessError(result.status, `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 { 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 fetchSiteVersions(ctx, thirdPartyAppRid) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, thirdPartyAppRid);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions`;\n const fetch = createFetch(ctx.tokenProvider);\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 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 { consola } 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(ctx, request) {\n const repositoryRid = await fetchWebsiteRepositoryRid(ctx, request.application);\n const url = `${getSiteAssetBaseUrl(ctx.foundryUrl, repositoryRid)}/versions/zip/${request.version}`;\n const fetch = createFetch(ctx.tokenProvider);\n const result = await fetch(url, {\n method: \"PUT\",\n body: request.zipFile,\n headers: {\n \"Content-Type\": \"application/octet-stream\"\n },\n duplex: \"half\" // Node hates me\n });\n if (result.status >= 200 && result.status < 300) {\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(foundryUrl, servicePath, tokenProvider) {\n return {\n fetchFn: createFetch(tokenProvider),\n baseUrl: foundryUrl,\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 function createInternalClientContext(foundryUrl, tokenProvider) {\n return {\n tokenProvider,\n foundryUrl\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\";","/*\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 { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nconst TOKEN_ENV_VARS = [\"FOUNDRY_TOKEN\", \"FOUNDRY_SDK_AUTH_TOKEN\"];\n\n/**\n * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.\n * @param token The token as a string.\n * @param tokenFile The path to the token file.\n * @returns The token as a string.\n * @throws An error if no token is found.\n */\nexport async function loadToken(token, tokenFile) {\n if (token) {\n consola.debug(`Using token from --token argument`);\n validate(token);\n return token;\n }\n if (tokenFile) {\n const loadedToken = await loadTokenFile(tokenFile);\n consola.debug(`Using token from --tokenFile=${loadedToken.filePath} argument`);\n validate(loadedToken.token);\n return loadedToken.token;\n }\n for (const envVar of TOKEN_ENV_VARS) {\n const environmentToken = process.env[envVar];\n if (environmentToken) {\n consola.debug(`Using token from ${envVar} environment variable`);\n validate(environmentToken);\n if (envVar === \"FOUNDRY_SDK_AUTH_TOKEN\") {\n consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);\n }\n return environmentToken;\n }\n }\n throw new ExitProcessError(2, `No token found. Please supply a --token argument, a --token-file argument or set the ${TOKEN_ENV_VARS[0]} environment variable.`);\n}\n/**\n * Synchronously reads a JWT Auth Token from a file.\n * @param filePath The path to the token file.\n * @returns The token as a string.\n * @throws An error if the file cannot be read or if the file does not contain a valid JWT.\n */\nexport async function loadTokenFile(filePath) {\n let token;\n let resolvedPath;\n try {\n resolvedPath = path.resolve(filePath);\n token = await fsPromises.readFile(resolvedPath, \"utf8\");\n token = token.trim();\n } catch (error) {\n throw new ExitProcessError(2, `Unable to read token file \"${filePath}\": ${error}`);\n }\n return {\n filePath: resolvedPath,\n token\n };\n}\nexport function validate(token) {\n if (!isJWT(token)) {\n throw new ExitProcessError(2, `Token does not appear to be a JWT`);\n }\n}\nfunction isJWT(token) {\n // https://stackoverflow.com/a/65755789\n const jwtPattern = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\n return jwtPattern.test(token);\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":[],"mappings":";;;;;;AAgBA,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,mCAAmC,4CAA4C;AACxF,SAAS,qBAAqB,4BAA4B;AAC1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QAAI,mBAAmB;AACrB,MAAG,iBAAc,mBAAmB,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,IACvE;AACA,WAAO,MAAM,kBAAkB,UAAU,IAAI;AAAA,EAC/C,SAAS,GAAG;AACV,YAAQ,MAAM,mCAAmC,CAAC;AAClD,WAAO;AAAA,EACT;AACF;AACA,eAAe,kBAAkB,UAAU,MAAM;AAC/C,QAAM,YAAY;AAAA,IAChB,WAAW,CAAC,MAAM,aAAa;AAC7B,aAAU,YAAS,UAAU,MAAM,UAAU,OAAO;AAAA,IACtD;AAAA,IACA,OAAO,OAAO,MAAM,YAAY;AAC9B,YAAS,YAAS,MAAM,MAAM,OAAO;AAAA,IACvC;AAAA,IACA,SAAS,OAAM,SAAW,YAAS,QAAQ,IAAI;AAAA,EACjD;AACA,MAAI;AACF,QAAI,KAAK,MAAM;AACb,YAAM,qCAAqC,UAAU,aAAa,KAAK,OAAO,GAAG,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IAC3H,OAAO;AACL,YAAM,kCAAkC,UAAU,aAAa,KAAK,OAAO,GAAG,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IACxH;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,0BAA0B,EAAE,OAAO;AACjD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAIA,SAAS,aAAa,SAAS;AAC7B,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT,OAAO;AACL,WAAO,kBAAkB,OAAO,IAAI,UAAU;AAAA,EAChD;AACF","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\";\nconst USER_AGENT = `osdk-cli/${process.env.PACKAGE_VERSION}`;\nexport default async function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\n }\n}\nasync function generateFromLocalFile(args) {\n if (!fs.existsSync(args.ontologyPath)) {\n consola.error(`Ontology file does not exist: ${args.ontologyPath}`);\n return false;\n }\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n return await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId,\n ontologyWritePath\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: USER_AGENT\n }\n }, args.stack, () => token.access_token, USER_AGENT);\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 return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n if (ontologyWritePath) {\n fs.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));\n }\n return await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to generate the ontology\", e);\n return false;\n }\n}\nasync function generateClientSdk(ontology, args) {\n const minimalFs = {\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 readdir: async path => fs.promises.readdir(path)\n };\n try {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, getUserAgent(args.version), minimalFs, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, getUserAgent(args.version), minimalFs, args.outDir, args.packageType);\n }\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message);\n return false;\n }\n return true;\n}\n\n// If the user passed us `dev` as our version, we use that for both our generated package version AND the cli version.\n// This makes it so that releases don't force us to have to regenerate the code when the version strings change.\nfunction getUserAgent(version) {\n if (version === \"dev\") {\n return \"typescript-sdk/dev osdk-cli/dev\";\n } else {\n return `typescript-sdk/${version} ${USER_AGENT}`;\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/typescript/generate/handleGenerate.mts"],"names":[],"mappings":";;;;;;AAgBA,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,mCAAmC,4CAA4C;AACxF,SAAS,qBAAqB,4BAA4B;AAC1D,SAAS,eAAe;AACxB,YAAY,QAAQ;AAEpB,IAAM,aAAa,YAAY,OAA2B;AAC1D,eAAO,eAAsC,MAAM;AACjD,MAAI,UAAU;AACd,MAAI,KAAK,cAAc;AACrB,cAAU,MAAM,sBAAsB,IAAI;AAAA,EAC5C,WAAW,KAAK,SAAS,KAAK,UAAU;AACtC,cAAU,MAAM,kBAAkB,IAAI;AAAA,EACxC,OAAO;AACL,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,MAAI,SAAS;AACX,YAAQ,KAAK,iBAAiB;AAAA,EAChC;AACF;AACA,eAAe,sBAAsB,MAAM;AACzC,MAAI,CAAI,cAAW,KAAK,YAAY,GAAG;AACrC,YAAQ,MAAM,iCAAiC,KAAK,YAAY,EAAE;AAClE,WAAO;AAAA,EACT;AACA,QAAM,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ACF,QAAI,KAAK,MAAM;AACb,YAAM,qCAAqC,UAAU,aAAa,KAAK,OAAO,GAAG,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IAC3H,OAAO;AACL,YAAM,kCAAkC,UAAU,aAAa,KAAK,OAAO,GAAG,WAAW,KAAK,QAAQ,KAAK,WAAW;AAAA,IACxH;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,0BAA0B,EAAE,OAAO;AACjD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAIA,SAAS,aAAa,SAAS;AAC7B,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT,OAAO;AACL,WAAO,kBAAkB,OAAO,IAAI,UAAU;AAAA,EAChD;AACF","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\";\nconst USER_AGENT = `osdk-cli/${process.env.PACKAGE_VERSION}`;\nexport default async function handleGenerate(args) {\n let success = false;\n if (args.ontologyPath) {\n success = await generateFromLocalFile(args);\n } else if (args.stack && args.clientId) {\n success = await generateFromStack(args);\n } else {\n throw new Error(\"Must have specified ontologyPath or stack and clientId\");\n }\n if (success) {\n consola.info(\"OSDK Generated!\");\n }\n}\nasync function generateFromLocalFile(args) {\n if (!fs.existsSync(args.ontologyPath)) {\n consola.error(`Ontology file does not exist: ${args.ontologyPath}`);\n return false;\n }\n const ontology = JSON.parse(await fs.promises.readFile(args.ontologyPath, \"utf-8\"));\n return await generateClientSdk(ontology, args);\n}\nasync function generateFromStack(args) {\n const {\n stack,\n clientId,\n ontologyWritePath\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: USER_AGENT\n }\n }, args.stack, () => token.access_token, USER_AGENT);\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 return false;\n }\n const ontology = await getOntologyFullMetadata(createOpenApiRequest(stack, fetch), ontologies.data[0].apiName);\n if (ontologyWritePath) {\n fs.writeFileSync(ontologyWritePath, JSON.stringify(ontology, null, 2));\n }\n return await generateClientSdk(ontology, args);\n } catch (e) {\n consola.error(\"Failed to generate the ontology\", e);\n return false;\n }\n}\nasync function generateClientSdk(ontology, args) {\n const minimalFs = {\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 readdir: async path => fs.promises.readdir(path)\n };\n try {\n if (args.beta) {\n await generateClientSdkVersionTwoPointZero(ontology, getUserAgent(args.version), minimalFs, args.outDir, args.packageType);\n } else {\n await generateClientSdkVersionOneDotOne(ontology, getUserAgent(args.version), minimalFs, args.outDir, args.packageType);\n }\n } catch (e) {\n consola.error(\"OSDK generation failed\", e.message);\n return false;\n }\n return true;\n}\n\n// If the user passed us `dev` as our version, we use that for both our generated package version AND the cli version.\n// This makes it so that releases don't force us to have to regenerate the code when the version strings change.\nfunction getUserAgent(version) {\n if (version === \"dev\") {\n return \"typescript-sdk/dev osdk-cli/dev\";\n } else {\n return `typescript-sdk/${version} ${USER_AGENT}`;\n }\n}"]}
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk2DZBTS5E_cjs = require('./chunk-2DZBTS5E.cjs');
4
- require('./chunk-HQDDGVB7.cjs');
5
-
6
-
7
-
8
- module.exports = chunk2DZBTS5E_cjs.invokeLoginFlow;
9
- //# sourceMappingURL=out.js.map
10
- //# sourceMappingURL=loginFlow-BZDDHHT5.cjs.map
@@ -1,4 +0,0 @@
1
- export { invokeLoginFlow as default } from './chunk-JFDXL5SV.mjs';
2
- import './chunk-E2SEJZTC.mjs';
3
- //# sourceMappingURL=out.js.map
4
- //# sourceMappingURL=loginFlow-KGLTXVZ6.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":["autoVersion"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,SAAS,eAAe;AAExB,OAAO,cAAc;AACrB,SAAS,gBAAgB;AACzB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACNzB,SAAS,gBAAgB;AAWzB,eAAsB,YAAY,YAAY,IAAI;AAChD,QAAM,CAAC,aAAa,WAAW,IAAI,cAAc,KAAK,CAAC,WAAW,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC,IAAI,CAAC,QAAW,IAAI,OAAO,KAAK,CAAC;AAC9H,MAAI;AACF,UAAM,aAAa,SAAS,6CAA6C,eAAe,OAAO,aAAa,WAAW,OAAO,EAAE,IAAI;AAAA,MAClI,UAAU;AAAA,IACZ,CAAC;AACD,UAAM,UAAU,WAAW,KAAK,EAAE,QAAQ,aAAa,EAAE;AACzD,QAAI,CAAC,cAAc,OAAO,GAAG;AAC3B,YAAM,IAAI,iBAAiB,GAAG,sBAAsB,OAAO,2BAA2B;AAAA,IACxF;AACA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,UAAM,IAAI,iBAAiB,GAAG,sFAAsF,KAAK,EAAE;AAA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right 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, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n version,\n application,\n foundryUrl,\n autoVersion,\n gitTagPrefix,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n if (version == null && autoVersion == null) {\n throw new Error(\"Either version or autoVersion must be specified\");\n }\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n\n // version has a priority over autoVersion. Both could be defined at the same time when\n // autoVersion is present in the config file (it assigns that as a default value to argv.autoVersion)\n // and --version is passed as an argument\n let siteVersion;\n if (version != null) {\n siteVersion = version;\n } else {\n siteVersion = await findAutoVersion(gitTagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([artifacts.SiteAssetArtifactsService.uploadZippedSiteAsset(clientCtx, {\n application,\n version: siteVersion,\n zipFile: Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n }), archive.finalize()]);\n consola.success(\"Upload complete\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const registeredSiteDomains = await ArtifactsSitesAdminV2Service.getRegisteredSiteDomains(ctx, repositoryRid);\n const domain = getFirstSiteDomain(registeredSiteDomains);\n if (!uploadOnly) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version: siteVersion\n }\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}\nfunction getFirstSiteDomain(domains) {\n if (domains.length === 0) {\n consola.warn(\"No registered domains for site found\");\n return undefined;\n }\n switch (domains[0].type) {\n case \"controlPanelManaged\":\n return domains[0].controlPanelManaged.siteDomain.domain;\n default:\n const _ = domains[0].type;\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 { execSync } from \"node:child_process\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { isValidSemver } from \"./isValidSemver.js\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n try {\n const gitVersion = execSync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n } catch (error) {\n throw new ExitProcessError(2, `Unable to determine the version automatically. Please supply a --version argument. ${error}`);\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":["autoVersion"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,SAAS,eAAe;AAExB,OAAO,cAAc;AACrB,SAAS,gBAAgB;AACzB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACNzB,SAAS,gBAAgB;AAWzB,eAAsB,YAAY,YAAY,IAAI;AAChD,QAAM,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,OAAO,MAAM;AAChC,UAAQ,IAAI;AAAA,IACV,SAAS,GAAG,KAAK;AAAA;AAAA,EAAO,SAAS,SAAS,IAAI,CAAC;AAAA,IAC/C,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH;AACA,SAAS,mBAAmB,SAAS;AACnC,MAAI,QAAQ,WAAW,GAAG;AACxB,YAAQ,KAAK,sCAAsC;AACnD,WAAO;AAAA,EACT;AACA,UAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,IACvB,KAAK;AACH,aAAO,QAAQ,CAAC,EAAE,oBAAoB,WAAW;AAAA,IACnD;AACE,YAAM,IAAI,QAAQ,CAAC,EAAE;AAAA,EACzB;AACF","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, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { ExitProcessError } from \"../../../ExitProcessError.js\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n version,\n application,\n foundryUrl,\n autoVersion,\n gitTagPrefix,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n if (version == null && autoVersion == null) {\n throw new Error(\"Either version or autoVersion must be specified\");\n }\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n\n // version has a priority over autoVersion. Both could be defined at the same time when\n // autoVersion is present in the config file (it assigns that as a default value to argv.autoVersion)\n // and --version is passed as an argument\n let siteVersion;\n if (version != null) {\n siteVersion = version;\n } else {\n siteVersion = await findAutoVersion(gitTagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([artifacts.SiteAssetArtifactsService.uploadZippedSiteAsset(clientCtx, {\n application,\n version: siteVersion,\n zipFile: Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n }), archive.finalize()]);\n consola.success(\"Upload complete\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const registeredSiteDomains = await ArtifactsSitesAdminV2Service.getRegisteredSiteDomains(ctx, repositoryRid);\n const domain = getFirstSiteDomain(registeredSiteDomains);\n if (!uploadOnly) {\n await ArtifactsSitesAdminV2Service.updateDeployedVersion(ctx, repositoryRid, {\n siteVersion: {\n version: siteVersion\n }\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}\nfunction getFirstSiteDomain(domains) {\n if (domains.length === 0) {\n consola.warn(\"No registered domains for site found\");\n return undefined;\n }\n switch (domains[0].type) {\n case \"controlPanelManaged\":\n return domains[0].controlPanelManaged.siteDomain.domain;\n default:\n const _ = domains[0].type;\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 { execSync } from \"node:child_process\";\nimport { ExitProcessError } from \"../ExitProcessError.js\";\nimport { isValidSemver } from \"./isValidSemver.js\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n try {\n const gitVersion = execSync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n } catch (error) {\n throw new ExitProcessError(2, `Unable to determine the version automatically. Please supply a --version argument. ${error}`);\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/site/version/list/versionListCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,eAAO,mBAA0C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sCAAsC;AACpD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,CAAC,UAAU,eAAe,IAAI,MAAM,QAAQ,IAAI,CAAC,kBAAU,0BAA0B,kBAAkB,WAAW,WAAW,GAAG,qCAA6B,mBAAmB,KAAK,aAAa,CAAC,CAAC;AAC1M,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,KAAK,+DAA+D;AAC5E;AAAA,EACF;AACA,UAAQ,QAAQ,iBAAiB;AACjC,aAAW,WAAW,UAAU;AAC9B,YAAQ,IAAI,SAAS,OAAO,GAAG,mBAAmB,YAAY,gBAAgB,UAAU,SAAS,SAAS,aAAa,IAAI,EAAE,EAAE;AAAA,EACjI;AACF","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 { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionListCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Fetching versions & deployed version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const [versions, deployedVersion] = await Promise.all([artifacts.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid)]);\n if (versions.length === 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\");\n for (const version of versions) {\n consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? colorize(\"green\", ` (deployed)`) : \"\"}`);\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/site/version/list/versionListCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,eAAO,mBAA0C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sCAAsC;AACpD,QAAM,gBAAgB,MAAM,wCAA6B,0BAA0B,WAAW,WAAW;AACzG,QAAM,MAAM,qBAAqB,YAAY,kBAAkB,aAAa;AAC5E,QAAM,CAAC,UAAU,eAAe,IAAI,MAAM,QAAQ,IAAI,CAAC,kBAAU,0BAA0B,kBAAkB,WAAW,WAAW,GAAG,qCAA6B,mBAAmB,KAAK,aAAa,CAAC,CAAC;AAC1M,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,KAAK,+DAA+D;AAC5E;AAAA,EACF;AACA,UAAQ,QAAQ,iBAAiB;AACjC,aAAW,WAAW,UAAU;AAC9B,YAAQ,IAAI,SAAS,OAAO,GAAG,mBAAmB,YAAY,gBAAgB,UAAU,SAAS,SAAS,aAAa,IAAI,EAAE,EAAE;AAAA,EACjI;AACF","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 { artifacts, ArtifactsSitesAdminV2Service, createConjureContext, createInternalClientContext, thirdPartyApplicationService } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionListCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Fetching versions & deployed version\");\n const repositoryRid = await thirdPartyApplicationService.fetchWebsiteRepositoryRid(clientCtx, application);\n const ctx = createConjureContext(foundryUrl, \"/artifacts/api\", tokenProvider);\n const [versions, deployedVersion] = await Promise.all([artifacts.SiteAssetArtifactsService.fetchSiteVersions(clientCtx, application), ArtifactsSitesAdminV2Service.getDeployedVersion(ctx, repositoryRid)]);\n if (versions.length === 0) {\n consola.warn(\"Successfully connected to server, but no versions were found.\");\n return;\n }\n consola.success(\"Found versions:\");\n for (const version of versions) {\n consola.log(` - ${version}${deployedVersion && version === deployedVersion.version ? colorize(\"green\", ` (deployed)`) : \"\"}`);\n }\n}"]}