@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.
Files changed (311) hide show
  1. package/assets/dev-env.lando.template.yml.ejs +1 -1
  2. package/dist/bin/vip-app-deploy-token-generate.js +110 -78
  3. package/dist/bin/vip-app-deploy-token.js +24 -16
  4. package/dist/bin/vip-app-deploy-validate.js +45 -41
  5. package/dist/bin/vip-app-deploy.js +222 -215
  6. package/dist/bin/vip-app-list.js +59 -43
  7. package/dist/bin/vip-app.js +97 -66
  8. package/dist/bin/vip-backup-db.js +36 -29
  9. package/dist/bin/vip-backup.js +16 -9
  10. package/dist/bin/vip-cache-purge-url.js +93 -55
  11. package/dist/bin/vip-cache.js +23 -14
  12. package/dist/bin/vip-config-envvar-delete.js +74 -73
  13. package/dist/bin/vip-config-envvar-get-all.js +68 -68
  14. package/dist/bin/vip-config-envvar-get.js +46 -46
  15. package/dist/bin/vip-config-envvar-list.js +54 -57
  16. package/dist/bin/vip-config-envvar-set.js +102 -96
  17. package/dist/bin/vip-config-envvar.js +38 -24
  18. package/dist/bin/vip-config-software-get.js +88 -75
  19. package/dist/bin/vip-config-software-update.js +116 -120
  20. package/dist/bin/vip-config-software.js +31 -21
  21. package/dist/bin/vip-config.js +25 -17
  22. package/dist/bin/vip-db-phpmyadmin.js +40 -39
  23. package/dist/bin/vip-db.js +13 -12
  24. package/dist/bin/vip-defensive-mode-configure.js +197 -197
  25. package/dist/bin/vip-defensive-mode-disable.js +43 -35
  26. package/dist/bin/vip-defensive-mode-enable.js +47 -38
  27. package/dist/bin/vip-defensive-mode.js +28 -17
  28. package/dist/bin/vip-dev-env-create.js +147 -104
  29. package/dist/bin/vip-dev-env-destroy.js +48 -39
  30. package/dist/bin/vip-dev-env-envvar-delete.js +60 -49
  31. package/dist/bin/vip-dev-env-envvar-get-all.js +52 -45
  32. package/dist/bin/vip-dev-env-envvar-get.js +48 -37
  33. package/dist/bin/vip-dev-env-envvar-list.js +48 -41
  34. package/dist/bin/vip-dev-env-envvar-set.js +83 -70
  35. package/dist/bin/vip-dev-env-envvar.js +38 -23
  36. package/dist/bin/vip-dev-env-exec.js +81 -74
  37. package/dist/bin/vip-dev-env-import-media.js +34 -26
  38. package/dist/bin/vip-dev-env-import-sql.js +65 -51
  39. package/dist/bin/vip-dev-env-import.js +23 -14
  40. package/dist/bin/vip-dev-env-info.js +59 -50
  41. package/dist/bin/vip-dev-env-list.js +34 -31
  42. package/dist/bin/vip-dev-env-logs.js +59 -49
  43. package/dist/bin/vip-dev-env-purge.js +71 -63
  44. package/dist/bin/vip-dev-env-shell.js +82 -71
  45. package/dist/bin/vip-dev-env-start.js +77 -65
  46. package/dist/bin/vip-dev-env-stop.js +80 -74
  47. package/dist/bin/vip-dev-env-sync-sql.js +80 -72
  48. package/dist/bin/vip-dev-env-sync.js +18 -11
  49. package/dist/bin/vip-dev-env-update.js +93 -84
  50. package/dist/bin/vip-dev-env.js +25 -8
  51. package/dist/bin/vip-edge-workers-build.js +82 -54
  52. package/dist/bin/vip-edge-workers-delete.js +84 -52
  53. package/dist/bin/vip-edge-workers-deploy.js +186 -126
  54. package/dist/bin/vip-edge-workers-disable.js +75 -44
  55. package/dist/bin/vip-edge-workers-enable.js +86 -54
  56. package/dist/bin/vip-edge-workers-get.js +108 -88
  57. package/dist/bin/vip-edge-workers-init.js +83 -53
  58. package/dist/bin/vip-edge-workers-list.js +89 -54
  59. package/dist/bin/vip-edge-workers-new.js +98 -69
  60. package/dist/bin/vip-edge-workers-validate.js +123 -82
  61. package/dist/bin/vip-edge-workers.js +19 -6
  62. package/dist/bin/vip-export-sql.js +75 -69
  63. package/dist/bin/vip-export.js +12 -7
  64. package/dist/bin/vip-import-media-abort.js +99 -73
  65. package/dist/bin/vip-import-media-status.js +83 -51
  66. package/dist/bin/vip-import-media.js +165 -166
  67. package/dist/bin/vip-import-sql-status.js +75 -45
  68. package/dist/bin/vip-import-sql.js +536 -596
  69. package/dist/bin/vip-import-validate-files.js +122 -141
  70. package/dist/bin/vip-import-validate-sql.js +52 -16
  71. package/dist/bin/vip-import.js +16 -7
  72. package/dist/bin/vip-logout.js +17 -13
  73. package/dist/bin/vip-logs.js +209 -183
  74. package/dist/bin/vip-search-replace.js +85 -53
  75. package/dist/bin/vip-slowlogs.js +168 -147
  76. package/dist/bin/vip-sync.js +163 -133
  77. package/dist/bin/vip-whoami.js +71 -35
  78. package/dist/bin/vip-wp.js +506 -549
  79. package/dist/bin/vip.js +161 -116
  80. package/dist/commands/backup-db.js +183 -149
  81. package/dist/commands/dev-env-import-sql.js +162 -117
  82. package/dist/commands/dev-env-sync-sql.js +372 -330
  83. package/dist/commands/export-sql.js +441 -425
  84. package/dist/commands/phpmyadmin.js +232 -212
  85. package/dist/commands/wp-ssh.js +218 -187
  86. package/dist/lib/analytics/clients/tracks.js +84 -91
  87. package/dist/lib/analytics/index.js +27 -27
  88. package/dist/lib/api/app.js +37 -36
  89. package/dist/lib/api/cache-purge.js +17 -20
  90. package/dist/lib/api/constants.js +5 -6
  91. package/dist/lib/api/edge-workers.js +84 -135
  92. package/dist/lib/api/error-debug.js +10 -13
  93. package/dist/lib/api/feature-flags.js +16 -17
  94. package/dist/lib/api/http.js +47 -48
  95. package/dist/lib/api/user.js +17 -18
  96. package/dist/lib/api.js +107 -116
  97. package/dist/lib/app-logs/app-logs.js +24 -25
  98. package/dist/lib/app-slowlogs/app-slowlogs.js +23 -24
  99. package/dist/lib/app-slowlogs/types.js +2 -1
  100. package/dist/lib/app.js +6 -8
  101. package/dist/lib/backup-storage-availability/backup-storage-availability.js +119 -119
  102. package/dist/lib/backup-storage-availability/docker-machine-not-found-error.js +5 -6
  103. package/dist/lib/cli/apiConfig.js +71 -41
  104. package/dist/lib/cli/command.js +1120 -873
  105. package/dist/lib/cli/config.js +29 -29
  106. package/dist/lib/cli/envAlias.js +35 -50
  107. package/dist/lib/cli/exit.js +19 -19
  108. package/dist/lib/cli/format.js +172 -172
  109. package/dist/lib/cli/progress.js +193 -236
  110. package/dist/lib/cli/prompt.js +14 -15
  111. package/dist/lib/cli/runtime-mode.js +5 -6
  112. package/dist/lib/client-file-uploader.js +489 -641
  113. package/dist/lib/config/software.js +206 -212
  114. package/dist/lib/constants/dev-environment.js +40 -37
  115. package/dist/lib/constants/file-size.js +6 -7
  116. package/dist/lib/constants/vipgo.js +24 -12
  117. package/dist/lib/custom-deploy/custom-deploy.js +138 -120
  118. package/dist/lib/database.js +88 -85
  119. package/dist/lib/defensive-mode/api.js +41 -46
  120. package/dist/lib/defensive-mode/cli-helpers.js +40 -40
  121. package/dist/lib/dev-environment/dev-environment-cli.js +776 -735
  122. package/dist/lib/dev-environment/dev-environment-configuration-file.js +224 -191
  123. package/dist/lib/dev-environment/dev-environment-core.js +697 -732
  124. package/dist/lib/dev-environment/dev-environment-database.js +57 -41
  125. package/dist/lib/dev-environment/dev-environment-lando.js +734 -666
  126. package/dist/lib/dev-environment/docker-utils.js +96 -90
  127. package/dist/lib/dev-environment/env-vars.js +61 -59
  128. package/dist/lib/dev-environment/lando-loader.js +6 -7
  129. package/dist/lib/dev-environment/types.js +2 -1
  130. package/dist/lib/edge-workers/confirmation.js +42 -36
  131. package/dist/lib/edge-workers/deployment.js +150 -159
  132. package/dist/lib/edge-workers/index.js +68 -85
  133. package/dist/lib/edge-workers/location.js +26 -26
  134. package/dist/lib/edge-workers/output.js +14 -15
  135. package/dist/lib/edge-workers/project.js +123 -132
  136. package/dist/lib/edge-workers/toolchains/assemblyscript/constants.js +6 -8
  137. package/dist/lib/edge-workers/toolchains/assemblyscript/index.js +100 -101
  138. package/dist/lib/edge-workers/toolchains/assemblyscript/templates.js +31 -33
  139. package/dist/lib/edge-workers/toolchains/index.js +15 -15
  140. package/dist/lib/edge-workers/types.js +10 -38
  141. package/dist/lib/edge-workers/validation.js +161 -150
  142. package/dist/lib/env.js +16 -17
  143. package/dist/lib/envvar/api-delete.js +16 -18
  144. package/dist/lib/envvar/api-get-all.js +15 -19
  145. package/dist/lib/envvar/api-get.js +8 -9
  146. package/dist/lib/envvar/api-list.js +16 -21
  147. package/dist/lib/envvar/api-set.js +20 -19
  148. package/dist/lib/envvar/api.js +34 -29
  149. package/dist/lib/envvar/input.js +29 -34
  150. package/dist/lib/envvar/logging.js +9 -11
  151. package/dist/lib/envvar/read-file.js +6 -7
  152. package/dist/lib/http/download-file.js +76 -44
  153. package/dist/lib/http/proxy-agent.js +37 -40
  154. package/dist/lib/http/proxy-dispatcher.js +69 -71
  155. package/dist/lib/keychain/insecure.js +40 -36
  156. package/dist/lib/keychain/keychain.js +2 -1
  157. package/dist/lib/keychain/secure.js +16 -15
  158. package/dist/lib/keychain.js +22 -22
  159. package/dist/lib/live-backup-copy.js +117 -115
  160. package/dist/lib/logout.js +17 -19
  161. package/dist/lib/media-import/config.js +15 -14
  162. package/dist/lib/media-import/media-file-import.js +9 -13
  163. package/dist/lib/media-import/progress.js +53 -65
  164. package/dist/lib/media-import/status.js +241 -256
  165. package/dist/lib/media-import/utils.js +15 -15
  166. package/dist/lib/node-version-check.js +16 -16
  167. package/dist/lib/promise.js +16 -17
  168. package/dist/lib/read-file.js +48 -16
  169. package/dist/lib/rechallenge/client.js +37 -43
  170. package/dist/lib/rechallenge/errors.js +38 -37
  171. package/dist/lib/rechallenge/flow.js +148 -123
  172. package/dist/lib/rechallenge/index.js +23 -24
  173. package/dist/lib/rechallenge/link.js +153 -151
  174. package/dist/lib/rechallenge/open-browser.js +14 -17
  175. package/dist/lib/rechallenge/token-cache.js +83 -86
  176. package/dist/lib/rechallenge/types.js +5 -14
  177. package/dist/lib/retry.js +93 -129
  178. package/dist/lib/search-and-replace.js +164 -148
  179. package/dist/lib/site-import/db-file-import.js +12 -16
  180. package/dist/lib/site-import/status.js +291 -291
  181. package/dist/lib/token.js +86 -87
  182. package/dist/lib/tracker.js +51 -62
  183. package/dist/lib/types/graphql/rate-limit-exceeded-error.js +2 -1
  184. package/dist/lib/types.js +2 -1
  185. package/dist/lib/user-error.js +6 -8
  186. package/dist/lib/utils.js +81 -87
  187. package/dist/lib/validations/custom-deploy.js +218 -186
  188. package/dist/lib/validations/is-multi-site-sql-dump.js +6 -6
  189. package/dist/lib/validations/is-multi-site.js +83 -50
  190. package/dist/lib/validations/is-multisite-domain-mapped.js +92 -62
  191. package/dist/lib/validations/line-by-line.js +78 -46
  192. package/dist/lib/validations/site-type.js +59 -63
  193. package/dist/lib/validations/sql-insert-parser.js +415 -0
  194. package/dist/lib/validations/sql.js +551 -431
  195. package/dist/lib/validations/utils.js +27 -29
  196. package/dist/lib/vip-import-validate-files.js +481 -490
  197. package/dist/lib/wp/helpers.js +41 -45
  198. package/dist/lib/wp/readline.js +21 -57
  199. package/dist/lib/xdg-data.js +11 -12
  200. package/helpers/mark-cli-executable.js +9 -0
  201. package/node_modules/@apollo/client/CHANGELOG.md +10 -0
  202. package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs +5 -0
  203. package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs.map +1 -1
  204. package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs +2 -1
  205. package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  206. package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs +14 -2
  207. package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  208. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs +16 -0
  209. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs.map +1 -1
  210. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.d.cts +2 -0
  211. package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs +3 -2
  212. package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  213. package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs +9 -1
  214. package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs.map +1 -1
  215. package/node_modules/@apollo/client/__cjs/core/QueryInfo.d.cts +1 -1
  216. package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs +10 -3
  217. package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs.map +1 -1
  218. package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.cjs.map +1 -1
  219. package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.d.cts +42 -43
  220. package/node_modules/@apollo/client/__cjs/version.cjs +1 -1
  221. package/node_modules/@apollo/client/cache/inmemory/helpers.js +5 -0
  222. package/node_modules/@apollo/client/cache/inmemory/helpers.js.map +1 -1
  223. package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js +2 -1
  224. package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map +1 -1
  225. package/node_modules/@apollo/client/cache/inmemory/key-extractor.js +14 -2
  226. package/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map +1 -1
  227. package/node_modules/@apollo/client/cache/inmemory/policies.d.ts +2 -0
  228. package/node_modules/@apollo/client/cache/inmemory/policies.js +17 -1
  229. package/node_modules/@apollo/client/cache/inmemory/policies.js.map +1 -1
  230. package/node_modules/@apollo/client/cache/inmemory/writeToStore.js +3 -2
  231. package/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map +1 -1
  232. package/node_modules/@apollo/client/core/QueryInfo.d.ts +1 -1
  233. package/node_modules/@apollo/client/core/QueryInfo.js +10 -2
  234. package/node_modules/@apollo/client/core/QueryInfo.js.map +1 -1
  235. package/node_modules/@apollo/client/core/QueryManager.js +10 -3
  236. package/node_modules/@apollo/client/core/QueryManager.js.map +1 -1
  237. package/node_modules/@apollo/client/package.json +1 -1
  238. package/node_modules/@apollo/client/react/hooks/useFragment.d.ts +42 -43
  239. package/node_modules/@apollo/client/react/hooks/useFragment.js.map +1 -1
  240. package/node_modules/@apollo/client/react/hooks-compiled/useFragment.d.ts +42 -43
  241. package/node_modules/@apollo/client/react/hooks-compiled/useFragment.js.map +1 -1
  242. package/node_modules/@apollo/client/version.js +1 -1
  243. package/node_modules/@automattic/vip-search-replace/README.md +6 -1
  244. package/node_modules/@automattic/vip-search-replace/lib/index.js +46 -14
  245. package/node_modules/@automattic/vip-search-replace/package.json +1 -1
  246. package/node_modules/@types/node/README.md +1 -1
  247. package/node_modules/@types/node/package.json +2 -2
  248. package/node_modules/@types/node/zlib.d.ts +752 -0
  249. package/node_modules/check-disk-space/README.md +92 -32
  250. package/node_modules/check-disk-space/dist/check-disk-space.d.mts +58 -0
  251. package/node_modules/check-disk-space/dist/check-disk-space.mjs +170 -190
  252. package/node_modules/check-disk-space/package.json +43 -71
  253. package/node_modules/cpu-features/build/Makefile +2 -2
  254. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o.d +1 -1
  255. 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
  256. 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
  257. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_windows.o.d +1 -1
  258. 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
  259. 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
  260. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o.d +1 -1
  261. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o.d +1 -1
  262. 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
  263. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o.d +1 -1
  264. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o.d +1 -1
  265. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o.d +1 -1
  266. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o.d +1 -1
  267. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpufeatures/src/binding.o.d +157 -145
  268. package/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
  269. package/node_modules/cpu-features/build/Release/obj.target/cpufeatures/src/binding.o +0 -0
  270. package/node_modules/cpu-features/build/Release/obj.target/cpufeatures.node +0 -0
  271. package/node_modules/cpu-features/build/config.gypi +100 -31
  272. package/node_modules/cpu-features/build/cpufeatures.target.mk +14 -14
  273. package/node_modules/cpu-features/build/deps/cpu_features/cpu_features.target.mk +14 -14
  274. package/node_modules/ssh2/lib/protocol/crypto/build/Makefile +2 -2
  275. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d.raw +136 -0
  276. package/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk +14 -14
  277. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  278. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  279. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  280. package/node_modules/undici/package.json +3 -3
  281. package/node_modules/undici/types/api.d.ts +1 -1
  282. package/node_modules/undici/types/utility.d.ts +4 -4
  283. package/package.json +44 -13
  284. package/dist/lib/analytics/clients/client.js +0 -1
  285. package/dist/lib/analytics/clients/pendo.js +0 -78
  286. package/helpers/check-version.js +0 -16
  287. package/node_modules/check-disk-space/dist/check-disk-space.cjs +0 -210
  288. package/node_modules/check-disk-space/dist/check-disk-space.d.ts +0 -53
  289. package/node_modules/fetch-retry/.eslintignore +0 -1
  290. package/node_modules/fetch-retry/.eslintrc.yml +0 -20
  291. package/node_modules/fetch-retry/.github/workflows/node.js.yml +0 -32
  292. package/node_modules/fetch-retry/.husky/pre-commit +0 -6
  293. package/node_modules/fetch-retry/.nycrc.json +0 -24
  294. package/node_modules/fetch-retry/.travis.yml +0 -3
  295. package/node_modules/fetch-retry/LICENSE +0 -21
  296. package/node_modules/fetch-retry/README.md +0 -128
  297. package/node_modules/fetch-retry/dist/fetch-retry.umd.js +0 -151
  298. package/node_modules/fetch-retry/index.d.ts +0 -29
  299. package/node_modules/fetch-retry/index.js +0 -143
  300. package/node_modules/fetch-retry/package.json +0 -41
  301. package/node_modules/fetch-retry/rollup.config.js +0 -12
  302. package/node_modules/fetch-retry/test/.eslintrc.yml +0 -7
  303. package/node_modules/fetch-retry/test/integration/index.js +0 -212
  304. package/node_modules/fetch-retry/test/integration/mock-api/index.js +0 -42
  305. package/node_modules/fetch-retry/test/unit/index.js +0 -1169
  306. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d +0 -265
  307. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d +0 -1
  308. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d +0 -1
  309. package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o +0 -0
  310. package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node +0 -0
  311. package/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
@@ -1,110 +1,116 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
- exports.__esModule = true;
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.setEnvVarCommand = setEnvVarCommand;
6
- var _chalk = _interopRequireDefault(require("chalk"));
7
- var _command = _interopRequireDefault(require("../lib/cli/command"));
8
- var _format = require("../lib/cli/format");
9
- var _api = require("../lib/envvar/api");
10
- var _input = require("../lib/envvar/input");
11
- var _logging = require("../lib/envvar/logging");
12
- var _readFile = require("../lib/envvar/read-file");
13
- var _tracker = require("../lib/tracker");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const command_1 = __importDefault(require("../lib/cli/command"));
10
+ const format_1 = require("../lib/cli/format");
11
+ const api_1 = require("../lib/envvar/api");
12
+ const input_1 = require("../lib/envvar/input");
13
+ const logging_1 = require("../lib/envvar/logging");
14
+ const read_file_1 = require("../lib/envvar/read-file");
15
+ const tracker_1 = require("../lib/tracker");
15
16
  const baseUsage = 'vip config envvar set';
16
17
  const exampleUsage = 'vip @example-app.develop config envvar set';
17
18
  const NEW_RELIC_ENVVAR_KEY = 'NEW_RELIC_LICENSE_KEY';
18
-
19
19
  // Command examples
20
- const examples = [{
21
- usage: `${exampleUsage} MY_VARIABLE`,
22
- description: 'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.'
23
- }, {
24
- usage: `${exampleUsage} MULTILINE_ENV_VAR --from-file=envvar-value.txt`,
25
- description: 'Add or update the environment variable "MULTILINE_ENV_VAR" and assign the multiline contents of local file envvar-value.txt as its value.'
26
- }];
20
+ const examples = [
21
+ {
22
+ usage: `${exampleUsage} MY_VARIABLE`,
23
+ description: 'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.',
24
+ },
25
+ {
26
+ usage: `${exampleUsage} MULTILINE_ENV_VAR --from-file=envvar-value.txt`,
27
+ description: 'Add or update the environment variable "MULTILINE_ENV_VAR" and assign the multiline contents of local file envvar-value.txt as its value.',
28
+ },
29
+ ];
27
30
  async function setEnvVarCommand(arg, opt) {
28
- // Help the user by uppercasing input.
29
- const name = arg[0].trim().toUpperCase();
30
- const trackingParams = {
31
- app_id: opt.app.id,
32
- command: `${baseUsage} ${name}`,
33
- env_id: opt.env.id,
34
- from_file: Boolean(opt.fromFile),
35
- org_id: opt.app.organization.id,
36
- org_sfid: opt.app.organization.salesforceId,
37
- skip_confirm: Boolean(opt.skipConfirmation),
38
- variable_name: name
39
- };
40
- const envName = opt.env.type;
41
- const appName = opt.app.name;
42
- if (!opt.skipConfirmation && envName === 'production') {
43
- const yes = await (0, _input.confirm)(`Are you sure you want to set the environment variable ${name} on ${(0, _format.formatEnvironment)(envName)} for site ${appName}?`);
44
- if (!yes) {
45
- (0, _tracker.trackEvent)('wpcli_confirm_cancel', trackingParams).catch(() => {});
46
- console.log('Command cancelled');
47
- process.exit();
31
+ // Help the user by uppercasing input.
32
+ const name = arg[0].trim().toUpperCase();
33
+ const trackingParams = {
34
+ app_id: opt.app.id,
35
+ command: `${baseUsage} ${name}`,
36
+ env_id: opt.env.id,
37
+ from_file: Boolean(opt.fromFile),
38
+ org_id: opt.app.organization.id,
39
+ org_sfid: opt.app.organization.salesforceId,
40
+ skip_confirm: Boolean(opt.skipConfirmation),
41
+ variable_name: name,
42
+ };
43
+ const envName = opt.env.type;
44
+ const appName = opt.app.name;
45
+ if (!opt.skipConfirmation && envName === 'production') {
46
+ const yes = await (0, input_1.confirm)(`Are you sure you want to set the environment variable ${name} on ${(0, format_1.formatEnvironment)(envName)} for site ${appName}?`);
47
+ if (!yes) {
48
+ (0, tracker_1.trackEvent)('wpcli_confirm_cancel', trackingParams).catch(() => { });
49
+ console.log('Command cancelled');
50
+ process.exit();
51
+ }
48
52
  }
49
- }
50
- (0, _logging.debug)(`Request: Set environment variable ${JSON.stringify(name)} for ${(0, _logging.getEnvContext)(opt.app, opt.env)}`);
51
- await (0, _tracker.trackEvent)('envvar_set_command_execute', trackingParams);
52
- if (!(0, _api.validateNameWithMessage)(name)) {
53
- await (0, _tracker.trackEvent)('envvar_set_invalid_name', trackingParams);
54
- process.exit(1);
55
- }
56
- if (NEW_RELIC_ENVVAR_KEY === name) {
57
- await (0, _tracker.trackEvent)('envvar_set_newrelic_key', trackingParams);
58
- console.log(_chalk.default.bold.red('Setting the New Relic key is not permitted.'), 'If you want to set your own New Relic key, please contact WordPress VIP support.');
59
- process.exit(1);
60
- }
61
- let value;
62
- if (opt.fromFile) {
63
- value = await (0, _readFile.readVariableFromFile)(opt.fromFile);
64
- } else {
65
- console.log(`For multiline input, use the ${_chalk.default.bold('--from-file')} option.`);
66
- console.log();
67
- value = await (0, _input.promptForValue)(`Enter the value for ${name}:`).catch(async () => {
68
- await (0, _tracker.trackEvent)('envvar_set_user_cancelled_input', trackingParams);
69
- (0, _input.cancel)();
70
- });
71
- }
72
- if (!opt.skipConfirmation) {
73
- // Print input if it was loaded from file.
53
+ (0, logging_1.debug)(`Request: Set environment variable ${JSON.stringify(name)} for ${(0, logging_1.getEnvContext)(opt.app, opt.env)}`);
54
+ await (0, tracker_1.trackEvent)('envvar_set_command_execute', trackingParams);
55
+ if (!(0, api_1.validateNameWithMessage)(name)) {
56
+ await (0, tracker_1.trackEvent)('envvar_set_invalid_name', trackingParams);
57
+ process.exit(1);
58
+ }
59
+ if (NEW_RELIC_ENVVAR_KEY === name) {
60
+ await (0, tracker_1.trackEvent)('envvar_set_newrelic_key', trackingParams);
61
+ console.log(chalk_1.default.bold.red('Setting the New Relic key is not permitted.'), 'If you want to set your own New Relic key, please contact WordPress VIP support.');
62
+ process.exit(1);
63
+ }
64
+ let value;
74
65
  if (opt.fromFile) {
75
- console.log('===== Received value printed below =====');
76
- console.log(value);
77
- console.log('===== Received value printed above =====');
78
- console.log();
66
+ value = await (0, read_file_1.readVariableFromFile)(opt.fromFile);
67
+ }
68
+ else {
69
+ console.log(`For multiline input, use the ${chalk_1.default.bold('--from-file')} option.`);
70
+ console.log();
71
+ value = await (0, input_1.promptForValue)(`Enter the value for ${name}:`).catch(async () => {
72
+ await (0, tracker_1.trackEvent)('envvar_set_user_cancelled_input', trackingParams);
73
+ (0, input_1.cancel)();
74
+ });
79
75
  }
80
- if (!(await (0, _input.confirm)(`Please ${_chalk.default.bold('confirm')} the input value above`))) {
81
- await (0, _tracker.trackEvent)('envvar_set_user_cancelled_confirmation', trackingParams);
82
- (0, _input.cancel)();
76
+ if (!opt.skipConfirmation) {
77
+ // Print input if it was loaded from file.
78
+ if (opt.fromFile) {
79
+ console.log('===== Received value printed below =====');
80
+ console.log(value);
81
+ console.log('===== Received value printed above =====');
82
+ console.log();
83
+ }
84
+ if (!(await (0, input_1.confirm)(`Please ${chalk_1.default.bold('confirm')} the input value above`))) {
85
+ await (0, tracker_1.trackEvent)('envvar_set_user_cancelled_confirmation', trackingParams);
86
+ (0, input_1.cancel)();
87
+ }
83
88
  }
84
- }
85
- let reloadManifest = false;
86
- if (!opt.skipConfirmation) {
87
- reloadManifest = await (0, _input.promptForReloadManifest)(opt.app.typeId);
88
- }
89
- await (0, _api.setEnvVar)(opt.app.id, opt.env.id, name, value, reloadManifest).catch(async err => {
90
- await (0, _tracker.trackEvent)('envvar_set_mutation_error', {
91
- ...trackingParams,
92
- error: err.message
89
+ let reloadManifest = false;
90
+ if (!opt.skipConfirmation) {
91
+ reloadManifest = await (0, input_1.promptForReloadManifest)(opt.app.typeId);
92
+ }
93
+ await (0, api_1.setEnvVar)(opt.app.id, opt.env.id, name, value, reloadManifest).catch(async (err) => {
94
+ await (0, tracker_1.trackEvent)('envvar_set_mutation_error', { ...trackingParams, error: err.message });
95
+ throw err;
93
96
  });
94
- throw err;
95
- });
96
- await (0, _tracker.trackEvent)('envvar_set_command_success', trackingParams);
97
- console.log(_chalk.default.green(`Successfully set environment variable ${JSON.stringify(name)}`));
98
- if (reloadManifest) {
99
- console.log(_chalk.default.yellow('Environment variable is active and available.'));
100
- } else if (!opt.skipConfirmation) {
101
- (0, _input.showDeployWarning)();
102
- }
97
+ await (0, tracker_1.trackEvent)('envvar_set_command_success', trackingParams);
98
+ console.log(chalk_1.default.green(`Successfully set environment variable ${JSON.stringify(name)}`));
99
+ if (reloadManifest) {
100
+ console.log(chalk_1.default.yellow('Environment variable is active and available.'));
101
+ }
102
+ else if (!opt.skipConfirmation) {
103
+ (0, input_1.showDeployWarning)();
104
+ }
103
105
  }
104
- (0, _command.default)({
105
- appContext: true,
106
- appQuery: _api.appQuery,
107
- envContext: true,
108
- requiredArgs: 1,
109
- usage: `${baseUsage} <VARIABLE_NAME>`
110
- }).option('from-file', 'Read environment variable value from a UTF-8-encoded text file (useful for multiline input). Accepts a relative or absolute path.').option('skip-confirmation', 'Skip the confirmation prompt (USE WITH CAUTION).', false).examples(examples).argv(process.argv, setEnvVarCommand);
106
+ (0, command_1.default)({
107
+ appContext: true,
108
+ appQuery: api_1.appQuery,
109
+ envContext: true,
110
+ requiredArgs: 1,
111
+ usage: `${baseUsage} <VARIABLE_NAME>`,
112
+ })
113
+ .option('from-file', 'Read environment variable value from a UTF-8-encoded text file (useful for multiline input). Accepts a relative or absolute path.')
114
+ .option('skip-confirmation', 'Skip the confirmation prompt (USE WITH CAUTION).', false)
115
+ .examples(examples)
116
+ .argv(process.argv, setEnvVarCommand);
@@ -1,29 +1,43 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
- var _command = _interopRequireDefault(require("../lib/cli/command"));
5
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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 command_1 = __importDefault(require("../lib/cli/command"));
6
8
  const usage = 'vip config envvar';
7
9
  const exampleUsage = 'vip @example-app.develop config envvar';
8
-
9
10
  // Command examples
10
- const examples = [{
11
- usage: `${exampleUsage} set MY_VARIABLE`,
12
- description: 'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.'
13
- }, {
14
- usage: `${exampleUsage} get MY_VARIABLE`,
15
- description: 'Retrieve the value of the environment variable "MY_VARIABLE".'
16
- }, {
17
- usage: `${exampleUsage} get-all`,
18
- description: 'Retrieve a list of all environment variables in the default table format.'
19
- }, {
20
- usage: `${exampleUsage} list`,
21
- description: 'List the names of all environment variables.'
22
- }, {
23
- usage: `${exampleUsage} delete MY_VARIABLE`,
24
- description: 'Delete the environment variable "MY_VARIABLE" from the environment.'
25
- }];
26
- (0, _command.default)({
27
- requiredArgs: 0,
28
- usage
29
- }).command('delete', 'Delete an environment variable.').command('get', 'Retrieve the value of an environment variable.').command('get-all', 'Retrieve the names and values of all environment variables.').command('list', 'List the names of all environment variables.').command('set', 'Add or update an environment variable.').examples(examples).argv(process.argv);
11
+ const examples = [
12
+ {
13
+ usage: `${exampleUsage} set MY_VARIABLE`,
14
+ description: 'Add or update the environment variable "MY_VARIABLE" and assign its value at the prompt.',
15
+ },
16
+ {
17
+ usage: `${exampleUsage} get MY_VARIABLE`,
18
+ description: 'Retrieve the value of the environment variable "MY_VARIABLE".',
19
+ },
20
+ {
21
+ usage: `${exampleUsage} get-all`,
22
+ description: 'Retrieve a list of all environment variables in the default table format.',
23
+ },
24
+ {
25
+ usage: `${exampleUsage} list`,
26
+ description: 'List the names of all environment variables.',
27
+ },
28
+ {
29
+ usage: `${exampleUsage} delete MY_VARIABLE`,
30
+ description: 'Delete the environment variable "MY_VARIABLE" from the environment.',
31
+ },
32
+ ];
33
+ (0, command_1.default)({
34
+ requiredArgs: 0,
35
+ usage,
36
+ })
37
+ .command('delete', 'Delete an environment variable.')
38
+ .command('get', 'Retrieve the value of an environment variable.')
39
+ .command('get-all', 'Retrieve the names and values of all environment variables.')
40
+ .command('list', 'List the names of all environment variables.')
41
+ .command('set', 'Add or update an environment variable.')
42
+ .examples(examples)
43
+ .argv(process.argv);
@@ -1,86 +1,99 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
- var _command = _interopRequireDefault(require("../lib/cli/command"));
5
- var _format = require("../lib/cli/format");
6
- var _software = require("../lib/config/software");
7
- var _tracker = require("../lib/tracker");
8
- var _userError = _interopRequireDefault(require("../lib/user-error"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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 command_1 = __importDefault(require("../lib/cli/command"));
8
+ const format_1 = require("../lib/cli/format");
9
+ const software_1 = require("../lib/config/software");
10
+ const tracker_1 = require("../lib/tracker");
11
+ const user_error_1 = __importDefault(require("../lib/user-error"));
10
12
  const usage = 'vip config software get <wordpress|php|nodejs|muplugins>';
11
13
  const exampleUsage = 'vip @example-app.develop config software get';
12
14
  const exampleUsageNode = 'vip @example-node-app.develop config software get';
13
-
14
15
  // Command examples
15
- const examples = [{
16
- usage: exampleUsage,
17
- description: 'Retrieve a list of the current versions of all environment software in the default table format.'
18
- }, {
19
- usage: `${exampleUsage} --format=csv`,
20
- description: 'Retrieve a list of the current versions of all environment software in CSV format.'
21
- }, {
22
- usage: `${exampleUsage} wordpress --include=available_versions`,
23
- description: 'Retrieve the current version of WordPress for a WordPress environment and a list of available versions in the default table format.'
24
- }, {
25
- usage: `${exampleUsage} php --include=available_versions`,
26
- description: 'Retrieve the current version of PHP for a WordPress environment and a list of available versions in the default table format.'
27
- }, {
28
- usage: `${exampleUsageNode} nodejs --include=available_versions --format=json`,
29
- description: 'Retrieve the current version of Node.js for a Node.js environment and a list of available versions in JSON format.'
30
- }];
16
+ const examples = [
17
+ {
18
+ usage: exampleUsage,
19
+ description: 'Retrieve a list of the current versions of all environment software in the default table format.',
20
+ },
21
+ {
22
+ usage: `${exampleUsage} --format=csv`,
23
+ description: 'Retrieve a list of the current versions of all environment software in CSV format.',
24
+ },
25
+ {
26
+ usage: `${exampleUsage} wordpress --include=available_versions`,
27
+ description: 'Retrieve the current version of WordPress for a WordPress environment and a list of available versions in the default table format.',
28
+ },
29
+ {
30
+ usage: `${exampleUsage} php --include=available_versions`,
31
+ description: 'Retrieve the current version of PHP for a WordPress environment and a list of available versions in the default table format.',
32
+ },
33
+ {
34
+ usage: `${exampleUsageNode} nodejs --include=available_versions --format=json`,
35
+ description: 'Retrieve the current version of Node.js for a Node.js environment and a list of available versions in JSON format.',
36
+ },
37
+ ];
31
38
  const VALID_INCLUDES = ['available_versions'];
32
- (0, _command.default)({
33
- appContext: true,
34
- appQuery: _software.appQuery,
35
- appQueryFragments: _software.appQueryFragments,
36
- envContext: true,
37
- wildcardCommand: true,
38
- format: true,
39
- usage
40
- }).option('include', `Retrieve additional data of a specific type. Supported values: ${VALID_INCLUDES.join(',')}`).examples(examples).argv(process.argv, async (arg, opt) => {
41
- const trackingInfo = {
42
- environment_id: opt.env?.id,
43
- args: JSON.stringify(arg)
44
- };
45
- await (0, _tracker.trackEvent)('config_software_get_execute', trackingInfo);
46
- let include = [];
47
- if (opt.include) {
48
- if (Array.isArray(opt.include)) {
49
- include = opt.include;
50
- } else {
51
- include = [opt.include];
39
+ (0, command_1.default)({
40
+ appContext: true,
41
+ appQuery: software_1.appQuery,
42
+ appQueryFragments: software_1.appQueryFragments,
43
+ envContext: true,
44
+ wildcardCommand: true,
45
+ format: true,
46
+ usage,
47
+ })
48
+ .option('include', `Retrieve additional data of a specific type. Supported values: ${VALID_INCLUDES.join(',')}`)
49
+ .examples(examples)
50
+ .argv(process.argv, async (arg, opt) => {
51
+ const trackingInfo = {
52
+ environment_id: opt.env?.id,
53
+ args: JSON.stringify(arg),
54
+ };
55
+ await (0, tracker_1.trackEvent)('config_software_get_execute', trackingInfo);
56
+ let include = [];
57
+ if (opt.include) {
58
+ if (Array.isArray(opt.include)) {
59
+ include = opt.include;
60
+ }
61
+ else {
62
+ include = [opt.include];
63
+ }
64
+ const invalidIncludes = include.filter(includeKey => !VALID_INCLUDES.includes(includeKey));
65
+ if (invalidIncludes.length > 0) {
66
+ throw new user_error_1.default(`Invalid include value(s): ${invalidIncludes.join(',')}`);
67
+ }
52
68
  }
53
- const invalidIncludes = include.filter(includeKey => !VALID_INCLUDES.includes(includeKey));
54
- if (invalidIncludes.length > 0) {
55
- throw new _userError.default(`Invalid include value(s): ${invalidIncludes.join(',')}`);
69
+ const { softwareSettings } = opt.env;
70
+ if (softwareSettings === null) {
71
+ throw new user_error_1.default('Software settings are not supported for this environment.');
56
72
  }
57
- }
58
- const {
59
- softwareSettings
60
- } = opt.env;
61
- if (softwareSettings === null) {
62
- throw new _userError.default('Software settings are not supported for this environment.');
63
- }
64
- let chosenSettings = [];
65
- if (arg.length > 0) {
66
- const component = arg[0];
67
- if (!softwareSettings[component]) {
68
- throw new _userError.default(`Software settings for ${component} are not supported for this environment.`);
73
+ let chosenSettings = [];
74
+ if (arg.length > 0) {
75
+ const component = arg[0];
76
+ if (!softwareSettings[component]) {
77
+ throw new user_error_1.default(`Software settings for ${component} are not supported for this environment.`);
78
+ }
79
+ chosenSettings = [softwareSettings[component]];
80
+ // Only `get php` asks for the running patch version, since Parker reads it from Kubernetes.
81
+ if (component === 'php') {
82
+ const runningVersion = await (0, software_1.getRunningPhpVersion)(opt.app.id, opt.env.id);
83
+ chosenSettings = [{ ...softwareSettings.php, runningVersion }];
84
+ }
69
85
  }
70
- chosenSettings = [softwareSettings[component]];
71
-
72
- // Only `get php` asks for the running patch version, since Parker reads it from Kubernetes.
73
- if (component === 'php') {
74
- const runningVersion = await (0, _software.getRunningPhpVersion)(opt.app.id, opt.env.id);
75
- chosenSettings = [{
76
- ...softwareSettings.php,
77
- runningVersion
78
- }];
86
+ else {
87
+ chosenSettings = [
88
+ softwareSettings.wordpress,
89
+ softwareSettings.php,
90
+ softwareSettings.muplugins,
91
+ softwareSettings.nodejs,
92
+ ];
79
93
  }
80
- } else {
81
- chosenSettings = [softwareSettings.wordpress, softwareSettings.php, softwareSettings.muplugins, softwareSettings.nodejs];
82
- }
83
- const preFormatted = chosenSettings.filter(softwareSetting => Boolean(softwareSetting)).map(softwareSetting => (0, _software.formatSoftwareSettings)(softwareSetting, include, opt.format));
84
- console.log((0, _format.formatData)(preFormatted, opt.format));
85
- await (0, _tracker.trackEvent)('config_software_get_success', trackingInfo);
86
- });
94
+ const preFormatted = chosenSettings
95
+ .filter(softwareSetting => Boolean(softwareSetting))
96
+ .map(softwareSetting => (0, software_1.formatSoftwareSettings)(softwareSetting, include, opt.format));
97
+ console.log((0, format_1.formatData)(preFormatted, opt.format));
98
+ await (0, tracker_1.trackEvent)('config_software_get_success', trackingInfo);
99
+ });