@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
package/dist/bin/vip-sync.js
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const core_1 = require("@apollo/client/core");
|
|
8
|
+
const single_line_log_1 = require("@wwa/single-line-log");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
11
|
+
const api_1 = __importDefault(require("../lib/api"));
|
|
12
|
+
const app_1 = __importDefault(require("../lib/api/app"));
|
|
13
|
+
const command_1 = __importDefault(require("../lib/cli/command"));
|
|
14
|
+
const format_1 = require("../lib/cli/format");
|
|
15
|
+
const tracker_1 = require("../lib/tracker");
|
|
16
|
+
// The API reports the current step as the overall status while a sync is in progress.
|
|
17
|
+
const SYNC_RUNNING_STATUSES = ['running', 'started', 'importing', 'cleanup'];
|
|
18
|
+
const SYNC_SUCCESS_STATUSES = ['success', 'complete'];
|
|
14
19
|
const appQuery = `id,name,environments{
|
|
15
20
|
id,appId,type,name,defaultDomain,branch,datacenter,syncProgress{
|
|
16
|
-
status,sync,steps{name,status}
|
|
21
|
+
status,error,progress_update_text,sync,steps{name,status}
|
|
17
22
|
},syncPreview { canSync, errors { message }, backup { createdAt }, replacements { from, to } }
|
|
18
23
|
}`;
|
|
19
|
-
(0,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
await
|
|
31
|
-
|
|
24
|
+
(0, command_1.default)({
|
|
25
|
+
appContext: true,
|
|
26
|
+
appQuery,
|
|
27
|
+
childEnvContext: true,
|
|
28
|
+
module: 'sync',
|
|
29
|
+
requireConfirm: 'Are you sure you want to sync from production?',
|
|
30
|
+
})
|
|
31
|
+
.example('vip @example-app.develop sync', 'Sync the production environment database of the "example-app" application to the develop environment.')
|
|
32
|
+
.argv(process.argv, async (arg, opts) => {
|
|
33
|
+
const api = (0, api_1.default)();
|
|
34
|
+
let syncing = false;
|
|
35
|
+
await (0, tracker_1.trackEvent)('sync_command_execute');
|
|
36
|
+
try {
|
|
37
|
+
await api.mutate({
|
|
38
|
+
mutation: (0, graphql_tag_1.default) `
|
|
32
39
|
mutation SyncEnvironmentMutation($input: AppEnvironmentSyncInput) {
|
|
33
40
|
syncEnvironment(input: $input) {
|
|
34
41
|
environment {
|
|
@@ -37,74 +44,75 @@ const appQuery = `id,name,environments{
|
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
`,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} catch (error) {
|
|
48
|
-
if (_core.CombinedGraphQLErrors.is(error)) {
|
|
49
|
-
let bail = false;
|
|
50
|
-
for (const err of error.errors) {
|
|
51
|
-
if (err.message !== 'Site is already syncing') {
|
|
52
|
-
bail = true;
|
|
53
|
-
console.log(_chalk.default.red('Error:'), err.message);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// TODO: Log e
|
|
58
|
-
|
|
59
|
-
if (bail) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
47
|
+
variables: {
|
|
48
|
+
input: {
|
|
49
|
+
id: opts.app.id,
|
|
50
|
+
environmentId: opts.env.id,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
62
54
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (core_1.CombinedGraphQLErrors.is(error)) {
|
|
57
|
+
let bail = false;
|
|
58
|
+
for (const err of error.errors) {
|
|
59
|
+
if (err.message !== 'Site is already syncing') {
|
|
60
|
+
bail = true;
|
|
61
|
+
console.log(chalk_1.default.red('Error:'), err.message);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// TODO: Log e
|
|
65
|
+
if (bail) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
syncing = true;
|
|
70
|
+
await (0, tracker_1.trackEvent)('sync_command_execute_error', {
|
|
71
|
+
error: `Already syncing: ${error.message}`,
|
|
72
|
+
});
|
|
80
73
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
const sprite = {
|
|
75
|
+
count: 0,
|
|
76
|
+
sprite: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
77
|
+
next() {
|
|
78
|
+
this.count++;
|
|
79
|
+
if (this.count >= this.sprite.length) {
|
|
80
|
+
this.count = 0;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
value: this.sprite[this.count],
|
|
84
|
+
done: false,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const application = await (0, app_1.default)(opts.app.id, appQuery);
|
|
89
|
+
let environment = application.environments.find(env => env.id === opts.env.id);
|
|
90
|
+
if (syncing) {
|
|
91
|
+
if (SYNC_RUNNING_STATUSES.includes(environment.syncProgress.status)) {
|
|
92
|
+
console.log(chalk_1.default.yellow('Note:'), 'A data sync is already running.');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.log(chalk_1.default.yellow('Note:'), 'Someone recently ran a data sync on this site.');
|
|
96
|
+
console.log(chalk_1.default.yellow('Note:'), 'Please wait a few minutes before trying again.');
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
query App($id: Int) {
|
|
99
|
+
console.log();
|
|
100
|
+
console.log(` syncing: ${chalk_1.default.yellow(opts.app.name)}`);
|
|
101
|
+
console.log(` from: ${(0, format_1.formatEnvironment)('production')}`);
|
|
102
|
+
console.log(` to: ${(0, format_1.formatEnvironment)(opts.env.type)}`);
|
|
103
|
+
let count = 0;
|
|
104
|
+
const progress = setInterval(async () => {
|
|
105
|
+
if (count++ % 10 === 0) {
|
|
106
|
+
// Query the API 1/10 of the time (every 1s)
|
|
107
|
+
// The rest of the iterations are just for moving the spinner
|
|
108
|
+
api
|
|
109
|
+
.query({
|
|
110
|
+
query: (0, graphql_tag_1.default) `
|
|
111
|
+
query App($id: Int, $envId: Int) {
|
|
104
112
|
app(id: $id) {
|
|
105
113
|
id
|
|
106
114
|
name
|
|
107
|
-
environments {
|
|
115
|
+
environments(id: $envId) {
|
|
108
116
|
id
|
|
109
117
|
name
|
|
110
118
|
defaultDomain
|
|
@@ -112,6 +120,8 @@ const appQuery = `id,name,environments{
|
|
|
112
120
|
datacenter
|
|
113
121
|
syncProgress {
|
|
114
122
|
status
|
|
123
|
+
error
|
|
124
|
+
progress_update_text
|
|
115
125
|
sync
|
|
116
126
|
steps {
|
|
117
127
|
name
|
|
@@ -122,52 +132,72 @@ const appQuery = `id,name,environments{
|
|
|
122
132
|
}
|
|
123
133
|
}
|
|
124
134
|
`,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
fetchPolicy: 'network-only',
|
|
136
|
+
variables: {
|
|
137
|
+
id: opts.app.id,
|
|
138
|
+
envId: opts.env.id,
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
.then(res => res.data.app)
|
|
142
|
+
.then(_app => {
|
|
143
|
+
environment = _app.environments.find(env => env.id === opts.env.id);
|
|
144
|
+
});
|
|
128
145
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
};
|
|
140
|
-
const out = [];
|
|
141
|
-
const steps = environment.syncProgress.steps || [];
|
|
142
|
-
out.push('');
|
|
143
|
-
steps.forEach(step => {
|
|
144
|
-
if (step.status === 'pending') {
|
|
145
|
-
out.push(_chalk.default.dim(` ${marks[step.status]} ${step.name}`));
|
|
146
|
-
} else {
|
|
147
|
-
out.push(` ${marks[step.status]} ${step.name}`);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
out.push('');
|
|
151
|
-
switch (environment.syncProgress.status) {
|
|
152
|
-
case 'running':
|
|
153
|
-
out.push(`${marks.running} Press ^C to hide progress. Data sync will continue in the background.`);
|
|
154
|
-
break;
|
|
155
|
-
case 'failed':
|
|
156
|
-
clearInterval(progress);
|
|
157
|
-
await (0, _tracker.trackEvent)('sync_command_error', {
|
|
158
|
-
error: 'API returned `failed` status'
|
|
159
|
-
});
|
|
160
|
-
out.push(`${marks.failed} Data Sync is finished for ${opts.app.name}.`);
|
|
146
|
+
const marks = {
|
|
147
|
+
pending: '○',
|
|
148
|
+
running: chalk_1.default.blueBright(sprite.next().value),
|
|
149
|
+
success: chalk_1.default.green('✓'),
|
|
150
|
+
finished: chalk_1.default.green('✓'),
|
|
151
|
+
failed: chalk_1.default.red('✕'),
|
|
152
|
+
unknown: chalk_1.default.yellow('✕'),
|
|
153
|
+
};
|
|
154
|
+
const out = [];
|
|
155
|
+
const steps = environment.syncProgress.steps || [];
|
|
161
156
|
out.push('');
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
157
|
+
steps.forEach(step => {
|
|
158
|
+
if (step.status === 'pending') {
|
|
159
|
+
out.push(chalk_1.default.dim(` ${marks[step.status]} ${step.name}`));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
out.push(` ${marks[step.status] ?? marks.unknown} ${step.name}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
168
165
|
out.push('');
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
166
|
+
const { status, error: syncError, progress_update_text: progressText, } = environment.syncProgress;
|
|
167
|
+
if (progressText) {
|
|
168
|
+
out.push(` ${progressText}`);
|
|
169
|
+
out.push('');
|
|
170
|
+
}
|
|
171
|
+
if (status === 'failed') {
|
|
172
|
+
clearInterval(progress);
|
|
173
|
+
await (0, tracker_1.trackEvent)('sync_command_error', {
|
|
174
|
+
error: 'API returned `failed` status',
|
|
175
|
+
});
|
|
176
|
+
out.push(`${marks.failed} Data Sync failed for ${opts.app.name}.`);
|
|
177
|
+
if (syncError) {
|
|
178
|
+
out.push(`${chalk_1.default.red('Error:')} ${syncError}`);
|
|
179
|
+
}
|
|
180
|
+
out.push('');
|
|
181
|
+
}
|
|
182
|
+
else if (status === 'partially_completed') {
|
|
183
|
+
clearInterval(progress);
|
|
184
|
+
await (0, tracker_1.trackEvent)('sync_command_partially_completed');
|
|
185
|
+
out.push(`${marks.unknown} Data Sync is partially completed for ${opts.app.name}.`);
|
|
186
|
+
if (syncError) {
|
|
187
|
+
out.push(`${chalk_1.default.yellow('Error:')} ${syncError}`);
|
|
188
|
+
}
|
|
189
|
+
out.push('');
|
|
190
|
+
}
|
|
191
|
+
else if (SYNC_SUCCESS_STATUSES.includes(status)) {
|
|
192
|
+
clearInterval(progress);
|
|
193
|
+
await (0, tracker_1.trackEvent)('sync_command_success');
|
|
194
|
+
out.push(`${marks.success} Data Sync is finished for ${opts.app.name}.`);
|
|
195
|
+
out.push('');
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Running, or not_syncing until the job shows up: keep polling.
|
|
199
|
+
out.push('Press ^C to hide progress. Data sync will continue in the background.');
|
|
200
|
+
}
|
|
201
|
+
(0, single_line_log_1.stdout)(out.join('\n'));
|
|
202
|
+
}, 100);
|
|
203
|
+
});
|
package/dist/bin/vip-whoami.js
CHANGED
|
@@ -1,41 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
40
|
exports.whoamiCommand = whoamiCommand;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
41
|
+
const user_1 = require("../lib/api/user");
|
|
42
|
+
const command_1 = __importDefault(require("../lib/cli/command"));
|
|
43
|
+
const exit = __importStar(require("../lib/cli/exit"));
|
|
44
|
+
const tracker_1 = require("../lib/tracker");
|
|
12
45
|
const baseUsage = 'vip whoami';
|
|
13
46
|
async function whoamiCommand() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
const trackingParams = {
|
|
48
|
+
command: 'vip whoami',
|
|
49
|
+
};
|
|
50
|
+
await (0, tracker_1.trackEvent)('whoami_command_execute', trackingParams);
|
|
51
|
+
let currentUser;
|
|
52
|
+
try {
|
|
53
|
+
currentUser = await (0, user_1.getCurrentUserInfo)();
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
const error = err instanceof Error ? err : new Error('Unknown error');
|
|
57
|
+
await (0, tracker_1.trackEvent)('whoami_command_error', { ...trackingParams, error: error.message });
|
|
58
|
+
exit.withError(`Failed to fetch information about the currently logged-in user error: ${error.message}`);
|
|
59
|
+
}
|
|
60
|
+
await (0, tracker_1.trackEvent)('whoami_command_success', trackingParams);
|
|
61
|
+
const output = [
|
|
62
|
+
`- Howdy ${currentUser.displayName ?? 'user'}!`,
|
|
63
|
+
`- Your user ID is ${currentUser.id ?? ' not found'}`,
|
|
64
|
+
];
|
|
65
|
+
if (currentUser.isVIP) {
|
|
66
|
+
output.push('- Your account has VIP Staff permissions');
|
|
67
|
+
}
|
|
68
|
+
console.log(output.join('\n'));
|
|
35
69
|
}
|
|
36
|
-
void (0,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
70
|
+
void (0, command_1.default)({ usage: baseUsage })
|
|
71
|
+
.examples([
|
|
72
|
+
{
|
|
73
|
+
usage: baseUsage + '\n' + ' - Howdy user@example.com!\n' + ' - Your user ID is 1234\n',
|
|
74
|
+
description: 'Retrieve details about the current authenticated VIP-CLI user.',
|
|
75
|
+
},
|
|
76
|
+
])
|
|
77
|
+
.argv(process.argv, whoamiCommand);
|