@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,413 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import sinon from "sinon";
|
|
4
|
-
import { ConnectionsApi } from "../../client/api";
|
|
5
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
6
|
-
import { logger } from "../../logger";
|
|
7
|
-
import { getConfirmation } from "../../utils";
|
|
8
|
-
import { createConnections } from "./createconnections";
|
|
9
|
-
|
|
10
|
-
describe("create-connections", () => {
|
|
11
|
-
let sandbox: sinon.SinonSandbox;
|
|
12
|
-
let createConnectionStub: sinon.SinonStub;
|
|
13
|
-
let loggerStub: sinon.SinonStubbedInstance<typeof logger>;
|
|
14
|
-
let getConfirmationStub: sinon.SinonStub;
|
|
15
|
-
let readFileSyncStub: sinon.SinonStub;
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
sandbox = sinon.createSandbox();
|
|
19
|
-
createConnectionStub = sandbox.stub();
|
|
20
|
-
loggerStub = sandbox.stub(logger);
|
|
21
|
-
getConfirmationStub = sandbox.stub();
|
|
22
|
-
readFileSyncStub = sandbox.stub(fs, "readFileSync");
|
|
23
|
-
|
|
24
|
-
sandbox
|
|
25
|
-
.stub(ClientConfiguration.prototype, "getOrganization")
|
|
26
|
-
.returns("test-org");
|
|
27
|
-
sandbox
|
|
28
|
-
.stub(ClientConfiguration.prototype, "getProject")
|
|
29
|
-
.returns("test-project");
|
|
30
|
-
sandbox
|
|
31
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
32
|
-
.returns(true);
|
|
33
|
-
sandbox
|
|
34
|
-
.stub(ClientConfiguration.prototype, "getHeaders")
|
|
35
|
-
.returns({ Authorization: "Bearer test-token" });
|
|
36
|
-
|
|
37
|
-
sandbox
|
|
38
|
-
.stub(ConnectionsApi.prototype, "createConnection")
|
|
39
|
-
.callsFake(createConnectionStub);
|
|
40
|
-
sandbox
|
|
41
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
42
|
-
.callsFake(getConfirmationStub);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
afterEach(() => {
|
|
46
|
-
sandbox.restore();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("should create connection successfully", async () => {
|
|
50
|
-
const mockConnections = [
|
|
51
|
-
{
|
|
52
|
-
name: "test_connection",
|
|
53
|
-
type: "postgres",
|
|
54
|
-
host: "localhost",
|
|
55
|
-
port: 5432,
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
59
|
-
getConfirmationStub.resolves(true);
|
|
60
|
-
createConnectionStub.resolves({ data: {} });
|
|
61
|
-
|
|
62
|
-
await createConnections(
|
|
63
|
-
"http://test-server",
|
|
64
|
-
"/path/to/connections.json",
|
|
65
|
-
null,
|
|
66
|
-
null,
|
|
67
|
-
false,
|
|
68
|
-
false,
|
|
69
|
-
true,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
expect(readFileSyncStub.calledWith("/path/to/connections.json", "utf8"))
|
|
73
|
-
.to.be.true;
|
|
74
|
-
expect(createConnectionStub.calledOnce).to.be.true;
|
|
75
|
-
expect(createConnectionStub.firstCall.args[0]).to.equal("test-org");
|
|
76
|
-
expect(createConnectionStub.firstCall.args[1]).to.equal("test-project");
|
|
77
|
-
expect(createConnectionStub.firstCall.args[2]).to.deep.include({
|
|
78
|
-
name: "test_connection",
|
|
79
|
-
});
|
|
80
|
-
expect(
|
|
81
|
-
loggerStub.info.calledWith(
|
|
82
|
-
sinon.match("Connection test_connection created successfully"),
|
|
83
|
-
),
|
|
84
|
-
).to.be.true;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("should create multiple connections", async () => {
|
|
88
|
-
const mockConnections = [
|
|
89
|
-
{ name: "conn1", type: "postgres" },
|
|
90
|
-
{ name: "conn2", type: "mysql" },
|
|
91
|
-
];
|
|
92
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
93
|
-
getConfirmationStub.resolves(true);
|
|
94
|
-
createConnectionStub.resolves({ data: {} });
|
|
95
|
-
|
|
96
|
-
await createConnections(
|
|
97
|
-
"http://test-server",
|
|
98
|
-
"/path/to/connections.json",
|
|
99
|
-
null,
|
|
100
|
-
null,
|
|
101
|
-
false,
|
|
102
|
-
false,
|
|
103
|
-
true,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
expect(createConnectionStub.calledTwice).to.be.true;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("should handle includeTables", async () => {
|
|
110
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
111
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
112
|
-
getConfirmationStub.resolves(true);
|
|
113
|
-
createConnectionStub.resolves({ data: {} });
|
|
114
|
-
|
|
115
|
-
await createConnections(
|
|
116
|
-
"http://test-server",
|
|
117
|
-
"/path/to/connections.json",
|
|
118
|
-
"table1, table2",
|
|
119
|
-
null,
|
|
120
|
-
false,
|
|
121
|
-
false,
|
|
122
|
-
true,
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
expect(createConnectionStub.firstCall.args[2]).to.deep.include({
|
|
126
|
-
includeTables: ["table1", "table2"],
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("should handle excludeTables", async () => {
|
|
131
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
132
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
133
|
-
getConfirmationStub.resolves(true);
|
|
134
|
-
createConnectionStub.resolves({ data: {} });
|
|
135
|
-
|
|
136
|
-
await createConnections(
|
|
137
|
-
"http://test-server",
|
|
138
|
-
"/path/to/connections.json",
|
|
139
|
-
null,
|
|
140
|
-
"table1, table2",
|
|
141
|
-
false,
|
|
142
|
-
false,
|
|
143
|
-
true,
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
expect(createConnectionStub.firstCall.args[2]).to.deep.include({
|
|
147
|
-
excludeTables: ["table1", "table2"],
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("should handle skipIndexing", async () => {
|
|
152
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
153
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
154
|
-
getConfirmationStub.resolves(true);
|
|
155
|
-
createConnectionStub.resolves({ data: {} });
|
|
156
|
-
|
|
157
|
-
await createConnections(
|
|
158
|
-
"http://test-server",
|
|
159
|
-
"/path/to/connections.json",
|
|
160
|
-
null,
|
|
161
|
-
null,
|
|
162
|
-
true,
|
|
163
|
-
false,
|
|
164
|
-
true,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
expect(createConnectionStub.firstCall.args[2]).to.deep.include({
|
|
168
|
-
excludeAllTables: true,
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it("should reject includeTables and excludeTables together", async () => {
|
|
173
|
-
await createConnections(
|
|
174
|
-
"http://test-server",
|
|
175
|
-
"/path/to/connections.json",
|
|
176
|
-
"table1",
|
|
177
|
-
"table2",
|
|
178
|
-
false,
|
|
179
|
-
false,
|
|
180
|
-
true,
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
expect(createConnectionStub.called).to.be.false;
|
|
184
|
-
expect(
|
|
185
|
-
loggerStub.error.calledWith(
|
|
186
|
-
sinon.match(
|
|
187
|
-
"includeTables and excludeTables cannot be set at the same time",
|
|
188
|
-
),
|
|
189
|
-
),
|
|
190
|
-
).to.be.true;
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("should reject skipIndexing with includeTables", async () => {
|
|
194
|
-
await createConnections(
|
|
195
|
-
"http://test-server",
|
|
196
|
-
"/path/to/connections.json",
|
|
197
|
-
"table1",
|
|
198
|
-
null,
|
|
199
|
-
true,
|
|
200
|
-
false,
|
|
201
|
-
true,
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
expect(createConnectionStub.called).to.be.false;
|
|
205
|
-
expect(
|
|
206
|
-
loggerStub.error.calledWith(
|
|
207
|
-
sinon.match(
|
|
208
|
-
"skipIndexing and includeTables cannot be set at the same time",
|
|
209
|
-
),
|
|
210
|
-
),
|
|
211
|
-
).to.be.true;
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it("should reject skipIndexing with excludeTables", async () => {
|
|
215
|
-
await createConnections(
|
|
216
|
-
"http://test-server",
|
|
217
|
-
"/path/to/connections.json",
|
|
218
|
-
null,
|
|
219
|
-
"table1",
|
|
220
|
-
true,
|
|
221
|
-
false,
|
|
222
|
-
true,
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
expect(createConnectionStub.called).to.be.false;
|
|
226
|
-
expect(
|
|
227
|
-
loggerStub.error.calledWith(
|
|
228
|
-
sinon.match(
|
|
229
|
-
"skipIndexing and excludeTables cannot be set at the same time",
|
|
230
|
-
),
|
|
231
|
-
),
|
|
232
|
-
).to.be.true;
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it("should reject invalid connection name", async () => {
|
|
236
|
-
const mockConnections = [
|
|
237
|
-
{ name: "123invalid", type: "postgres" },
|
|
238
|
-
{ name: "valid_connection", type: "postgres" },
|
|
239
|
-
];
|
|
240
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
241
|
-
getConfirmationStub.resolves(true);
|
|
242
|
-
createConnectionStub.resolves({ data: {} });
|
|
243
|
-
|
|
244
|
-
await createConnections(
|
|
245
|
-
"http://test-server",
|
|
246
|
-
"/path/to/connections.json",
|
|
247
|
-
null,
|
|
248
|
-
null,
|
|
249
|
-
false,
|
|
250
|
-
false,
|
|
251
|
-
true,
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
expect(
|
|
255
|
-
loggerStub.error.calledWith(
|
|
256
|
-
sinon.match(/Connection name can only contain letters/),
|
|
257
|
-
),
|
|
258
|
-
).to.be.true;
|
|
259
|
-
expect(createConnectionStub.calledOnce).to.be.true;
|
|
260
|
-
expect(createConnectionStub.firstCall.args[2].name).to.equal(
|
|
261
|
-
"valid_connection",
|
|
262
|
-
);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
it("should handle missing config", async () => {
|
|
266
|
-
sandbox.restore();
|
|
267
|
-
sandbox = sinon.createSandbox();
|
|
268
|
-
createConnectionStub = sandbox.stub();
|
|
269
|
-
loggerStub = sandbox.stub(logger);
|
|
270
|
-
getConfirmationStub = sandbox.stub();
|
|
271
|
-
readFileSyncStub = sandbox.stub(fs, "readFileSync");
|
|
272
|
-
|
|
273
|
-
// Short-circuit loadConfig — createconnections calls getOrganization
|
|
274
|
-
// before it checks doesConfigExists, so we need to stub it or loadConfig
|
|
275
|
-
// would run against the stubbed readFileSync.
|
|
276
|
-
sandbox
|
|
277
|
-
.stub(ClientConfiguration.prototype, "getOrganization")
|
|
278
|
-
.returns("");
|
|
279
|
-
sandbox.stub(ClientConfiguration.prototype, "getProject").returns("");
|
|
280
|
-
sandbox
|
|
281
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
282
|
-
.returns(false);
|
|
283
|
-
sandbox
|
|
284
|
-
.stub(ConnectionsApi.prototype, "createConnection")
|
|
285
|
-
.callsFake(createConnectionStub);
|
|
286
|
-
sandbox
|
|
287
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
288
|
-
.callsFake(getConfirmationStub);
|
|
289
|
-
|
|
290
|
-
await createConnections(
|
|
291
|
-
"http://test-server",
|
|
292
|
-
"/path/to/connections.json",
|
|
293
|
-
null,
|
|
294
|
-
null,
|
|
295
|
-
false,
|
|
296
|
-
false,
|
|
297
|
-
true,
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
expect(createConnectionStub.called).to.be.false;
|
|
301
|
-
expect(
|
|
302
|
-
loggerStub.error.calledWith(
|
|
303
|
-
sinon.match("Please, make sure that you are logged in"),
|
|
304
|
-
),
|
|
305
|
-
).to.be.true;
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
it("should handle missing project", async () => {
|
|
309
|
-
sandbox.restore();
|
|
310
|
-
sandbox = sinon.createSandbox();
|
|
311
|
-
createConnectionStub = sandbox.stub();
|
|
312
|
-
loggerStub = sandbox.stub(logger);
|
|
313
|
-
getConfirmationStub = sandbox.stub();
|
|
314
|
-
readFileSyncStub = sandbox.stub(fs, "readFileSync");
|
|
315
|
-
|
|
316
|
-
sandbox
|
|
317
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
318
|
-
.returns(true);
|
|
319
|
-
sandbox
|
|
320
|
-
.stub(ClientConfiguration.prototype, "getOrganization")
|
|
321
|
-
.returns("test-org");
|
|
322
|
-
sandbox.stub(ClientConfiguration.prototype, "getProject").returns("");
|
|
323
|
-
sandbox
|
|
324
|
-
.stub(ConnectionsApi.prototype, "createConnection")
|
|
325
|
-
.callsFake(createConnectionStub);
|
|
326
|
-
sandbox
|
|
327
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
328
|
-
.callsFake(getConfirmationStub);
|
|
329
|
-
|
|
330
|
-
await createConnections(
|
|
331
|
-
"http://test-server",
|
|
332
|
-
"/path/to/connections.json",
|
|
333
|
-
null,
|
|
334
|
-
null,
|
|
335
|
-
false,
|
|
336
|
-
false,
|
|
337
|
-
true,
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
expect(createConnectionStub.called).to.be.false;
|
|
341
|
-
expect(
|
|
342
|
-
loggerStub.error.calledWith(
|
|
343
|
-
sinon.match("Please, make sure to set an environment"),
|
|
344
|
-
),
|
|
345
|
-
).to.be.true;
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
it("should request confirmation when autoConfirm is false", async () => {
|
|
349
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
350
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
351
|
-
getConfirmationStub.resolves(true);
|
|
352
|
-
createConnectionStub.resolves({ data: {} });
|
|
353
|
-
|
|
354
|
-
await createConnections(
|
|
355
|
-
"http://test-server",
|
|
356
|
-
"/path/to/connections.json",
|
|
357
|
-
null,
|
|
358
|
-
null,
|
|
359
|
-
false,
|
|
360
|
-
false,
|
|
361
|
-
false,
|
|
362
|
-
);
|
|
363
|
-
|
|
364
|
-
expect(getConfirmationStub.calledOnce).to.be.true;
|
|
365
|
-
expect(createConnectionStub.calledOnce).to.be.true;
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it("should cancel when confirmation is denied", async () => {
|
|
369
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
370
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
371
|
-
getConfirmationStub.resolves(false);
|
|
372
|
-
|
|
373
|
-
await createConnections(
|
|
374
|
-
"http://test-server",
|
|
375
|
-
"/path/to/connections.json",
|
|
376
|
-
null,
|
|
377
|
-
null,
|
|
378
|
-
false,
|
|
379
|
-
false,
|
|
380
|
-
false,
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
expect(getConfirmationStub.calledOnce).to.be.true;
|
|
384
|
-
expect(createConnectionStub.called).to.be.false;
|
|
385
|
-
expect(loggerStub.info.calledWith(sinon.match("Operation cancelled."))).to
|
|
386
|
-
.be.true;
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
it("should handle API errors", async () => {
|
|
390
|
-
const mockConnections = [{ name: "test_conn", type: "postgres" }];
|
|
391
|
-
readFileSyncStub.returns(JSON.stringify(mockConnections));
|
|
392
|
-
getConfirmationStub.resolves(true);
|
|
393
|
-
const mockError = new Error("API Error");
|
|
394
|
-
createConnectionStub.rejects(mockError);
|
|
395
|
-
|
|
396
|
-
await createConnections(
|
|
397
|
-
"http://test-server",
|
|
398
|
-
"/path/to/connections.json",
|
|
399
|
-
null,
|
|
400
|
-
null,
|
|
401
|
-
false,
|
|
402
|
-
true,
|
|
403
|
-
true,
|
|
404
|
-
);
|
|
405
|
-
|
|
406
|
-
expect(createConnectionStub.calledOnce).to.be.true;
|
|
407
|
-
expect(
|
|
408
|
-
loggerStub.error.calledWith(
|
|
409
|
-
sinon.match("Failed to create connection test_conn"),
|
|
410
|
-
),
|
|
411
|
-
).to.be.true;
|
|
412
|
-
});
|
|
413
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import { Connection, ConnectionsApi } from "../../client/api";
|
|
3
|
-
import { Configuration } from "../../client/configuration";
|
|
4
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
5
|
-
import { logger } from "../../logger";
|
|
6
|
-
import { getConfirmation, printOutError } from "../../utils";
|
|
7
|
-
|
|
8
|
-
const connectionsApi = new ConnectionsApi(new Configuration());
|
|
9
|
-
|
|
10
|
-
export const createConnections = async (
|
|
11
|
-
controlPlane: string,
|
|
12
|
-
connectionFileName: string,
|
|
13
|
-
includeTables: string | null,
|
|
14
|
-
excludeTables: string | null,
|
|
15
|
-
skipIndexing: boolean,
|
|
16
|
-
debug: boolean,
|
|
17
|
-
autoConfirm: boolean,
|
|
18
|
-
) => {
|
|
19
|
-
const clientConfig = new ClientConfiguration();
|
|
20
|
-
const organizationName = clientConfig.getOrganization();
|
|
21
|
-
const environmentName = clientConfig.getProject();
|
|
22
|
-
|
|
23
|
-
if (!clientConfig.doesConfigExists()) {
|
|
24
|
-
logger.error("Please, make sure that you are logged in");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!environmentName) {
|
|
29
|
-
logger.error("Please, make sure to set an environment");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (includeTables && excludeTables) {
|
|
34
|
-
logger.error(
|
|
35
|
-
"includeTables and excludeTables cannot be set at the same time",
|
|
36
|
-
);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (skipIndexing && includeTables) {
|
|
41
|
-
logger.error(
|
|
42
|
-
"skipIndexing and includeTables cannot be set at the same time",
|
|
43
|
-
);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (skipIndexing && excludeTables) {
|
|
48
|
-
logger.error(
|
|
49
|
-
"skipIndexing and excludeTables cannot be set at the same time",
|
|
50
|
-
);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const connections = JSON.parse(
|
|
55
|
-
fs.readFileSync(connectionFileName, "utf8"),
|
|
56
|
-
) as Connection[];
|
|
57
|
-
|
|
58
|
-
for (const connection of connections) {
|
|
59
|
-
if (!/^[a-zA-Z_][a-zA-Z0-9_]+$/.test(connection.name)) {
|
|
60
|
-
logger.error(
|
|
61
|
-
`Connection name can only contain letters, numbers, and underscores for connection and should start with a letter or underscore: ${connection.name}`,
|
|
62
|
-
);
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (!autoConfirm) {
|
|
67
|
-
const confirmation = await getConfirmation(
|
|
68
|
-
`Are you sure you that want to create a connection named ${connection.name}?`,
|
|
69
|
-
);
|
|
70
|
-
if (!confirmation) {
|
|
71
|
-
logger.info("Operation cancelled.");
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const parsedIncludeTables = includeTables
|
|
77
|
-
? includeTables.split(",").map((s) => s.trim())
|
|
78
|
-
: undefined;
|
|
79
|
-
const parsedExcludeTables = excludeTables
|
|
80
|
-
? excludeTables.split(",").map((s) => s.trim())
|
|
81
|
-
: undefined;
|
|
82
|
-
|
|
83
|
-
if (parsedIncludeTables) {
|
|
84
|
-
connection.includeTables = parsedIncludeTables;
|
|
85
|
-
}
|
|
86
|
-
if (parsedExcludeTables) {
|
|
87
|
-
connection.excludeTables = parsedExcludeTables;
|
|
88
|
-
}
|
|
89
|
-
if (skipIndexing) {
|
|
90
|
-
connection.excludeAllTables = true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
await connectionsApi.createConnection(
|
|
94
|
-
organizationName,
|
|
95
|
-
environmentName,
|
|
96
|
-
connection,
|
|
97
|
-
false,
|
|
98
|
-
{
|
|
99
|
-
baseURL: controlPlane,
|
|
100
|
-
headers: clientConfig.getHeaders(),
|
|
101
|
-
},
|
|
102
|
-
);
|
|
103
|
-
logger.info(`Connection ${connection.name} created successfully`);
|
|
104
|
-
} catch (error) {
|
|
105
|
-
logger.error(`Failed to create connection ${connection.name}`);
|
|
106
|
-
printOutError(error, debug);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import sinon from "sinon";
|
|
3
|
-
import { ConnectionsApi } from "../../client/api";
|
|
4
|
-
import { ClientConfiguration } from "../../clientconfiguration";
|
|
5
|
-
import { logger } from "../../logger";
|
|
6
|
-
import { getConfirmation } from "../../utils";
|
|
7
|
-
import { deleteConnection } from "./deleteconnection";
|
|
8
|
-
|
|
9
|
-
describe("delete-connection", () => {
|
|
10
|
-
let sandbox: sinon.SinonSandbox;
|
|
11
|
-
let deleteConnectionStub: sinon.SinonStub;
|
|
12
|
-
let loggerStub: sinon.SinonStubbedInstance<typeof logger>;
|
|
13
|
-
let getConfirmationStub: sinon.SinonStub;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
sandbox = sinon.createSandbox();
|
|
17
|
-
deleteConnectionStub = sandbox.stub();
|
|
18
|
-
loggerStub = sandbox.stub(logger);
|
|
19
|
-
getConfirmationStub = sandbox.stub();
|
|
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(ConnectionsApi.prototype, "deleteConnection")
|
|
36
|
-
.callsFake(deleteConnectionStub);
|
|
37
|
-
sandbox
|
|
38
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
39
|
-
.callsFake(getConfirmationStub);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
afterEach(() => {
|
|
43
|
-
sandbox.restore();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("should delete connection successfully", async () => {
|
|
47
|
-
deleteConnectionStub.resolves({ status: 200 });
|
|
48
|
-
getConfirmationStub.resolves(true);
|
|
49
|
-
|
|
50
|
-
await deleteConnection(
|
|
51
|
-
"http://test-server",
|
|
52
|
-
"test-connection",
|
|
53
|
-
false,
|
|
54
|
-
true,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
expect(deleteConnectionStub.calledOnce).to.be.true;
|
|
58
|
-
expect(deleteConnectionStub.firstCall.args[0]).to.equal("test-org");
|
|
59
|
-
expect(deleteConnectionStub.firstCall.args[1]).to.equal("test-project");
|
|
60
|
-
expect(deleteConnectionStub.firstCall.args[2]).to.equal(
|
|
61
|
-
"test-connection",
|
|
62
|
-
);
|
|
63
|
-
expect(deleteConnectionStub.firstCall.args[3]).to.deep.include({
|
|
64
|
-
baseURL: "http://test-server",
|
|
65
|
-
headers: { Authorization: "Bearer test-token" },
|
|
66
|
-
});
|
|
67
|
-
expect(
|
|
68
|
-
loggerStub.info.calledWith(
|
|
69
|
-
sinon.match("Connection deleted successfully"),
|
|
70
|
-
),
|
|
71
|
-
).to.be.true;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it("should handle missing config", async () => {
|
|
75
|
-
sandbox.restore();
|
|
76
|
-
sandbox = sinon.createSandbox();
|
|
77
|
-
deleteConnectionStub = sandbox.stub();
|
|
78
|
-
loggerStub = sandbox.stub(logger);
|
|
79
|
-
getConfirmationStub = sandbox.stub();
|
|
80
|
-
|
|
81
|
-
sandbox
|
|
82
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
83
|
-
.returns(false);
|
|
84
|
-
sandbox
|
|
85
|
-
.stub(ConnectionsApi.prototype, "deleteConnection")
|
|
86
|
-
.callsFake(deleteConnectionStub);
|
|
87
|
-
sandbox
|
|
88
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
89
|
-
.callsFake(getConfirmationStub);
|
|
90
|
-
|
|
91
|
-
await deleteConnection(
|
|
92
|
-
"http://test-server",
|
|
93
|
-
"test-connection",
|
|
94
|
-
false,
|
|
95
|
-
true,
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
expect(deleteConnectionStub.called).to.be.false;
|
|
99
|
-
expect(
|
|
100
|
-
loggerStub.error.calledWith(
|
|
101
|
-
sinon.match("Please, make sure that you are logged in"),
|
|
102
|
-
),
|
|
103
|
-
).to.be.true;
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("should handle missing project", async () => {
|
|
107
|
-
sandbox.restore();
|
|
108
|
-
sandbox = sinon.createSandbox();
|
|
109
|
-
deleteConnectionStub = sandbox.stub();
|
|
110
|
-
loggerStub = sandbox.stub(logger);
|
|
111
|
-
getConfirmationStub = sandbox.stub();
|
|
112
|
-
|
|
113
|
-
sandbox
|
|
114
|
-
.stub(ClientConfiguration.prototype, "doesConfigExists")
|
|
115
|
-
.returns(true);
|
|
116
|
-
sandbox.stub(ClientConfiguration.prototype, "getProject").returns("");
|
|
117
|
-
sandbox
|
|
118
|
-
.stub(ConnectionsApi.prototype, "deleteConnection")
|
|
119
|
-
.callsFake(deleteConnectionStub);
|
|
120
|
-
sandbox
|
|
121
|
-
.stub(require("../../utils"), "getConfirmation")
|
|
122
|
-
.callsFake(getConfirmationStub);
|
|
123
|
-
|
|
124
|
-
await deleteConnection(
|
|
125
|
-
"http://test-server",
|
|
126
|
-
"test-connection",
|
|
127
|
-
false,
|
|
128
|
-
true,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
expect(deleteConnectionStub.called).to.be.false;
|
|
132
|
-
expect(
|
|
133
|
-
loggerStub.error.calledWith(
|
|
134
|
-
sinon.match("Please, make sure to set an environment"),
|
|
135
|
-
),
|
|
136
|
-
).to.be.true;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it("should request confirmation when autoConfirm is false", async () => {
|
|
140
|
-
deleteConnectionStub.resolves({ status: 200 });
|
|
141
|
-
getConfirmationStub.resolves(true);
|
|
142
|
-
|
|
143
|
-
await deleteConnection(
|
|
144
|
-
"http://test-server",
|
|
145
|
-
"test-connection",
|
|
146
|
-
false,
|
|
147
|
-
false,
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
expect(getConfirmationStub.calledOnce).to.be.true;
|
|
151
|
-
expect(deleteConnectionStub.calledOnce).to.be.true;
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("should cancel when confirmation is denied", async () => {
|
|
155
|
-
getConfirmationStub.resolves(false);
|
|
156
|
-
|
|
157
|
-
await deleteConnection(
|
|
158
|
-
"http://test-server",
|
|
159
|
-
"test-connection",
|
|
160
|
-
false,
|
|
161
|
-
false,
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
expect(getConfirmationStub.calledOnce).to.be.true;
|
|
165
|
-
expect(deleteConnectionStub.called).to.be.false;
|
|
166
|
-
expect(loggerStub.info.calledWith(sinon.match("Operation cancelled."))).to
|
|
167
|
-
.be.true;
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it("should handle API errors", async () => {
|
|
171
|
-
const mockError = new Error("API Error");
|
|
172
|
-
deleteConnectionStub.rejects(mockError);
|
|
173
|
-
getConfirmationStub.resolves(true);
|
|
174
|
-
|
|
175
|
-
await deleteConnection(
|
|
176
|
-
"http://test-server",
|
|
177
|
-
"test-connection",
|
|
178
|
-
true,
|
|
179
|
-
true,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
expect(deleteConnectionStub.calledOnce).to.be.true;
|
|
183
|
-
expect(
|
|
184
|
-
loggerStub.error.calledWith(
|
|
185
|
-
sinon.match("Failed to delete connection"),
|
|
186
|
-
),
|
|
187
|
-
).to.be.true;
|
|
188
|
-
});
|
|
189
|
-
});
|