@automattic/vip 4.1.6 → 4.1.8
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/assets/dev-env.lando.template.yml.ejs +1 -1
- package/dist/bin/vip-app-deploy-token-generate.js +110 -78
- package/dist/bin/vip-app-deploy-token.js +24 -16
- package/dist/bin/vip-app-deploy-validate.js +45 -41
- package/dist/bin/vip-app-deploy.js +222 -215
- package/dist/bin/vip-app-list.js +59 -43
- package/dist/bin/vip-app.js +97 -66
- package/dist/bin/vip-backup-db.js +36 -29
- package/dist/bin/vip-backup.js +16 -9
- package/dist/bin/vip-cache-purge-url.js +93 -55
- package/dist/bin/vip-cache.js +23 -14
- package/dist/bin/vip-config-envvar-delete.js +74 -73
- package/dist/bin/vip-config-envvar-get-all.js +68 -68
- package/dist/bin/vip-config-envvar-get.js +46 -46
- package/dist/bin/vip-config-envvar-list.js +54 -57
- package/dist/bin/vip-config-envvar-set.js +102 -96
- package/dist/bin/vip-config-envvar.js +38 -24
- package/dist/bin/vip-config-software-get.js +88 -75
- package/dist/bin/vip-config-software-update.js +116 -120
- package/dist/bin/vip-config-software.js +31 -21
- package/dist/bin/vip-config.js +25 -17
- package/dist/bin/vip-db-phpmyadmin.js +40 -39
- package/dist/bin/vip-db.js +13 -12
- package/dist/bin/vip-defensive-mode-configure.js +197 -197
- package/dist/bin/vip-defensive-mode-disable.js +43 -35
- package/dist/bin/vip-defensive-mode-enable.js +47 -38
- package/dist/bin/vip-defensive-mode.js +28 -17
- package/dist/bin/vip-dev-env-create.js +147 -104
- package/dist/bin/vip-dev-env-destroy.js +48 -39
- package/dist/bin/vip-dev-env-envvar-delete.js +60 -49
- package/dist/bin/vip-dev-env-envvar-get-all.js +52 -45
- package/dist/bin/vip-dev-env-envvar-get.js +48 -37
- package/dist/bin/vip-dev-env-envvar-list.js +48 -41
- package/dist/bin/vip-dev-env-envvar-set.js +83 -70
- package/dist/bin/vip-dev-env-envvar.js +38 -23
- package/dist/bin/vip-dev-env-exec.js +81 -74
- package/dist/bin/vip-dev-env-import-media.js +34 -26
- package/dist/bin/vip-dev-env-import-sql.js +65 -51
- package/dist/bin/vip-dev-env-import.js +23 -14
- package/dist/bin/vip-dev-env-info.js +59 -50
- package/dist/bin/vip-dev-env-list.js +34 -31
- package/dist/bin/vip-dev-env-logs.js +59 -49
- package/dist/bin/vip-dev-env-purge.js +71 -63
- package/dist/bin/vip-dev-env-shell.js +82 -71
- package/dist/bin/vip-dev-env-start.js +77 -65
- package/dist/bin/vip-dev-env-stop.js +80 -74
- package/dist/bin/vip-dev-env-sync-sql.js +80 -72
- package/dist/bin/vip-dev-env-sync.js +18 -11
- package/dist/bin/vip-dev-env-update.js +93 -84
- package/dist/bin/vip-dev-env.js +25 -8
- package/dist/bin/vip-edge-workers-build.js +82 -54
- package/dist/bin/vip-edge-workers-delete.js +84 -52
- package/dist/bin/vip-edge-workers-deploy.js +186 -126
- package/dist/bin/vip-edge-workers-disable.js +75 -44
- package/dist/bin/vip-edge-workers-enable.js +86 -54
- package/dist/bin/vip-edge-workers-get.js +108 -88
- package/dist/bin/vip-edge-workers-init.js +83 -53
- package/dist/bin/vip-edge-workers-list.js +89 -54
- package/dist/bin/vip-edge-workers-new.js +98 -69
- package/dist/bin/vip-edge-workers-validate.js +123 -82
- package/dist/bin/vip-edge-workers.js +19 -6
- package/dist/bin/vip-export-sql.js +75 -69
- package/dist/bin/vip-export.js +12 -7
- package/dist/bin/vip-import-media-abort.js +99 -73
- package/dist/bin/vip-import-media-status.js +83 -51
- package/dist/bin/vip-import-media.js +165 -166
- package/dist/bin/vip-import-sql-status.js +75 -45
- package/dist/bin/vip-import-sql.js +536 -596
- package/dist/bin/vip-import-validate-files.js +122 -141
- package/dist/bin/vip-import-validate-sql.js +52 -16
- package/dist/bin/vip-import.js +16 -7
- package/dist/bin/vip-logout.js +17 -13
- package/dist/bin/vip-logs.js +209 -183
- package/dist/bin/vip-search-replace.js +85 -53
- package/dist/bin/vip-slowlogs.js +168 -147
- package/dist/bin/vip-sync.js +163 -133
- package/dist/bin/vip-whoami.js +71 -35
- package/dist/bin/vip-wp.js +506 -549
- package/dist/bin/vip.js +161 -116
- package/dist/commands/backup-db.js +183 -149
- package/dist/commands/dev-env-import-sql.js +162 -117
- package/dist/commands/dev-env-sync-sql.js +372 -330
- package/dist/commands/export-sql.js +441 -425
- package/dist/commands/phpmyadmin.js +232 -212
- package/dist/commands/wp-ssh.js +218 -187
- package/dist/lib/analytics/clients/tracks.js +84 -91
- package/dist/lib/analytics/index.js +27 -27
- package/dist/lib/api/app.js +37 -36
- package/dist/lib/api/cache-purge.js +17 -20
- package/dist/lib/api/constants.js +5 -6
- package/dist/lib/api/edge-workers.js +84 -135
- package/dist/lib/api/error-debug.js +10 -13
- package/dist/lib/api/feature-flags.js +16 -17
- package/dist/lib/api/http.js +47 -48
- package/dist/lib/api/user.js +17 -18
- package/dist/lib/api.js +107 -116
- package/dist/lib/app-logs/app-logs.js +24 -25
- package/dist/lib/app-slowlogs/app-slowlogs.js +23 -24
- package/dist/lib/app-slowlogs/types.js +2 -1
- package/dist/lib/app.js +6 -8
- package/dist/lib/backup-storage-availability/backup-storage-availability.js +119 -119
- package/dist/lib/backup-storage-availability/docker-machine-not-found-error.js +5 -6
- package/dist/lib/cli/apiConfig.js +71 -41
- package/dist/lib/cli/command.js +1120 -873
- package/dist/lib/cli/config.js +29 -29
- package/dist/lib/cli/envAlias.js +35 -50
- package/dist/lib/cli/exit.js +19 -19
- package/dist/lib/cli/format.js +172 -172
- package/dist/lib/cli/progress.js +193 -236
- package/dist/lib/cli/prompt.js +14 -15
- package/dist/lib/cli/runtime-mode.js +5 -6
- package/dist/lib/client-file-uploader.js +489 -641
- package/dist/lib/config/software.js +206 -212
- package/dist/lib/constants/dev-environment.js +40 -37
- package/dist/lib/constants/file-size.js +6 -7
- package/dist/lib/constants/vipgo.js +24 -12
- package/dist/lib/custom-deploy/custom-deploy.js +138 -120
- package/dist/lib/database.js +88 -85
- package/dist/lib/defensive-mode/api.js +41 -46
- package/dist/lib/defensive-mode/cli-helpers.js +40 -40
- package/dist/lib/dev-environment/dev-environment-cli.js +776 -735
- package/dist/lib/dev-environment/dev-environment-configuration-file.js +224 -191
- package/dist/lib/dev-environment/dev-environment-core.js +697 -732
- package/dist/lib/dev-environment/dev-environment-database.js +57 -41
- package/dist/lib/dev-environment/dev-environment-lando.js +734 -666
- package/dist/lib/dev-environment/docker-utils.js +96 -90
- package/dist/lib/dev-environment/env-vars.js +61 -59
- package/dist/lib/dev-environment/lando-loader.js +6 -7
- package/dist/lib/dev-environment/types.js +2 -1
- package/dist/lib/edge-workers/confirmation.js +42 -36
- package/dist/lib/edge-workers/deployment.js +150 -159
- package/dist/lib/edge-workers/index.js +68 -85
- package/dist/lib/edge-workers/location.js +26 -26
- package/dist/lib/edge-workers/output.js +14 -15
- package/dist/lib/edge-workers/project.js +123 -132
- package/dist/lib/edge-workers/toolchains/assemblyscript/constants.js +6 -8
- package/dist/lib/edge-workers/toolchains/assemblyscript/index.js +100 -101
- package/dist/lib/edge-workers/toolchains/assemblyscript/templates.js +31 -33
- package/dist/lib/edge-workers/toolchains/index.js +15 -15
- package/dist/lib/edge-workers/types.js +10 -38
- package/dist/lib/edge-workers/validation.js +161 -150
- package/dist/lib/env.js +16 -17
- package/dist/lib/envvar/api-delete.js +16 -18
- package/dist/lib/envvar/api-get-all.js +15 -19
- package/dist/lib/envvar/api-get.js +8 -9
- package/dist/lib/envvar/api-list.js +16 -21
- package/dist/lib/envvar/api-set.js +20 -19
- package/dist/lib/envvar/api.js +34 -29
- package/dist/lib/envvar/input.js +29 -34
- package/dist/lib/envvar/logging.js +9 -11
- package/dist/lib/envvar/read-file.js +6 -7
- package/dist/lib/http/download-file.js +76 -44
- package/dist/lib/http/proxy-agent.js +37 -40
- package/dist/lib/http/proxy-dispatcher.js +69 -71
- package/dist/lib/keychain/insecure.js +40 -36
- package/dist/lib/keychain/keychain.js +2 -1
- package/dist/lib/keychain/secure.js +16 -15
- package/dist/lib/keychain.js +22 -22
- package/dist/lib/live-backup-copy.js +117 -115
- package/dist/lib/logout.js +17 -19
- package/dist/lib/media-import/config.js +15 -14
- package/dist/lib/media-import/media-file-import.js +9 -13
- package/dist/lib/media-import/progress.js +53 -65
- package/dist/lib/media-import/status.js +241 -256
- package/dist/lib/media-import/utils.js +15 -15
- package/dist/lib/node-version-check.js +16 -16
- package/dist/lib/promise.js +16 -17
- package/dist/lib/read-file.js +48 -16
- package/dist/lib/rechallenge/client.js +37 -43
- package/dist/lib/rechallenge/errors.js +38 -37
- package/dist/lib/rechallenge/flow.js +148 -123
- package/dist/lib/rechallenge/index.js +23 -24
- package/dist/lib/rechallenge/link.js +153 -151
- package/dist/lib/rechallenge/open-browser.js +14 -17
- package/dist/lib/rechallenge/token-cache.js +83 -86
- package/dist/lib/rechallenge/types.js +5 -14
- package/dist/lib/retry.js +93 -129
- package/dist/lib/search-and-replace.js +164 -148
- package/dist/lib/site-import/db-file-import.js +12 -16
- package/dist/lib/site-import/status.js +291 -291
- package/dist/lib/token.js +86 -87
- package/dist/lib/tracker.js +51 -62
- package/dist/lib/types/graphql/rate-limit-exceeded-error.js +2 -1
- package/dist/lib/types.js +2 -1
- package/dist/lib/user-error.js +6 -8
- package/dist/lib/utils.js +81 -87
- package/dist/lib/validations/custom-deploy.js +218 -186
- package/dist/lib/validations/is-multi-site-sql-dump.js +6 -6
- package/dist/lib/validations/is-multi-site.js +83 -50
- package/dist/lib/validations/is-multisite-domain-mapped.js +92 -62
- package/dist/lib/validations/line-by-line.js +78 -46
- package/dist/lib/validations/site-type.js +59 -63
- package/dist/lib/validations/sql-insert-parser.js +415 -0
- package/dist/lib/validations/sql.js +551 -431
- package/dist/lib/validations/utils.js +27 -29
- package/dist/lib/vip-import-validate-files.js +481 -490
- package/dist/lib/wp/helpers.js +41 -45
- package/dist/lib/wp/readline.js +21 -57
- package/dist/lib/xdg-data.js +11 -12
- package/helpers/mark-cli-executable.js +9 -0
- package/node_modules/@apollo/client/CHANGELOG.md +10 -0
- package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs +5 -0
- package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs +2 -1
- package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs +14 -2
- package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs +16 -0
- package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.d.cts +2 -0
- package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs +3 -2
- package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs +9 -1
- package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/core/QueryInfo.d.cts +1 -1
- package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs +10 -3
- package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.d.cts +42 -43
- package/node_modules/@apollo/client/__cjs/version.cjs +1 -1
- package/node_modules/@apollo/client/cache/inmemory/helpers.js +5 -0
- package/node_modules/@apollo/client/cache/inmemory/helpers.js.map +1 -1
- package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js +2 -1
- package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map +1 -1
- package/node_modules/@apollo/client/cache/inmemory/key-extractor.js +14 -2
- package/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map +1 -1
- package/node_modules/@apollo/client/cache/inmemory/policies.d.ts +2 -0
- package/node_modules/@apollo/client/cache/inmemory/policies.js +17 -1
- package/node_modules/@apollo/client/cache/inmemory/policies.js.map +1 -1
- package/node_modules/@apollo/client/cache/inmemory/writeToStore.js +3 -2
- package/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map +1 -1
- package/node_modules/@apollo/client/core/QueryInfo.d.ts +1 -1
- package/node_modules/@apollo/client/core/QueryInfo.js +10 -2
- package/node_modules/@apollo/client/core/QueryInfo.js.map +1 -1
- package/node_modules/@apollo/client/core/QueryManager.js +10 -3
- package/node_modules/@apollo/client/core/QueryManager.js.map +1 -1
- package/node_modules/@apollo/client/package.json +1 -1
- package/node_modules/@apollo/client/react/hooks/useFragment.d.ts +42 -43
- package/node_modules/@apollo/client/react/hooks/useFragment.js.map +1 -1
- package/node_modules/@apollo/client/react/hooks-compiled/useFragment.d.ts +42 -43
- package/node_modules/@apollo/client/react/hooks-compiled/useFragment.js.map +1 -1
- package/node_modules/@apollo/client/version.js +1 -1
- package/node_modules/@automattic/vip-search-replace/README.md +6 -1
- package/node_modules/@automattic/vip-search-replace/lib/index.js +46 -14
- package/node_modules/@automattic/vip-search-replace/package.json +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/check-disk-space/README.md +92 -32
- package/node_modules/check-disk-space/dist/check-disk-space.d.mts +58 -0
- package/node_modules/check-disk-space/dist/check-disk-space.mjs +170 -190
- package/node_modules/check-disk-space/package.json +43 -71
- package/node_modules/cpu-features/build/Makefile +2 -2
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_windows.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o.d +1 -1
- package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpufeatures/src/binding.o.d +157 -145
- package/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
- package/node_modules/cpu-features/build/Release/obj.target/cpufeatures/src/binding.o +0 -0
- package/node_modules/cpu-features/build/Release/obj.target/cpufeatures.node +0 -0
- package/node_modules/cpu-features/build/config.gypi +100 -31
- package/node_modules/cpu-features/build/cpufeatures.target.mk +14 -14
- package/node_modules/cpu-features/build/deps/cpu_features/cpu_features.target.mk +14 -14
- package/node_modules/ssh2/lib/protocol/crypto/build/Makefile +2 -2
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d.raw +136 -0
- package/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk +14 -14
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/package.json +44 -13
- package/dist/lib/analytics/clients/client.js +0 -1
- package/dist/lib/analytics/clients/pendo.js +0 -78
- package/helpers/check-version.js +0 -16
- package/node_modules/check-disk-space/dist/check-disk-space.cjs +0 -210
- package/node_modules/check-disk-space/dist/check-disk-space.d.ts +0 -53
- package/node_modules/fetch-retry/.eslintignore +0 -1
- package/node_modules/fetch-retry/.eslintrc.yml +0 -20
- package/node_modules/fetch-retry/.github/workflows/node.js.yml +0 -32
- package/node_modules/fetch-retry/.husky/pre-commit +0 -6
- package/node_modules/fetch-retry/.nycrc.json +0 -24
- package/node_modules/fetch-retry/.travis.yml +0 -3
- package/node_modules/fetch-retry/LICENSE +0 -21
- package/node_modules/fetch-retry/README.md +0 -128
- package/node_modules/fetch-retry/dist/fetch-retry.umd.js +0 -151
- package/node_modules/fetch-retry/index.d.ts +0 -29
- package/node_modules/fetch-retry/index.js +0 -143
- package/node_modules/fetch-retry/package.json +0 -41
- package/node_modules/fetch-retry/rollup.config.js +0 -12
- package/node_modules/fetch-retry/test/.eslintrc.yml +0 -7
- package/node_modules/fetch-retry/test/integration/index.js +0 -212
- package/node_modules/fetch-retry/test/integration/mock-api/index.js +0 -42
- package/node_modules/fetch-retry/test/unit/index.js +0 -1169
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d +0 -265
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d +0 -1
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d +0 -1
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o +0 -0
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node +0 -0
- package/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
|
@@ -1,216 +1,216 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
7
|
exports.defensiveModeConfigureCommand = defensiveModeConfigureCommand;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const enquirer_1 = require("enquirer");
|
|
10
|
+
const command_1 = __importDefault(require("../lib/cli/command"));
|
|
11
|
+
const format_1 = require("../lib/cli/format");
|
|
12
|
+
const api_1 = require("../lib/defensive-mode/api");
|
|
13
|
+
const cli_helpers_1 = require("../lib/defensive-mode/cli-helpers");
|
|
14
|
+
const input_1 = require("../lib/envvar/input");
|
|
15
|
+
const tracker_1 = require("../lib/tracker");
|
|
15
16
|
const baseUsage = 'vip defensive-mode configure';
|
|
16
17
|
const exampleUsage = 'vip @example-app.production defensive-mode configure';
|
|
17
|
-
const examples = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
const examples = [
|
|
19
|
+
{
|
|
20
|
+
usage: `${exampleUsage} --enabled=true --challenge-type=1`,
|
|
21
|
+
description: 'Update defensive mode configuration non-interactively (minimal required flags).',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
usage: `${exampleUsage} --enabled=true --challenge-type=2 --connection-threshold-absolute=5000 --connection-threshold-percentage=80`,
|
|
25
|
+
description: 'Update with explicit thresholds.',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
24
28
|
function parseBoolean(raw) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
if (raw === true || raw === false) {
|
|
30
|
+
return raw;
|
|
31
|
+
}
|
|
32
|
+
if (typeof raw !== 'string') {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const normalized = raw.trim().toLowerCase();
|
|
36
|
+
if (['true', 'yes', '1', 'on', 'enable', 'enabled'].includes(normalized)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (['false', 'no', '0', 'off', 'disable', 'disabled'].includes(normalized)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
29
42
|
return null;
|
|
30
|
-
}
|
|
31
|
-
const normalized = raw.trim().toLowerCase();
|
|
32
|
-
if (['true', 'yes', '1', 'on', 'enable', 'enabled'].includes(normalized)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
if (['false', 'no', '0', 'off', 'disable', 'disabled'].includes(normalized)) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
43
|
}
|
|
40
44
|
function parsePositiveInt(raw) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
// A bare flag (e.g. `--challenge-type` with no value) arrives as boolean true,
|
|
46
|
+
// which Number() would silently coerce to 1.
|
|
47
|
+
if (raw === undefined || raw === null || typeof raw === 'boolean') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (typeof raw === 'string' && raw.trim() === '') {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const num = Number(raw);
|
|
54
|
+
if (!Number.isInteger(num) || num < 0) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return num;
|
|
54
58
|
}
|
|
55
59
|
function validateFlags(opt) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
percentage,
|
|
78
|
-
errors
|
|
79
|
-
};
|
|
60
|
+
const errors = [];
|
|
61
|
+
const enabled = opt.enabled === undefined ? null : parseBoolean(opt.enabled);
|
|
62
|
+
if (opt.enabled !== undefined && enabled === null) {
|
|
63
|
+
errors.push(`Invalid value for --enabled: ${opt.enabled}. Expected true or false.`);
|
|
64
|
+
}
|
|
65
|
+
const challengeType = opt.challengeType === undefined ? null : parsePositiveInt(opt.challengeType);
|
|
66
|
+
if (opt.challengeType !== undefined && challengeType === null) {
|
|
67
|
+
errors.push(`Invalid value for --challenge-type: ${opt.challengeType}. Expected a non-negative integer.`);
|
|
68
|
+
}
|
|
69
|
+
const absolute = opt.connectionThresholdAbsolute === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: parsePositiveInt(opt.connectionThresholdAbsolute);
|
|
72
|
+
if (opt.connectionThresholdAbsolute !== undefined && absolute === null) {
|
|
73
|
+
errors.push(`Invalid value for --connection-threshold-absolute: ${opt.connectionThresholdAbsolute}. Expected a non-negative integer.`);
|
|
74
|
+
}
|
|
75
|
+
const percentage = opt.connectionThresholdPercentage === undefined
|
|
76
|
+
? undefined
|
|
77
|
+
: parsePositiveInt(opt.connectionThresholdPercentage);
|
|
78
|
+
if (opt.connectionThresholdPercentage !== undefined && percentage === null) {
|
|
79
|
+
errors.push(`Invalid value for --connection-threshold-percentage: ${opt.connectionThresholdPercentage}. Expected a non-negative integer.`);
|
|
80
|
+
}
|
|
81
|
+
return { enabled, challengeType, absolute, percentage, errors };
|
|
80
82
|
}
|
|
81
83
|
function formatSettingValue(value) {
|
|
82
|
-
|
|
84
|
+
return value === undefined || value === null ? '-' : String(value);
|
|
83
85
|
}
|
|
84
|
-
function buildSettingRows(currentConfig, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
function buildSettingRows(currentConfig, { enabled, challengeType, absolute, percentage }) {
|
|
87
|
+
return [
|
|
88
|
+
{
|
|
89
|
+
setting: 'Enabled',
|
|
90
|
+
current: formatSettingValue(currentConfig?.enabled),
|
|
91
|
+
proposed: formatSettingValue(enabled),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
setting: 'Challenge type',
|
|
95
|
+
current: formatSettingValue(currentConfig?.challengeType),
|
|
96
|
+
proposed: formatSettingValue(challengeType),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
setting: 'Connection threshold (absolute)',
|
|
100
|
+
current: formatSettingValue(currentConfig?.connectionThresholdAbsolute),
|
|
101
|
+
proposed: absolute === undefined ? '(not specified)' : formatSettingValue(absolute),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
setting: 'Connection threshold (percentage)',
|
|
105
|
+
current: formatSettingValue(currentConfig?.connectionThresholdPercentage),
|
|
106
|
+
proposed: percentage === undefined ? '(not specified)' : formatSettingValue(percentage),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
107
109
|
}
|
|
108
110
|
async function resolveRequiredViaPrompt(missing, enabled, challengeType) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (resolvedChallengeType === null) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
challengeType: resolvedChallengeType
|
|
133
|
-
};
|
|
111
|
+
const answers = await (0, enquirer_1.prompt)(missing.map(flag => flag === '--enabled'
|
|
112
|
+
? {
|
|
113
|
+
type: 'confirm',
|
|
114
|
+
name: 'enabled',
|
|
115
|
+
message: 'Enable defensive mode?',
|
|
116
|
+
}
|
|
117
|
+
: {
|
|
118
|
+
type: 'input',
|
|
119
|
+
name: 'challengeType',
|
|
120
|
+
message: 'Challenge type (integer):',
|
|
121
|
+
}));
|
|
122
|
+
let resolvedEnabled = enabled;
|
|
123
|
+
let resolvedChallengeType = challengeType;
|
|
124
|
+
if (resolvedEnabled === null && 'enabled' in answers) {
|
|
125
|
+
resolvedEnabled = Boolean(answers.enabled);
|
|
126
|
+
}
|
|
127
|
+
if (resolvedChallengeType === null && 'challengeType' in answers) {
|
|
128
|
+
resolvedChallengeType = parsePositiveInt(answers.challengeType);
|
|
129
|
+
if (resolvedChallengeType === null) {
|
|
130
|
+
console.error(chalk_1.default.red('Challenge type must be a non-negative integer.'));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { enabled: resolvedEnabled, challengeType: resolvedChallengeType };
|
|
134
135
|
}
|
|
135
136
|
async function defensiveModeConfigureCommand(_args, opt) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
console.log(`Defensive mode configuration for ${_chalk.default.bold(opt.app.name)} (${(0, _format.formatEnvironment)(opt.env.type)}):`);
|
|
202
|
-
console.log((0, _format.table)(settingRows));
|
|
203
|
-
|
|
204
|
-
// Production mutations require confirmation. In non-interactive contexts this
|
|
205
|
-
// hard-errors unless --skip-confirmation is passed, so unattended/CI runs fail
|
|
206
|
-
// fast rather than silently mutating production — matching enable/disable.
|
|
207
|
-
await (0, _cliHelpers.guardProductionMutation)(opt, 'configure', trackingParams, _input.confirm, _tracker.trackEvent, _format.formatEnvironment);
|
|
208
|
-
const result = await (0, _api.updateDefensiveModeConfig)(input);
|
|
209
|
-
await (0, _cliHelpers.reportMutationResult)(result, trackingParams, 'configure', opt.app.name, opt.env.type, 'configuration updated', 'update defensive mode config', _tracker.trackEvent);
|
|
137
|
+
const interactive = (0, cli_helpers_1.isInteractive)(opt);
|
|
138
|
+
const trackingParams = {
|
|
139
|
+
app_id: opt.app.id,
|
|
140
|
+
command: baseUsage,
|
|
141
|
+
env_id: opt.env.id,
|
|
142
|
+
org_id: opt.app.organization.id,
|
|
143
|
+
org_sfid: opt.app.organization.salesforceId,
|
|
144
|
+
interactive,
|
|
145
|
+
skip_confirm: Boolean(opt.skipConfirmation),
|
|
146
|
+
};
|
|
147
|
+
await (0, tracker_1.trackEvent)('defensive_mode_configure_command_execute', trackingParams);
|
|
148
|
+
const { enabled: rawEnabled, challengeType: rawChallengeType, absolute, percentage, errors, } = validateFlags(opt);
|
|
149
|
+
if (errors.length > 0) {
|
|
150
|
+
errors.forEach(msg => console.error(chalk_1.default.red(msg)));
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
const missing = [];
|
|
154
|
+
if (rawEnabled === null) {
|
|
155
|
+
missing.push('--enabled');
|
|
156
|
+
}
|
|
157
|
+
if (rawChallengeType === null) {
|
|
158
|
+
missing.push('--challenge-type');
|
|
159
|
+
}
|
|
160
|
+
let enabled = rawEnabled;
|
|
161
|
+
let challengeType = rawChallengeType;
|
|
162
|
+
if (missing.length > 0) {
|
|
163
|
+
if (!interactive) {
|
|
164
|
+
console.error(chalk_1.default.red(`Missing required flags in non-interactive mode: ${missing.join(', ')}`));
|
|
165
|
+
console.error('Re-run with all required flags, or remove --non-interactive and run on a TTY.');
|
|
166
|
+
await (0, tracker_1.trackEvent)('defensive_mode_configure_command_error', {
|
|
167
|
+
...trackingParams,
|
|
168
|
+
error: 'missing-required-flags',
|
|
169
|
+
});
|
|
170
|
+
process.exit(1);
|
|
171
|
+
}
|
|
172
|
+
({ enabled, challengeType } = await resolveRequiredViaPrompt(missing, enabled, challengeType));
|
|
173
|
+
}
|
|
174
|
+
const input = {
|
|
175
|
+
appId: opt.app.id,
|
|
176
|
+
envId: opt.env.id,
|
|
177
|
+
enabled,
|
|
178
|
+
challengeType,
|
|
179
|
+
};
|
|
180
|
+
if (absolute !== undefined) {
|
|
181
|
+
input.connectionThresholdAbsolute = absolute;
|
|
182
|
+
}
|
|
183
|
+
if (percentage !== undefined) {
|
|
184
|
+
input.connectionThresholdPercentage = percentage;
|
|
185
|
+
}
|
|
186
|
+
const currentConfig = opt.env.defensiveMode?.config?.effective ?? null;
|
|
187
|
+
const settingRows = buildSettingRows(currentConfig, {
|
|
188
|
+
enabled,
|
|
189
|
+
challengeType,
|
|
190
|
+
absolute,
|
|
191
|
+
percentage,
|
|
192
|
+
});
|
|
193
|
+
console.log(`Defensive mode configuration for ${chalk_1.default.bold(opt.app.name)} (${(0, format_1.formatEnvironment)(opt.env.type)}):`);
|
|
194
|
+
console.log((0, format_1.table)(settingRows));
|
|
195
|
+
// Production mutations require confirmation. In non-interactive contexts this
|
|
196
|
+
// hard-errors unless --skip-confirmation is passed, so unattended/CI runs fail
|
|
197
|
+
// fast rather than silently mutating production — matching enable/disable.
|
|
198
|
+
await (0, cli_helpers_1.guardProductionMutation)(opt, 'configure', trackingParams, input_1.confirm, tracker_1.trackEvent, format_1.formatEnvironment);
|
|
199
|
+
const result = await (0, api_1.updateDefensiveModeConfig)(input);
|
|
200
|
+
await (0, cli_helpers_1.reportMutationResult)(result, trackingParams, 'configure', opt.app.name, opt.env.type, 'configuration updated', 'update defensive mode config', tracker_1.trackEvent);
|
|
210
201
|
}
|
|
211
|
-
(0,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
})
|
|
202
|
+
(0, command_1.default)({
|
|
203
|
+
appContext: true,
|
|
204
|
+
appQuery: api_1.appQuery,
|
|
205
|
+
envContext: true,
|
|
206
|
+
usage: baseUsage,
|
|
207
|
+
})
|
|
208
|
+
.option('enabled', 'Whether defensive mode should be enabled (true|false). Required.')
|
|
209
|
+
.option('challenge-type', 'Challenge type integer. Required.')
|
|
210
|
+
.option('connection-threshold-absolute', 'Absolute connection threshold that triggers defensive mode.')
|
|
211
|
+
.option('connection-threshold-percentage', 'Connection threshold percentage that triggers defensive mode.')
|
|
212
|
+
.option('non-interactive', 'Disable prompts and browser-open; fail fast if a required flag is missing.', false)
|
|
213
|
+
.option('skip-confirmation', 'Skip the confirmation prompt for production envs.', false)
|
|
214
|
+
.option('rechallenge-wait', 'When step-up verification is required non-interactively, print the URL and wait for verification on another device instead of failing fast.', false)
|
|
215
|
+
.examples(examples)
|
|
216
|
+
.argv(process.argv, defensiveModeConfigureCommand);
|
|
@@ -1,42 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
7
|
exports.defensiveModeDisableCommand = defensiveModeDisableCommand;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
const command_1 = __importDefault(require("../lib/cli/command"));
|
|
9
|
+
const format_1 = require("../lib/cli/format");
|
|
10
|
+
const api_1 = require("../lib/defensive-mode/api");
|
|
11
|
+
const cli_helpers_1 = require("../lib/defensive-mode/cli-helpers");
|
|
12
|
+
const input_1 = require("../lib/envvar/input");
|
|
13
|
+
const tracker_1 = require("../lib/tracker");
|
|
13
14
|
const baseUsage = 'vip defensive-mode disable';
|
|
14
15
|
const exampleUsage = 'vip @example-app.production defensive-mode disable';
|
|
15
|
-
const examples = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const examples = [
|
|
17
|
+
{
|
|
18
|
+
usage: exampleUsage,
|
|
19
|
+
description: 'Disable defensive mode for the environment.',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
19
22
|
async function defensiveModeDisableCommand(_args, opt) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
const trackingParams = {
|
|
24
|
+
app_id: opt.app.id,
|
|
25
|
+
command: baseUsage,
|
|
26
|
+
env_id: opt.env.id,
|
|
27
|
+
org_id: opt.app.organization.id,
|
|
28
|
+
org_sfid: opt.app.organization.salesforceId,
|
|
29
|
+
skip_confirm: Boolean(opt.skipConfirmation),
|
|
30
|
+
};
|
|
31
|
+
await (0, tracker_1.trackEvent)('defensive_mode_disable_command_execute', trackingParams);
|
|
32
|
+
await (0, cli_helpers_1.guardProductionMutation)(opt, 'disable', trackingParams, input_1.confirm, tracker_1.trackEvent, format_1.formatEnvironment);
|
|
33
|
+
const result = await (0, api_1.updateDefensiveModeStatus)({
|
|
34
|
+
appId: opt.app.id,
|
|
35
|
+
envId: opt.env.id,
|
|
36
|
+
enabled: false,
|
|
37
|
+
});
|
|
38
|
+
await (0, cli_helpers_1.reportMutationResult)(result, trackingParams, 'disable', opt.app.name, opt.env.type, 'disabled', 'disable defensive mode', tracker_1.trackEvent);
|
|
36
39
|
}
|
|
37
|
-
(0,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
40
|
+
(0, command_1.default)({
|
|
41
|
+
appContext: true,
|
|
42
|
+
appQuery: api_1.appQuery,
|
|
43
|
+
envContext: true,
|
|
44
|
+
usage: baseUsage,
|
|
45
|
+
})
|
|
46
|
+
.option('skip-confirmation', 'Skip the confirmation prompt for production envs.', false)
|
|
47
|
+
.option('non-interactive', 'Disable prompts; error if a production mutation is attempted without --skip-confirmation.', false)
|
|
48
|
+
.option('rechallenge-wait', 'When step-up verification is required non-interactively, print the URL and wait for verification on another device instead of failing fast.', false)
|
|
49
|
+
.examples(examples)
|
|
50
|
+
.argv(process.argv, defensiveModeDisableCommand);
|
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
7
|
exports.defensiveModeEnableCommand = defensiveModeEnableCommand;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
const command_1 = __importDefault(require("../lib/cli/command"));
|
|
9
|
+
const format_1 = require("../lib/cli/format");
|
|
10
|
+
const api_1 = require("../lib/defensive-mode/api");
|
|
11
|
+
const cli_helpers_1 = require("../lib/defensive-mode/cli-helpers");
|
|
12
|
+
const input_1 = require("../lib/envvar/input");
|
|
13
|
+
const tracker_1 = require("../lib/tracker");
|
|
13
14
|
const baseUsage = 'vip defensive-mode enable';
|
|
14
15
|
const exampleUsage = 'vip @example-app.production defensive-mode enable';
|
|
15
|
-
const examples = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
16
|
+
const examples = [
|
|
17
|
+
{
|
|
18
|
+
usage: exampleUsage,
|
|
19
|
+
description: 'Enable defensive mode for the environment (interactive).',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
usage: `${exampleUsage} --skip-confirmation`,
|
|
23
|
+
description: 'Enable defensive mode without the production confirmation prompt.',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
22
26
|
async function defensiveModeEnableCommand(_args, opt) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
const trackingParams = {
|
|
28
|
+
app_id: opt.app.id,
|
|
29
|
+
command: baseUsage,
|
|
30
|
+
env_id: opt.env.id,
|
|
31
|
+
org_id: opt.app.organization.id,
|
|
32
|
+
org_sfid: opt.app.organization.salesforceId,
|
|
33
|
+
skip_confirm: Boolean(opt.skipConfirmation),
|
|
34
|
+
};
|
|
35
|
+
await (0, tracker_1.trackEvent)('defensive_mode_enable_command_execute', trackingParams);
|
|
36
|
+
await (0, cli_helpers_1.guardProductionMutation)(opt, 'enable', trackingParams, input_1.confirm, tracker_1.trackEvent, format_1.formatEnvironment);
|
|
37
|
+
const result = await (0, api_1.updateDefensiveModeStatus)({
|
|
38
|
+
appId: opt.app.id,
|
|
39
|
+
envId: opt.env.id,
|
|
40
|
+
enabled: true,
|
|
41
|
+
});
|
|
42
|
+
await (0, cli_helpers_1.reportMutationResult)(result, trackingParams, 'enable', opt.app.name, opt.env.type, 'enabled', 'enable defensive mode', tracker_1.trackEvent);
|
|
39
43
|
}
|
|
40
|
-
(0,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
44
|
+
(0, command_1.default)({
|
|
45
|
+
appContext: true,
|
|
46
|
+
appQuery: api_1.appQuery,
|
|
47
|
+
envContext: true,
|
|
48
|
+
usage: baseUsage,
|
|
49
|
+
})
|
|
50
|
+
.option('skip-confirmation', 'Skip the confirmation prompt for production envs.', false)
|
|
51
|
+
.option('non-interactive', 'Disable prompts; error if a production mutation is attempted without --skip-confirmation.', false)
|
|
52
|
+
.option('rechallenge-wait', 'When step-up verification is required non-interactively, print the URL and wait for verification on another device instead of failing fast.', false)
|
|
53
|
+
.examples(examples)
|
|
54
|
+
.argv(process.argv, defensiveModeEnableCommand);
|