@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,386 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import sinon from "sinon";
|
|
3
|
-
import { EnvironmentsApi } from "../../client/api";
|
|
4
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
5
|
-
import { logger } from "../../logger";
|
|
6
|
-
import { updateEnvironment } from "./updateenvironment";
|
|
7
|
-
|
|
8
|
-
describe("update-environment", () => {
|
|
9
|
-
let sandbox: sinon.SinonSandbox;
|
|
10
|
-
let updateEnvironmentStub: sinon.SinonStub;
|
|
11
|
-
let loggerStub: sinon.SinonStubbedInstance<typeof logger>;
|
|
12
|
-
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
sandbox = sinon.createSandbox();
|
|
15
|
-
updateEnvironmentStub = sandbox.stub();
|
|
16
|
-
loggerStub = sandbox.stub(logger);
|
|
17
|
-
|
|
18
|
-
// Mock ClientConfiguration constructor
|
|
19
|
-
sandbox
|
|
20
|
-
.stub(ClientConfiguration.prototype, "getOrganization")
|
|
21
|
-
.returns("test-org");
|
|
22
|
-
sandbox
|
|
23
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
24
|
-
.returns(true);
|
|
25
|
-
sandbox
|
|
26
|
-
.stub(ClientConfiguration.prototype, "getHeaders")
|
|
27
|
-
.returns({ Authorization: "Bearer test-token" });
|
|
28
|
-
|
|
29
|
-
// Mock EnvironmentsApi constructor and method
|
|
30
|
-
sandbox
|
|
31
|
-
.stub(EnvironmentsApi.prototype, "updateEnvironment")
|
|
32
|
-
.callsFake(updateEnvironmentStub);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
sandbox.restore();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe("updateEnvironment", () => {
|
|
40
|
-
it("should update environment successfully", async () => {
|
|
41
|
-
const mockResponse = { status: 200 };
|
|
42
|
-
updateEnvironmentStub.resolves(mockResponse);
|
|
43
|
-
|
|
44
|
-
await updateEnvironment(
|
|
45
|
-
"http://test-server",
|
|
46
|
-
"test-environment",
|
|
47
|
-
{ replicationCount: 3 },
|
|
48
|
-
false,
|
|
49
|
-
true,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
expect(updateEnvironmentStub.calledOnce).to.be.true;
|
|
53
|
-
expect(updateEnvironmentStub.firstCall.args[0]).to.equal("test-org");
|
|
54
|
-
expect(updateEnvironmentStub.firstCall.args[1]).to.equal(
|
|
55
|
-
"test-environment",
|
|
56
|
-
);
|
|
57
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.include({
|
|
58
|
-
replicationCount: 3,
|
|
59
|
-
});
|
|
60
|
-
expect(updateEnvironmentStub.firstCall.args[3]).to.deep.include({
|
|
61
|
-
baseURL: "http://test-server",
|
|
62
|
-
headers: { Authorization: "Bearer test-token" },
|
|
63
|
-
});
|
|
64
|
-
expect(
|
|
65
|
-
loggerStub.info.calledWith(
|
|
66
|
-
sinon.match("Successfully updated environment test-environment"),
|
|
67
|
-
),
|
|
68
|
-
).to.be.true;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("should handle missing environment name", async () => {
|
|
72
|
-
await updateEnvironment(
|
|
73
|
-
"http://test-server",
|
|
74
|
-
"",
|
|
75
|
-
{ replicationCount: 3 },
|
|
76
|
-
false,
|
|
77
|
-
true,
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
81
|
-
expect(
|
|
82
|
-
loggerStub.error.calledWith(
|
|
83
|
-
sinon.match("Please provide an environment name"),
|
|
84
|
-
),
|
|
85
|
-
).to.be.true;
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("should handle API errors", async () => {
|
|
89
|
-
const mockError = new Error("API Error");
|
|
90
|
-
updateEnvironmentStub.rejects(mockError);
|
|
91
|
-
|
|
92
|
-
await updateEnvironment(
|
|
93
|
-
"http://test-server",
|
|
94
|
-
"test-environment",
|
|
95
|
-
{ replicationCount: 3 },
|
|
96
|
-
true,
|
|
97
|
-
true,
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
expect(updateEnvironmentStub.calledOnce).to.be.true;
|
|
101
|
-
expect(
|
|
102
|
-
loggerStub.error.calledWith(
|
|
103
|
-
sinon.match("Failed to update environment test-environment"),
|
|
104
|
-
),
|
|
105
|
-
).to.be.true;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it("should handle non-200 response status", async () => {
|
|
109
|
-
const mockResponse = { status: 400 };
|
|
110
|
-
updateEnvironmentStub.resolves(mockResponse);
|
|
111
|
-
|
|
112
|
-
await updateEnvironment(
|
|
113
|
-
"http://test-server",
|
|
114
|
-
"test-environment",
|
|
115
|
-
{ replicationCount: 3 },
|
|
116
|
-
false,
|
|
117
|
-
true,
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
expect(updateEnvironmentStub.calledOnce).to.be.true;
|
|
121
|
-
expect(
|
|
122
|
-
loggerStub.error.calledWith(
|
|
123
|
-
sinon.match("Failed to update environment. Status: 400"),
|
|
124
|
-
),
|
|
125
|
-
).to.be.true;
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
describe("validators", () => {
|
|
130
|
-
describe("authentication validation", () => {
|
|
131
|
-
it("should fail when user is not logged in", async () => {
|
|
132
|
-
sandbox.restore();
|
|
133
|
-
sandbox = sinon.createSandbox();
|
|
134
|
-
updateEnvironmentStub = sandbox.stub();
|
|
135
|
-
loggerStub = sandbox.stub(logger);
|
|
136
|
-
|
|
137
|
-
sandbox
|
|
138
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
139
|
-
.returns(false);
|
|
140
|
-
sandbox
|
|
141
|
-
.stub(EnvironmentsApi.prototype, "updateEnvironment")
|
|
142
|
-
.callsFake(updateEnvironmentStub);
|
|
143
|
-
|
|
144
|
-
await updateEnvironment(
|
|
145
|
-
"http://test-server",
|
|
146
|
-
"test-environment",
|
|
147
|
-
{ replicationCount: 3 },
|
|
148
|
-
false,
|
|
149
|
-
true,
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
153
|
-
expect(
|
|
154
|
-
loggerStub.error.calledWith(
|
|
155
|
-
sinon.match("Please, make sure that you are logged in"),
|
|
156
|
-
),
|
|
157
|
-
).to.be.true;
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
describe("git-backed modeling", () => {
|
|
162
|
-
it("sends the enrolment flag on its own", async () => {
|
|
163
|
-
updateEnvironmentStub.resolves({ status: 200 });
|
|
164
|
-
|
|
165
|
-
await updateEnvironment(
|
|
166
|
-
"http://test-server",
|
|
167
|
-
"test-environment",
|
|
168
|
-
{ gitModeling: "true" },
|
|
169
|
-
false,
|
|
170
|
-
true,
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
expect(updateEnvironmentStub.calledOnce).to.be.true;
|
|
174
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.deep.equal({
|
|
175
|
-
gitModelingEnabled: true,
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it("rejects a --git-modeling value that is neither true nor false", async () => {
|
|
180
|
-
await updateEnvironment(
|
|
181
|
-
"http://test-server",
|
|
182
|
-
"test-environment",
|
|
183
|
-
{ gitModeling: "yes" },
|
|
184
|
-
false,
|
|
185
|
-
true,
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
189
|
-
expect(
|
|
190
|
-
loggerStub.error.calledWith(
|
|
191
|
-
sinon.match("--git-modeling must be true or false"),
|
|
192
|
-
),
|
|
193
|
-
).to.be.true;
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it("sends all three coordinates together", async () => {
|
|
197
|
-
updateEnvironmentStub.resolves({ status: 200 });
|
|
198
|
-
|
|
199
|
-
await updateEnvironment(
|
|
200
|
-
"http://test-server",
|
|
201
|
-
"test-environment",
|
|
202
|
-
{
|
|
203
|
-
gitRepositoryOwner: "credible-data-repos",
|
|
204
|
-
gitRepositoryName: "models",
|
|
205
|
-
gitBaseBranch: "main",
|
|
206
|
-
},
|
|
207
|
-
false,
|
|
208
|
-
true,
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.deep.equal({
|
|
212
|
-
gitRepositoryOwner: "credible-data-repos",
|
|
213
|
-
gitRepositoryName: "models",
|
|
214
|
-
gitBaseBranch: "main",
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("refuses a partial coordinate locally rather than sending a 400", async () => {
|
|
219
|
-
// The API rejects this as GIT_REPOSITORY_INCOMPLETE. Refusing here means a
|
|
220
|
-
// script gets the rule from the tool it is driving.
|
|
221
|
-
await updateEnvironment(
|
|
222
|
-
"http://test-server",
|
|
223
|
-
"test-environment",
|
|
224
|
-
{ gitRepositoryOwner: "credible-data-repos" },
|
|
225
|
-
false,
|
|
226
|
-
true,
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
230
|
-
expect(loggerStub.error.calledWith(sinon.match("change together")))
|
|
231
|
-
.to.be.true;
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it("refuses a mix of set and cleared coordinates", async () => {
|
|
235
|
-
await updateEnvironment(
|
|
236
|
-
"http://test-server",
|
|
237
|
-
"test-environment",
|
|
238
|
-
{
|
|
239
|
-
gitRepositoryOwner: "credible-data-repos",
|
|
240
|
-
gitRepositoryName: "",
|
|
241
|
-
gitBaseBranch: "main",
|
|
242
|
-
},
|
|
243
|
-
false,
|
|
244
|
-
true,
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
248
|
-
expect(
|
|
249
|
-
loggerStub.error.calledWith(sinon.match("unset the repository")),
|
|
250
|
-
).to.be.true;
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it("sends nulls when all three are emptied, which is how a record is unset", async () => {
|
|
254
|
-
updateEnvironmentStub.resolves({ status: 200 });
|
|
255
|
-
|
|
256
|
-
await updateEnvironment(
|
|
257
|
-
"http://test-server",
|
|
258
|
-
"test-environment",
|
|
259
|
-
{
|
|
260
|
-
gitRepositoryOwner: "",
|
|
261
|
-
gitRepositoryName: "",
|
|
262
|
-
gitBaseBranch: " ",
|
|
263
|
-
},
|
|
264
|
-
false,
|
|
265
|
-
true,
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.deep.equal({
|
|
269
|
-
gitRepositoryOwner: null,
|
|
270
|
-
gitRepositoryName: null,
|
|
271
|
-
gitBaseBranch: null,
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("carries the enrolment and the coordinates in one request", async () => {
|
|
276
|
-
updateEnvironmentStub.resolves({ status: 200 });
|
|
277
|
-
|
|
278
|
-
await updateEnvironment(
|
|
279
|
-
"http://test-server",
|
|
280
|
-
"test-environment",
|
|
281
|
-
{
|
|
282
|
-
gitModeling: "true",
|
|
283
|
-
gitRepositoryOwner: "credible-data-repos",
|
|
284
|
-
gitRepositoryName: "models",
|
|
285
|
-
gitBaseBranch: "main",
|
|
286
|
-
},
|
|
287
|
-
false,
|
|
288
|
-
true,
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.deep.equal({
|
|
292
|
-
gitModelingEnabled: true,
|
|
293
|
-
gitRepositoryOwner: "credible-data-repos",
|
|
294
|
-
gitRepositoryName: "models",
|
|
295
|
-
gitBaseBranch: "main",
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
it("reports a refusal from the server rather than claiming success", async () => {
|
|
300
|
-
updateEnvironmentStub.rejects(
|
|
301
|
-
Object.assign(new Error("Request failed with status code 400"), {
|
|
302
|
-
response: {
|
|
303
|
-
status: 400,
|
|
304
|
-
data: { code: "GIT_REPOSITORY_NOT_REGISTERED" },
|
|
305
|
-
},
|
|
306
|
-
}),
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
await updateEnvironment(
|
|
310
|
-
"http://test-server",
|
|
311
|
-
"test-environment",
|
|
312
|
-
{ gitModeling: "true" },
|
|
313
|
-
false,
|
|
314
|
-
true,
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
expect(
|
|
318
|
-
loggerStub.error.calledWith(
|
|
319
|
-
sinon.match("Failed to update environment test-environment"),
|
|
320
|
-
),
|
|
321
|
-
).to.be.true;
|
|
322
|
-
expect(
|
|
323
|
-
loggerStub.info.calledWith(sinon.match("Successfully updated")),
|
|
324
|
-
).to.be.false;
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
describe("replication count validation", () => {
|
|
329
|
-
it("should accept valid replication counts", async () => {
|
|
330
|
-
const mockResponse = { status: 200 };
|
|
331
|
-
updateEnvironmentStub.resolves(mockResponse);
|
|
332
|
-
|
|
333
|
-
const validCounts = [1, 2, 5, 10, 100];
|
|
334
|
-
|
|
335
|
-
for (const count of validCounts) {
|
|
336
|
-
await updateEnvironment(
|
|
337
|
-
"http://test-server",
|
|
338
|
-
"test-environment",
|
|
339
|
-
{ replicationCount: count },
|
|
340
|
-
false,
|
|
341
|
-
true,
|
|
342
|
-
);
|
|
343
|
-
expect(updateEnvironmentStub.called).to.be.true;
|
|
344
|
-
expect(updateEnvironmentStub.firstCall.args[2]).to.include({
|
|
345
|
-
replicationCount: count,
|
|
346
|
-
});
|
|
347
|
-
updateEnvironmentStub.reset();
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it("should reject replication count less than 1", async () => {
|
|
352
|
-
await updateEnvironment(
|
|
353
|
-
"http://test-server",
|
|
354
|
-
"test-environment",
|
|
355
|
-
{ replicationCount: 0 },
|
|
356
|
-
false,
|
|
357
|
-
true,
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
361
|
-
expect(
|
|
362
|
-
loggerStub.error.calledWith(
|
|
363
|
-
sinon.match("Replication count must be at least 1"),
|
|
364
|
-
),
|
|
365
|
-
).to.be.true;
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it("should reject negative replication count", async () => {
|
|
369
|
-
await updateEnvironment(
|
|
370
|
-
"http://test-server",
|
|
371
|
-
"test-environment",
|
|
372
|
-
{ replicationCount: -1 },
|
|
373
|
-
false,
|
|
374
|
-
true,
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
expect(updateEnvironmentStub.called).to.be.false;
|
|
378
|
-
expect(
|
|
379
|
-
loggerStub.error.calledWith(
|
|
380
|
-
sinon.match("Replication count must be at least 1"),
|
|
381
|
-
),
|
|
382
|
-
).to.be.true;
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { Environment, EnvironmentsApi } from "../../client/api";
|
|
2
|
-
import { Configuration } from "../../client/configuration";
|
|
3
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
4
|
-
import { logger } from "../../logger";
|
|
5
|
-
import { getConfirmation, printOutError } from "../../utils";
|
|
6
|
-
|
|
7
|
-
const environmentsApi = new EnvironmentsApi(new Configuration());
|
|
8
|
-
|
|
9
|
-
type UpdateEnvironmentProperties = {
|
|
10
|
-
replicationCount?: number;
|
|
11
|
-
/** Raw `--git-modeling` value; parsed here so a typo is refused rather than sent. */
|
|
12
|
-
gitModeling?: string;
|
|
13
|
-
gitRepositoryOwner?: string;
|
|
14
|
-
gitRepositoryName?: string;
|
|
15
|
-
gitBaseBranch?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The three repository coordinates change as a unit, and the API rejects any other
|
|
20
|
-
* shape (`GIT_REPOSITORY_INCOMPLETE`, `GIT_REPOSITORY_INCOHERENT`). Refused here too, so
|
|
21
|
-
* a scripted caller gets the rule from the tool it is driving rather than from a 400.
|
|
22
|
-
*
|
|
23
|
-
* Returns the body fragment, or a message to print instead of sending anything.
|
|
24
|
-
*/
|
|
25
|
-
function gitRepositoryRecord(
|
|
26
|
-
properties: UpdateEnvironmentProperties,
|
|
27
|
-
): { changes: Partial<Environment> } | { error: string } {
|
|
28
|
-
const mentioned = [
|
|
29
|
-
properties.gitRepositoryOwner,
|
|
30
|
-
properties.gitRepositoryName,
|
|
31
|
-
properties.gitBaseBranch,
|
|
32
|
-
].filter((value) => value !== undefined) as string[];
|
|
33
|
-
|
|
34
|
-
if (mentioned.length === 0) {
|
|
35
|
-
return { changes: {} };
|
|
36
|
-
}
|
|
37
|
-
if (mentioned.length !== 3) {
|
|
38
|
-
return {
|
|
39
|
-
error:
|
|
40
|
-
"--git-repository-owner, --git-repository-name and --git-base-branch change " +
|
|
41
|
-
"together. Pass all three, or none.",
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const trimmed = mentioned.map((value) => value.trim());
|
|
46
|
-
const cleared = trimmed.filter((value) => value === "").length;
|
|
47
|
-
if (cleared !== 0 && cleared !== 3) {
|
|
48
|
-
return {
|
|
49
|
-
error:
|
|
50
|
-
"Set all three of --git-repository-owner, --git-repository-name and " +
|
|
51
|
-
'--git-base-branch, or pass "" for all three to unset the repository.',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const [owner, name, baseBranch] = trimmed;
|
|
56
|
-
return {
|
|
57
|
-
changes: {
|
|
58
|
-
gitRepositoryOwner: owner || null,
|
|
59
|
-
gitRepositoryName: name || null,
|
|
60
|
-
gitBaseBranch: baseBranch || null,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function updateEnvironment(
|
|
66
|
-
controlPlane: string,
|
|
67
|
-
environmentName: string,
|
|
68
|
-
properties: UpdateEnvironmentProperties,
|
|
69
|
-
debug?: boolean,
|
|
70
|
-
skipConfirmation?: boolean,
|
|
71
|
-
) {
|
|
72
|
-
const clientConfig = new ClientConfiguration();
|
|
73
|
-
if (!clientConfig.doesConfigExists()) {
|
|
74
|
-
logger.error("Please, make sure that you are logged in");
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!environmentName) {
|
|
79
|
-
logger.error("Please provide an environment name");
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const organizationName = clientConfig.getOrganization();
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
properties.replicationCount !== undefined &&
|
|
87
|
-
properties.replicationCount < 1
|
|
88
|
-
) {
|
|
89
|
-
logger.error("Replication count must be at least 1");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
properties.gitModeling !== undefined &&
|
|
95
|
-
properties.gitModeling !== "true" &&
|
|
96
|
-
properties.gitModeling !== "false"
|
|
97
|
-
) {
|
|
98
|
-
logger.error("--git-modeling must be true or false");
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const repositoryRecord = gitRepositoryRecord(properties);
|
|
103
|
-
if ("error" in repositoryRecord) {
|
|
104
|
-
logger.error(repositoryRecord.error);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
if (!skipConfirmation) {
|
|
110
|
-
const confirmation = await getConfirmation(
|
|
111
|
-
`Are you sure you want to update environment ${environmentName}?`,
|
|
112
|
-
);
|
|
113
|
-
if (!confirmation) {
|
|
114
|
-
logger.info("Operation cancelled.");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const environmentUpdate: Environment = { ...repositoryRecord.changes };
|
|
120
|
-
|
|
121
|
-
if (properties.replicationCount !== undefined) {
|
|
122
|
-
environmentUpdate.replicationCount = properties.replicationCount;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (properties.gitModeling !== undefined) {
|
|
126
|
-
environmentUpdate.gitModelingEnabled =
|
|
127
|
-
properties.gitModeling === "true";
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const response = await environmentsApi.updateEnvironment(
|
|
131
|
-
organizationName,
|
|
132
|
-
environmentName,
|
|
133
|
-
environmentUpdate,
|
|
134
|
-
{
|
|
135
|
-
baseURL: controlPlane,
|
|
136
|
-
headers: clientConfig.getHeaders(),
|
|
137
|
-
},
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
if (response.status === 200) {
|
|
141
|
-
logger.info(`Successfully updated environment ${environmentName}`);
|
|
142
|
-
if (properties.replicationCount !== undefined) {
|
|
143
|
-
logger.info(
|
|
144
|
-
`Replication count set to ${properties.replicationCount}`,
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
if (properties.gitModeling !== undefined) {
|
|
148
|
-
logger.info(
|
|
149
|
-
`Git-backed modeling ${properties.gitModeling === "true" ? "enabled" : "disabled"}`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
if (environmentUpdate.gitRepositoryOwner !== undefined) {
|
|
153
|
-
logger.info(
|
|
154
|
-
environmentUpdate.gitRepositoryOwner
|
|
155
|
-
? `Repository set to ${environmentUpdate.gitRepositoryOwner}/${environmentUpdate.gitRepositoryName} (${environmentUpdate.gitBaseBranch})`
|
|
156
|
-
: "Repository unset",
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
} else {
|
|
160
|
-
logger.error(
|
|
161
|
-
`Failed to update environment. Status: ${response.status}`,
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
} catch (e) {
|
|
165
|
-
logger.error(`Failed to update environment ${environmentName}`);
|
|
166
|
-
printOutError(e, debug);
|
|
167
|
-
}
|
|
168
|
-
}
|
package/src/commands/get.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { Command } from "commander";
|
|
3
|
-
import { controlPlanesByEnv, Environment } from "../constants";
|
|
4
|
-
import { getGroup } from "./group/getgroup";
|
|
5
|
-
import { getEnvironment } from "./environment/getenvironment";
|
|
6
|
-
import { getMaterialization } from "./materialization/getmaterialization";
|
|
7
|
-
import { getIndex } from "./materialization/getindex";
|
|
8
|
-
import { getPreaggregate } from "./materialization/getpreaggregate";
|
|
9
|
-
import { getRun } from "./materialization/getrun";
|
|
10
|
-
import { warnProjectDeprecated } from "./legacy";
|
|
11
|
-
import { getPermission } from "./permission/getpermission";
|
|
12
|
-
|
|
13
|
-
export const registerGetCommands = (cli: Command, environment: Environment) => {
|
|
14
|
-
const get = cli
|
|
15
|
-
.command("get")
|
|
16
|
-
.description("Get a resource")
|
|
17
|
-
.argument(
|
|
18
|
-
"<resource>",
|
|
19
|
-
"The resource to get (environment | group | permission | materialization | index | preaggregate | run)",
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const getEnvironmentAction = (environmentName: string, options: any) => {
|
|
23
|
-
getEnvironment(
|
|
24
|
-
controlPlanesByEnv[environment],
|
|
25
|
-
environmentName,
|
|
26
|
-
options.debug,
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
get.command("environment")
|
|
31
|
-
.description("Get an environment by name.")
|
|
32
|
-
.argument("<environmentName>", "The name of the environment to get.")
|
|
33
|
-
.option("--debug")
|
|
34
|
-
.action(getEnvironmentAction);
|
|
35
|
-
|
|
36
|
-
get.command("project")
|
|
37
|
-
.description("[deprecated] Alias for 'get environment'.")
|
|
38
|
-
.argument("<projectName>", "The name of the environment to get.")
|
|
39
|
-
.option("--debug")
|
|
40
|
-
.action((projectName, options) => {
|
|
41
|
-
warnProjectDeprecated("get environment");
|
|
42
|
-
getEnvironmentAction(projectName, options);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
get.command("group")
|
|
46
|
-
.description("Get a group by name.")
|
|
47
|
-
.argument("<groupName>", "The name of the group to get.")
|
|
48
|
-
.option("--debug")
|
|
49
|
-
.action((groupName, options) => {
|
|
50
|
-
getGroup(controlPlanesByEnv[environment], groupName, options.debug);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
get.command("permission")
|
|
54
|
-
.description(
|
|
55
|
-
"Get a user or group's permission on the organization, an environment, or a package.",
|
|
56
|
-
)
|
|
57
|
-
.argument(
|
|
58
|
-
"<userGroupId>",
|
|
59
|
-
"Whose permission to get [user:{email}|group:{groupName}|user:*]",
|
|
60
|
-
)
|
|
61
|
-
.option(
|
|
62
|
-
"--environment <environmentName>",
|
|
63
|
-
"Get the permission on this environment instead of the organization.",
|
|
64
|
-
)
|
|
65
|
-
.option(
|
|
66
|
-
"--package <packageName>",
|
|
67
|
-
"Get the permission on this package. Uses --environment, or the current environment.",
|
|
68
|
-
)
|
|
69
|
-
.option("--debug")
|
|
70
|
-
.action((userGroupId, options) => {
|
|
71
|
-
getPermission(
|
|
72
|
-
controlPlanesByEnv[environment],
|
|
73
|
-
userGroupId,
|
|
74
|
-
options.debug || false,
|
|
75
|
-
{ environment: options.environment, package: options.package },
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
get.command("materialization")
|
|
80
|
-
.alias("mat")
|
|
81
|
-
.description(
|
|
82
|
-
"Get a materialization anchor by id (status, physical table + connection, serving build, freshness, staleness).",
|
|
83
|
-
)
|
|
84
|
-
.argument("<packageName>", "The package that owns the materialization.")
|
|
85
|
-
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
86
|
-
.argument("<materializationId>", "The materialization id.")
|
|
87
|
-
.option("--debug")
|
|
88
|
-
.action((packageName, versionId, materializationId, options) => {
|
|
89
|
-
getMaterialization(
|
|
90
|
-
controlPlanesByEnv[environment],
|
|
91
|
-
packageName,
|
|
92
|
-
versionId,
|
|
93
|
-
materializationId,
|
|
94
|
-
options.debug,
|
|
95
|
-
);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
get.command("index")
|
|
99
|
-
.description(
|
|
100
|
-
"Get a dimensional index anchor by id (status, row count, lastIndexedAt, freshness, staleness).",
|
|
101
|
-
)
|
|
102
|
-
.argument("<packageName>", "The package that owns the index.")
|
|
103
|
-
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
104
|
-
.argument("<indexId>", "The index (binding) id.")
|
|
105
|
-
.option("--debug")
|
|
106
|
-
.action((packageName, versionId, indexId, options) => {
|
|
107
|
-
getIndex(
|
|
108
|
-
controlPlanesByEnv[environment],
|
|
109
|
-
packageName,
|
|
110
|
-
versionId,
|
|
111
|
-
indexId,
|
|
112
|
-
options.debug,
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
get.command("preaggregate")
|
|
117
|
-
.alias("preagg")
|
|
118
|
-
.description(
|
|
119
|
-
"Get a pre-aggregated measure by id (status, grain, row count, lastBuiltAt, freshness, staleness).",
|
|
120
|
-
)
|
|
121
|
-
.argument("<packageName>", "The package that owns the pre-aggregation.")
|
|
122
|
-
.argument("<versionId>", "The version that binds it (e.g. 0.1.21).")
|
|
123
|
-
.argument(
|
|
124
|
-
"<preaggregateId>",
|
|
125
|
-
"The pre-aggregation id, as printed by `cred ls preaggregate`. It addresses a measure within a rollup — do not construct one by hand.",
|
|
126
|
-
)
|
|
127
|
-
.option("--debug")
|
|
128
|
-
.action((packageName, versionId, preaggregateId, options) => {
|
|
129
|
-
getPreaggregate(
|
|
130
|
-
controlPlanesByEnv[environment],
|
|
131
|
-
packageName,
|
|
132
|
-
versionId,
|
|
133
|
-
preaggregateId,
|
|
134
|
-
options.debug,
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
get.command("run")
|
|
139
|
-
.description(
|
|
140
|
-
"Get a run by id, including its build-plan graph (per-unit state, physical table names, row counts).",
|
|
141
|
-
)
|
|
142
|
-
.argument("<packageName>", "The package that owns the run.")
|
|
143
|
-
.argument("<runId>", "The run id.")
|
|
144
|
-
.option("--debug")
|
|
145
|
-
.action((packageName, runId, options) => {
|
|
146
|
-
getRun(
|
|
147
|
-
controlPlanesByEnv[environment],
|
|
148
|
-
packageName,
|
|
149
|
-
runId,
|
|
150
|
-
options.debug,
|
|
151
|
-
);
|
|
152
|
-
});
|
|
153
|
-
};
|