@ardennguyen/zalo-agent-cli 1.0.7 → 2.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/DISCLAIMER.md +2 -2
- package/README.md +146 -69
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/bignumber.js/CHANGELOG.md +381 -0
- package/node_modules/bignumber.js/LICENCE.md +26 -0
- package/node_modules/bignumber.js/README.md +289 -0
- package/node_modules/bignumber.js/bignumber.d.mts +6 -0
- package/node_modules/bignumber.js/bignumber.d.ts +5 -0
- package/node_modules/bignumber.js/bignumber.js +2922 -0
- package/node_modules/bignumber.js/bignumber.mjs +2907 -0
- package/node_modules/bignumber.js/doc/API.html +2249 -0
- package/node_modules/bignumber.js/package.json +60 -0
- package/node_modules/bignumber.js/types.d.ts +1821 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/crypto-js/CONTRIBUTING.md +28 -0
- package/node_modules/crypto-js/LICENSE +24 -0
- package/node_modules/crypto-js/README.md +275 -0
- package/node_modules/crypto-js/aes.js +234 -0
- package/node_modules/crypto-js/blowfish.js +471 -0
- package/node_modules/crypto-js/bower.json +39 -0
- package/node_modules/crypto-js/cipher-core.js +895 -0
- package/node_modules/crypto-js/core.js +807 -0
- package/node_modules/crypto-js/crypto-js.js +6657 -0
- package/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
- package/node_modules/crypto-js/enc-base64.js +136 -0
- package/node_modules/crypto-js/enc-base64url.js +148 -0
- package/node_modules/crypto-js/enc-hex.js +18 -0
- package/node_modules/crypto-js/enc-latin1.js +18 -0
- package/node_modules/crypto-js/enc-utf16.js +149 -0
- package/node_modules/crypto-js/enc-utf8.js +18 -0
- package/node_modules/crypto-js/evpkdf.js +134 -0
- package/node_modules/crypto-js/format-hex.js +66 -0
- package/node_modules/crypto-js/format-openssl.js +18 -0
- package/node_modules/crypto-js/hmac-md5.js +18 -0
- package/node_modules/crypto-js/hmac-ripemd160.js +18 -0
- package/node_modules/crypto-js/hmac-sha1.js +18 -0
- package/node_modules/crypto-js/hmac-sha224.js +18 -0
- package/node_modules/crypto-js/hmac-sha256.js +18 -0
- package/node_modules/crypto-js/hmac-sha3.js +18 -0
- package/node_modules/crypto-js/hmac-sha384.js +18 -0
- package/node_modules/crypto-js/hmac-sha512.js +18 -0
- package/node_modules/crypto-js/hmac.js +143 -0
- package/node_modules/crypto-js/index.js +18 -0
- package/node_modules/crypto-js/lib-typedarrays.js +76 -0
- package/node_modules/crypto-js/md5.js +268 -0
- package/node_modules/crypto-js/mode-cfb.js +80 -0
- package/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
- package/node_modules/crypto-js/mode-ctr.js +58 -0
- package/node_modules/crypto-js/mode-ecb.js +40 -0
- package/node_modules/crypto-js/mode-ofb.js +54 -0
- package/node_modules/crypto-js/package.json +42 -0
- package/node_modules/crypto-js/pad-ansix923.js +49 -0
- package/node_modules/crypto-js/pad-iso10126.js +44 -0
- package/node_modules/crypto-js/pad-iso97971.js +40 -0
- package/node_modules/crypto-js/pad-nopadding.js +30 -0
- package/node_modules/crypto-js/pad-pkcs7.js +18 -0
- package/node_modules/crypto-js/pad-zeropadding.js +47 -0
- package/node_modules/crypto-js/pbkdf2.js +145 -0
- package/node_modules/crypto-js/rabbit-legacy.js +190 -0
- package/node_modules/crypto-js/rabbit.js +192 -0
- package/node_modules/crypto-js/rc4.js +139 -0
- package/node_modules/crypto-js/ripemd160.js +267 -0
- package/node_modules/crypto-js/sha1.js +150 -0
- package/node_modules/crypto-js/sha224.js +80 -0
- package/node_modules/crypto-js/sha256.js +199 -0
- package/node_modules/crypto-js/sha3.js +326 -0
- package/node_modules/crypto-js/sha384.js +83 -0
- package/node_modules/crypto-js/sha512.js +326 -0
- package/node_modules/crypto-js/tripledes.js +779 -0
- package/node_modules/crypto-js/x64-core.js +304 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +79 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +7 -0
- package/node_modules/es-set-tostringtag/.eslintrc +13 -0
- package/node_modules/es-set-tostringtag/.nycrc +9 -0
- package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
- package/node_modules/es-set-tostringtag/LICENSE +21 -0
- package/node_modules/es-set-tostringtag/README.md +53 -0
- package/node_modules/es-set-tostringtag/index.d.ts +10 -0
- package/node_modules/es-set-tostringtag/index.js +35 -0
- package/node_modules/es-set-tostringtag/package.json +78 -0
- package/node_modules/es-set-tostringtag/test/index.js +85 -0
- package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
- package/node_modules/form-data/CHANGELOG.md +686 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md +355 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +4 -0
- package/node_modules/form-data/lib/form_data.js +506 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-db/README.md +100 -0
- package/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
- package/node_modules/form-data/node_modules/mime-db/index.js +12 -0
- package/node_modules/form-data/node_modules/mime-db/package.json +60 -0
- package/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-types/README.md +113 -0
- package/node_modules/form-data/node_modules/mime-types/index.js +188 -0
- package/node_modules/form-data/node_modules/mime-types/package.json +44 -0
- package/node_modules/form-data/package.json +82 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/has-tostringtag/.eslintrc +5 -0
- package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
- package/node_modules/has-tostringtag/.nycrc +13 -0
- package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
- package/node_modules/has-tostringtag/LICENSE +21 -0
- package/node_modules/has-tostringtag/README.md +46 -0
- package/node_modules/has-tostringtag/index.d.ts +3 -0
- package/node_modules/has-tostringtag/index.js +8 -0
- package/node_modules/has-tostringtag/package.json +108 -0
- package/node_modules/has-tostringtag/shams.d.ts +3 -0
- package/node_modules/has-tostringtag/shams.js +8 -0
- package/node_modules/has-tostringtag/test/index.js +21 -0
- package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
- package/node_modules/has-tostringtag/test/tests.js +15 -0
- package/node_modules/has-tostringtag/tsconfig.json +49 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +58 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/json-bigint/LICENSE +20 -0
- package/node_modules/json-bigint/README.md +240 -0
- package/node_modules/json-bigint/index.js +12 -0
- package/node_modules/json-bigint/lib/parse.js +443 -0
- package/node_modules/json-bigint/lib/stringify.js +384 -0
- package/node_modules/json-bigint/package.json +34 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +155 -0
- package/node_modules/pako/dist/pako.es5.js +6760 -0
- package/node_modules/pako/dist/pako.es5.min.js +2 -0
- package/node_modules/pako/dist/pako.esm.mjs +6945 -0
- package/node_modules/pako/dist/pako.js +6964 -0
- package/node_modules/pako/dist/pako.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.es5.js +3953 -0
- package/node_modules/pako/dist/pako_deflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.js +4154 -0
- package/node_modules/pako/dist/pako_deflate.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.es5.js +3272 -0
- package/node_modules/pako/dist/pako_inflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.js +3279 -0
- package/node_modules/pako/dist/pako_inflate.min.js +2 -0
- package/node_modules/pako/index.js +18 -0
- package/node_modules/pako/lib/deflate.js +387 -0
- package/node_modules/pako/lib/inflate.js +456 -0
- package/node_modules/pako/lib/utils/common.js +48 -0
- package/node_modules/pako/lib/utils/strings.js +174 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +2069 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +344 -0
- package/node_modules/pako/lib/zlib/inflate.js +1575 -0
- package/node_modules/pako/lib/zlib/inftrees.js +340 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1179 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +73 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/spark-md5/LICENSE +13 -0
- package/node_modules/spark-md5/README.md +191 -0
- package/node_modules/spark-md5/package.json +35 -0
- package/node_modules/spark-md5/spark-md5.js +751 -0
- package/node_modules/spark-md5/spark-md5.min.js +1 -0
- package/node_modules/tldts/LICENSE +13 -0
- package/node_modules/tldts/README.md +327 -0
- package/node_modules/tldts/bin/cli.js +21 -0
- package/node_modules/tldts/dist/cjs/index.js +666 -0
- package/node_modules/tldts/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/es6/index.js +33 -0
- package/node_modules/tldts/dist/es6/index.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/index.cjs.min.js +2 -0
- package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
- package/node_modules/tldts/dist/index.esm.min.js +2 -0
- package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
- package/node_modules/tldts/dist/index.umd.min.js +2 -0
- package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
- package/node_modules/tldts/dist/types/index.d.ts +7 -0
- package/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
- package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
- package/node_modules/tldts/index.ts +62 -0
- package/node_modules/tldts/package.json +91 -0
- package/node_modules/tldts/src/data/trie.ts +14 -0
- package/node_modules/tldts/src/suffix-trie.ts +110 -0
- package/node_modules/tldts-core/LICENSE +13 -0
- package/node_modules/tldts-core/README.md +3 -0
- package/node_modules/tldts-core/dist/cjs/index.js +561 -0
- package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js +104 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/es6/index.js +4 -0
- package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js +99 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/options.js +19 -0
- package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
- package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
- package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
- package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
- package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
- package/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
- package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
- package/node_modules/tldts-core/index.ts +10 -0
- package/node_modules/tldts-core/package.json +68 -0
- package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
- package/node_modules/tldts-core/src/domain.ts +100 -0
- package/node_modules/tldts-core/src/extract-hostname.ts +170 -0
- package/node_modules/tldts-core/src/factory.ts +160 -0
- package/node_modules/tldts-core/src/is-ip.ts +87 -0
- package/node_modules/tldts-core/src/is-valid.ts +79 -0
- package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
- package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
- package/node_modules/tldts-core/src/options.ts +39 -0
- package/node_modules/tldts-core/src/subdomain.ts +11 -0
- package/node_modules/tough-cookie/LICENSE +12 -0
- package/node_modules/tough-cookie/README.md +154 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +33 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +65 -0
- package/node_modules/tough-cookie/dist/cookie/constants.d.ts +54 -0
- package/node_modules/tough-cookie/dist/cookie/constants.js +38 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +326 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.js +831 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +58 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +84 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +621 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.js +1000 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +40 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.js +60 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +38 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.js +94 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +15 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.js +20 -0
- package/node_modules/tough-cookie/dist/cookie/index.d.ts +29 -0
- package/node_modules/tough-cookie/dist/cookie/index.js +54 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +103 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.js +323 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +14 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.js +32 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +55 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.js +71 -0
- package/node_modules/tough-cookie/dist/memstore.d.ts +220 -0
- package/node_modules/tough-cookie/dist/memstore.js +187 -0
- package/node_modules/tough-cookie/dist/pathMatch.d.ts +17 -0
- package/node_modules/tough-cookie/dist/pathMatch.js +40 -0
- package/node_modules/tough-cookie/dist/permuteDomain.d.ts +15 -0
- package/node_modules/tough-cookie/dist/permuteDomain.js +44 -0
- package/node_modules/tough-cookie/dist/store.d.ts +211 -0
- package/node_modules/tough-cookie/dist/store.js +76 -0
- package/node_modules/tough-cookie/dist/utils.d.ts +34 -0
- package/node_modules/tough-cookie/dist/utils.js +99 -0
- package/node_modules/tough-cookie/dist/validators.d.ts +24 -0
- package/node_modules/tough-cookie/dist/validators.js +90 -0
- package/node_modules/tough-cookie/dist/version.d.ts +5 -0
- package/node_modules/tough-cookie/dist/version.js +8 -0
- package/node_modules/tough-cookie/package.json +144 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/zca-js/.prettierrc +5 -0
- package/node_modules/zca-js/CODE_OF_CONDUCT.md +163 -0
- package/node_modules/zca-js/CONTRIBUTING.md +470 -0
- package/node_modules/zca-js/LICENSE +21 -0
- package/node_modules/zca-js/README.md +225 -0
- package/node_modules/zca-js/SECURITY.md +83 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/node_modules/zca-js/dist/Errors/index.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/index.js +4 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.js +26 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.js +60 -0
- package/node_modules/zca-js/dist/apis/addReaction.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/addReaction.js +294 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.js +52 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/blockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.js +30 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +52 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.js +27 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +44 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.js +32 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.js +30 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.js +37 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/createCatalog.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createCatalog.js +29 -0
- package/node_modules/zca-js/dist/apis/createGroup.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/createGroup.js +43 -0
- package/node_modules/zca-js/dist/apis/createNote.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createNote.js +47 -0
- package/node_modules/zca-js/dist/apis/createPoll.d.ts +36 -0
- package/node_modules/zca-js/dist/apis/createPoll.js +40 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.js +50 -0
- package/node_modules/zca-js/dist/apis/createReminder.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/createReminder.js +63 -0
- package/node_modules/zca-js/dist/apis/custom.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/custom.js +15 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.js +29 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.js +28 -0
- package/node_modules/zca-js/dist/apis/deleteChat.d.ts +19 -0
- package/node_modules/zca-js/dist/apis/deleteChat.js +50 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.js +52 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +31 -0
- package/node_modules/zca-js/dist/apis/deleteSnapshotMobileMsg.js +18 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.js +24 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.js +28 -0
- package/node_modules/zca-js/dist/apis/editNote.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/editNote.js +46 -0
- package/node_modules/zca-js/dist/apis/editReminder.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/editReminder.js +61 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.js +25 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +10 -0
- package/node_modules/zca-js/dist/apis/findUser.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUser.js +42 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.js +27 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.js +114 -0
- package/node_modules/zca-js/dist/apis/getAliasList.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getAliasList.js +27 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.js +34 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.js +10 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.js +23 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +21 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.js +24 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.js +28 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +30 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.js +32 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.js +20 -0
- package/node_modules/zca-js/dist/apis/getContext.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getContext.js +4 -0
- package/node_modules/zca-js/dist/apis/getCookie.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getCookie.js +9 -0
- package/node_modules/zca-js/dist/apis/getCrossDB.js +18 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.js +26 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.js +35 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +27 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +25 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +29 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +36 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.js +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +31 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +34 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +28 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +24 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.js +23 -0
- package/node_modules/zca-js/dist/apis/getLabels.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getLabels.js +28 -0
- package/node_modules/zca-js/dist/apis/getListBank.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getListBank.js +20 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getListBoard.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/getListBoard.js +45 -0
- package/node_modules/zca-js/dist/apis/getListDevice.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getListDevice.js +22 -0
- package/node_modules/zca-js/dist/apis/getListReminder.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/getListReminder.js +47 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +39 -0
- package/node_modules/zca-js/dist/apis/getMute.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/getMute.js +22 -0
- package/node_modules/zca-js/dist/apis/getOwnId.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getOwnId.js +4 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +27 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.js +22 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.js +30 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.js +33 -0
- package/node_modules/zca-js/dist/apis/getQR.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/getQR.js +29 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.js +24 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +30 -0
- package/node_modules/zca-js/dist/apis/getReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getReminder.js +25 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.js +24 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +24 -0
- package/node_modules/zca-js/dist/apis/getSettings.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getSettings.js +20 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +24 -0
- package/node_modules/zca-js/dist/apis/getStickers.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getStickers.js +40 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.js +40 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.js +30 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.js +44 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +30 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +25 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.js +27 -0
- package/node_modules/zca-js/dist/apis/keepAlive.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/keepAlive.js +22 -0
- package/node_modules/zca-js/dist/apis/lastOnline.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/lastOnline.js +26 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.js +33 -0
- package/node_modules/zca-js/dist/apis/listen.d.ts +102 -0
- package/node_modules/zca-js/dist/apis/listen.js +425 -0
- package/node_modules/zca-js/dist/apis/lockPoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/lockPoll.js +28 -0
- package/node_modules/zca-js/dist/apis/login.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/login.js +96 -0
- package/node_modules/zca-js/dist/apis/loginQR.d.ts +71 -0
- package/node_modules/zca-js/dist/apis/loginQR.js +376 -0
- package/node_modules/zca-js/dist/apis/logoutV2.js +79 -0
- package/node_modules/zca-js/dist/apis/lostFocus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/lostFocus.js +23 -0
- package/node_modules/zca-js/dist/apis/parseLink.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/parseLink.js +27 -0
- package/node_modules/zca-js/dist/apis/pullMobileMsg.js +22 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.js +27 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/removeFriend.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriend.js +28 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.js +24 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.js +27 -0
- package/node_modules/zca-js/dist/apis/removeReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/removeReminder.js +40 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.js +50 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/requestSyncMessage.js +18 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +20 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.js +26 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/node_modules/zca-js/dist/apis/scanURL.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/scanURL.js +28 -0
- package/node_modules/zca-js/dist/apis/searchSticker.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/searchSticker.js +28 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.js +53 -0
- package/node_modules/zca-js/dist/apis/sendCard.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendCard.js +75 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +55 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.js +39 -0
- package/node_modules/zca-js/dist/apis/sendLink.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendLink.js +78 -0
- package/node_modules/zca-js/dist/apis/sendMessage.d.ts +105 -0
- package/node_modules/zca-js/dist/apis/sendMessage.js +486 -0
- package/node_modules/zca-js/dist/apis/sendReport.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/sendReport.js +53 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.js +63 -0
- package/node_modules/zca-js/dist/apis/sendSticker.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendSticker.js +74 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.js +33 -0
- package/node_modules/zca-js/dist/apis/sendVideo.d.ts +35 -0
- package/node_modules/zca-js/dist/apis/sendVideo.js +134 -0
- package/node_modules/zca-js/dist/apis/sendVoice.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/sendVoice.js +89 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.js +39 -0
- package/node_modules/zca-js/dist/apis/setMute.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/setMute.js +67 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.js +34 -0
- package/node_modules/zca-js/dist/apis/sharePoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sharePoll.js +28 -0
- package/node_modules/zca-js/dist/apis/unblockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/unblockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/undo.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/undo.js +42 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.js +27 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +34 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +40 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.js +38 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.js +31 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.js +30 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +40 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.js +43 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +30 -0
- package/node_modules/zca-js/dist/apis/updateLabels.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateLabels.js +34 -0
- package/node_modules/zca-js/dist/apis/updateLang.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/updateLang.js +30 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +25 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.js +51 -0
- package/node_modules/zca-js/dist/apis/updateProfile.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/updateProfile.js +43 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.js +27 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.js +61 -0
- package/node_modules/zca-js/dist/apis/updateSettings.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/updateSettings.js +90 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +27 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +50 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.js +197 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +50 -0
- package/node_modules/zca-js/dist/apis/votePoll.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/votePoll.js +29 -0
- package/node_modules/zca-js/dist/apis.d.ts +317 -0
- package/node_modules/zca-js/dist/apis.js +327 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +308 -0
- package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +52 -0
- package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/custom.cjs +19 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteSnapshotMobileMsg.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +75 -0
- package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +41 -0
- package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +129 -0
- package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +14 -0
- package/node_modules/zca-js/dist/cjs/apis/getCrossDB.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +40 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +59 -0
- package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +61 -0
- package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +58 -0
- package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/listen.cjs +440 -0
- package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/login.cjs +102 -0
- package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +368 -0
- package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +83 -0
- package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/pullMobileMsg.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/requestSyncMessage.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +68 -0
- package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +89 -0
- package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
- package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +92 -0
- package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +500 -0
- package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +67 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +88 -0
- package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +47 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +148 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +103 -0
- package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +81 -0
- package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/undo.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +95 -0
- package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +211 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis.cjs +332 -0
- package/node_modules/zca-js/dist/cjs/context.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/index.cjs +159 -0
- package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/Bank.cjs +263 -0
- package/node_modules/zca-js/dist/cjs/models/Board.cjs +8 -0
- package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Enum.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +87 -0
- package/node_modules/zca-js/dist/cjs/models/Group.cjs +13 -0
- package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +94 -0
- package/node_modules/zca-js/dist/cjs/models/Message.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +74 -0
- package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Typing.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Undo.cjs +16 -0
- package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/update.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/utils.cjs +703 -0
- package/node_modules/zca-js/dist/cjs/zalo.cjs +112 -0
- package/node_modules/zca-js/dist/context.d.ts +179 -0
- package/node_modules/zca-js/dist/context.js +28 -0
- package/node_modules/zca-js/dist/index.d.ts +166 -0
- package/node_modules/zca-js/dist/index.js +14 -0
- package/node_modules/zca-js/dist/models/Attachment.d.ts +9 -0
- package/node_modules/zca-js/dist/models/Attachment.js +1 -0
- package/node_modules/zca-js/dist/models/AutoReply.d.ts +20 -0
- package/node_modules/zca-js/dist/models/AutoReply.js +7 -0
- package/node_modules/zca-js/dist/models/Bank.d.ts +291 -0
- package/node_modules/zca-js/dist/models/Bank.js +262 -0
- package/node_modules/zca-js/dist/models/Board.d.ts +60 -0
- package/node_modules/zca-js/dist/models/Board.js +6 -0
- package/node_modules/zca-js/dist/models/Catalog.d.ts +16 -0
- package/node_modules/zca-js/dist/models/Catalog.js +1 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +27 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Enum.d.ts +21 -0
- package/node_modules/zca-js/dist/models/Enum.js +25 -0
- package/node_modules/zca-js/dist/models/FriendEvent.d.ts +107 -0
- package/node_modules/zca-js/dist/models/FriendEvent.js +83 -0
- package/node_modules/zca-js/dist/models/Group.d.ts +125 -0
- package/node_modules/zca-js/dist/models/Group.js +11 -0
- package/node_modules/zca-js/dist/models/GroupEvent.d.ts +178 -0
- package/node_modules/zca-js/dist/models/GroupEvent.js +90 -0
- package/node_modules/zca-js/dist/models/Label.d.ts +10 -0
- package/node_modules/zca-js/dist/models/Label.js +1 -0
- package/node_modules/zca-js/dist/models/Message.d.ts +91 -0
- package/node_modules/zca-js/dist/models/Message.js +29 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +17 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.js +1 -0
- package/node_modules/zca-js/dist/models/QuickMessage.d.ts +25 -0
- package/node_modules/zca-js/dist/models/QuickMessage.js +1 -0
- package/node_modules/zca-js/dist/models/Reaction.d.ts +85 -0
- package/node_modules/zca-js/dist/models/Reaction.js +70 -0
- package/node_modules/zca-js/dist/models/Reminder.d.ts +51 -0
- package/node_modules/zca-js/dist/models/Reminder.js +7 -0
- package/node_modules/zca-js/dist/models/SeenMessage.d.ts +26 -0
- package/node_modules/zca-js/dist/models/SeenMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Sticker.d.ts +27 -0
- package/node_modules/zca-js/dist/models/Sticker.js +1 -0
- package/node_modules/zca-js/dist/models/Typing.d.ts +24 -0
- package/node_modules/zca-js/dist/models/Typing.js +17 -0
- package/node_modules/zca-js/dist/models/Undo.d.ts +34 -0
- package/node_modules/zca-js/dist/models/Undo.js +12 -0
- package/node_modules/zca-js/dist/models/User.d.ts +70 -0
- package/node_modules/zca-js/dist/models/User.js +1 -0
- package/node_modules/zca-js/dist/models/ZBusiness.d.ts +22 -0
- package/node_modules/zca-js/dist/models/ZBusiness.js +35 -0
- package/node_modules/zca-js/dist/models/index.d.ts +22 -0
- package/node_modules/zca-js/dist/models/index.js +22 -0
- package/node_modules/zca-js/dist/update.d.ts +2 -0
- package/node_modules/zca-js/dist/update.js +29 -0
- package/node_modules/zca-js/dist/utils.d.ts +167 -0
- package/node_modules/zca-js/dist/utils.js +719 -0
- package/node_modules/zca-js/dist/zalo.d.ts +41 -0
- package/node_modules/zca-js/dist/zalo.js +107 -0
- package/node_modules/zca-js/eslint.config.js +21 -0
- package/node_modules/zca-js/index.d.ts +2 -0
- package/node_modules/zca-js/package.json +78 -0
- package/node_modules/zca-js/rollup.config.js +28 -0
- package/package.json +79 -62
- package/patches/zca-js+2.2.0.patch +1677 -0
- package/src/cli.test.js +34 -5
- package/src/commands/account.js +98 -5
- package/src/commands/auto-reply.js +30 -10
- package/src/commands/catalog.js +5 -4
- package/src/commands/conv.js +551 -14
- package/src/commands/friend.js +19 -7
- package/src/commands/group.js +82 -31
- package/src/commands/listen.js +607 -65
- package/src/commands/login.js +179 -20
- package/src/commands/mcp.js +392 -41
- package/src/commands/msg.js +1278 -139
- package/src/commands/oa-listen.js +130 -20
- package/src/commands/oa.js +26 -5
- package/src/commands/poll.js +7 -2
- package/src/commands/profile.js +3 -2
- package/src/commands/sync.js +2052 -0
- package/src/core/accounts.js +69 -6
- package/src/core/cached-message.js +200 -0
- package/src/core/coverage.js +90 -0
- package/src/core/daemon-channel.js +638 -0
- package/src/core/daemon-sync.js +181 -0
- package/src/core/db.js +1610 -0
- package/src/core/forward.js +112 -0
- package/src/core/group-history.js +248 -0
- package/src/core/group-members.js +68 -0
- package/src/core/group-settings.js +250 -0
- package/src/core/history-fetch.js +208 -0
- package/src/core/listener-lifecycle.js +90 -0
- package/src/core/live-api.js +47 -0
- package/src/core/live-store.js +733 -0
- package/src/core/lock.js +129 -0
- package/src/core/logout.js +289 -0
- package/src/core/offline-queue.js +194 -0
- package/src/core/pin.js +222 -0
- package/src/core/read-state.js +318 -0
- package/src/core/receipts.js +679 -0
- package/src/core/recent-conversations.js +30 -0
- package/src/core/self-heal.js +522 -0
- package/src/core/socket-tap.js +154 -0
- package/src/core/sync-v2/assets.js +181 -0
- package/src/core/sync-v2/board.js +338 -0
- package/src/core/sync-v2/conv-state.js +152 -0
- package/src/core/sync-v2/gap-advice.js +110 -0
- package/src/core/sync-v2/gid.js +103 -0
- package/src/core/sync-v2/index.js +1208 -0
- package/src/core/sync-v2/keepalive.js +177 -0
- package/src/core/sync-v2/media.js +704 -0
- package/src/core/sync-v2/message-types.js +522 -0
- package/src/core/sync-v2/plan.js +95 -0
- package/src/core/sync-v2/reactions.js +236 -0
- package/src/core/sync-v2/renewlink.js +124 -0
- package/src/core/sync-v2/zcloud-cipher.js +88 -0
- package/src/core/sync-v2/zcloud.js +675 -0
- package/src/core/sync.js +540 -0
- package/src/core/zalo-client.js +179 -61
- package/src/core/zca-custom.js +78 -0
- package/src/index.js +14 -3
- package/src/mcp/mcp-config.js +40 -3
- package/src/mcp/mcp-http-transport.js +11 -2
- package/src/mcp/mcp-server.js +4 -2
- package/src/mcp/mcp-tools.js +837 -97
- package/src/mcp/message-buffer.js +38 -8
- package/src/mcp/message-buffer.test.js +67 -15
- package/src/mcp/notifier.js +17 -1
- package/src/mcp/notifier.test.js +6 -0
- package/src/utils/bank-helpers.js +8 -3
- package/src/utils/device-fingerprint.js +72 -0
- package/src/utils/mentions.js +140 -0
- package/src/utils/my-documents.js +95 -0
- package/src/utils/open-file.js +49 -0
- package/src/utils/output.js +75 -4
- package/src/utils/parse-options.js +56 -0
- package/src/utils/qr-http-server.js +44 -7
- package/src/utils/quote.js +203 -0
- package/src/utils/thread-type.js +72 -0
- package/src/utils/update-check.js +42 -1
- package/src/utils/urgency.js +29 -0
- package/src/mcp/media-downloader.js +0 -191
- package/src/mcp/media-downloader.test.js +0 -45
- package/src/utils/qr-display.test.js +0 -97
|
@@ -0,0 +1,1208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* transfer-sync-v2 — restore mobile message history into zalo.db.
|
|
3
|
+
*
|
|
4
|
+
* This is the real, phone-backed sync (as opposed to the empty cmd 510/511
|
|
5
|
+
* socket backfill). Flow, all over the one zca-js WebSocket:
|
|
6
|
+
*
|
|
7
|
+
* 1. cmd 590 CONVERSATION round (priority 0, partition "") — prompts the
|
|
8
|
+
* owner's phone once (transfer_status 3 -> 4 on tap). Decrypts to the full
|
|
9
|
+
* conversation list (opaque `convId`s + type).
|
|
10
|
+
* 2. cmd 590 MESSAGE round(s) (priority 2), sharded at <=30 partitions each
|
|
11
|
+
* (`oneone/<convId>` / `group/<convId>`). Sent right after the confirm, so
|
|
12
|
+
* they inherit it (status 5, no extra tap). Each upload_batch carries a
|
|
13
|
+
* signed msgUrl.
|
|
14
|
+
* 3. Fetch each msgUrl, strip the [u32 LE len] frame, decrypt via libzproto
|
|
15
|
+
* (metadata -> sessionRecord, then messages), Zstd-decompress, protobuf-
|
|
16
|
+
* decode, map the opaque convId to the real numeric threadId (+ name) via
|
|
17
|
+
* the friend/group lists, and write into zalo.db.
|
|
18
|
+
* 4. cmd 591 dispose every session (clears the phone's sync banner).
|
|
19
|
+
*
|
|
20
|
+
* See tests/HANDOFF.md / agent/work/transfer-sync-v2 for the protocol notes.
|
|
21
|
+
*/
|
|
22
|
+
import zlib from "node:zlib";
|
|
23
|
+
import crypto from "node:crypto";
|
|
24
|
+
import { resolve } from "node:path";
|
|
25
|
+
import {
|
|
26
|
+
initDb,
|
|
27
|
+
insertMessage,
|
|
28
|
+
upsertThread,
|
|
29
|
+
setSyncState,
|
|
30
|
+
runInTransaction,
|
|
31
|
+
getPendingSyncGaps,
|
|
32
|
+
resolveSyncGap,
|
|
33
|
+
replaceLiveGroupEventPlaceholder,
|
|
34
|
+
} from "../db.js";
|
|
35
|
+
import { ensureAssets, loadCodecs } from "./assets.js";
|
|
36
|
+
import { classifySyncMessage } from "./message-types.js";
|
|
37
|
+
import { resolveNonFriendDms } from "./gid.js";
|
|
38
|
+
import { startKeepAlive } from "./keepalive.js";
|
|
39
|
+
import { attachLiveStore } from "../live-store.js";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Lower bound of a "full history" sync: the beginning of time.
|
|
43
|
+
*
|
|
44
|
+
* This used to be pinned at 2024-01-01, which quietly made "full history" mean
|
|
45
|
+
* "the last couple of years" — an account with messages from 2018 never had
|
|
46
|
+
* them requested from the phone at all, with nothing in the output saying so.
|
|
47
|
+
* Zalo itself asks for 14/30 days and the bound is just the `from` field of the
|
|
48
|
+
* cmd 590 query, so there is no protocol reason to stop at any particular year.
|
|
49
|
+
*
|
|
50
|
+
* Use `--from` (see {@link resolveSyncWindow}) to raise it deliberately when a
|
|
51
|
+
* narrower window is actually wanted.
|
|
52
|
+
*/
|
|
53
|
+
export const FULL_HISTORY_FROM = 0;
|
|
54
|
+
|
|
55
|
+
/** Zalo launched in 2012; nothing can predate it. Used only to sanity-check `--from`. */
|
|
56
|
+
const EARLIEST_PLAUSIBLE = 1325376000000; // 2012-01-01
|
|
57
|
+
const MAX_TS = 9007199254740991;
|
|
58
|
+
/**
|
|
59
|
+
* Wait allowance per message shard. The phone serves shards sequentially,
|
|
60
|
+
* so the overall budget scales with how many were sent rather than being a
|
|
61
|
+
* flat number that is either too small for a full history or absurd for a
|
|
62
|
+
* one-shard run.
|
|
63
|
+
*/
|
|
64
|
+
const PER_SHARD_BUDGET_MS = 30000;
|
|
65
|
+
/**
|
|
66
|
+
* How many message sessions may be open on the phone at once. Zalo Web
|
|
67
|
+
* opens four; fifty at once got the socket dropped with no error frame.
|
|
68
|
+
*/
|
|
69
|
+
const DEFAULT_WAVE_SIZE = 4;
|
|
70
|
+
/**
|
|
71
|
+
* How many times a dropped socket may be reconnected inside one restore.
|
|
72
|
+
*
|
|
73
|
+
* One, deliberately. A reconnect is cheap for us and potentially expensive for
|
|
74
|
+
* the account owner -- if the server does not carry the phone's confirmation
|
|
75
|
+
* across it, the resumed request prompts their phone again -- so this retries
|
|
76
|
+
* once and then reports honestly rather than looping on a wire that keeps
|
|
77
|
+
* dying.
|
|
78
|
+
*/
|
|
79
|
+
const MAX_RESUMES = 1;
|
|
80
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Turn the `--days` option into the `from`/`to` bounds carried by every
|
|
84
|
+
* cmd 590 query — the conversation round as well as the message rounds, so a
|
|
85
|
+
* narrow window also means fewer conversations, fewer shards and a shorter run.
|
|
86
|
+
*
|
|
87
|
+
* A falsy `days` (the default) means full history. A window reaching further
|
|
88
|
+
* back than {@link FULL_HISTORY_FROM} is clamped to it, so `--days 9999` is
|
|
89
|
+
* exactly the default rather than a wider request never tested against the
|
|
90
|
+
* server.
|
|
91
|
+
*
|
|
92
|
+
* @param {number|null|undefined} days - how many days back to sync.
|
|
93
|
+
* @param {number} [now=Date.now()] - injectable for tests.
|
|
94
|
+
* @returns {{days: number|null, from: number, to: number, clamped: boolean, label: string}}
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Record that a restore settled the window it asked about.
|
|
98
|
+
*
|
|
99
|
+
* Two things made the freshness debounce -- the guard that stops a run from
|
|
100
|
+
* re-pinging the phone -- effectively disabled:
|
|
101
|
+
*
|
|
102
|
+
* - a CONFIRMED empty window (the phone answered: nothing in this range was
|
|
103
|
+
* missed) returned before the success markers were written, so it never
|
|
104
|
+
* counted. That is the common case over any window a listener was
|
|
105
|
+
* connected for: the phone hands a sync only what a web session missed.
|
|
106
|
+
* - checkSyncFreshness never skips while any gap is pending, and nothing
|
|
107
|
+
* resolved gaps (resolveSyncGap had only test callers), so after the first
|
|
108
|
+
* listener reconnect every later run pinged the phone forever.
|
|
109
|
+
*
|
|
110
|
+
* Only a gap lying wholly inside the window is resolved: a --days 1 run says
|
|
111
|
+
* nothing about a gap from last week. A partial run resolves none.
|
|
112
|
+
*
|
|
113
|
+
* @param {{from: number}} win - the window the restore asked for
|
|
114
|
+
* @param {{resolveGaps?: boolean, now?: number}} [opts]
|
|
115
|
+
* @returns {{resolvedGaps: number}}
|
|
116
|
+
*/
|
|
117
|
+
export function recordRestoreSuccess(win, opts = {}) {
|
|
118
|
+
const now = Number.isFinite(opts.now) ? opts.now : Date.now();
|
|
119
|
+
setSyncState("lastSyncOkAt", now);
|
|
120
|
+
setSyncState("lastSyncOkKind", "transfer");
|
|
121
|
+
// How far back this run actually covered, so a later, WIDER sync is not
|
|
122
|
+
// silently skipped by the freshness debounce.
|
|
123
|
+
setSyncState("lastSyncOkFrom", String(win.from));
|
|
124
|
+
let resolvedGaps = 0;
|
|
125
|
+
if (opts.resolveGaps) {
|
|
126
|
+
for (const g of getPendingSyncGaps()) {
|
|
127
|
+
if (Number(g.fromTs) >= Number(win.from) && Number(g.toTs) <= now) {
|
|
128
|
+
resolveSyncGap(g.id);
|
|
129
|
+
resolvedGaps++;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { resolvedGaps };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function resolveSyncWindow(days, now = Date.now(), fromTs = undefined) {
|
|
137
|
+
const since = (ts) => (ts > 0 ? new Date(ts).toISOString().slice(0, 10) : "the beginning");
|
|
138
|
+
|
|
139
|
+
// An explicit --from wins over --days: it is the more specific request.
|
|
140
|
+
if (fromTs !== undefined && fromTs !== null && fromTs !== "") {
|
|
141
|
+
const t = typeof fromTs === "number" ? fromTs : Date.parse(fromTs);
|
|
142
|
+
if (Number.isFinite(t) && t >= EARLIEST_PLAUSIBLE && t <= now) {
|
|
143
|
+
return { days: null, from: t, to: MAX_TS, clamped: false, label: `everything since ${since(t)}` };
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
days: null,
|
|
147
|
+
from: FULL_HISTORY_FROM,
|
|
148
|
+
to: MAX_TS,
|
|
149
|
+
clamped: true,
|
|
150
|
+
label: `full history (--from was not a usable date, so: everything)`,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const n = Number(days);
|
|
155
|
+
const full = { days: null, from: FULL_HISTORY_FROM, to: MAX_TS, clamped: false };
|
|
156
|
+
if (!Number.isFinite(n) || n <= 0) return { ...full, label: "full history (everything your phone still holds)" };
|
|
157
|
+
|
|
158
|
+
const wanted = now - n * DAY_MS;
|
|
159
|
+
if (wanted <= FULL_HISTORY_FROM) {
|
|
160
|
+
return { ...full, days: n, clamped: true, label: `the last ${n} days — which is all of it, so: full history` };
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
days: n,
|
|
164
|
+
from: wanted,
|
|
165
|
+
to: MAX_TS,
|
|
166
|
+
clamped: false,
|
|
167
|
+
label: `the last ${n} day${n === 1 ? "" : "s"} (since ${since(wanted)})`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const randId = (n = 32) =>
|
|
172
|
+
[...crypto.randomBytes(n)]
|
|
173
|
+
.map((b) => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[b % 62])
|
|
174
|
+
.join("");
|
|
175
|
+
const b64 = (u8) => Buffer.from(u8).toString("base64");
|
|
176
|
+
|
|
177
|
+
/** Split a downloaded batch blob into its length-prefixed payload chunks. */
|
|
178
|
+
export function splitChunks(buf) {
|
|
179
|
+
const out = [];
|
|
180
|
+
let o = 0;
|
|
181
|
+
while (o + 4 <= buf.length) {
|
|
182
|
+
const n = buf.readUInt32LE(o);
|
|
183
|
+
o += 4;
|
|
184
|
+
if (o + n > buf.length) break;
|
|
185
|
+
out.push(buf.subarray(o, o + n));
|
|
186
|
+
o += n;
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function decompress(p) {
|
|
192
|
+
try {
|
|
193
|
+
return zlib.zstdDecompressSync(p);
|
|
194
|
+
} catch {}
|
|
195
|
+
try {
|
|
196
|
+
return zlib.inflateSync(p);
|
|
197
|
+
} catch {}
|
|
198
|
+
try {
|
|
199
|
+
return zlib.gunzipSync(p);
|
|
200
|
+
} catch {}
|
|
201
|
+
return p;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Decode a Zalo WebSocket frame body (the `{encrypt, data}` envelope) using the
|
|
206
|
+
* per-session transport cipher key (the `key` field of the cmd 1/1 handshake
|
|
207
|
+
* frame). Mirrors zca-js's decodeEventData without importing its internals.
|
|
208
|
+
* encrypt: 0=plain JSON, 1=inflate-only, 2=AES-128-GCM+inflate, 3=GCM only.
|
|
209
|
+
*
|
|
210
|
+
* @param {{encrypt: number, data: string}} parsed
|
|
211
|
+
* @param {string} cipherKey - base64 AES key from the handshake.
|
|
212
|
+
*/
|
|
213
|
+
export function decodeFrame(parsed, cipherKey) {
|
|
214
|
+
if (parsed.encrypt === 0) return JSON.parse(parsed.data);
|
|
215
|
+
const raw = Buffer.from(parsed.encrypt === 1 ? parsed.data : decodeURIComponent(parsed.data), "base64");
|
|
216
|
+
let plain = raw;
|
|
217
|
+
if (parsed.encrypt !== 1) {
|
|
218
|
+
if (!cipherKey || raw.length < 48) throw new Error("missing cipher key or short frame");
|
|
219
|
+
const iv = raw.subarray(0, 16);
|
|
220
|
+
const aad = raw.subarray(16, 32);
|
|
221
|
+
const body = raw.subarray(32);
|
|
222
|
+
const ct = body.subarray(0, body.length - 16);
|
|
223
|
+
const tag = body.subarray(body.length - 16);
|
|
224
|
+
const key = Buffer.from(cipherKey, "base64");
|
|
225
|
+
const decipher = crypto.createDecipheriv(key.length === 16 ? "aes-128-gcm" : "aes-256-gcm", key, iv);
|
|
226
|
+
decipher.setAAD(aad);
|
|
227
|
+
decipher.setAuthTag(tag);
|
|
228
|
+
plain = Buffer.concat([decipher.update(ct), decipher.final()]);
|
|
229
|
+
}
|
|
230
|
+
// encrypt 1/2 wrap the payload with zlib OR gzip (pako auto-detects both);
|
|
231
|
+
// zlib.unzipSync handles either. encrypt 3 is uncompressed.
|
|
232
|
+
let out = plain;
|
|
233
|
+
if (parsed.encrypt !== 3) {
|
|
234
|
+
try {
|
|
235
|
+
out = zlib.unzipSync(plain);
|
|
236
|
+
} catch {
|
|
237
|
+
out = zlib.inflateRawSync(plain);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return JSON.parse(out.toString("utf8"));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Has a sync session delivered everything it was asked for?
|
|
245
|
+
*
|
|
246
|
+
* `isLast` looks like the end marker and mostly is, but a captured Zalo Web run
|
|
247
|
+
* ends its final message session with `isLast=0` and disposes it anyway. What
|
|
248
|
+
* actually completes a message session is coverage: every partition in the
|
|
249
|
+
* cmd 590 request has come back inside some batch's `scopes`. The conversation
|
|
250
|
+
* round asks for the empty partition and its batches carry no scopes, so there
|
|
251
|
+
* `isLast` is the only signal available.
|
|
252
|
+
*
|
|
253
|
+
* @param {{want: Set<string>, covered: Set<string>, sawLast: boolean}} state
|
|
254
|
+
* @returns {boolean}
|
|
255
|
+
*/
|
|
256
|
+
/**
|
|
257
|
+
* Resolve a wait budget, refusing to produce something that means "do not wait".
|
|
258
|
+
*
|
|
259
|
+
* This exists because of a real regression: a call site that forgot to pass the
|
|
260
|
+
* budget produced `Date.now() + undefined` = NaN, every comparison against NaN
|
|
261
|
+
* is false, and the wait loop exited on its first check -- so a sync round that
|
|
262
|
+
* should have waited three minutes for a phone confirmation returned instantly
|
|
263
|
+
* and reported "not confirmed in time".
|
|
264
|
+
*
|
|
265
|
+
* @param {number|undefined} budgetMs - the requested budget
|
|
266
|
+
* @param {number} fallbackMs - used when the request is missing or nonsensical
|
|
267
|
+
* @returns {number} a finite, positive number of milliseconds
|
|
268
|
+
*/
|
|
269
|
+
export function resolveWaitBudget(budgetMs, fallbackMs) {
|
|
270
|
+
if (Number.isFinite(budgetMs) && budgetMs > 0) return budgetMs;
|
|
271
|
+
if (Number.isFinite(fallbackMs) && fallbackMs > 0) return fallbackMs;
|
|
272
|
+
return 30000;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Which shards still have to go out, and whether a dropped socket is worth one
|
|
277
|
+
* more reconnect.
|
|
278
|
+
*
|
|
279
|
+
* Pulled out of the wave loop because this is the part that has to stay right
|
|
280
|
+
* across a disconnect: a shard the phone already served must never be asked for
|
|
281
|
+
* again (it would re-fetch, and in the worst case re-prompt), and a shard that
|
|
282
|
+
* was in flight when the wire died must go out again or its messages are simply
|
|
283
|
+
* lost. Mixing that bookkeeping in with the decrypt/decode/store body is how it
|
|
284
|
+
* gets broken quietly.
|
|
285
|
+
*
|
|
286
|
+
* @param {number} shardCount - how many message rounds the run needs
|
|
287
|
+
* @param {object} [opts]
|
|
288
|
+
* @param {number} [opts.waveSize=DEFAULT_WAVE_SIZE] sessions in flight at once
|
|
289
|
+
* @param {number} [opts.maxResumes=0] reconnects allowed; 0 disables resuming
|
|
290
|
+
* @returns {{remaining: () => number, resumes: () => number, done: () => boolean,
|
|
291
|
+
* pending: () => number[], nextWave: () => number[], settle: (i: number) => boolean,
|
|
292
|
+
* useResume: () => boolean}}
|
|
293
|
+
*/
|
|
294
|
+
export function createShardSchedule(shardCount, opts = {}) {
|
|
295
|
+
const waveSize = Math.max(1, opts.waveSize || DEFAULT_WAVE_SIZE);
|
|
296
|
+
let resumesLeft = Number.isFinite(opts.maxResumes) && opts.maxResumes > 0 ? opts.maxResumes : 0;
|
|
297
|
+
let resumes = 0;
|
|
298
|
+
const pending = [];
|
|
299
|
+
for (let i = 0; i < Math.max(0, shardCount); i++) pending.push(i);
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
remaining: () => pending.length,
|
|
303
|
+
resumes: () => resumes,
|
|
304
|
+
done: () => pending.length === 0,
|
|
305
|
+
pending: () => pending.slice(),
|
|
306
|
+
/** The shard indexes to send next -- never more than one wave at a time. */
|
|
307
|
+
nextWave: () => pending.slice(0, waveSize),
|
|
308
|
+
/**
|
|
309
|
+
* Mark a shard settled: served, or refused by the phone. Either way it
|
|
310
|
+
* is finished with, and a resume must not send it again.
|
|
311
|
+
*
|
|
312
|
+
* @param {number} idx - shard index
|
|
313
|
+
* @returns {boolean} true when it was still pending
|
|
314
|
+
*/
|
|
315
|
+
settle(idx) {
|
|
316
|
+
const at = pending.indexOf(idx);
|
|
317
|
+
if (at >= 0) pending.splice(at, 1);
|
|
318
|
+
return at >= 0;
|
|
319
|
+
},
|
|
320
|
+
/**
|
|
321
|
+
* Spend one reconnect allowance.
|
|
322
|
+
*
|
|
323
|
+
* @returns {boolean} true when a reconnect may be attempted
|
|
324
|
+
*/
|
|
325
|
+
useResume() {
|
|
326
|
+
if (resumesLeft <= 0) return false;
|
|
327
|
+
resumesLeft--;
|
|
328
|
+
resumes++;
|
|
329
|
+
return true;
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Turn the end state of a restore into a `reason` and, when it failed outright,
|
|
336
|
+
* the message to throw.
|
|
337
|
+
*
|
|
338
|
+
* These two failures need opposite advice and used to read identically:
|
|
339
|
+
*
|
|
340
|
+
* - **the socket died** -- nothing is wrong with the phone, and if it had
|
|
341
|
+
* already confirmed, that tap is spent; the user needs to know a re-run costs
|
|
342
|
+
* them another one.
|
|
343
|
+
* - **the phone never answered** -- the connection was fine the whole time, so
|
|
344
|
+
* the only thing to do differently is confirm the prompt.
|
|
345
|
+
*
|
|
346
|
+
* @param {object} st
|
|
347
|
+
* @param {boolean} st.socketDied - the wire dropped and could not be resumed
|
|
348
|
+
* @param {boolean} st.timedOut - the wait budget ran out with the socket up
|
|
349
|
+
* @param {boolean} st.confirmed - the phone answered (transfer_status >= 4)
|
|
350
|
+
* @param {number} st.messagesSaved
|
|
351
|
+
* @param {number} st.finished - shards served
|
|
352
|
+
* @param {number} st.total - shards requested
|
|
353
|
+
* @param {number} [st.resumes=0] - reconnects used
|
|
354
|
+
* @param {number} [st.waitMs] - the budget, for the timeout wording
|
|
355
|
+
* @returns {{reason: string, error: string|null}}
|
|
356
|
+
*/
|
|
357
|
+
export function describeRestoreOutcome(st) {
|
|
358
|
+
const resumes = st.resumes || 0;
|
|
359
|
+
const secs = Number.isFinite(st.waitMs) ? Math.round(st.waitMs / 1000) : null;
|
|
360
|
+
|
|
361
|
+
if (st.socketDied && !st.messagesSaved) {
|
|
362
|
+
return {
|
|
363
|
+
reason: "socket-lost",
|
|
364
|
+
error:
|
|
365
|
+
(resumes ? `the connection dropped again after ${resumes} reconnect(s)` : "the connection dropped") +
|
|
366
|
+
" before any messages arrived" +
|
|
367
|
+
(st.confirmed
|
|
368
|
+
? " — your phone had already confirmed, so re-running will prompt it again"
|
|
369
|
+
: " — your phone was never prompted, so nothing was spent"),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
if (st.timedOut && !st.messagesSaved) {
|
|
373
|
+
return {
|
|
374
|
+
reason: "timeout",
|
|
375
|
+
error: st.confirmed
|
|
376
|
+
? `your phone confirmed but served no messages within ${secs ?? "the"}${secs ? "s" : " budget"} — the connection stayed up the whole time`
|
|
377
|
+
: `your phone did not answer the sync prompt${secs ? ` within ${secs}s` : ""} — the connection stayed up, so nothing was lost; re-run and confirm it`,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
if (st.finished < st.total) return { reason: st.socketDied ? "socket-lost" : "partial", error: null };
|
|
381
|
+
return { reason: "complete", error: null };
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export function isSessionComplete(state) {
|
|
385
|
+
if (!state) return false;
|
|
386
|
+
if (state.sawLast) return true;
|
|
387
|
+
const want = state.want?.size ?? 0;
|
|
388
|
+
if (!want) return false; // conversation round: only isLast can end it
|
|
389
|
+
return (state.covered?.size ?? 0) >= want;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* The id a synced message should be stored under.
|
|
394
|
+
*
|
|
395
|
+
* `globalId` is the server id and the one every other path names a message by
|
|
396
|
+
* (a reaction's `gMsgID`, a removal's `globalDelMsgId`). It is absent on some
|
|
397
|
+
* messages, and jspb renders an absent uint64 as the string "0" — truthy — so
|
|
398
|
+
* a plain `globalId || clientId` stored them all under the literal id "0",
|
|
399
|
+
* where they overwrote one another through insertMessage's upsert.
|
|
400
|
+
*
|
|
401
|
+
* @param {object} msg - a decoded Sync2.Message.Message
|
|
402
|
+
* @returns {string}
|
|
403
|
+
*/
|
|
404
|
+
function syncMsgId(msg) {
|
|
405
|
+
const gid = msg?.globalId;
|
|
406
|
+
if (gid !== undefined && gid !== null && String(gid) !== "0" && String(gid) !== "") return String(gid);
|
|
407
|
+
return String(msg?.clientId ?? "");
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export class SyncV2 {
|
|
411
|
+
/**
|
|
412
|
+
* @param {object} api - a logged-in zca-js API (from getApi()).
|
|
413
|
+
* @param {string} accountName - ownId; picks the account data dir.
|
|
414
|
+
*/
|
|
415
|
+
constructor(api, accountName) {
|
|
416
|
+
this.api = api;
|
|
417
|
+
this.accountName = accountName;
|
|
418
|
+
this.accountDir = resolve(
|
|
419
|
+
process.env.USERPROFILE || process.env.HOME || "",
|
|
420
|
+
".zalo-agent-cli",
|
|
421
|
+
"accounts",
|
|
422
|
+
accountName,
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** Build opaque-globalId -> {id, name, type} from the friend + group lists. */
|
|
427
|
+
async _buildThreadMap(log) {
|
|
428
|
+
const map = new Map();
|
|
429
|
+
try {
|
|
430
|
+
const friends = await this.api.getAllFriends();
|
|
431
|
+
const arr = Array.isArray(friends) ? friends : friends?.data || [];
|
|
432
|
+
for (const f of arr)
|
|
433
|
+
if (f.globalId)
|
|
434
|
+
map.set(f.globalId, { id: String(f.userId), name: f.displayName || f.zaloName || "", type: "dm" });
|
|
435
|
+
} catch (e) {
|
|
436
|
+
log(`friend list unavailable (${e.message}); DM names/ids may be missing`);
|
|
437
|
+
}
|
|
438
|
+
try {
|
|
439
|
+
const groups = await this.api.getAllGroups();
|
|
440
|
+
const gridVer = groups?.gridVerMap || groups?.data?.gridVerMap || {};
|
|
441
|
+
const gids = Object.keys(gridVer);
|
|
442
|
+
for (let i = 0; i < gids.length; i += 50) {
|
|
443
|
+
const info = await this.api.getGroupInfo(gids.slice(i, i + 50)).catch(() => ({}));
|
|
444
|
+
const gi = info?.gridInfoMap || info?.data?.gridInfoMap || {};
|
|
445
|
+
for (const g of Object.values(gi))
|
|
446
|
+
if (g.globalId) map.set(g.globalId, { id: String(g.groupId), name: g.name || "", type: "group" });
|
|
447
|
+
}
|
|
448
|
+
} catch (e) {
|
|
449
|
+
log(`group list unavailable (${e.message}); group names/ids may be missing`);
|
|
450
|
+
}
|
|
451
|
+
return map;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
_send590(listener, kind, syncId, ek, ik, req) {
|
|
455
|
+
listener.sendWs(
|
|
456
|
+
{
|
|
457
|
+
version: 1,
|
|
458
|
+
cmd: 590,
|
|
459
|
+
subCmd: 0,
|
|
460
|
+
data: {
|
|
461
|
+
data: {
|
|
462
|
+
syncId,
|
|
463
|
+
syncType: 0,
|
|
464
|
+
ek: b64(ek.publicKey),
|
|
465
|
+
ik: b64(ik.publicKey),
|
|
466
|
+
toDevice: 0,
|
|
467
|
+
tempKey: "",
|
|
468
|
+
deviceName: "zalo-agent-cli",
|
|
469
|
+
req,
|
|
470
|
+
ver: 1,
|
|
471
|
+
ussidx: 0,
|
|
472
|
+
},
|
|
473
|
+
reqId: `req_${kind}_${syncId.slice(0, 6)}`,
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
false,
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
_dispose(listener, syncId) {
|
|
480
|
+
listener.sendWs(
|
|
481
|
+
{ version: 1, cmd: 591, subCmd: 0, data: { data: { syncId, toDevice: 0, reason: 1 }, reqId: "req_disp" } },
|
|
482
|
+
false,
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Run the full restore. Assumes the caller holds the account lock AND has
|
|
488
|
+
* already started the listener: this adds and removes its own socket taps,
|
|
489
|
+
* it never starts or stops the listener itself.
|
|
490
|
+
*
|
|
491
|
+
* @param {object} [opts]
|
|
492
|
+
* @param {number|null} [opts.days=null] only sync the last N days; falsy = full history.
|
|
493
|
+
* @param {string|number} [opts.from] explicit lower bound (date string or epoch ms); beats `days`.
|
|
494
|
+
* @param {number} [opts.shardSize=30] partitions per message round (server caps ~30).
|
|
495
|
+
* @param {number} [opts.waveSize=4] message sessions open at once (Zalo Web uses 4).
|
|
496
|
+
* @param {number} [opts.waitMs=120000] per-phase wait budget.
|
|
497
|
+
* @param {(s: {phase: string, detail?: string}) => void} [opts.onStatus]
|
|
498
|
+
* @param {boolean} [opts.liveStore=true] false when the caller already taps live traffic
|
|
499
|
+
* @param {number|false} [opts.keepAlive] heartbeat interval in ms, or false when the
|
|
500
|
+
* caller already pings this socket for the whole window it owns.
|
|
501
|
+
* @param {() => Promise<boolean>} [opts.reconnect] re-open the listener socket after a
|
|
502
|
+
* drop and resolve true once it is live. Supplied by the caller because this class
|
|
503
|
+
* never starts or stops the listener itself. Without it a dropped socket ends the run.
|
|
504
|
+
* @returns {Promise<{conversations:number, messagesSaved:number, threadsMapped:number, threadsUnmapped:number, reason:string, days:number|null, from:number, confirmed:boolean, resumes:number, rePrompted:boolean}>}
|
|
505
|
+
*/
|
|
506
|
+
async restore(opts = {}) {
|
|
507
|
+
const shardSize = Math.min(30, Math.max(1, opts.shardSize || 30));
|
|
508
|
+
const waveSize = Math.min(30, Math.max(1, opts.waveSize || DEFAULT_WAVE_SIZE));
|
|
509
|
+
const waitMs = Math.max(30000, opts.waitMs || 120000);
|
|
510
|
+
const onStatus = typeof opts.onStatus === "function" ? opts.onStatus : () => {};
|
|
511
|
+
const log = (m) => onStatus({ phase: "info", detail: m });
|
|
512
|
+
// The caller announces the window (it also decides the debounce on it);
|
|
513
|
+
// it comes back on the result too, so no status line is emitted here.
|
|
514
|
+
const win = resolveSyncWindow(opts.days, Date.now(), opts.from);
|
|
515
|
+
|
|
516
|
+
onStatus({ phase: "assets", detail: "loading decryption assets" });
|
|
517
|
+
const assets = await ensureAssets(resolve(this.accountDir, "sync", "zproto-cache"), log);
|
|
518
|
+
const { zproto, M, C } = await loadCodecs(assets);
|
|
519
|
+
|
|
520
|
+
onStatus({ phase: "contacts", detail: "reading friend/group lists for thread mapping" });
|
|
521
|
+
const threadMap = await this._buildThreadMap(log);
|
|
522
|
+
|
|
523
|
+
initDb(resolve(this.accountDir, "zalo.db"));
|
|
524
|
+
|
|
525
|
+
const L = this.api.listener;
|
|
526
|
+
const sessions = new Map(); // syncId -> {kind, batches:[], statuses:[], done, err}
|
|
527
|
+
const onMsg = async (buf) => {
|
|
528
|
+
if (!(buf instanceof Buffer) || buf.length < 4 || buf.readUInt16LE(1) !== 601) return;
|
|
529
|
+
let parsed;
|
|
530
|
+
try {
|
|
531
|
+
parsed = JSON.parse(buf.subarray(4).toString("utf8"));
|
|
532
|
+
} catch {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
let d;
|
|
536
|
+
try {
|
|
537
|
+
d =
|
|
538
|
+
typeof parsed.data === "string" && typeof parsed.encrypt === "number"
|
|
539
|
+
? decodeFrame(parsed, L.cipherKey)
|
|
540
|
+
: parsed;
|
|
541
|
+
} catch {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
for (const c of d?.data?.controls || []) {
|
|
545
|
+
if (c?.content?.act_type !== "transfer_sync2") continue;
|
|
546
|
+
let dj = c.content.data;
|
|
547
|
+
try {
|
|
548
|
+
dj = JSON.parse(dj);
|
|
549
|
+
} catch {}
|
|
550
|
+
const s = sessions.get(dj?.syncId);
|
|
551
|
+
if (!s) continue;
|
|
552
|
+
if (c.content.act === "transfer_status") {
|
|
553
|
+
s.statuses.push(dj.status);
|
|
554
|
+
if (dj.status === 3)
|
|
555
|
+
onStatus({
|
|
556
|
+
phase: "confirm",
|
|
557
|
+
detail: "Confirm the sync request on your phone (tap ĐỒNG BỘ NGAY)",
|
|
558
|
+
});
|
|
559
|
+
} else if (c.content.act === "upload_batch") {
|
|
560
|
+
s.batches.push(dj);
|
|
561
|
+
for (const sc of dj.scopes || []) if (sc?.partition) s.covered.add(sc.partition);
|
|
562
|
+
if (dj.isLast) s.sawLast = true;
|
|
563
|
+
s.done = isSessionComplete(s);
|
|
564
|
+
} else if (/error/i.test(c.content.act)) {
|
|
565
|
+
s.err = dj;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
// Zalo Web does not freeze while a sync runs: new messages keep arriving
|
|
571
|
+
// on the same socket and keep being stored. A full-history run holds this
|
|
572
|
+
// socket for many minutes, so without this everything that landed during
|
|
573
|
+
// it was dropped -- a hole precisely where the sync promises completeness.
|
|
574
|
+
// A caller holding the socket across several stages (`zalo-agent sync`)
|
|
575
|
+
// attaches one tap for its whole window and passes liveStore:false, so
|
|
576
|
+
// no live event is stored twice.
|
|
577
|
+
const detachLive =
|
|
578
|
+
opts.liveStore === false
|
|
579
|
+
? () => {}
|
|
580
|
+
: attachLiveStore(L, (what, detail) =>
|
|
581
|
+
onStatus({
|
|
582
|
+
phase: "live",
|
|
583
|
+
detail: `stored a live ${what}${detail?.threadId ? ` in ${detail.threadId}` : ""}`,
|
|
584
|
+
}),
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
// Why the socket went away matters: Zalo's 3000 means "another session
|
|
588
|
+
// took the account", anything else points elsewhere. Without this the
|
|
589
|
+
// only symptom is a silent stall, which is what made the first two
|
|
590
|
+
// runs so hard to diagnose.
|
|
591
|
+
let closeInfo = null;
|
|
592
|
+
// Declared before the close handler that reads it: the handler reports
|
|
593
|
+
// how long the heartbeat had gone unanswered when the wire died.
|
|
594
|
+
let keeper = null;
|
|
595
|
+
const onClose = (code, reason) => {
|
|
596
|
+
closeInfo = { code, reason: String(reason || "") };
|
|
597
|
+
// A 1006 carries no close frame, so the only thing that can say
|
|
598
|
+
// whether the wire had already gone quiet is our own heartbeat.
|
|
599
|
+
// Zalo echoes every cmd 2/1 straight back, so a ping count well
|
|
600
|
+
// ahead of the echo count is a half-open socket we noticed late --
|
|
601
|
+
// the one piece of evidence a bare 1006 otherwise never leaves.
|
|
602
|
+
const hb = keeper?.stats();
|
|
603
|
+
closeInfo.heartbeat = hb?.sent
|
|
604
|
+
? `${hb.echoed}/${hb.sent} echoed, last ${Math.round(hb.silentMs / 1000)}s ago`
|
|
605
|
+
: "";
|
|
606
|
+
onStatus({
|
|
607
|
+
phase: "warn",
|
|
608
|
+
detail:
|
|
609
|
+
`socket closed (code ${code}${closeInfo.reason ? ": " + closeInfo.reason : ""})` +
|
|
610
|
+
(closeInfo.heartbeat ? ` — heartbeat ${closeInfo.heartbeat}` : ""),
|
|
611
|
+
});
|
|
612
|
+
};
|
|
613
|
+
const onSockErr = (e) => {
|
|
614
|
+
closeInfo = closeInfo || { code: "error", reason: e?.message || String(e) };
|
|
615
|
+
onStatus({ phase: "warn", detail: `socket error: ${closeInfo.reason}` });
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
// Everything below is attached to the RAW socket, so all of it has to be
|
|
619
|
+
// re-attached after a reconnect -- `L.ws` is a different object then, and
|
|
620
|
+
// zca-js nulls the old one. (`attachLiveStore` taps the Listener, which
|
|
621
|
+
// outlives the socket, so it is deliberately not in here.)
|
|
622
|
+
const attachSocketTaps = () => {
|
|
623
|
+
try {
|
|
624
|
+
L.ws.on("message", onMsg);
|
|
625
|
+
L.ws.on("close", onClose);
|
|
626
|
+
L.ws.on("error", onSockErr);
|
|
627
|
+
} catch {
|
|
628
|
+
/* an older ws shape without these events is not fatal */
|
|
629
|
+
}
|
|
630
|
+
if (opts.keepAlive !== false) {
|
|
631
|
+
keeper = startKeepAlive(L, {
|
|
632
|
+
intervalMs: typeof opts.keepAlive === "number" ? opts.keepAlive : undefined,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
const detachSocketTaps = () => {
|
|
637
|
+
try {
|
|
638
|
+
keeper?.stop();
|
|
639
|
+
} catch {
|
|
640
|
+
/* already stopped */
|
|
641
|
+
}
|
|
642
|
+
keeper = null;
|
|
643
|
+
for (const [ev, fn] of [
|
|
644
|
+
["message", onMsg],
|
|
645
|
+
["close", onClose],
|
|
646
|
+
["error", onSockErr],
|
|
647
|
+
]) {
|
|
648
|
+
try {
|
|
649
|
+
L.ws?.removeListener?.(ev, fn);
|
|
650
|
+
} catch {
|
|
651
|
+
/* the socket may already be gone */
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
attachSocketTaps();
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* One reconnect attempt, then re-arm every raw-socket tap on the new
|
|
659
|
+
* wire. The caller owns starting the listener (this class never does),
|
|
660
|
+
* so it supplies `opts.reconnect`; without one a dropped socket stays
|
|
661
|
+
* dropped, exactly as before.
|
|
662
|
+
*
|
|
663
|
+
* @returns {Promise<boolean>} true when a live socket is back
|
|
664
|
+
*/
|
|
665
|
+
const reconnect = async () => {
|
|
666
|
+
if (typeof opts.reconnect !== "function") return false;
|
|
667
|
+
detachSocketTaps();
|
|
668
|
+
let ok = false;
|
|
669
|
+
try {
|
|
670
|
+
ok = Boolean(await opts.reconnect());
|
|
671
|
+
} catch (e) {
|
|
672
|
+
onStatus({ phase: "warn", detail: `reconnect failed: ${e?.message || e}` });
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
if (!ok || !L.ws || L.ws.readyState > 1) return false;
|
|
676
|
+
closeInfo = null;
|
|
677
|
+
attachSocketTaps();
|
|
678
|
+
return true;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
const newSession = (kind, wantPartitions = []) => {
|
|
682
|
+
const id = randId();
|
|
683
|
+
sessions.set(id, {
|
|
684
|
+
kind,
|
|
685
|
+
batches: [],
|
|
686
|
+
statuses: [],
|
|
687
|
+
done: false,
|
|
688
|
+
sawLast: false,
|
|
689
|
+
err: null,
|
|
690
|
+
disposed: false,
|
|
691
|
+
// Completion is measured by coverage: every partition asked for
|
|
692
|
+
// has to come back in some batch's `scopes`.
|
|
693
|
+
want: new Set(wantPartitions.filter(Boolean)),
|
|
694
|
+
covered: new Set(),
|
|
695
|
+
});
|
|
696
|
+
return id;
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Wait for one session to finish.
|
|
701
|
+
*
|
|
702
|
+
* `isLast` is NOT a reliable end marker -- a captured Zalo Web run ends
|
|
703
|
+
* its final message session with isLast=0 and disposes it anyway. What
|
|
704
|
+
* actually marks a message session complete is that every requested
|
|
705
|
+
* partition has appeared in a batch's `scopes`. The conversation round
|
|
706
|
+
* asks for the empty partition and carries no scopes, so it still falls
|
|
707
|
+
* back to isLast.
|
|
708
|
+
*
|
|
709
|
+
* Returns why it stopped, so the caller can tell "no data" from
|
|
710
|
+
* "the socket died" from "the phone never answered".
|
|
711
|
+
*/
|
|
712
|
+
const waitDone = async (id, budgetMs) => {
|
|
713
|
+
const dl = Date.now() + resolveWaitBudget(budgetMs, waitMs);
|
|
714
|
+
const s = sessions.get(id);
|
|
715
|
+
while (!s.done && !s.err && Date.now() < dl) {
|
|
716
|
+
// A closed socket can never deliver the rest, so stop now
|
|
717
|
+
// instead of burning the whole budget waiting on a dead wire.
|
|
718
|
+
// zca-js sets `this.ws = null` on close, so an absent socket is
|
|
719
|
+
// just as dead as one reporting CLOSING/CLOSED -- checking only
|
|
720
|
+
// readyState missed every real disconnect.
|
|
721
|
+
if (!L.ws || L.ws.readyState > 1) return "socket-closed";
|
|
722
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
723
|
+
}
|
|
724
|
+
if (s.err) return "error";
|
|
725
|
+
if (s.done) return "done";
|
|
726
|
+
return "timeout";
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
/** Dispose one session the moment it finishes, as Zalo Web does. */
|
|
730
|
+
const disposeOne = (id) => {
|
|
731
|
+
const s = sessions.get(id);
|
|
732
|
+
if (!s || s.disposed) return;
|
|
733
|
+
s.disposed = true;
|
|
734
|
+
try {
|
|
735
|
+
this._dispose(L, id);
|
|
736
|
+
} catch {
|
|
737
|
+
/* the socket may already be gone; nothing to release */
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
const ik = zproto.generateKeyPair();
|
|
742
|
+
let conversations = 0,
|
|
743
|
+
messagesSaved = 0,
|
|
744
|
+
attachmentsSaved = 0;
|
|
745
|
+
const mappedThreads = new Set(),
|
|
746
|
+
unmappedThreads = new Set();
|
|
747
|
+
/** type name -> count, for the command's summary line. */
|
|
748
|
+
const typeCounts = Object.create(null);
|
|
749
|
+
let reason = "complete";
|
|
750
|
+
// Did the phone actually answer? transfer_status 4 = Confirmed,
|
|
751
|
+
// 5 = Authorized. Needed to tell "empty window" from "never tapped".
|
|
752
|
+
let confirmed = false;
|
|
753
|
+
// Set by the message rounds; read by done(), which can run before them.
|
|
754
|
+
let resumeInfo = { resumes: 0, rePrompted: false };
|
|
755
|
+
const done = (r) =>
|
|
756
|
+
this._result(conversations, messagesSaved, mappedThreads, unmappedThreads, r, {
|
|
757
|
+
days: win.days,
|
|
758
|
+
from: win.from,
|
|
759
|
+
confirmed,
|
|
760
|
+
...resumeInfo,
|
|
761
|
+
attachmentsSaved,
|
|
762
|
+
typeCounts: { ...typeCounts },
|
|
763
|
+
// Every threadId the conversation round accounted for. Anything
|
|
764
|
+
// cached outside this list is orphaned.
|
|
765
|
+
liveThreadIds: [...mappedThreads, ...unmappedThreads],
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
// decrypt one session's batches -> decoded proto objects
|
|
769
|
+
const eachChunkObj = async (s, ek, protoClass, onObj) => {
|
|
770
|
+
let sessionRecord = null;
|
|
771
|
+
const ordered = s.batches
|
|
772
|
+
.slice()
|
|
773
|
+
.sort((a, b) => (a.batchType === 2 ? -1 : 1) - (b.batchType === 2 ? -1 : 1) || a.idx - b.idx);
|
|
774
|
+
for (const bt of ordered) {
|
|
775
|
+
if (!bt.msgUrl) continue;
|
|
776
|
+
await new Promise((r) => setImmediate(r));
|
|
777
|
+
let blob;
|
|
778
|
+
try {
|
|
779
|
+
const r = await fetch(bt.msgUrl);
|
|
780
|
+
if (!r.ok) continue;
|
|
781
|
+
blob = Buffer.from(await r.arrayBuffer());
|
|
782
|
+
} catch {
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
for (const chunk of splitChunks(blob)) {
|
|
786
|
+
// Hand the event loop back before each chunk. Decode and
|
|
787
|
+
// store are synchronous and a single shard can carry tens of
|
|
788
|
+
// thousands of messages; zca-js keeps the socket alive with
|
|
789
|
+
// a setInterval ping, and a blocked loop means a missed ping
|
|
790
|
+
// means Zalo drops the connection mid-run. This is the same
|
|
791
|
+
// problem Zalo Web avoids by decoding in a worker thread.
|
|
792
|
+
await new Promise((r) => setImmediate(r));
|
|
793
|
+
try {
|
|
794
|
+
let plain;
|
|
795
|
+
if (bt.batchType === 2) {
|
|
796
|
+
const m = zproto.decryptMetadata(chunk, ik.publicKey, ik.privateKey, ek.privateKey);
|
|
797
|
+
sessionRecord = m.sessionRecord;
|
|
798
|
+
plain = m.plaintext;
|
|
799
|
+
} else {
|
|
800
|
+
if (!sessionRecord) continue;
|
|
801
|
+
plain = zproto.decryptMessage(chunk, sessionRecord).plaintext;
|
|
802
|
+
}
|
|
803
|
+
let obj;
|
|
804
|
+
try {
|
|
805
|
+
obj = protoClass.deserializeBinary(decompress(plain)).toObject();
|
|
806
|
+
} catch {
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
onObj(obj);
|
|
810
|
+
} catch {
|
|
811
|
+
/* skip bad chunk */
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
try {
|
|
818
|
+
await new Promise((r) => setTimeout(r, 1200));
|
|
819
|
+
|
|
820
|
+
// ---- conversation round ----
|
|
821
|
+
// `ek` is fresh per session and `ik` is stable across them (see
|
|
822
|
+
// FINDINGS.md § cmd 590 request envelope), so a retried round needs
|
|
823
|
+
// its OWN ek -- and the decrypt then has to use that one.
|
|
824
|
+
let ekConv = zproto.generateKeyPair();
|
|
825
|
+
let convId = newSession("conv");
|
|
826
|
+
onStatus({ phase: "conversation", detail: "requesting your conversation list" });
|
|
827
|
+
this._send590(L, "conv", convId, ekConv, ik, {
|
|
828
|
+
type: "conversation",
|
|
829
|
+
priority: 0,
|
|
830
|
+
batchSize: 2000,
|
|
831
|
+
queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
|
|
832
|
+
});
|
|
833
|
+
let convWhy = await waitDone(convId, waitMs);
|
|
834
|
+
let convSession = sessions.get(convId);
|
|
835
|
+
confirmed = convSession.statuses.some((st) => Number(st) >= 4);
|
|
836
|
+
|
|
837
|
+
// A socket that dies here loses the conversation list outright --
|
|
838
|
+
// it only ever arrives on the socket that asked for it. Reconnect
|
|
839
|
+
// and ask again rather than ending the run: if the phone already
|
|
840
|
+
// confirmed, the server carries that authorization and the resent
|
|
841
|
+
// round goes straight through; if it had not, the prompt the user
|
|
842
|
+
// sees is the one a manual re-run would have shown them anyway.
|
|
843
|
+
if (convWhy === "socket-closed" && (await reconnect())) {
|
|
844
|
+
onStatus({
|
|
845
|
+
phase: "reconnect",
|
|
846
|
+
detail: confirmed
|
|
847
|
+
? "reconnected — asking for your conversation list again (your phone already confirmed)"
|
|
848
|
+
: "reconnected — asking for your conversation list again; your phone may prompt once more",
|
|
849
|
+
});
|
|
850
|
+
const retryId = newSession("conv");
|
|
851
|
+
ekConv = zproto.generateKeyPair();
|
|
852
|
+
this._send590(L, "conv", retryId, ekConv, ik, {
|
|
853
|
+
type: "conversation",
|
|
854
|
+
priority: 0,
|
|
855
|
+
batchSize: 2000,
|
|
856
|
+
queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
|
|
857
|
+
});
|
|
858
|
+
convWhy = await waitDone(retryId, waitMs);
|
|
859
|
+
convSession = sessions.get(retryId);
|
|
860
|
+
convId = retryId;
|
|
861
|
+
confirmed = confirmed || convSession.statuses.some((st) => Number(st) >= 4);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (convSession.err) throw new Error(`conversation round failed: ${JSON.stringify(convSession.err)}`);
|
|
865
|
+
if (convWhy === "socket-closed") {
|
|
866
|
+
throw new Error(
|
|
867
|
+
confirmed
|
|
868
|
+
? "the connection dropped after your phone confirmed, before the conversation list arrived"
|
|
869
|
+
: "the connection dropped while waiting for your phone to confirm — re-run and you will be prompted again",
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
if (convWhy === "timeout" && !confirmed) {
|
|
873
|
+
throw new Error(
|
|
874
|
+
`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`,
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const convs = [];
|
|
879
|
+
await eachChunkObj(convSession, ekConv, C.SyncChunk, (obj) => {
|
|
880
|
+
for (const c of obj.conversationsList || []) convs.push(c);
|
|
881
|
+
});
|
|
882
|
+
// Zalo Web releases the conversation session as soon as it has the
|
|
883
|
+
// list, before asking for any messages. Match that: it clears the
|
|
884
|
+
// phone's banner for that round instead of holding it open.
|
|
885
|
+
disposeOne(convId);
|
|
886
|
+
conversations = convs.length;
|
|
887
|
+
// The conversation round carries per-thread state the message
|
|
888
|
+
// rounds never repeat (whether you have replied, and the ids of the
|
|
889
|
+
// newest message). Keep it keyed by the opaque convId so the
|
|
890
|
+
// message loop can attach it once the real threadId is known.
|
|
891
|
+
const convMeta = new Map();
|
|
892
|
+
for (const c of convs) {
|
|
893
|
+
convMeta.set(c.convId, {
|
|
894
|
+
respondedByMe: c.respondedByMe,
|
|
895
|
+
lastGlobalId: c.lastGlobalId,
|
|
896
|
+
lastClientId: c.lastClientId,
|
|
897
|
+
lastTs: Number(c.lastTs) || 0,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
if (!conversations) {
|
|
901
|
+
// With --days an empty result is expected when nothing happened
|
|
902
|
+
// in the window, so separate that from a prompt that was never
|
|
903
|
+
// confirmed — the two need opposite advice from the caller.
|
|
904
|
+
reason = confirmed ? "empty-window" : "no-conversations";
|
|
905
|
+
// The phone answered and had nothing for this window: that IS
|
|
906
|
+
// the window settled. Only an unconfirmed prompt is a non-result.
|
|
907
|
+
if (confirmed) recordRestoreSuccess(win, { resolveGaps: true });
|
|
908
|
+
return done(reason);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// Tier 3: resolve 1-1 conversations not in the friend list (non-friends, OA) to
|
|
912
|
+
// real ids + names via /api/gid/decrypt — the same fallback Zalo Web uses. Left
|
|
913
|
+
// groups have no per-item endpoint, so they stay opaque (as in Zalo Web).
|
|
914
|
+
const unresolved = convs.filter((c) => c.convType !== 2 && !threadMap.has(c.convId)).map((c) => c.convId);
|
|
915
|
+
if (unresolved.length) {
|
|
916
|
+
onStatus({ phase: "resolve", detail: `resolving ${unresolved.length} non-friend conversation(s)` });
|
|
917
|
+
try {
|
|
918
|
+
const extra = await resolveNonFriendDms(this.api, unresolved, log);
|
|
919
|
+
for (const [gid, v] of extra) threadMap.set(gid, { id: v.id, name: v.name, type: "dm" });
|
|
920
|
+
onStatus({
|
|
921
|
+
phase: "resolve",
|
|
922
|
+
detail: `resolved ${extra.size}/${unresolved.length} via gid/decrypt`,
|
|
923
|
+
});
|
|
924
|
+
} catch (e) {
|
|
925
|
+
log(`tier-3 resolve failed (${e.message})`);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// `to` is per conversation, not a global bound. Zalo Web sends each
|
|
930
|
+
// partition its own conversation's `lastTs` -- a capture of one run
|
|
931
|
+
// shows 30 distinct `to` values across 30 partitions -- and asks for
|
|
932
|
+
// an unbounded `to` only on the conversation round, where it does
|
|
933
|
+
// not yet know what the latest message is. Sending MAX_SAFE_INTEGER
|
|
934
|
+
// per partition asks the phone to scan to the year 285428 for a
|
|
935
|
+
// conversation that has been quiet since 2024.
|
|
936
|
+
const askedTo = Math.min(win.to, Date.now());
|
|
937
|
+
const partitions = convs.map((c) => {
|
|
938
|
+
const lastTs = Number(c.lastTs) || 0;
|
|
939
|
+
return {
|
|
940
|
+
partition: (c.convType === 2 ? "group/" : "oneone/") + c.convId,
|
|
941
|
+
from: win.from,
|
|
942
|
+
// Never past what the caller asked for, and never past now.
|
|
943
|
+
to: lastTs > 0 ? Math.min(lastTs, askedTo) : askedTo,
|
|
944
|
+
limit: 2147483647,
|
|
945
|
+
};
|
|
946
|
+
});
|
|
947
|
+
const shards = [];
|
|
948
|
+
for (let i = 0; i < partitions.length; i += shardSize) shards.push(partitions.slice(i, i + shardSize));
|
|
949
|
+
onStatus({ phase: "messages", detail: `${conversations} conversations in ${shards.length} batch(es)` });
|
|
950
|
+
|
|
951
|
+
// ---- message rounds (sharded) ----
|
|
952
|
+
// Requests go out in waves. Zalo Web opens at most FOUR message
|
|
953
|
+
// sessions at once and the phone serves them one at a time; firing
|
|
954
|
+
// all fifty shards of a full-history run at once got the socket
|
|
955
|
+
// dropped with no error frame, so the in-flight count is capped.
|
|
956
|
+
// Within a wave the requests still go out together, which is what
|
|
957
|
+
// makes them inherit the single confirmation.
|
|
958
|
+
const sendWave = async (wave) => {
|
|
959
|
+
const meta = [];
|
|
960
|
+
for (const shard of wave) {
|
|
961
|
+
const ek = zproto.generateKeyPair();
|
|
962
|
+
const sid = newSession(
|
|
963
|
+
"msg",
|
|
964
|
+
shard.map((q) => q.partition),
|
|
965
|
+
);
|
|
966
|
+
meta.push({ sid, ek });
|
|
967
|
+
this._send590(L, "msg", sid, ek, ik, {
|
|
968
|
+
type: "message",
|
|
969
|
+
priority: 2,
|
|
970
|
+
batchSize: 2000,
|
|
971
|
+
queries: shard,
|
|
972
|
+
});
|
|
973
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
974
|
+
}
|
|
975
|
+
return meta;
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
// One budget for the whole run, not one per shard: a per-shard
|
|
979
|
+
// budget multiplies (50 shards x 10 min = eight hours of waiting on
|
|
980
|
+
// a phone that already went quiet). It scales with the shard count
|
|
981
|
+
// because the phone serves them one at a time -- a full-history run
|
|
982
|
+
// is 50 shards and genuinely needs longer than a one-shard run --
|
|
983
|
+
// and a dropped socket aborts immediately regardless, so a long
|
|
984
|
+
// budget costs nothing when something actually breaks.
|
|
985
|
+
const shardBudget = (n) => Math.max(waitMs, n * PER_SHARD_BUDGET_MS);
|
|
986
|
+
let runDeadline = Date.now() + shardBudget(shards.length);
|
|
987
|
+
onStatus({
|
|
988
|
+
phase: "messages",
|
|
989
|
+
detail: `waiting up to ${Math.round(shardBudget(shards.length) / 60000)} min for the phone to serve ${shards.length} batch(es)`,
|
|
990
|
+
});
|
|
991
|
+
let finished = 0;
|
|
992
|
+
let socketDied = false;
|
|
993
|
+
let timedOut = false;
|
|
994
|
+
let stop = false;
|
|
995
|
+
let rePrompted = false;
|
|
996
|
+
// A reconnect is only on the table when the caller handed us a way
|
|
997
|
+
// to reconnect -- this class never starts the listener itself.
|
|
998
|
+
const schedule = createShardSchedule(shards.length, {
|
|
999
|
+
waveSize,
|
|
1000
|
+
maxResumes: typeof opts.reconnect === "function" ? MAX_RESUMES : 0,
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
// ---- wave by wave: send, wait, decrypt, decode, store ----
|
|
1004
|
+
// Storing per shard rather than after all of them means an
|
|
1005
|
+
// interrupted run keeps what it already pulled.
|
|
1006
|
+
while (!schedule.done() && !stop) {
|
|
1007
|
+
const wave = schedule.nextWave();
|
|
1008
|
+
const waveMeta = await sendWave(wave.map((i) => shards[i]));
|
|
1009
|
+
let lostSocket = false;
|
|
1010
|
+
for (let k = 0; k < waveMeta.length; k++) {
|
|
1011
|
+
const m = waveMeta[k];
|
|
1012
|
+
const left = runDeadline - Date.now();
|
|
1013
|
+
const why = left > 0 ? await waitDone(m.sid, left) : "timeout";
|
|
1014
|
+
if (why === "socket-closed") {
|
|
1015
|
+
lostSocket = true;
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
if (why === "timeout") {
|
|
1019
|
+
stop = true;
|
|
1020
|
+
timedOut = true;
|
|
1021
|
+
onStatus({
|
|
1022
|
+
phase: "warn",
|
|
1023
|
+
detail: `timed out after ${finished}/${shards.length} batch(es) — keeping what arrived`,
|
|
1024
|
+
});
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
// Served or refused, this shard is settled: a resume must
|
|
1028
|
+
// not ask the phone for it again.
|
|
1029
|
+
schedule.settle(wave[k]);
|
|
1030
|
+
// A message session that was prompted (status 3) rather than
|
|
1031
|
+
// authorized outright (5) cost the user a second tap.
|
|
1032
|
+
if (schedule.resumes() && sessions.get(m.sid).statuses.some((st) => Number(st) === 3)) {
|
|
1033
|
+
rePrompted = true;
|
|
1034
|
+
}
|
|
1035
|
+
if (why === "error") {
|
|
1036
|
+
onStatus({ phase: "warn", detail: `batch failed: ${JSON.stringify(sessions.get(m.sid).err)}` });
|
|
1037
|
+
continue;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
const before = messagesSaved;
|
|
1041
|
+
await eachChunkObj(sessions.get(m.sid), m.ek, M.SyncChunk, (obj) => {
|
|
1042
|
+
// One transaction per decoded chunk rather than one per
|
|
1043
|
+
// row: thousands of individual WAL commits is both slow
|
|
1044
|
+
// and a long block on the event loop.
|
|
1045
|
+
runInTransaction(() => {
|
|
1046
|
+
for (const part of obj.partitionsList || []) {
|
|
1047
|
+
const gid = /^(?:oneone|group)\/(.+)$/.exec(part.id)?.[1];
|
|
1048
|
+
const hit = gid && threadMap.get(gid);
|
|
1049
|
+
const isGroup = part.id.startsWith("group/");
|
|
1050
|
+
const threadId = hit ? hit.id : part.id;
|
|
1051
|
+
(hit ? mappedThreads : unmappedThreads).add(threadId);
|
|
1052
|
+
const cm = (gid && convMeta.get(gid)) || {};
|
|
1053
|
+
for (const msg of part.messagesList || []) {
|
|
1054
|
+
// The payload's numeric msgType + meta decide the row;
|
|
1055
|
+
// `content` is always a string, so it cannot.
|
|
1056
|
+
const info = classifySyncMessage(msg);
|
|
1057
|
+
const threadType = hit ? hit.type : isGroup ? "group" : "dm";
|
|
1058
|
+
try {
|
|
1059
|
+
upsertThread({
|
|
1060
|
+
threadId,
|
|
1061
|
+
type: threadType,
|
|
1062
|
+
// The partition prefix is the phone's own
|
|
1063
|
+
// classification: authoritative when the
|
|
1064
|
+
// thread map agrees, so it can heal a 1-1 a
|
|
1065
|
+
// pin notice once turned into a "group".
|
|
1066
|
+
authoritative: threadType === (isGroup ? "group" : "dm"),
|
|
1067
|
+
name: hit ? hit.name : "",
|
|
1068
|
+
lastUpdate: Number(msg.timestamp) || 0,
|
|
1069
|
+
sync_timestamp: Date.now(),
|
|
1070
|
+
respondedByMe: cm.respondedByMe,
|
|
1071
|
+
lastGlobalId: cm.lastGlobalId,
|
|
1072
|
+
lastClientId: cm.lastClientId,
|
|
1073
|
+
});
|
|
1074
|
+
// The listener stored this system line under a
|
|
1075
|
+
// placeholder id (a group event carries no
|
|
1076
|
+
// message id); the phone's row replaces it.
|
|
1077
|
+
if (info.type === "group_event") {
|
|
1078
|
+
replaceLiveGroupEventPlaceholder(threadId, Number(msg.timestamp) || 0);
|
|
1079
|
+
}
|
|
1080
|
+
insertMessage({
|
|
1081
|
+
// jspb renders an unset uint64 as
|
|
1082
|
+
// the STRING "0", which is truthy,
|
|
1083
|
+
// so `globalId || clientId` kept it
|
|
1084
|
+
// and every message without a
|
|
1085
|
+
// global id collided on the primary
|
|
1086
|
+
// key "0", overwriting each other.
|
|
1087
|
+
// 0 means absent here, exactly as
|
|
1088
|
+
// it does in a removal's
|
|
1089
|
+
// globalDelMsgId and a reaction's
|
|
1090
|
+
// gMsgID.
|
|
1091
|
+
msgId: syncMsgId(msg),
|
|
1092
|
+
threadId,
|
|
1093
|
+
senderId: String(msg.senderId || ""),
|
|
1094
|
+
senderName: "",
|
|
1095
|
+
text: info.text,
|
|
1096
|
+
timestamp: Number(msg.timestamp) || 0,
|
|
1097
|
+
type: info.type,
|
|
1098
|
+
raw_data: info.raw,
|
|
1099
|
+
has_attachment: info.hasAttachment,
|
|
1100
|
+
// The phone is the only source of
|
|
1101
|
+
// delivery/read state, and this was
|
|
1102
|
+
// parsed and then dropped on the way
|
|
1103
|
+
// to the column: 87k rows carried a
|
|
1104
|
+
// real status inside raw_data while
|
|
1105
|
+
// the column stayed NULL on all of
|
|
1106
|
+
// them.
|
|
1107
|
+
msgStatus: info.raw?.msgStatus,
|
|
1108
|
+
});
|
|
1109
|
+
messagesSaved++;
|
|
1110
|
+
if (info.hasAttachment) attachmentsSaved++;
|
|
1111
|
+
typeCounts[info.type] = (typeCounts[info.type] || 0) + 1;
|
|
1112
|
+
} catch {
|
|
1113
|
+
/* dedupe/constraint — keep going */
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
finished++;
|
|
1121
|
+
// Per-shard progress: without it a 50-shard run prints nothing
|
|
1122
|
+
// between "50 batch(es)" and the final total, so a stall looks
|
|
1123
|
+
// exactly like work in progress.
|
|
1124
|
+
onStatus({
|
|
1125
|
+
phase: "progress",
|
|
1126
|
+
detail: `batch ${finished}/${shards.length} — ${messagesSaved - before} new message(s), ${messagesSaved} total`,
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
if (!lostSocket) continue;
|
|
1131
|
+
socketDied = true;
|
|
1132
|
+
onStatus({
|
|
1133
|
+
phase: "warn",
|
|
1134
|
+
detail:
|
|
1135
|
+
`connection lost after ${finished}/${shards.length} batch(es) — keeping what arrived` +
|
|
1136
|
+
(closeInfo
|
|
1137
|
+
? ` [close ${closeInfo.code}${closeInfo.reason ? ": " + closeInfo.reason : ""}]`
|
|
1138
|
+
: " [no close event seen]"),
|
|
1139
|
+
});
|
|
1140
|
+
// Re-tapping the phone is the expensive part of this command, so
|
|
1141
|
+
// a dropped wire is worth one reconnect before giving the tap
|
|
1142
|
+
// up. The shards already served stay served; only what is still
|
|
1143
|
+
// pending goes out again. Worst case the phone prompts once more
|
|
1144
|
+
// -- which is exactly what a manual re-run would have cost, and
|
|
1145
|
+
// that run would have had to re-fetch everything as well.
|
|
1146
|
+
if (schedule.useResume() && (await reconnect())) {
|
|
1147
|
+
socketDied = false;
|
|
1148
|
+
// The remaining shards still need their own time; the
|
|
1149
|
+
// reconnect must not eat the budget they were owed.
|
|
1150
|
+
runDeadline = Date.now() + shardBudget(schedule.remaining());
|
|
1151
|
+
onStatus({
|
|
1152
|
+
phase: "reconnect",
|
|
1153
|
+
detail: `reconnected — re-requesting the ${schedule.remaining()} batch(es) that never arrived (attempt ${schedule.resumes()} of ${MAX_RESUMES})`,
|
|
1154
|
+
});
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
stop = true;
|
|
1158
|
+
}
|
|
1159
|
+
if (rePrompted) {
|
|
1160
|
+
onStatus({
|
|
1161
|
+
phase: "warn",
|
|
1162
|
+
detail:
|
|
1163
|
+
"the resumed request needed a fresh confirmation — " +
|
|
1164
|
+
"the reconnect did not inherit the first one",
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
resumeInfo = { resumes: schedule.resumes(), rePrompted };
|
|
1168
|
+
const outcome = describeRestoreOutcome({
|
|
1169
|
+
socketDied,
|
|
1170
|
+
timedOut,
|
|
1171
|
+
confirmed,
|
|
1172
|
+
messagesSaved,
|
|
1173
|
+
finished,
|
|
1174
|
+
total: shards.length,
|
|
1175
|
+
resumes: schedule.resumes(),
|
|
1176
|
+
waitMs,
|
|
1177
|
+
});
|
|
1178
|
+
if (outcome.error) throw new Error(outcome.error);
|
|
1179
|
+
reason = outcome.reason;
|
|
1180
|
+
// A partial run still records success (unchanged), so the next run
|
|
1181
|
+
// within the hour is skipped unless --force -- but it settles no gap.
|
|
1182
|
+
recordRestoreSuccess(win, { resolveGaps: reason === "complete" });
|
|
1183
|
+
} finally {
|
|
1184
|
+
for (const id of sessions.keys()) {
|
|
1185
|
+
try {
|
|
1186
|
+
this._dispose(L, id);
|
|
1187
|
+
} catch {}
|
|
1188
|
+
}
|
|
1189
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
1190
|
+
detachSocketTaps();
|
|
1191
|
+
try {
|
|
1192
|
+
detachLive();
|
|
1193
|
+
} catch {}
|
|
1194
|
+
}
|
|
1195
|
+
return done(reason);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
_result(conversations, messagesSaved, mapped, unmapped, reason, extra = {}) {
|
|
1199
|
+
return {
|
|
1200
|
+
conversations,
|
|
1201
|
+
messagesSaved,
|
|
1202
|
+
threadsMapped: mapped.size,
|
|
1203
|
+
threadsUnmapped: unmapped.size,
|
|
1204
|
+
reason,
|
|
1205
|
+
...extra,
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
}
|