@ardennguyen/zalo-agent-cli 2.5.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +23 -2
- package/DISCLAIMER.md +3 -3
- package/LICENSE +2 -3
- package/NOTICE +14 -34
- package/README.md +166 -72
- package/package.json +37 -19
- package/src/commands/account.js +369 -40
- package/src/commands/auto-reply.js +8 -25
- package/src/commands/bank.js +25 -6
- package/src/commands/catalog.js +54 -11
- package/src/commands/cloud.js +459 -0
- package/src/commands/conv.js +470 -287
- package/src/commands/db.js +442 -0
- package/src/commands/fleet.js +449 -41
- package/src/commands/friend.js +198 -45
- package/src/commands/group.js +256 -43
- package/src/commands/label.js +16 -2
- package/src/commands/listen.js +495 -122
- package/src/commands/login.js +313 -117
- package/src/commands/mcp-approver.js +103 -0
- package/src/commands/mcp-webhook.js +13 -5
- package/src/commands/mcp.js +800 -104
- package/src/commands/msg-media.js +187 -0
- package/src/commands/msg-search.js +219 -0
- package/src/commands/msg.js +414 -110
- package/src/commands/oa/calls.js +134 -0
- package/src/commands/oa/content.js +266 -0
- package/src/commands/oa/gmf.js +429 -0
- package/src/commands/oa/messages.js +355 -0
- package/src/commands/oa/users.js +502 -0
- package/src/commands/oa-init.js +122 -123
- package/src/commands/oa-listen.js +374 -150
- package/src/commands/oa.js +83 -598
- package/src/commands/policy.js +224 -0
- package/src/commands/poll.js +3 -0
- package/src/commands/presence.js +175 -0
- package/src/commands/profile.js +45 -94
- package/src/commands/quick-msg.js +26 -0
- package/src/commands/read.js +172 -0
- package/src/commands/reminder.js +34 -4
- package/src/commands/social.js +223 -0
- package/src/commands/sync.js +482 -158
- package/src/commands/write.js +85 -0
- package/src/commands/zbs.js +502 -0
- package/src/core/account-devices.js +76 -0
- package/src/core/account-state.js +167 -0
- package/src/core/account-status.js +355 -0
- package/src/core/accounts.js +11 -4
- package/src/core/admin-api.js +392 -0
- package/src/core/approval.js +271 -0
- package/src/core/auto-reply.js +27 -0
- package/src/core/bank-accounts.js +1 -1
- package/src/core/block-sharing.js +43 -0
- package/src/core/board-pass.js +94 -0
- package/src/core/cached-message.js +78 -8
- package/src/core/cloud-plan.js +285 -0
- package/src/core/cloud-verify.js +305 -0
- package/src/core/confirm-guard.js +808 -0
- package/src/core/contact-names.js +504 -0
- package/src/core/control-events.js +525 -0
- package/src/core/control-replay.js +106 -0
- package/src/core/conversation-actions.js +214 -0
- package/src/core/credentials.js +112 -11
- package/src/core/current-user-names.js +60 -26
- package/src/core/daemon-channel.js +296 -15
- package/src/core/daemon-health.js +110 -7
- package/src/core/daemon-presence.js +455 -0
- package/src/core/daemon-sync.js +58 -18
- package/src/core/data-export.js +610 -0
- package/src/core/db-tools.js +473 -0
- package/src/core/db.js +1327 -83
- package/src/core/deploy-policy.js +560 -0
- package/src/core/device-since.js +123 -0
- package/src/core/e2ee-notice.js +41 -0
- package/src/core/exit-codes.js +7 -0
- package/src/core/export-crypt.js +290 -0
- package/src/core/fleet-controller.js +340 -0
- package/src/core/fleet-purge.js +144 -0
- package/src/core/fleet-qr.js +273 -0
- package/src/core/fleet-serve.js +292 -0
- package/src/core/fleet-supervisor.js +176 -0
- package/src/core/fleet-templates.js +568 -39
- package/src/core/fleet.js +232 -20
- package/src/core/friend-requests.js +80 -16
- package/src/core/friend-search.js +1 -1
- package/src/core/group-admin.js +2 -29
- package/src/core/group-departure.js +233 -0
- package/src/core/group-exit.js +621 -0
- package/src/core/group-members.js +21 -9
- package/src/core/group-settings.js +5 -207
- package/src/core/hidden-chat-actions.js +96 -0
- package/src/core/hidden-chats.js +425 -0
- package/src/core/history-fetch.js +81 -27
- package/src/core/keystore/config.js +163 -0
- package/src/core/keystore/container.js +208 -0
- package/src/core/keystore/index.js +483 -0
- package/src/core/keystore/keyring.js +588 -0
- package/src/core/keystore/kms.js +157 -0
- package/src/core/keystore/media-seal.js +711 -0
- package/src/core/keystore/providers.js +492 -0
- package/src/core/keystore/stores.js +177 -0
- package/src/core/keystore/worker.js +80 -0
- package/src/core/kick-marker.js +61 -0
- package/src/core/last-online.js +236 -0
- package/src/core/list-all.js +280 -0
- package/src/core/listener-lifecycle.js +101 -10
- package/src/core/live-api.js +1 -1
- package/src/core/live-store.js +111 -53
- package/src/core/local-reads.js +16 -0
- package/src/core/logout.js +102 -140
- package/src/core/media-deliver.js +732 -0
- package/src/core/media-route.js +347 -0
- package/src/core/media-store.js +408 -0
- package/src/core/mutual-groups.js +94 -0
- package/src/core/name-refresh.js +135 -0
- package/src/core/oa/calls.js +212 -0
- package/src/core/oa/content.js +390 -0
- package/src/core/oa/gmf.js +537 -0
- package/src/core/oa/messages.js +470 -0
- package/src/core/oa/oauth.js +422 -0
- package/src/core/oa/transport.js +645 -0
- package/src/core/oa/users.js +694 -0
- package/src/core/oa-client.js +49 -415
- package/src/core/overflow-repair.js +221 -0
- package/src/core/policy-layer.js +55 -0
- package/src/core/policy-schema.js +401 -0
- package/src/core/policy-store.js +1058 -0
- package/src/core/presence-config.js +100 -0
- package/src/core/presence-leases.js +211 -0
- package/src/core/presence.js +688 -0
- package/src/core/profile-settings.js +243 -0
- package/src/core/qr-login-flow.js +237 -0
- package/src/core/read-state.js +145 -22
- package/src/core/receipts.js +355 -548
- package/src/core/recent-conversations.js +28 -6
- package/src/core/row-mac.js +405 -0
- package/src/core/search.js +271 -0
- package/src/core/secure-page.js +771 -0
- package/src/core/self-heal.js +493 -34
- package/src/core/session-expiry.js +103 -0
- package/src/core/session-notice.js +249 -0
- package/src/core/social/client.js +296 -0
- package/src/core/social/dpop.js +54 -0
- package/src/core/socket-host.js +437 -0
- package/src/core/sqlite.js +520 -0
- package/src/core/startup-gate.js +49 -5
- package/src/core/storage-quota.js +796 -0
- package/src/core/sync-action.js +180 -0
- package/src/core/sync-v2/auto-sync.js +356 -0
- package/src/core/sync-v2/board.js +130 -92
- package/src/core/sync-v2/conv-state.js +21 -4
- package/src/core/sync-v2/gap-advice.js +2 -3
- package/src/core/sync-v2/index.js +739 -323
- package/src/core/sync-v2/media.js +116 -27
- package/src/core/sync-v2/plan.js +16 -2
- package/src/core/sync-v2/ranges.js +98 -0
- package/src/core/sync-v2/reactions.js +12 -196
- package/src/core/sync-v2/senders.js +32 -14
- package/src/core/sync-v2/zcloud.js +177 -579
- package/src/core/sync.js +23 -21
- package/src/core/test-fake-session.js +87 -0
- package/src/core/typing.js +78 -0
- package/src/core/unknown-acts.js +240 -0
- package/src/core/voice-text.js +171 -0
- package/src/core/webhook-outbox.js +110 -12
- package/src/core/zalo-client.js +147 -188
- package/src/core/zbs/api.js +505 -0
- package/src/core/zbs/image.js +85 -0
- package/src/core/zbs/phone.js +59 -0
- package/src/core/zbs/rsa.js +129 -0
- package/src/core/zbs/template-check.js +449 -0
- package/src/index.js +60 -10
- package/src/mcp/action-tool.js +188 -0
- package/src/mcp/actions-business.js +488 -0
- package/src/mcp/actions-conversation.js +633 -0
- package/src/mcp/actions-media.js +268 -0
- package/src/mcp/actions-profile.js +281 -0
- package/src/mcp/actions-social.js +518 -0
- package/src/mcp/instructions.js +19 -5
- package/src/mcp/mcp-config.js +112 -10
- package/src/mcp/mcp-http-transport.js +162 -25
- package/src/mcp/mcp-server.js +14 -3
- package/src/mcp/mcp-tools.js +1686 -384
- package/src/mcp/message-buffer.js +58 -12
- package/src/mcp/notifier.js +1 -1
- package/src/mcp/official-tool.js +298 -0
- package/src/mcp/sync-jobs.js +7 -1
- package/src/mcp/sync-stages.js +72 -0
- package/src/mcp/thread-name-cache.js +43 -5
- package/src/mcp/tool-presence.js +153 -0
- package/src/mcp/wait-batch.js +27 -0
- package/src/mcp/wait-result.js +19 -21
- package/src/utils/bank-helpers.js +52 -1
- package/src/utils/cli-args.js +12 -12
- package/src/utils/date-range.js +50 -0
- package/src/utils/hidden-access.js +141 -0
- package/src/utils/interrupt.js +37 -0
- package/src/utils/json-input.js +41 -0
- package/src/utils/list-replies.js +60 -0
- package/src/utils/my-documents.js +2 -3
- package/src/utils/output.js +66 -2
- package/src/utils/qr-display.js +14 -8
- package/src/utils/qr-http-server.js +674 -134
- package/src/utils/quote.js +8 -8
- package/src/utils/secret-input.js +57 -0
- package/src/utils/vn-text.js +72 -0
- package/src/zalo/README.md +46 -0
- package/src/zalo/anomaly-store.js +49 -0
- package/src/zalo/api/actions.js +670 -0
- package/src/zalo/api/boards.js +1036 -0
- package/src/zalo/api/business.js +662 -0
- package/src/zalo/api/conversations.js +329 -0
- package/src/zalo/api/groups.js +631 -0
- package/src/zalo/api/messages.js +695 -0
- package/src/zalo/api/people.js +711 -0
- package/src/zalo/api/profile.js +374 -0
- package/src/zalo/api/session.js +45 -0
- package/src/zalo/api/upload.js +976 -0
- package/src/zalo/api.js +117 -0
- package/src/zalo/client.js +206 -0
- package/src/zalo/custom/forward.js +199 -0
- package/src/zalo/custom/gid.js +123 -0
- package/src/zalo/custom/group-history.js +246 -0
- package/src/zalo/custom/group-invite.js +53 -0
- package/src/zalo/custom/group-settings.js +186 -0
- package/src/zalo/custom/group-visibility.js +71 -0
- package/src/zalo/custom/pin.js +220 -0
- package/src/zalo/custom/renewlink.js +115 -0
- package/src/zalo/device-fingerprint.js +33 -0
- package/src/zalo/download-fetch.js +45 -0
- package/src/zalo/enums.js +25 -0
- package/src/zalo/errors.js +195 -0
- package/src/zalo/format/mentions.js +140 -0
- package/src/zalo/format/split-message.js +222 -0
- package/src/zalo/format/urgency.js +29 -0
- package/src/zalo/headers.js +93 -0
- package/src/zalo/index.js +72 -0
- package/src/zalo/kernel/atomic-file.js +217 -0
- package/src/zalo/kernel/bound.js +46 -0
- package/src/zalo/kernel/cipher.js +88 -0
- package/src/zalo/kernel/cookies.js +125 -0
- package/src/zalo/kernel/endpoint.js +211 -0
- package/src/zalo/kernel/http.js +360 -0
- package/src/zalo/kernel/json-ids.js +118 -0
- package/src/zalo/kernel/login-cipher.js +165 -0
- package/src/zalo/kernel/secret-file.js +45 -0
- package/src/zalo/kernel/session.js +261 -0
- package/src/zalo/kernel/zcloud-cipher.js +83 -0
- package/src/zalo/kickout.js +136 -0
- package/src/zalo/listener/dispatch.js +404 -0
- package/src/zalo/listener/frames.js +222 -0
- package/src/zalo/listener/friend-events.js +113 -0
- package/src/zalo/listener/group-events.js +117 -0
- package/src/zalo/listener/keepalive.js +191 -0
- package/src/zalo/listener/listener.js +469 -0
- package/src/zalo/listener/models.js +220 -0
- package/src/zalo/listener/reactions.js +224 -0
- package/src/zalo/listener/socket-tap.js +228 -0
- package/src/zalo/login.js +387 -0
- package/src/zalo/logout.js +192 -0
- package/src/zalo/maintenance.js +183 -0
- package/src/zalo/official-logout.js +254 -0
- package/src/zalo/paging.js +114 -0
- package/src/zalo/profile.js +184 -0
- package/src/zalo/pulls.js +129 -0
- package/src/zalo/qr-image.js +90 -0
- package/src/zalo/qr-login.js +494 -0
- package/src/zalo/queues/control-queue.js +193 -0
- package/src/zalo/queues/offline-queue.js +275 -0
- package/src/zalo/queues/queue-verify.js +306 -0
- package/src/zalo/reads.js +723 -0
- package/src/zalo/receipts.js +550 -0
- package/src/zalo/req-id.js +24 -0
- package/src/zalo/retry.js +343 -0
- package/src/zalo/session-call.js +55 -0
- package/src/zalo/socket.js +762 -0
- package/src/zalo/transfer-sync/assets.js +181 -0
- package/src/zalo/transfer-sync/channel.js +459 -0
- package/src/zalo/transfer-sync/download.js +161 -0
- package/src/zalo/transfer-sync/message-types.js +520 -0
- package/src/zalo/transfer-sync/transfer.js +468 -0
- package/src/zalo/trust-store.js +99 -0
- package/src/zalo/trust-wasm.js +393 -0
- package/src/zalo/upkeep.js +127 -0
- package/src/zalo/web-call.js +103 -0
- package/src/zalo/writes.js +704 -0
- package/src/zalo/zcloud-e2ee.js +214 -0
- package/src/zalo/zcloud.js +802 -0
- package/node_modules/asynckit/LICENSE +0 -21
- package/node_modules/asynckit/README.md +0 -233
- package/node_modules/asynckit/bench.js +0 -76
- package/node_modules/asynckit/index.js +0 -6
- package/node_modules/asynckit/lib/abort.js +0 -29
- package/node_modules/asynckit/lib/async.js +0 -34
- package/node_modules/asynckit/lib/defer.js +0 -26
- package/node_modules/asynckit/lib/iterate.js +0 -75
- package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/node_modules/asynckit/lib/state.js +0 -37
- package/node_modules/asynckit/lib/streamify.js +0 -141
- package/node_modules/asynckit/lib/terminator.js +0 -29
- package/node_modules/asynckit/package.json +0 -63
- package/node_modules/asynckit/parallel.js +0 -43
- package/node_modules/asynckit/serial.js +0 -17
- package/node_modules/asynckit/serialOrdered.js +0 -75
- package/node_modules/asynckit/stream.js +0 -21
- package/node_modules/bignumber.js/CHANGELOG.md +0 -381
- package/node_modules/bignumber.js/LICENCE.md +0 -26
- package/node_modules/bignumber.js/README.md +0 -289
- package/node_modules/bignumber.js/bignumber.d.mts +0 -6
- package/node_modules/bignumber.js/bignumber.d.ts +0 -5
- package/node_modules/bignumber.js/bignumber.js +0 -2922
- package/node_modules/bignumber.js/bignumber.mjs +0 -2907
- package/node_modules/bignumber.js/doc/API.html +0 -2249
- package/node_modules/bignumber.js/package.json +0 -60
- package/node_modules/bignumber.js/types.d.ts +0 -1821
- package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
- package/node_modules/call-bind-apply-helpers/LICENSE +0 -21
- package/node_modules/call-bind-apply-helpers/README.md +0 -62
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
- package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
- package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
- package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
- package/node_modules/call-bind-apply-helpers/index.js +0 -15
- package/node_modules/call-bind-apply-helpers/package.json +0 -85
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
- package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
- package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
- package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
- package/node_modules/combined-stream/License +0 -19
- package/node_modules/combined-stream/Readme.md +0 -138
- package/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/node_modules/combined-stream/package.json +0 -25
- package/node_modules/crypto-js/CONTRIBUTING.md +0 -28
- package/node_modules/crypto-js/LICENSE +0 -24
- package/node_modules/crypto-js/README.md +0 -275
- package/node_modules/crypto-js/aes.js +0 -234
- package/node_modules/crypto-js/blowfish.js +0 -471
- package/node_modules/crypto-js/bower.json +0 -39
- package/node_modules/crypto-js/cipher-core.js +0 -895
- package/node_modules/crypto-js/core.js +0 -807
- package/node_modules/crypto-js/crypto-js.js +0 -6657
- package/node_modules/crypto-js/docs/QuickStartGuide.wiki +0 -470
- package/node_modules/crypto-js/enc-base64.js +0 -136
- package/node_modules/crypto-js/enc-base64url.js +0 -148
- package/node_modules/crypto-js/enc-hex.js +0 -18
- package/node_modules/crypto-js/enc-latin1.js +0 -18
- package/node_modules/crypto-js/enc-utf16.js +0 -149
- package/node_modules/crypto-js/enc-utf8.js +0 -18
- package/node_modules/crypto-js/evpkdf.js +0 -134
- package/node_modules/crypto-js/format-hex.js +0 -66
- package/node_modules/crypto-js/format-openssl.js +0 -18
- package/node_modules/crypto-js/hmac-md5.js +0 -18
- package/node_modules/crypto-js/hmac-ripemd160.js +0 -18
- package/node_modules/crypto-js/hmac-sha1.js +0 -18
- package/node_modules/crypto-js/hmac-sha224.js +0 -18
- package/node_modules/crypto-js/hmac-sha256.js +0 -18
- package/node_modules/crypto-js/hmac-sha3.js +0 -18
- package/node_modules/crypto-js/hmac-sha384.js +0 -18
- package/node_modules/crypto-js/hmac-sha512.js +0 -18
- package/node_modules/crypto-js/hmac.js +0 -143
- package/node_modules/crypto-js/index.js +0 -18
- package/node_modules/crypto-js/lib-typedarrays.js +0 -76
- package/node_modules/crypto-js/md5.js +0 -268
- package/node_modules/crypto-js/mode-cfb.js +0 -80
- package/node_modules/crypto-js/mode-ctr-gladman.js +0 -116
- package/node_modules/crypto-js/mode-ctr.js +0 -58
- package/node_modules/crypto-js/mode-ecb.js +0 -40
- package/node_modules/crypto-js/mode-ofb.js +0 -54
- package/node_modules/crypto-js/package.json +0 -42
- package/node_modules/crypto-js/pad-ansix923.js +0 -49
- package/node_modules/crypto-js/pad-iso10126.js +0 -44
- package/node_modules/crypto-js/pad-iso97971.js +0 -40
- package/node_modules/crypto-js/pad-nopadding.js +0 -30
- package/node_modules/crypto-js/pad-pkcs7.js +0 -18
- package/node_modules/crypto-js/pad-zeropadding.js +0 -47
- package/node_modules/crypto-js/pbkdf2.js +0 -145
- package/node_modules/crypto-js/rabbit-legacy.js +0 -190
- package/node_modules/crypto-js/rabbit.js +0 -192
- package/node_modules/crypto-js/rc4.js +0 -139
- package/node_modules/crypto-js/ripemd160.js +0 -267
- package/node_modules/crypto-js/sha1.js +0 -150
- package/node_modules/crypto-js/sha224.js +0 -80
- package/node_modules/crypto-js/sha256.js +0 -199
- package/node_modules/crypto-js/sha3.js +0 -326
- package/node_modules/crypto-js/sha384.js +0 -83
- package/node_modules/crypto-js/sha512.js +0 -326
- package/node_modules/crypto-js/tripledes.js +0 -779
- package/node_modules/crypto-js/x64-core.js +0 -304
- package/node_modules/delayed-stream/.npmignore +0 -1
- package/node_modules/delayed-stream/License +0 -19
- package/node_modules/delayed-stream/Makefile +0 -7
- package/node_modules/delayed-stream/Readme.md +0 -141
- package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/node_modules/delayed-stream/package.json +0 -27
- package/node_modules/dunder-proto/.eslintrc +0 -5
- package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
- package/node_modules/dunder-proto/.nycrc +0 -13
- package/node_modules/dunder-proto/CHANGELOG.md +0 -24
- package/node_modules/dunder-proto/LICENSE +0 -21
- package/node_modules/dunder-proto/README.md +0 -54
- package/node_modules/dunder-proto/get.d.ts +0 -5
- package/node_modules/dunder-proto/get.js +0 -30
- package/node_modules/dunder-proto/package.json +0 -76
- package/node_modules/dunder-proto/set.d.ts +0 -5
- package/node_modules/dunder-proto/set.js +0 -35
- package/node_modules/dunder-proto/test/get.js +0 -34
- package/node_modules/dunder-proto/test/index.js +0 -4
- package/node_modules/dunder-proto/test/set.js +0 -50
- package/node_modules/dunder-proto/tsconfig.json +0 -9
- package/node_modules/es-define-property/.eslintrc +0 -13
- package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/node_modules/es-define-property/.nycrc +0 -9
- package/node_modules/es-define-property/CHANGELOG.md +0 -29
- package/node_modules/es-define-property/LICENSE +0 -21
- package/node_modules/es-define-property/README.md +0 -49
- package/node_modules/es-define-property/index.d.ts +0 -3
- package/node_modules/es-define-property/index.js +0 -14
- package/node_modules/es-define-property/package.json +0 -81
- package/node_modules/es-define-property/test/index.js +0 -56
- package/node_modules/es-define-property/tsconfig.json +0 -10
- package/node_modules/es-errors/.eslintrc +0 -5
- package/node_modules/es-errors/.github/FUNDING.yml +0 -12
- package/node_modules/es-errors/CHANGELOG.md +0 -40
- package/node_modules/es-errors/LICENSE +0 -21
- package/node_modules/es-errors/README.md +0 -55
- package/node_modules/es-errors/eval.d.ts +0 -3
- package/node_modules/es-errors/eval.js +0 -4
- package/node_modules/es-errors/index.d.ts +0 -3
- package/node_modules/es-errors/index.js +0 -4
- package/node_modules/es-errors/package.json +0 -80
- package/node_modules/es-errors/range.d.ts +0 -3
- package/node_modules/es-errors/range.js +0 -4
- package/node_modules/es-errors/ref.d.ts +0 -3
- package/node_modules/es-errors/ref.js +0 -4
- package/node_modules/es-errors/syntax.d.ts +0 -3
- package/node_modules/es-errors/syntax.js +0 -4
- package/node_modules/es-errors/test/index.js +0 -19
- package/node_modules/es-errors/tsconfig.json +0 -49
- package/node_modules/es-errors/type.d.ts +0 -3
- package/node_modules/es-errors/type.js +0 -4
- package/node_modules/es-errors/uri.d.ts +0 -3
- package/node_modules/es-errors/uri.js +0 -4
- package/node_modules/es-object-atoms/.eslintrc +0 -16
- package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
- package/node_modules/es-object-atoms/CHANGELOG.md +0 -44
- package/node_modules/es-object-atoms/LICENSE +0 -21
- package/node_modules/es-object-atoms/README.md +0 -63
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
- package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
- package/node_modules/es-object-atoms/ToObject.js +0 -10
- package/node_modules/es-object-atoms/index.d.ts +0 -3
- package/node_modules/es-object-atoms/index.js +0 -4
- package/node_modules/es-object-atoms/isObject.d.ts +0 -3
- package/node_modules/es-object-atoms/isObject.js +0 -6
- package/node_modules/es-object-atoms/package.json +0 -79
- package/node_modules/es-object-atoms/test/index.js +0 -38
- package/node_modules/es-object-atoms/tsconfig.json +0 -7
- package/node_modules/es-set-tostringtag/.eslintrc +0 -13
- package/node_modules/es-set-tostringtag/.nycrc +0 -9
- package/node_modules/es-set-tostringtag/CHANGELOG.md +0 -67
- package/node_modules/es-set-tostringtag/LICENSE +0 -21
- package/node_modules/es-set-tostringtag/README.md +0 -53
- package/node_modules/es-set-tostringtag/index.d.ts +0 -10
- package/node_modules/es-set-tostringtag/index.js +0 -35
- package/node_modules/es-set-tostringtag/package.json +0 -78
- package/node_modules/es-set-tostringtag/test/index.js +0 -85
- package/node_modules/es-set-tostringtag/tsconfig.json +0 -9
- package/node_modules/form-data/CHANGELOG.md +0 -686
- package/node_modules/form-data/License +0 -19
- package/node_modules/form-data/README.md +0 -355
- package/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/form-data/lib/browser.js +0 -4
- package/node_modules/form-data/lib/form_data.js +0 -506
- package/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/form-data/node_modules/mime-db/HISTORY.md +0 -507
- package/node_modules/form-data/node_modules/mime-db/LICENSE +0 -23
- package/node_modules/form-data/node_modules/mime-db/README.md +0 -100
- package/node_modules/form-data/node_modules/mime-db/db.json +0 -8519
- package/node_modules/form-data/node_modules/mime-db/index.js +0 -12
- package/node_modules/form-data/node_modules/mime-db/package.json +0 -60
- package/node_modules/form-data/node_modules/mime-types/HISTORY.md +0 -397
- package/node_modules/form-data/node_modules/mime-types/LICENSE +0 -23
- package/node_modules/form-data/node_modules/mime-types/README.md +0 -113
- package/node_modules/form-data/node_modules/mime-types/index.js +0 -188
- package/node_modules/form-data/node_modules/mime-types/package.json +0 -44
- package/node_modules/form-data/package.json +0 -82
- package/node_modules/function-bind/.eslintrc +0 -21
- package/node_modules/function-bind/.github/FUNDING.yml +0 -12
- package/node_modules/function-bind/.github/SECURITY.md +0 -3
- package/node_modules/function-bind/.nycrc +0 -13
- package/node_modules/function-bind/CHANGELOG.md +0 -136
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -46
- package/node_modules/function-bind/implementation.js +0 -84
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -87
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/get-intrinsic/.eslintrc +0 -42
- package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/node_modules/get-intrinsic/.nycrc +0 -9
- package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
- package/node_modules/get-intrinsic/LICENSE +0 -21
- package/node_modules/get-intrinsic/README.md +0 -71
- package/node_modules/get-intrinsic/index.js +0 -378
- package/node_modules/get-intrinsic/package.json +0 -97
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/node_modules/get-proto/.eslintrc +0 -10
- package/node_modules/get-proto/.github/FUNDING.yml +0 -12
- package/node_modules/get-proto/.nycrc +0 -9
- package/node_modules/get-proto/CHANGELOG.md +0 -21
- package/node_modules/get-proto/LICENSE +0 -21
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
- package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
- package/node_modules/get-proto/README.md +0 -50
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
- package/node_modules/get-proto/index.d.ts +0 -5
- package/node_modules/get-proto/index.js +0 -27
- package/node_modules/get-proto/package.json +0 -81
- package/node_modules/get-proto/test/index.js +0 -68
- package/node_modules/get-proto/tsconfig.json +0 -9
- package/node_modules/gopd/.eslintrc +0 -16
- package/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/node_modules/gopd/CHANGELOG.md +0 -45
- package/node_modules/gopd/LICENSE +0 -21
- package/node_modules/gopd/README.md +0 -40
- package/node_modules/gopd/gOPD.d.ts +0 -1
- package/node_modules/gopd/gOPD.js +0 -4
- package/node_modules/gopd/index.d.ts +0 -5
- package/node_modules/gopd/index.js +0 -15
- package/node_modules/gopd/package.json +0 -77
- package/node_modules/gopd/test/index.js +0 -36
- package/node_modules/gopd/tsconfig.json +0 -9
- package/node_modules/has-symbols/.eslintrc +0 -11
- package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/node_modules/has-symbols/.nycrc +0 -9
- package/node_modules/has-symbols/CHANGELOG.md +0 -91
- package/node_modules/has-symbols/LICENSE +0 -21
- package/node_modules/has-symbols/README.md +0 -46
- package/node_modules/has-symbols/index.d.ts +0 -3
- package/node_modules/has-symbols/index.js +0 -14
- package/node_modules/has-symbols/package.json +0 -111
- package/node_modules/has-symbols/shams.d.ts +0 -3
- package/node_modules/has-symbols/shams.js +0 -45
- package/node_modules/has-symbols/test/index.js +0 -22
- package/node_modules/has-symbols/test/shams/core-js.js +0 -29
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
- package/node_modules/has-symbols/test/tests.js +0 -58
- package/node_modules/has-symbols/tsconfig.json +0 -10
- package/node_modules/has-tostringtag/.eslintrc +0 -5
- package/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
- package/node_modules/has-tostringtag/.nycrc +0 -13
- package/node_modules/has-tostringtag/CHANGELOG.md +0 -42
- package/node_modules/has-tostringtag/LICENSE +0 -21
- package/node_modules/has-tostringtag/README.md +0 -46
- package/node_modules/has-tostringtag/index.d.ts +0 -3
- package/node_modules/has-tostringtag/index.js +0 -8
- package/node_modules/has-tostringtag/package.json +0 -108
- package/node_modules/has-tostringtag/shams.d.ts +0 -3
- package/node_modules/has-tostringtag/shams.js +0 -8
- package/node_modules/has-tostringtag/test/index.js +0 -21
- package/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
- package/node_modules/has-tostringtag/test/tests.js +0 -15
- package/node_modules/has-tostringtag/tsconfig.json +0 -49
- package/node_modules/hasown/.github/FUNDING.yml +0 -12
- package/node_modules/hasown/.nycrc +0 -13
- package/node_modules/hasown/CHANGELOG.md +0 -58
- package/node_modules/hasown/LICENSE +0 -21
- package/node_modules/hasown/README.md +0 -40
- package/node_modules/hasown/eslint.config.mjs +0 -6
- package/node_modules/hasown/index.d.ts +0 -3
- package/node_modules/hasown/index.js +0 -8
- package/node_modules/hasown/package.json +0 -91
- package/node_modules/hasown/tsconfig.json +0 -6
- package/node_modules/json-bigint/LICENSE +0 -20
- package/node_modules/json-bigint/README.md +0 -240
- package/node_modules/json-bigint/index.js +0 -12
- package/node_modules/json-bigint/lib/parse.js +0 -443
- package/node_modules/json-bigint/lib/stringify.js +0 -384
- package/node_modules/json-bigint/package.json +0 -34
- package/node_modules/math-intrinsics/.eslintrc +0 -16
- package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
- package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
- package/node_modules/math-intrinsics/LICENSE +0 -21
- package/node_modules/math-intrinsics/README.md +0 -50
- package/node_modules/math-intrinsics/abs.d.ts +0 -1
- package/node_modules/math-intrinsics/abs.js +0 -4
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
- package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
- package/node_modules/math-intrinsics/floor.d.ts +0 -1
- package/node_modules/math-intrinsics/floor.js +0 -4
- package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
- package/node_modules/math-intrinsics/isFinite.js +0 -12
- package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
- package/node_modules/math-intrinsics/isInteger.js +0 -16
- package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
- package/node_modules/math-intrinsics/isNaN.js +0 -6
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
- package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
- package/node_modules/math-intrinsics/max.d.ts +0 -1
- package/node_modules/math-intrinsics/max.js +0 -4
- package/node_modules/math-intrinsics/min.d.ts +0 -1
- package/node_modules/math-intrinsics/min.js +0 -4
- package/node_modules/math-intrinsics/mod.d.ts +0 -3
- package/node_modules/math-intrinsics/mod.js +0 -9
- package/node_modules/math-intrinsics/package.json +0 -86
- package/node_modules/math-intrinsics/pow.d.ts +0 -1
- package/node_modules/math-intrinsics/pow.js +0 -4
- package/node_modules/math-intrinsics/round.d.ts +0 -1
- package/node_modules/math-intrinsics/round.js +0 -4
- package/node_modules/math-intrinsics/sign.d.ts +0 -3
- package/node_modules/math-intrinsics/sign.js +0 -11
- package/node_modules/math-intrinsics/test/index.js +0 -192
- package/node_modules/math-intrinsics/tsconfig.json +0 -3
- package/node_modules/pako/LICENSE +0 -21
- package/node_modules/pako/README.md +0 -155
- package/node_modules/pako/dist/pako.es5.js +0 -6760
- package/node_modules/pako/dist/pako.es5.min.js +0 -2
- package/node_modules/pako/dist/pako.esm.mjs +0 -6945
- package/node_modules/pako/dist/pako.js +0 -6964
- package/node_modules/pako/dist/pako.min.js +0 -2
- package/node_modules/pako/dist/pako_deflate.es5.js +0 -3953
- package/node_modules/pako/dist/pako_deflate.es5.min.js +0 -2
- package/node_modules/pako/dist/pako_deflate.js +0 -4154
- package/node_modules/pako/dist/pako_deflate.min.js +0 -2
- package/node_modules/pako/dist/pako_inflate.es5.js +0 -3272
- package/node_modules/pako/dist/pako_inflate.es5.min.js +0 -2
- package/node_modules/pako/dist/pako_inflate.js +0 -3279
- package/node_modules/pako/dist/pako_inflate.min.js +0 -2
- package/node_modules/pako/index.js +0 -18
- package/node_modules/pako/lib/deflate.js +0 -387
- package/node_modules/pako/lib/inflate.js +0 -456
- package/node_modules/pako/lib/utils/common.js +0 -48
- package/node_modules/pako/lib/utils/strings.js +0 -174
- package/node_modules/pako/lib/zlib/README +0 -59
- package/node_modules/pako/lib/zlib/adler32.js +0 -51
- package/node_modules/pako/lib/zlib/constants.js +0 -68
- package/node_modules/pako/lib/zlib/crc32.js +0 -59
- package/node_modules/pako/lib/zlib/deflate.js +0 -2069
- package/node_modules/pako/lib/zlib/gzheader.js +0 -58
- package/node_modules/pako/lib/zlib/inffast.js +0 -344
- package/node_modules/pako/lib/zlib/inflate.js +0 -1575
- package/node_modules/pako/lib/zlib/inftrees.js +0 -340
- package/node_modules/pako/lib/zlib/messages.js +0 -32
- package/node_modules/pako/lib/zlib/trees.js +0 -1179
- package/node_modules/pako/lib/zlib/zstream.js +0 -47
- package/node_modules/pako/package.json +0 -73
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -680
- package/node_modules/semver/bin/semver.js +0 -195
- package/node_modules/semver/classes/comparator.js +0 -143
- package/node_modules/semver/classes/index.js +0 -7
- package/node_modules/semver/classes/range.js +0 -577
- package/node_modules/semver/classes/semver.js +0 -350
- package/node_modules/semver/functions/clean.js +0 -8
- package/node_modules/semver/functions/cmp.js +0 -54
- package/node_modules/semver/functions/coerce.js +0 -62
- package/node_modules/semver/functions/compare-build.js +0 -9
- package/node_modules/semver/functions/compare-loose.js +0 -5
- package/node_modules/semver/functions/compare.js +0 -7
- package/node_modules/semver/functions/diff.js +0 -60
- package/node_modules/semver/functions/eq.js +0 -5
- package/node_modules/semver/functions/gt.js +0 -5
- package/node_modules/semver/functions/gte.js +0 -5
- package/node_modules/semver/functions/inc.js +0 -21
- package/node_modules/semver/functions/lt.js +0 -5
- package/node_modules/semver/functions/lte.js +0 -5
- package/node_modules/semver/functions/major.js +0 -5
- package/node_modules/semver/functions/minor.js +0 -5
- package/node_modules/semver/functions/neq.js +0 -5
- package/node_modules/semver/functions/parse.js +0 -18
- package/node_modules/semver/functions/patch.js +0 -5
- package/node_modules/semver/functions/prerelease.js +0 -8
- package/node_modules/semver/functions/rcompare.js +0 -5
- package/node_modules/semver/functions/rsort.js +0 -5
- package/node_modules/semver/functions/satisfies.js +0 -12
- package/node_modules/semver/functions/sort.js +0 -5
- package/node_modules/semver/functions/truncate.js +0 -48
- package/node_modules/semver/functions/valid.js +0 -8
- package/node_modules/semver/index.js +0 -93
- package/node_modules/semver/internal/constants.js +0 -37
- package/node_modules/semver/internal/debug.js +0 -11
- package/node_modules/semver/internal/identifiers.js +0 -29
- package/node_modules/semver/internal/lrucache.js +0 -42
- package/node_modules/semver/internal/parse-options.js +0 -17
- package/node_modules/semver/internal/re.js +0 -223
- package/node_modules/semver/package.json +0 -78
- package/node_modules/semver/preload.js +0 -4
- package/node_modules/semver/range.bnf +0 -17
- package/node_modules/semver/ranges/gtr.js +0 -6
- package/node_modules/semver/ranges/intersects.js +0 -9
- package/node_modules/semver/ranges/ltr.js +0 -6
- package/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/node_modules/semver/ranges/min-version.js +0 -63
- package/node_modules/semver/ranges/outside.js +0 -82
- package/node_modules/semver/ranges/simplify.js +0 -49
- package/node_modules/semver/ranges/subset.js +0 -249
- package/node_modules/semver/ranges/to-comparators.js +0 -10
- package/node_modules/semver/ranges/valid.js +0 -13
- package/node_modules/spark-md5/LICENSE +0 -13
- package/node_modules/spark-md5/README.md +0 -191
- package/node_modules/spark-md5/package.json +0 -35
- package/node_modules/spark-md5/spark-md5.js +0 -751
- package/node_modules/spark-md5/spark-md5.min.js +0 -1
- package/node_modules/tldts/LICENSE +0 -13
- package/node_modules/tldts/README.md +0 -327
- package/node_modules/tldts/bin/cli.js +0 -21
- package/node_modules/tldts/dist/cjs/index.js +0 -666
- package/node_modules/tldts/dist/cjs/index.js.map +0 -1
- package/node_modules/tldts/dist/cjs/src/data/trie.js +0 -14
- package/node_modules/tldts/dist/cjs/src/data/trie.js.map +0 -1
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js +0 -67
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +0 -1
- package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/node_modules/tldts/dist/es6/index.js +0 -33
- package/node_modules/tldts/dist/es6/index.js.map +0 -1
- package/node_modules/tldts/dist/es6/src/data/trie.js +0 -11
- package/node_modules/tldts/dist/es6/src/data/trie.js.map +0 -1
- package/node_modules/tldts/dist/es6/src/suffix-trie.js +0 -64
- package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +0 -1
- package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +0 -1
- package/node_modules/tldts/dist/index.cjs.min.js +0 -2
- package/node_modules/tldts/dist/index.cjs.min.js.map +0 -1
- package/node_modules/tldts/dist/index.esm.min.js +0 -2
- package/node_modules/tldts/dist/index.esm.min.js.map +0 -1
- package/node_modules/tldts/dist/index.umd.min.js +0 -2
- package/node_modules/tldts/dist/index.umd.min.js.map +0 -1
- package/node_modules/tldts/dist/types/index.d.ts +0 -7
- package/node_modules/tldts/dist/types/src/data/trie.d.ts +0 -5
- package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +0 -5
- package/node_modules/tldts/index.ts +0 -62
- package/node_modules/tldts/package.json +0 -91
- package/node_modules/tldts/src/data/trie.ts +0 -14
- package/node_modules/tldts/src/suffix-trie.ts +0 -110
- package/node_modules/tldts-core/LICENSE +0 -13
- package/node_modules/tldts-core/README.md +0 -3
- package/node_modules/tldts-core/dist/cjs/index.js +0 -561
- package/node_modules/tldts-core/dist/cjs/index.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +0 -15
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/domain.js +0 -83
- package/node_modules/tldts-core/dist/cjs/src/domain.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +0 -149
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/factory.js +0 -104
- package/node_modules/tldts-core/dist/cjs/src/factory.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js +0 -72
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js +0 -69
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +0 -69
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +0 -3
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/options.js +0 -22
- package/node_modules/tldts-core/dist/cjs/src/options.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js +0 -14
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +0 -1
- package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/node_modules/tldts-core/dist/es6/index.js +0 -4
- package/node_modules/tldts-core/dist/es6/index.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +0 -12
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/domain.js +0 -80
- package/node_modules/tldts-core/dist/es6/src/domain.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +0 -146
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/factory.js +0 -99
- package/node_modules/tldts-core/dist/es6/src/factory.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/is-ip.js +0 -69
- package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/is-valid.js +0 -66
- package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +0 -66
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +0 -2
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/options.js +0 -19
- package/node_modules/tldts-core/dist/es6/src/options.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/src/subdomain.js +0 -11
- package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +0 -1
- package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +0 -1
- package/node_modules/tldts-core/dist/types/index.d.ts +0 -4
- package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +0 -6
- package/node_modules/tldts-core/dist/types/src/domain.d.ts +0 -5
- package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +0 -5
- package/node_modules/tldts-core/dist/types/src/factory.d.ts +0 -28
- package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +0 -6
- package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +0 -15
- package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +0 -2
- package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +0 -9
- package/node_modules/tldts-core/dist/types/src/options.d.ts +0 -10
- package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +0 -4
- package/node_modules/tldts-core/index.ts +0 -10
- package/node_modules/tldts-core/package.json +0 -68
- package/node_modules/tldts-core/src/domain-without-suffix.ts +0 -14
- package/node_modules/tldts-core/src/domain.ts +0 -100
- package/node_modules/tldts-core/src/extract-hostname.ts +0 -170
- package/node_modules/tldts-core/src/factory.ts +0 -160
- package/node_modules/tldts-core/src/is-ip.ts +0 -87
- package/node_modules/tldts-core/src/is-valid.ts +0 -79
- package/node_modules/tldts-core/src/lookup/fast-path.ts +0 -80
- package/node_modules/tldts-core/src/lookup/interface.ts +0 -10
- package/node_modules/tldts-core/src/options.ts +0 -39
- package/node_modules/tldts-core/src/subdomain.ts +0 -11
- package/node_modules/tough-cookie/LICENSE +0 -12
- package/node_modules/tough-cookie/README.md +0 -154
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +0 -33
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +0 -65
- package/node_modules/tough-cookie/dist/cookie/constants.d.ts +0 -54
- package/node_modules/tough-cookie/dist/cookie/constants.js +0 -38
- package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +0 -326
- package/node_modules/tough-cookie/dist/cookie/cookie.js +0 -831
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +0 -58
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +0 -84
- package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +0 -621
- package/node_modules/tough-cookie/dist/cookie/cookieJar.js +0 -1000
- package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +0 -40
- package/node_modules/tough-cookie/dist/cookie/defaultPath.js +0 -60
- package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +0 -38
- package/node_modules/tough-cookie/dist/cookie/domainMatch.js +0 -94
- package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +0 -15
- package/node_modules/tough-cookie/dist/cookie/formatDate.js +0 -20
- package/node_modules/tough-cookie/dist/cookie/index.d.ts +0 -29
- package/node_modules/tough-cookie/dist/cookie/index.js +0 -54
- package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +0 -103
- package/node_modules/tough-cookie/dist/cookie/parseDate.js +0 -323
- package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +0 -14
- package/node_modules/tough-cookie/dist/cookie/permutePath.js +0 -32
- package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +0 -55
- package/node_modules/tough-cookie/dist/getPublicSuffix.js +0 -71
- package/node_modules/tough-cookie/dist/memstore.d.ts +0 -220
- package/node_modules/tough-cookie/dist/memstore.js +0 -187
- package/node_modules/tough-cookie/dist/pathMatch.d.ts +0 -17
- package/node_modules/tough-cookie/dist/pathMatch.js +0 -40
- package/node_modules/tough-cookie/dist/permuteDomain.d.ts +0 -15
- package/node_modules/tough-cookie/dist/permuteDomain.js +0 -44
- package/node_modules/tough-cookie/dist/store.d.ts +0 -211
- package/node_modules/tough-cookie/dist/store.js +0 -76
- package/node_modules/tough-cookie/dist/utils.d.ts +0 -34
- package/node_modules/tough-cookie/dist/utils.js +0 -99
- package/node_modules/tough-cookie/dist/validators.d.ts +0 -24
- package/node_modules/tough-cookie/dist/validators.js +0 -90
- package/node_modules/tough-cookie/dist/version.d.ts +0 -5
- package/node_modules/tough-cookie/dist/version.js +0 -8
- package/node_modules/tough-cookie/package.json +0 -144
- package/node_modules/ws/LICENSE +0 -20
- package/node_modules/ws/README.md +0 -548
- package/node_modules/ws/browser.js +0 -8
- package/node_modules/ws/index.js +0 -22
- package/node_modules/ws/lib/buffer-util.js +0 -131
- package/node_modules/ws/lib/constants.js +0 -19
- package/node_modules/ws/lib/event-target.js +0 -292
- package/node_modules/ws/lib/extension.js +0 -203
- package/node_modules/ws/lib/limiter.js +0 -55
- package/node_modules/ws/lib/permessage-deflate.js +0 -530
- package/node_modules/ws/lib/receiver.js +0 -743
- package/node_modules/ws/lib/sender.js +0 -607
- package/node_modules/ws/lib/stream.js +0 -161
- package/node_modules/ws/lib/subprotocol.js +0 -62
- package/node_modules/ws/lib/validation.js +0 -152
- package/node_modules/ws/lib/websocket-server.js +0 -562
- package/node_modules/ws/lib/websocket.js +0 -1407
- package/node_modules/ws/package.json +0 -74
- package/node_modules/ws/wrapper.mjs +0 -21
- package/node_modules/zca-js/.prettierrc +0 -5
- package/node_modules/zca-js/CODE_OF_CONDUCT.md +0 -163
- package/node_modules/zca-js/CONTRIBUTING.md +0 -470
- package/node_modules/zca-js/LICENSE +0 -21
- package/node_modules/zca-js/README.md +0 -225
- package/node_modules/zca-js/SECURITY.md +0 -83
- package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +0 -4
- package/node_modules/zca-js/dist/Errors/ZaloApiError.js +0 -7
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +0 -4
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +0 -7
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +0 -4
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +0 -7
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +0 -4
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +0 -7
- package/node_modules/zca-js/dist/Errors/index.d.ts +0 -4
- package/node_modules/zca-js/dist/Errors/index.js +0 -4
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +0 -28
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +0 -28
- package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/addGroupDeputy.js +0 -30
- package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/addPollOptions.js +0 -26
- package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/addQuickMessage.js +0 -60
- package/node_modules/zca-js/dist/apis/addReaction.d.ts +0 -18
- package/node_modules/zca-js/dist/apis/addReaction.js +0 -294
- package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/addUnreadMark.js +0 -52
- package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/addUserToGroup.js +0 -34
- package/node_modules/zca-js/dist/apis/blockUser.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/blockUser.js +0 -28
- package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/blockViewFeed.js +0 -30
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +0 -52
- package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/changeFriendAlias.js +0 -27
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +0 -44
- package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/changeGroupName.js +0 -32
- package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/changeGroupOwner.js +0 -30
- package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/createAutoReply.js +0 -37
- package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/createBankAccount.js +0 -32
- package/node_modules/zca-js/dist/apis/createCatalog.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/createCatalog.js +0 -29
- package/node_modules/zca-js/dist/apis/createGroup.d.ts +0 -28
- package/node_modules/zca-js/dist/apis/createGroup.js +0 -43
- package/node_modules/zca-js/dist/apis/createNote.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/createNote.js +0 -47
- package/node_modules/zca-js/dist/apis/createPoll.d.ts +0 -36
- package/node_modules/zca-js/dist/apis/createPoll.js +0 -40
- package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +0 -23
- package/node_modules/zca-js/dist/apis/createProductCatalog.js +0 -50
- package/node_modules/zca-js/dist/apis/createReminder.d.ts +0 -12
- package/node_modules/zca-js/dist/apis/createReminder.js +0 -63
- package/node_modules/zca-js/dist/apis/custom.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/custom.js +0 -15
- package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/deleteAutoReply.js +0 -29
- package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/deleteAvatar.js +0 -27
- package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/deleteBankAccount.js +0 -32
- package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/deleteCatalog.js +0 -28
- package/node_modules/zca-js/dist/apis/deleteChat.d.ts +0 -19
- package/node_modules/zca-js/dist/apis/deleteChat.js +0 -50
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +0 -27
- package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/deleteMessage.js +0 -52
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +0 -31
- package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/disableGroupLink.js +0 -24
- package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/disperseGroup.js +0 -28
- package/node_modules/zca-js/dist/apis/editNote.d.ts +0 -17
- package/node_modules/zca-js/dist/apis/editNote.js +0 -46
- package/node_modules/zca-js/dist/apis/editReminder.d.ts +0 -13
- package/node_modules/zca-js/dist/apis/editReminder.js +0 -61
- package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +0 -6
- package/node_modules/zca-js/dist/apis/enableGroupLink.js +0 -25
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +0 -10
- package/node_modules/zca-js/dist/apis/findUser.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/findUser.js +0 -42
- package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/findUserByUsername.js +0 -27
- package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +0 -24
- package/node_modules/zca-js/dist/apis/forwardMessage.js +0 -114
- package/node_modules/zca-js/dist/apis/getAliasList.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/getAliasList.js +0 -27
- package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getAllFriends.js +0 -34
- package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/getAllGroups.js +0 -10
- package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getArchivedChatList.js +0 -23
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +0 -21
- package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +0 -6
- package/node_modules/zca-js/dist/apis/getAutoReplyList.js +0 -24
- package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +0 -12
- package/node_modules/zca-js/dist/apis/getAvatarList.js +0 -28
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +0 -30
- package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +0 -24
- package/node_modules/zca-js/dist/apis/getBizAccount.js +0 -27
- package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +0 -18
- package/node_modules/zca-js/dist/apis/getCatalogList.js +0 -32
- package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getCloseFriends.js +0 -20
- package/node_modules/zca-js/dist/apis/getContext.d.ts +0 -1
- package/node_modules/zca-js/dist/apis/getContext.js +0 -4
- package/node_modules/zca-js/dist/apis/getCookie.d.ts +0 -1
- package/node_modules/zca-js/dist/apis/getCookie.js +0 -9
- package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getFriendBoardList.js +0 -26
- package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/getFriendOnlines.js +0 -35
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +0 -42
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +0 -27
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +0 -25
- package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getFullAvatar.js +0 -25
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +0 -23
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +0 -29
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +0 -36
- package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +0 -16
- package/node_modules/zca-js/dist/apis/getGroupInfo.js +0 -32
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +0 -32
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +0 -38
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +0 -38
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +0 -31
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +0 -25
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +0 -34
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +0 -28
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +0 -17
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +0 -24
- package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/getHiddenConversations.js +0 -23
- package/node_modules/zca-js/dist/apis/getLabels.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/getLabels.js +0 -28
- package/node_modules/zca-js/dist/apis/getListBank.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getListBank.js +0 -20
- package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/getListBankAccount.js +0 -27
- package/node_modules/zca-js/dist/apis/getListBoard.d.ts +0 -21
- package/node_modules/zca-js/dist/apis/getListBoard.js +0 -45
- package/node_modules/zca-js/dist/apis/getListDevice.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/getListDevice.js +0 -22
- package/node_modules/zca-js/dist/apis/getListReminder.d.ts +0 -28
- package/node_modules/zca-js/dist/apis/getListReminder.js +0 -47
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +0 -39
- package/node_modules/zca-js/dist/apis/getMute.d.ts +0 -13
- package/node_modules/zca-js/dist/apis/getMute.js +0 -22
- package/node_modules/zca-js/dist/apis/getOwnId.d.ts +0 -1
- package/node_modules/zca-js/dist/apis/getOwnId.js +0 -4
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +0 -27
- package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getPinConversations.js +0 -22
- package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getPollDetail.js +0 -30
- package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +0 -20
- package/node_modules/zca-js/dist/apis/getProductCatalogList.js +0 -33
- package/node_modules/zca-js/dist/apis/getQR.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/getQR.js +0 -29
- package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/getQuickMessageList.js +0 -24
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +0 -6
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +0 -30
- package/node_modules/zca-js/dist/apis/getReminder.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getReminder.js +0 -25
- package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/getReminderResponses.js +0 -24
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +0 -18
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +0 -24
- package/node_modules/zca-js/dist/apis/getSettings.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getSettings.js +0 -20
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +0 -24
- package/node_modules/zca-js/dist/apis/getStickers.d.ts +0 -1
- package/node_modules/zca-js/dist/apis/getStickers.js +0 -40
- package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/getStickersDetail.js +0 -40
- package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/getUnreadMark.js +0 -30
- package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/getUserInfo.js +0 -44
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +0 -30
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +0 -25
- package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/joinGroupLink.js +0 -27
- package/node_modules/zca-js/dist/apis/keepAlive.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/keepAlive.js +0 -22
- package/node_modules/zca-js/dist/apis/lastOnline.d.ts +0 -7
- package/node_modules/zca-js/dist/apis/lastOnline.js +0 -26
- package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/leaveGroup.js +0 -33
- package/node_modules/zca-js/dist/apis/listen.d.ts +0 -102
- package/node_modules/zca-js/dist/apis/listen.js +0 -425
- package/node_modules/zca-js/dist/apis/lockPoll.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/lockPoll.js +0 -28
- package/node_modules/zca-js/dist/apis/login.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/login.js +0 -96
- package/node_modules/zca-js/dist/apis/loginQR.d.ts +0 -71
- package/node_modules/zca-js/dist/apis/loginQR.js +0 -376
- package/node_modules/zca-js/dist/apis/logoutV2.js +0 -79
- package/node_modules/zca-js/dist/apis/lostFocus.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/lostFocus.js +0 -23
- package/node_modules/zca-js/dist/apis/parseLink.d.ts +0 -21
- package/node_modules/zca-js/dist/apis/parseLink.js +0 -27
- package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/registerCatalog.js +0 -27
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +0 -27
- package/node_modules/zca-js/dist/apis/removeFriend.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/removeFriend.js +0 -28
- package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/removeFriendAlias.js +0 -24
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +0 -28
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +0 -30
- package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/removeQuickMessage.js +0 -27
- package/node_modules/zca-js/dist/apis/removeReminder.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/removeReminder.js +0 -40
- package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +0 -8
- package/node_modules/zca-js/dist/apis/removeUnreadMark.js +0 -50
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +0 -34
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +0 -20
- package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/reuseAvatar.js +0 -26
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +0 -38
- package/node_modules/zca-js/dist/apis/scanURL.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/scanURL.js +0 -28
- package/node_modules/zca-js/dist/apis/searchSticker.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/searchSticker.js +0 -28
- package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/sendBankCard.js +0 -53
- package/node_modules/zca-js/dist/apis/sendCard.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/sendCard.js +0 -75
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +0 -16
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +0 -55
- package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/sendFriendRequest.js +0 -39
- package/node_modules/zca-js/dist/apis/sendLink.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/sendLink.js +0 -78
- package/node_modules/zca-js/dist/apis/sendMessage.d.ts +0 -105
- package/node_modules/zca-js/dist/apis/sendMessage.js +0 -486
- package/node_modules/zca-js/dist/apis/sendReport.d.ts +0 -17
- package/node_modules/zca-js/dist/apis/sendReport.js +0 -53
- package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +0 -16
- package/node_modules/zca-js/dist/apis/sendSeenEvent.js +0 -63
- package/node_modules/zca-js/dist/apis/sendSticker.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/sendSticker.js +0 -74
- package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/sendTypingEvent.js +0 -33
- package/node_modules/zca-js/dist/apis/sendVideo.d.ts +0 -35
- package/node_modules/zca-js/dist/apis/sendVideo.js +0 -134
- package/node_modules/zca-js/dist/apis/sendVoice.d.ts +0 -12
- package/node_modules/zca-js/dist/apis/sendVoice.js +0 -89
- package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/setHiddenConversations.js +0 -39
- package/node_modules/zca-js/dist/apis/setMute.d.ts +0 -20
- package/node_modules/zca-js/dist/apis/setMute.js +0 -67
- package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +0 -3
- package/node_modules/zca-js/dist/apis/setPinnedConversations.js +0 -34
- package/node_modules/zca-js/dist/apis/sharePoll.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/sharePoll.js +0 -28
- package/node_modules/zca-js/dist/apis/unblockUser.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/unblockUser.js +0 -28
- package/node_modules/zca-js/dist/apis/undo.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/undo.js +0 -42
- package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/undoFriendRequest.js +0 -27
- package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +0 -4
- package/node_modules/zca-js/dist/apis/updateActiveStatus.js +0 -27
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +0 -10
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +0 -34
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +0 -40
- package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +0 -15
- package/node_modules/zca-js/dist/apis/updateAutoReply.js +0 -38
- package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +0 -9
- package/node_modules/zca-js/dist/apis/updateBankAccount.js +0 -31
- package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/updateCatalog.js +0 -30
- package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +0 -40
- package/node_modules/zca-js/dist/apis/updateGroupSettings.js +0 -43
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +0 -30
- package/node_modules/zca-js/dist/apis/updateLabels.d.ts +0 -15
- package/node_modules/zca-js/dist/apis/updateLabels.js +0 -34
- package/node_modules/zca-js/dist/apis/updateLang.d.ts +0 -6
- package/node_modules/zca-js/dist/apis/updateLang.js +0 -30
- package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +0 -25
- package/node_modules/zca-js/dist/apis/updateProductCatalog.js +0 -51
- package/node_modules/zca-js/dist/apis/updateProfile.d.ts +0 -20
- package/node_modules/zca-js/dist/apis/updateProfile.js +0 -43
- package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/updateProfileBio.js +0 -27
- package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +0 -11
- package/node_modules/zca-js/dist/apis/updateQuickMessage.js +0 -61
- package/node_modules/zca-js/dist/apis/updateSettings.d.ts +0 -16
- package/node_modules/zca-js/dist/apis/updateSettings.js +0 -90
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +0 -2
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +0 -27
- package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +0 -50
- package/node_modules/zca-js/dist/apis/uploadAttachment.js +0 -197
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +0 -14
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +0 -50
- package/node_modules/zca-js/dist/apis/votePoll.d.ts +0 -5
- package/node_modules/zca-js/dist/apis/votePoll.js +0 -29
- package/node_modules/zca-js/dist/apis.d.ts +0 -317
- package/node_modules/zca-js/dist/apis.js +0 -319
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +0 -11
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +0 -12
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +0 -12
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +0 -12
- package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +0 -31
- package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +0 -65
- package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +0 -308
- package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +0 -66
- package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +0 -39
- package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +0 -57
- package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +0 -49
- package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +0 -37
- package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +0 -42
- package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +0 -37
- package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +0 -48
- package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +0 -52
- package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +0 -45
- package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +0 -55
- package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +0 -77
- package/node_modules/zca-js/dist/cjs/apis/custom.cjs +0 -19
- package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +0 -37
- package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +0 -64
- package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +0 -66
- package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +0 -36
- package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +0 -51
- package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +0 -75
- package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +0 -15
- package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +0 -56
- package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +0 -41
- package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +0 -129
- package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +0 -48
- package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +0 -15
- package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +0 -28
- package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +0 -26
- package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +0 -44
- package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +0 -37
- package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +0 -25
- package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +0 -9
- package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +0 -14
- package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +0 -31
- package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +0 -40
- package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +0 -51
- package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +0 -37
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +0 -43
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +0 -36
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +0 -28
- package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +0 -25
- package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +0 -59
- package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +0 -27
- package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +0 -61
- package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +0 -53
- package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +0 -27
- package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +0 -9
- package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +0 -27
- package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +0 -38
- package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +0 -25
- package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +0 -45
- package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +0 -45
- package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +0 -58
- package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +0 -30
- package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +0 -27
- package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +0 -31
- package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +0 -38
- package/node_modules/zca-js/dist/cjs/apis/listen.cjs +0 -440
- package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/login.cjs +0 -102
- package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +0 -368
- package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +0 -83
- package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +0 -28
- package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +0 -29
- package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +0 -54
- package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +0 -64
- package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +0 -39
- package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +0 -25
- package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +0 -31
- package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +0 -43
- package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +0 -68
- package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +0 -89
- package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +0 -69
- package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +0 -44
- package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +0 -92
- package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +0 -500
- package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +0 -67
- package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +0 -77
- package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +0 -88
- package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +0 -47
- package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +0 -148
- package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +0 -103
- package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +0 -53
- package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +0 -81
- package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +0 -48
- package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +0 -33
- package/node_modules/zca-js/dist/cjs/apis/undo.cjs +0 -56
- package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +0 -39
- package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +0 -54
- package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +0 -43
- package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +0 -36
- package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +0 -48
- package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +0 -39
- package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +0 -56
- package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +0 -48
- package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +0 -66
- package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +0 -95
- package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +0 -32
- package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +0 -211
- package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +0 -55
- package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/apis.cjs +0 -324
- package/node_modules/zca-js/dist/cjs/context.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/index.cjs +0 -159
- package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +0 -9
- package/node_modules/zca-js/dist/cjs/models/Bank.cjs +0 -263
- package/node_modules/zca-js/dist/cjs/models/Board.cjs +0 -8
- package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +0 -23
- package/node_modules/zca-js/dist/cjs/models/Enum.cjs +0 -27
- package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +0 -87
- package/node_modules/zca-js/dist/cjs/models/Group.cjs +0 -13
- package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +0 -94
- package/node_modules/zca-js/dist/cjs/models/Message.cjs +0 -35
- package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +0 -74
- package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +0 -9
- package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +0 -23
- package/node_modules/zca-js/dist/cjs/models/Typing.cjs +0 -23
- package/node_modules/zca-js/dist/cjs/models/Undo.cjs +0 -16
- package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +0 -39
- package/node_modules/zca-js/dist/cjs/update.cjs +0 -34
- package/node_modules/zca-js/dist/cjs/utils.cjs +0 -703
- package/node_modules/zca-js/dist/cjs/zalo.cjs +0 -112
- package/node_modules/zca-js/dist/context.d.ts +0 -179
- package/node_modules/zca-js/dist/context.js +0 -28
- package/node_modules/zca-js/dist/index.d.ts +0 -166
- package/node_modules/zca-js/dist/index.js +0 -14
- package/node_modules/zca-js/dist/models/Attachment.d.ts +0 -9
- package/node_modules/zca-js/dist/models/Attachment.js +0 -1
- package/node_modules/zca-js/dist/models/AutoReply.d.ts +0 -20
- package/node_modules/zca-js/dist/models/AutoReply.js +0 -7
- package/node_modules/zca-js/dist/models/Bank.d.ts +0 -291
- package/node_modules/zca-js/dist/models/Bank.js +0 -262
- package/node_modules/zca-js/dist/models/Board.d.ts +0 -60
- package/node_modules/zca-js/dist/models/Board.js +0 -6
- package/node_modules/zca-js/dist/models/Catalog.d.ts +0 -16
- package/node_modules/zca-js/dist/models/Catalog.js +0 -1
- package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +0 -27
- package/node_modules/zca-js/dist/models/DeliveredMessage.js +0 -17
- package/node_modules/zca-js/dist/models/Enum.d.ts +0 -21
- package/node_modules/zca-js/dist/models/Enum.js +0 -25
- package/node_modules/zca-js/dist/models/FriendEvent.d.ts +0 -107
- package/node_modules/zca-js/dist/models/FriendEvent.js +0 -83
- package/node_modules/zca-js/dist/models/Group.d.ts +0 -125
- package/node_modules/zca-js/dist/models/Group.js +0 -11
- package/node_modules/zca-js/dist/models/GroupEvent.d.ts +0 -178
- package/node_modules/zca-js/dist/models/GroupEvent.js +0 -90
- package/node_modules/zca-js/dist/models/Label.d.ts +0 -10
- package/node_modules/zca-js/dist/models/Label.js +0 -1
- package/node_modules/zca-js/dist/models/Message.d.ts +0 -91
- package/node_modules/zca-js/dist/models/Message.js +0 -29
- package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +0 -17
- package/node_modules/zca-js/dist/models/ProductCatalog.js +0 -1
- package/node_modules/zca-js/dist/models/QuickMessage.d.ts +0 -25
- package/node_modules/zca-js/dist/models/QuickMessage.js +0 -1
- package/node_modules/zca-js/dist/models/Reaction.d.ts +0 -85
- package/node_modules/zca-js/dist/models/Reaction.js +0 -70
- package/node_modules/zca-js/dist/models/Reminder.d.ts +0 -51
- package/node_modules/zca-js/dist/models/Reminder.js +0 -7
- package/node_modules/zca-js/dist/models/SeenMessage.d.ts +0 -26
- package/node_modules/zca-js/dist/models/SeenMessage.js +0 -17
- package/node_modules/zca-js/dist/models/Sticker.d.ts +0 -27
- package/node_modules/zca-js/dist/models/Sticker.js +0 -1
- package/node_modules/zca-js/dist/models/Typing.d.ts +0 -24
- package/node_modules/zca-js/dist/models/Typing.js +0 -17
- package/node_modules/zca-js/dist/models/Undo.d.ts +0 -34
- package/node_modules/zca-js/dist/models/Undo.js +0 -12
- package/node_modules/zca-js/dist/models/User.d.ts +0 -70
- package/node_modules/zca-js/dist/models/User.js +0 -1
- package/node_modules/zca-js/dist/models/ZBusiness.d.ts +0 -22
- package/node_modules/zca-js/dist/models/ZBusiness.js +0 -35
- package/node_modules/zca-js/dist/models/index.d.ts +0 -22
- package/node_modules/zca-js/dist/models/index.js +0 -22
- package/node_modules/zca-js/dist/update.d.ts +0 -2
- package/node_modules/zca-js/dist/update.js +0 -29
- package/node_modules/zca-js/dist/utils.d.ts +0 -167
- package/node_modules/zca-js/dist/utils.js +0 -719
- package/node_modules/zca-js/dist/zalo.d.ts +0 -41
- package/node_modules/zca-js/dist/zalo.js +0 -107
- package/node_modules/zca-js/eslint.config.js +0 -21
- package/node_modules/zca-js/index.d.ts +0 -2
- package/node_modules/zca-js/package.json +0 -78
- package/node_modules/zca-js/rollup.config.js +0 -28
- package/patches/zca-js+2.2.0.patch +0 -1445
- package/src/cli.test.js +0 -127
- package/src/core/forward.js +0 -112
- package/src/core/group-history.js +0 -248
- package/src/core/group-invite.js +0 -53
- package/src/core/offline-queue.js +0 -194
- package/src/core/pin.js +0 -222
- package/src/core/socket-tap.js +0 -154
- package/src/core/sync-v2/assets.js +0 -181
- package/src/core/sync-v2/gid.js +0 -106
- package/src/core/sync-v2/keepalive.js +0 -177
- package/src/core/sync-v2/message-types.js +0 -522
- package/src/core/sync-v2/renewlink.js +0 -124
- package/src/core/sync-v2/zcloud-cipher.js +0 -88
- package/src/core/zca-custom.js +0 -78
- package/src/mcp/message-buffer.test.js +0 -360
- package/src/mcp/notifier.test.js +0 -275
- package/src/mcp/thread-filter.test.js +0 -206
- package/src/mcp/thread-name-cache.test.js +0 -142
- package/src/utils/atomic-file.js +0 -209
- package/src/utils/bank-helpers.test.js +0 -66
- package/src/utils/device-fingerprint.js +0 -72
- package/src/utils/mentions.js +0 -140
- package/src/utils/proxy-helpers.test.js +0 -36
- package/src/utils/split-message.js +0 -166
- package/src/utils/urgency.js +0 -29
- /package/src/{core → zalo/custom}/user-info.js +0 -0
- /package/src/{utils → zalo/format}/extract-message-text.js +0 -0
- /package/src/{utils → zalo/format}/markdown.js +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* transfer-sync-v2 — restore mobile message history into zalo.db.
|
|
3
3
|
*
|
|
4
4
|
* This is the real, phone-backed sync (as opposed to the empty cmd 510/511
|
|
5
|
-
* socket backfill). Flow, all over the one
|
|
5
|
+
* socket backfill). Flow, all over the listener's one WebSocket:
|
|
6
6
|
*
|
|
7
7
|
* 1. cmd 590 CONVERSATION round (priority 0, partition "") — prompts the
|
|
8
8
|
* owner's phone once (transfer_status 3 -> 4 on tap). Decrypts to the full
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* See tests/HANDOFF.md / agent/work/transfer-sync-v2 for the protocol notes.
|
|
21
21
|
*/
|
|
22
|
+
import { getGroupInfoWatched } from "../group-exit.js";
|
|
22
23
|
import zlib from "node:zlib";
|
|
23
24
|
import crypto from "node:crypto";
|
|
24
25
|
import { resolve } from "node:path";
|
|
@@ -34,14 +35,49 @@ import {
|
|
|
34
35
|
getThreadType,
|
|
35
36
|
getRecentThreads,
|
|
36
37
|
findMessageByClientId,
|
|
38
|
+
countSyncRanges,
|
|
39
|
+
deleteSyncRanges,
|
|
40
|
+
getSyncRanges,
|
|
41
|
+
markSyncRangesPending,
|
|
42
|
+
setSyncRangeStatus,
|
|
37
43
|
} from "../db.js";
|
|
38
|
-
import { ensureAssets, loadCodecs } from "
|
|
39
|
-
import { classifySyncMessage } from "
|
|
40
|
-
import { resolveNonFriendDms } from "
|
|
44
|
+
import { ensureAssets, loadCodecs } from "../../zalo/transfer-sync/assets.js";
|
|
45
|
+
import { classifySyncMessage } from "../../zalo/transfer-sync/message-types.js";
|
|
46
|
+
import { resolveNonFriendDms } from "../../zalo/custom/gid.js";
|
|
41
47
|
import { createSenderResolver } from "./senders.js";
|
|
42
48
|
import { readUserAliases, currentUserName, resolveCurrentUserNames } from "../current-user-names.js";
|
|
43
|
-
import {
|
|
49
|
+
import { refreshProfiles } from "../name-refresh.js";
|
|
50
|
+
import { startKeepAlive } from "../../zalo/listener/keepalive.js";
|
|
51
|
+
import { DEVICE_LABEL } from "../../zalo/profile.js";
|
|
52
|
+
import { decodeFrame } from "../../zalo/listener/frames.js";
|
|
53
|
+
import {
|
|
54
|
+
REQUEST_FAILURE,
|
|
55
|
+
SyncRequestError,
|
|
56
|
+
createSessionStore,
|
|
57
|
+
createSyncChannel,
|
|
58
|
+
} from "../../zalo/transfer-sync/channel.js";
|
|
59
|
+
import { createBatchDownloader } from "../../zalo/transfer-sync/download.js";
|
|
60
|
+
import { createDownloadFetch } from "../../zalo/download-fetch.js";
|
|
61
|
+
import { coveredAfter, planRanges, rangeStatusAfter } from "./ranges.js";
|
|
62
|
+
import {
|
|
63
|
+
CONFIRM_WAIT_MS,
|
|
64
|
+
DISPOSE_REASON,
|
|
65
|
+
applyControl,
|
|
66
|
+
createTransferSession,
|
|
67
|
+
declineError,
|
|
68
|
+
PARTITION_NOT_FOUND,
|
|
69
|
+
isConfirmed,
|
|
70
|
+
isIdleTooLong,
|
|
71
|
+
isStalledIdle,
|
|
72
|
+
isTransferSessionComplete,
|
|
73
|
+
judgeConversationRound,
|
|
74
|
+
recordDownloadFailure,
|
|
75
|
+
readTransferControls,
|
|
76
|
+
shouldAbortOnFailures,
|
|
77
|
+
STALL_IDLE_MS,
|
|
78
|
+
} from "../../zalo/transfer-sync/transfer.js";
|
|
44
79
|
import { attachLiveStore } from "../live-store.js";
|
|
80
|
+
import { codecForDir } from "../keystore/index.js";
|
|
45
81
|
|
|
46
82
|
/**
|
|
47
83
|
* Lower bound of a "full history" sync: the beginning of time.
|
|
@@ -67,26 +103,40 @@ const MAX_TS = 9007199254740991;
|
|
|
67
103
|
* one-shard run.
|
|
68
104
|
*/
|
|
69
105
|
const PER_SHARD_BUDGET_MS = 30000;
|
|
106
|
+
/** How long a session may be waited for before the restore says what it is still missing. */
|
|
107
|
+
const STALL_NOTE_MS = 60_000;
|
|
108
|
+
/**
|
|
109
|
+
* How many message sessions are asked for before the first of them has been served.
|
|
110
|
+
*
|
|
111
|
+
* Every session of a run (98 partitions at 30 each is four of them) goes out one after the other, each after the
|
|
112
|
+
* previous one was acknowledged; they are then consumed and released together at the end. Fifty at once, with no
|
|
113
|
+
* waiting for acks, once got our socket dropped with no error frame; the requests are ack-paced now. The phone stops
|
|
114
|
+
* serving at about 32 sessions that are open together (live, 2026-10-25), so a wave is at most 30, which is also the
|
|
115
|
+
* most the restore takes (see `waveSize`): a run of 79 sessions is three waves, and the sessions of a wave are released
|
|
116
|
+
* together when the wave is done.
|
|
117
|
+
*/
|
|
118
|
+
const DEFAULT_WAVE_SIZE = 30;
|
|
70
119
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
120
|
+
* Sessions released at once. One: each release goes out after the previous one was acknowledged. Four 591 within 3 ms
|
|
121
|
+
* can get four acks, but this client's bursts were answered only in part (live, 2026-10-28: two acks for
|
|
122
|
+
* thirty releases, two for each burst of four, the rest unanswered for 3 s and then released fine one at a time),
|
|
123
|
+
* while one at a time was acknowledged every time.
|
|
73
124
|
*/
|
|
74
|
-
const
|
|
125
|
+
const RELEASE_BURST = 1;
|
|
75
126
|
/**
|
|
76
127
|
* How many times a dropped socket may be reconnected inside one restore.
|
|
77
128
|
*
|
|
78
|
-
*
|
|
79
|
-
* the
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* dying.
|
|
129
|
+
* Three, as in a daemon. It was one, on the argument that a reconnect may cost the person a second tap if the server
|
|
130
|
+
* does not carry the phone's confirmation across it. Live, 2026-10-28, none of a dozen or so reconnects on the
|
|
131
|
+
* test account prompted the phone again, and each cost about three seconds (a two second pause, then the dead
|
|
132
|
+
* socket's sessions released). A restore that dies on its second drop throws away a run that a phone tap bought.
|
|
83
133
|
*/
|
|
84
|
-
const MAX_RESUMES =
|
|
134
|
+
const MAX_RESUMES = 3;
|
|
85
135
|
/** The most reconnects a caller may ask a single restore to attempt. */
|
|
86
136
|
const MAX_RESUMES_CAP = 5;
|
|
87
137
|
|
|
88
138
|
/**
|
|
89
|
-
* How many reconnects a restore may spend: the caller's `maxResumes` (a whole number, capped), else
|
|
139
|
+
* How many reconnects a restore may spend: the caller's `maxResumes` (a whole number, capped), else three.
|
|
90
140
|
*
|
|
91
141
|
* @param {unknown} requested
|
|
92
142
|
* @returns {number}
|
|
@@ -119,7 +169,7 @@ const DAY_MS = 24 * 60 * 60 * 1000;
|
|
|
119
169
|
* - a CONFIRMED empty window (the phone answered: nothing in this range was
|
|
120
170
|
* missed) returned before the success markers were written, so it never
|
|
121
171
|
* counted. That is the common case over any window a listener was
|
|
122
|
-
* connected for: the phone hands a sync only what
|
|
172
|
+
* connected for: the phone hands a sync only what this client's session missed.
|
|
123
173
|
* - checkSyncFreshness never skips while any gap is pending, and nothing
|
|
124
174
|
* resolved gaps (resolveSyncGap had only test callers), so after the first
|
|
125
175
|
* listener reconnect every later run pinged the phone forever.
|
|
@@ -219,49 +269,18 @@ function decompress(p) {
|
|
|
219
269
|
}
|
|
220
270
|
|
|
221
271
|
/**
|
|
222
|
-
* Decode a
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* @param {{encrypt: number, data: string}} parsed
|
|
228
|
-
* @param {string} cipherKey - base64 AES key from the handshake.
|
|
272
|
+
* Decode a WebSocket frame body from Zalo (the `{encrypt, data}` envelope) with the per-session cipher key (the `key`
|
|
273
|
+
* of the cmd 1/1 handshake frame): encrypt 0 plain JSON, 1 inflate only, 2 AES-GCM then inflate, 3 AES-GCM only. The
|
|
274
|
+
* decoder lives with the listener (src/zalo/listener/frames.js) and is re-exported here, so the listener, the raw tap
|
|
275
|
+
* and sync-v2 share one copy.
|
|
229
276
|
*/
|
|
230
|
-
export
|
|
231
|
-
if (parsed.encrypt === 0) return JSON.parse(parsed.data);
|
|
232
|
-
const raw = Buffer.from(parsed.encrypt === 1 ? parsed.data : decodeURIComponent(parsed.data), "base64");
|
|
233
|
-
let plain = raw;
|
|
234
|
-
if (parsed.encrypt !== 1) {
|
|
235
|
-
if (!cipherKey || raw.length < 48) throw new Error("missing cipher key or short frame");
|
|
236
|
-
const iv = raw.subarray(0, 16);
|
|
237
|
-
const aad = raw.subarray(16, 32);
|
|
238
|
-
const body = raw.subarray(32);
|
|
239
|
-
const ct = body.subarray(0, body.length - 16);
|
|
240
|
-
const tag = body.subarray(body.length - 16);
|
|
241
|
-
const key = Buffer.from(cipherKey, "base64");
|
|
242
|
-
const decipher = crypto.createDecipheriv(key.length === 16 ? "aes-128-gcm" : "aes-256-gcm", key, iv);
|
|
243
|
-
decipher.setAAD(aad);
|
|
244
|
-
decipher.setAuthTag(tag);
|
|
245
|
-
plain = Buffer.concat([decipher.update(ct), decipher.final()]);
|
|
246
|
-
}
|
|
247
|
-
// encrypt 1/2 wrap the payload with zlib OR gzip (pako auto-detects both);
|
|
248
|
-
// zlib.unzipSync handles either. encrypt 3 is uncompressed.
|
|
249
|
-
let out = plain;
|
|
250
|
-
if (parsed.encrypt !== 3) {
|
|
251
|
-
try {
|
|
252
|
-
out = zlib.unzipSync(plain);
|
|
253
|
-
} catch {
|
|
254
|
-
out = zlib.inflateRawSync(plain);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return JSON.parse(out.toString("utf8"));
|
|
258
|
-
}
|
|
277
|
+
export { decodeFrame };
|
|
259
278
|
|
|
260
279
|
/**
|
|
261
280
|
* Has a sync session delivered everything it was asked for?
|
|
262
281
|
*
|
|
263
|
-
* `isLast` looks like the end marker and mostly is, but a
|
|
264
|
-
*
|
|
282
|
+
* `isLast` looks like the end marker and mostly is, but a run can
|
|
283
|
+
* end its final message session with `isLast=0` and dispose it anyway. What
|
|
265
284
|
* actually completes a message session is coverage: every partition in the
|
|
266
285
|
* cmd 590 request has come back inside some batch's `scopes`. The conversation
|
|
267
286
|
* round asks for the empty partition and its batches carry no scopes, so there
|
|
@@ -384,13 +403,24 @@ export function createShardSchedule(shardCount, opts = {}) {
|
|
|
384
403
|
* @param {number} st.total - shards requested
|
|
385
404
|
* @param {number} [st.resumes=0] - reconnects used
|
|
386
405
|
* @param {number} [st.waitMs] - the budget, for the timeout wording
|
|
406
|
+
* @param {number} [st.failedBatches] - batches the phone could not serve
|
|
387
407
|
* @param {number} [st.rowErrors] - rows that could not be written to the cache
|
|
408
|
+
* @param {boolean} [st.tooManyFailures] - the run was stopped because too many batches failed
|
|
388
409
|
* @returns {{reason: string, error: string|null}}
|
|
389
410
|
*/
|
|
390
411
|
export function describeRestoreOutcome(st) {
|
|
391
412
|
const resumes = st.resumes || 0;
|
|
392
413
|
const secs = Number.isFinite(st.waitMs) ? Math.round(st.waitMs / 1000) : null;
|
|
393
414
|
|
|
415
|
+
if (st.tooManyFailures) {
|
|
416
|
+
return {
|
|
417
|
+
reason: "too-many-failures",
|
|
418
|
+
error: st.messagesSaved
|
|
419
|
+
? null
|
|
420
|
+
: "the phone could not serve most of the batches and none arrived — nothing was restored; try again later",
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
394
424
|
if (st.socketDied && !st.messagesSaved) {
|
|
395
425
|
return {
|
|
396
426
|
reason: "socket-lost",
|
|
@@ -411,17 +441,15 @@ export function describeRestoreOutcome(st) {
|
|
|
411
441
|
};
|
|
412
442
|
}
|
|
413
443
|
if (st.finished < st.total) return { reason: st.socketDied ? "socket-lost" : "partial", error: null };
|
|
414
|
-
// Every shard came back, but
|
|
444
|
+
// Every shard came back, but some of what the phone was asked for did not: that is not complete.
|
|
445
|
+
if (st.failedBatches > 0) return { reason: "partial", error: null };
|
|
446
|
+
// Every shard came back and was asked for in full, but a row did not reach the cache: a hole is not complete.
|
|
415
447
|
if (st.rowErrors > 0) return { reason: "partial", error: null };
|
|
416
448
|
return { reason: "complete", error: null };
|
|
417
449
|
}
|
|
418
450
|
|
|
419
451
|
export function isSessionComplete(state) {
|
|
420
|
-
|
|
421
|
-
if (state.sawLast) return true;
|
|
422
|
-
const want = state.want?.size ?? 0;
|
|
423
|
-
if (!want) return false; // conversation round: only isLast can end it
|
|
424
|
-
return (state.covered?.size ?? 0) >= want;
|
|
452
|
+
return isTransferSessionComplete(state);
|
|
425
453
|
}
|
|
426
454
|
|
|
427
455
|
/**
|
|
@@ -450,7 +478,7 @@ function syncMsgId(msg, threadId = null) {
|
|
|
450
478
|
|
|
451
479
|
export class SyncV2 {
|
|
452
480
|
/**
|
|
453
|
-
* @param {object} api - a logged-in
|
|
481
|
+
* @param {object} api - a logged-in session (from getApi()).
|
|
454
482
|
* @param {string} accountName - ownId; picks the account data dir.
|
|
455
483
|
*/
|
|
456
484
|
constructor(api, accountName) {
|
|
@@ -491,7 +519,9 @@ export class SyncV2 {
|
|
|
491
519
|
const gridVer = groups?.gridVerMap || groups?.data?.gridVerMap || {};
|
|
492
520
|
const gids = Object.keys(gridVer);
|
|
493
521
|
for (let i = 0; i < gids.length; i += 50) {
|
|
494
|
-
|
|
522
|
+
// Watched: a group the fetch lists as removed was disbanded (src/core/group-exit.js).
|
|
523
|
+
const own = /^[1-9][0-9]*$/.test(String(this.accountName || "")) ? String(this.accountName) : null;
|
|
524
|
+
const info = await getGroupInfoWatched(this.api, own, gids.slice(i, i + 50)).catch(() => ({}));
|
|
495
525
|
const gi = info?.gridInfoMap || info?.data?.gridInfoMap || {};
|
|
496
526
|
for (const g of Object.values(gi))
|
|
497
527
|
if (g.globalId) map.set(g.globalId, { id: String(g.groupId), name: g.name || "", type: "group" });
|
|
@@ -514,14 +544,15 @@ export class SyncV2 {
|
|
|
514
544
|
/**
|
|
515
545
|
* Refresh existing DM peers outside the requested message window, including non-friends.
|
|
516
546
|
*
|
|
517
|
-
* Every
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
547
|
+
* Every non-friend DM peer in the cache is looked up: up to 500 uids per
|
|
548
|
+
* request, one request at a time (../name-refresh.js). Peers whose cached title is missing or just their id go
|
|
549
|
+
* first, because those are the ones a restore can actually improve. When Zalo answers 221 (too many requests)
|
|
550
|
+
* the refresh stops for this run, the refused request's uids are parked for an hour (or until the server's
|
|
551
|
+
* `nextTs`), and the result says how many were left. ZALO_SYNC_NAME_REFRESH_MAX, when set, is an opt-in cap.
|
|
522
552
|
*
|
|
523
553
|
* @param {Map<string, object>} threadMap
|
|
524
554
|
* @param {(message: string) => void} [log]
|
|
555
|
+
* @returns {Promise<object>} what ../name-refresh.js `refreshProfiles` reported
|
|
525
556
|
*/
|
|
526
557
|
async _refreshDmNames(threadMap, log = () => {}) {
|
|
527
558
|
const profiles = new Map(
|
|
@@ -534,24 +565,51 @@ export class SyncV2 {
|
|
|
534
565
|
const wanted = peers.filter((t) => !profiles.has(String(t.threadId)));
|
|
535
566
|
wanted.sort((a, b) => Number(unknown(b)) - Number(unknown(a)));
|
|
536
567
|
const envCap = Number.parseInt(process.env.ZALO_SYNC_NAME_REFRESH_MAX ?? "", 10);
|
|
537
|
-
const
|
|
538
|
-
const chosen = wanted.slice(0, maxLookups);
|
|
568
|
+
const chosen = Number.isFinite(envCap) && envCap >= 0 ? wanted.slice(0, envCap) : wanted;
|
|
539
569
|
if (wanted.length) {
|
|
540
570
|
log(
|
|
541
571
|
`refreshing ${chosen.length} of ${wanted.length} non-friend DM peer name(s)` +
|
|
542
|
-
(chosen.length < wanted.length
|
|
543
|
-
? ` (cap ${maxLookups}; the rest keep their cached titles until a later restore)`
|
|
544
|
-
: ""),
|
|
572
|
+
(chosen.length < wanted.length ? ` (ZALO_SYNC_NAME_REFRESH_MAX=${envCap})` : ""),
|
|
545
573
|
);
|
|
546
574
|
}
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
575
|
+
const chosenIds = chosen.map((t) => String(t.threadId));
|
|
576
|
+
let canLookup = false;
|
|
577
|
+
try {
|
|
578
|
+
canLookup = typeof this.api?.getUserInfo === "function";
|
|
579
|
+
} catch {
|
|
580
|
+
/* a live-API proxy throws while the session re-logs in */
|
|
581
|
+
}
|
|
582
|
+
const refresh = canLookup
|
|
583
|
+
? await refreshProfiles(
|
|
584
|
+
this.api,
|
|
585
|
+
chosenIds.filter((id) => /^[1-9][0-9]*$/.test(id)),
|
|
586
|
+
{ stateFile: resolve(this.accountDir, "sync", "name-refresh-parked.json"), log },
|
|
587
|
+
)
|
|
588
|
+
: { profiles: new Map(), asked: 0, left: 0, parkedSkipped: 0, stoppedBy: null, parkedUntil: null };
|
|
589
|
+
for (const [id, profile] of refresh.profiles) profiles.set(id, profile);
|
|
590
|
+
const aliases = this.userAliases || new Map();
|
|
591
|
+
// A peer whose profile was not fetched keeps its cached title, unless the owner gave it an alias.
|
|
592
|
+
const names = new Map(
|
|
593
|
+
[...profiles.keys(), ...chosenIds.filter((id) => aliases.has(id))].map((id) => [
|
|
594
|
+
id,
|
|
595
|
+
currentUserName(id, profiles.get(id), aliases),
|
|
596
|
+
]),
|
|
551
597
|
);
|
|
598
|
+
this.nameRefresh =
|
|
599
|
+
refresh.stoppedBy || refresh.parkedSkipped
|
|
600
|
+
? {
|
|
601
|
+
peers: chosenIds.length,
|
|
602
|
+
refreshed: refresh.asked,
|
|
603
|
+
left: refresh.left,
|
|
604
|
+
parked: refresh.parkedSkipped,
|
|
605
|
+
stoppedBy: refresh.stoppedBy,
|
|
606
|
+
parkedUntil: refresh.parkedUntil,
|
|
607
|
+
}
|
|
608
|
+
: null;
|
|
552
609
|
for (const [id, current] of names) {
|
|
553
610
|
upsertThread({ threadId: id, type: "dm", name: current.name, lastUpdate: 0 });
|
|
554
611
|
}
|
|
612
|
+
return refresh;
|
|
555
613
|
}
|
|
556
614
|
|
|
557
615
|
/** Refresh the active account's own display name via onSelfName if provided. */
|
|
@@ -570,38 +628,6 @@ export class SyncV2 {
|
|
|
570
628
|
}
|
|
571
629
|
}
|
|
572
630
|
|
|
573
|
-
_send590(listener, kind, syncId, ek, ik, req) {
|
|
574
|
-
listener.sendWs(
|
|
575
|
-
{
|
|
576
|
-
version: 1,
|
|
577
|
-
cmd: 590,
|
|
578
|
-
subCmd: 0,
|
|
579
|
-
data: {
|
|
580
|
-
data: {
|
|
581
|
-
syncId,
|
|
582
|
-
syncType: 0,
|
|
583
|
-
ek: b64(ek.publicKey),
|
|
584
|
-
ik: b64(ik.publicKey),
|
|
585
|
-
toDevice: 0,
|
|
586
|
-
tempKey: "",
|
|
587
|
-
deviceName: "zalo-agent-cli",
|
|
588
|
-
req,
|
|
589
|
-
ver: 1,
|
|
590
|
-
ussidx: 0,
|
|
591
|
-
},
|
|
592
|
-
reqId: `req_${kind}_${syncId.slice(0, 6)}`,
|
|
593
|
-
},
|
|
594
|
-
},
|
|
595
|
-
false,
|
|
596
|
-
);
|
|
597
|
-
}
|
|
598
|
-
_dispose(listener, syncId) {
|
|
599
|
-
listener.sendWs(
|
|
600
|
-
{ version: 1, cmd: 591, subCmd: 0, data: { data: { syncId, toDevice: 0, reason: 1 }, reqId: "req_disp" } },
|
|
601
|
-
false,
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
631
|
/**
|
|
606
632
|
* Run the full restore. Assumes the caller holds the account lock AND has
|
|
607
633
|
* already started the listener: this adds and removes its own socket taps,
|
|
@@ -611,13 +637,23 @@ export class SyncV2 {
|
|
|
611
637
|
* @param {number|null} [opts.days=null] only sync the last N days; falsy = full history.
|
|
612
638
|
* @param {string|number} [opts.from] explicit lower bound (date string or epoch ms); beats `days`.
|
|
613
639
|
* @param {number} [opts.shardSize=30] partitions per message round (server caps ~30).
|
|
614
|
-
* @param {number} [opts.waveSize=4] message sessions open at once
|
|
640
|
+
* @param {number} [opts.waveSize=4] message sessions open at once.
|
|
615
641
|
* @param {number} [opts.waitMs=120000] per-phase wait budget.
|
|
616
642
|
* @param {(s: {phase: string, detail?: string}) => void} [opts.onStatus]
|
|
617
643
|
* @param {boolean} [opts.liveStore=true] false when the caller already taps live traffic
|
|
618
644
|
* @param {number|false} [opts.keepAlive] heartbeat interval in ms, or false when the
|
|
619
645
|
* caller already pings this socket for the whole window it owns.
|
|
620
|
-
* @param {number} [opts.
|
|
646
|
+
* @param {number} [opts.settleMs] pause before the first request (default 1200; tests only)
|
|
647
|
+
* @param {number} [opts.pollMs] how often a wait looks at its session (default 300; tests only)
|
|
648
|
+
* @param {string} [opts.tempKey] the `temp_key` of a `transfer_after_login` control, to ask for the sync without a
|
|
649
|
+
* tap on the phone (Y8); empty by default
|
|
650
|
+
* @param {AbortSignal} [opts.signal] cancel the run: it stops asking, keeps what already arrived, releases every
|
|
651
|
+
* open session with reason 0 (cancelled) and resolves with `reason: "cancelled"`
|
|
652
|
+
* @param {boolean} [opts.fullResync] forget what earlier runs settled and ask for every conversation in full
|
|
653
|
+
* @param {{zproto: object, M: object, C: object}} [opts.codecs] decryption and decoding stand-ins (tests only)
|
|
654
|
+
* @param {number} [opts.stallNoteMs=60000] how long a session may be waited for before the run says what it lacks
|
|
655
|
+
* @param {number} [opts.stallIdleMs=60000] how long an incomplete session may sit with the phone idle before it is failed
|
|
656
|
+
* @param {number} [opts.maxResumes] reconnects this run may spend (default 3, at most 5); each one
|
|
621
657
|
* that needs the phone's confirmation again costs the owner a tap.
|
|
622
658
|
* @param {() => Promise<boolean|{api: object}>} [opts.reconnect] re-open the listener socket
|
|
623
659
|
* after a drop and resolve true once it is live. Supplied by the caller because this class
|
|
@@ -627,24 +663,55 @@ export class SyncV2 {
|
|
|
627
663
|
* @returns {Promise<{conversations:number, messagesSaved:number, threadsMapped:number, threadsUnmapped:number, reason:string, days:number|null, from:number, confirmed:boolean, resumes:number, rePrompted:boolean}>}
|
|
628
664
|
*/
|
|
629
665
|
async restore(opts = {}) {
|
|
666
|
+
// The server decides whether this account may sync from the phone at all:
|
|
667
|
+
// `settings.features.sync_2_web.enable` false means no sync. (Live, 2026-10-28: true on a paid
|
|
668
|
+
// and on a free account alike, with the same 300 s timeouts; the block does not depend on the zCloud plan.)
|
|
669
|
+
if (this.api.getContext?.()?.settings?.features?.sync_2_web?.enable === false) {
|
|
670
|
+
throw new Error(
|
|
671
|
+
"Zalo has turned the phone-backed sync off for this account (the server's sync_2_web setting is off). " +
|
|
672
|
+
"Nothing was asked of the phone.",
|
|
673
|
+
);
|
|
674
|
+
}
|
|
630
675
|
const shardSize = Math.min(30, Math.max(1, opts.shardSize || 30));
|
|
631
676
|
const waveSize = Math.min(30, Math.max(1, opts.waveSize || DEFAULT_WAVE_SIZE));
|
|
632
|
-
const
|
|
677
|
+
const stallNoteMs = opts.stallNoteMs ?? STALL_NOTE_MS;
|
|
678
|
+
const stallIdleMs = opts.stallIdleMs ?? STALL_IDLE_MS;
|
|
679
|
+
const waitMs = Math.max(30000, opts.waitMs || CONFIRM_WAIT_MS);
|
|
680
|
+
// How long the socket is given to settle before the first request, and how often a wait looks at its session.
|
|
681
|
+
// Both only ever change in a test.
|
|
682
|
+
const settleMs = Number.isFinite(opts.settleMs) ? opts.settleMs : 1200;
|
|
683
|
+
const pollMs = Number.isFinite(opts.pollMs) ? opts.pollMs : 300;
|
|
633
684
|
const onStatus = typeof opts.onStatus === "function" ? opts.onStatus : () => {};
|
|
634
685
|
const log = (m) => onStatus({ phase: "info", detail: m });
|
|
686
|
+
// The key the phone offered at a QR login with auto sync ticked (a `transfer_after_login` control), when the
|
|
687
|
+
// caller has one. Sent with the conversation request only.
|
|
688
|
+
const tempKey = typeof opts.tempKey === "string" ? opts.tempKey : "";
|
|
689
|
+
/** Has the caller asked to stop? Looked at between waits, never inside one request. */
|
|
690
|
+
const aborted = () => opts.signal?.aborted === true;
|
|
691
|
+
/** Set once the run was cut short on purpose: decides the reason sessions are released with. */
|
|
692
|
+
let cancelled = false;
|
|
693
|
+
const cancelError = () => Object.assign(new Error("cancelled"), { reason: "cancelled", cancelled: true });
|
|
635
694
|
// The caller announces the window (it also decides the debounce on it);
|
|
636
695
|
// it comes back on the result too, so no status line is emitted here.
|
|
637
696
|
const win = resolveSyncWindow(opts.days, Date.now(), opts.from);
|
|
638
697
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
698
|
+
// `opts.codecs` stands in for the decryption assets: a test runs the whole restore against a fake phone
|
|
699
|
+
// with codecs of its own. The product never passes it.
|
|
700
|
+
let codecs = opts.codecs;
|
|
701
|
+
if (!codecs) {
|
|
702
|
+
onStatus({ phase: "assets", detail: "loading decryption assets" });
|
|
703
|
+
const assets = await ensureAssets(resolve(this.accountDir, "sync", "zproto-cache"), log);
|
|
704
|
+
codecs = await loadCodecs(assets);
|
|
705
|
+
}
|
|
706
|
+
const { zproto, M, C } = codecs;
|
|
642
707
|
|
|
643
708
|
onStatus({ phase: "contacts", detail: "reading friend/group lists for thread mapping" });
|
|
644
709
|
const threadMap = await this._buildThreadMap(log);
|
|
645
710
|
const senders = createSenderResolver(this.api, threadMap, { log });
|
|
646
711
|
|
|
647
712
|
initDb(resolve(this.accountDir, "zalo.db"));
|
|
713
|
+
// A full resync trusts nothing an earlier run settled (Y5c).
|
|
714
|
+
if (opts.fullResync) deleteSyncRanges();
|
|
648
715
|
this._refreshThreadNames(threadMap);
|
|
649
716
|
await this._refreshDmNames(threadMap, log);
|
|
650
717
|
await this._refreshSelfName(opts.onSelfName);
|
|
@@ -653,50 +720,49 @@ export class SyncV2 {
|
|
|
653
720
|
// listener, and `opts.reconnect` can hand that api back (see `reconnect` below).
|
|
654
721
|
let L = this.api.listener;
|
|
655
722
|
const sessions = new Map(); // syncId -> {kind, batches:[], statuses:[], done, err}
|
|
723
|
+
// Sending a request, reading its ack, releasing a session and remembering the open ones (Y4a, Y6, Y7).
|
|
724
|
+
// It follows `L`, so a reconnect that replaces the listener is followed too.
|
|
725
|
+
const channel = createSyncChannel({
|
|
726
|
+
getListener: () => L,
|
|
727
|
+
decode: (parsed) => decodeFrame(parsed, L.cipherKey),
|
|
728
|
+
// The phone's session ids, sealed under the account's data key (src/core/keystore/).
|
|
729
|
+
store: createSessionStore(resolve(this.accountDir, "sync", "open-sessions.json"), {
|
|
730
|
+
codec: codecForDir(this.accountDir),
|
|
731
|
+
}),
|
|
732
|
+
log,
|
|
733
|
+
});
|
|
734
|
+
// A batch is fetched the moment the phone announces it, two at a time (Y3), not when its turn to be
|
|
735
|
+
// decoded comes.
|
|
736
|
+
// In the account's own identity and over its proxy (plan item ZP-01), not the global fetch.
|
|
737
|
+
const downloader = createBatchDownloader({ fetchImpl: createDownloadFetch(this.api) });
|
|
656
738
|
const onMsg = async (buf) => {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
parsed = JSON.parse(buf.subarray(4).toString("utf8"));
|
|
661
|
-
} catch {
|
|
662
|
-
return;
|
|
663
|
-
}
|
|
664
|
-
let d;
|
|
665
|
-
try {
|
|
666
|
-
d =
|
|
667
|
-
typeof parsed.data === "string" && typeof parsed.encrypt === "number"
|
|
668
|
-
? decodeFrame(parsed, L.cipherKey)
|
|
669
|
-
: parsed;
|
|
670
|
-
} catch {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
for (const c of d?.data?.controls || []) {
|
|
674
|
-
if (c?.content?.act_type !== "transfer_sync2") continue;
|
|
675
|
-
let dj = c.content.data;
|
|
676
|
-
try {
|
|
677
|
-
dj = JSON.parse(dj);
|
|
678
|
-
} catch {}
|
|
679
|
-
const s = sessions.get(dj?.syncId);
|
|
739
|
+
channel.handleFrame(buf);
|
|
740
|
+
for (const ctl of readTransferControls(buf, (parsed) => decodeFrame(parsed, L.cipherKey))) {
|
|
741
|
+
const s = sessions.get(ctl.syncId);
|
|
680
742
|
if (!s) continue;
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
743
|
+
const ev = applyControl(s, { act: ctl.act, data: ctl.data });
|
|
744
|
+
if (ev.type === "batch" && ev.batch.msgUrl) downloader.start(ev.batch.msgUrl);
|
|
745
|
+
if (ev.type === "status") {
|
|
746
|
+
if (ev.cls.status === 3) {
|
|
684
747
|
onStatus({
|
|
685
748
|
phase: "confirm",
|
|
686
749
|
detail: "Confirm the sync request on your phone (tap ĐỒNG BỘ NGAY)",
|
|
687
750
|
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
751
|
+
} else if (ev.cls.fatal) {
|
|
752
|
+
onStatus({ phase: "warn", detail: `your phone ended the sync: ${ev.cls.message}` });
|
|
753
|
+
}
|
|
754
|
+
} else if (ev.type === "failure") {
|
|
755
|
+
onStatus({
|
|
756
|
+
phase: "warn",
|
|
757
|
+
detail:
|
|
758
|
+
`the phone could not serve ${ev.partitions.length} partition(s)` +
|
|
759
|
+
(ev.code !== null ? ` (error ${ev.code})` : ""),
|
|
760
|
+
});
|
|
695
761
|
}
|
|
696
762
|
}
|
|
697
763
|
};
|
|
698
764
|
|
|
699
|
-
//
|
|
765
|
+
// A sync does not freeze the socket: new messages keep arriving
|
|
700
766
|
// on the same socket and keep being stored. A full-history run holds this
|
|
701
767
|
// socket for many minutes, so without this everything that landed during
|
|
702
768
|
// it was dropped -- a hole precisely where the sync promises completeness.
|
|
@@ -746,7 +812,7 @@ export class SyncV2 {
|
|
|
746
812
|
|
|
747
813
|
// Everything below is attached to the RAW socket, so all of it has to be
|
|
748
814
|
// re-attached after a reconnect -- `L.ws` is a different object then, and
|
|
749
|
-
//
|
|
815
|
+
// the listener nulls the old one. (`attachLiveStore` taps the Listener, which
|
|
750
816
|
// outlives the socket, so it is deliberately not in here.)
|
|
751
817
|
const attachSocketTaps = () => {
|
|
752
818
|
try {
|
|
@@ -759,6 +825,8 @@ export class SyncV2 {
|
|
|
759
825
|
if (opts.keepAlive !== false) {
|
|
760
826
|
keeper = startKeepAlive(L, {
|
|
761
827
|
intervalMs: typeof opts.keepAlive === "number" ? opts.keepAlive : undefined,
|
|
828
|
+
// The interval the server gave this session at login.
|
|
829
|
+
advisedMs: Number(this.api.getContext?.()?.settings?.features?.socket?.ping_interval),
|
|
762
830
|
});
|
|
763
831
|
}
|
|
764
832
|
};
|
|
@@ -816,27 +884,17 @@ export class SyncV2 {
|
|
|
816
884
|
|
|
817
885
|
const newSession = (kind, wantPartitions = []) => {
|
|
818
886
|
const id = randId();
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
statuses: [],
|
|
823
|
-
done: false,
|
|
824
|
-
sawLast: false,
|
|
825
|
-
err: null,
|
|
826
|
-
disposed: false,
|
|
827
|
-
// Completion is measured by coverage: every partition asked for
|
|
828
|
-
// has to come back in some batch's `scopes`.
|
|
829
|
-
want: new Set(wantPartitions.filter(Boolean)),
|
|
830
|
-
covered: new Set(),
|
|
831
|
-
});
|
|
887
|
+
// Completion is measured by coverage: every partition asked for has to come back in some
|
|
888
|
+
// batch's `scopes`, or be reported as failed (see ../../zalo/transfer-sync/transfer.js).
|
|
889
|
+
sessions.set(id, createTransferSession({ kind, want: wantPartitions }));
|
|
832
890
|
return id;
|
|
833
891
|
};
|
|
834
892
|
|
|
835
893
|
/**
|
|
836
894
|
* Wait for one session to finish.
|
|
837
895
|
*
|
|
838
|
-
* `isLast` is NOT a reliable end marker -- a
|
|
839
|
-
* its final message session with isLast=0 and
|
|
896
|
+
* `isLast` is NOT a reliable end marker -- a run can end
|
|
897
|
+
* its final message session with isLast=0 and dispose it anyway. What
|
|
840
898
|
* actually marks a message session complete is that every requested
|
|
841
899
|
* partition has appeared in a batch's `scopes`. The conversation round
|
|
842
900
|
* asks for the empty partition and carries no scopes, so it still falls
|
|
@@ -848,29 +906,110 @@ export class SyncV2 {
|
|
|
848
906
|
const waitDone = async (id, budgetMs) => {
|
|
849
907
|
const dl = Date.now() + resolveWaitBudget(budgetMs, waitMs);
|
|
850
908
|
const s = sessions.get(id);
|
|
851
|
-
|
|
909
|
+
let noted = Date.now();
|
|
910
|
+
while (!s.done && !s.err && !s.fatal && Date.now() < dl) {
|
|
911
|
+
if (aborted()) return "cancelled";
|
|
912
|
+
// A minute of waiting says what the session has and what it lacks: without it a phone that went
|
|
913
|
+
// quiet looks exactly like work in progress (seen live, 2026-10-28: ten minutes of nothing).
|
|
914
|
+
if (Date.now() - noted >= stallNoteMs) {
|
|
915
|
+
noted = Date.now();
|
|
916
|
+
onStatus({ phase: "wait", detail: describeWait(s) });
|
|
917
|
+
}
|
|
918
|
+
// A phone that says it is idle and stays so is not coming back.
|
|
919
|
+
// A message session the phone left incomplete and idle: failed for this run, asked again at the end.
|
|
920
|
+
if (s.kind === "msg" && isStalledIdle(s, { afterMs: stallIdleMs })) return "stalled";
|
|
921
|
+
if (isIdleTooLong(s)) return "idle-timeout";
|
|
852
922
|
// A closed socket can never deliver the rest, so stop now
|
|
853
923
|
// instead of burning the whole budget waiting on a dead wire.
|
|
854
|
-
//
|
|
924
|
+
// The listener sets `ws = null` on close, so an absent socket is
|
|
855
925
|
// just as dead as one reporting CLOSING/CLOSED -- checking only
|
|
856
926
|
// readyState missed every real disconnect.
|
|
857
927
|
if (!L.ws || L.ws.readyState > 1) return "socket-closed";
|
|
858
|
-
await new Promise((r) => setTimeout(r,
|
|
928
|
+
await new Promise((r) => setTimeout(r, pollMs));
|
|
859
929
|
}
|
|
930
|
+
// The phone ended the sync (rejected, cancelled, busy, low on storage, signed out).
|
|
931
|
+
if (s.fatal) return "declined";
|
|
860
932
|
if (s.err) return "error";
|
|
861
933
|
if (s.done) return "done";
|
|
862
934
|
return "timeout";
|
|
863
935
|
};
|
|
864
936
|
|
|
865
|
-
/**
|
|
937
|
+
/** What a session that is still waited for has: batches, conversations covered of those asked, phone statuses. */
|
|
938
|
+
const describeWait = (s) => {
|
|
939
|
+
const status = `phone status ${s.statuses.length ? s.statuses.slice(-4).join(",") : "none"}`;
|
|
940
|
+
if (s.kind === "conv")
|
|
941
|
+
return `still waiting for the phone: ${s.batches.length} batch(es) of the conversation list so far, ${status}`;
|
|
942
|
+
return (
|
|
943
|
+
`still waiting for the phone: ${s.batches.length} batch(es) so far, ${s.covered.size} of ${s.want.size} ` +
|
|
944
|
+
`conversation(s) covered, ${s.failed.size} failed, last batch ${s.sawLast ? "seen" : "not seen"}, ${status}`
|
|
945
|
+
);
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
/** Releases sent and not yet answered: a request must not overtake them (see sendRequest). */
|
|
949
|
+
const releasing = new Set();
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Release one session (the ack is awaited in the background; the next request waits for it).
|
|
953
|
+
*
|
|
954
|
+
* @returns {Promise<object>|undefined} the release, or nothing when the session is already let go of
|
|
955
|
+
*/
|
|
866
956
|
const disposeOne = (id) => {
|
|
867
957
|
const s = sessions.get(id);
|
|
868
|
-
if (!s || s.disposed) return;
|
|
958
|
+
if (!s || s.disposed) return undefined;
|
|
869
959
|
s.disposed = true;
|
|
960
|
+
const going = channel.release(id, s.disposeReason ?? DISPOSE_REASON.SUCCESS).finally(() => {
|
|
961
|
+
releasing.delete(going);
|
|
962
|
+
});
|
|
963
|
+
releasing.add(going);
|
|
964
|
+
return going;
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Release a wave's sessions together, once the wave is stored (see RELEASE_BURST for how many go out at once).
|
|
969
|
+
*/
|
|
970
|
+
const disposeTogether = async (ids) => {
|
|
971
|
+
for (let i = 0; i < ids.length; i += RELEASE_BURST) {
|
|
972
|
+
await Promise.allSettled(ids.slice(i, i + RELEASE_BURST).map(disposeOne));
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Send one cmd 590 and wait until Zalo acknowledges it (Y4a): requests are paced by their acks, so a
|
|
978
|
+
* request is never sent into a queue that has not taken the one before it.
|
|
979
|
+
*
|
|
980
|
+
* A request also waits for the releases still unanswered: 591 goes out, its ack comes back, and only then
|
|
981
|
+
* the 590.
|
|
982
|
+
*
|
|
983
|
+
* @returns {Promise<{socketClosed: boolean}>} `socketClosed` when the wire died before the ack; any other
|
|
984
|
+
* failure throws with words the person can act on
|
|
985
|
+
*/
|
|
986
|
+
const sendRequest = async (kind, id, ek, req, tempKey = "") => {
|
|
987
|
+
await Promise.allSettled([...releasing]);
|
|
870
988
|
try {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
989
|
+
await channel.request({
|
|
990
|
+
tempKey,
|
|
991
|
+
kind,
|
|
992
|
+
syncId: id,
|
|
993
|
+
ek: b64(ek.publicKey),
|
|
994
|
+
ik: b64(ik.publicKey),
|
|
995
|
+
req,
|
|
996
|
+
deviceName: DEVICE_LABEL,
|
|
997
|
+
});
|
|
998
|
+
return { socketClosed: false };
|
|
999
|
+
} catch (e) {
|
|
1000
|
+
if (!(e instanceof SyncRequestError)) throw e;
|
|
1001
|
+
if (e.failure === REQUEST_FAILURE.SOCKET_CLOSED) return { socketClosed: true };
|
|
1002
|
+
if (e.failure === REQUEST_FAILURE.NOT_SUPPORTED) {
|
|
1003
|
+
throw Object.assign(
|
|
1004
|
+
new Error(
|
|
1005
|
+
`Zalo refused the sync request: this client's protocol version is not supported (${e.message})`,
|
|
1006
|
+
),
|
|
1007
|
+
{ reason: "client-not-supported" },
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
throw Object.assign(new Error(`Zalo did not take the sync request: ${e.message}`), {
|
|
1011
|
+
reason: e.failure,
|
|
1012
|
+
});
|
|
874
1013
|
}
|
|
875
1014
|
};
|
|
876
1015
|
|
|
@@ -881,11 +1020,23 @@ export class SyncV2 {
|
|
|
881
1020
|
rowErrors = 0;
|
|
882
1021
|
/** The first reason a row could not be written, for the report. */
|
|
883
1022
|
let firstRowError = null;
|
|
1023
|
+
/** Partitions with a row that could not be written: they are not settled as done, so the next run asks again. */
|
|
1024
|
+
const writeFailed = new Set();
|
|
884
1025
|
const mappedThreads = new Set(),
|
|
885
1026
|
unmappedThreads = new Set();
|
|
1027
|
+
/** Account for one listed conversation (`oneone/<gid>` or `group/<gid>`) under its thread id. */
|
|
1028
|
+
const noteThread = (partition) => {
|
|
1029
|
+
const gid = /^(?:oneone|group)\/(.+)$/.exec(partition)?.[1];
|
|
1030
|
+
const hit = gid ? threadMap.get(gid) : undefined;
|
|
1031
|
+
const threadId = hit ? hit.id : partition;
|
|
1032
|
+
(hit ? mappedThreads : unmappedThreads).add(threadId);
|
|
1033
|
+
return { gid, hit, threadId };
|
|
1034
|
+
};
|
|
886
1035
|
/** type name -> count, for the command's summary line. */
|
|
887
1036
|
const typeCounts = Object.create(null);
|
|
888
1037
|
let reason = "complete";
|
|
1038
|
+
/** What ended the run, when it threw: decides the reason sessions are released with. */
|
|
1039
|
+
let runError = null;
|
|
889
1040
|
// Did the phone actually answer? transfer_status 4 = Confirmed,
|
|
890
1041
|
// 5 = Authorized. Needed to tell "empty window" from "never tapped".
|
|
891
1042
|
let confirmed = false;
|
|
@@ -906,8 +1057,10 @@ export class SyncV2 {
|
|
|
906
1057
|
liveThreadIds: [...mappedThreads, ...unmappedThreads],
|
|
907
1058
|
});
|
|
908
1059
|
|
|
909
|
-
// decrypt one session's batches -> decoded proto objects
|
|
1060
|
+
// decrypt one session's batches -> decoded proto objects. A batch that cannot be downloaded fails its
|
|
1061
|
+
// scopes (Y3) instead of being skipped: they are returned, so the caller can count them.
|
|
910
1062
|
const eachChunkObj = async (s, ek, protoClass, onObj) => {
|
|
1063
|
+
const downloadFailures = [];
|
|
911
1064
|
let sessionRecord = null;
|
|
912
1065
|
const ordered = s.batches
|
|
913
1066
|
.slice()
|
|
@@ -917,19 +1070,23 @@ export class SyncV2 {
|
|
|
917
1070
|
await new Promise((r) => setImmediate(r));
|
|
918
1071
|
let blob;
|
|
919
1072
|
try {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1073
|
+
blob = await downloader.get(bt.msgUrl);
|
|
1074
|
+
} catch (e) {
|
|
1075
|
+
recordDownloadFailure(s, bt, e);
|
|
1076
|
+
downloadFailures.push({ batch: bt, error: e });
|
|
1077
|
+
onStatus({
|
|
1078
|
+
phase: "warn",
|
|
1079
|
+
detail: `could not download a batch (${e.kind ?? "error"}: ${e.message}) — its conversations are marked failed`,
|
|
1080
|
+
});
|
|
924
1081
|
continue;
|
|
925
1082
|
}
|
|
926
1083
|
for (const chunk of splitChunks(blob)) {
|
|
927
1084
|
// Hand the event loop back before each chunk. Decode and
|
|
928
1085
|
// store are synchronous and a single shard can carry tens of
|
|
929
|
-
// thousands of messages;
|
|
1086
|
+
// thousands of messages; the listener keeps the socket alive with
|
|
930
1087
|
// a setInterval ping, and a blocked loop means a missed ping
|
|
931
1088
|
// means Zalo drops the connection mid-run. This is the same
|
|
932
|
-
// problem
|
|
1089
|
+
// problem a worker thread for decoding would avoid.
|
|
933
1090
|
await new Promise((r) => setImmediate(r));
|
|
934
1091
|
try {
|
|
935
1092
|
let plain;
|
|
@@ -953,10 +1110,17 @@ export class SyncV2 {
|
|
|
953
1110
|
}
|
|
954
1111
|
}
|
|
955
1112
|
}
|
|
1113
|
+
return { downloadFailures };
|
|
956
1114
|
};
|
|
957
1115
|
|
|
958
1116
|
try {
|
|
959
|
-
await new Promise((r) => setTimeout(r,
|
|
1117
|
+
await new Promise((r) => setTimeout(r, settleMs));
|
|
1118
|
+
if (aborted()) throw cancelError();
|
|
1119
|
+
|
|
1120
|
+
// A run that died left its sessions open on the phone; release them (reason 3) before starting
|
|
1121
|
+
// anything, so the phone's banner and its queue start clean (Y6b).
|
|
1122
|
+
const leftover = await channel.cleanLeftovers();
|
|
1123
|
+
if (leftover) log(`released ${leftover} sync session(s) an earlier run left open`);
|
|
960
1124
|
|
|
961
1125
|
// ---- conversation round ----
|
|
962
1126
|
// `ek` is fresh per session and `ik` is stable across them (see
|
|
@@ -965,15 +1129,17 @@ export class SyncV2 {
|
|
|
965
1129
|
let ekConv = zproto.generateKeyPair();
|
|
966
1130
|
let convId = newSession("conv");
|
|
967
1131
|
onStatus({ phase: "conversation", detail: "requesting your conversation list" });
|
|
968
|
-
|
|
1132
|
+
const convRequest = {
|
|
969
1133
|
type: "conversation",
|
|
970
1134
|
priority: 0,
|
|
971
1135
|
batchSize: 2000,
|
|
972
1136
|
queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
|
|
973
|
-
}
|
|
974
|
-
|
|
1137
|
+
};
|
|
1138
|
+
const convSent = await sendRequest("conv", convId, ekConv, convRequest, tempKey);
|
|
1139
|
+
let convWhy = convSent.socketClosed ? "socket-closed" : await waitDone(convId, waitMs);
|
|
1140
|
+
if (convWhy === "cancelled") throw cancelError();
|
|
975
1141
|
let convSession = sessions.get(convId);
|
|
976
|
-
confirmed = convSession.statuses
|
|
1142
|
+
confirmed = isConfirmed(convSession.statuses);
|
|
977
1143
|
|
|
978
1144
|
// A socket that dies here loses the conversation list outright --
|
|
979
1145
|
// it only ever arrives on the socket that asked for it. Reconnect
|
|
@@ -988,40 +1154,40 @@ export class SyncV2 {
|
|
|
988
1154
|
? "reconnected — asking for your conversation list again (your phone already confirmed)"
|
|
989
1155
|
: "reconnected — asking for your conversation list again; your phone may prompt once more",
|
|
990
1156
|
});
|
|
1157
|
+
// A new socket starts with the dead one's sessions released with reason 3, counting from 0.
|
|
1158
|
+
await channel.releaseAbandoned();
|
|
1159
|
+
channel.resetUssidx(0);
|
|
991
1160
|
const retryId = newSession("conv");
|
|
992
1161
|
ekConv = zproto.generateKeyPair();
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
batchSize: 2000,
|
|
997
|
-
queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
|
|
998
|
-
});
|
|
999
|
-
convWhy = await waitDone(retryId, waitMs);
|
|
1162
|
+
const retrySent = await sendRequest("conv", retryId, ekConv, convRequest, tempKey);
|
|
1163
|
+
convWhy = retrySent.socketClosed ? "socket-closed" : await waitDone(retryId, waitMs);
|
|
1164
|
+
if (convWhy === "cancelled") throw cancelError();
|
|
1000
1165
|
convSession = sessions.get(retryId);
|
|
1001
1166
|
convId = retryId;
|
|
1002
|
-
confirmed = confirmed || convSession.statuses
|
|
1167
|
+
confirmed = confirmed || isConfirmed(convSession.statuses);
|
|
1003
1168
|
}
|
|
1004
1169
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
? "the connection dropped after your phone confirmed, before the conversation list arrived"
|
|
1010
|
-
: "the connection dropped while waiting for your phone to confirm — re-run and you will be prompted again",
|
|
1011
|
-
);
|
|
1012
|
-
}
|
|
1013
|
-
if (convWhy === "timeout" && !confirmed) {
|
|
1014
|
-
throw new Error(
|
|
1015
|
-
`your phone did not answer the sync prompt within ${Math.round(waitMs / 1000)}s — the connection stayed up, so nothing was lost; re-run and confirm the prompt`,
|
|
1016
|
-
);
|
|
1017
|
-
}
|
|
1170
|
+
// What the conversation round ended in (see judgeConversationRound): a phone that said no is
|
|
1171
|
+
// not a window that was settled, so it ends here and nothing is recorded.
|
|
1172
|
+
const verdict = judgeConversationRound({ why: convWhy, session: convSession, waitMs, confirmed });
|
|
1173
|
+
if (verdict.error) throw verdict.error;
|
|
1018
1174
|
|
|
1019
1175
|
const convs = [];
|
|
1020
|
-
await eachChunkObj(convSession, ekConv, C.SyncChunk, (obj) => {
|
|
1176
|
+
const convRead = await eachChunkObj(convSession, ekConv, C.SyncChunk, (obj) => {
|
|
1021
1177
|
for (const c of obj.conversationsList || []) convs.push(c);
|
|
1022
1178
|
});
|
|
1023
|
-
//
|
|
1024
|
-
|
|
1179
|
+
// A conversation list with a hole in it is not a list: say so rather than restore a part of it.
|
|
1180
|
+
if (convRead.downloadFailures.length) {
|
|
1181
|
+
const first = convRead.downloadFailures[0].error;
|
|
1182
|
+
throw Object.assign(
|
|
1183
|
+
new Error(
|
|
1184
|
+
`your conversation list could not be downloaded (${first.kind ?? "error"}: ${first.message}) — nothing was restored`,
|
|
1185
|
+
),
|
|
1186
|
+
{ reason: "download-failed" },
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
// The conversation session is released as soon as the list is in,
|
|
1190
|
+
// before asking for any messages: it clears the
|
|
1025
1191
|
// phone's banner for that round instead of holding it open.
|
|
1026
1192
|
disposeOne(convId);
|
|
1027
1193
|
conversations = convs.length;
|
|
@@ -1050,8 +1216,8 @@ export class SyncV2 {
|
|
|
1050
1216
|
}
|
|
1051
1217
|
|
|
1052
1218
|
// Tier 3: resolve 1-1 conversations not in the friend list (non-friends, OA) to
|
|
1053
|
-
// real ids + names via /api/gid/decrypt
|
|
1054
|
-
// groups have no per-item endpoint, so they stay opaque
|
|
1219
|
+
// real ids + names via /api/gid/decrypt. Left
|
|
1220
|
+
// groups have no per-item endpoint, so they stay opaque.
|
|
1055
1221
|
const unresolved = convs.filter((c) => c.convType !== 2 && !threadMap.has(c.convId)).map((c) => c.convId);
|
|
1056
1222
|
if (unresolved.length) {
|
|
1057
1223
|
onStatus({ phase: "resolve", detail: `resolving ${unresolved.length} non-friend conversation(s)` });
|
|
@@ -1075,11 +1241,10 @@ export class SyncV2 {
|
|
|
1075
1241
|
}
|
|
1076
1242
|
}
|
|
1077
1243
|
|
|
1078
|
-
// `to` is per conversation, not a global bound.
|
|
1079
|
-
//
|
|
1080
|
-
//
|
|
1081
|
-
//
|
|
1082
|
-
// not yet know what the latest message is. Sending MAX_SAFE_INTEGER
|
|
1244
|
+
// `to` is per conversation, not a global bound. Each partition is
|
|
1245
|
+
// sent its own conversation's `lastTs` (30 partitions, 30 distinct
|
|
1246
|
+
// `to` values), and an unbounded `to` is asked for only on the
|
|
1247
|
+
// conversation round, where the latest message is not yet known. Sending MAX_SAFE_INTEGER
|
|
1083
1248
|
// per partition asks the phone to scan to the year 285428 for a
|
|
1084
1249
|
// conversation that has been quiet since 2024.
|
|
1085
1250
|
const askedTo = Math.min(win.to, Date.now());
|
|
@@ -1093,14 +1258,101 @@ export class SyncV2 {
|
|
|
1093
1258
|
limit: 2147483647,
|
|
1094
1259
|
};
|
|
1095
1260
|
});
|
|
1261
|
+
// Every listed conversation is on the account, whether this run asks for it, asks only for what came
|
|
1262
|
+
// after an earlier run, or skips it as settled. Only the ones that returned messages used to be
|
|
1263
|
+
// accounted for, so a run that skipped 2,247 settled conversations reported them as "returned no
|
|
1264
|
+
// messages" and could not prove anything gone.
|
|
1265
|
+
for (const q of partitions) noteThread(q.partition);
|
|
1266
|
+
// What earlier runs settled is not asked for again, and what they got part of is asked for from
|
|
1267
|
+
// there (Y5): a killed run resumes, and a later run only fetches what came after the last one.
|
|
1268
|
+
const plan = planRanges({
|
|
1269
|
+
asked: partitions.map(({ partition, from, to }) => ({ partition, from, to })),
|
|
1270
|
+
prior: getSyncRanges(),
|
|
1271
|
+
fullResync: Boolean(opts.fullResync),
|
|
1272
|
+
});
|
|
1273
|
+
if (plan.orphans.length) deleteSyncRanges(plan.orphans);
|
|
1274
|
+
const askOf = new Map(partitions.map((q) => [q.partition, q]));
|
|
1275
|
+
const priorOf = new Map(getSyncRanges().map((r) => [r.partition, r]));
|
|
1276
|
+
const incrementalOf = new Map(plan.todo.map((q) => [q.partition, q.incremental]));
|
|
1277
|
+
const todo = plan.todo.map((q) => ({
|
|
1278
|
+
partition: q.partition,
|
|
1279
|
+
from: q.from,
|
|
1280
|
+
to: q.to,
|
|
1281
|
+
limit: askOf.get(q.partition).limit,
|
|
1282
|
+
}));
|
|
1283
|
+
markSyncRangesPending(
|
|
1284
|
+
plan.todo
|
|
1285
|
+
.filter((q) => !q.incremental)
|
|
1286
|
+
.map((q) => ({ partition: q.partition, fromTs: q.from, toTs: q.to })),
|
|
1287
|
+
);
|
|
1288
|
+
const rangeInfo = {
|
|
1289
|
+
skipped: plan.skipped.length,
|
|
1290
|
+
incremental: plan.todo.filter((q) => q.incremental).length,
|
|
1291
|
+
retried: 0,
|
|
1292
|
+
recovered: 0,
|
|
1293
|
+
};
|
|
1294
|
+
/** partition -> why it failed, for the ranges that stand failed right now in this run */
|
|
1295
|
+
const failedRanges = new Map();
|
|
1296
|
+
if (plan.skipped.length || rangeInfo.incremental) {
|
|
1297
|
+
onStatus({
|
|
1298
|
+
phase: "messages",
|
|
1299
|
+
detail:
|
|
1300
|
+
`${plan.skipped.length} conversation(s) already settled by an earlier run are not asked for again` +
|
|
1301
|
+
(rangeInfo.incremental
|
|
1302
|
+
? `; ${rangeInfo.incremental} are asked for only from where that run stopped`
|
|
1303
|
+
: ""),
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
// Settle each partition of a served shard: done, failed (with why), or still pending (the session ended early).
|
|
1307
|
+
const settleRanges = (queries, session) => {
|
|
1308
|
+
for (const q of queries) {
|
|
1309
|
+
const status = rangeStatusAfter(q.partition, session);
|
|
1310
|
+
if (status === "done" && writeFailed.has(q.partition)) {
|
|
1311
|
+
setSyncRangeStatus(q.partition, "failed", { reason: "write-error" });
|
|
1312
|
+
failedRanges.set(q.partition, "write-error");
|
|
1313
|
+
continue;
|
|
1314
|
+
}
|
|
1315
|
+
if (status === "done") {
|
|
1316
|
+
setSyncRangeStatus(
|
|
1317
|
+
q.partition,
|
|
1318
|
+
"done",
|
|
1319
|
+
coveredAfter(
|
|
1320
|
+
askOf.get(q.partition),
|
|
1321
|
+
priorOf.get(q.partition),
|
|
1322
|
+
incrementalOf.get(q.partition),
|
|
1323
|
+
),
|
|
1324
|
+
);
|
|
1325
|
+
failedRanges.delete(q.partition);
|
|
1326
|
+
} else if (status === "failed") {
|
|
1327
|
+
const f = session.failures.find((x) => x.partition === q.partition);
|
|
1328
|
+
if (Number(f?.code) === PARTITION_NOT_FOUND) {
|
|
1329
|
+
// The phone no longer has this conversation: there is nothing to ask for again.
|
|
1330
|
+
deleteSyncRanges([q.partition]);
|
|
1331
|
+
failedRanges.delete(q.partition);
|
|
1332
|
+
rangeInfo.gone = (rangeInfo.gone ?? 0) + 1;
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
const why = f?.download ? `download:${f.download}` : `error:${f?.code ?? "unknown"}`;
|
|
1336
|
+
setSyncRangeStatus(q.partition, "failed", { reason: why });
|
|
1337
|
+
failedRanges.set(q.partition, why);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
if (!todo.length) {
|
|
1342
|
+
// Everything was settled by earlier runs: nothing to ask, and nothing left unfinished.
|
|
1343
|
+
onStatus({ phase: "messages", detail: "every conversation was already settled by an earlier run" });
|
|
1344
|
+
reason = "complete";
|
|
1345
|
+
recordRestoreSuccess(win, { resolveGaps: true });
|
|
1346
|
+
resumeInfo = { resumes: 0, rePrompted: false, ranges: { ...rangeInfo, ...countSyncRanges() } };
|
|
1347
|
+
return done(reason);
|
|
1348
|
+
}
|
|
1096
1349
|
const shards = [];
|
|
1097
|
-
for (let i = 0; i <
|
|
1098
|
-
onStatus({ phase: "messages", detail: `${
|
|
1350
|
+
for (let i = 0; i < todo.length; i += shardSize) shards.push(todo.slice(i, i + shardSize));
|
|
1351
|
+
onStatus({ phase: "messages", detail: `${todo.length} conversations in ${shards.length} batch(es)` });
|
|
1099
1352
|
|
|
1100
1353
|
// ---- message rounds (sharded) ----
|
|
1101
|
-
// Requests go out in waves.
|
|
1102
|
-
//
|
|
1103
|
-
// all fifty shards of a full-history run at once got the socket
|
|
1354
|
+
// Requests go out in waves. The phone serves message sessions one
|
|
1355
|
+
// at a time; firing all fifty shards of a full-history run at once got the socket
|
|
1104
1356
|
// dropped with no error frame, so the in-flight count is capped.
|
|
1105
1357
|
// Within a wave the requests still go out together, which is what
|
|
1106
1358
|
// makes them inherit the single confirmation.
|
|
@@ -1113,13 +1365,17 @@ export class SyncV2 {
|
|
|
1113
1365
|
shard.map((q) => q.partition),
|
|
1114
1366
|
);
|
|
1115
1367
|
meta.push({ sid, ek });
|
|
1116
|
-
|
|
1368
|
+
// Each request goes out after the one before it was acknowledged, not on a timer (Y4b).
|
|
1369
|
+
const sent = await sendRequest("msg", sid, ek, {
|
|
1117
1370
|
type: "message",
|
|
1118
1371
|
priority: 2,
|
|
1119
1372
|
batchSize: 2000,
|
|
1120
1373
|
queries: shard,
|
|
1121
1374
|
});
|
|
1122
|
-
|
|
1375
|
+
if (sent.socketClosed) {
|
|
1376
|
+
meta.socketClosed = true;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1123
1379
|
}
|
|
1124
1380
|
return meta;
|
|
1125
1381
|
};
|
|
@@ -1141,7 +1397,13 @@ export class SyncV2 {
|
|
|
1141
1397
|
let socketDied = false;
|
|
1142
1398
|
let timedOut = false;
|
|
1143
1399
|
let stop = false;
|
|
1400
|
+
let declined = null;
|
|
1401
|
+
let failedBatches = 0;
|
|
1402
|
+
let tooManyFailures = false;
|
|
1403
|
+
const batchStats = { failed: 0, total: 0 };
|
|
1144
1404
|
let rePrompted = false;
|
|
1405
|
+
/** batches that failed as a whole (no scope named): they are not a range to ask for again */
|
|
1406
|
+
let sessionErrors = 0;
|
|
1145
1407
|
// A reconnect is only on the table when the caller handed us a way
|
|
1146
1408
|
// to reconnect -- this class never starts the listener itself.
|
|
1147
1409
|
const schedule = createShardSchedule(shards.length, {
|
|
@@ -1149,14 +1411,105 @@ export class SyncV2 {
|
|
|
1149
1411
|
maxResumes: typeof opts.reconnect === "function" ? resolveMaxResumes(opts.maxResumes) : 0,
|
|
1150
1412
|
});
|
|
1151
1413
|
|
|
1414
|
+
// Store one decoded chunk: the same for a first ask and for the one retry.
|
|
1415
|
+
const storeChunk = async (obj) => {
|
|
1416
|
+
// Network identity lookups must finish before opening
|
|
1417
|
+
// the synchronous SQLite transaction for this chunk.
|
|
1418
|
+
await senders.prepare((obj.partitionsList || []).flatMap((p) => p.messagesList || []));
|
|
1419
|
+
// One transaction per decoded chunk rather than one per
|
|
1420
|
+
// row: thousands of individual WAL commits is both slow
|
|
1421
|
+
// and a long block on the event loop.
|
|
1422
|
+
runInTransaction(() => {
|
|
1423
|
+
for (const part of obj.partitionsList || []) {
|
|
1424
|
+
const { gid, hit, threadId } = noteThread(part.id);
|
|
1425
|
+
const isGroup = part.id.startsWith("group/");
|
|
1426
|
+
const cm = (gid && convMeta.get(gid)) || {};
|
|
1427
|
+
for (const msg of part.messagesList || []) {
|
|
1428
|
+
// The payload's numeric msgType + meta decide the row;
|
|
1429
|
+
// `content` is always a string, so it cannot.
|
|
1430
|
+
const info = classifySyncMessage(msg);
|
|
1431
|
+
const threadType = hit ? hit.type : isGroup ? "group" : "dm";
|
|
1432
|
+
try {
|
|
1433
|
+
upsertThread({
|
|
1434
|
+
threadId,
|
|
1435
|
+
type: threadType,
|
|
1436
|
+
// The partition prefix is the phone's own
|
|
1437
|
+
// classification: authoritative when the
|
|
1438
|
+
// thread map agrees, so it can heal a 1-1 a
|
|
1439
|
+
// pin notice once turned into a "group".
|
|
1440
|
+
authoritative: threadType === (isGroup ? "group" : "dm"),
|
|
1441
|
+
name: hit ? hit.name : "",
|
|
1442
|
+
lastUpdate: Number(msg.timestamp) || 0,
|
|
1443
|
+
sync_timestamp: Date.now(),
|
|
1444
|
+
respondedByMe: cm.respondedByMe,
|
|
1445
|
+
lastGlobalId: cm.lastGlobalId,
|
|
1446
|
+
lastClientId: cm.lastClientId,
|
|
1447
|
+
});
|
|
1448
|
+
// The listener stored this system line under a
|
|
1449
|
+
// placeholder id (a group event carries no
|
|
1450
|
+
// message id); the phone's row replaces it.
|
|
1451
|
+
if (info.type === "group_event") {
|
|
1452
|
+
replaceLiveGroupEventPlaceholder(threadId, Number(msg.timestamp) || 0);
|
|
1453
|
+
}
|
|
1454
|
+
insertMessage({
|
|
1455
|
+
// jspb renders an unset uint64 as
|
|
1456
|
+
// the STRING "0", which is truthy,
|
|
1457
|
+
// so `globalId || clientId` kept it
|
|
1458
|
+
// and every message without a
|
|
1459
|
+
// global id collided on the primary
|
|
1460
|
+
// key "0", overwriting each other.
|
|
1461
|
+
// 0 means absent here, exactly as
|
|
1462
|
+
// it does in a removal's
|
|
1463
|
+
// globalDelMsgId and a reaction's
|
|
1464
|
+
// gMsgID.
|
|
1465
|
+
msgId: syncMsgId(msg, threadId),
|
|
1466
|
+
threadId,
|
|
1467
|
+
senderId: senders.get(msg.senderId).id,
|
|
1468
|
+
senderName: senders.get(msg.senderId).name,
|
|
1469
|
+
text: info.text,
|
|
1470
|
+
timestamp: Number(msg.timestamp) || 0,
|
|
1471
|
+
type: info.type,
|
|
1472
|
+
raw_data: info.raw,
|
|
1473
|
+
has_attachment: info.hasAttachment,
|
|
1474
|
+
// The phone is the only source of
|
|
1475
|
+
// delivery/read state, and this was
|
|
1476
|
+
// parsed and then dropped on the way
|
|
1477
|
+
// to the column: 87k rows carried a
|
|
1478
|
+
// real status inside raw_data while
|
|
1479
|
+
// the column stayed NULL on all of
|
|
1480
|
+
// them.
|
|
1481
|
+
msgStatus: info.raw?.msgStatus,
|
|
1482
|
+
});
|
|
1483
|
+
messagesSaved++;
|
|
1484
|
+
if (info.hasAttachment) attachmentsSaved++;
|
|
1485
|
+
typeCounts[info.type] = (typeCounts[info.type] || 0) + 1;
|
|
1486
|
+
} catch (e) {
|
|
1487
|
+
// Keep going with the rest of the chunk, but never silently: a row that cannot be
|
|
1488
|
+
// written (a full disk, a locked file) leaves a hole, so the partition is not settled
|
|
1489
|
+
// and the run does not call itself complete.
|
|
1490
|
+
rowErrors++;
|
|
1491
|
+
writeFailed.add(part.id);
|
|
1492
|
+
firstRowError ??= e?.message ?? String(e);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1152
1499
|
// ---- wave by wave: send, wait, decrypt, decode, store ----
|
|
1153
1500
|
// Storing per shard rather than after all of them means an
|
|
1154
1501
|
// interrupted run keeps what it already pulled.
|
|
1155
1502
|
while (!schedule.done() && !stop) {
|
|
1503
|
+
if (aborted()) {
|
|
1504
|
+
cancelled = true;
|
|
1505
|
+
stop = true;
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1156
1508
|
const wave = schedule.nextWave();
|
|
1157
1509
|
const waveMeta = await sendWave(wave.map((i) => shards[i]));
|
|
1158
|
-
|
|
1159
|
-
|
|
1510
|
+
// A wire that died while the requests were going out loses the rest of the wave with it.
|
|
1511
|
+
let lostSocket = Boolean(waveMeta.socketClosed);
|
|
1512
|
+
for (let k = 0; !lostSocket && k < waveMeta.length; k++) {
|
|
1160
1513
|
const m = waveMeta[k];
|
|
1161
1514
|
const left = runDeadline - Date.now();
|
|
1162
1515
|
const why = left > 0 ? await waitDone(m.sid, left) : "timeout";
|
|
@@ -1164,7 +1517,38 @@ export class SyncV2 {
|
|
|
1164
1517
|
lostSocket = true;
|
|
1165
1518
|
break;
|
|
1166
1519
|
}
|
|
1167
|
-
if (why === "
|
|
1520
|
+
if (why === "cancelled") {
|
|
1521
|
+
cancelled = true;
|
|
1522
|
+
stop = true;
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
if (why === "declined") {
|
|
1526
|
+
// Same rule as the conversation round: the phone's no ends the run.
|
|
1527
|
+
declined = sessions.get(m.sid).fatal;
|
|
1528
|
+
stop = true;
|
|
1529
|
+
break;
|
|
1530
|
+
}
|
|
1531
|
+
if (why === "stalled") {
|
|
1532
|
+
// Fail this session alone (an idle timeout fails the session, not the run):
|
|
1533
|
+
// what arrived is stored, and the conversations it never delivered are asked for once more at
|
|
1534
|
+
// the end of the run, in sessions of their own.
|
|
1535
|
+
const stalled = sessions.get(m.sid);
|
|
1536
|
+
const missing = shards[wave[k]].filter(
|
|
1537
|
+
(q) => !stalled.covered.has(q.partition) && !stalled.failed.has(q.partition),
|
|
1538
|
+
);
|
|
1539
|
+
for (const q of missing) {
|
|
1540
|
+
stalled.failed.add(q.partition);
|
|
1541
|
+
stalled.failures.push({ partition: q.partition, code: "stalled" });
|
|
1542
|
+
}
|
|
1543
|
+
stalled.disposeReason ??= DISPOSE_REASON.ERROR;
|
|
1544
|
+
onStatus({
|
|
1545
|
+
phase: "warn",
|
|
1546
|
+
detail:
|
|
1547
|
+
`the phone went idle with ${shards[wave[k]].length - missing.length} of ` +
|
|
1548
|
+
`${shards[wave[k]].length} conversation(s) of batch ${finished + 1} delivered — ` +
|
|
1549
|
+
`keeping those, and asking for the other ${missing.length} again at the end`,
|
|
1550
|
+
});
|
|
1551
|
+
} else if (why === "idle-timeout" || why === "timeout") {
|
|
1168
1552
|
stop = true;
|
|
1169
1553
|
timedOut = true;
|
|
1170
1554
|
onStatus({
|
|
@@ -1181,97 +1565,51 @@ export class SyncV2 {
|
|
|
1181
1565
|
if (schedule.resumes() && sessions.get(m.sid).statuses.some((st) => Number(st) === 3)) {
|
|
1182
1566
|
rePrompted = true;
|
|
1183
1567
|
}
|
|
1568
|
+
const served = sessions.get(m.sid);
|
|
1184
1569
|
if (why === "error") {
|
|
1185
|
-
|
|
1186
|
-
|
|
1570
|
+
// Keep the part that did arrive: one bad frame must not drop a whole shard.
|
|
1571
|
+
onStatus({
|
|
1572
|
+
phase: "warn",
|
|
1573
|
+
detail: `batch failed: ${JSON.stringify(served.err)} — keeping the part that arrived`,
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
const failedHere = served.failures.length + (served.err ? 1 : 0);
|
|
1577
|
+
failedBatches += failedHere;
|
|
1578
|
+
batchStats.failed += failedHere;
|
|
1579
|
+
batchStats.total += served.batches.length + failedHere;
|
|
1580
|
+
if (shouldAbortOnFailures(batchStats)) {
|
|
1581
|
+
stop = true;
|
|
1582
|
+
tooManyFailures = true;
|
|
1583
|
+
onStatus({
|
|
1584
|
+
phase: "warn",
|
|
1585
|
+
detail: `${batchStats.failed} of ${batchStats.total} batches failed — stopping and keeping what arrived`,
|
|
1586
|
+
});
|
|
1187
1587
|
}
|
|
1188
1588
|
|
|
1189
1589
|
const before = messagesSaved;
|
|
1190
|
-
await eachChunkObj(sessions.get(m.sid), m.ek, M.SyncChunk,
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
type: threadType,
|
|
1214
|
-
// The partition prefix is the phone's own
|
|
1215
|
-
// classification: authoritative when the
|
|
1216
|
-
// thread map agrees, so it can heal a 1-1 a
|
|
1217
|
-
// pin notice once turned into a "group".
|
|
1218
|
-
authoritative: threadType === (isGroup ? "group" : "dm"),
|
|
1219
|
-
name: hit ? hit.name : "",
|
|
1220
|
-
lastUpdate: Number(msg.timestamp) || 0,
|
|
1221
|
-
sync_timestamp: Date.now(),
|
|
1222
|
-
respondedByMe: cm.respondedByMe,
|
|
1223
|
-
lastGlobalId: cm.lastGlobalId,
|
|
1224
|
-
lastClientId: cm.lastClientId,
|
|
1225
|
-
});
|
|
1226
|
-
// The listener stored this system line under a
|
|
1227
|
-
// placeholder id (a group event carries no
|
|
1228
|
-
// message id); the phone's row replaces it.
|
|
1229
|
-
if (info.type === "group_event") {
|
|
1230
|
-
replaceLiveGroupEventPlaceholder(threadId, Number(msg.timestamp) || 0);
|
|
1231
|
-
}
|
|
1232
|
-
insertMessage({
|
|
1233
|
-
// jspb renders an unset uint64 as
|
|
1234
|
-
// the STRING "0", which is truthy,
|
|
1235
|
-
// so `globalId || clientId` kept it
|
|
1236
|
-
// and every message without a
|
|
1237
|
-
// global id collided on the primary
|
|
1238
|
-
// key "0", overwriting each other.
|
|
1239
|
-
// 0 means absent here, exactly as
|
|
1240
|
-
// it does in a removal's
|
|
1241
|
-
// globalDelMsgId and a reaction's
|
|
1242
|
-
// gMsgID.
|
|
1243
|
-
msgId: syncMsgId(msg, threadId),
|
|
1244
|
-
threadId,
|
|
1245
|
-
senderId: senders.get(msg.senderId).id,
|
|
1246
|
-
senderName: senders.get(msg.senderId).name,
|
|
1247
|
-
text: info.text,
|
|
1248
|
-
timestamp: Number(msg.timestamp) || 0,
|
|
1249
|
-
type: info.type,
|
|
1250
|
-
raw_data: info.raw,
|
|
1251
|
-
has_attachment: info.hasAttachment,
|
|
1252
|
-
// The phone is the only source of
|
|
1253
|
-
// delivery/read state, and this was
|
|
1254
|
-
// parsed and then dropped on the way
|
|
1255
|
-
// to the column: 87k rows carried a
|
|
1256
|
-
// real status inside raw_data while
|
|
1257
|
-
// the column stayed NULL on all of
|
|
1258
|
-
// them.
|
|
1259
|
-
msgStatus: info.raw?.msgStatus,
|
|
1260
|
-
});
|
|
1261
|
-
messagesSaved++;
|
|
1262
|
-
if (info.hasAttachment) attachmentsSaved++;
|
|
1263
|
-
typeCounts[info.type] = (typeCounts[info.type] || 0) + 1;
|
|
1264
|
-
} catch (e) {
|
|
1265
|
-
// Keep going with the rest of the chunk, but never silently: a row that cannot
|
|
1266
|
-
// be written (a full disk, a locked file) leaves a hole, so the run does not
|
|
1267
|
-
// call itself complete.
|
|
1268
|
-
rowErrors++;
|
|
1269
|
-
firstRowError ??= e?.message ?? String(e);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
});
|
|
1590
|
+
const read = await eachChunkObj(sessions.get(m.sid), m.ek, M.SyncChunk, storeChunk);
|
|
1591
|
+
|
|
1592
|
+
// Batches that could not be downloaded count as failed ones, and can stop the run like any other.
|
|
1593
|
+
if (read.downloadFailures.length) {
|
|
1594
|
+
failedBatches += read.downloadFailures.length;
|
|
1595
|
+
batchStats.failed += read.downloadFailures.length;
|
|
1596
|
+
if (shouldAbortOnFailures(batchStats) && !tooManyFailures) {
|
|
1597
|
+
stop = true;
|
|
1598
|
+
tooManyFailures = true;
|
|
1599
|
+
onStatus({
|
|
1600
|
+
phase: "warn",
|
|
1601
|
+
detail: `${batchStats.failed} of ${batchStats.total} batches failed — stopping and keeping what arrived`,
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// The partitions of this shard now stand done, failed, or (a session that ended early) pending.
|
|
1607
|
+
if (served.err) sessionErrors++;
|
|
1608
|
+
settleRanges(shards[wave[k]], served);
|
|
1609
|
+
// The session is released with the others of its wave below, not now: a run's sessions are
|
|
1610
|
+
// released together once all are consumed. The phone stops serving at about 32 sessions open
|
|
1611
|
+
// together, which a wave never reaches.
|
|
1612
|
+
if (served.err || served.failures.length) served.disposeReason ??= DISPOSE_REASON.ERROR;
|
|
1275
1613
|
|
|
1276
1614
|
finished++;
|
|
1277
1615
|
// Per-shard progress: without it a 50-shard run prints nothing
|
|
@@ -1283,6 +1621,11 @@ export class SyncV2 {
|
|
|
1283
1621
|
});
|
|
1284
1622
|
}
|
|
1285
1623
|
|
|
1624
|
+
// A wave that was consumed whole: let go of its sessions together, back to back (the next request
|
|
1625
|
+
// waits for the acks, see sendRequest). One that stopped early is released by the end of the run,
|
|
1626
|
+
// each with its own reason (cancelled, declined, failed); one that lost the socket is released by
|
|
1627
|
+
// the first move on the next socket (releaseAbandoned).
|
|
1628
|
+
if (!lostSocket && !stop) await disposeTogether(waveMeta.map((m) => m.sid));
|
|
1286
1629
|
if (!lostSocket) continue;
|
|
1287
1630
|
socketDied = true;
|
|
1288
1631
|
onStatus({
|
|
@@ -1294,13 +1637,18 @@ export class SyncV2 {
|
|
|
1294
1637
|
: " [no close event seen]"),
|
|
1295
1638
|
});
|
|
1296
1639
|
// Re-tapping the phone is the expensive part of this command, so
|
|
1297
|
-
// a dropped wire is worth
|
|
1640
|
+
// a dropped wire is worth a few reconnects before giving the tap
|
|
1298
1641
|
// up. The shards already served stay served; only what is still
|
|
1299
1642
|
// pending goes out again. Worst case the phone prompts once more
|
|
1300
1643
|
// -- which is exactly what a manual re-run would have cost, and
|
|
1301
1644
|
// that run would have had to re-fetch everything as well.
|
|
1302
1645
|
if (schedule.useResume() && (await reconnect())) {
|
|
1303
1646
|
socketDied = false;
|
|
1647
|
+
// First on a new socket: release, with reason 3, every session the previous socket left
|
|
1648
|
+
// open, and count sessions from 0 again, as a new sync does. The sessions of the dead socket are
|
|
1649
|
+
// gone with it; asking on without releasing them left up to 39 of them open on the phone.
|
|
1650
|
+
await channel.releaseAbandoned();
|
|
1651
|
+
channel.resetUssidx(1); // 0 is the conversation round, which a resume does not repeat
|
|
1304
1652
|
// The remaining shards still need their own time; the
|
|
1305
1653
|
// reconnect must not eat the budget they were owed.
|
|
1306
1654
|
runDeadline = Date.now() + shardBudget(schedule.remaining());
|
|
@@ -1312,6 +1660,53 @@ export class SyncV2 {
|
|
|
1312
1660
|
}
|
|
1313
1661
|
stop = true;
|
|
1314
1662
|
}
|
|
1663
|
+
// A range the phone could not serve is asked for once more, in sessions of its own (Y2b). One that
|
|
1664
|
+
// fails again stays failed for the next run: the phone may simply not have it ready.
|
|
1665
|
+
if (!stop && !declined && failedRanges.size) {
|
|
1666
|
+
const again = todo.filter((q) => failedRanges.has(q.partition));
|
|
1667
|
+
runDeadline = Date.now() + shardBudget(Math.ceil(again.length / shardSize));
|
|
1668
|
+
onStatus({
|
|
1669
|
+
phase: "messages",
|
|
1670
|
+
detail: `asking once more for ${again.length} conversation(s) the phone could not serve`,
|
|
1671
|
+
});
|
|
1672
|
+
for (let i = 0; i < again.length; i += shardSize) {
|
|
1673
|
+
const queries = again.slice(i, i + shardSize);
|
|
1674
|
+
const ek = zproto.generateKeyPair();
|
|
1675
|
+
const sid = newSession(
|
|
1676
|
+
"msg",
|
|
1677
|
+
queries.map((q) => q.partition),
|
|
1678
|
+
);
|
|
1679
|
+
const sent = await sendRequest("msg", sid, ek, {
|
|
1680
|
+
type: "message",
|
|
1681
|
+
priority: 2,
|
|
1682
|
+
batchSize: 2000,
|
|
1683
|
+
queries,
|
|
1684
|
+
});
|
|
1685
|
+
if (sent.socketClosed) break;
|
|
1686
|
+
rangeInfo.retried += queries.length;
|
|
1687
|
+
const left = runDeadline - Date.now();
|
|
1688
|
+
const why = left > 0 ? await waitDone(sid, left) : "timeout";
|
|
1689
|
+
if (why === "cancelled") cancelled = true;
|
|
1690
|
+
if (
|
|
1691
|
+
why === "cancelled" ||
|
|
1692
|
+
why === "socket-closed" ||
|
|
1693
|
+
why === "declined" ||
|
|
1694
|
+
why === "stalled" ||
|
|
1695
|
+
why === "idle-timeout" ||
|
|
1696
|
+
why === "timeout"
|
|
1697
|
+
)
|
|
1698
|
+
break;
|
|
1699
|
+
const retried = sessions.get(sid);
|
|
1700
|
+
await eachChunkObj(retried, ek, M.SyncChunk, storeChunk);
|
|
1701
|
+
const had = new Set(failedRanges.keys());
|
|
1702
|
+
settleRanges(queries, retried);
|
|
1703
|
+
if (retried.err || retried.failures.length) retried.disposeReason ??= DISPOSE_REASON.ERROR;
|
|
1704
|
+
disposeOne(sid);
|
|
1705
|
+
rangeInfo.recovered += queries.filter(
|
|
1706
|
+
(q) => had.has(q.partition) && !failedRanges.has(q.partition),
|
|
1707
|
+
).length;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1315
1710
|
if (rePrompted) {
|
|
1316
1711
|
onStatus({
|
|
1317
1712
|
phase: "warn",
|
|
@@ -1320,8 +1715,14 @@ export class SyncV2 {
|
|
|
1320
1715
|
"the reconnect did not inherit the first one",
|
|
1321
1716
|
});
|
|
1322
1717
|
}
|
|
1323
|
-
resumeInfo = { resumes: schedule.resumes(), rePrompted };
|
|
1718
|
+
resumeInfo = { resumes: schedule.resumes(), rePrompted, ranges: { ...rangeInfo, ...countSyncRanges() } };
|
|
1719
|
+
if (declined) throw declineError(declined);
|
|
1720
|
+
// A cut-short run is not a failure and not a settled window: what arrived is kept, nothing is recorded.
|
|
1721
|
+
if (cancelled) throw cancelError();
|
|
1324
1722
|
const outcome = describeRestoreOutcome({
|
|
1723
|
+
// A range that failed and was recovered by the retry is not a failed batch any more.
|
|
1724
|
+
failedBatches: failedRanges.size || sessionErrors || tooManyFailures ? failedBatches : 0,
|
|
1725
|
+
tooManyFailures,
|
|
1325
1726
|
socketDied,
|
|
1326
1727
|
timedOut,
|
|
1327
1728
|
confirmed,
|
|
@@ -1334,16 +1735,30 @@ export class SyncV2 {
|
|
|
1334
1735
|
});
|
|
1335
1736
|
if (outcome.error) throw new Error(outcome.error);
|
|
1336
1737
|
reason = outcome.reason;
|
|
1337
|
-
//
|
|
1338
|
-
//
|
|
1339
|
-
recordRestoreSuccess(win, { resolveGaps:
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1738
|
+
// Only a run that settled its window counts as a success (Y5a). A partial one records none: the
|
|
1739
|
+
// next run asks again, and (with the ranges kept above) only for what it did not get.
|
|
1740
|
+
if (reason === "complete") recordRestoreSuccess(win, { resolveGaps: true });
|
|
1741
|
+
} catch (e) {
|
|
1742
|
+
if (e?.cancelled) {
|
|
1743
|
+
cancelled = true;
|
|
1744
|
+
reason = "cancelled";
|
|
1745
|
+
} else {
|
|
1746
|
+
runError = e;
|
|
1747
|
+
throw e;
|
|
1345
1748
|
}
|
|
1346
|
-
|
|
1749
|
+
} finally {
|
|
1750
|
+
// Every session still open is released with the reason that fits how the run ended: the phone's own
|
|
1751
|
+
// reason when it ended the session (a "no" has one), cancelled for a run the person stopped, finished
|
|
1752
|
+
// for a run that settled its window, failed for one that did not (Y6a). The acks are awaited; on a
|
|
1753
|
+
// dead wire this fails fast.
|
|
1754
|
+
const settled = !runError && (reason === "complete" || reason === "empty-window");
|
|
1755
|
+
await channel.releaseAll((id) => {
|
|
1756
|
+
const s = sessions.get(id);
|
|
1757
|
+
if (Number.isInteger(s?.disposeReason)) return s.disposeReason;
|
|
1758
|
+
// A stop leaves finished sessions finished: only the ones still waiting are cancelled.
|
|
1759
|
+
if (cancelled) return s?.done ? DISPOSE_REASON.SUCCESS : DISPOSE_REASON.CANCELLED;
|
|
1760
|
+
return settled ? undefined : DISPOSE_REASON.ERROR;
|
|
1761
|
+
});
|
|
1347
1762
|
detachSocketTaps();
|
|
1348
1763
|
try {
|
|
1349
1764
|
detachLive();
|
|
@@ -1359,6 +1774,7 @@ export class SyncV2 {
|
|
|
1359
1774
|
threadsMapped: mapped.size,
|
|
1360
1775
|
threadsUnmapped: unmapped.size,
|
|
1361
1776
|
reason,
|
|
1777
|
+
...(this.nameRefresh && { nameRefresh: this.nameRefresh }),
|
|
1362
1778
|
...extra,
|
|
1363
1779
|
};
|
|
1364
1780
|
}
|