@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,371 +0,0 @@
|
|
|
1
|
-
import { spawn } from "child_process";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import { expect } from "chai";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
import os from "os";
|
|
6
|
-
import { join, resolve } from "path";
|
|
7
|
-
import sinon from "sinon";
|
|
8
|
-
import * as credConstants from "../../constants";
|
|
9
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
10
|
-
import { isLoginInvocation, login } from "./login";
|
|
11
|
-
import { OrganizationsApi } from "../../client/api";
|
|
12
|
-
import * as loopbackOAuth from "./loopbackOAuth";
|
|
13
|
-
|
|
14
|
-
function createFakeIdToken(payload: Record<string, unknown>): string {
|
|
15
|
-
const header = Buffer.from(
|
|
16
|
-
JSON.stringify({ alg: "none", typ: "JWT" }),
|
|
17
|
-
).toString("base64url");
|
|
18
|
-
const body = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
19
|
-
return `${header}.${body}.`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
describe("login", () => {
|
|
23
|
-
let tmpConfigDir: string;
|
|
24
|
-
let tmpConfigFilePath: string;
|
|
25
|
-
let axiosStub: sinon.SinonStub;
|
|
26
|
-
let orgPermissionsStub: sinon.SinonStub;
|
|
27
|
-
|
|
28
|
-
const mockDeviceCodeResponse = {
|
|
29
|
-
data: {
|
|
30
|
-
verification_uri_complete: "https://example.com",
|
|
31
|
-
user_code: "123456",
|
|
32
|
-
device_code: "device-code-123",
|
|
33
|
-
interval: 1,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const fakeJwtPayload = {
|
|
38
|
-
name: "Test User",
|
|
39
|
-
email: "test@example.com",
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const mockedAccessTokenResponse = {
|
|
43
|
-
data: {
|
|
44
|
-
id_token: createFakeIdToken(fakeJwtPayload),
|
|
45
|
-
access_token: "mock-access-token",
|
|
46
|
-
refresh_token: "mock-refresh-token",
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const mockOrgPermissionsResponse = {
|
|
51
|
-
status: 200,
|
|
52
|
-
data: {},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
beforeEach(() => {
|
|
56
|
-
// mkdtempSync atomically creates a private (mode 0700) directory
|
|
57
|
-
// with an unguessable suffix, sidestepping the symlink / clobber
|
|
58
|
-
// class that CodeQL flags as js/insecure-temporary-file when a
|
|
59
|
-
// fixed name is reused inside the shared OS tmpdir.
|
|
60
|
-
tmpConfigDir = fs.mkdtempSync(join(os.tmpdir(), "cred-login-spec-"));
|
|
61
|
-
tmpConfigFilePath = join(tmpConfigDir, "cred.json");
|
|
62
|
-
// Seed with a valid ConfigFile. loadConfig now throws on malformed
|
|
63
|
-
// input rather than silently resetting, so an empty `{}` is no longer
|
|
64
|
-
// an acceptable starting state.
|
|
65
|
-
fs.writeFileSync(
|
|
66
|
-
tmpConfigFilePath,
|
|
67
|
-
JSON.stringify({
|
|
68
|
-
configPerEnvironment: {
|
|
69
|
-
production: {},
|
|
70
|
-
staging: {},
|
|
71
|
-
localhost: {},
|
|
72
|
-
},
|
|
73
|
-
activeEnvironment: "production",
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
76
|
-
axiosStub = sinon.stub(axios, "request");
|
|
77
|
-
orgPermissionsStub = sinon
|
|
78
|
-
.stub(OrganizationsApi.prototype, "getOrganization")
|
|
79
|
-
.resolves(mockOrgPermissionsResponse as any);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
afterEach(() => {
|
|
83
|
-
fs.rmSync(tmpConfigDir, { recursive: true, force: true });
|
|
84
|
-
sinon.restore();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("should not delete config properties on login", async function () {
|
|
88
|
-
this.timeout(2000);
|
|
89
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
90
|
-
config.setEnvironment("localhost");
|
|
91
|
-
config.setOrganization("foo");
|
|
92
|
-
config.setProject("bar");
|
|
93
|
-
axiosStub
|
|
94
|
-
.onFirstCall()
|
|
95
|
-
.resolves(mockDeviceCodeResponse)
|
|
96
|
-
.onSecondCall()
|
|
97
|
-
.resolves(mockedAccessTokenResponse);
|
|
98
|
-
await login("foo", "http://localhost", tmpConfigFilePath);
|
|
99
|
-
expect(config.getOrganization()).to.equal("foo");
|
|
100
|
-
expect(config.getProject()).to.equal("bar");
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("should change the active organization when login succeeds", async function () {
|
|
104
|
-
this.timeout(2000);
|
|
105
|
-
axiosStub
|
|
106
|
-
.onFirstCall()
|
|
107
|
-
.resolves(mockDeviceCodeResponse)
|
|
108
|
-
.onSecondCall()
|
|
109
|
-
.resolves(mockedAccessTokenResponse);
|
|
110
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
111
|
-
config.setEnvironment("localhost");
|
|
112
|
-
config.setOrganization("foo");
|
|
113
|
-
config.setProject("bar");
|
|
114
|
-
await login("test", "http://localhost", tmpConfigFilePath);
|
|
115
|
-
expect(config.getOrganization()).to.equal("test");
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("should set an access token when login succeeds", async function () {
|
|
119
|
-
this.timeout(2000);
|
|
120
|
-
axiosStub
|
|
121
|
-
.onFirstCall()
|
|
122
|
-
.resolves(mockDeviceCodeResponse)
|
|
123
|
-
.onSecondCall()
|
|
124
|
-
.resolves(mockedAccessTokenResponse);
|
|
125
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
126
|
-
config.setEnvironment("localhost");
|
|
127
|
-
await login("test", "http://localhost", tmpConfigFilePath);
|
|
128
|
-
expect(config.getAccessToken()).to.equal(
|
|
129
|
-
mockedAccessTokenResponse.data.access_token,
|
|
130
|
-
);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("should unset the project field when switching organizations", async function () {
|
|
134
|
-
this.timeout(2000);
|
|
135
|
-
axiosStub
|
|
136
|
-
.onFirstCall()
|
|
137
|
-
.resolves(mockDeviceCodeResponse)
|
|
138
|
-
.onSecondCall()
|
|
139
|
-
.resolves(mockedAccessTokenResponse);
|
|
140
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
141
|
-
config.setEnvironment("localhost");
|
|
142
|
-
config.setOrganization("foo");
|
|
143
|
-
config.setProject("bar");
|
|
144
|
-
await login("not-foo", "http://localhost", tmpConfigFilePath);
|
|
145
|
-
expect(config.getProject()).to.equal(undefined);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("should not unset the project field when logging in with the same organization", async function () {
|
|
149
|
-
this.timeout(2000);
|
|
150
|
-
axiosStub
|
|
151
|
-
.onFirstCall()
|
|
152
|
-
.resolves(mockDeviceCodeResponse)
|
|
153
|
-
.onSecondCall()
|
|
154
|
-
.resolves(mockedAccessTokenResponse);
|
|
155
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
156
|
-
config.setEnvironment("localhost");
|
|
157
|
-
config.setOrganization("foo");
|
|
158
|
-
config.setProject("bar");
|
|
159
|
-
await login("foo", "http://localhost", tmpConfigFilePath);
|
|
160
|
-
expect(config.getProject()).to.equal("bar");
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("uses auth-code + PKCE with organization in authorize URL for mapped CLI orgs", async function () {
|
|
164
|
-
this.timeout(2000);
|
|
165
|
-
const orgIdStub = sinon
|
|
166
|
-
.stub(credConstants, "getAuth0OrganizationIdForCliLogin")
|
|
167
|
-
.returns("org_nMRKafeSuxOiuJeG");
|
|
168
|
-
const loopbackStub = sinon
|
|
169
|
-
.stub(loopbackOAuth, "authorizationCodeViaLoopback")
|
|
170
|
-
.callsFake(async (opts) => {
|
|
171
|
-
opts.onListening?.();
|
|
172
|
-
return { code: "test-pkce-auth-code" };
|
|
173
|
-
});
|
|
174
|
-
axiosStub.onFirstCall().resolves(mockedAccessTokenResponse);
|
|
175
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
176
|
-
config.setEnvironment("videoamp");
|
|
177
|
-
await login(
|
|
178
|
-
"videoamp",
|
|
179
|
-
"https://admin.videoamp-aws-us-east-1.credibledata.com/api/v0",
|
|
180
|
-
tmpConfigFilePath,
|
|
181
|
-
);
|
|
182
|
-
expect(orgIdStub.calledOnceWithExactly("videoamp", undefined)).to.be.true;
|
|
183
|
-
expect(loopbackStub.calledOnce).to.be.true;
|
|
184
|
-
const call = loopbackStub.getCall(0);
|
|
185
|
-
expect(call.args[0].authorizeUrl).to.contain(
|
|
186
|
-
"organization=org_nMRKafeSuxOiuJeG",
|
|
187
|
-
);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it("uses mapped org id for PKCE flow regardless of org name casing", async function () {
|
|
191
|
-
this.timeout(2000);
|
|
192
|
-
const orgIdStub = sinon
|
|
193
|
-
.stub(credConstants, "getAuth0OrganizationIdForCliLogin")
|
|
194
|
-
.callsFake((name: string) =>
|
|
195
|
-
name.toLowerCase() === "videoamp"
|
|
196
|
-
? "org_nMRKafeSuxOiuJeG"
|
|
197
|
-
: undefined,
|
|
198
|
-
);
|
|
199
|
-
const loopbackStub = sinon
|
|
200
|
-
.stub(loopbackOAuth, "authorizationCodeViaLoopback")
|
|
201
|
-
.callsFake(async (opts) => {
|
|
202
|
-
opts.onListening?.();
|
|
203
|
-
return { code: "test-pkce-auth-code" };
|
|
204
|
-
});
|
|
205
|
-
axiosStub.onFirstCall().resolves(mockedAccessTokenResponse);
|
|
206
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
207
|
-
config.setEnvironment("videoamp");
|
|
208
|
-
await login(
|
|
209
|
-
"VideoAmp",
|
|
210
|
-
"https://admin.videoamp-aws-us-east-1.credibledata.com/api/v0",
|
|
211
|
-
tmpConfigFilePath,
|
|
212
|
-
);
|
|
213
|
-
expect(orgIdStub.calledOnceWithExactly("VideoAmp", undefined)).to.be.true;
|
|
214
|
-
expect(loopbackStub.getCall(0).args[0].authorizeUrl).to.contain(
|
|
215
|
-
"organization=org_nMRKafeSuxOiuJeG",
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it("forwards the cluster arg to getAuth0OrganizationIdForCliLogin (so -c aws triggers PKCE)", async function () {
|
|
220
|
-
this.timeout(2000);
|
|
221
|
-
const orgIdStub = sinon
|
|
222
|
-
.stub(credConstants, "getAuth0OrganizationIdForCliLogin")
|
|
223
|
-
.returns("org_nMRKafeSuxOiuJeG");
|
|
224
|
-
sinon
|
|
225
|
-
.stub(loopbackOAuth, "authorizationCodeViaLoopback")
|
|
226
|
-
.callsFake(async (opts) => {
|
|
227
|
-
opts.onListening?.();
|
|
228
|
-
return { code: "test-pkce-auth-code" };
|
|
229
|
-
});
|
|
230
|
-
axiosStub.onFirstCall().resolves(mockedAccessTokenResponse);
|
|
231
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
232
|
-
config.setEnvironment("videoamp");
|
|
233
|
-
await login(
|
|
234
|
-
"videoamp",
|
|
235
|
-
"https://admin.videoamp-aws-us-east-1.credibledata.com/api/v0",
|
|
236
|
-
tmpConfigFilePath,
|
|
237
|
-
"aws",
|
|
238
|
-
);
|
|
239
|
-
expect(orgIdStub.calledOnceWithExactly("videoamp", "aws")).to.be.true;
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it("should not pass Auth0 organization for unmapped org names", async function () {
|
|
243
|
-
this.timeout(2000);
|
|
244
|
-
axiosStub
|
|
245
|
-
.onFirstCall()
|
|
246
|
-
.resolves(mockDeviceCodeResponse)
|
|
247
|
-
.onSecondCall()
|
|
248
|
-
.resolves(mockedAccessTokenResponse);
|
|
249
|
-
const config = new ClientConfiguration(tmpConfigFilePath);
|
|
250
|
-
config.setEnvironment("localhost");
|
|
251
|
-
await login("test", "http://localhost", tmpConfigFilePath);
|
|
252
|
-
expect(axiosStub.getCall(0).args[0].data).to.not.have.property(
|
|
253
|
-
"organization",
|
|
254
|
-
);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
describe("isLoginInvocation", () => {
|
|
259
|
-
it("is true for a `cred login <org>` invocation", () => {
|
|
260
|
-
expect(isLoginInvocation(["node", "/x/index.js", "login", "myorg"])).to.be
|
|
261
|
-
.true;
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it("is false for other commands (they stay fail-loud on a corrupt config)", () => {
|
|
265
|
-
expect(isLoginInvocation(["node", "/x/index.js", "status"])).to.be.false;
|
|
266
|
-
expect(isLoginInvocation(["node", "/x/index.js", "publish"])).to.be.false;
|
|
267
|
-
expect(isLoginInvocation(["node", "/x/index.js"])).to.be.false;
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// Drives the real binary entrypoint (src/index.ts), not recoverIfCorrupt() in
|
|
272
|
-
// isolation. index.ts reads the active environment at module load (axios
|
|
273
|
-
// baseURL + command registration), so a corrupt ~/.cred used to throw before
|
|
274
|
-
// the login action ran — dead-ending the documented recovery path. This guards
|
|
275
|
-
// that ordering: with HOME pointed at a fixture dir holding a corrupt config,
|
|
276
|
-
// `index.ts login <org>` must reset the file rather than crash with the
|
|
277
|
-
// structure error.
|
|
278
|
-
describe("entrypoint recovery for a corrupt ~/.cred (real index.ts)", () => {
|
|
279
|
-
let tmpHome: string;
|
|
280
|
-
const indexPath = resolve(__dirname, "../../index.ts");
|
|
281
|
-
const cliRoot = resolve(__dirname, "../../..");
|
|
282
|
-
|
|
283
|
-
beforeEach(() => {
|
|
284
|
-
tmpHome = fs.mkdtempSync(join(os.tmpdir(), "cred-entrypoint-"));
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
afterEach(() => {
|
|
288
|
-
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
const findBackup = (): string | undefined =>
|
|
292
|
-
fs.readdirSync(tmpHome).find((f) => f.startsWith(".cred.corrupt-"));
|
|
293
|
-
|
|
294
|
-
it("backs up the corrupt file and resets instead of crashing", async function () {
|
|
295
|
-
this.timeout(60000);
|
|
296
|
-
|
|
297
|
-
// A structurally-invalid config: parses as JSON but has neither
|
|
298
|
-
// activeEnvironment nor configPerEnvironment — exactly what triggered the
|
|
299
|
-
// customer's "re-run cred login" loop.
|
|
300
|
-
const credPath = join(tmpHome, ".cred");
|
|
301
|
-
fs.writeFileSync(credPath, JSON.stringify({ garbage: true }));
|
|
302
|
-
|
|
303
|
-
const child = spawn(
|
|
304
|
-
process.execPath,
|
|
305
|
-
["-r", "ts-node/register", indexPath, "login", "testorg"],
|
|
306
|
-
{
|
|
307
|
-
cwd: cliRoot,
|
|
308
|
-
env: {
|
|
309
|
-
...process.env,
|
|
310
|
-
HOME: tmpHome,
|
|
311
|
-
USERPROFILE: tmpHome,
|
|
312
|
-
// Runtime behavior is what we're testing; skip type-checking the
|
|
313
|
-
// whole import graph so an unrelated type error can't derail it.
|
|
314
|
-
TS_NODE_TRANSPILE_ONLY: "1",
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
);
|
|
318
|
-
|
|
319
|
-
let output = "";
|
|
320
|
-
child.stdout.on("data", (d) => (output += d.toString()));
|
|
321
|
-
child.stderr.on("data", (d) => (output += d.toString()));
|
|
322
|
-
|
|
323
|
-
// Recovery runs synchronously at module load, before login() touches the
|
|
324
|
-
// network. It renames the corrupt file aside (.cred.corrupt-*) and THEN
|
|
325
|
-
// rewrites .cred to a valid default. Gate on the rewrite, not the backup:
|
|
326
|
-
// the backup appears first, so killing the instant it shows can catch the
|
|
327
|
-
// child in the gap before .cred is rewritten — a flaky ENOENT on the read
|
|
328
|
-
// below. resetComplete() only goes true once .cred is the valid default
|
|
329
|
-
// (which implies the backup already happened). Then stop the process
|
|
330
|
-
// (login otherwise blocks on the device-code flow).
|
|
331
|
-
const resetComplete = (): boolean => {
|
|
332
|
-
try {
|
|
333
|
-
return (
|
|
334
|
-
JSON.parse(fs.readFileSync(credPath, "utf8"))
|
|
335
|
-
.activeEnvironment === "production"
|
|
336
|
-
);
|
|
337
|
-
} catch {
|
|
338
|
-
return false; // .cred absent or mid-rewrite
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
await new Promise<void>((resolveWait) => {
|
|
342
|
-
const deadline = Date.now() + 55000;
|
|
343
|
-
const timer = setInterval(() => {
|
|
344
|
-
if (resetComplete() || Date.now() > deadline) {
|
|
345
|
-
clearInterval(timer);
|
|
346
|
-
resolveWait();
|
|
347
|
-
}
|
|
348
|
-
}, 200);
|
|
349
|
-
child.on("exit", () => {
|
|
350
|
-
clearInterval(timer);
|
|
351
|
-
resolveWait();
|
|
352
|
-
});
|
|
353
|
-
});
|
|
354
|
-
child.kill("SIGKILL");
|
|
355
|
-
|
|
356
|
-
const backup = findBackup();
|
|
357
|
-
expect(backup, "corrupt config should be backed up aside").to.be.a(
|
|
358
|
-
"string",
|
|
359
|
-
);
|
|
360
|
-
// The bad contents are preserved in the backup, not destroyed.
|
|
361
|
-
expect(
|
|
362
|
-
JSON.parse(fs.readFileSync(join(tmpHome, backup!), "utf8")),
|
|
363
|
-
).to.deep.equal({ garbage: true });
|
|
364
|
-
// ~/.cred is rewritten to a valid default the next read can load.
|
|
365
|
-
const reset = JSON.parse(fs.readFileSync(credPath, "utf8"));
|
|
366
|
-
expect(reset.activeEnvironment).to.equal("production");
|
|
367
|
-
expect(reset.configPerEnvironment).to.be.an("object");
|
|
368
|
-
// The startup read no longer dead-ends on the structure error.
|
|
369
|
-
expect(output).to.not.match(/Invalid config structure/);
|
|
370
|
-
});
|
|
371
|
-
});
|