@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,78 +1,76 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
4
6
  exports.createProxyDispatcher = createProxyDispatcher;
5
- var _debug = _interopRequireDefault(require("debug"));
6
- var _undici = require("undici");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
- const debug = (0, _debug.default)('vip:proxy-dispatcher');
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const undici_1 = require("undici");
9
+ const debug = (0, debug_1.default)('vip:proxy-dispatcher');
9
10
  const proxyDispatchers = new Map();
10
11
  function normalizeNoProxyToken(token) {
11
- return token.trim().toLowerCase();
12
+ return token.trim().toLowerCase();
12
13
  }
13
14
  function isNoProxyMatch(hostname, port, token) {
14
- // eslint-disable-next-line security/detect-possible-timing-attacks
15
- if (token === '*') {
16
- return true;
17
- }
18
- const [tokenHostRaw, tokenPort] = token.split(':');
19
- const tokenHost = tokenHostRaw.replace(/^\./u, '');
20
- if (tokenPort && tokenPort !== port) {
21
- return false;
22
- }
23
- if (hostname === tokenHost) {
24
- return true;
25
- }
26
- return hostname.endsWith(`.${tokenHost}`);
15
+ // eslint-disable-next-line security/detect-possible-timing-attacks
16
+ if (token === '*') {
17
+ return true;
18
+ }
19
+ const [tokenHostRaw, tokenPort] = token.split(':');
20
+ const tokenHost = tokenHostRaw.replace(/^\./u, '');
21
+ if (tokenPort && tokenPort !== port) {
22
+ return false;
23
+ }
24
+ if (hostname === tokenHost) {
25
+ return true;
26
+ }
27
+ return hostname.endsWith(`.${tokenHost}`);
27
28
  }
28
29
  function isCoveredByNoProxy(url) {
29
- const NO_PROXY = process.env.NO_PROXY || process.env.no_proxy || null; // NOSONAR
30
-
31
- if (!NO_PROXY) {
32
- return false;
33
- }
34
- const parsedUrl = new URL(url);
35
- const hostname = parsedUrl.hostname.toLowerCase();
36
- const port = parsedUrl.port || (parsedUrl.protocol === 'http:' ? '80' : '443');
37
- const noProxyTokens = NO_PROXY.split(',').map(normalizeNoProxyToken).filter(Boolean);
38
- return noProxyTokens.some(token => isNoProxyMatch(hostname, port, token));
30
+ const NO_PROXY = process.env.NO_PROXY || process.env.no_proxy || null; // NOSONAR
31
+ if (!NO_PROXY) {
32
+ return false;
33
+ }
34
+ const parsedUrl = new URL(url);
35
+ const hostname = parsedUrl.hostname.toLowerCase();
36
+ const port = parsedUrl.port || (parsedUrl.protocol === 'http:' ? '80' : '443');
37
+ const noProxyTokens = NO_PROXY.split(',').map(normalizeNoProxyToken).filter(Boolean);
38
+ return noProxyTokens.some(token => isNoProxyMatch(hostname, port, token));
39
39
  }
40
40
  function resolveProxyUrl(url) {
41
- const VIP_PROXY = process.env.VIP_PROXY || process.env.vip_proxy || null; // NOSONAR
42
- const SOCKS_PROXY = process.env.SOCKS_PROXY || process.env.socks_proxy || null; // NOSONAR
43
- const HTTPS_PROXY = process.env.HTTPS_PROXY || process.env.https_proxy || null; // NOSONAR
44
-
45
- if (VIP_PROXY) {
46
- return VIP_PROXY;
47
- }
48
- if (process.env.VIP_USE_SYSTEM_PROXY && !isCoveredByNoProxy(url)) {
49
- if (SOCKS_PROXY) {
50
- return SOCKS_PROXY;
41
+ const VIP_PROXY = process.env.VIP_PROXY || process.env.vip_proxy || null; // NOSONAR
42
+ const SOCKS_PROXY = process.env.SOCKS_PROXY || process.env.socks_proxy || null; // NOSONAR
43
+ const HTTPS_PROXY = process.env.HTTPS_PROXY || process.env.https_proxy || null; // NOSONAR
44
+ if (VIP_PROXY) {
45
+ return VIP_PROXY;
51
46
  }
52
- if (HTTPS_PROXY) {
53
- return HTTPS_PROXY;
47
+ if (process.env.VIP_USE_SYSTEM_PROXY && !isCoveredByNoProxy(url)) {
48
+ if (SOCKS_PROXY) {
49
+ return SOCKS_PROXY;
50
+ }
51
+ if (HTTPS_PROXY) {
52
+ return HTTPS_PROXY;
53
+ }
54
54
  }
55
- }
56
- return null;
55
+ return null;
57
56
  }
58
57
  function redactProxyUrl(proxyUrl) {
59
- try {
60
- const parsed = new URL(proxyUrl);
61
- return `${parsed.protocol}//${parsed.host}`;
62
- } catch {
63
- return 'invalid-proxy-url';
64
- }
58
+ try {
59
+ const parsed = new URL(proxyUrl);
60
+ return `${parsed.protocol}//${parsed.host}`;
61
+ }
62
+ catch {
63
+ return 'invalid-proxy-url';
64
+ }
65
65
  }
66
66
  let listeners = null;
67
-
68
67
  // Suppress ExperimentalWarning: SOCKS5 proxy support is experimental and subject to change
69
68
  function suppressExperimentalSocksWarning(warning) {
70
- listeners?.forEach(listener => process.on('warning', listener));
71
- if (warning.name !== 'ExperimentalWarning' || !/SOCKS5 proxy/u.test(warning.message)) {
72
- listeners?.forEach(listener => listener(warning));
73
- }
69
+ listeners?.forEach(listener => process.on('warning', listener));
70
+ if (warning.name !== 'ExperimentalWarning' || !/SOCKS5 proxy/u.test(warning.message)) {
71
+ listeners?.forEach(listener => listener(warning));
72
+ }
74
73
  }
75
-
76
74
  /**
77
75
  * Build an undici dispatcher from the existing proxy resolution logic.
78
76
  *
@@ -80,18 +78,18 @@ function suppressExperimentalSocksWarning(warning) {
80
78
  * provide `dispatcher` instead of `agent`.
81
79
  */
82
80
  function createProxyDispatcher(url) {
83
- const proxyUrl = resolveProxyUrl(url);
84
- if (!proxyUrl) {
85
- return null;
86
- }
87
- if (!proxyDispatchers.has(proxyUrl)) {
88
- debug(`Enabling fetch dispatcher proxy support using config: ${redactProxyUrl(proxyUrl)}`);
89
- proxyDispatchers.set(proxyUrl, new _undici.ProxyAgent(proxyUrl));
90
- }
91
- if (listeners === null) {
92
- listeners = process.rawListeners('warning');
93
- process.removeAllListeners('warning');
94
- process.once('warning', suppressExperimentalSocksWarning);
95
- }
96
- return proxyDispatchers.get(proxyUrl) ?? null;
97
- }
81
+ const proxyUrl = resolveProxyUrl(url);
82
+ if (!proxyUrl) {
83
+ return null;
84
+ }
85
+ if (!proxyDispatchers.has(proxyUrl)) {
86
+ debug(`Enabling fetch dispatcher proxy support using config: ${redactProxyUrl(proxyUrl)}`);
87
+ proxyDispatchers.set(proxyUrl, new undici_1.ProxyAgent(proxyUrl));
88
+ }
89
+ if (listeners === null) {
90
+ listeners = process.rawListeners('warning');
91
+ process.removeAllListeners('warning');
92
+ process.once('warning', suppressExperimentalSocksWarning);
93
+ }
94
+ return proxyDispatchers.get(proxyUrl) ?? null;
95
+ }
@@ -1,43 +1,47 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
4
6
  exports.Insecure = void 0;
5
- var _configstore = _interopRequireDefault(require("configstore"));
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ const configstore_1 = __importDefault(require("configstore"));
7
8
  class Insecure {
8
- configstore;
9
- constructor(file) {
10
- this.file = file;
11
- this.configstore = new _configstore.default(this.file);
12
- }
13
- getPassword(service) {
14
- try {
15
- const value = this.configstore.get(service);
16
- if (null === value || undefined === value) {
17
- return Promise.resolve(null);
18
- }
19
-
20
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
21
- return Promise.resolve(value.toString()); // NOSONAR
22
- } catch (err) {
23
- return Promise.reject(err);
9
+ file;
10
+ configstore;
11
+ constructor(file) {
12
+ this.file = file;
13
+ this.configstore = new configstore_1.default(this.file);
24
14
  }
25
- }
26
- setPassword(service, password) {
27
- try {
28
- this.configstore.set(service, password);
29
- return Promise.resolve(true);
30
- } catch (err) {
31
- return Promise.reject(err);
15
+ getPassword(service) {
16
+ try {
17
+ const value = this.configstore.get(service);
18
+ if (null === value || undefined === value) {
19
+ return Promise.resolve(null);
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
22
+ return Promise.resolve(value.toString()); // NOSONAR
23
+ }
24
+ catch (err) {
25
+ return Promise.reject(err);
26
+ }
32
27
  }
33
- }
34
- deletePassword(service) {
35
- try {
36
- this.configstore.delete(service);
37
- return Promise.resolve(true);
38
- } catch (err) {
39
- return Promise.reject(err);
28
+ setPassword(service, password) {
29
+ try {
30
+ this.configstore.set(service, password);
31
+ return Promise.resolve(true);
32
+ }
33
+ catch (err) {
34
+ return Promise.reject(err);
35
+ }
36
+ }
37
+ deletePassword(service) {
38
+ try {
39
+ this.configstore.delete(service);
40
+ return Promise.resolve(true);
41
+ }
42
+ catch (err) {
43
+ return Promise.reject(err);
44
+ }
40
45
  }
41
- }
42
46
  }
43
- exports.Insecure = Insecure;
47
+ exports.Insecure = Insecure;
@@ -1 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
4
6
  exports.Secure = void 0;
5
- var _keytar = _interopRequireDefault(require("@github/keytar"));
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ const keytar_1 = __importDefault(require("@github/keytar"));
7
8
  class Secure {
8
- getPassword(service) {
9
- return _keytar.default.getPassword(service, service);
10
- }
11
- async setPassword(service, password) {
12
- await _keytar.default.setPassword(service, service, password);
13
- return true;
14
- }
15
- deletePassword(service) {
16
- return _keytar.default.deletePassword(service, service);
17
- }
9
+ getPassword(service) {
10
+ return keytar_1.default.getPassword(service, service);
11
+ }
12
+ async setPassword(service, password) {
13
+ await keytar_1.default.setPassword(service, service, password);
14
+ return true;
15
+ }
16
+ deletePassword(service) {
17
+ return keytar_1.default.deletePassword(service, service);
18
+ }
18
19
  }
19
- exports.Secure = Secure;
20
+ exports.Secure = Secure;
@@ -1,27 +1,27 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
4
6
  exports.getKeychain = getKeychain;
5
- var _debug = _interopRequireDefault(require("debug"));
6
- var _insecure = require("./keychain/insecure");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const insecure_1 = require("./keychain/insecure");
8
9
  let keychain;
9
- const debug = (0, _debug.default)('@automattic/vip:keychain');
10
+ const debug = (0, debug_1.default)('@automattic/vip:keychain');
10
11
  async function getKeychain() {
11
- if (typeof keychain === 'undefined') {
12
- try {
13
- const {
14
- Secure
15
- } = await import('./keychain/secure.js');
16
- const kc = new Secure();
17
- // We don't know if the secure keychain is actually usable until we try to communicate with it.
18
- await kc.getPassword('non-existent-password-fraude-perit-virtus');
19
- debug('Using Secure keychain');
20
- keychain = kc;
21
- } catch (error) {
22
- debug('Cannot use Secure keychain; falling back to Insecure keychain (Details: %o)', error);
23
- keychain = new _insecure.Insecure('vip-go-cli');
12
+ if (typeof keychain === 'undefined') {
13
+ try {
14
+ const { Secure } = await import('./keychain/secure.js');
15
+ const kc = new Secure();
16
+ // We don't know if the secure keychain is actually usable until we try to communicate with it.
17
+ await kc.getPassword('non-existent-password-fraude-perit-virtus');
18
+ debug('Using Secure keychain');
19
+ keychain = kc;
20
+ }
21
+ catch (error) {
22
+ debug('Cannot use Secure keychain; falling back to Insecure keychain (Details: %o)', error);
23
+ keychain = new insecure_1.Insecure('vip-go-cli');
24
+ }
24
25
  }
25
- }
26
- return keychain;
27
- }
26
+ return keychain;
27
+ }
@@ -1,54 +1,61 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.START_LIVE_COPY_MUTATION = exports.SQLDumpTool = exports.GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = exports.BackupLiveCopyType = void 0;
5
- exports.getDownloadURL = getDownloadURL;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SQLDumpTool = exports.BackupLiveCopyType = exports.GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = exports.START_LIVE_COPY_MUTATION = void 0;
6
7
  exports.parseLiveBackupCopyCLIOptions = parseLiveBackupCopyCLIOptions;
7
8
  exports.startLiveBackupCopy = startLiveBackupCopy;
8
- var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
9
- var _userError = _interopRequireDefault(require("./user-error"));
10
- var _utils = require("./utils");
11
- var _api = _interopRequireDefault(require("../lib/api"));
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ exports.getDownloadURL = getDownloadURL;
10
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
11
+ const user_error_1 = __importDefault(require("./user-error"));
12
+ const utils_1 = require("./utils");
13
+ const api_1 = __importDefault(require("../lib/api"));
13
14
  function parseLiveBackupCopyCLIOptions(configFile, table, siteId, wpcliCommand) {
14
- const options = {};
15
- if (configFile && (table || siteId || wpcliCommand)) {
16
- throw new _userError.default('The --config-file option cannot be used with the --table, --site-id, or --wpcli-command options. Please use only one of these options at a time.');
17
- }
18
- if (wpcliCommand && (table || siteId)) {
19
- throw new _userError.default('The --wpcli-command option cannot be used with the --table or --site-id options. Please use only one of these options at a time.');
20
- }
21
- let useLiveBackupCopy = false;
22
- if (table) {
23
- if (Array.isArray(table)) {
24
- options.tables = table.flatMap(tableItem => tableItem.split(',').map(name => name.trim()));
25
- } else {
26
- options.tables = table.split(',').map(name => name.trim());
15
+ const options = {};
16
+ if (configFile && (table || siteId || wpcliCommand)) {
17
+ throw new user_error_1.default('The --config-file option cannot be used with the --table, --site-id, or --wpcli-command options. Please use only one of these options at a time.');
18
+ }
19
+ if (wpcliCommand && (table || siteId)) {
20
+ throw new user_error_1.default('The --wpcli-command option cannot be used with the --table or --site-id options. Please use only one of these options at a time.');
21
+ }
22
+ let useLiveBackupCopy = false;
23
+ if (table) {
24
+ if (Array.isArray(table)) {
25
+ options.tables = table.flatMap(tableItem => tableItem.split(',').map(name => name.trim()));
26
+ }
27
+ else {
28
+ options.tables = table.split(',').map(name => name.trim());
29
+ }
30
+ useLiveBackupCopy = true;
31
+ }
32
+ if (siteId) {
33
+ if (Array.isArray(siteId)) {
34
+ options.siteIds = siteId.flatMap(id => String(id)
35
+ .split(',')
36
+ .map(idStr => Number(idStr.trim())));
37
+ }
38
+ else {
39
+ options.siteIds = String(siteId)
40
+ .split(',')
41
+ .map(idStr => Number(idStr.trim()));
42
+ }
43
+ useLiveBackupCopy = true;
27
44
  }
28
- useLiveBackupCopy = true;
29
- }
30
- if (siteId) {
31
- if (Array.isArray(siteId)) {
32
- options.siteIds = siteId.flatMap(id => String(id).split(',').map(idStr => Number(idStr.trim())));
33
- } else {
34
- options.siteIds = String(siteId).split(',').map(idStr => Number(idStr.trim()));
45
+ if (configFile) {
46
+ options.configFile = configFile;
47
+ useLiveBackupCopy = true;
35
48
  }
36
- useLiveBackupCopy = true;
37
- }
38
- if (configFile) {
39
- options.configFile = configFile;
40
- useLiveBackupCopy = true;
41
- }
42
- if (wpcliCommand) {
43
- options.wpcliCommand = wpcliCommand;
44
- useLiveBackupCopy = true;
45
- }
46
- return {
47
- ...options,
48
- useLiveBackupCopy
49
- };
49
+ if (wpcliCommand) {
50
+ options.wpcliCommand = wpcliCommand;
51
+ useLiveBackupCopy = true;
52
+ }
53
+ return {
54
+ ...options,
55
+ useLiveBackupCopy,
56
+ };
50
57
  }
51
- const START_LIVE_COPY_MUTATION = exports.START_LIVE_COPY_MUTATION = (0, _graphqlTag.default)(`
58
+ exports.START_LIVE_COPY_MUTATION = (0, graphql_tag_1.default)(`
52
59
  mutation startLiveBackupCopy($input: LiveBackupCopyConfigInput!) {
53
60
  startLiveBackupCopy(input: $input) {
54
61
  message
@@ -56,9 +63,8 @@ const START_LIVE_COPY_MUTATION = exports.START_LIVE_COPY_MUTATION = (0, _graphql
56
63
  }
57
64
  }
58
65
  `);
59
-
60
66
  // eslint-disable-next-line id-length
61
- const GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = exports.GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = (0, _graphqlTag.default)(`
67
+ exports.GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = (0, graphql_tag_1.default)(`
62
68
  mutation generateLiveBackupCopyDownloadURL(
63
69
  $input: AppEnvironmentLiveBackupCopyDownloadURLInput!
64
70
  ) {
@@ -70,77 +76,73 @@ const GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION = exports.GENERATE_LIVE_BACKUP_
70
76
  }
71
77
  }
72
78
  `);
73
- let BackupLiveCopyType = exports.BackupLiveCopyType = /*#__PURE__*/function (BackupLiveCopyType) {
74
- BackupLiveCopyType["FULL"] = "full";
75
- BackupLiveCopyType["TABLES"] = "tables";
76
- BackupLiveCopyType["SITE_IDS"] = "site_ids";
77
- BackupLiveCopyType["WP_CLI_COMMAND"] = "wpcli_command";
78
- return BackupLiveCopyType;
79
- }({});
80
- let SQLDumpTool = exports.SQLDumpTool = /*#__PURE__*/function (SQLDumpTool) {
81
- SQLDumpTool["MYSQLDUMP"] = "mysqldump";
82
- SQLDumpTool["MYDUMPER"] = "mydumper";
83
- return SQLDumpTool;
84
- }({});
85
- async function startLiveBackupCopy({
86
- appId,
87
- environmentId,
88
- config
89
- }) {
90
- const api = (0, _api.default)({
91
- exitOnError: true
92
- });
93
- const result = await api.mutate({
94
- mutation: START_LIVE_COPY_MUTATION,
95
- variables: {
96
- input: {
97
- id: appId,
98
- environmentId,
99
- config
100
- }
79
+ var BackupLiveCopyType;
80
+ (function (BackupLiveCopyType) {
81
+ BackupLiveCopyType["FULL"] = "full";
82
+ BackupLiveCopyType["TABLES"] = "tables";
83
+ BackupLiveCopyType["SITE_IDS"] = "site_ids";
84
+ BackupLiveCopyType["WP_CLI_COMMAND"] = "wpcli_command";
85
+ })(BackupLiveCopyType || (exports.BackupLiveCopyType = BackupLiveCopyType = {}));
86
+ var SQLDumpTool;
87
+ (function (SQLDumpTool) {
88
+ SQLDumpTool["MYSQLDUMP"] = "mysqldump";
89
+ SQLDumpTool["MYDUMPER"] = "mydumper";
90
+ })(SQLDumpTool || (exports.SQLDumpTool = SQLDumpTool = {}));
91
+ async function startLiveBackupCopy({ appId, environmentId, config, }) {
92
+ const api = (0, api_1.default)({ exitOnError: true });
93
+ const result = await api.mutate({
94
+ mutation: exports.START_LIVE_COPY_MUTATION,
95
+ variables: {
96
+ input: {
97
+ id: appId,
98
+ environmentId,
99
+ config,
100
+ },
101
+ },
102
+ });
103
+ if (!result.data?.startLiveBackupCopy.copyId) {
104
+ throw new Error(`Failed to start partial database export: ${result.data?.startLiveBackupCopy?.message
105
+ ? result.data?.startLiveBackupCopy?.message
106
+ : 'Unknown error'}`);
101
107
  }
102
- });
103
- if (!result.data?.startLiveBackupCopy.copyId) {
104
- throw new Error(`Failed to start partial database export: ${result.data?.startLiveBackupCopy?.message ? result.data?.startLiveBackupCopy?.message : 'Unknown error'}`);
105
- }
106
- return result.data?.startLiveBackupCopy.copyId;
108
+ return result.data?.startLiveBackupCopy.copyId;
107
109
  }
108
- async function getDownloadURL({
109
- appId,
110
- environmentId,
111
- copyId,
112
- timeoutInSeconds = 2 * 60 * 60 // 2 hours default timeout
113
- }) {
114
- const api = (0, _api.default)({
115
- exitOnError: true
116
- });
117
- try {
118
- const result = await (0, _utils.pollUntil)(async () => {
119
- return await api.mutate({
120
- mutation: GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION,
121
- variables: {
122
- input: {
123
- id: appId,
124
- environmentId,
125
- copyId
126
- }
110
+ async function getDownloadURL({ appId, environmentId, copyId, timeoutInSeconds = 2 * 60 * 60, // 2 hours default timeout
111
+ }) {
112
+ const api = (0, api_1.default)({ exitOnError: true });
113
+ try {
114
+ const result = await (0, utils_1.pollUntil)(async () => {
115
+ return await api.mutate({
116
+ mutation: exports.GENERATE_LIVE_BACKUP_DOWNLOAD_URL_MUTATION,
117
+ variables: {
118
+ input: {
119
+ id: appId,
120
+ environmentId,
121
+ copyId,
122
+ },
123
+ },
124
+ });
125
+ }, 5000, fetchResult => {
126
+ return Boolean(fetchResult.data?.generateLiveBackupCopyDownloadURL?.url &&
127
+ !fetchResult.data?.generateLiveBackupCopyDownloadURL?.processing);
128
+ }, timeoutInSeconds * 1000);
129
+ if (!result.data?.generateLiveBackupCopyDownloadURL?.success ||
130
+ !result.data.generateLiveBackupCopyDownloadURL.url ||
131
+ !result.data.generateLiveBackupCopyDownloadURL.size) {
132
+ throw new Error(`Failed to generate download URL: ${result.data?.generateLiveBackupCopyDownloadURL?.url
133
+ ? result.data?.generateLiveBackupCopyDownloadURL?.url
134
+ : 'Unknown error'}`);
127
135
  }
128
- });
129
- }, 5000, fetchResult => {
130
- return Boolean(fetchResult.data?.generateLiveBackupCopyDownloadURL?.url && !fetchResult.data?.generateLiveBackupCopyDownloadURL?.processing);
131
- }, timeoutInSeconds * 1000);
132
- if (!result.data?.generateLiveBackupCopyDownloadURL?.success || !result.data.generateLiveBackupCopyDownloadURL.url || !result.data.generateLiveBackupCopyDownloadURL.size) {
133
- throw new Error(`Failed to generate download URL: ${result.data?.generateLiveBackupCopyDownloadURL?.url ? result.data?.generateLiveBackupCopyDownloadURL?.url : 'Unknown error'}`);
136
+ return {
137
+ url: result.data.generateLiveBackupCopyDownloadURL.url,
138
+ size: Number(result.data.generateLiveBackupCopyDownloadURL.size),
139
+ };
134
140
  }
135
- return {
136
- url: result.data.generateLiveBackupCopyDownloadURL.url,
137
- size: Number(result.data.generateLiveBackupCopyDownloadURL.size)
138
- };
139
- } catch (error) {
140
- if (error instanceof _utils.PollingTimeoutError) {
141
- throw new Error(`Failed to generate download URL: Polling timed out after ${timeoutInSeconds} seconds`);
141
+ catch (error) {
142
+ if (error instanceof utils_1.PollingTimeoutError) {
143
+ throw new Error(`Failed to generate download URL: Polling timed out after ${timeoutInSeconds} seconds`);
144
+ }
145
+ const errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
146
+ throw new Error(`Failed to generate download URL: ${errorMessage}`);
142
147
  }
143
- const errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
144
- throw new Error(`Failed to generate download URL: ${errorMessage}`);
145
- }
146
- }
148
+ }
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _http = _interopRequireDefault(require("../lib/api/http"));
6
- var _tokenCache = _interopRequireDefault(require("../lib/rechallenge/token-cache"));
7
- var _token = _interopRequireDefault(require("../lib/token"));
8
- var _tracker = require("../lib/tracker");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- var _default = async () => {
11
- try {
12
- await (0, _http.default)('/logout', {
13
- method: 'post'
14
- });
15
- } finally {
16
- await _token.default.purge();
17
- await _tokenCache.default.clearAll();
18
- }
19
- await (0, _tracker.trackEvent)('logout_command_execute');
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = __importDefault(require("../lib/api/http"));
7
+ const token_cache_1 = __importDefault(require("../lib/rechallenge/token-cache"));
8
+ const token_1 = __importDefault(require("../lib/token"));
9
+ const tracker_1 = require("../lib/tracker");
10
+ exports.default = async () => {
11
+ try {
12
+ await (0, http_1.default)('/logout', { method: 'post' });
13
+ }
14
+ finally {
15
+ await token_1.default.purge();
16
+ await token_cache_1.default.clearAll();
17
+ }
18
+ await (0, tracker_1.trackEvent)('logout_command_execute');
20
19
  };
21
- exports.default = _default;