@credibledata/cred-cli 0.0.103 → 0.0.105
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/README.md +106 -1
- package/dist/agent-contract.spec.js +548 -0
- package/dist/agent-contract.spec.js.map +1 -0
- package/dist/browser.js +72 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.spec.js +125 -0
- package/dist/browser.spec.js.map +1 -0
- package/dist/client/api.js +4137 -1159
- package/dist/client/api.js.map +1 -1
- package/dist/client-codeassist/api.js +476 -0
- package/dist/client-codeassist/api.js.map +1 -0
- package/dist/client-codeassist/base.js +69 -0
- package/dist/client-codeassist/base.js.map +1 -0
- package/dist/client-codeassist/common.js +162 -0
- package/dist/client-codeassist/common.js.map +1 -0
- package/dist/client-codeassist/configuration.js +44 -0
- package/dist/client-codeassist/configuration.js.map +1 -0
- package/dist/client-codeassist/index.js +32 -0
- package/dist/client-codeassist/index.js.map +1 -0
- package/dist/clientconfiguration.js +17 -289
- package/dist/clientconfiguration.js.map +1 -1
- package/dist/clientconfiguration.spec.js +35 -96
- package/dist/clientconfiguration.spec.js.map +1 -1
- package/dist/commands/add.js +103 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/add.spec.js +113 -0
- package/dist/commands/add.spec.js.map +1 -0
- package/dist/commands/connection/createconnections.js +104 -7
- package/dist/commands/connection/createconnections.js.map +1 -1
- package/dist/commands/connection/createconnections.spec.js +35 -1
- package/dist/commands/connection/createconnections.spec.js.map +1 -1
- package/dist/commands/connection/deleteconnection.js +4 -2
- package/dist/commands/connection/deleteconnection.js.map +1 -1
- package/dist/commands/connection/deleteconnection.spec.js +6 -1
- package/dist/commands/connection/deleteconnection.spec.js.map +1 -1
- package/dist/commands/connection/listconnections.js +2 -0
- package/dist/commands/connection/listconnections.js.map +1 -1
- package/dist/commands/connection/updateconnection.js +365 -0
- package/dist/commands/connection/updateconnection.js.map +1 -0
- package/dist/commands/connection/updateconnection.spec.js +625 -0
- package/dist/commands/connection/updateconnection.spec.js.map +1 -0
- package/dist/commands/database/createdatabase.js +52 -0
- package/dist/commands/database/createdatabase.js.map +1 -0
- package/dist/commands/database/database.spec.js +267 -0
- package/dist/commands/database/database.spec.js.map +1 -0
- package/dist/commands/database/deletedatabase.js +91 -0
- package/dist/commands/database/deletedatabase.js.map +1 -0
- package/dist/commands/database/getdatabase.js +97 -0
- package/dist/commands/database/getdatabase.js.map +1 -0
- package/dist/commands/database/listdatabases.js +36 -0
- package/dist/commands/database/listdatabases.js.map +1 -0
- package/dist/commands/database/shared.js +125 -0
- package/dist/commands/database/shared.js.map +1 -0
- package/dist/commands/database/shared.spec.js +109 -0
- package/dist/commands/database/shared.spec.js.map +1 -0
- package/dist/commands/database/updatedatabase.js +39 -0
- package/dist/commands/database/updatedatabase.js.map +1 -0
- package/dist/commands/environment/createenvironment.js +59 -28
- package/dist/commands/environment/createenvironment.js.map +1 -1
- package/dist/commands/environment/createenvironment.spec.js +29 -0
- package/dist/commands/environment/createenvironment.spec.js.map +1 -1
- package/dist/commands/environment/deleteenvironment.js +3 -2
- package/dist/commands/environment/deleteenvironment.js.map +1 -1
- package/dist/commands/environment/deleteenvironment.spec.js +5 -1
- package/dist/commands/environment/deleteenvironment.spec.js.map +1 -1
- package/dist/commands/environment/getenvironment.js +1 -0
- package/dist/commands/environment/getenvironment.js.map +1 -1
- package/dist/commands/environment/listenvironments.js +40 -8
- package/dist/commands/environment/listenvironments.js.map +1 -1
- package/dist/commands/environment/listenvironments.spec.js +41 -2
- package/dist/commands/environment/listenvironments.spec.js.map +1 -1
- package/dist/commands/environment/setenvironment.js +145 -6
- package/dist/commands/environment/setenvironment.js.map +1 -1
- package/dist/commands/environment/setenvironment.spec.js +256 -8
- package/dist/commands/environment/setenvironment.spec.js.map +1 -1
- package/dist/commands/environment/updateenvironment.js +12 -8
- package/dist/commands/environment/updateenvironment.js.map +1 -1
- package/dist/commands/environment/updateenvironment.spec.js +36 -2
- package/dist/commands/environment/updateenvironment.spec.js.map +1 -1
- package/dist/commands/get.js +64 -1
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/group/addmember.js +3 -1
- package/dist/commands/group/addmember.js.map +1 -1
- package/dist/commands/group/addmember.spec.js +7 -2
- package/dist/commands/group/addmember.spec.js.map +1 -1
- package/dist/commands/group/creategroup.js +2 -0
- package/dist/commands/group/creategroup.js.map +1 -1
- package/dist/commands/group/deletegroup.js +3 -1
- package/dist/commands/group/deletegroup.js.map +1 -1
- package/dist/commands/group/deletegroup.spec.js +7 -1
- package/dist/commands/group/deletegroup.spec.js.map +1 -1
- package/dist/commands/group/getgroup.js +2 -0
- package/dist/commands/group/getgroup.js.map +1 -1
- package/dist/commands/group/listgroups.js +2 -0
- package/dist/commands/group/listgroups.js.map +1 -1
- package/dist/commands/group/removemember.js +3 -1
- package/dist/commands/group/removemember.js.map +1 -1
- package/dist/commands/group/removemember.spec.js +7 -2
- package/dist/commands/group/removemember.spec.js.map +1 -1
- package/dist/commands/groupaccesstoken/deleteToken.js +2 -1
- package/dist/commands/groupaccesstoken/deleteToken.js.map +1 -1
- package/dist/commands/groupaccesstoken/groupContainer.js +2 -0
- package/dist/commands/groupaccesstoken/groupContainer.js.map +1 -1
- package/dist/commands/list.js +24 -4
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/materialization/cancelrun.js +3 -1
- package/dist/commands/materialization/cancelrun.js.map +1 -1
- package/dist/commands/materialization/getindex.js +2 -0
- package/dist/commands/materialization/getindex.js.map +1 -1
- package/dist/commands/materialization/getmaterialization.js +2 -0
- package/dist/commands/materialization/getmaterialization.js.map +1 -1
- package/dist/commands/materialization/getpreaggregate.js +2 -0
- package/dist/commands/materialization/getpreaggregate.js.map +1 -1
- package/dist/commands/materialization/getrun.js +2 -0
- package/dist/commands/materialization/getrun.js.map +1 -1
- package/dist/commands/materialization/listindexes.js +2 -0
- package/dist/commands/materialization/listindexes.js.map +1 -1
- package/dist/commands/materialization/listmaterializations.js +2 -0
- package/dist/commands/materialization/listmaterializations.js.map +1 -1
- package/dist/commands/materialization/listpreaggregates.js +2 -0
- package/dist/commands/materialization/listpreaggregates.js.map +1 -1
- package/dist/commands/materialization/listruns.js +3 -1
- package/dist/commands/materialization/listruns.js.map +1 -1
- package/dist/commands/materialization/rerun.js +3 -1
- package/dist/commands/materialization/rerun.js.map +1 -1
- package/dist/commands/misc/inquirerHost.js +87 -0
- package/dist/commands/misc/inquirerHost.js.map +1 -0
- package/dist/commands/misc/inquirerHost.spec.js +91 -0
- package/dist/commands/misc/inquirerHost.spec.js.map +1 -0
- package/dist/commands/misc/login.js +348 -58
- package/dist/commands/misc/login.js.map +1 -1
- package/dist/commands/misc/login.spec.js +525 -7
- package/dist/commands/misc/login.spec.js.map +1 -1
- package/dist/commands/misc/logout.js +26 -3
- package/dist/commands/misc/logout.js.map +1 -1
- package/dist/commands/misc/logout.spec.js +52 -12
- package/dist/commands/misc/logout.spec.js.map +1 -1
- package/dist/commands/misc/resolveLoginTarget.spec.js +90 -0
- package/dist/commands/misc/resolveLoginTarget.spec.js.map +1 -0
- package/dist/commands/misc/scope.spec.js +108 -0
- package/dist/commands/misc/scope.spec.js.map +1 -0
- package/dist/commands/misc/set-access-token.js +1 -1
- package/dist/commands/misc/set-access-token.js.map +1 -1
- package/dist/commands/misc/set-access-token.spec.js +13 -2
- package/dist/commands/misc/set-access-token.spec.js.map +1 -1
- package/dist/commands/misc/setup.js +819 -0
- package/dist/commands/misc/setup.js.map +1 -0
- package/dist/commands/misc/setup.spec.js +783 -0
- package/dist/commands/misc/setup.spec.js.map +1 -0
- package/dist/commands/misc/status.js +168 -0
- package/dist/commands/misc/status.js.map +1 -0
- package/dist/commands/misc/status.spec.js +301 -0
- package/dist/commands/misc/status.spec.js.map +1 -0
- package/dist/commands/misc/token.js +57 -0
- package/dist/commands/misc/token.js.map +1 -0
- package/dist/commands/misc/token.spec.js +92 -0
- package/dist/commands/misc/token.spec.js.map +1 -0
- package/dist/commands/package/deletepackage.js +4 -2
- package/dist/commands/package/deletepackage.js.map +1 -1
- package/dist/commands/package/deletepackage.spec.js +7 -1
- package/dist/commands/package/deletepackage.spec.js.map +1 -1
- package/dist/commands/package/getpackage.js +142 -0
- package/dist/commands/package/getpackage.js.map +1 -0
- package/dist/commands/package/getpackage.spec.js +246 -0
- package/dist/commands/package/getpackage.spec.js.map +1 -0
- package/dist/commands/package/listpackages.js +2 -0
- package/dist/commands/package/listpackages.js.map +1 -1
- package/dist/commands/package/publish.archive.spec.js +570 -0
- package/dist/commands/package/publish.archive.spec.js.map +1 -0
- package/dist/commands/package/publish.js +780 -49
- package/dist/commands/package/publish.js.map +1 -1
- package/dist/commands/package/publish.spec.js +451 -8
- package/dist/commands/package/publish.spec.js.map +1 -1
- package/dist/commands/package/updatepackage.js +22 -19
- package/dist/commands/package/updatepackage.js.map +1 -1
- package/dist/commands/package/updatepackage.spec.js +36 -1
- package/dist/commands/package/updatepackage.spec.js.map +1 -1
- package/dist/commands/permission/createpermission.js +3 -1
- package/dist/commands/permission/createpermission.js.map +1 -1
- package/dist/commands/permission/deletepermission.js +6 -3
- package/dist/commands/permission/deletepermission.js.map +1 -1
- package/dist/commands/permission/getpermission.js +2 -0
- package/dist/commands/permission/getpermission.js.map +1 -1
- package/dist/commands/permission/listpermissions.js +2 -0
- package/dist/commands/permission/listpermissions.js.map +1 -1
- package/dist/commands/rm.js +21 -0
- package/dist/commands/rm.js.map +1 -1
- package/dist/commands/set.js +40 -6
- package/dist/commands/set.js.map +1 -1
- package/dist/commands/set.spec.js +123 -0
- package/dist/commands/set.spec.js.map +1 -0
- package/dist/commands/table/addtable.js +155 -0
- package/dist/commands/table/addtable.js.map +1 -0
- package/dist/commands/table/deletetable.js +45 -0
- package/dist/commands/table/deletetable.js.map +1 -0
- package/dist/commands/table/gettable.js +32 -0
- package/dist/commands/table/gettable.js.map +1 -0
- package/dist/commands/table/listtables.js +36 -0
- package/dist/commands/table/listtables.js.map +1 -0
- package/dist/commands/table/table.spec.js +304 -0
- package/dist/commands/table/table.spec.js.map +1 -0
- package/dist/commands/table/tablefile.js +195 -0
- package/dist/commands/table/tablefile.js.map +1 -0
- package/dist/commands/table/tablefile.spec.js +158 -0
- package/dist/commands/table/tablefile.spec.js.map +1 -0
- package/dist/commands/update.js +21 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.js +4 -2
- package/dist/commands/version/archive-unarchive-version.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.spec.js +6 -1
- package/dist/commands/version/archive-unarchive-version.spec.js.map +1 -1
- package/dist/commands/version/listversions.js +2 -0
- package/dist/commands/version/listversions.js.map +1 -1
- package/dist/common/UserGroupId.js +9 -4
- package/dist/common/UserGroupId.js.map +1 -1
- package/dist/common/UserGroupId.spec.js +5 -0
- package/dist/common/UserGroupId.spec.js.map +1 -1
- package/dist/constants.js +37 -143
- package/dist/constants.js.map +1 -1
- package/dist/index.js +487 -90
- package/dist/index.js.map +1 -1
- package/dist/logger.js +42 -9
- package/dist/logger.js.map +1 -1
- package/dist/session.js +56 -0
- package/dist/session.js.map +1 -0
- package/dist/session.spec.js +103 -0
- package/dist/session.spec.js.map +1 -0
- package/dist/setup-core/briefing.js +176 -0
- package/dist/setup-core/briefing.js.map +1 -0
- package/dist/setup-core/credstore.js +415 -0
- package/dist/setup-core/credstore.js.map +1 -0
- package/dist/setup-core/credstore.spec.js +238 -0
- package/dist/setup-core/credstore.spec.js.map +1 -0
- package/dist/setup-core/environments.js +267 -0
- package/dist/setup-core/environments.js.map +1 -0
- package/dist/setup-core/flow.e2e.js +165 -0
- package/dist/setup-core/flow.e2e.js.map +1 -0
- package/dist/setup-core/flow.js +765 -0
- package/dist/setup-core/flow.js.map +1 -0
- package/dist/setup-core/flow.spec.js +1348 -0
- package/dist/setup-core/flow.spec.js.map +1 -0
- package/dist/setup-core/folderconfig.js +283 -0
- package/dist/setup-core/folderconfig.js.map +1 -0
- package/dist/setup-core/git.js +97 -0
- package/dist/setup-core/git.js.map +1 -0
- package/dist/setup-core/host.js +77 -0
- package/dist/setup-core/host.js.map +1 -0
- package/dist/setup-core/importconnections.js +470 -0
- package/dist/setup-core/importconnections.js.map +1 -0
- package/dist/setup-core/importconnections.spec.js +594 -0
- package/dist/setup-core/importconnections.spec.js.map +1 -0
- package/dist/setup-core/liveness.js +94 -0
- package/dist/setup-core/liveness.js.map +1 -0
- package/dist/setup-core/liveness.spec.js +59 -0
- package/dist/setup-core/liveness.spec.js.map +1 -0
- package/dist/setup-core/localpublisherconfig.js +26 -0
- package/dist/setup-core/localpublisherconfig.js.map +1 -0
- package/dist/setup-core/localpublisherconfig.spec.js +29 -0
- package/dist/setup-core/localpublisherconfig.spec.js.map +1 -0
- package/dist/setup-core/mcpconfig.js +198 -0
- package/dist/setup-core/mcpconfig.js.map +1 -0
- package/dist/setup-core/mcpconfig.spec.js +205 -0
- package/dist/setup-core/mcpconfig.spec.js.map +1 -0
- package/dist/setup-core/packagemanifest.js +55 -0
- package/dist/setup-core/packagemanifest.js.map +1 -0
- package/dist/setup-core/ports.js +182 -0
- package/dist/setup-core/ports.js.map +1 -0
- package/dist/setup-core/ports.spec.js +173 -0
- package/dist/setup-core/ports.spec.js.map +1 -0
- package/dist/setup-core/publisherconfig.js +268 -0
- package/dist/setup-core/publisherconfig.js.map +1 -0
- package/dist/setup-core/publisherconfig.oracle.js +166 -0
- package/dist/setup-core/publisherconfig.oracle.js.map +1 -0
- package/dist/setup-core/publisherconfig.spec.js +277 -0
- package/dist/setup-core/publisherconfig.spec.js.map +1 -0
- package/dist/setup-core/publisherversion.js +26 -0
- package/dist/setup-core/publisherversion.js.map +1 -0
- package/dist/setup-core/readiness.spec.js +161 -0
- package/dist/setup-core/readiness.spec.js.map +1 -0
- package/dist/setup-core/readylines.js +169 -0
- package/dist/setup-core/readylines.js.map +1 -0
- package/dist/setup-core/readylines.spec.js +70 -0
- package/dist/setup-core/readylines.spec.js.map +1 -0
- package/dist/setup-core/refresh.js +348 -0
- package/dist/setup-core/refresh.js.map +1 -0
- package/dist/setup-core/refresh.spec.js +501 -0
- package/dist/setup-core/refresh.spec.js.map +1 -0
- package/dist/setup-core/skills.js +279 -0
- package/dist/setup-core/skills.js.map +1 -0
- package/dist/setup-core/skills.spec.js +334 -0
- package/dist/setup-core/skills.spec.js.map +1 -0
- package/dist/setup-core/supervisor.js +879 -0
- package/dist/setup-core/supervisor.js.map +1 -0
- package/dist/setup-core/supervisor.spec.js +833 -0
- package/dist/setup-core/supervisor.spec.js.map +1 -0
- package/dist/setup-core/writefile.js +61 -0
- package/dist/setup-core/writefile.js.map +1 -0
- package/dist/setup-core/writefile.spec.js +68 -0
- package/dist/setup-core/writefile.spec.js.map +1 -0
- package/dist/utils.js +409 -3
- package/dist/utils.js.map +1 -1
- package/dist/utils.spec.js +373 -2
- package/dist/utils.spec.js.map +1 -1
- package/dist/versioncheck-refresh.js +18 -0
- package/dist/versioncheck-refresh.js.map +1 -0
- package/dist/versioncheck.js +324 -0
- package/dist/versioncheck.js.map +1 -0
- package/dist/versioncheck.spec.js +587 -0
- package/dist/versioncheck.spec.js.map +1 -0
- package/node_modules/@credibledata/cli-auth/dist/index.d.ts +86 -0
- package/node_modules/@credibledata/cli-auth/dist/index.js +102 -0
- package/node_modules/@credibledata/cli-auth/package.json +19 -0
- package/package.json +18 -6
- package/.github/workflows/build.yml +0 -23
- package/.mocharc.json +0 -10
- package/.prettierignore +0 -2
- package/.prettierrc +0 -4
- package/README-DEV.md +0 -40
- package/coverage/coverage-summary.json +0 -40
- package/coverage/tmp/coverage-2152-1789496974457-0.json +0 -1
- package/coverage/tmp/coverage-2153-1789496954404-0.json +0 -1
- package/docker/Dockerfile.ci +0 -18
- package/docker-compose.yml +0 -18
- package/eslint.config.mjs +0 -45
- package/generate-client.sh +0 -27
- package/mocha.setup.ts +0 -4
- package/openapitools.json +0 -10
- package/src/client/.openapi-generator/FILES +0 -9
- package/src/client/.openapi-generator/VERSION +0 -1
- package/src/client/.openapi-generator-ignore +0 -23
- package/src/client/api.ts +0 -15999
- package/src/client/base.ts +0 -86
- package/src/client/common.ts +0 -150
- package/src/client/configuration.ts +0 -110
- package/src/client/git_push.sh +0 -57
- package/src/client/index.ts +0 -18
- package/src/clientconfiguration.spec.ts +0 -615
- package/src/clientconfiguration.ts +0 -364
- package/src/commands/add.ts +0 -191
- package/src/commands/connection/createconnections.spec.ts +0 -413
- package/src/commands/connection/createconnections.ts +0 -109
- package/src/commands/connection/deleteconnection.spec.ts +0 -189
- package/src/commands/connection/deleteconnection.ts +0 -57
- package/src/commands/connection/listconnections.spec.ts +0 -132
- package/src/commands/connection/listconnections.ts +0 -58
- package/src/commands/environment/createenvironment.spec.ts +0 -249
- package/src/commands/environment/createenvironment.ts +0 -73
- package/src/commands/environment/deleteenvironment.spec.ts +0 -152
- package/src/commands/environment/deleteenvironment.ts +0 -48
- package/src/commands/environment/getenvironment.spec.ts +0 -110
- package/src/commands/environment/getenvironment.ts +0 -43
- package/src/commands/environment/listenvironments.spec.ts +0 -123
- package/src/commands/environment/listenvironments.ts +0 -67
- package/src/commands/environment/setenvironment.spec.ts +0 -63
- package/src/commands/environment/setenvironment.ts +0 -14
- package/src/commands/environment/updateenvironment.spec.ts +0 -386
- package/src/commands/environment/updateenvironment.ts +0 -168
- package/src/commands/get.ts +0 -153
- package/src/commands/group/addmember.spec.ts +0 -257
- package/src/commands/group/addmember.ts +0 -85
- package/src/commands/group/creategroup.spec.ts +0 -146
- package/src/commands/group/creategroup.ts +0 -54
- package/src/commands/group/deletegroup.spec.ts +0 -120
- package/src/commands/group/deletegroup.ts +0 -45
- package/src/commands/group/getgroup.spec.ts +0 -129
- package/src/commands/group/getgroup.ts +0 -47
- package/src/commands/group/listgroups.spec.ts +0 -137
- package/src/commands/group/listgroups.ts +0 -45
- package/src/commands/group/removemember.spec.ts +0 -224
- package/src/commands/group/removemember.ts +0 -75
- package/src/commands/groupaccesstoken/createToken.spec.ts +0 -211
- package/src/commands/groupaccesstoken/createToken.ts +0 -72
- package/src/commands/groupaccesstoken/deleteToken.spec.ts +0 -147
- package/src/commands/groupaccesstoken/deleteToken.ts +0 -29
- package/src/commands/groupaccesstoken/groupContainer.ts +0 -83
- package/src/commands/groupaccesstoken/listTokens.spec.ts +0 -147
- package/src/commands/groupaccesstoken/listTokens.ts +0 -29
- package/src/commands/legacy.ts +0 -5
- package/src/commands/list.ts +0 -326
- package/src/commands/materialization/cancelrun.ts +0 -70
- package/src/commands/materialization/getindex.ts +0 -55
- package/src/commands/materialization/getmaterialization.ts +0 -57
- package/src/commands/materialization/getpreaggregate.ts +0 -58
- package/src/commands/materialization/getrun.ts +0 -55
- package/src/commands/materialization/listindexes.ts +0 -69
- package/src/commands/materialization/listmaterializations.ts +0 -53
- package/src/commands/materialization/listpreaggregates.ts +0 -74
- package/src/commands/materialization/listruns.ts +0 -77
- package/src/commands/materialization/rerun.ts +0 -123
- package/src/commands/misc/login.spec.ts +0 -371
- package/src/commands/misc/login.ts +0 -343
- package/src/commands/misc/logout.spec.ts +0 -32
- package/src/commands/misc/logout.ts +0 -9
- package/src/commands/misc/loopbackOAuth.ts +0 -127
- package/src/commands/misc/set-access-token.spec.ts +0 -95
- package/src/commands/misc/set-access-token.ts +0 -32
- package/src/commands/package/deletepackage.spec.ts +0 -164
- package/src/commands/package/deletepackage.ts +0 -58
- package/src/commands/package/listpackages.spec.ts +0 -163
- package/src/commands/package/listpackages.ts +0 -74
- package/src/commands/package/publish.spec.ts +0 -642
- package/src/commands/package/publish.ts +0 -236
- package/src/commands/package/updatepackage.spec.ts +0 -319
- package/src/commands/package/updatepackage.ts +0 -95
- package/src/commands/permission/createpermission.spec.ts +0 -507
- package/src/commands/permission/createpermission.ts +0 -181
- package/src/commands/permission/deletepermission.ts +0 -117
- package/src/commands/permission/getpermission.ts +0 -115
- package/src/commands/permission/listpermissions.ts +0 -101
- package/src/commands/permission/scope.ts +0 -180
- package/src/commands/rm.ts +0 -146
- package/src/commands/set.ts +0 -25
- package/src/commands/update.ts +0 -107
- package/src/commands/version/archive-unarchive-version.spec.ts +0 -456
- package/src/commands/version/archive-unarchive-version.ts +0 -108
- package/src/commands/version/listversions.spec.ts +0 -138
- package/src/commands/version/listversions.ts +0 -45
- package/src/common/UserGroupId.spec.ts +0 -115
- package/src/common/UserGroupId.ts +0 -137
- package/src/constants.spec.ts +0 -111
- package/src/constants.ts +0 -228
- package/src/index.ts +0 -378
- package/src/logger.spec.ts +0 -158
- package/src/logger.ts +0 -90
- package/src/polyfills/file.polyfill.ts +0 -6
- package/src/utils.spec.ts +0 -135
- package/src/utils.ts +0 -115
- package/src/validator.spec.ts +0 -51
- package/src/validator.ts +0 -44
- package/tsconfig.json +0 -17
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import sinon from "sinon";
|
|
3
|
-
import { VersionsApi } from "../../client/api";
|
|
4
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
5
|
-
import { logger } from "../../logger";
|
|
6
|
-
import { prettifyJson } from "../../utils";
|
|
7
|
-
import { listVersions } from "./listversions";
|
|
8
|
-
|
|
9
|
-
describe("list-versions", () => {
|
|
10
|
-
let sandbox: sinon.SinonSandbox;
|
|
11
|
-
let listVersionsStub: sinon.SinonStub;
|
|
12
|
-
let loggerStub: sinon.SinonStubbedInstance<typeof logger>;
|
|
13
|
-
let consoleLogStub: sinon.SinonStub;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
sandbox = sinon.createSandbox();
|
|
17
|
-
listVersionsStub = sandbox.stub();
|
|
18
|
-
loggerStub = sandbox.stub(logger);
|
|
19
|
-
consoleLogStub = sandbox.stub(console, "log");
|
|
20
|
-
|
|
21
|
-
sandbox
|
|
22
|
-
.stub(ClientConfiguration.prototype, "getOrganization")
|
|
23
|
-
.returns("test-org");
|
|
24
|
-
sandbox
|
|
25
|
-
.stub(ClientConfiguration.prototype, "getProject")
|
|
26
|
-
.returns("test-project");
|
|
27
|
-
sandbox
|
|
28
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
29
|
-
.returns(true);
|
|
30
|
-
sandbox
|
|
31
|
-
.stub(ClientConfiguration.prototype, "getHeaders")
|
|
32
|
-
.returns({ Authorization: "Bearer test-token" });
|
|
33
|
-
|
|
34
|
-
sandbox
|
|
35
|
-
.stub(VersionsApi.prototype, "listVersions")
|
|
36
|
-
.callsFake(listVersionsStub);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
afterEach(() => {
|
|
40
|
-
sandbox.restore();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("should list versions successfully", async () => {
|
|
44
|
-
const mockVersions = [
|
|
45
|
-
{ id: "1.0.0", archiveStatus: "active" },
|
|
46
|
-
{ id: "2.0.0", archiveStatus: "active" },
|
|
47
|
-
];
|
|
48
|
-
const mockResponse = {
|
|
49
|
-
data: mockVersions,
|
|
50
|
-
};
|
|
51
|
-
listVersionsStub.resolves(mockResponse);
|
|
52
|
-
|
|
53
|
-
await listVersions("http://test-server", "/test-package", false);
|
|
54
|
-
|
|
55
|
-
expect(listVersionsStub.calledOnce).to.be.true;
|
|
56
|
-
expect(listVersionsStub.firstCall.args[0]).to.equal("test-org");
|
|
57
|
-
expect(listVersionsStub.firstCall.args[1]).to.equal("test-project");
|
|
58
|
-
expect(listVersionsStub.firstCall.args[2]).to.equal("test-package");
|
|
59
|
-
expect(listVersionsStub.firstCall.args[3]).to.deep.include({
|
|
60
|
-
baseURL: "http://test-server",
|
|
61
|
-
headers: { Authorization: "Bearer test-token" },
|
|
62
|
-
});
|
|
63
|
-
expect(consoleLogStub.calledWith(prettifyJson(mockVersions))).to.be.true;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("should handle package path without leading slash", async () => {
|
|
67
|
-
const mockVersions = [{ id: "1.0.0" }];
|
|
68
|
-
const mockResponse = {
|
|
69
|
-
data: mockVersions,
|
|
70
|
-
};
|
|
71
|
-
listVersionsStub.resolves(mockResponse);
|
|
72
|
-
|
|
73
|
-
await listVersions("http://test-server", "test-package", false);
|
|
74
|
-
|
|
75
|
-
expect(listVersionsStub.firstCall.args[2]).to.equal("test-package");
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("should handle missing config", async () => {
|
|
79
|
-
sandbox.restore();
|
|
80
|
-
sandbox = sinon.createSandbox();
|
|
81
|
-
listVersionsStub = sandbox.stub();
|
|
82
|
-
loggerStub = sandbox.stub(logger);
|
|
83
|
-
consoleLogStub = sandbox.stub(console, "log");
|
|
84
|
-
|
|
85
|
-
sandbox
|
|
86
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
87
|
-
.returns(false);
|
|
88
|
-
sandbox
|
|
89
|
-
.stub(VersionsApi.prototype, "listVersions")
|
|
90
|
-
.callsFake(listVersionsStub);
|
|
91
|
-
|
|
92
|
-
await listVersions("http://test-server", "/test-package", false);
|
|
93
|
-
|
|
94
|
-
expect(listVersionsStub.called).to.be.false;
|
|
95
|
-
expect(
|
|
96
|
-
loggerStub.error.calledWith(
|
|
97
|
-
sinon.match("Please, make sure that you are logged in"),
|
|
98
|
-
),
|
|
99
|
-
).to.be.true;
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("should handle missing project", async () => {
|
|
103
|
-
sandbox.restore();
|
|
104
|
-
sandbox = sinon.createSandbox();
|
|
105
|
-
listVersionsStub = sandbox.stub();
|
|
106
|
-
loggerStub = sandbox.stub(logger);
|
|
107
|
-
consoleLogStub = sandbox.stub(console, "log");
|
|
108
|
-
|
|
109
|
-
sandbox
|
|
110
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
111
|
-
.returns(true);
|
|
112
|
-
sandbox.stub(ClientConfiguration.prototype, "getProject").returns("");
|
|
113
|
-
sandbox
|
|
114
|
-
.stub(VersionsApi.prototype, "listVersions")
|
|
115
|
-
.callsFake(listVersionsStub);
|
|
116
|
-
|
|
117
|
-
await listVersions("http://test-server", "/test-package", false);
|
|
118
|
-
|
|
119
|
-
expect(listVersionsStub.called).to.be.false;
|
|
120
|
-
expect(
|
|
121
|
-
loggerStub.error.calledWith(
|
|
122
|
-
sinon.match("Please, make sure to set an environment"),
|
|
123
|
-
),
|
|
124
|
-
).to.be.true;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("should handle API errors", async () => {
|
|
128
|
-
const mockError = new Error("API Error");
|
|
129
|
-
listVersionsStub.rejects(mockError);
|
|
130
|
-
|
|
131
|
-
await listVersions("http://test-server", "/test-package", true);
|
|
132
|
-
|
|
133
|
-
expect(listVersionsStub.calledOnce).to.be.true;
|
|
134
|
-
expect(
|
|
135
|
-
loggerStub.error.calledWith(sinon.match("Failed to list versions")),
|
|
136
|
-
).to.be.true;
|
|
137
|
-
});
|
|
138
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { VersionsApi } from "../../client/api";
|
|
2
|
-
import { Configuration } from "../../client/configuration";
|
|
3
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
-
import { logger } from "../../logger";
|
|
5
|
-
import { prettifyJson, printOutError } from "../../utils";
|
|
6
|
-
|
|
7
|
-
const versionsApi = new VersionsApi(new Configuration());
|
|
8
|
-
|
|
9
|
-
export async function listVersions(
|
|
10
|
-
controlPlane: string,
|
|
11
|
-
packagePath: string,
|
|
12
|
-
debug: boolean,
|
|
13
|
-
) {
|
|
14
|
-
const clientConfig = new ClientConfiguration();
|
|
15
|
-
const organizationName = clientConfig.getOrganization();
|
|
16
|
-
const environmentName = clientConfig.getProject();
|
|
17
|
-
|
|
18
|
-
if (!clientConfig.doesConfigExists()) {
|
|
19
|
-
logger.error("Please, make sure that you are logged in");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!environmentName) {
|
|
24
|
-
logger.error("Please, make sure to set an environment");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const packageName = packagePath.replace("/", "");
|
|
30
|
-
const response = await versionsApi.listVersions(
|
|
31
|
-
organizationName,
|
|
32
|
-
environmentName,
|
|
33
|
-
packageName,
|
|
34
|
-
{
|
|
35
|
-
baseURL: controlPlane,
|
|
36
|
-
headers: clientConfig.getHeaders(),
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
console.log(prettifyJson(response.data));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
logger.error("Failed to list versions");
|
|
43
|
-
printOutError(e, debug);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { ResourceType, UserGroupId } from "./UserGroupId";
|
|
3
|
-
|
|
4
|
-
describe("UserGroupId", () => {
|
|
5
|
-
describe("constructor", () => {
|
|
6
|
-
it("should parse a valid user id", () => {
|
|
7
|
-
const id = new UserGroupId("user:john");
|
|
8
|
-
expect(id.getResourceType()).to.equal(ResourceType.USER);
|
|
9
|
-
expect(id.getResourceName()).to.equal("john");
|
|
10
|
-
expect(id.getValue()).to.equal("user:john");
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should parse a valid group id", () => {
|
|
14
|
-
const id = new UserGroupId("group:admins");
|
|
15
|
-
expect(id.getResourceType()).to.equal(ResourceType.GROUP);
|
|
16
|
-
expect(id.getResourceName()).to.equal("admins");
|
|
17
|
-
expect(id.getValue()).to.equal("group:admins");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("should trim whitespace from input", () => {
|
|
21
|
-
const id = new UserGroupId(" user:john ");
|
|
22
|
-
expect(id.getValue()).to.equal("user:john");
|
|
23
|
-
expect(id.getResourceName()).to.equal("john");
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should throw for null or empty input", () => {
|
|
27
|
-
expect(() => new UserGroupId("")).to.throw("cannot be null or empty");
|
|
28
|
-
expect(() => new UserGroupId(" ")).to.throw(
|
|
29
|
-
"cannot be null or empty",
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should throw for invalid format", () => {
|
|
34
|
-
expect(() => new UserGroupId("invalid")).to.throw(
|
|
35
|
-
"Invalid UserGroupId format",
|
|
36
|
-
);
|
|
37
|
-
expect(() => new UserGroupId("user:")).to.throw(
|
|
38
|
-
"Invalid UserGroupId format",
|
|
39
|
-
);
|
|
40
|
-
expect(() => new UserGroupId("foo:bar")).to.throw(
|
|
41
|
-
"Invalid UserGroupId format",
|
|
42
|
-
);
|
|
43
|
-
expect(() => new UserGroupId("user:a:b")).to.throw(
|
|
44
|
-
"Invalid UserGroupId format",
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe("static factory methods", () => {
|
|
50
|
-
it("forPublicAccess should create user:* id", () => {
|
|
51
|
-
const id = UserGroupId.forPublicAccess();
|
|
52
|
-
expect(id.getResourceType()).to.equal(ResourceType.USER);
|
|
53
|
-
expect(id.getResourceName()).to.equal("*");
|
|
54
|
-
expect(id.getValue()).to.equal("user:*");
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("forUser should create a user id", () => {
|
|
58
|
-
const id = UserGroupId.forUser("alice");
|
|
59
|
-
expect(id.getResourceType()).to.equal(ResourceType.USER);
|
|
60
|
-
expect(id.getResourceName()).to.equal("alice");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("forUser should throw for undefined user name", () => {
|
|
64
|
-
expect(() => UserGroupId.forUser(undefined)).to.throw(
|
|
65
|
-
"cannot be undefined",
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("forGroup should create a group id", () => {
|
|
70
|
-
const id = UserGroupId.forGroup("developers");
|
|
71
|
-
expect(id.getResourceType()).to.equal(ResourceType.GROUP);
|
|
72
|
-
expect(id.getResourceName()).to.equal("developers");
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("create should build from ResourceType and name", () => {
|
|
76
|
-
const userId = UserGroupId.create(ResourceType.USER, "bob");
|
|
77
|
-
expect(userId.getResourceType()).to.equal(ResourceType.USER);
|
|
78
|
-
expect(userId.getResourceName()).to.equal("bob");
|
|
79
|
-
|
|
80
|
-
const groupId = UserGroupId.create(ResourceType.GROUP, "team");
|
|
81
|
-
expect(groupId.getResourceType()).to.equal(ResourceType.GROUP);
|
|
82
|
-
expect(groupId.getResourceName()).to.equal("team");
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe("serialization", () => {
|
|
87
|
-
it("toString should return original value", () => {
|
|
88
|
-
const id = new UserGroupId("user:john");
|
|
89
|
-
expect(id.toString()).to.equal("user:john");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("toJSON should return original value for JSON serialization", () => {
|
|
93
|
-
const id = new UserGroupId("group:admins");
|
|
94
|
-
expect(id.toJSON()).to.equal("group:admins");
|
|
95
|
-
expect(JSON.stringify(id)).to.equal('"group:admins"');
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe("isPublicAccess", () => {
|
|
100
|
-
it("should return false for regular user ids", () => {
|
|
101
|
-
const id = new UserGroupId("user:john");
|
|
102
|
-
expect(id.isPublicAccess()).to.be.false;
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("should return false for group ids", () => {
|
|
106
|
-
const id = new UserGroupId("group:admins");
|
|
107
|
-
expect(id.isPublicAccess()).to.be.false;
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("should return true for user:* (the public-access wildcard)", () => {
|
|
111
|
-
const id = UserGroupId.forPublicAccess();
|
|
112
|
-
expect(id.isPublicAccess()).to.be.true;
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
});
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing the different types of user/group resources.
|
|
3
|
-
*/
|
|
4
|
-
export enum ResourceType {
|
|
5
|
-
USER = "USER",
|
|
6
|
-
GROUP = "GROUP",
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Represents a user or group identifier in the format 'user:userId' or 'group:groupId'.
|
|
11
|
-
* This class parses the input string and provides methods to extract the
|
|
12
|
-
* resource type and name.
|
|
13
|
-
*/
|
|
14
|
-
export class UserGroupId {
|
|
15
|
-
private readonly resourceType: ResourceType;
|
|
16
|
-
private readonly resourceName: string;
|
|
17
|
-
private readonly originalValue: string;
|
|
18
|
-
|
|
19
|
-
static forPublicAccess(): UserGroupId {
|
|
20
|
-
return new UserGroupId(`user:*`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static forUser(userName: string | undefined): UserGroupId {
|
|
24
|
-
if (!userName) {
|
|
25
|
-
throw new Error("User name cannot be undefined");
|
|
26
|
-
}
|
|
27
|
-
return new UserGroupId(`user:${userName}`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static forGroup(groupName: string): UserGroupId {
|
|
31
|
-
return new UserGroupId(`group:${groupName}`);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a UserGroupId from a string in the format 'user:userId' or 'group:groupId'.
|
|
35
|
-
*
|
|
36
|
-
* @param value the string to parse
|
|
37
|
-
* @throws BadRequestException if the format is invalid
|
|
38
|
-
*/
|
|
39
|
-
constructor(value: string) {
|
|
40
|
-
if (!value || value.trim().length === 0) {
|
|
41
|
-
throw new Error("UserGroupId cannot be null or empty");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.originalValue = value.trim();
|
|
45
|
-
|
|
46
|
-
if (!this.originalValue.match(/^(user:[^:]+|group:[^:]+)$/)) {
|
|
47
|
-
throw new Error(
|
|
48
|
-
`Invalid UserGroupId format. Expected 'user:userId' or 'group:groupId', got: ${this.originalValue}`,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const parts = this.originalValue.split(":", 2);
|
|
53
|
-
const typeStr = parts[0];
|
|
54
|
-
const name = parts[1];
|
|
55
|
-
|
|
56
|
-
if (!name || name.length === 0) {
|
|
57
|
-
throw new Error(
|
|
58
|
-
`UserGroupId name cannot be empty. Expected 'user:userId' or 'group:groupId', got: ${this.originalValue}`,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
switch (typeStr) {
|
|
63
|
-
case "user":
|
|
64
|
-
this.resourceType = ResourceType.USER;
|
|
65
|
-
break;
|
|
66
|
-
case "group":
|
|
67
|
-
this.resourceType = ResourceType.GROUP;
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
throw new Error(
|
|
71
|
-
`Invalid UserGroupId type. Expected 'user' or 'group', got: ${typeStr}`,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.resourceName = name;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Creates a UserGroupId from resource type and name.
|
|
80
|
-
*
|
|
81
|
-
* @param resourceType the resource type
|
|
82
|
-
* @param userName the user or group name
|
|
83
|
-
*/
|
|
84
|
-
public static create(
|
|
85
|
-
resourceType: ResourceType,
|
|
86
|
-
userName: string,
|
|
87
|
-
): UserGroupId {
|
|
88
|
-
return new UserGroupId(`${resourceType.toLowerCase()}:${userName}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Returns the resource type (USER or GROUP).
|
|
93
|
-
*
|
|
94
|
-
* @return the resource type
|
|
95
|
-
*/
|
|
96
|
-
public getResourceType(): ResourceType {
|
|
97
|
-
return this.resourceType;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Returns the resource name (the part after the colon).
|
|
102
|
-
*
|
|
103
|
-
* @return the resource name
|
|
104
|
-
*/
|
|
105
|
-
public getResourceName(): string {
|
|
106
|
-
return this.resourceName;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Returns the original string value.
|
|
111
|
-
*
|
|
112
|
-
* @return the original string value
|
|
113
|
-
*/
|
|
114
|
-
public getValue(): string {
|
|
115
|
-
return this.originalValue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public toString(): string {
|
|
119
|
-
return this.originalValue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Custom JSON serialization method for axios/openapi.
|
|
124
|
-
* This ensures UserGroupId is serialized as a string (originalValue) instead of an object.
|
|
125
|
-
*
|
|
126
|
-
* @return the original string value for JSON serialization
|
|
127
|
-
*/
|
|
128
|
-
public toJSON(): string {
|
|
129
|
-
return this.originalValue;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public isPublicAccess(): boolean {
|
|
133
|
-
return (
|
|
134
|
-
this.resourceType === ResourceType.USER && this.resourceName === "*"
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
package/src/constants.spec.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import {
|
|
3
|
-
CLUSTER_BY_ENVIRONMENT,
|
|
4
|
-
DEFAULT_ENVIRONMENT_BY_CLUSTER,
|
|
5
|
-
getAuth0OrganizationIdForCliLogin,
|
|
6
|
-
getCliOrgConfig,
|
|
7
|
-
} from "./constants";
|
|
8
|
-
|
|
9
|
-
describe("constants", () => {
|
|
10
|
-
describe("DEFAULT_ENVIRONMENT_BY_CLUSTER", () => {
|
|
11
|
-
it("defaults gcp to production", () => {
|
|
12
|
-
expect(DEFAULT_ENVIRONMENT_BY_CLUSTER.gcp).to.equal("production");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("defaults aws to videoamp", () => {
|
|
16
|
-
expect(DEFAULT_ENVIRONMENT_BY_CLUSTER.aws).to.equal("videoamp");
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe("CLUSTER_BY_ENVIRONMENT", () => {
|
|
21
|
-
it("places videoamp on aws", () => {
|
|
22
|
-
expect(CLUSTER_BY_ENVIRONMENT.videoamp).to.equal("aws");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("places every other env on gcp", () => {
|
|
26
|
-
expect(CLUSTER_BY_ENVIRONMENT.production).to.equal("gcp");
|
|
27
|
-
expect(CLUSTER_BY_ENVIRONMENT.staging).to.equal("gcp");
|
|
28
|
-
expect(CLUSTER_BY_ENVIRONMENT.dev).to.equal("gcp");
|
|
29
|
-
expect(CLUSTER_BY_ENVIRONMENT.localhost).to.equal("gcp");
|
|
30
|
-
expect(CLUSTER_BY_ENVIRONMENT["e2e-test"]).to.equal("gcp");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("agrees with DEFAULT_ENVIRONMENT_BY_CLUSTER round-trip", () => {
|
|
34
|
-
for (const cluster of ["gcp", "aws"] as const) {
|
|
35
|
-
const defaultEnv = DEFAULT_ENVIRONMENT_BY_CLUSTER[cluster];
|
|
36
|
-
expect(CLUSTER_BY_ENVIRONMENT[defaultEnv]).to.equal(cluster);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe("getCliOrgConfig", () => {
|
|
42
|
-
it("returns the videoamp registry entry", () => {
|
|
43
|
-
const cfg = getCliOrgConfig("videoamp");
|
|
44
|
-
expect(cfg).to.not.be.undefined;
|
|
45
|
-
expect(cfg!.cliOrgName).to.equal("videoamp");
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("lists videoamp's supported clusters and default", () => {
|
|
49
|
-
const cfg = getCliOrgConfig("videoamp")!;
|
|
50
|
-
expect(cfg.supportedClusters).to.have.members(["gcp", "aws"]);
|
|
51
|
-
expect(cfg.defaultCluster).to.be.oneOf(cfg.supportedClusters);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("exposes the aws Auth0 org id for videoamp", () => {
|
|
55
|
-
const cfg = getCliOrgConfig("videoamp")!;
|
|
56
|
-
expect(cfg.auth0OrganizationIds?.aws).to.equal("org_nMRKafeSuxOiuJeG");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("is case-insensitive on the org name", () => {
|
|
60
|
-
expect(getCliOrgConfig("VideoAmp")?.cliOrgName).to.equal("videoamp");
|
|
61
|
-
expect(getCliOrgConfig("VIDEOAMP")?.cliOrgName).to.equal("videoamp");
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("returns undefined for unregistered orgs (default gcp/device-flow path)", () => {
|
|
65
|
-
expect(getCliOrgConfig("acme")).to.be.undefined;
|
|
66
|
-
expect(getCliOrgConfig("some-new-customer")).to.be.undefined;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("guarantees defaultCluster is in supportedClusters for every entry", () => {
|
|
70
|
-
for (const name of ["videoamp"]) {
|
|
71
|
-
const cfg = getCliOrgConfig(name)!;
|
|
72
|
-
expect(cfg.supportedClusters).to.include(cfg.defaultCluster);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe("getAuth0OrganizationIdForCliLogin", () => {
|
|
78
|
-
it("returns the aws Auth0 org id when -c aws is the active cluster", () => {
|
|
79
|
-
expect(getAuth0OrganizationIdForCliLogin("videoamp", "aws")).to.equal(
|
|
80
|
-
"org_nMRKafeSuxOiuJeG",
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("returns undefined for videoamp on gcp (no aws-only Auth0 id maps to gcp)", () => {
|
|
85
|
-
expect(getAuth0OrganizationIdForCliLogin("videoamp", "gcp")).to.be
|
|
86
|
-
.undefined;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it("falls back to the org's defaultCluster when no cluster is passed", () => {
|
|
90
|
-
const cfg = getCliOrgConfig("videoamp")!;
|
|
91
|
-
const expected = cfg.auth0OrganizationIds?.[cfg.defaultCluster];
|
|
92
|
-
expect(getAuth0OrganizationIdForCliLogin("videoamp")).to.equal(
|
|
93
|
-
expected,
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("is case-insensitive on the org name", () => {
|
|
98
|
-
expect(getAuth0OrganizationIdForCliLogin("VideoAmp", "aws")).to.equal(
|
|
99
|
-
"org_nMRKafeSuxOiuJeG",
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("returns undefined for unregistered orgs (forces device-code flow)", () => {
|
|
104
|
-
expect(getAuth0OrganizationIdForCliLogin("acme")).to.be.undefined;
|
|
105
|
-
expect(getAuth0OrganizationIdForCliLogin("acme", "aws")).to.be
|
|
106
|
-
.undefined;
|
|
107
|
-
expect(getAuth0OrganizationIdForCliLogin("acme", "gcp")).to.be
|
|
108
|
-
.undefined;
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|