@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,24 +1,24 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
5
6
  exports.getGlyphForStatus = getGlyphForStatus;
6
7
  exports.mediaImportCheckStatus = mediaImportCheckStatus;
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _enquirer = require("enquirer");
9
- var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
10
- var _promises = require("node:fs/promises");
11
- var _nodePath = require("node:path");
12
- var _undici = require("undici");
13
- var _api = _interopRequireDefault(require("../../lib/api"));
14
- var _format = require("../../lib/cli/format");
15
- var _mediaFileImport = require("../../lib/media-import/media-file-import");
16
- var _proxyDispatcher = require("../http/proxy-dispatcher");
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const enquirer_1 = require("enquirer");
10
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
11
+ const promises_1 = require("node:fs/promises");
12
+ const node_path_1 = require("node:path");
13
+ const undici_1 = require("undici");
14
+ const api_1 = __importDefault(require("../../lib/api"));
15
+ const format_1 = require("../../lib/cli/format");
16
+ const media_file_import_1 = require("../../lib/media-import/media-file-import");
17
+ const proxy_dispatcher_1 = require("../http/proxy-dispatcher");
18
18
  const IMPORT_MEDIA_PROGRESS_POLL_INTERVAL = 1000;
19
19
  const ONE_MINUTE_IN_MILLISECONDS = 1000 * 60;
20
20
  const TWO_MINUTES_IN_MILLISECONDS = 2 * ONE_MINUTE_IN_MILLISECONDS;
21
- const IMPORT_MEDIA_PROGRESS_QUERY = (0, _graphqlTag.default)`
21
+ const IMPORT_MEDIA_PROGRESS_QUERY = (0, graphql_tag_1.default) `
22
22
  query App($appId: Int, $envId: Int) {
23
23
  app(id: $appId) {
24
24
  environments(id: $envId) {
@@ -43,268 +43,253 @@ const IMPORT_MEDIA_PROGRESS_QUERY = (0, _graphqlTag.default)`
43
43
  }
44
44
  `;
45
45
  async function getStatus(api, appId, envId) {
46
- const response = await api.query({
47
- query: IMPORT_MEDIA_PROGRESS_QUERY,
48
- variables: {
49
- appId,
50
- envId
51
- },
52
- fetchPolicy: 'network-only'
53
- });
54
- const environments = response.data?.app?.environments;
55
- if (!environments?.length) {
56
- throw new Error('Unable to determine import status from environment');
57
- }
58
- const [environment] = environments;
59
- const {
60
- mediaImportStatus
61
- } = environment ?? {};
62
- return mediaImportStatus ?? null;
46
+ const response = await api.query({
47
+ query: IMPORT_MEDIA_PROGRESS_QUERY,
48
+ variables: { appId, envId },
49
+ fetchPolicy: 'network-only',
50
+ });
51
+ const environments = response.data?.app?.environments;
52
+ if (!environments?.length) {
53
+ throw new Error('Unable to determine import status from environment');
54
+ }
55
+ const [environment] = environments;
56
+ const { mediaImportStatus } = environment ?? {};
57
+ return mediaImportStatus ?? null;
63
58
  }
64
59
  function getGlyphForStatus(status, runningSprite) {
65
- switch (status) {
66
- case 'INITIALIZING':
67
- return '○';
68
- case 'INITIALIZED':
69
- case 'RUNNING':
70
- case 'COMPLETING':
71
- case 'RAN':
72
- case 'VALIDATING':
73
- case 'VALIDATED':
74
- return _chalk.default.blueBright(runningSprite);
75
- case 'COMPLETED':
76
- return _chalk.default.green('✓');
77
- case 'FAILED':
78
- return _chalk.default.red('✕');
79
- case 'ABORTED':
80
- case 'ABORTING':
81
- return _chalk.default.yellow('⚠️');
82
- default:
83
- return '';
84
- }
60
+ switch (status) {
61
+ case 'INITIALIZING':
62
+ return '○';
63
+ case 'INITIALIZED':
64
+ case 'RUNNING':
65
+ case 'COMPLETING':
66
+ case 'RAN':
67
+ case 'VALIDATING':
68
+ case 'VALIDATED':
69
+ return chalk_1.default.blueBright(runningSprite);
70
+ case 'COMPLETED':
71
+ return chalk_1.default.green('✓');
72
+ case 'FAILED':
73
+ return chalk_1.default.red('✕');
74
+ case 'ABORTED':
75
+ case 'ABORTING':
76
+ return chalk_1.default.yellow('⚠️');
77
+ default:
78
+ return '';
79
+ }
85
80
  }
86
81
  function buildErrorMessage(importFailed) {
87
- let message = '';
88
- if ('FAILED' === importFailed.status) {
89
- const globalFailureDetails = importFailed.failureDetails;
90
- if (globalFailureDetails) {
91
- message += `${_chalk.default.red('Import failed at status: ')}`;
92
- message += `${_chalk.default.redBright.bold(globalFailureDetails.previousStatus)}\n`;
93
- message += _chalk.default.red('Errors:');
94
- globalFailureDetails.globalErrors?.forEach(value => {
95
- message += `\n\t- ${_chalk.default.redBright.bold(value)}`;
96
- });
97
- return message;
82
+ let message = '';
83
+ if ('FAILED' === importFailed.status) {
84
+ const globalFailureDetails = importFailed.failureDetails;
85
+ if (globalFailureDetails) {
86
+ message += `${chalk_1.default.red('Import failed at status: ')}`;
87
+ message += `${chalk_1.default.redBright.bold(globalFailureDetails.previousStatus)}\n`;
88
+ message += chalk_1.default.red('Errors:');
89
+ globalFailureDetails.globalErrors?.forEach(value => {
90
+ message += `\n\t- ${chalk_1.default.redBright.bold(value)}`;
91
+ });
92
+ return message;
93
+ }
98
94
  }
99
- }
100
- message += _chalk.default.red(importFailed.error ? importFailed.error : importFailed);
101
- message += '\n\nPlease check the status of your Import using `vip import media status @mysite.production`';
102
- message += '\n\nIf this error persists and you are not sure on how to fix, please contact support\n';
103
- return message;
95
+ message += chalk_1.default.red(importFailed.error ? importFailed.error : importFailed);
96
+ message +=
97
+ '\n\nPlease check the status of your Import using `vip import media status @mysite.production`';
98
+ message +=
99
+ '\n\nIf this error persists and you are not sure on how to fix, please contact support\n';
100
+ return message;
104
101
  }
105
102
  function buildFileErrors(fileErrors, exportFileErrorsToJson) {
106
- if (exportFileErrorsToJson) {
107
- const fileErrorsToExport = fileErrors.map(fileError => {
108
- return {
109
- fileName: fileError?.fileName,
110
- errors: fileError?.errors
111
- };
112
- });
113
- return (0, _format.formatData)(fileErrorsToExport, 'json');
114
- }
115
- let errorString = '';
116
- for (const fileError of fileErrors) {
117
- errorString += `File Name: ${fileError?.fileName ?? 'N/A'}`;
118
- errorString += `\n\nErrors:\n\t- ${fileError?.errors?.join(', ') ?? 'unknown error'}\n\n\n\n`;
119
- }
120
- return errorString;
103
+ if (exportFileErrorsToJson) {
104
+ const fileErrorsToExport = fileErrors.map(fileError => {
105
+ return {
106
+ fileName: fileError?.fileName,
107
+ errors: fileError?.errors,
108
+ };
109
+ });
110
+ return (0, format_1.formatData)(fileErrorsToExport, 'json');
111
+ }
112
+ let errorString = '';
113
+ for (const fileError of fileErrors) {
114
+ errorString += `File Name: ${fileError?.fileName ?? 'N/A'}`;
115
+ errorString += `\n\nErrors:\n\t- ${fileError?.errors?.join(', ') ?? 'unknown error'}\n\n\n\n`;
116
+ }
117
+ return errorString;
121
118
  }
122
- async function mediaImportCheckStatus({
123
- app,
124
- env,
125
- progressTracker,
126
- exportFileErrorsToJson,
127
- saveErrorLog
128
- }) {
129
- // Stop printing so we can pass our callback
130
- progressTracker.stopPrinting();
131
-
132
- // NO `console.log` in this function (until results are final)! It will break the progress printing.
133
- const api = (0, _api.default)();
134
- if (!(0, _mediaFileImport.currentUserCanImportForApp)(app)) {
135
- throw new Error('The currently authenticated account does not have permission to view Media Import status.');
136
- }
137
- let overallStatus = 'Checking...';
138
- const setProgressTrackerSuffix = () => {
139
- const sprite = getGlyphForStatus(overallStatus, progressTracker.runningSprite);
140
- const exitPrompt = '(Press ^C to hide progress. The import will continue in the background.)';
141
- let statusMessage;
142
- switch (overallStatus) {
143
- case 'INITIALIZING':
144
- statusMessage = `INITIALIZING ${sprite} : We're downloading the files to be imported...`;
145
- break;
146
- case 'COMPLETED':
147
- statusMessage = `COMPLETED ${sprite} : The imported files should be visible on your App`;
148
- break;
149
- default:
150
- statusMessage = `${(0, _format.capitalize)(overallStatus)} ${sprite}`;
119
+ async function mediaImportCheckStatus({ app, env, progressTracker, exportFileErrorsToJson, saveErrorLog, }) {
120
+ // Stop printing so we can pass our callback
121
+ progressTracker.stopPrinting();
122
+ // NO `console.log` in this function (until results are final)! It will break the progress printing.
123
+ const api = (0, api_1.default)();
124
+ if (!(0, media_file_import_1.currentUserCanImportForApp)(app)) {
125
+ throw new Error('The currently authenticated account does not have permission to view Media Import status.');
151
126
  }
152
- const maybeExitPrompt = ['COMPLETED', 'ABORTED', 'FAILED'].includes(overallStatus) ? '' : exitPrompt;
153
- const suffix = `
127
+ let overallStatus = 'Checking...';
128
+ const setProgressTrackerSuffix = () => {
129
+ const sprite = getGlyphForStatus(overallStatus, progressTracker.runningSprite);
130
+ const exitPrompt = '(Press ^C to hide progress. The import will continue in the background.)';
131
+ let statusMessage;
132
+ switch (overallStatus) {
133
+ case 'INITIALIZING':
134
+ statusMessage = `INITIALIZING ${sprite} : We're downloading the files to be imported...`;
135
+ break;
136
+ case 'COMPLETED':
137
+ statusMessage = `COMPLETED ${sprite} : The imported files should be visible on your App`;
138
+ break;
139
+ default:
140
+ statusMessage = `${(0, format_1.capitalize)(overallStatus)} ${sprite}`;
141
+ }
142
+ const maybeExitPrompt = ['COMPLETED', 'ABORTED', 'FAILED'].includes(overallStatus)
143
+ ? ''
144
+ : exitPrompt;
145
+ const suffix = `
154
146
  =============================================================
155
147
  Status: ${statusMessage}
156
- App: ${app.name ?? 'N/A'} (${(0, _format.formatEnvironment)(env.type ?? 'N/A')})
148
+ App: ${app.name ?? 'N/A'} (${(0, format_1.formatEnvironment)(env.type ?? 'N/A')})
157
149
  =============================================================
158
150
  ${maybeExitPrompt}
159
151
  `;
160
- progressTracker.suffix = suffix;
161
- };
162
- const setSuffixAndPrint = () => {
163
- setProgressTrackerSuffix();
164
- progressTracker.print();
165
- };
166
- progressTracker.startPrinting(setSuffixAndPrint);
167
- const getResults = () =>
168
- // eslint-disable-next-line @typescript-eslint/no-shadow
169
- new Promise((resolve, reject) => {
170
- let startDate = Date.now();
171
- let pollIntervalDecreasing = false;
172
- const checkStatus = async pollInterval => {
173
- let mediaImportStatus = null;
174
- try {
175
- mediaImportStatus = await getStatus(api, app.id ?? -1, env.id ?? -1);
176
- if (!mediaImportStatus) {
177
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
178
- return reject({
179
- error: 'Requested app/environment is not available for this operation. If you think this is not correct, please contact Support.'
180
- });
181
- }
182
- } catch (error) {
183
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
184
- return reject({
185
- error: error.message
186
- });
187
- }
188
- const status = mediaImportStatus.status ?? 'unknown';
189
- const failedMediaImport = 'FAILED' === status;
190
- if (failedMediaImport) {
191
- progressTracker.setStatus(mediaImportStatus);
192
- overallStatus = 'FAILED';
193
- setSuffixAndPrint();
194
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
195
- return reject({
196
- ...mediaImportStatus,
197
- error: 'Import FAILED'
198
- });
199
- }
200
- progressTracker.setStatus(mediaImportStatus);
201
- setSuffixAndPrint();
202
- if (['COMPLETED', 'ABORTED'].includes(status)) {
203
- return resolve(mediaImportStatus);
204
- }
205
- overallStatus = status;
206
-
207
- // after two minutes, we'll start decreasing the pollInterval
208
- pollIntervalDecreasing = pollIntervalDecreasing || startDate < Date.now() - TWO_MINUTES_IN_MILLISECONDS;
209
-
210
- // decrease poll interval by a second, every minute
211
- if (pollIntervalDecreasing && startDate < Date.now() - ONE_MINUTE_IN_MILLISECONDS) {
212
- pollInterval = pollInterval + IMPORT_MEDIA_PROGRESS_POLL_INTERVAL;
213
- startDate = Date.now();
214
- }
215
- setTimeout(() => {
216
- void checkStatus(pollInterval);
217
- }, pollInterval);
152
+ progressTracker.suffix = suffix;
218
153
  };
219
-
220
- // Kick off the check
221
- void checkStatus(IMPORT_MEDIA_PROGRESS_POLL_INTERVAL);
222
- });
223
- async function exportFailureDetails(fileErrors) {
224
- const formattedData = buildFileErrors(fileErrors, exportFileErrorsToJson);
225
- const errorsFile = `media-import-${app.name ?? ''}-${Date.now()}${exportFileErrorsToJson ? '.json' : '.txt'}`;
226
- try {
227
- await (0, _promises.writeFile)(errorsFile, formattedData);
228
- progressTracker.suffix += `${_chalk.default.yellow(`⚠️ All errors have been exported to ${_chalk.default.bold((0, _nodePath.resolve)(errorsFile))}\n`)}`;
229
- } catch (writeFileErr) {
230
- progressTracker.suffix += `${_chalk.default.red(`Could not export errors to file\n${writeFileErr.message}`)}`;
154
+ const setSuffixAndPrint = () => {
155
+ setProgressTrackerSuffix();
156
+ progressTracker.print();
157
+ };
158
+ progressTracker.startPrinting(setSuffixAndPrint);
159
+ const getResults = () =>
160
+ // eslint-disable-next-line @typescript-eslint/no-shadow
161
+ new Promise((resolve, reject) => {
162
+ let startDate = Date.now();
163
+ let pollIntervalDecreasing = false;
164
+ const checkStatus = async (pollInterval) => {
165
+ let mediaImportStatus = null;
166
+ try {
167
+ mediaImportStatus = await getStatus(api, app.id ?? -1, env.id ?? -1);
168
+ if (!mediaImportStatus) {
169
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
170
+ return reject({
171
+ error: 'Requested app/environment is not available for this operation. If you think this is not correct, please contact Support.',
172
+ });
173
+ }
174
+ }
175
+ catch (error) {
176
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
177
+ return reject({ error: error.message });
178
+ }
179
+ const status = mediaImportStatus.status ?? 'unknown';
180
+ const failedMediaImport = 'FAILED' === status;
181
+ if (failedMediaImport) {
182
+ progressTracker.setStatus(mediaImportStatus);
183
+ overallStatus = 'FAILED';
184
+ setSuffixAndPrint();
185
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
186
+ return reject({ ...mediaImportStatus, error: 'Import FAILED' });
187
+ }
188
+ progressTracker.setStatus(mediaImportStatus);
189
+ setSuffixAndPrint();
190
+ if (['COMPLETED', 'ABORTED'].includes(status)) {
191
+ return resolve(mediaImportStatus);
192
+ }
193
+ overallStatus = status;
194
+ // after two minutes, we'll start decreasing the pollInterval
195
+ pollIntervalDecreasing =
196
+ pollIntervalDecreasing || startDate < Date.now() - TWO_MINUTES_IN_MILLISECONDS;
197
+ // decrease poll interval by a second, every minute
198
+ if (pollIntervalDecreasing && startDate < Date.now() - ONE_MINUTE_IN_MILLISECONDS) {
199
+ pollInterval = pollInterval + IMPORT_MEDIA_PROGRESS_POLL_INTERVAL;
200
+ startDate = Date.now();
201
+ }
202
+ setTimeout(() => {
203
+ void checkStatus(pollInterval);
204
+ }, pollInterval);
205
+ };
206
+ // Kick off the check
207
+ void checkStatus(IMPORT_MEDIA_PROGRESS_POLL_INTERVAL);
208
+ });
209
+ async function exportFailureDetails(fileErrors) {
210
+ const formattedData = buildFileErrors(fileErrors, exportFileErrorsToJson);
211
+ const errorsFile = `media-import-${app.name ?? ''}-${Date.now()}${exportFileErrorsToJson ? '.json' : '.txt'}`;
212
+ try {
213
+ await (0, promises_1.writeFile)(errorsFile, formattedData);
214
+ progressTracker.suffix += `${chalk_1.default.yellow(`⚠️ All errors have been exported to ${chalk_1.default.bold((0, node_path_1.resolve)(errorsFile))}\n`)}`;
215
+ }
216
+ catch (writeFileErr) {
217
+ progressTracker.suffix += `${chalk_1.default.red(`Could not export errors to file\n${writeFileErr.message}`)}`;
218
+ }
231
219
  }
232
- }
233
- async function fetchFailureDetails(fileErrorsUrl) {
234
- progressTracker.suffix += `
220
+ async function fetchFailureDetails(fileErrorsUrl) {
221
+ progressTracker.suffix += `
235
222
  =============================================================
236
223
  Downloading errors details from ${fileErrorsUrl}
237
224
  \n`;
238
- progressTracker.print({
239
- clearAfter: true
240
- });
241
- try {
242
- const proxyDispatcher = (0, _proxyDispatcher.createProxyDispatcher)(fileErrorsUrl);
243
- const response = await (0, _undici.fetch)(fileErrorsUrl, {
244
- dispatcher: proxyDispatcher ?? undefined
245
- });
246
- return await response.json();
247
- } catch (err) {
248
- progressTracker.suffix += `${_chalk.default.red(`Could not download import errors report\n${err.message}`)}`;
249
- throw err;
225
+ progressTracker.print({ clearAfter: true });
226
+ try {
227
+ const proxyDispatcher = (0, proxy_dispatcher_1.createProxyDispatcher)(fileErrorsUrl);
228
+ const response = await (0, undici_1.fetch)(fileErrorsUrl, {
229
+ dispatcher: proxyDispatcher ?? undefined,
230
+ });
231
+ return (await response.json());
232
+ }
233
+ catch (err) {
234
+ progressTracker.suffix += `${chalk_1.default.red(`Could not download import errors report\n${err.message}`)}`;
235
+ throw err;
236
+ }
250
237
  }
251
- }
252
- async function promptFailureDetailsDownload(fileErrorsUrl) {
253
- const failureDetails = 'prompt' === saveErrorLog ? await (0, _enquirer.prompt)({
254
- type: 'confirm',
255
- name: 'download',
256
- message: 'Download import errors report now? (Report will be downloadable for up to 7 days from the completion of the import)'
257
- }) : {
258
- download: ['true', 'yes'].includes(saveErrorLog)
259
- };
260
- if (!failureDetails.download) {
261
- progressTracker.suffix += `${_chalk.default.yellow(`⚠️ An error report file has been generated for this media import. Access it within the next 15 minutes by clicking on the URL below.`)}`;
262
- progressTracker.suffix += `\n${_chalk.default.yellow(`Or, generate a new URL by running the ${_chalk.default.bgYellow('vip import media status')} command.`)} `;
263
- progressTracker.suffix += `\n${_chalk.default.yellow('The report will be downloadable for up to 7 days after the completion of the import or until a new media import is performed.')}`;
264
- progressTracker.suffix += `\n\n${_chalk.default.underline(fileErrorsUrl)}\n`;
265
- progressTracker.print({
266
- clearAfter: true
267
- });
268
- return;
238
+ async function promptFailureDetailsDownload(fileErrorsUrl) {
239
+ const failureDetails = 'prompt' === saveErrorLog
240
+ ? await (0, enquirer_1.prompt)({
241
+ type: 'confirm',
242
+ name: 'download',
243
+ message: 'Download import errors report now? (Report will be downloadable for up to 7 days from the completion of the import)',
244
+ })
245
+ : {
246
+ download: ['true', 'yes'].includes(saveErrorLog),
247
+ };
248
+ if (!failureDetails.download) {
249
+ progressTracker.suffix += `${chalk_1.default.yellow(`⚠️ An error report file has been generated for this media import. Access it within the next 15 minutes by clicking on the URL below.`)}`;
250
+ progressTracker.suffix += `\n${chalk_1.default.yellow(`Or, generate a new URL by running the ${chalk_1.default.bgYellow('vip import media status')} command.`)} `;
251
+ progressTracker.suffix += `\n${chalk_1.default.yellow('The report will be downloadable for up to 7 days after the completion of the import or until a new media import is performed.')}`;
252
+ progressTracker.suffix += `\n\n${chalk_1.default.underline(fileErrorsUrl)}\n`;
253
+ progressTracker.print({ clearAfter: true });
254
+ return;
255
+ }
256
+ const failureDetailsErrors = await fetchFailureDetails(fileErrorsUrl);
257
+ await exportFailureDetails(failureDetailsErrors);
258
+ }
259
+ function printFileErrorsReportLinkExpiredError(results) {
260
+ if (results.filesTotal &&
261
+ typeof results.filesProcessed === 'number' &&
262
+ results.filesTotal !== results.filesProcessed) {
263
+ const errorsFound = results.filesTotal - results.filesProcessed;
264
+ progressTracker.suffix += `${chalk_1.default.yellow(`⚠️ ${errorsFound} error(s) were found. File import errors report link expired.`)}`;
265
+ }
269
266
  }
270
- const failureDetailsErrors = await fetchFailureDetails(fileErrorsUrl);
271
- await exportFailureDetails(failureDetailsErrors);
272
- }
273
- function printFileErrorsReportLinkExpiredError(results) {
274
- if (results.filesTotal && typeof results.filesProcessed === 'number' && results.filesTotal !== results.filesProcessed) {
275
- const errorsFound = results.filesTotal - results.filesProcessed;
276
- progressTracker.suffix += `${_chalk.default.yellow(`⚠️ ${errorsFound} error(s) were found. File import errors report link expired.`)}`;
267
+ try {
268
+ const results = await getResults();
269
+ overallStatus = results.status ?? 'unknown';
270
+ progressTracker.stopPrinting();
271
+ setProgressTrackerSuffix();
272
+ progressTracker.print();
273
+ if (results.failureDetails?.fileErrorsUrl) {
274
+ await promptFailureDetailsDownload(results.failureDetails.fileErrorsUrl);
275
+ }
276
+ else if ('ABORTED' !== overallStatus) {
277
+ // print report link expired if required
278
+ // do not print this message if the import was aborted
279
+ printFileErrorsReportLinkExpiredError(results);
280
+ }
281
+ // Print one final time
282
+ progressTracker.print({ clearAfter: true });
283
+ process.exit(0);
277
284
  }
278
- }
279
- try {
280
- const results = await getResults();
281
- overallStatus = results.status ?? 'unknown';
282
- progressTracker.stopPrinting();
283
- setProgressTrackerSuffix();
284
- progressTracker.print();
285
- if (results.failureDetails?.fileErrorsUrl) {
286
- await promptFailureDetailsDownload(results.failureDetails.fileErrorsUrl);
287
- } else if ('ABORTED' !== overallStatus) {
288
- // print report link expired if required
289
- // do not print this message if the import was aborted
290
- printFileErrorsReportLinkExpiredError(results);
285
+ catch (importFailed) {
286
+ progressTracker.stopPrinting();
287
+ progressTracker.print();
288
+ progressTracker.suffix += `\n${buildErrorMessage(importFailed)}`;
289
+ progressTracker.print({ clearAfter: true });
290
+ process.exit(1);
291
291
  }
292
-
293
- // Print one final time
294
- progressTracker.print({
295
- clearAfter: true
296
- });
297
- process.exit(0);
298
- } catch (importFailed) {
299
- progressTracker.stopPrinting();
300
- progressTracker.print();
301
- progressTracker.suffix += `\n${buildErrorMessage(importFailed)}`;
302
- progressTracker.print({
303
- clearAfter: true
304
- });
305
- process.exit(1);
306
- }
307
292
  }
308
- var _default = exports.default = {
309
- mediaImportCheckStatus
310
- };
293
+ exports.default = {
294
+ mediaImportCheckStatus,
295
+ };
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.isLocalArchive = isLocalArchive;
5
- var _promises = require("node:fs/promises");
4
+ const promises_1 = require("node:fs/promises");
6
5
  async function isLocalArchive(filePath) {
7
- const lower = filePath.toLowerCase();
8
- const isArchive = lower.endsWith('.tar.gz') || lower.endsWith('.tgz') || lower.endsWith('.zip');
9
- if (!isArchive) {
10
- return false;
11
- }
12
- try {
13
- const fileStat = await (0, _promises.stat)(filePath);
14
- return fileStat.isFile();
15
- } catch {
16
- return false;
17
- }
18
- }
6
+ const lower = filePath.toLowerCase();
7
+ const isArchive = lower.endsWith('.tar.gz') || lower.endsWith('.tgz') || lower.endsWith('.zip');
8
+ if (!isArchive) {
9
+ return false;
10
+ }
11
+ try {
12
+ const fileStat = await (0, promises_1.stat)(filePath);
13
+ return fileStat.isFile();
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
-
3
- var _nodeFs = require("node:fs");
4
- var _nodePath = require("node:path");
5
- var _semver = require("semver");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_fs_1 = require("node:fs");
4
+ const node_path_1 = require("node:path");
5
+ const semver_1 = require("semver");
6
6
  const boldRed = process.stdout.isTTY ? '\x1b[1;31m' : '';
7
7
  const reset = process.stdout.isTTY ? '\x1b[0m' : '';
8
8
  try {
9
- const json = (0, _nodeFs.readFileSync)((0, _nodePath.join)(__dirname, '..', '..', 'package.json'), 'utf8');
10
- const {
11
- name,
12
- engines
13
- } = JSON.parse(json);
14
- const version = engines.node;
15
- if (version && !(0, _semver.satisfies)(process.version, version)) {
16
- console.warn(`${boldRed}WARNING: The current version of Node (${process.version}) does not meet the minimum requirements; ` + `${name} requires Node version ${version}.\n\n` + `Please follow the installation instructions at https://nodejs.org/en/download/ to upgrade.${reset}\n`);
17
- }
18
- } catch {
19
- // Do nothing
20
- }
9
+ const json = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', '..', 'package.json'), 'utf8');
10
+ const { name, engines } = JSON.parse(json);
11
+ const version = engines.node;
12
+ if (version && !(0, semver_1.satisfies)(process.version, version, { includePrerelease: true })) {
13
+ console.warn(`${boldRed}WARNING: The current version of Node (${process.version}) does not meet the minimum requirements; ` +
14
+ `${name} requires Node version ${version}.\n\n` +
15
+ `Please follow the installation instructions at https://nodejs.org/en/download/ to upgrade.${reset}\n`);
16
+ }
17
+ }
18
+ catch {
19
+ // Do nothing
20
+ }
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.createExternalizedPromise = void 0;
5
4
  const createExternalizedPromise = () => {
6
- let externalResolve = null;
7
- let externalReject = null;
8
- const externalizedPromise = new Promise((resolve, reject) => {
9
- externalResolve = resolve;
10
- externalReject = reject;
11
- });
12
- if (!externalReject || !externalResolve) {
13
- throw new Error("Somehow, externalReject or externalResolve didn't get set.");
14
- }
15
- return {
16
- promise: externalizedPromise,
17
- resolve: externalResolve,
18
- reject: externalReject
19
- };
5
+ let externalResolve = null;
6
+ let externalReject = null;
7
+ const externalizedPromise = new Promise((resolve, reject) => {
8
+ externalResolve = resolve;
9
+ externalReject = reject;
10
+ });
11
+ if (!externalReject || !externalResolve) {
12
+ throw new Error("Somehow, externalReject or externalResolve didn't get set.");
13
+ }
14
+ return {
15
+ promise: externalizedPromise,
16
+ resolve: externalResolve,
17
+ reject: externalReject,
18
+ };
20
19
  };
21
- exports.createExternalizedPromise = createExternalizedPromise;
20
+ exports.createExternalizedPromise = createExternalizedPromise;