@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,22 +1,52 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
5
39
  exports.importSqlCheckStatus = importSqlCheckStatus;
6
- var _chalk = _interopRequireDefault(require("chalk"));
7
- var _debug = _interopRequireDefault(require("debug"));
8
- var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
9
- var _dbFileImport = require("./db-file-import");
10
- var _api = _interopRequireDefault(require("../../lib/api"));
11
- var exit = _interopRequireWildcard(require("../../lib/cli/exit"));
12
- var _format = require("../../lib/cli/format");
13
- 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); }
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- /* eslint-disable complexity */
16
-
17
- const debug = (0, _debug.default)('vip:lib/site-import/status');
40
+ const chalk_1 = __importDefault(require("chalk"));
41
+ const debug_1 = __importDefault(require("debug"));
42
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
43
+ const db_file_import_1 = require("./db-file-import");
44
+ const api_1 = __importDefault(require("../../lib/api"));
45
+ const exit = __importStar(require("../../lib/cli/exit"));
46
+ const format_1 = require("../../lib/cli/format");
47
+ const debug = (0, debug_1.default)('vip:lib/site-import/status');
18
48
  const IMPORT_SQL_PROGRESS_POLL_INTERVAL = 5000;
19
- const IMPORT_SQL_PROGRESS_QUERY = (0, _graphqlTag.default)`
49
+ const IMPORT_SQL_PROGRESS_QUERY = (0, graphql_tag_1.default) `
20
50
  query App($appId: Int, $envId: Int) {
21
51
  app(id: $appId) {
22
52
  environments(id: $envId) {
@@ -57,321 +87,291 @@ const IMPORT_SQL_PROGRESS_QUERY = (0, _graphqlTag.default)`
57
87
  }
58
88
  `;
59
89
  async function getStatus(api, appId, envId) {
60
- const response = await api.query({
61
- query: IMPORT_SQL_PROGRESS_QUERY,
62
- variables: {
63
- appId,
64
- envId
65
- },
66
- fetchPolicy: 'network-only'
67
- });
68
- const environments = response.data?.app?.environments ?? [];
69
- if (!environments.length) {
70
- throw new Error('Unable to determine import status from environment');
71
- }
72
- const environment = environments[0] ?? {};
73
- const {
74
- importStatus,
75
- jobs,
76
- launched
77
- } = environment;
78
- const [importJob] = jobs ?? [];
79
- return {
80
- importStatus,
81
- importJob,
82
- launched
83
- };
90
+ const response = await api.query({
91
+ query: IMPORT_SQL_PROGRESS_QUERY,
92
+ variables: { appId, envId },
93
+ fetchPolicy: 'network-only',
94
+ });
95
+ const environments = response.data?.app?.environments ?? [];
96
+ if (!environments.length) {
97
+ throw new Error('Unable to determine import status from environment');
98
+ }
99
+ const environment = environments[0] ?? {};
100
+ const { importStatus, jobs, launched } = environment;
101
+ const [importJob] = jobs ?? [];
102
+ return {
103
+ importStatus,
104
+ importJob,
105
+ launched,
106
+ };
84
107
  }
85
108
  function getErrorMessage(importFailed, launched = false) {
86
- debug({
87
- importFailed
88
- });
89
- const rollbackMessage = launched ? '' : `Your site is ${_chalk.default.blue('automatically being rolled back')} to the last backup prior to your import job.
109
+ debug({ importFailed });
110
+ const rollbackMessage = launched
111
+ ? ''
112
+ : `Your site is ${chalk_1.default.blue('automatically being rolled back')} to the last backup prior to your import job.
90
113
  `;
91
- let message = importFailed.error;
92
- if (importFailed.inImportProgress) {
93
- switch (importFailed.stepName) {
94
- case 'import_preflights':
95
- message += `
114
+ let message = importFailed.error;
115
+ if (importFailed.inImportProgress) {
116
+ switch (importFailed.stepName) {
117
+ case 'import_preflights':
118
+ message += `
96
119
  This error occurred prior to the mysql batch script processing of your SQL file.
97
120
 
98
121
  Your site content was not altered.
99
122
 
100
123
  If this error persists, please contact support.
101
124
  `;
102
- break;
103
- case 'importing_db':
104
- message += `
125
+ break;
126
+ case 'importing_db':
127
+ message += `
105
128
  This error occurred during the mysql batch script processing of your SQL file.
106
129
 
107
130
  ${rollbackMessage}`;
108
- if (importFailed.commandOutput) {
109
- const commandOutput = [].concat(importFailed.commandOutput).join(';');
110
- message += `
131
+ if (importFailed.commandOutput) {
132
+ const commandOutput = [].concat(importFailed.commandOutput).join(';');
133
+ message += `
111
134
  Please inspect your input file and make the appropriate corrections before trying again.
112
135
  The server said:
113
- > ${_chalk.default.red(commandOutput)}
136
+ > ${chalk_1.default.red(commandOutput)}
114
137
  `;
115
- } else {
116
- message += 'Please contact support and include this message along with your sql file.';
117
- }
118
- break;
119
- case 'validating_db':
120
- message += `\nThis error occurred during the post-import validation of the imported data.
138
+ }
139
+ else {
140
+ message += 'Please contact support and include this message along with your sql file.';
141
+ }
142
+ break;
143
+ case 'validating_db':
144
+ message += `\nThis error occurred during the post-import validation of the imported data.
121
145
 
122
146
  ${rollbackMessage}
123
147
  `;
124
- if (importFailed.commandOutput) {
125
- const commandOutput = [].concat(importFailed.commandOutput).join(';');
126
- message += `
148
+ if (importFailed.commandOutput) {
149
+ const commandOutput = [].concat(importFailed.commandOutput).join(';');
150
+ message += `
127
151
  Please inspect your input file and make the appropriate corrections before trying again.
128
152
  The server said:
129
- > ${_chalk.default.red(commandOutput)}
153
+ > ${chalk_1.default.red(commandOutput)}
130
154
  `;
131
- } else {
132
- message += 'Please contact support and include this message along with your sql file.';
133
- }
134
- break;
135
- case 'update_primary_domain':
136
- message += `\nThis error occurred during the update of the primary domain.
155
+ }
156
+ else {
157
+ message += 'Please contact support and include this message along with your sql file.';
158
+ }
159
+ break;
160
+ case 'update_primary_domain':
161
+ message += `\nThis error occurred during the update of the primary domain.
137
162
 
138
163
  ${rollbackMessage}
139
164
  `;
140
- if (importFailed.commandOutput) {
141
- const commandOutput = [].concat(importFailed.commandOutput).join(';');
142
- message += `
165
+ if (importFailed.commandOutput) {
166
+ const commandOutput = [].concat(importFailed.commandOutput).join(';');
167
+ message += `
143
168
  Please inspect your input file and make the appropriate corrections before trying again.
144
169
  The server said:
145
- > ${_chalk.default.red(commandOutput)}
170
+ > ${chalk_1.default.red(commandOutput)}
146
171
  `;
172
+ }
173
+ break;
174
+ default:
147
175
  }
148
- break;
149
- default:
150
176
  }
151
- }
152
- return message;
177
+ return message;
153
178
  }
154
- async function importSqlCheckStatus({
155
- app,
156
- env,
157
- progressTracker,
158
- shouldReturnMissingJobImmediately = false // we want to return fast only if we're checking the status via `vip import job status`
159
- }) {
160
- // Stop printing so we can pass our callback
161
- progressTracker.stopPrinting();
162
-
163
- // NO `console.log` in this function (until results are final)! It will break the progress printing.
164
- const api = (0, _api.default)();
165
- if (!(0, _dbFileImport.currentUserCanImportForApp)(app)) {
166
- throw new Error('The currently authenticated account does not have permission to view SQL import status.');
167
- }
168
- let createdAt;
169
- let completedAt;
170
- let overallStatus = 'Checking...';
171
- const setProgressTrackerSuffix = () => {
172
- const sprite = (0, _format.getGlyphForStatus)(overallStatus, progressTracker.runningSprite);
173
- const formattedCreatedAt = createdAt ? `${new Date(createdAt).toLocaleString()} (${createdAt})` : 'TBD';
174
- const formattedCompletedAt = createdAt && completedAt ? `${new Date(completedAt).toLocaleString()} (${completedAt})` : 'TBD';
175
- const exitPrompt = '(Press ^C to hide progress. The import will continue in the background.)';
176
- let statusMessage;
177
- switch (overallStatus) {
178
- case 'success':
179
- statusMessage = `Success ${sprite} imported data should be visible on your site ${env.primaryDomain?.name ?? 'N/A'}.`;
180
- break;
181
- case 'running':
182
- if (progressTracker.allStepsSucceeded()) {
183
- statusMessage = `Finishing up... ${sprite} `;
184
- break;
185
- }
186
- // Intentionally no break to get default case:
187
- // eslint-disable-next-line no-fallthrough
188
- default:
189
- statusMessage = `${(0, _format.capitalize)(overallStatus)} ${sprite}`;
179
+ async function importSqlCheckStatus({ app, env, progressTracker, shouldReturnMissingJobImmediately = false, // we want to return fast only if we're checking the status via `vip import job status`
180
+ }) {
181
+ // Stop printing so we can pass our callback
182
+ progressTracker.stopPrinting();
183
+ // NO `console.log` in this function (until results are final)! It will break the progress printing.
184
+ const api = (0, api_1.default)();
185
+ if (!(0, db_file_import_1.currentUserCanImportForApp)(app)) {
186
+ throw new Error('The currently authenticated account does not have permission to view SQL import status.');
190
187
  }
191
- const maybeExitPrompt = `${overallStatus === 'running' ? exitPrompt : ''}`;
192
- const jobCreateCompleteTimestamps = `
188
+ let createdAt;
189
+ let completedAt;
190
+ let overallStatus = 'Checking...';
191
+ const setProgressTrackerSuffix = () => {
192
+ const sprite = (0, format_1.getGlyphForStatus)(overallStatus, progressTracker.runningSprite);
193
+ const formattedCreatedAt = createdAt
194
+ ? `${new Date(createdAt).toLocaleString()} (${createdAt})`
195
+ : 'TBD';
196
+ const formattedCompletedAt = createdAt && completedAt
197
+ ? `${new Date(completedAt).toLocaleString()} (${completedAt})`
198
+ : 'TBD';
199
+ const exitPrompt = '(Press ^C to hide progress. The import will continue in the background.)';
200
+ let statusMessage;
201
+ switch (overallStatus) {
202
+ case 'success':
203
+ statusMessage = `Success ${sprite} imported data should be visible on your site ${env.primaryDomain?.name ?? 'N/A'}.`;
204
+ break;
205
+ case 'running':
206
+ if (progressTracker.allStepsSucceeded()) {
207
+ statusMessage = `Finishing up... ${sprite} `;
208
+ break;
209
+ }
210
+ // Intentionally no break to get default case:
211
+ // eslint-disable-next-line no-fallthrough
212
+ default:
213
+ statusMessage = `${(0, format_1.capitalize)(overallStatus)} ${sprite}`;
214
+ }
215
+ const maybeExitPrompt = `${overallStatus === 'running' ? exitPrompt : ''}`;
216
+ const jobCreateCompleteTimestamps = `
193
217
  SQL Import Started: ${formattedCreatedAt}
194
218
  SQL Import Completed: ${formattedCompletedAt}`;
195
- const maybeTimestamps = ['running', 'success', 'failed'].includes(overallStatus) ? jobCreateCompleteTimestamps : '';
196
- const suffix = `
219
+ const maybeTimestamps = ['running', 'success', 'failed'].includes(overallStatus)
220
+ ? jobCreateCompleteTimestamps
221
+ : '';
222
+ const suffix = `
197
223
  =============================================================
198
224
  Status: ${statusMessage}
199
- Site: ${app.name ?? 'N/A'} (${(0, _format.formatEnvironment)(env.type ?? 'N/A')})${maybeTimestamps}
225
+ Site: ${app.name ?? 'N/A'} (${(0, format_1.formatEnvironment)(env.type ?? 'N/A')})${maybeTimestamps}
200
226
  =============================================================
201
227
  ${maybeExitPrompt}
202
228
  `;
203
- progressTracker.suffix = suffix;
204
- };
205
- const setSuffixAndPrint = () => {
206
- setProgressTrackerSuffix();
207
- progressTracker.print();
208
- };
209
- progressTracker.startPrinting(setSuffixAndPrint);
210
- const getResults = () => new Promise((resolve, reject) => {
211
- const checkStatus = async () => {
212
- let status;
213
- try {
214
- status = await getStatus(api, app.id ?? -1, env.id ?? -1);
215
- } catch (error) {
216
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
217
- return reject({
218
- error
219
- });
220
- }
221
- const {
222
- importStatus,
223
- launched
224
- } = status;
225
- // we want the "vip import job status" command to fail fast if we have no import job.
226
- const isMissingImportJobAndShouldReturnFast = !status.importJob && shouldReturnMissingJobImmediately;
227
- let {
228
- importJob
229
- } = status;
230
- let jobStatus;
231
- let jobSteps = [];
232
- if (!isMissingImportJobAndShouldReturnFast) {
233
- // in the future the API may provide this in k8s jobs so account for that.
234
- // Until then we need to create the importJob from the status object.
235
- if (!importJob) {
236
- importJob = {};
237
- const statusSteps = importStatus?.progress?.steps;
238
- // if the progress meta isn't filled out yet, wait until it is.
239
- if (!statusSteps) {
240
- return setTimeout(() => {
241
- void checkStatus();
229
+ progressTracker.suffix = suffix;
230
+ };
231
+ const setSuffixAndPrint = () => {
232
+ setProgressTrackerSuffix();
233
+ progressTracker.print();
234
+ };
235
+ progressTracker.startPrinting(setSuffixAndPrint);
236
+ const getResults = () => new Promise((resolve, reject) => {
237
+ const checkStatus = async () => {
238
+ let status;
239
+ try {
240
+ status = await getStatus(api, app.id ?? -1, env.id ?? -1);
241
+ }
242
+ catch (error) {
243
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
244
+ return reject({ error });
245
+ }
246
+ const { importStatus, launched } = status;
247
+ // we want the "vip import job status" command to fail fast if we have no import job.
248
+ const isMissingImportJobAndShouldReturnFast = !status.importJob && shouldReturnMissingJobImmediately;
249
+ let { importJob } = status;
250
+ let jobStatus;
251
+ let jobSteps = [];
252
+ if (!isMissingImportJobAndShouldReturnFast) {
253
+ // in the future the API may provide this in k8s jobs so account for that.
254
+ // Until then we need to create the importJob from the status object.
255
+ if (!importJob) {
256
+ importJob = {};
257
+ const statusSteps = importStatus?.progress?.steps;
258
+ // if the progress meta isn't filled out yet, wait until it is.
259
+ if (!statusSteps) {
260
+ return setTimeout(() => {
261
+ void checkStatus();
262
+ }, IMPORT_SQL_PROGRESS_POLL_INTERVAL);
263
+ }
264
+ jobSteps = statusSteps.map(step => {
265
+ return {
266
+ id: step.name,
267
+ name: (0, format_1.capitalize)(step.name?.replace(/_/g, ' ')),
268
+ status: step.result,
269
+ };
270
+ });
271
+ if (statusSteps.some(({ result }) => result === 'failed') &&
272
+ !statusSteps.find(({ name, result }) => name === 'restore_db' && !result)) {
273
+ jobStatus = 'error';
274
+ }
275
+ else if (statusSteps.every(({ result }) => result === 'success')) {
276
+ jobStatus = 'success';
277
+ const timestamps = statusSteps
278
+ .map(step => step.finished_at)
279
+ .filter(Boolean);
280
+ importJob.completedAt = new Date(Math.max(...timestamps, 0) * 1000).toUTCString();
281
+ }
282
+ if (importStatus?.progress?.started_at) {
283
+ importJob.createdAt = new Date(importStatus.progress.started_at * 1000).toUTCString();
284
+ }
285
+ importJob.progress = { status: jobStatus, steps: jobSteps };
286
+ }
287
+ }
288
+ else if (!importJob) {
289
+ return resolve('No import job found');
290
+ }
291
+ jobStatus = importJob.progress?.status ?? 'unknown';
292
+ jobSteps = importJob.progress?.steps ?? [];
293
+ createdAt = importJob.createdAt;
294
+ completedAt = importJob.completedAt;
295
+ const { dbOperationInProgress, importInProgress, progress: importStepProgress, } = importStatus ?? {};
296
+ debug({
297
+ jobStatus,
298
+ completedAt,
299
+ createdAt,
300
+ dbOperationInProgress,
301
+ importInProgress,
302
+ importStepProgress,
303
+ });
304
+ const jobCreationTime = new Date(createdAt ?? '').getTime();
305
+ let failedImportStep;
306
+ if (!isNaN(jobCreationTime) &&
307
+ (importStepProgress?.started_at ?? 0) * 1000 >= jobCreationTime) {
308
+ // The contents of the `import_progress` meta are pertinent to the most recent import job
309
+ failedImportStep = importStepProgress?.steps?.find(step => step?.result === 'failed' &&
310
+ 1000 * (step.started_at ?? 0) > new Date(createdAt ?? '').getTime());
311
+ }
312
+ if (!jobSteps.length) {
313
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
314
+ return reject({ error: 'Could not enumerate the import job steps', launched });
315
+ }
316
+ if (failedImportStep) {
317
+ // The server marks the step as a success as per the host action, demote it to 'failed'
318
+ const _jobSteps = [...jobSteps];
319
+ const failedJobStepIndex = _jobSteps.findIndex(step => step?.id === 'import');
320
+ _jobSteps[failedJobStepIndex] = {
321
+ ..._jobSteps[failedJobStepIndex],
322
+ status: 'failed',
323
+ };
324
+ progressTracker.setStepsFromServer(_jobSteps);
325
+ overallStatus = 'failed';
326
+ setSuffixAndPrint();
327
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
328
+ return reject({
329
+ inImportProgress: true,
330
+ commandOutput: failedImportStep.output,
331
+ error: 'Import step failed',
332
+ stepName: failedImportStep.name,
333
+ launched,
334
+ });
335
+ }
336
+ progressTracker.setStepsFromServer(jobSteps);
337
+ setSuffixAndPrint();
338
+ if (jobStatus === 'error') {
339
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
340
+ return reject({ error: 'Import job failed', steps: jobSteps, launched });
341
+ }
342
+ if (jobStatus !== 'running' && completedAt) {
343
+ return resolve(importJob);
344
+ }
345
+ overallStatus = 'running';
346
+ setTimeout(() => {
347
+ void checkStatus();
242
348
  }, IMPORT_SQL_PROGRESS_POLL_INTERVAL);
243
- }
244
- jobSteps = statusSteps.map(step => {
245
- return {
246
- id: step.name,
247
- name: (0, _format.capitalize)(step.name?.replace(/_/g, ' ')),
248
- status: step.result
249
- };
250
- });
251
- if (statusSteps.some(({
252
- result
253
- }) => result === 'failed') && !statusSteps.find(({
254
- name,
255
- result
256
- }) => name === 'restore_db' && !result)) {
257
- jobStatus = 'error';
258
- } else if (statusSteps.every(({
259
- result
260
- }) => result === 'success')) {
261
- jobStatus = 'success';
262
- const timestamps = statusSteps.map(step => step.finished_at).filter(Boolean);
263
- importJob.completedAt = new Date(Math.max(...timestamps, 0) * 1000).toUTCString();
264
- }
265
- if (importStatus?.progress?.started_at) {
266
- importJob.createdAt = new Date(importStatus.progress.started_at * 1000).toUTCString();
267
- }
268
- importJob.progress = {
269
- status: jobStatus,
270
- steps: jobSteps
271
- };
272
- }
273
- } else if (!importJob) {
274
- return resolve('No import job found');
275
- }
276
- jobStatus = importJob.progress?.status ?? 'unknown';
277
- jobSteps = importJob.progress?.steps ?? [];
278
- createdAt = importJob.createdAt;
279
- completedAt = importJob.completedAt;
280
- const {
281
- dbOperationInProgress,
282
- importInProgress,
283
- progress: importStepProgress
284
- } = importStatus ?? {};
285
- debug({
286
- jobStatus,
287
- completedAt,
288
- createdAt,
289
- dbOperationInProgress,
290
- importInProgress,
291
- importStepProgress
292
- });
293
- const jobCreationTime = new Date(createdAt ?? '').getTime();
294
- let failedImportStep;
295
- if (!isNaN(jobCreationTime) && (importStepProgress?.started_at ?? 0) * 1000 >= jobCreationTime) {
296
- // The contents of the `import_progress` meta are pertinent to the most recent import job
297
- failedImportStep = importStepProgress?.steps?.find(step => step?.result === 'failed' && 1000 * (step.started_at ?? 0) > new Date(createdAt ?? '').getTime());
298
- }
299
- if (!jobSteps.length) {
300
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
301
- return reject({
302
- error: 'Could not enumerate the import job steps',
303
- launched
304
- });
305
- }
306
- if (failedImportStep) {
307
- // The server marks the step as a success as per the host action, demote it to 'failed'
308
- const _jobSteps = [...jobSteps];
309
- const failedJobStepIndex = _jobSteps.findIndex(step => step?.id === 'import');
310
- _jobSteps[failedJobStepIndex] = {
311
- ..._jobSteps[failedJobStepIndex],
312
- status: 'failed'
313
349
  };
314
- progressTracker.setStepsFromServer(_jobSteps);
315
- overallStatus = 'failed';
316
- setSuffixAndPrint();
317
-
318
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
319
- return reject({
320
- inImportProgress: true,
321
- commandOutput: failedImportStep.output,
322
- error: 'Import step failed',
323
- stepName: failedImportStep.name,
324
- launched
325
- });
326
- }
327
- progressTracker.setStepsFromServer(jobSteps);
328
- setSuffixAndPrint();
329
- if (jobStatus === 'error') {
330
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
331
- return reject({
332
- error: 'Import job failed',
333
- steps: jobSteps,
334
- launched
335
- });
336
- }
337
- if (jobStatus !== 'running' && completedAt) {
338
- return resolve(importJob);
339
- }
340
- overallStatus = 'running';
341
- setTimeout(() => {
350
+ // Kick off the check
342
351
  void checkStatus();
343
- }, IMPORT_SQL_PROGRESS_POLL_INTERVAL);
344
- };
345
-
346
- // Kick off the check
347
- void checkStatus();
348
- });
349
- try {
350
- const results = await getResults();
351
- if (typeof results === 'string') {
352
- overallStatus = results;
353
- } else {
354
- overallStatus = results.progress?.status ?? 'unknown';
355
- // This shouldn't be 'unknown'...what should we do here?
356
- }
357
- progressTracker.stopPrinting();
358
- setProgressTrackerSuffix();
359
-
360
- // Print one final time
361
- progressTracker.print({
362
- clearAfter: true
363
- });
364
-
365
- // This type of result is not an importing error. e.g. no import job was found
366
- process.exit(0);
367
- } catch (importFailed) {
368
- progressTracker.stopPrinting();
369
- progressTracker.print({
370
- clearAfter: true
371
352
  });
372
- exit.withError(getErrorMessage(importFailed, importFailed.launched));
373
- }
353
+ try {
354
+ const results = await getResults();
355
+ if (typeof results === 'string') {
356
+ overallStatus = results;
357
+ }
358
+ else {
359
+ overallStatus = results.progress?.status ?? 'unknown';
360
+ // This shouldn't be 'unknown'...what should we do here?
361
+ }
362
+ progressTracker.stopPrinting();
363
+ setProgressTrackerSuffix();
364
+ // Print one final time
365
+ progressTracker.print({ clearAfter: true });
366
+ // This type of result is not an importing error. e.g. no import job was found
367
+ process.exit(0);
368
+ }
369
+ catch (importFailed) {
370
+ progressTracker.stopPrinting();
371
+ progressTracker.print({ clearAfter: true });
372
+ exit.withError(getErrorMessage(importFailed, importFailed.launched));
373
+ }
374
374
  }
375
- var _default = exports.default = {
376
- importSqlCheckStatus
377
- };
375
+ exports.default = {
376
+ importSqlCheckStatus,
377
+ };