@osdk/cli 0.24.0-beta.11 → 0.24.0-beta.13
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 +27 -0
- package/build/browser/cli.d.ts +7 -0
- package/build/browser/cli.d.ts.map +1 -0
- package/build/browser/cli.js +42 -0
- package/build/browser/cli.js.map +1 -0
- package/build/browser/commands/auth/index.d.ts +5 -0
- package/build/browser/commands/auth/index.d.ts.map +1 -0
- package/build/browser/commands/auth/index.js +34 -0
- package/build/browser/commands/auth/index.js.map +1 -0
- package/build/browser/commands/auth/login/index.d.ts +5 -0
- package/build/browser/commands/auth/login/index.d.ts.map +1 -0
- package/build/browser/commands/auth/login/index.js +34 -0
- package/build/browser/commands/auth/login/index.js.map +1 -0
- package/build/browser/commands/site/CommonSiteArgs.d.ts +9 -0
- package/build/browser/commands/site/CommonSiteArgs.d.ts.map +1 -0
- package/build/browser/commands/site/CommonSiteArgs.js +17 -0
- package/build/browser/commands/site/CommonSiteArgs.js.map +1 -0
- package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts +10 -0
- package/build/browser/commands/site/deploy/SiteDeployArgs.d.ts.map +1 -0
- package/build/browser/commands/site/deploy/SiteDeployArgs.js +17 -0
- package/build/browser/commands/site/deploy/SiteDeployArgs.js.map +1 -0
- package/build/browser/commands/site/deploy/index.d.ts +6 -0
- package/build/browser/commands/site/deploy/index.d.ts.map +1 -0
- package/build/browser/commands/site/deploy/index.js +108 -0
- package/build/browser/commands/site/deploy/index.js.map +1 -0
- package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts +5 -0
- package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts.map +1 -0
- package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js +28 -0
- package/build/browser/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +1 -0
- package/build/browser/commands/site/deploy/siteDeployCommand.d.mts +10 -0
- package/build/browser/commands/site/deploy/siteDeployCommand.d.mts.map +1 -0
- package/build/browser/commands/site/deploy/siteDeployCommand.js +98 -0
- package/build/browser/commands/site/deploy/siteDeployCommand.js.map +1 -0
- package/build/browser/commands/site/deploy/siteDeployCommand.mjs +90 -0
- package/build/browser/commands/site/index.d.ts +6 -0
- package/build/browser/commands/site/index.d.ts.map +1 -0
- package/build/browser/commands/site/index.js +69 -0
- package/build/browser/commands/site/index.js.map +1 -0
- package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts +5 -0
- package/build/browser/commands/site/logSiteCommandConfigFileOverride.d.ts.map +1 -0
- package/build/browser/commands/site/logSiteCommandConfigFileOverride.js +25 -0
- package/build/browser/commands/site/logSiteCommandConfigFileOverride.js.map +1 -0
- package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts +6 -0
- package/build/browser/commands/site/version/delete/VersionDeleteArgs.d.ts.map +1 -0
- package/build/browser/commands/site/version/delete/VersionDeleteArgs.js +17 -0
- package/build/browser/commands/site/version/delete/VersionDeleteArgs.js.map +1 -0
- package/build/browser/commands/site/version/delete/index.d.ts +6 -0
- package/build/browser/commands/site/version/delete/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/delete/index.js +36 -0
- package/build/browser/commands/site/version/delete/index.js.map +1 -0
- package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts +3 -0
- package/build/browser/commands/site/version/delete/versionDeleteCommand.d.mts.map +1 -0
- package/build/browser/commands/site/version/delete/versionDeleteCommand.js +41 -0
- package/build/browser/commands/site/version/delete/versionDeleteCommand.js.map +1 -0
- package/build/browser/commands/site/version/delete/versionDeleteCommand.mjs +32 -0
- package/build/browser/commands/site/version/get/VersionGetArgs.d.ts +4 -0
- package/build/browser/commands/site/version/get/VersionGetArgs.d.ts.map +1 -0
- package/build/browser/commands/site/version/get/VersionGetArgs.js +17 -0
- package/build/browser/commands/site/version/get/VersionGetArgs.js.map +1 -0
- package/build/browser/commands/site/version/get/index.d.ts +6 -0
- package/build/browser/commands/site/version/get/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/get/index.js +28 -0
- package/build/browser/commands/site/version/get/index.js.map +1 -0
- package/build/browser/commands/site/version/get/versionGetCommand.d.mts +3 -0
- package/build/browser/commands/site/version/get/versionGetCommand.d.mts.map +1 -0
- package/build/browser/commands/site/version/get/versionGetCommand.js +36 -0
- package/build/browser/commands/site/version/get/versionGetCommand.js.map +1 -0
- package/build/browser/commands/site/version/get/versionGetCommand.mjs +32 -0
- package/build/browser/commands/site/version/index.d.ts +5 -0
- package/build/browser/commands/site/version/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/index.js +30 -0
- package/build/browser/commands/site/version/index.js.map +1 -0
- package/build/browser/commands/site/version/list/VersionListArgs.d.ts +4 -0
- package/build/browser/commands/site/version/list/VersionListArgs.d.ts.map +1 -0
- package/build/browser/commands/site/version/list/VersionListArgs.js +17 -0
- package/build/browser/commands/site/version/list/VersionListArgs.js.map +1 -0
- package/build/browser/commands/site/version/list/index.d.ts +6 -0
- package/build/browser/commands/site/version/list/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/list/index.js +28 -0
- package/build/browser/commands/site/version/list/index.js.map +1 -0
- package/build/browser/commands/site/version/list/versionListCommand.d.mts +3 -0
- package/build/browser/commands/site/version/list/versionListCommand.d.mts.map +1 -0
- package/build/browser/commands/site/version/list/versionListCommand.js +41 -0
- package/build/browser/commands/site/version/list/versionListCommand.js.map +1 -0
- package/build/browser/commands/site/version/list/versionListCommand.mjs +42 -0
- package/build/browser/commands/site/version/set/VersionSetArgs.d.ts +5 -0
- package/build/browser/commands/site/version/set/VersionSetArgs.d.ts.map +1 -0
- package/build/browser/commands/site/version/set/VersionSetArgs.js +17 -0
- package/build/browser/commands/site/version/set/VersionSetArgs.js.map +1 -0
- package/build/browser/commands/site/version/set/index.d.ts +6 -0
- package/build/browser/commands/site/version/set/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/set/index.js +32 -0
- package/build/browser/commands/site/version/set/index.js.map +1 -0
- package/build/browser/commands/site/version/set/versionSetCommand.d.mts +3 -0
- package/build/browser/commands/site/version/set/versionSetCommand.d.mts.map +1 -0
- package/build/browser/commands/site/version/set/versionSetCommand.js +36 -0
- package/build/browser/commands/site/version/set/versionSetCommand.js.map +1 -0
- package/build/browser/commands/site/version/set/versionSetCommand.mjs +28 -0
- package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts +5 -0
- package/build/browser/commands/site/version/unset/VersionUnsetArgs.d.ts.map +1 -0
- package/build/browser/commands/site/version/unset/VersionUnsetArgs.js +17 -0
- package/build/browser/commands/site/version/unset/VersionUnsetArgs.js.map +1 -0
- package/build/browser/commands/site/version/unset/index.d.ts +6 -0
- package/build/browser/commands/site/version/unset/index.d.ts.map +1 -0
- package/build/browser/commands/site/version/unset/index.js +32 -0
- package/build/browser/commands/site/version/unset/index.js.map +1 -0
- package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts +3 -0
- package/build/browser/commands/site/version/unset/versionUnsetCommand.d.mts.map +1 -0
- package/build/browser/commands/site/version/unset/versionUnsetCommand.js +40 -0
- package/build/browser/commands/site/version/unset/versionUnsetCommand.js.map +1 -0
- package/build/browser/commands/site/version/unset/versionUnsetCommand.mjs +32 -0
- package/build/browser/consola/handlePromptCancel.d.ts +2 -0
- package/build/browser/consola/handlePromptCancel.d.ts.map +1 -0
- package/build/browser/consola/handlePromptCancel.js +25 -0
- package/build/browser/consola/handlePromptCancel.js.map +1 -0
- package/build/browser/index.d.ts +2 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +16 -588
- package/build/browser/index.js.map +1 -1
- package/build/browser/net/ThirdPartyAppRid.d.ts +2 -0
- package/build/browser/net/ThirdPartyAppRid.d.ts.map +1 -0
- package/build/browser/net/ThirdPartyAppRid.js +17 -0
- package/build/browser/net/ThirdPartyAppRid.js.map +1 -0
- package/build/browser/net/UserAgent.d.ts +2 -0
- package/build/browser/net/UserAgent.d.ts.map +1 -0
- package/build/browser/net/UserAgent.js +17 -0
- package/build/browser/net/UserAgent.js.map +1 -0
- package/build/browser/net/createFetch.d.mts +2 -0
- package/build/browser/net/createFetch.d.mts.map +1 -0
- package/build/browser/net/createFetch.js +66 -0
- package/build/browser/net/createFetch.js.map +1 -0
- package/build/browser/net/createFetch.mjs +71 -0
- package/build/browser/net/createInternalClientContext.d.mts +3 -0
- package/build/browser/net/createInternalClientContext.d.mts.map +1 -0
- package/build/browser/net/createInternalClientContext.js +22 -0
- package/build/browser/net/createInternalClientContext.js.map +1 -0
- package/build/browser/net/createInternalClientContext.mjs +21 -0
- package/build/browser/net/index.d.mts +3 -0
- package/build/browser/net/index.d.mts.map +1 -0
- package/build/browser/net/index.js +18 -0
- package/build/browser/net/index.js.map +1 -0
- package/build/browser/net/index.mjs +17 -0
- package/build/browser/net/internalClientContext.d.mts +5 -0
- package/build/browser/net/internalClientContext.d.mts.map +1 -0
- package/build/browser/net/internalClientContext.js +17 -0
- package/build/browser/net/internalClientContext.js.map +1 -0
- package/build/browser/net/internalClientContext.mjs +16 -0
- package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts +4 -0
- package/build/browser/net/third-party-applications/DeployWebsiteRequest.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/DeployWebsiteRequest.js +17 -0
- package/build/browser/net/third-party-applications/DeployWebsiteRequest.js.map +1 -0
- package/build/browser/net/third-party-applications/DeployWebsiteRequest.mjs +16 -0
- package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts +6 -0
- package/build/browser/net/third-party-applications/ListVersionsResponse.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/ListVersionsResponse.js +17 -0
- package/build/browser/net/third-party-applications/ListVersionsResponse.js.map +1 -0
- package/build/browser/net/third-party-applications/ListVersionsResponse.mjs +16 -0
- package/build/browser/net/third-party-applications/Version.d.mts +4 -0
- package/build/browser/net/third-party-applications/Version.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/Version.js +17 -0
- package/build/browser/net/third-party-applications/Version.js.map +1 -0
- package/build/browser/net/third-party-applications/Version.mjs +16 -0
- package/build/browser/net/third-party-applications/Website.d.mts +5 -0
- package/build/browser/net/third-party-applications/Website.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/Website.js +17 -0
- package/build/browser/net/third-party-applications/Website.js.map +1 -0
- package/build/browser/net/third-party-applications/Website.mjs +16 -0
- package/build/browser/net/third-party-applications/deleteVersion.d.mts +4 -0
- package/build/browser/net/third-party-applications/deleteVersion.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/deleteVersion.js +24 -0
- package/build/browser/net/third-party-applications/deleteVersion.js.map +1 -0
- package/build/browser/net/third-party-applications/deleteVersion.mjs +23 -0
- package/build/browser/net/third-party-applications/deployWebsite.d.mts +6 -0
- package/build/browser/net/third-party-applications/deployWebsite.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/deployWebsite.js +29 -0
- package/build/browser/net/third-party-applications/deployWebsite.js.map +1 -0
- package/build/browser/net/third-party-applications/deployWebsite.mjs +28 -0
- package/build/browser/net/third-party-applications/getWebsite.d.mts +5 -0
- package/build/browser/net/third-party-applications/getWebsite.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/getWebsite.js +33 -0
- package/build/browser/net/third-party-applications/getWebsite.js.map +1 -0
- package/build/browser/net/third-party-applications/getWebsite.mjs +35 -0
- package/build/browser/net/third-party-applications/index.d.mts +11 -0
- package/build/browser/net/third-party-applications/index.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/index.js +22 -0
- package/build/browser/net/third-party-applications/index.js.map +1 -0
- package/build/browser/net/third-party-applications/index.mjs +21 -0
- package/build/browser/net/third-party-applications/listVersions.d.mts +5 -0
- package/build/browser/net/third-party-applications/listVersions.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/listVersions.js +23 -0
- package/build/browser/net/third-party-applications/listVersions.js.map +1 -0
- package/build/browser/net/third-party-applications/listVersions.mjs +22 -0
- package/build/browser/net/third-party-applications/undeployWebsite.d.mts +4 -0
- package/build/browser/net/third-party-applications/undeployWebsite.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/undeployWebsite.js +24 -0
- package/build/browser/net/third-party-applications/undeployWebsite.js.map +1 -0
- package/build/browser/net/third-party-applications/undeployWebsite.mjs +23 -0
- package/build/browser/net/third-party-applications/uploadVersion.d.mts +5 -0
- package/build/browser/net/third-party-applications/uploadVersion.d.mts.map +1 -0
- package/build/browser/net/third-party-applications/uploadVersion.js +30 -0
- package/build/browser/net/third-party-applications/uploadVersion.js.map +1 -0
- package/build/browser/net/third-party-applications/uploadVersion.mjs +29 -0
- package/build/browser/util/autoVersion.d.ts +9 -0
- package/build/browser/util/autoVersion.d.ts.map +1 -0
- package/build/browser/util/autoVersion.js +62 -0
- package/build/browser/util/autoVersion.js.map +1 -0
- package/build/browser/util/autoVersion.test.d.ts +2 -0
- package/build/browser/util/autoVersion.test.d.ts.map +1 -0
- package/build/browser/util/autoVersion.test.js +71 -0
- package/build/browser/util/autoVersion.test.js.map +1 -0
- package/build/browser/util/config.d.ts +26 -0
- package/build/browser/util/config.d.ts.map +1 -0
- package/build/browser/util/config.js +102 -0
- package/build/browser/util/config.js.map +1 -0
- package/build/browser/util/config.test.d.ts +2 -0
- package/build/browser/util/config.test.d.ts.map +1 -0
- package/build/browser/util/config.test.js +110 -0
- package/build/browser/util/config.test.js.map +1 -0
- package/build/browser/util/configLoader.d.ts +4 -0
- package/build/browser/util/configLoader.d.ts.map +1 -0
- package/build/browser/util/configLoader.js +25 -0
- package/build/browser/util/configLoader.js.map +1 -0
- package/build/browser/util/isValidSemver.test.d.ts +2 -0
- package/build/browser/util/isValidSemver.test.d.ts.map +1 -0
- package/build/browser/util/isValidSemver.test.js +41 -0
- package/build/browser/util/isValidSemver.test.js.map +1 -0
- package/build/browser/util/token.d.ts +22 -0
- package/build/browser/util/token.d.ts.map +1 -0
- package/build/browser/util/token.js +84 -0
- package/build/browser/util/token.js.map +1 -0
- package/build/browser/util/token.test.d.ts +2 -0
- package/build/browser/util/token.test.d.ts.map +1 -0
- package/build/browser/util/token.test.js +62 -0
- package/build/browser/util/token.test.js.map +1 -0
- package/build/browser/yargs/logConfigFileMiddleware.d.ts +2 -0
- package/build/browser/yargs/logConfigFileMiddleware.d.ts.map +1 -0
- package/build/browser/yargs/logConfigFileMiddleware.js +29 -0
- package/build/browser/yargs/logConfigFileMiddleware.js.map +1 -0
- package/build/esm/cli.js +42 -0
- package/build/esm/cli.js.map +1 -0
- package/build/esm/commands/auth/index.js +34 -0
- package/build/esm/commands/auth/index.js.map +1 -0
- package/build/esm/commands/auth/login/index.js +34 -0
- package/build/esm/commands/auth/login/index.js.map +1 -0
- package/build/esm/commands/site/CommonSiteArgs.js +17 -0
- package/build/esm/commands/site/CommonSiteArgs.js.map +1 -0
- package/build/esm/commands/site/deploy/SiteDeployArgs.js +17 -0
- package/build/esm/commands/site/deploy/SiteDeployArgs.js.map +1 -0
- package/build/esm/commands/site/deploy/index.js +108 -0
- package/build/esm/commands/site/deploy/index.js.map +1 -0
- package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js +28 -0
- package/build/esm/commands/site/deploy/logDeployCommandConfigFileOverride.js.map +1 -0
- package/build/esm/commands/site/deploy/siteDeployCommand.js +98 -0
- package/build/esm/commands/site/deploy/siteDeployCommand.js.map +1 -0
- package/build/esm/commands/site/deploy/siteDeployCommand.mjs +90 -0
- package/build/esm/commands/site/index.js +69 -0
- package/build/esm/commands/site/index.js.map +1 -0
- package/build/esm/commands/site/logSiteCommandConfigFileOverride.js +25 -0
- package/build/esm/commands/site/logSiteCommandConfigFileOverride.js.map +1 -0
- package/build/esm/commands/site/version/delete/VersionDeleteArgs.js +17 -0
- package/build/esm/commands/site/version/delete/VersionDeleteArgs.js.map +1 -0
- package/build/esm/commands/site/version/delete/index.js +36 -0
- package/build/esm/commands/site/version/delete/index.js.map +1 -0
- package/build/esm/commands/site/version/delete/versionDeleteCommand.js +41 -0
- package/build/esm/commands/site/version/delete/versionDeleteCommand.js.map +1 -0
- package/build/esm/commands/site/version/delete/versionDeleteCommand.mjs +32 -0
- package/build/esm/commands/site/version/get/VersionGetArgs.js +17 -0
- package/build/esm/commands/site/version/get/VersionGetArgs.js.map +1 -0
- package/build/esm/commands/site/version/get/index.js +28 -0
- package/build/esm/commands/site/version/get/index.js.map +1 -0
- package/build/esm/commands/site/version/get/versionGetCommand.js +36 -0
- package/build/esm/commands/site/version/get/versionGetCommand.js.map +1 -0
- package/build/esm/commands/site/version/get/versionGetCommand.mjs +32 -0
- package/build/esm/commands/site/version/index.js +30 -0
- package/build/esm/commands/site/version/index.js.map +1 -0
- package/build/esm/commands/site/version/list/VersionListArgs.js +17 -0
- package/build/esm/commands/site/version/list/VersionListArgs.js.map +1 -0
- package/build/esm/commands/site/version/list/index.js +28 -0
- package/build/esm/commands/site/version/list/index.js.map +1 -0
- package/build/esm/commands/site/version/list/versionListCommand.js +41 -0
- package/build/esm/commands/site/version/list/versionListCommand.js.map +1 -0
- package/build/esm/commands/site/version/list/versionListCommand.mjs +42 -0
- package/build/esm/commands/site/version/set/VersionSetArgs.js +17 -0
- package/build/esm/commands/site/version/set/VersionSetArgs.js.map +1 -0
- package/build/esm/commands/site/version/set/index.js +32 -0
- package/build/esm/commands/site/version/set/index.js.map +1 -0
- package/build/esm/commands/site/version/set/versionSetCommand.js +36 -0
- package/build/esm/commands/site/version/set/versionSetCommand.js.map +1 -0
- package/build/esm/commands/site/version/set/versionSetCommand.mjs +28 -0
- package/build/esm/commands/site/version/unset/VersionUnsetArgs.js +17 -0
- package/build/esm/commands/site/version/unset/VersionUnsetArgs.js.map +1 -0
- package/build/esm/commands/site/version/unset/index.js +32 -0
- package/build/esm/commands/site/version/unset/index.js.map +1 -0
- package/build/esm/commands/site/version/unset/versionUnsetCommand.js +40 -0
- package/build/esm/commands/site/version/unset/versionUnsetCommand.js.map +1 -0
- package/build/esm/commands/site/version/unset/versionUnsetCommand.mjs +32 -0
- package/build/esm/consola/handlePromptCancel.js +25 -0
- package/build/esm/consola/handlePromptCancel.js.map +1 -0
- package/build/esm/index.js +16 -588
- package/build/esm/index.js.map +1 -1
- package/build/esm/net/ThirdPartyAppRid.js +17 -0
- package/build/esm/net/ThirdPartyAppRid.js.map +1 -0
- package/build/esm/net/UserAgent.js +17 -0
- package/build/esm/net/UserAgent.js.map +1 -0
- package/build/esm/net/createFetch.js +66 -0
- package/build/esm/net/createFetch.js.map +1 -0
- package/build/esm/net/createFetch.mjs +71 -0
- package/build/esm/net/createInternalClientContext.js +22 -0
- package/build/esm/net/createInternalClientContext.js.map +1 -0
- package/build/esm/net/createInternalClientContext.mjs +21 -0
- package/build/esm/net/index.js +18 -0
- package/build/esm/net/index.js.map +1 -0
- package/build/esm/net/index.mjs +17 -0
- package/build/esm/net/internalClientContext.js +17 -0
- package/build/esm/net/internalClientContext.js.map +1 -0
- package/build/esm/net/internalClientContext.mjs +16 -0
- package/build/esm/net/third-party-applications/DeployWebsiteRequest.js +17 -0
- package/build/esm/net/third-party-applications/DeployWebsiteRequest.js.map +1 -0
- package/build/esm/net/third-party-applications/DeployWebsiteRequest.mjs +16 -0
- package/build/esm/net/third-party-applications/ListVersionsResponse.js +17 -0
- package/build/esm/net/third-party-applications/ListVersionsResponse.js.map +1 -0
- package/build/esm/net/third-party-applications/ListVersionsResponse.mjs +16 -0
- package/build/esm/net/third-party-applications/Version.js +17 -0
- package/build/esm/net/third-party-applications/Version.js.map +1 -0
- package/build/esm/net/third-party-applications/Version.mjs +16 -0
- package/build/esm/net/third-party-applications/Website.js +17 -0
- package/build/esm/net/third-party-applications/Website.js.map +1 -0
- package/build/esm/net/third-party-applications/Website.mjs +16 -0
- package/build/esm/net/third-party-applications/deleteVersion.js +24 -0
- package/build/esm/net/third-party-applications/deleteVersion.js.map +1 -0
- package/build/esm/net/third-party-applications/deleteVersion.mjs +23 -0
- package/build/esm/net/third-party-applications/deployWebsite.js +29 -0
- package/build/esm/net/third-party-applications/deployWebsite.js.map +1 -0
- package/build/esm/net/third-party-applications/deployWebsite.mjs +28 -0
- package/build/esm/net/third-party-applications/getWebsite.js +33 -0
- package/build/esm/net/third-party-applications/getWebsite.js.map +1 -0
- package/build/esm/net/third-party-applications/getWebsite.mjs +35 -0
- package/build/esm/net/third-party-applications/index.js +22 -0
- package/build/esm/net/third-party-applications/index.js.map +1 -0
- package/build/esm/net/third-party-applications/index.mjs +21 -0
- package/build/esm/net/third-party-applications/listVersions.js +23 -0
- package/build/esm/net/third-party-applications/listVersions.js.map +1 -0
- package/build/esm/net/third-party-applications/listVersions.mjs +22 -0
- package/build/esm/net/third-party-applications/undeployWebsite.js +24 -0
- package/build/esm/net/third-party-applications/undeployWebsite.js.map +1 -0
- package/build/esm/net/third-party-applications/undeployWebsite.mjs +23 -0
- package/build/esm/net/third-party-applications/uploadVersion.js +30 -0
- package/build/esm/net/third-party-applications/uploadVersion.js.map +1 -0
- package/build/esm/net/third-party-applications/uploadVersion.mjs +29 -0
- package/build/esm/util/autoVersion.js +62 -0
- package/build/esm/util/autoVersion.js.map +1 -0
- package/build/esm/util/autoVersion.test.js +71 -0
- package/build/esm/util/autoVersion.test.js.map +1 -0
- package/build/esm/util/config.js +102 -0
- package/build/esm/util/config.js.map +1 -0
- package/build/esm/util/config.test.js +110 -0
- package/build/esm/util/config.test.js.map +1 -0
- package/build/esm/util/configLoader.js +25 -0
- package/build/esm/util/configLoader.js.map +1 -0
- package/build/esm/util/isValidSemver.test.js +41 -0
- package/build/esm/util/isValidSemver.test.js.map +1 -0
- package/build/esm/util/token.js +84 -0
- package/build/esm/util/token.js.map +1 -0
- package/build/esm/util/token.test.js +62 -0
- package/build/esm/util/token.test.js.map +1 -0
- package/build/esm/yargs/logConfigFileMiddleware.js +29 -0
- package/build/esm/yargs/logConfigFileMiddleware.js.map +1 -0
- package/package.json +8 -10
- package/build/browser/chunk-5AQYUXAY.js +0 -17
- package/build/browser/chunk-5AQYUXAY.js.map +0 -1
- package/build/browser/chunk-DAYFZSC6.js +0 -42
- package/build/browser/chunk-DAYFZSC6.js.map +0 -1
- package/build/browser/chunk-SBJIY4HI.js +0 -67
- package/build/browser/chunk-SBJIY4HI.js.map +0 -1
- package/build/browser/chunk-XJLUGCCS.js +0 -120
- package/build/browser/chunk-XJLUGCCS.js.map +0 -1
- package/build/browser/chunk-Z4JRY4PG.js +0 -221
- package/build/browser/chunk-Z4JRY4PG.js.map +0 -1
- package/build/browser/handleGenerate-QAI4FEG7-RF32BMXD.js +0 -642
- package/build/browser/handleGenerate-QAI4FEG7-RF32BMXD.js.map +0 -1
- package/build/browser/loginFlow-X2LB2TEP.js +0 -4
- package/build/browser/loginFlow-X2LB2TEP.js.map +0 -1
- package/build/browser/siteDeployCommand-6UZVKCSK.js +0 -140
- package/build/browser/siteDeployCommand-6UZVKCSK.js.map +0 -1
- package/build/browser/versionDeleteCommand-YXTKR33T.js +0 -35
- package/build/browser/versionDeleteCommand-YXTKR33T.js.map +0 -1
- package/build/browser/versionGetCommand-GH5OK4LZ.js +0 -29
- package/build/browser/versionGetCommand-GH5OK4LZ.js.map +0 -1
- package/build/browser/versionListCommand-QM5SDDE3.js +0 -34
- package/build/browser/versionListCommand-QM5SDDE3.js.map +0 -1
- package/build/browser/versionSetCommand-VJK43BAU.js +0 -29
- package/build/browser/versionSetCommand-VJK43BAU.js.map +0 -1
- package/build/browser/versionUnsetCommand-LTOSIBQA.js +0 -34
- package/build/browser/versionUnsetCommand-LTOSIBQA.js.map +0 -1
- package/build/esm/chunk-5AQYUXAY.js +0 -17
- package/build/esm/chunk-5AQYUXAY.js.map +0 -1
- package/build/esm/chunk-DAYFZSC6.js +0 -42
- package/build/esm/chunk-DAYFZSC6.js.map +0 -1
- package/build/esm/chunk-SBJIY4HI.js +0 -67
- package/build/esm/chunk-SBJIY4HI.js.map +0 -1
- package/build/esm/chunk-XJLUGCCS.js +0 -120
- package/build/esm/chunk-XJLUGCCS.js.map +0 -1
- package/build/esm/chunk-Z4JRY4PG.js +0 -221
- package/build/esm/chunk-Z4JRY4PG.js.map +0 -1
- package/build/esm/handleGenerate-QAI4FEG7-RF32BMXD.js +0 -642
- package/build/esm/handleGenerate-QAI4FEG7-RF32BMXD.js.map +0 -1
- package/build/esm/loginFlow-X2LB2TEP.js +0 -4
- package/build/esm/loginFlow-X2LB2TEP.js.map +0 -1
- package/build/esm/siteDeployCommand-6UZVKCSK.js +0 -140
- package/build/esm/siteDeployCommand-6UZVKCSK.js.map +0 -1
- package/build/esm/versionDeleteCommand-YXTKR33T.js +0 -35
- package/build/esm/versionDeleteCommand-YXTKR33T.js.map +0 -1
- package/build/esm/versionGetCommand-GH5OK4LZ.js +0 -29
- package/build/esm/versionGetCommand-GH5OK4LZ.js.map +0 -1
- package/build/esm/versionListCommand-QM5SDDE3.js +0 -34
- package/build/esm/versionListCommand-QM5SDDE3.js.map +0 -1
- package/build/esm/versionSetCommand-VJK43BAU.js +0 -29
- package/build/esm/versionSetCommand-VJK43BAU.js.map +0 -1
- package/build/esm/versionUnsetCommand-LTOSIBQA.js +0 -34
- package/build/esm/versionUnsetCommand-LTOSIBQA.js.map +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ExitProcessError } from "@osdk/cli.common";
|
|
17
|
+
import { promises as fsPromises } from "node:fs";
|
|
18
|
+
import { extname } from "node:path";
|
|
19
|
+
const CONFIG_FILE_NAMES = ["foundry.config.json"];
|
|
20
|
+
const CONFIG_FILE_SCHEMA = {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
foundryUrl: {
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
site: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
application: {
|
|
30
|
+
type: "string"
|
|
31
|
+
},
|
|
32
|
+
directory: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
autoVersion: {
|
|
36
|
+
type: "object",
|
|
37
|
+
nullable: true,
|
|
38
|
+
oneOf: [{
|
|
39
|
+
properties: {
|
|
40
|
+
type: {
|
|
41
|
+
const: "git-describe",
|
|
42
|
+
type: "string"
|
|
43
|
+
},
|
|
44
|
+
tagPrefix: {
|
|
45
|
+
type: "string",
|
|
46
|
+
nullable: true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}],
|
|
50
|
+
required: ["type"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
required: ["application", "directory"]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
required: ["foundryUrl", "site"],
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.
|
|
61
|
+
* @returns A promise that resolves to the configuration JSON object, or undefined if not found.
|
|
62
|
+
* @throws Will throw an error if the configuration file is found but cannot be read or parsed.
|
|
63
|
+
*/
|
|
64
|
+
export async function loadFoundryConfig() {
|
|
65
|
+
const ajvModule = await import("ajv");
|
|
66
|
+
const Ajv = ajvModule.default.default; // https://github.com/ajv-validator/ajv/issues/2132
|
|
67
|
+
const ajv = new Ajv({
|
|
68
|
+
allErrors: true
|
|
69
|
+
});
|
|
70
|
+
const validate = ajv.compile(CONFIG_FILE_SCHEMA);
|
|
71
|
+
const {
|
|
72
|
+
findUp
|
|
73
|
+
} = await import("find-up");
|
|
74
|
+
const configFilePath = await findUp(CONFIG_FILE_NAMES);
|
|
75
|
+
if (configFilePath) {
|
|
76
|
+
let foundryConfig;
|
|
77
|
+
try {
|
|
78
|
+
const fileContent = await fsPromises.readFile(configFilePath, "utf-8");
|
|
79
|
+
foundryConfig = parseConfigFile(fileContent, configFilePath);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}. Error: ${error}`);
|
|
82
|
+
}
|
|
83
|
+
if (!validate(foundryConfig)) {
|
|
84
|
+
throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
foundryConfig,
|
|
88
|
+
configFilePath
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
function parseConfigFile(fileContent, configFilePath) {
|
|
94
|
+
const extension = extname(configFilePath);
|
|
95
|
+
switch (extension) {
|
|
96
|
+
case ".json":
|
|
97
|
+
return JSON.parse(fileContent);
|
|
98
|
+
default:
|
|
99
|
+
throw new ExitProcessError(2, `Unsupported file extension: ${extension} for config file.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","names":["ExitProcessError","promises","fsPromises","extname","CONFIG_FILE_NAMES","CONFIG_FILE_SCHEMA","type","properties","foundryUrl","site","application","directory","autoVersion","nullable","oneOf","const","tagPrefix","required","additionalProperties","loadFoundryConfig","ajvModule","Ajv","default","ajv","allErrors","validate","compile","findUp","configFilePath","foundryConfig","fileContent","readFile","parseConfigFile","error","errorsText","errors","undefined","extension","JSON","parse"],"sources":["config.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { promises as fsPromises } from \"node:fs\";\nimport { extname } from \"node:path\";\nconst CONFIG_FILE_NAMES = [\n \"foundry.config.json\",\n];\nconst CONFIG_FILE_SCHEMA = {\n type: \"object\",\n properties: {\n foundryUrl: { type: \"string\" },\n site: {\n type: \"object\",\n properties: {\n application: { type: \"string\" },\n directory: { type: \"string\" },\n autoVersion: {\n type: \"object\",\n nullable: true,\n oneOf: [\n {\n properties: {\n type: { const: \"git-describe\", type: \"string\" },\n tagPrefix: { type: \"string\", nullable: true },\n },\n },\n ],\n required: [\"type\"],\n },\n },\n required: [\"application\", \"directory\"],\n },\n },\n required: [\"foundryUrl\", \"site\"],\n additionalProperties: false,\n};\n/**\n * Asynchronously loads a configuration file. Looks for any of the CONFIG_FILE_NAMES in the current directory going up to the root directory.\n * @returns A promise that resolves to the configuration JSON object, or undefined if not found.\n * @throws Will throw an error if the configuration file is found but cannot be read or parsed.\n */\nexport async function loadFoundryConfig() {\n const ajvModule = await import(\"ajv\");\n const Ajv = ajvModule.default.default; // https://github.com/ajv-validator/ajv/issues/2132\n const ajv = new Ajv({ allErrors: true });\n const validate = ajv.compile(CONFIG_FILE_SCHEMA);\n const { findUp } = await import(\"find-up\");\n const configFilePath = await findUp(CONFIG_FILE_NAMES);\n if (configFilePath) {\n let foundryConfig;\n try {\n const fileContent = await fsPromises.readFile(configFilePath, \"utf-8\");\n foundryConfig = parseConfigFile(fileContent, configFilePath);\n }\n catch (error) {\n throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}. Error: ${error}`);\n }\n if (!validate(foundryConfig)) {\n throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);\n }\n return { foundryConfig, configFilePath };\n }\n return undefined;\n}\nfunction parseConfigFile(fileContent, configFilePath) {\n const extension = extname(configFilePath);\n switch (extension) {\n case \".json\":\n return JSON.parse(fileContent);\n default:\n throw new ExitProcessError(2, `Unsupported file extension: ${extension} for config file.`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,SAASC,OAAO,QAAQ,WAAW;AACnC,MAAMC,iBAAiB,GAAG,CACtB,qBAAqB,CACxB;AACD,MAAMC,kBAAkB,GAAG;EACvBC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE;IACRC,UAAU,EAAE;MAAEF,IAAI,EAAE;IAAS,CAAC;IAC9BG,IAAI,EAAE;MACFH,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACRG,WAAW,EAAE;UAAEJ,IAAI,EAAE;QAAS,CAAC;QAC/BK,SAAS,EAAE;UAAEL,IAAI,EAAE;QAAS,CAAC;QAC7BM,WAAW,EAAE;UACTN,IAAI,EAAE,QAAQ;UACdO,QAAQ,EAAE,IAAI;UACdC,KAAK,EAAE,CACH;YACIP,UAAU,EAAE;cACRD,IAAI,EAAE;gBAAES,KAAK,EAAE,cAAc;gBAAET,IAAI,EAAE;cAAS,CAAC;cAC/CU,SAAS,EAAE;gBAAEV,IAAI,EAAE,QAAQ;gBAAEO,QAAQ,EAAE;cAAK;YAChD;UACJ,CAAC,CACJ;UACDI,QAAQ,EAAE,CAAC,MAAM;QACrB;MACJ,CAAC;MACDA,QAAQ,EAAE,CAAC,aAAa,EAAE,WAAW;IACzC;EACJ,CAAC;EACDA,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC;EAChCC,oBAAoB,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AK,CAACT,WAAW,CAAC;IAClC;MACI,MAAM,IAAI9B,gBAAgB,CAAC,CAAC,EAAE,+BAA+BqC,SAAS,mBAAmB,CAAC;EAClG;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { findUp } from "find-up";
|
|
17
|
+
import { promises as fsPromises } from "node:fs";
|
|
18
|
+
import { extname } from "node:path";
|
|
19
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
20
|
+
import { loadFoundryConfig } from "./config.js";
|
|
21
|
+
vi.mock("find-up");
|
|
22
|
+
vi.mock("node:fs");
|
|
23
|
+
vi.mock("node:path");
|
|
24
|
+
describe("loadFoundryConfig", () => {
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
vi.mocked(findUp).mockResolvedValue("/path/foundry.config.json");
|
|
27
|
+
vi.mocked(extname).mockReturnValue(".json");
|
|
28
|
+
});
|
|
29
|
+
it("should load and parse the configuration file correctly", async () => {
|
|
30
|
+
const correctConfig = {
|
|
31
|
+
foundryUrl: "http://localhost",
|
|
32
|
+
site: {
|
|
33
|
+
application: "test-app",
|
|
34
|
+
directory: "/test/directory",
|
|
35
|
+
autoVersion: {
|
|
36
|
+
type: "git-describe"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(correctConfig));
|
|
41
|
+
await expect(loadFoundryConfig()).resolves.toEqual({
|
|
42
|
+
configFilePath: "/path/foundry.config.json",
|
|
43
|
+
foundryConfig: {
|
|
44
|
+
...correctConfig
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it("should throw an error if autoVersion type isn't allowed", async () => {
|
|
49
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
|
|
50
|
+
foundryUrl: "http://localhost",
|
|
51
|
+
site: {
|
|
52
|
+
application: "test-app",
|
|
53
|
+
directory: "/test/directory",
|
|
54
|
+
autoVersion: {
|
|
55
|
+
type: "invalid"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
|
|
60
|
+
});
|
|
61
|
+
it("should throw an error if autoVersion type is missing", async () => {
|
|
62
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
|
|
63
|
+
foundryUrl: "http://localhost",
|
|
64
|
+
site: {
|
|
65
|
+
application: "test-app",
|
|
66
|
+
directory: "/test/directory",
|
|
67
|
+
autoVersion: {}
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
|
|
71
|
+
});
|
|
72
|
+
it("should throw an error if the configuration file cannot be read", async () => {
|
|
73
|
+
vi.mocked(fsPromises.readFile).mockRejectedValue(new Error("Read error"));
|
|
74
|
+
await expect(loadFoundryConfig()).rejects.toThrow("Couldn't read or parse config");
|
|
75
|
+
});
|
|
76
|
+
it("should throw an error if the site key isn't found", async () => {
|
|
77
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
|
|
78
|
+
foundryUrl: "http://localhost"
|
|
79
|
+
}));
|
|
80
|
+
await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
|
|
81
|
+
});
|
|
82
|
+
it("should throw an error if the site configuration is missing required keys", async () => {
|
|
83
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
|
|
84
|
+
foundryUrl: "http://localhost",
|
|
85
|
+
site: {
|
|
86
|
+
directory: "/test/directory"
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
|
|
90
|
+
});
|
|
91
|
+
it("should throw an error if foundryUrl isn't set on top level", async () => {
|
|
92
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify({
|
|
93
|
+
site: {
|
|
94
|
+
foundryUrl: "http://localhost",
|
|
95
|
+
directory: "/test/directory",
|
|
96
|
+
application: "test-app"
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
99
|
+
await expect(loadFoundryConfig()).rejects.toThrow("The configuration file does not match");
|
|
100
|
+
});
|
|
101
|
+
it("should return undefined if the configuration file is not found", async () => {
|
|
102
|
+
vi.mocked(findUp).mockResolvedValue(undefined);
|
|
103
|
+
await expect(loadFoundryConfig()).resolves.toBeUndefined();
|
|
104
|
+
});
|
|
105
|
+
it("should throw if config file extension isn't supported", async () => {
|
|
106
|
+
vi.mocked(extname).mockResolvedValue(".yaml");
|
|
107
|
+
await expect(loadFoundryConfig()).rejects.toThrow("Unsupported file extension:");
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=config.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.js","names":["findUp","promises","fsPromises","extname","beforeEach","describe","expect","it","vi","loadFoundryConfig","mock","mocked","mockResolvedValue","mockReturnValue","correctConfig","foundryUrl","site","application","directory","autoVersion","type","readFile","JSON","stringify","resolves","toEqual","configFilePath","foundryConfig","rejects","toThrow","mockRejectedValue","Error","undefined","toBeUndefined"],"sources":["config.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { findUp } from \"find-up\";\nimport { promises as fsPromises } from \"node:fs\";\nimport { extname } from \"node:path\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { loadFoundryConfig } from \"./config.js\";\nvi.mock(\"find-up\");\nvi.mock(\"node:fs\");\nvi.mock(\"node:path\");\ndescribe(\"loadFoundryConfig\", () => {\n beforeEach(() => {\n vi.mocked(findUp).mockResolvedValue(\"/path/foundry.config.json\");\n vi.mocked(extname).mockReturnValue(\".json\");\n });\n it(\"should load and parse the configuration file correctly\", async () => {\n const correctConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {\n type: \"git-describe\",\n },\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(correctConfig));\n await expect(loadFoundryConfig()).resolves.toEqual({\n configFilePath: \"/path/foundry.config.json\",\n foundryConfig: {\n ...correctConfig,\n },\n });\n });\n it(\"should throw an error if autoVersion type isn't allowed\", async () => {\n const inCorrectConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {\n type: \"invalid\",\n },\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(inCorrectConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if autoVersion type is missing\", async () => {\n const inCorrectConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n application: \"test-app\",\n directory: \"/test/directory\",\n autoVersion: {},\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(inCorrectConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if the configuration file cannot be read\", async () => {\n vi.mocked(fsPromises.readFile).mockRejectedValue(new Error(\"Read error\"));\n await expect(loadFoundryConfig()).rejects.toThrow(\"Couldn't read or parse config\");\n });\n it(\"should throw an error if the site key isn't found\", async () => {\n const fakeConfig = {\n foundryUrl: \"http://localhost\",\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if the site configuration is missing required keys\", async () => {\n const fakeConfig = {\n foundryUrl: \"http://localhost\",\n site: {\n directory: \"/test/directory\",\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should throw an error if foundryUrl isn't set on top level\", async () => {\n const fakeConfig = {\n site: {\n foundryUrl: \"http://localhost\",\n directory: \"/test/directory\",\n application: \"test-app\",\n },\n };\n vi.mocked(fsPromises.readFile).mockResolvedValue(JSON.stringify(fakeConfig));\n await expect(loadFoundryConfig()).rejects.toThrow(\"The configuration file does not match\");\n });\n it(\"should return undefined if the configuration file is not found\", async () => {\n vi.mocked(findUp).mockResolvedValue(undefined);\n await expect(loadFoundryConfig()).resolves.toBeUndefined();\n });\n it(\"should throw if config file extension isn't supported\", async () => {\n vi.mocked(extname).mockResolvedValue(\".yaml\");\n await expect(loadFoundryConfig()).rejects.toThrow(\"Unsupported file extension:\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,SAASC,O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List":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { loadFoundryConfig } from "./config.js";
|
|
17
|
+
let configPromise = undefined;
|
|
18
|
+
function getConfig() {
|
|
19
|
+
if (configPromise == null) {
|
|
20
|
+
configPromise = loadFoundryConfig();
|
|
21
|
+
}
|
|
22
|
+
return configPromise;
|
|
23
|
+
}
|
|
24
|
+
export default getConfig;
|
|
25
|
+
//# sourceMappingURL=configLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configLoader.js","names":["loadFoundryConfig","configPromise","undefined","getConfig"],"sources":["configLoader.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { loadFoundryConfig } from \"./config.js\";\nlet configPromise = undefined;\nfunction getConfig() {\n if (configPromise == null) {\n configPromise = loadFoundryConfig();\n }\n return configPromise;\n}\nexport default getConfig;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,aAAa;AAC/C,IAAIC,aAAa,GAAGC,SAAS;AAC7B,SAASC,SAASA,CAAA,EAAG;EACjB,IAAIF,aAAa,IAAI,IAAI,EAAE;IACvBA,aAAa,GAAGD,iBAAiB,CAAC,CAAC;EACvC;EACA,OAAOC,aAAa;AACxB;AACA,eAAeE,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { isValidSemver } from "@osdk/cli.common";
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
describe("isValidSemver", () => {
|
|
19
|
+
it("should return true for a valid SemVer version", () => {
|
|
20
|
+
expect(isValidSemver("1.0.0")).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
it("should return true for a valid SemVer version with prerelease", () => {
|
|
23
|
+
expect(isValidSemver("1.0.0-alpha.1")).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it("should return true for a valid SemVer version with build metadata", () => {
|
|
26
|
+
expect(isValidSemver("1.0.0+20130313144700")).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
it("should return false for a version missing patch number", () => {
|
|
29
|
+
expect(isValidSemver("1.0")).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
it("should return false for a version with non-numeric components", () => {
|
|
32
|
+
expect(isValidSemver("1.a.b")).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
it("should return false for a version with a single number", () => {
|
|
35
|
+
expect(isValidSemver("1")).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
it("should return false for a completely non-compliant string", () => {
|
|
38
|
+
expect(isValidSemver("not-a-version")).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=isValidSemver.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidSemver.test.js","names":["isValidSemver","describe","expect","it","toBe"],"sources":["isValidSemver.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { isValidSemver } from \"@osdk/cli.common\";\nimport { describe, expect, it } from \"vitest\";\ndescribe(\"isValidSemver\", () => {\n it(\"should return true for a valid SemVer version\", () => {\n const validVersion = \"1.0.0\";\n expect(isValidSemver(validVersion)).toBe(true);\n });\n it(\"should return true for a valid SemVer version with prerelease\", () => {\n const validVersionWithPrerelease = \"1.0.0-alpha.1\";\n expect(isValidSemver(validVersionWithPrerelease)).toBe(true);\n });\n it(\"should return true for a valid SemVer version with build metadata\", () => {\n const validVersionWithBuild = \"1.0.0+20130313144700\";\n expect(isValidSemver(validVersionWithBuild)).toBe(true);\n });\n it(\"should return false for a version missing patch number\", () => {\n const invalidVersionMissingPatch = \"1.0\";\n expect(isValidSemver(invalidVersionMissingPatch)).toBe(false);\n });\n it(\"should return false for a version with non-numeric components\", () => {\n const invalidVersionNonNumeric = \"1.a.b\";\n expect(isValidSemver(invalidVersionNonNumeric)).toBe(false);\n });\n it(\"should return false for a version with a single number\", () => {\n const invalidVersionNonNumeric = \"1\";\n expect(isValidSemver(invalidVersionNonNumeric)).toBe(false);\n });\n it(\"should return false for a completely non-compliant string\", () => {\n const nonCompliantString = \"not-a-version\";\n expect(isValidSemver(nonCompliantString)).toBe(false);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,kBAAkB;AAChD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7CF,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5BE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IAEtDD,MAAM,CAACF,aAAa,CADC,OACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAClD,CAAC,CAAC;EACFD,EAAE,CAAC,+DAA+D,EAAE,MAAM;IAEtED,MAAM,CAACF,aAAa,CADe,eACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAChE,CAAC,CAAC;EACFD,EAAE,CAAC,mEAAmE,EAAE,MAAM;IAE1ED,MAAM,CAACF,aAAa,CADU,sBACY,CAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAC3D,CAAC,CAAC;EACFD,EAAE,CAAC,wDAAwD,EAAE,MAAM;IAE/DD,MAAM,CAACF,aAAa,CADe,KACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EACjE,CAAC,CAAC;EACFD,EAAE,CAAC,+DAA+D,EAAE,MAAM;IAEtED,MAAM,CAACF,aAAa,CADa,OACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EAC/D,CAAC,CAAC;EACFD,EAAE,CAAC,wDAAwD,EAAE,MAAM;IAE/DD,MAAM,CAACF,aAAa,CADa,GACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EAC/D,CAAC,CAAC;EACFD,EAAE,CAAC,2DAA2D,EAAE,MAAM;IAElED,MAAM,CAACF,aAAa,CADO,eACY,CAAC,CAAC,CAACI,IAAI,CAAC,KAAK,CAAC;EACzD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ExitProcessError } from "@osdk/cli.common";
|
|
17
|
+
import { consola } from "consola";
|
|
18
|
+
import { promises as fsPromises } from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
const TOKEN_ENV_VARS = ["FOUNDRY_TOKEN", "FOUNDRY_SDK_AUTH_TOKEN"];
|
|
21
|
+
/**
|
|
22
|
+
* Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.
|
|
23
|
+
* @param token The token as a string.
|
|
24
|
+
* @param tokenFile The path to the token file.
|
|
25
|
+
* @returns The token as a string.
|
|
26
|
+
* @throws An error if no token is found.
|
|
27
|
+
*/
|
|
28
|
+
export async function loadToken(token, tokenFile) {
|
|
29
|
+
if (token) {
|
|
30
|
+
consola.debug(`Using token from --token option`);
|
|
31
|
+
validate(token);
|
|
32
|
+
return token;
|
|
33
|
+
}
|
|
34
|
+
if (tokenFile) {
|
|
35
|
+
const loadedToken = await loadTokenFile(tokenFile);
|
|
36
|
+
consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);
|
|
37
|
+
validate(loadedToken.token);
|
|
38
|
+
return loadedToken.token;
|
|
39
|
+
}
|
|
40
|
+
for (const envVar of TOKEN_ENV_VARS) {
|
|
41
|
+
const environmentToken = process.env[envVar];
|
|
42
|
+
if (environmentToken) {
|
|
43
|
+
consola.debug(`Using token from ${envVar} environment variable`);
|
|
44
|
+
validate(environmentToken);
|
|
45
|
+
if (envVar === "FOUNDRY_SDK_AUTH_TOKEN") {
|
|
46
|
+
consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);
|
|
47
|
+
}
|
|
48
|
+
return environmentToken;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads a JWT Auth Token from a file.
|
|
55
|
+
* @param filePath The path to the token file.
|
|
56
|
+
* @returns The token as a string.
|
|
57
|
+
* @throws An error if the file cannot be read.
|
|
58
|
+
*/
|
|
59
|
+
export async function loadTokenFile(filePath) {
|
|
60
|
+
let token;
|
|
61
|
+
let resolvedPath;
|
|
62
|
+
try {
|
|
63
|
+
resolvedPath = path.resolve(filePath);
|
|
64
|
+
token = await fsPromises.readFile(resolvedPath, "utf8");
|
|
65
|
+
token = token.trim();
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new ExitProcessError(2, `Unable to read token file "${filePath}": ${error}`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
filePath: resolvedPath,
|
|
71
|
+
token
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function validate(token) {
|
|
75
|
+
if (!isJWT(token)) {
|
|
76
|
+
throw new ExitProcessError(2, `Token does not appear to be a JWT`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function isJWT(token) {
|
|
80
|
+
// https://stackoverflow.com/a/65755789
|
|
81
|
+
|
|
82
|
+
return /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/.test(token);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","names":["ExitProcessError","consola","promises","fsPromises","path","TOKEN_ENV_VARS","loadToken","token","tokenFile","debug","validate","loadedToken","loadTokenFile","filePath","envVar","environmentToken","process","env","warn","resolvedPath","resolve","readFile","trim","error","isJWT","test"],"sources":["token.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport { consola } from \"consola\";\nimport { promises as fsPromises } from \"node:fs\";\nimport path from \"node:path\";\nconst TOKEN_ENV_VARS = [\"FOUNDRY_TOKEN\", \"FOUNDRY_SDK_AUTH_TOKEN\"];\n/**\n * Loads a JWT Auth Token from an argument, a file, or environment variable returning the first found.\n * @param token The token as a string.\n * @param tokenFile The path to the token file.\n * @returns The token as a string.\n * @throws An error if no token is found.\n */\nexport async function loadToken(token, tokenFile) {\n if (token) {\n consola.debug(`Using token from --token option`);\n validate(token);\n return token;\n }\n if (tokenFile) {\n const loadedToken = await loadTokenFile(tokenFile);\n consola.debug(`Using token from --tokenFile=${loadedToken.filePath} option`);\n validate(loadedToken.token);\n return loadedToken.token;\n }\n for (const envVar of TOKEN_ENV_VARS) {\n const environmentToken = process.env[envVar];\n if (environmentToken) {\n consola.debug(`Using token from ${envVar} environment variable`);\n validate(environmentToken);\n if (envVar === \"FOUNDRY_SDK_AUTH_TOKEN\") {\n consola.warn(`Using FOUNDRY_SDK_AUTH_TOKEN environment variable is deprecated. Please use FOUNDRY_TOKEN instead.`);\n }\n return environmentToken;\n }\n }\n throw new ExitProcessError(2, `No token found.`, `You can supply a --token or --token-file option, or set the ${TOKEN_ENV_VARS[0]} environment variable`);\n}\n/**\n * Reads a JWT Auth Token from a file.\n * @param filePath The path to the token file.\n * @returns The token as a string.\n * @throws An error if the file cannot be read.\n */\nexport async function loadTokenFile(filePath) {\n let token;\n let resolvedPath;\n try {\n resolvedPath = path.resolve(filePath);\n token = await fsPromises.readFile(resolvedPath, \"utf8\");\n token = token.trim();\n }\n catch (error) {\n throw new ExitProcessError(2, `Unable to read token file \"${filePath}\": ${error}`);\n }\n return { filePath: resolvedPath, token };\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}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,OAAOC,IAAI,MAAM,WAAW;AAC5B,MAAMC,cAAc,GAAG,CAAC,eAAe,EAAE,wBAAwB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AACe,IAAI,CAAC,CAAC;EACxB,CAAC,CACD,OAAOC,KAAK,EAAE;IACV,MAAM,IAAIvB,gBAAgB,CAAC,CAAC,EAAE,8BAA8Ba,QAAQ,MAAMU,KAAK,EAAE,CAAC;EACtF;EACA,OAAO;IAAEV,QAAQ,EAAEM,YAAY;IAAEZ;EAAM,CAAC;AAC5C;AACA,OAAO,SAASG,QAAQA,CAACH,KAAK,EAAE;EAC5B,IAAI,CAACiB,KAAK,CAACjB,KAAK,CAAC,EAAE;IACf,MAAM,IAAIP,gBAAgB,CAAC,CAAC,EAAE,mCAAmC,CAAC;EACtE;AACJ;AACA,SAASwB,KAAKA,CAACjB,KAAK,EAAE;EAClB;;EAEA,OADmB,kDAAkD,CACnDkB,IAAI,CAAClB,KAAK,CAAC;AACjC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { promises as fsPromises } from "node:fs";
|
|
17
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
18
|
+
import { loadToken, loadTokenFile, validate } from "./token.js";
|
|
19
|
+
vi.mock("node:fs");
|
|
20
|
+
// {"header": {"alg":"HS256","typ":"JWT"}, "payload": {"sub":"1234567890","name":"TestUser","iat":1516239022}}
|
|
21
|
+
const validToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlRlc3RVc2VyIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
|
|
22
|
+
describe("loadToken", () => {
|
|
23
|
+
it("should load a valid token from a direct argument", async () => {
|
|
24
|
+
const token = await loadToken(validToken);
|
|
25
|
+
expect(token).toBe(validToken);
|
|
26
|
+
});
|
|
27
|
+
it("should load a valid token from a file", async () => {
|
|
28
|
+
vi.mocked(fsPromises.readFile).mockResolvedValue(validToken);
|
|
29
|
+
const token = await loadToken(undefined, "valid-token.txt");
|
|
30
|
+
expect(token).toBe(validToken);
|
|
31
|
+
});
|
|
32
|
+
it("should load a valid token from the FOUNDRY_TOKEN environment variable", async () => {
|
|
33
|
+
vi.stubEnv("FOUNDRY_TOKEN", validToken);
|
|
34
|
+
vi.stubEnv("FOUNDRY_SDK_AUTH_TOKEN", "");
|
|
35
|
+
expect(await loadToken()).toBe(validToken);
|
|
36
|
+
});
|
|
37
|
+
it("should load a valid token from the deprecated FOUNDRY_SDK_AUTH_TOKEN environment variable", async () => {
|
|
38
|
+
vi.stubEnv("FOUNDRY_TOKEN", "");
|
|
39
|
+
vi.stubEnv("FOUNDRY_SDK_AUTH_TOKEN", validToken);
|
|
40
|
+
expect(await loadToken()).toBe(validToken);
|
|
41
|
+
});
|
|
42
|
+
it("should throw an error if no token is found", async () => {
|
|
43
|
+
vi.stubEnv("FOUNDRY_TOKEN", "");
|
|
44
|
+
vi.stubEnv("FOUNDRY_SDK_AUTH_TOKEN", "");
|
|
45
|
+
await expect(() => loadToken()).rejects.toThrow("No token found.");
|
|
46
|
+
});
|
|
47
|
+
afterEach(() => {
|
|
48
|
+
vi.unstubAllEnvs();
|
|
49
|
+
vi.restoreAllMocks();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
describe("loadTokenFile", () => {
|
|
53
|
+
it("should throw an error if the token file is not found", async () => {
|
|
54
|
+
await expect(() => loadTokenFile("does-not-exist.txt")).rejects.toThrow(`Unable to read token file "does-not-exist.txt"`);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe("validate", () => {
|
|
58
|
+
it("should throw an error if the token is invalid", () => {
|
|
59
|
+
expect(() => validate("token")).toThrow(`Token does not appear to be a JWT`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=token.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.test.js","names":["promises","fsPromises","afterEach","describe","expect","it","vi","loadToken","loadTokenFile","validate","mock","validToken","token","toBe","mocked","readFile","mockResolvedValue","undefined","stubEnv","rejects","toThrow","unstubAllEnvs","restoreAllMocks"],"sources":["token.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { promises as fsPromises } from \"node:fs\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { loadToken, loadTokenFile, validate } from \"./token.js\";\nvi.mock(\"node:fs\");\n// {\"header\": {\"alg\":\"HS256\",\"typ\":\"JWT\"}, \"payload\": {\"sub\":\"1234567890\",\"name\":\"TestUser\",\"iat\":1516239022}}\nconst validToken = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlRlc3RVc2VyIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\";\ndescribe(\"loadToken\", () => {\n it(\"should load a valid token from a direct argument\", async () => {\n const token = await loadToken(validToken);\n expect(token).toBe(validToken);\n });\n it(\"should load a valid token from a file\", async () => {\n vi.mocked(fsPromises.readFile).mockResolvedValue(validToken);\n const token = await loadToken(undefined, \"valid-token.txt\");\n expect(token).toBe(validToken);\n });\n it(\"should load a valid token from the FOUNDRY_TOKEN environment variable\", async () => {\n vi.stubEnv(\"FOUNDRY_TOKEN\", validToken);\n vi.stubEnv(\"FOUNDRY_SDK_AUTH_TOKEN\", \"\");\n expect(await loadToken()).toBe(validToken);\n });\n it(\"should load a valid token from the deprecated FOUNDRY_SDK_AUTH_TOKEN environment variable\", async () => {\n vi.stubEnv(\"FOUNDRY_TOKEN\", \"\");\n vi.stubEnv(\"FOUNDRY_SDK_AUTH_TOKEN\", validToken);\n expect(await loadToken()).toBe(validToken);\n });\n it(\"should throw an error if no token is found\", async () => {\n vi.stubEnv(\"FOUNDRY_TOKEN\", \"\");\n vi.stubEnv(\"FOUNDRY_SDK_AUTH_TOKEN\", \"\");\n await expect(() => loadToken()).rejects.toThrow(\"No token found.\");\n });\n afterEach(() => {\n vi.unstubAllEnvs();\n vi.restoreAllMocks();\n });\n});\ndescribe(\"loadTokenFile\", () => {\n it(\"should throw an error if the token file is not found\", async () => {\n await expect(() => loadTokenFile(\"does-not-exist.txt\"))\n .rejects.toThrow(`Unable to read token file \"does-not-exist.txt\"`);\n });\n});\ndescribe(\"validate\", () => {\n it(\"should throw an error if the token is invalid\", () => {\n expect(() => validate(\"token\"))\n .toThrow(`Token does not appear to be a JWT`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,UAAU,QAAQ,SAAS;AAChD,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC5D,SA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IAC/BZ,EAAE,CAACY,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;IACxC,MAAMd,MAAM,CAAC,MAAMG,SAAS,CAAC,CAAC,CAAC,CAACY,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;EACtE,CAAC,CAAC;EACFlB,SAAS,CAAC,MAAM;IACZI,EAAE,CAACe,aAAa,CAAC,CAAC;IAClBf,EAAE,CAACgB,eAAe,CAAC,CAAC;EACxB,CAAC,CAAC;AACN,CAAC,CAAC;AACFnB,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5BE,EAAE,CAAC,sDAAsD,EAAE,YAAY;IACnE,MAAMD,MAAM,CAAC,MAAMI,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAClDW,OAAO,CAACC,OAAO,CAAC,gDAAgD,CAAC;EAC1E,CAAC,CAAC;AACN,CAAC,CAAC;AACFjB,QAAQ,CAAC,UAAU,EAAE,MAAM;EACvBE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACtDD,MAAM,CAAC,MAAMK,QAAQ,CAAC,OAAO,CAAC,CAAC,CAC1BW,OAAO,CAAC,mCAAmC,CAAC;EACrD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { consola } from "consola";
|
|
17
|
+
import getConfig from "../util/configLoader.js";
|
|
18
|
+
let firstTime = true;
|
|
19
|
+
export async function logConfigFileMiddleware() {
|
|
20
|
+
if (firstTime) {
|
|
21
|
+
firstTime = false;
|
|
22
|
+
const config = getConfig();
|
|
23
|
+
const configFilePath = (await config)?.configFilePath;
|
|
24
|
+
if (configFilePath) {
|
|
25
|
+
consola.debug(`Using configuration from file: "${configFilePath}"`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=logConfigFileMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logConfigFileMiddleware.js","names":["consola","getConfig","firstTime","logConfigFileMiddleware","config","configFilePath","debug"],"sources":["logConfigFileMiddleware.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { consola } from \"consola\";\nimport getConfig from \"../util/configLoader.js\";\nlet firstTime = true;\nexport async function logConfigFileMiddleware() {\n if (firstTime) {\n firstTime = false;\n const config = getConfig();\n const configFilePath = (await config)?.configFilePath;\n if (configFilePath) {\n consola.debug(`Using configuration from file: \"${configFilePath}\"`);\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,IAAIC,SAAS,GAAG,IAAI;AACpB,OAAO,eAAeC,uBAAuBA,CAAA,EAAG;EAC5C,IAAID,SAAS,EAAE;IACXA,SAAS,GAAG,KAAK;IACjB,MAAME,MAAM,GAAGH,SAAS,CAAC,CAAC;IAC1B,MAAMI,cAAc,GAAG,CAAC,MAAMD,MAAM,GAAGC,cAAc;IACrD,IAAIA,cAAc,EAAE;MAChBL,OAAO,CAACM,KAAK,CAAC,mCAAmCD,cAAc,GAAG,CAAC;IACvE;EACJ;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/cli",
|
|
3
|
-
"version": "0.24.0-beta.
|
|
3
|
+
"version": "0.24.0-beta.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"semver": "^7.6.3",
|
|
29
29
|
"tslib": "^2.6.3",
|
|
30
30
|
"yargs": "^17.7.2",
|
|
31
|
-
"@osdk/generator": "~2.0.0-beta.
|
|
32
|
-
"@osdk/shared.net": "~2.0.0-beta.
|
|
31
|
+
"@osdk/generator": "~2.0.0-beta.14",
|
|
32
|
+
"@osdk/shared.net": "~2.0.0-beta.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/archiver": "^6.0.2",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@types/yargs": "^17.0.29",
|
|
40
40
|
"ts-expect": "^1.3.0",
|
|
41
41
|
"typescript": "^5.5.4",
|
|
42
|
-
"@osdk/cli.cmd.typescript": "~0.6.0-beta.
|
|
43
|
-
"@osdk/cli.common": "~0.
|
|
44
|
-
"@osdk/monorepo.api-extractor": "~0.0.0",
|
|
42
|
+
"@osdk/cli.cmd.typescript": "~0.6.0-beta.13",
|
|
43
|
+
"@osdk/cli.common": "~0.4.0-beta.0",
|
|
45
44
|
"@osdk/monorepo.tsconfig": "~0.0.0",
|
|
46
|
-
"@osdk/monorepo.tsup": "~0.0.0"
|
|
45
|
+
"@osdk/monorepo.tsup": "~0.0.0",
|
|
46
|
+
"@osdk/monorepo.api-extractor": "~0.0.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -75,8 +75,6 @@
|
|
|
75
75
|
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
|
|
76
76
|
"test": "vitest run --pool=forks",
|
|
77
77
|
"test:watch": "vitest",
|
|
78
|
-
"transpile": "monorepo.tool.transpile"
|
|
79
|
-
"transpileWatch": "tsup --watch",
|
|
80
|
-
"typecheck": "monorepo.tool.typecheck esm"
|
|
78
|
+
"transpile": "monorepo.tool.transpile"
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { init_esm_shims } from './chunk-DAYFZSC6.js';
|
|
2
|
-
import { consola } from 'consola';
|
|
3
|
-
|
|
4
|
-
// src/consola/handlePromptCancel.ts
|
|
5
|
-
init_esm_shims();
|
|
6
|
-
function handlePromptCancel(promptResponse) {
|
|
7
|
-
const isFalse = typeof promptResponse === "boolean" && !promptResponse;
|
|
8
|
-
const isSigInt = typeof promptResponse === "symbol" && promptResponse.toString() === "Symbol(clack:cancel)";
|
|
9
|
-
if (isSigInt || isFalse) {
|
|
10
|
-
consola.fail("Operation cancelled");
|
|
11
|
-
process.exit(0);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { handlePromptCancel };
|
|
16
|
-
//# sourceMappingURL=chunk-5AQYUXAY.js.map
|
|
17
|
-
//# sourceMappingURL=chunk-5AQYUXAY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/consola/handlePromptCancel.ts"],"names":[],"mappings":";;;;AAAA,cAAA,EAAA,CAAA;AAiBO,SAAS,mBAAmB,cAAgB,EAAA;AACjD,EAAA,MAAM,OAAU,GAAA,OAAO,cAAmB,KAAA,SAAA,IAAa,CAAC,cAAA,CAAA;AAExD,EAAA,MAAM,WAAW,OAAO,cAAA,KAAmB,QAAY,IAAA,cAAA,CAAe,UAAe,KAAA,sBAAA,CAAA;AACrF,EAAA,IAAI,YAAY,OAAS,EAAA;AACvB,IAAA,OAAA,CAAQ,KAAK,qBAAqB,CAAA,CAAA;AAClC,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GAChB;AACF","file":"chunk-5AQYUXAY.js","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nexport function handlePromptCancel(promptResponse) {\n const isFalse = typeof promptResponse === \"boolean\" && !promptResponse;\n // https://github.com/unjs/consola/issues/251\n const isSigInt = typeof promptResponse === \"symbol\" && promptResponse.toString() === \"Symbol(clack:cancel)\";\n if (isSigInt || isFalse) {\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}"]}
|