@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,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const debug = (0,
|
|
9
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const debug_1 = __importDefault(require("debug"));
|
|
7
|
+
const env_1 = __importDefault(require("../env"));
|
|
8
|
+
const debug = (0, debug_1.default)('@automattic/vip:analytics');
|
|
10
9
|
/* eslint-disable camelcase */
|
|
11
10
|
const client_info = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
cli_version: env_1.default.app.version,
|
|
12
|
+
os_name: env_1.default.os.name,
|
|
13
|
+
os_version: env_1.default.os.version,
|
|
14
|
+
os_arch: env_1.default.os.arch,
|
|
15
|
+
node_version: env_1.default.node.version,
|
|
16
16
|
};
|
|
17
17
|
/* eslint-enable camelcase */
|
|
18
|
-
|
|
19
18
|
class Analytics {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
client;
|
|
20
|
+
constructor(client) {
|
|
21
|
+
this.client = client;
|
|
22
|
+
}
|
|
23
|
+
async trackEvent(name, props = {}) {
|
|
24
|
+
if (process.env.DO_NOT_TRACK) {
|
|
25
|
+
debug(`trackEvent() for ${name} => skipping per DO_NOT_TRACK variable`);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return this.client.trackEvent(name, {
|
|
29
|
+
// eslint-disable-next-line camelcase
|
|
30
|
+
...client_info,
|
|
31
|
+
...props,
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
|
-
return Promise.all(this.clients.map(client => client.trackEvent(name, {
|
|
29
|
-
// eslint-disable-next-line camelcase
|
|
30
|
-
...client_info,
|
|
31
|
-
...props
|
|
32
|
-
})));
|
|
33
|
-
}
|
|
34
34
|
}
|
|
35
|
-
exports.default = Analytics;
|
|
35
|
+
exports.default = Analytics;
|
package/dist/lib/api/app.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = default_1;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const api_1 = __importDefault(require("../../lib/api"));
|
|
9
|
+
async function default_1(app, fields = 'id,name', fragments = '') {
|
|
10
|
+
const api = (0, api_1.default)();
|
|
11
|
+
if (isNaN(Number(app))) {
|
|
12
|
+
const res = await api.query({
|
|
13
|
+
query: (0, graphql_tag_1.default) `query App( $name: String ) {
|
|
13
14
|
apps( first: 1, name: $name ) {
|
|
14
15
|
total,
|
|
15
16
|
nextCursor,
|
|
@@ -19,34 +20,34 @@ async function _default(app, fields = 'id,name', fragments = '') {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
${fragments || ''}`,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
variables: {
|
|
24
|
+
name: app,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return res.data?.apps?.edges?.[0] ?? {};
|
|
28
|
+
}
|
|
29
|
+
if (typeof app === 'string') {
|
|
30
|
+
app = parseInt(app, 10);
|
|
31
|
+
}
|
|
32
|
+
const appQuery = {
|
|
33
|
+
query: (0, graphql_tag_1.default) `query App( $id: Int ) {
|
|
33
34
|
app( id: $id ){
|
|
34
35
|
${fields}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
${fragments || ''}`,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
const customDeployToken = process.env.WPVIP_DEPLOY_TOKEN;
|
|
43
|
-
if (customDeployToken) {
|
|
44
|
-
appQuery.context = {
|
|
45
|
-
headers: {
|
|
46
|
-
Authorization: `Bearer ${customDeployToken}`
|
|
47
|
-
}
|
|
39
|
+
variables: {
|
|
40
|
+
id: app,
|
|
41
|
+
},
|
|
48
42
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
const customDeployToken = process.env.WPVIP_DEPLOY_TOKEN;
|
|
44
|
+
if (customDeployToken) {
|
|
45
|
+
appQuery.context = {
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${customDeployToken}`,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const res = await api.query(appQuery);
|
|
52
|
+
return res.data?.app ?? {};
|
|
53
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
6
|
exports.appQuery = void 0;
|
|
5
7
|
exports.purgeCache = purgeCache;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const mutation = (0, _graphqlTag.default)`
|
|
8
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
9
|
+
const api_1 = __importDefault(require("../../lib/api"));
|
|
10
|
+
const mutation = (0, graphql_tag_1.default) `
|
|
10
11
|
mutation PurgePageCacheMutation($appId: Int!, $envId: Int!, $urls: [String!]!) {
|
|
11
12
|
purgePageCache(input: { appId: $appId, environmentId: $envId, urls: $urls }) {
|
|
12
13
|
success
|
|
@@ -14,9 +15,8 @@ const mutation = (0, _graphqlTag.default)`
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
`;
|
|
17
|
-
|
|
18
18
|
// The subquery for environments lets users choose any environment, including production.
|
|
19
|
-
|
|
19
|
+
exports.appQuery = `
|
|
20
20
|
id
|
|
21
21
|
name
|
|
22
22
|
environments {
|
|
@@ -30,15 +30,12 @@ const appQuery = exports.appQuery = `
|
|
|
30
30
|
}
|
|
31
31
|
`;
|
|
32
32
|
async function purgeCache(appId, envId, urls) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
return response.data?.purgePageCache ?? null;
|
|
44
|
-
}
|
|
33
|
+
const api = (0, api_1.default)();
|
|
34
|
+
const variables = {
|
|
35
|
+
appId,
|
|
36
|
+
envId,
|
|
37
|
+
urls,
|
|
38
|
+
};
|
|
39
|
+
const response = await api.mutate({ mutation, variables });
|
|
40
|
+
return response.data?.purgePageCache ?? null;
|
|
41
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.
|
|
4
|
-
exports.PRODUCTION_API_HOST =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const API_URL = exports.API_URL = `${API_HOST}/graphql`;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_URL = exports.API_HOST = exports.PRODUCTION_API_HOST = void 0;
|
|
4
|
+
exports.PRODUCTION_API_HOST = 'https://api.wpvip.com';
|
|
5
|
+
exports.API_HOST = process.env.API_HOST || exports.PRODUCTION_API_HOST; // NOSONAR
|
|
6
|
+
exports.API_URL = `${exports.API_HOST}/graphql`;
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.appQuery = void 0;
|
|
5
|
-
exports.createEdgeWorker = createEdgeWorker;
|
|
6
|
-
exports.deleteEdgeWorker = deleteEdgeWorker;
|
|
7
|
-
exports.findEdgeWorkerByName = findEdgeWorkerByName;
|
|
8
|
-
exports.getEdgeWorker = getEdgeWorker;
|
|
9
|
-
exports.listEdgeWorkers = listEdgeWorkers;
|
|
10
|
-
exports.setEdgeWorkerActive = setEdgeWorkerActive;
|
|
11
|
-
exports.updateEdgeWorker = updateEdgeWorker;
|
|
12
|
-
exports.validateEdgeWorker = validateEdgeWorker;
|
|
13
|
-
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
14
|
-
var _api = _interopRequireDefault(require("../../lib/api"));
|
|
15
|
-
var _userError = _interopRequireDefault(require("../user-error"));
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
2
|
/**
|
|
18
3
|
* GraphQL access for edge workers.
|
|
19
4
|
*
|
|
@@ -25,9 +10,24 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
25
10
|
* NOTE: these types are hand-written rather than codegen'd because the edge
|
|
26
11
|
* worker schema is not part of the public schema bundle the codegen runs against.
|
|
27
12
|
*/
|
|
28
|
-
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.appQuery = void 0;
|
|
18
|
+
exports.listEdgeWorkers = listEdgeWorkers;
|
|
19
|
+
exports.getEdgeWorker = getEdgeWorker;
|
|
20
|
+
exports.findEdgeWorkerByName = findEdgeWorkerByName;
|
|
21
|
+
exports.createEdgeWorker = createEdgeWorker;
|
|
22
|
+
exports.updateEdgeWorker = updateEdgeWorker;
|
|
23
|
+
exports.validateEdgeWorker = validateEdgeWorker;
|
|
24
|
+
exports.setEdgeWorkerActive = setEdgeWorkerActive;
|
|
25
|
+
exports.deleteEdgeWorker = deleteEdgeWorker;
|
|
26
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
27
|
+
const api_1 = __importDefault(require("../../lib/api"));
|
|
28
|
+
const user_error_1 = __importDefault(require("../user-error"));
|
|
29
29
|
// Selector used by command.js for app/env context resolution.
|
|
30
|
-
|
|
30
|
+
exports.appQuery = `
|
|
31
31
|
id
|
|
32
32
|
name
|
|
33
33
|
environments {
|
|
@@ -54,45 +54,41 @@ const EDGE_WORKER_FIELDS = `
|
|
|
54
54
|
updatedAt
|
|
55
55
|
`;
|
|
56
56
|
function isObject(value) {
|
|
57
|
-
|
|
57
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
58
58
|
}
|
|
59
59
|
function invalidReadResponse() {
|
|
60
|
-
|
|
60
|
+
throw new user_error_1.default('EdgeWorkers query returned an invalid response.');
|
|
61
61
|
}
|
|
62
|
-
|
|
63
62
|
/**
|
|
64
63
|
* Extract the target environment's workers from a `environments(id:)`-filtered
|
|
65
64
|
* response, failing closed (UserError) on any malformed shape. The query filters
|
|
66
65
|
* by id server-side, so we take the single returned environment.
|
|
67
66
|
*/
|
|
68
67
|
function pickEnvWorkers(result) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
if (!isObject(result) || !isObject(result.app)) {
|
|
69
|
+
return invalidReadResponse();
|
|
70
|
+
}
|
|
71
|
+
const environments = result.app.environments;
|
|
72
|
+
if (!Array.isArray(environments)) {
|
|
73
|
+
return invalidReadResponse();
|
|
74
|
+
}
|
|
75
|
+
const env = environments[0];
|
|
76
|
+
if (!isObject(env) || !Array.isArray(env.edgeWorkers)) {
|
|
77
|
+
return invalidReadResponse();
|
|
78
|
+
}
|
|
79
|
+
return env.edgeWorkers;
|
|
81
80
|
}
|
|
82
81
|
function requireMutationPayload(operation, value) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
if (value === null || value === undefined) {
|
|
83
|
+
throw new user_error_1.default(`${operation} returned no result.`);
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
87
86
|
}
|
|
88
|
-
|
|
89
87
|
/** List the edge workers deployed to an environment without source. */
|
|
90
88
|
async function listEdgeWorkers(appId, envId) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const response = await api.query({
|
|
95
|
-
query: (0, _graphqlTag.default)`
|
|
89
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
90
|
+
const response = await api.query({
|
|
91
|
+
query: (0, graphql_tag_1.default) `
|
|
96
92
|
query EdgeWorkers($appId: Int!, $envId: Int!) {
|
|
97
93
|
app(id: $appId) {
|
|
98
94
|
environments(id: $envId) {
|
|
@@ -104,27 +100,21 @@ async function listEdgeWorkers(appId, envId) {
|
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
102
|
`,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
fetchPolicy: 'no-cache'
|
|
112
|
-
});
|
|
113
|
-
return pickEnvWorkers(response.data);
|
|
103
|
+
variables: { appId, envId },
|
|
104
|
+
fetchPolicy: 'no-cache',
|
|
105
|
+
});
|
|
106
|
+
return pickEnvWorkers(response.data);
|
|
114
107
|
}
|
|
115
|
-
|
|
116
108
|
/**
|
|
117
109
|
* Fetch a single worker by name. The schema has no single-worker query, so this
|
|
118
110
|
* requests the target environment's workers and matches by name. Source is
|
|
119
111
|
* fetched only when explicitly requested.
|
|
120
112
|
*/
|
|
121
113
|
async function getEdgeWorker(appId, envId, name, options = {}) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const response = await api.query({
|
|
127
|
-
query: (0, _graphqlTag.default)`
|
|
114
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
115
|
+
const fields = options.includeSource === true ? `${EDGE_WORKER_FIELDS}\nsource` : EDGE_WORKER_FIELDS;
|
|
116
|
+
const response = await api.query({
|
|
117
|
+
query: (0, graphql_tag_1.default) `
|
|
128
118
|
query EdgeWorkerDetail($appId: Int!, $envId: Int!) {
|
|
129
119
|
app(id: $appId) {
|
|
130
120
|
environments(id: $envId) {
|
|
@@ -136,73 +126,52 @@ async function getEdgeWorker(appId, envId, name, options = {}) {
|
|
|
136
126
|
}
|
|
137
127
|
}
|
|
138
128
|
`,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
fetchPolicy: 'no-cache'
|
|
144
|
-
});
|
|
145
|
-
return pickEnvWorkers(response.data).find(worker => worker.name === name) ?? null;
|
|
129
|
+
variables: { appId, envId },
|
|
130
|
+
fetchPolicy: 'no-cache',
|
|
131
|
+
});
|
|
132
|
+
return pickEnvWorkers(response.data).find(worker => worker.name === name) ?? null;
|
|
146
133
|
}
|
|
147
|
-
|
|
148
134
|
/** Find a deployed worker by name, or null. Used to reconcile create-vs-update. */
|
|
149
135
|
async function findEdgeWorkerByName(appId, envId, name) {
|
|
150
|
-
|
|
151
|
-
|
|
136
|
+
const workers = await listEdgeWorkers(appId, envId);
|
|
137
|
+
return workers.find(worker => worker.name === name) ?? null;
|
|
152
138
|
}
|
|
153
139
|
async function createEdgeWorker(envId, input) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const response = await api.mutate({
|
|
158
|
-
mutation: (0, _graphqlTag.default)`
|
|
140
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
141
|
+
const response = await api.mutate({
|
|
142
|
+
mutation: (0, graphql_tag_1.default) `
|
|
159
143
|
mutation CreateEdgeWorker($input: CreateEdgeWorkerInput!) {
|
|
160
144
|
createEdgeWorker(input: $input) {
|
|
161
145
|
${EDGE_WORKER_FIELDS}
|
|
162
146
|
}
|
|
163
147
|
}
|
|
164
148
|
`,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
...input
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
return requireMutationPayload('createEdgeWorker', response.data?.createEdgeWorker);
|
|
149
|
+
variables: { input: { environmentId: envId, ...input } },
|
|
150
|
+
});
|
|
151
|
+
return requireMutationPayload('createEdgeWorker', response.data?.createEdgeWorker);
|
|
173
152
|
}
|
|
174
153
|
async function updateEdgeWorker(envId, edgeWorkerId, input) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const response = await api.mutate({
|
|
179
|
-
mutation: (0, _graphqlTag.default)`
|
|
154
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
155
|
+
const response = await api.mutate({
|
|
156
|
+
mutation: (0, graphql_tag_1.default) `
|
|
180
157
|
mutation UpdateEdgeWorker($input: UpdateEdgeWorkerInput!) {
|
|
181
158
|
updateEdgeWorker(input: $input) {
|
|
182
159
|
${EDGE_WORKER_FIELDS}
|
|
183
160
|
}
|
|
184
161
|
}
|
|
185
162
|
`,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
edgeWorkerId,
|
|
190
|
-
...input
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
return requireMutationPayload('updateEdgeWorker', response.data?.updateEdgeWorker);
|
|
163
|
+
variables: { input: { environmentId: envId, edgeWorkerId, ...input } },
|
|
164
|
+
});
|
|
165
|
+
return requireMutationPayload('updateEdgeWorker', response.data?.updateEdgeWorker);
|
|
195
166
|
}
|
|
196
167
|
/**
|
|
197
168
|
* Server-side dry-run validation of a compiled worker. Persists nothing — used
|
|
198
169
|
* to fail fast before the real create/update upload.
|
|
199
170
|
*/
|
|
200
171
|
async function validateEdgeWorker(envId, wasmBinary) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const response = await api.mutate({
|
|
205
|
-
mutation: (0, _graphqlTag.default)`
|
|
172
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
173
|
+
const response = await api.mutate({
|
|
174
|
+
mutation: (0, graphql_tag_1.default) `
|
|
206
175
|
mutation ValidateEdgeWorker($input: ValidateEdgeWorkerInput!) {
|
|
207
176
|
validateEdgeWorker(input: $input) {
|
|
208
177
|
valid
|
|
@@ -211,55 +180,35 @@ async function validateEdgeWorker(envId, wasmBinary) {
|
|
|
211
180
|
}
|
|
212
181
|
}
|
|
213
182
|
`,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
wasmBinary
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
return requireMutationPayload('validateEdgeWorker', response.data?.validateEdgeWorker);
|
|
183
|
+
variables: { input: { environmentId: envId, wasmBinary } },
|
|
184
|
+
});
|
|
185
|
+
return requireMutationPayload('validateEdgeWorker', response.data?.validateEdgeWorker);
|
|
222
186
|
}
|
|
223
187
|
async function setEdgeWorkerActive(envId, edgeWorkerId, active) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const response = await api.mutate({
|
|
228
|
-
mutation: (0, _graphqlTag.default)`
|
|
188
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
189
|
+
const response = await api.mutate({
|
|
190
|
+
mutation: (0, graphql_tag_1.default) `
|
|
229
191
|
mutation SetEdgeWorkerActive($input: SetEdgeWorkerActiveInput!) {
|
|
230
192
|
setEdgeWorkerActive(input: $input) {
|
|
231
193
|
${EDGE_WORKER_FIELDS}
|
|
232
194
|
}
|
|
233
195
|
}
|
|
234
196
|
`,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
edgeWorkerId,
|
|
239
|
-
active
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
return requireMutationPayload('setEdgeWorkerActive', response.data?.setEdgeWorkerActive);
|
|
197
|
+
variables: { input: { environmentId: envId, edgeWorkerId, active } },
|
|
198
|
+
});
|
|
199
|
+
return requireMutationPayload('setEdgeWorkerActive', response.data?.setEdgeWorkerActive);
|
|
244
200
|
}
|
|
245
201
|
async function deleteEdgeWorker(envId, edgeWorkerId) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const response = await api.mutate({
|
|
250
|
-
mutation: (0, _graphqlTag.default)`
|
|
202
|
+
const api = (0, api_1.default)({ exitOnError: false });
|
|
203
|
+
const response = await api.mutate({
|
|
204
|
+
mutation: (0, graphql_tag_1.default) `
|
|
251
205
|
mutation DeleteEdgeWorker($input: DeleteEdgeWorkerInput!) {
|
|
252
206
|
deleteEdgeWorker(input: $input)
|
|
253
207
|
}
|
|
254
208
|
`,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
209
|
+
variables: { input: { environmentId: envId, edgeWorkerId } },
|
|
210
|
+
});
|
|
211
|
+
if (response.data?.deleteEdgeWorker !== true) {
|
|
212
|
+
throw new user_error_1.default('deleteEdgeWorker did not confirm deletion.');
|
|
260
213
|
}
|
|
261
|
-
|
|
262
|
-
if (response.data?.deleteEdgeWorker !== true) {
|
|
263
|
-
throw new _userError.default('deleteEdgeWorker did not confirm deletion.');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
214
|
+
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.safeGraphQLErrorDebugInfo = safeGraphQLErrorDebugInfo;
|
|
5
4
|
function safeGraphQLErrorDebugInfo(operation, errors) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
}
|
|
5
|
+
return errors.map(error => {
|
|
6
|
+
const code = error.extensions?.code;
|
|
7
|
+
return {
|
|
8
|
+
operation,
|
|
9
|
+
path: error.path ?? [],
|
|
10
|
+
...(typeof code === 'string' ? { code } : {}),
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
6
|
exports.get = get;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const api_1 = __importDefault(require("../../lib/api"));
|
|
8
9
|
// Lazy-initialize the API client so that this module can be imported during the
|
|
9
10
|
// rechallenge module chain without triggering a circular-dependency crash. The
|
|
10
11
|
// cycle that existed before this change:
|
|
@@ -14,14 +15,12 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
14
15
|
// evaluated before API() is invoked.
|
|
15
16
|
let api = null;
|
|
16
17
|
function getApi() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return api;
|
|
18
|
+
if (!api) {
|
|
19
|
+
api = (0, api_1.default)({ silenceAuthErrors: true });
|
|
20
|
+
}
|
|
21
|
+
return api;
|
|
23
22
|
}
|
|
24
|
-
const isVipQuery = (0,
|
|
23
|
+
const isVipQuery = (0, graphql_tag_1.default) `
|
|
25
24
|
query isVIP {
|
|
26
25
|
me {
|
|
27
26
|
isVIP
|
|
@@ -29,8 +28,8 @@ const isVipQuery = (0, _graphqlTag.default)`
|
|
|
29
28
|
}
|
|
30
29
|
`;
|
|
31
30
|
function get() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
31
|
+
return getApi().query({
|
|
32
|
+
query: isVipQuery,
|
|
33
|
+
fetchPolicy: 'cache-first',
|
|
34
|
+
});
|
|
35
|
+
}
|