@ardennguyen/zalo-agent-cli 1.0.7 → 2.1.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/LICENSE +456 -21
- package/NOTICE +127 -0
- package/README.md +169 -70
- 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 +80 -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 +624 -68
- package/src/commands/login.js +179 -20
- package/src/commands/mcp.js +422 -44
- package/src/commands/msg.js +1288 -140
- 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/current-user-names.js +104 -0
- package/src/core/daemon-account.js +61 -0
- package/src/core/daemon-channel.js +638 -0
- package/src/core/daemon-sync.js +181 -0
- package/src/core/db.js +1625 -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 +106 -0
- package/src/core/sync-v2/index.js +1259 -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/senders.js +61 -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 +15 -3
- package/src/mcp/mcp-config.js +40 -3
- package/src/mcp/mcp-http-transport.js +12 -2
- package/src/mcp/mcp-server.js +5 -2
- package/src/mcp/mcp-tools.js +969 -99
- 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/mcp/sync-jobs.js +82 -0
- package/src/mcp/thread-name-cache.js +14 -1
- package/src/mcp/thread-name-cache.test.js +4 -1
- 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
package/src/commands/msg.js
CHANGED
|
@@ -1,12 +1,296 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Message commands — send text, images, files, cards, bank cards, QR transfers,
|
|
3
|
-
* stickers, reactions, delete, forward.
|
|
3
|
+
* stickers, reactions, delete, forward, pin.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { resolve, join } from "path";
|
|
8
|
+
import { InvalidArgumentError } from "commander";
|
|
9
|
+
import { getApi, getOwnId } from "../core/zalo-client.js";
|
|
10
|
+
import { withCurrentSenderNames } from "../core/current-user-names.js";
|
|
11
|
+
import { success, error, info, output, warning } from "../utils/output.js";
|
|
12
|
+
import { parseIntOption } from "../utils/parse-options.js";
|
|
13
|
+
import { getActive } from "../core/accounts.js";
|
|
14
|
+
import { CONFIG_DIR } from "../core/credentials.js";
|
|
15
|
+
import { initDb, getMessages, getMessageById, getDisplayName, getThreadType } from "../core/db.js";
|
|
16
|
+
import { sendViaDaemon, getDaemonChannel, getSyncChannel, syncViaDaemon } from "../core/daemon-channel.js";
|
|
17
|
+
import { fetchAndCacheHistory } from "../core/history-fetch.js";
|
|
18
|
+
import { classifyLiveMessage } from "../core/sync-v2/message-types.js";
|
|
19
|
+
import { downloadSyncedMedia } from "../core/sync-v2/media.js";
|
|
20
|
+
import { describeZaloError } from "../core/sync-v2/board.js";
|
|
21
|
+
import {
|
|
22
|
+
cachedCliMsgId,
|
|
23
|
+
cachedText,
|
|
24
|
+
resolveSenderUid,
|
|
25
|
+
cachedMessageById,
|
|
26
|
+
reactionCliMsgId,
|
|
27
|
+
recallCliMsgId,
|
|
28
|
+
} from "../core/cached-message.js";
|
|
29
|
+
import { buildForwardReference, sendForward, LOG_SRC_TYPE } from "../core/forward.js";
|
|
30
|
+
import { fetchMemberNames } from "../core/group-members.js";
|
|
31
|
+
import { pinMessage, unpinMessage, textPinParams } from "../core/pin.js";
|
|
32
|
+
import { expandMentions, parseMentionSpecs, shiftStyles, ALL_MENTION_UID } from "../utils/mentions.js";
|
|
33
|
+
import { applySelfThreadAlias } from "../utils/my-documents.js";
|
|
34
|
+
import { buildQuote, resolveQuoteSender } from "../utils/quote.js";
|
|
35
|
+
import { urgencyLevel } from "../utils/urgency.js";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Open the active account's SQLite cache.
|
|
39
|
+
*
|
|
40
|
+
* Best-effort on purpose: every caller here has a useful fallback for "no
|
|
41
|
+
* account, no cache file, or a db that will not open", so this reports that
|
|
42
|
+
* as false rather than failing the command.
|
|
43
|
+
*
|
|
44
|
+
* @returns {boolean} true when db.js is initialized and safe to query
|
|
45
|
+
*/
|
|
46
|
+
function openAccountDb() {
|
|
47
|
+
try {
|
|
48
|
+
const acc = getActive();
|
|
49
|
+
if (!acc) return false;
|
|
50
|
+
initDb(join(CONFIG_DIR, "accounts", acc.ownId, "zalo.db"));
|
|
51
|
+
return true;
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Display name for a `@[uid]` mention token, or null.
|
|
59
|
+
*
|
|
60
|
+
* Never throws. A name that cannot be looked up degrades to the uid, which
|
|
61
|
+
* still tags the right person — failing the whole send over a cache miss
|
|
62
|
+
* would be a far worse trade.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} uid
|
|
65
|
+
* @param {boolean} cacheOpen - whether openAccountDb() succeeded
|
|
66
|
+
* @returns {string|null}
|
|
67
|
+
*/
|
|
68
|
+
function mentionName(uid, cacheOpen) {
|
|
69
|
+
if (!cacheOpen) return null;
|
|
70
|
+
try {
|
|
71
|
+
return getDisplayName(uid);
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Ask Zalo for the names the local cache could not supply.
|
|
79
|
+
*
|
|
80
|
+
* The cache only knows someone who has already spoken — `senderName` comes
|
|
81
|
+
* off their messages — so a member who has never posted in the group would
|
|
82
|
+
* be tagged as a bare uid. `getGroupMembersInfo` takes the whole missing set
|
|
83
|
+
* in one call, and only runs when there is something missing, so the common
|
|
84
|
+
* case still costs no network at all.
|
|
85
|
+
*
|
|
86
|
+
* Nothing is written back. `msg send` writes nothing to zalo.db (Arden,
|
|
87
|
+
* 2026-09-30: "the msg send should not write anything, the data will come
|
|
88
|
+
* from live listener or sync"), so a member the cache cannot name costs this
|
|
89
|
+
* one lookup on every send until the listener or a sync learns their name.
|
|
90
|
+
*
|
|
91
|
+
* Never throws: no session, not a member of that group, or an API hiccup all
|
|
92
|
+
* leave the uid in place, which is still a valid mention. The lookup itself is
|
|
93
|
+
* shared with `zalo_get_group_members` (src/core/group-members.js).
|
|
94
|
+
*
|
|
95
|
+
* @param {string[]} uids - uids the cache had no name for
|
|
96
|
+
* @returns {Promise<Map<string, string>>} uid → display name, for those found
|
|
97
|
+
*/
|
|
98
|
+
async function fetchMentionNames(uids) {
|
|
99
|
+
if (uids.length === 0) return new Map();
|
|
100
|
+
try {
|
|
101
|
+
return (await fetchMemberNames(getApi(), uids)).names;
|
|
102
|
+
} catch {
|
|
103
|
+
return new Map(); // no session: fall back to the uid — see the doc comment
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* {@link cachedMessageById} for the active account, opening its cache first.
|
|
109
|
+
*
|
|
110
|
+
* The lookup is shared with the MCP tools (src/core/cached-message.js); only
|
|
111
|
+
* opening the db is the CLI's own. Null when there is no account or no cache.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} threadId
|
|
114
|
+
* @param {string} msgId
|
|
115
|
+
* @returns {{cliMsgId: string, uidFrom: string|null}|null}
|
|
116
|
+
*/
|
|
117
|
+
function cachedInAccount(threadId, msgId) {
|
|
118
|
+
return openAccountDb() ? cachedMessageById(threadId, msgId) : null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Whether a conversation is a group, for commands that can act on either.
|
|
123
|
+
*
|
|
124
|
+
* `-t` wins whenever something set it: the user, or the preAction hook that
|
|
125
|
+
* fills it in from the cache for a `threadId` argument. When it is still at
|
|
126
|
+
* its default -- e.g. `msg pin <msgId>`, where the conversation comes from the
|
|
127
|
+
* cached message rather than an argument -- the cache decides, and the
|
|
128
|
+
* default (0) applies only to a conversation the cache has never seen.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} threadId
|
|
131
|
+
* @param {object} opts - the command's options
|
|
132
|
+
* @param {import("commander").Command} cmd
|
|
133
|
+
* @returns {boolean}
|
|
134
|
+
*/
|
|
135
|
+
function threadIsGroup(threadId, opts, cmd) {
|
|
136
|
+
if (cmd?.getOptionValueSource?.("type") === "default") {
|
|
137
|
+
try {
|
|
138
|
+
const kind = openAccountDb() ? getThreadType(threadId) : null;
|
|
139
|
+
if (kind) return kind === "group";
|
|
140
|
+
} catch {
|
|
141
|
+
/* fall back to the flag */
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return Number(opts.type) === 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* This session's My Documents thread id (`loginInfo.send2me_id`), or null.
|
|
149
|
+
*
|
|
150
|
+
* @param {object} api
|
|
151
|
+
* @returns {string|null}
|
|
152
|
+
*/
|
|
153
|
+
function send2meIdOf(api) {
|
|
154
|
+
try {
|
|
155
|
+
const id = api.getContext().loginInfo?.send2me_id;
|
|
156
|
+
return id ? String(id) : null;
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* What a forward reference needs to know about its source message.
|
|
164
|
+
*
|
|
165
|
+
* @param {object} api - a logged-in zca-js API
|
|
166
|
+
* @param {object} row - the cached source message
|
|
167
|
+
* @returns {Promise<object>} the input for buildForwardReference, or `{error}`
|
|
168
|
+
*/
|
|
169
|
+
async function forwardSource(api, row) {
|
|
170
|
+
const cliMsgId = cachedCliMsgId(row);
|
|
171
|
+
if (!cliMsgId) {
|
|
172
|
+
return {
|
|
173
|
+
error:
|
|
174
|
+
"its cliMsgId was never cached, and the forward reference is derived from it " +
|
|
175
|
+
"(`listen` caches messages as they arrive, `sync` restores older ones)",
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const threadId = String(row.threadId || "");
|
|
179
|
+
const isMyDocuments = Boolean(threadId) && threadId === send2meIdOf(api);
|
|
180
|
+
let kind = null;
|
|
181
|
+
try {
|
|
182
|
+
kind = threadId ? getThreadType(threadId) : null;
|
|
183
|
+
} catch {
|
|
184
|
+
/* reported below */
|
|
185
|
+
}
|
|
186
|
+
if (!kind && !isMyDocuments) {
|
|
187
|
+
return {
|
|
188
|
+
error:
|
|
189
|
+
`the local cache does not say whether its conversation (${threadId || "unknown"}) is a group ` +
|
|
190
|
+
`or a 1-1, and the forward reference depends on it`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const sender = await resolveSenderUid(api, row.senderId, getOwnId());
|
|
194
|
+
if (sender.error) return { error: sender.error };
|
|
195
|
+
return {
|
|
196
|
+
cliMsgId,
|
|
197
|
+
senderUid: sender.uid,
|
|
198
|
+
threadId,
|
|
199
|
+
isGroup: kind === "group" && !isMyDocuments,
|
|
200
|
+
// The web's sendDttm: the server timestamp for any message it did not
|
|
201
|
+
// send itself. The cliMsgId is the fallback for a row that lost it.
|
|
202
|
+
ts: Number(row.timestamp) || Number(cliMsgId),
|
|
203
|
+
...(isMyDocuments && { logSrcType: LOG_SRC_TYPE.MY_CLOUD }),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Commander parser for `--urgency`: `important` → 1, `urgent` → 2. The
|
|
209
|
+
* mapping is src/utils/urgency.js, which `zalo_send_message` shares.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} value
|
|
212
|
+
* @returns {number}
|
|
213
|
+
* @throws {InvalidArgumentError} for anything else
|
|
214
|
+
*/
|
|
215
|
+
function parseUrgency(value) {
|
|
216
|
+
const level = urgencyLevel(value);
|
|
217
|
+
if (!level) throw new InvalidArgumentError("Expected one of: important, urgent.");
|
|
218
|
+
return level;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Report a refusal: the error line, and a non-zero exit.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} message
|
|
225
|
+
*/
|
|
226
|
+
function refuse(message) {
|
|
227
|
+
error(message);
|
|
228
|
+
process.exitCode = 1;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* A history row built with the classifier every other capture path uses.
|
|
233
|
+
*
|
|
234
|
+
* `msg history` is a third way into the cache, beside the listener and the
|
|
235
|
+
* mobile sync, and it used to carry its own mapping: the raw live msgType
|
|
236
|
+
* (chat.photo) as the row type -- the very spelling a one-off migration had to
|
|
237
|
+
* clean out -- and no has_attachment, so replaying a synced photo overwrote it
|
|
238
|
+
* to 0 and sync-media never fetched it again. It also won the merge below over
|
|
239
|
+
* the correctly classified cached row, so even the printed history showed the
|
|
240
|
+
* raw spelling.
|
|
241
|
+
*
|
|
242
|
+
* @param {object} data - a live-encoded message payload (msgType string + content)
|
|
243
|
+
* @param {string} threadId
|
|
244
|
+
* @returns {object} the row as printed; `raw_data` is dropped before output
|
|
245
|
+
*/
|
|
246
|
+
function historyRow(data, threadId) {
|
|
247
|
+
const info = classifyLiveMessage(data || {});
|
|
248
|
+
return {
|
|
249
|
+
msgId: data?.msgId,
|
|
250
|
+
threadId,
|
|
251
|
+
senderId: data?.uidFrom || null,
|
|
252
|
+
senderName: data?.dName || null,
|
|
253
|
+
text: info.text,
|
|
254
|
+
timestamp: data?.ts ? Number(data.ts) : null,
|
|
255
|
+
type: info.type,
|
|
256
|
+
has_attachment: info.hasAttachment ? 1 : 0,
|
|
257
|
+
raw_data: info.raw,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Why a running daemon did not hand back `msg history`'s fetch.
|
|
263
|
+
*
|
|
264
|
+
* Every case ends the command with nothing fetched or written in this process:
|
|
265
|
+
* the daemon holds the account's one web session and is its one db writer, so
|
|
266
|
+
* doing either beside it is exactly what the hand-off exists to prevent. The
|
|
267
|
+
* only way past a daemon is for it to be gone, which a re-run finds out.
|
|
268
|
+
*
|
|
269
|
+
* @param {{status?: number, error?: string, disconnected?: boolean, busyStage?: string,
|
|
270
|
+
* busySince?: number}} r - syncViaDaemon's refusal
|
|
271
|
+
* @param {number} pid - the daemon's
|
|
272
|
+
* @returns {string} the reason, to follow "History fetch failed: "
|
|
273
|
+
*/
|
|
274
|
+
function daemonHistoryFailure(r, pid) {
|
|
275
|
+
const who = `the listen/mcp daemon (pid ${pid})`;
|
|
276
|
+
if (r.status === 409) {
|
|
277
|
+
const since = r.busySince ? `, started ${Math.round((Date.now() - Number(r.busySince)) / 1000)}s ago` : "";
|
|
278
|
+
return (
|
|
279
|
+
`${who} is running a ${r.busyStage || "sync"} stage${since} — run this again when it finishes. ` +
|
|
280
|
+
"This command wrote nothing."
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (r.status === 404 || r.status === 503) {
|
|
284
|
+
return `${who} does not run the history fetch — restart it, then run this again.`;
|
|
285
|
+
}
|
|
286
|
+
if (r.disconnected) {
|
|
287
|
+
return (
|
|
288
|
+
`lost ${who} mid-fetch (${r.error}). This command wrote nothing. Run it again: a daemon that is ` +
|
|
289
|
+
"still up fetches it, and once the daemon has stopped this command fetches on its own."
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return `${who} could not fetch it: ${r.error || "no reason given"}. This command wrote nothing.`;
|
|
293
|
+
}
|
|
10
294
|
|
|
11
295
|
/**
|
|
12
296
|
* TextStyle codes matching zca-js TextStyle enum.
|
|
@@ -74,6 +358,174 @@ function parseMarkdownStyles(input) {
|
|
|
74
358
|
return { plain, styles };
|
|
75
359
|
}
|
|
76
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Extensions zca-js uploads through its inline-image path.
|
|
363
|
+
*
|
|
364
|
+
* uploadAttachment() routes on EXTENSION, not on which CLI command was used:
|
|
365
|
+
* these four resolve their upload promise synchronously, `gif` is split off
|
|
366
|
+
* by sendMessage() into its own inline path, and **everything else** —
|
|
367
|
+
* bmp, tiff, heic, avif, svg, mp4, pdf, … — takes the "others"/"video" path,
|
|
368
|
+
* which waits on a WebSocket upload-complete frame.
|
|
369
|
+
*
|
|
370
|
+
* Zalo does not restrict these formats (its `restricted_ext_file` denylist
|
|
371
|
+
* covers only executables: exe, cmd, bat, com, lnk, vbs, msi, …), so a user
|
|
372
|
+
* can legitimately hand `send-image` a .bmp. It simply arrives as a file
|
|
373
|
+
* attachment rather than an inline image.
|
|
374
|
+
*/
|
|
375
|
+
const INLINE_IMAGE_EXTS = new Set(["jpg", "jpeg", "png", "webp", "gif"]);
|
|
376
|
+
|
|
377
|
+
/** True when every path is a format Zalo renders inline. */
|
|
378
|
+
function allInlineImages(paths) {
|
|
379
|
+
return paths.every((p) => INLINE_IMAGE_EXTS.has(p.split(".").pop().toLowerCase()));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Pull the {msgId, cliMsgId} pairs out of an attachment send response.
|
|
384
|
+
*
|
|
385
|
+
* `msg send` reports `result.cliMsgId` off `result.message`, but an
|
|
386
|
+
* attachment send usually has no `result.message` at all: for a single
|
|
387
|
+
* jpg/jpeg/png/webp zca-js folds the caption into the attachment and leaves
|
|
388
|
+
* `message` null. The ids live in `result.attachment` instead -- an array,
|
|
389
|
+
* one entry per file.
|
|
390
|
+
*
|
|
391
|
+
* Until this existed an attachment's cliMsgId was unreachable from the CLI,
|
|
392
|
+
* so `msg undo` could not recall an image or a file at all unless a listener
|
|
393
|
+
* happened to be running and cached Zalo's echo of it. That is how tier 4
|
|
394
|
+
* ended up unable to clean up 24 attachments it had sent itself.
|
|
395
|
+
*
|
|
396
|
+
* @param {object} result - sendMessage() response
|
|
397
|
+
* @returns {Array<{msgId: string, cliMsgId: string|null}>}
|
|
398
|
+
*/
|
|
399
|
+
function sentAttachmentIds(result) {
|
|
400
|
+
const raw = result?.attachment;
|
|
401
|
+
const rows = Array.isArray(raw) ? raw : [raw];
|
|
402
|
+
return rows
|
|
403
|
+
.filter((r) => (r?.msgId ?? null) !== null)
|
|
404
|
+
.map((r) => ({
|
|
405
|
+
msgId: String(r.msgId),
|
|
406
|
+
cliMsgId: (r.cliMsgId ?? null) === null ? null : String(r.cliMsgId),
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Send attachments, bringing the WebSocket listener up first when any of
|
|
412
|
+
* them needs it.
|
|
413
|
+
*
|
|
414
|
+
* zca-js's uploadAttachment() resolves synchronously for inline images, but
|
|
415
|
+
* for "video" and "others" it registers an entry in ctx.uploadCallbacks and
|
|
416
|
+
* awaits a promise that ONLY apis/listen.js can settle, when the
|
|
417
|
+
* upload-complete control frame arrives. With no listener there is no
|
|
418
|
+
* timeout and no fallback — the await never settles and the command hangs
|
|
419
|
+
* with no output at all.
|
|
420
|
+
*
|
|
421
|
+
* Both `send-image` and `send-file` hit this, because the routing is by
|
|
422
|
+
* extension: `send-image photo.bmp` takes the same "others" path as
|
|
423
|
+
* `send-file doc.pdf`. So the listener decision is made from the actual
|
|
424
|
+
* paths, not from the command name.
|
|
425
|
+
*
|
|
426
|
+
* Opening that socket is only safe when nothing else holds one. A running
|
|
427
|
+
* `listen` or `mcp` daemon does, and Zalo answers a second session by killing
|
|
428
|
+
* the first, so this asks the daemon to do the upload when one is up and only
|
|
429
|
+
* opens its own session when none is. See src/core/daemon-channel.js.
|
|
430
|
+
*
|
|
431
|
+
* @param {object} api
|
|
432
|
+
* @param {string[]} absPaths
|
|
433
|
+
* @param {string} threadId
|
|
434
|
+
* @param {number} type
|
|
435
|
+
* @param {object} opts - {caption, uploadTimeout}
|
|
436
|
+
* @returns {Promise<{result?: object, error?: string, listenerStarted?: boolean, viaDaemon?: boolean}>}
|
|
437
|
+
*/
|
|
438
|
+
async function sendAttachments(api, absPaths, threadId, type, opts) {
|
|
439
|
+
const needsListener = !allInlineImages(absPaths);
|
|
440
|
+
let listenerStarted = false;
|
|
441
|
+
|
|
442
|
+
// A running `listen`/`mcp` daemon already holds the account's one permitted
|
|
443
|
+
// socket. Opening a second one here makes Zalo evict the daemon (cmd 3000),
|
|
444
|
+
// which loses every message that arrives during its ~6s reconnect -- a real
|
|
445
|
+
// message was lost this way, and the gap it recorded has no working repair
|
|
446
|
+
// path. So hand the upload to the daemon when there is one.
|
|
447
|
+
if (needsListener) {
|
|
448
|
+
const acc = getActive();
|
|
449
|
+
if (acc) {
|
|
450
|
+
const viaDaemon = await sendViaDaemon(join(CONFIG_DIR, "accounts", acc.ownId), {
|
|
451
|
+
paths: absPaths,
|
|
452
|
+
threadId,
|
|
453
|
+
type,
|
|
454
|
+
caption: opts.caption,
|
|
455
|
+
timeoutMs: Number(opts.uploadTimeout),
|
|
456
|
+
});
|
|
457
|
+
// null means no daemon answered; fall through and open our own.
|
|
458
|
+
if (viaDaemon) {
|
|
459
|
+
return viaDaemon.ok
|
|
460
|
+
? { result: viaDaemon.result, viaDaemon: true }
|
|
461
|
+
: { error: viaDaemon.error, viaDaemon: true };
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (needsListener) {
|
|
467
|
+
try {
|
|
468
|
+
await new Promise((res, rej) => {
|
|
469
|
+
const timer = setTimeout(() => rej(new Error("Listener connection timeout")), 15000);
|
|
470
|
+
api.listener.once("connected", () => {
|
|
471
|
+
clearTimeout(timer);
|
|
472
|
+
listenerStarted = true;
|
|
473
|
+
res();
|
|
474
|
+
});
|
|
475
|
+
api.listener.once("error", (err) => {
|
|
476
|
+
clearTimeout(timer);
|
|
477
|
+
rej(err);
|
|
478
|
+
});
|
|
479
|
+
api.listener.start({ retryOnClose: false });
|
|
480
|
+
});
|
|
481
|
+
} catch (e) {
|
|
482
|
+
return { error: `Could not open the upload channel: ${e.message}` };
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
try {
|
|
487
|
+
const result = await withTimeout(
|
|
488
|
+
api.sendMessage({ msg: opts.caption, attachments: absPaths }, threadId, type),
|
|
489
|
+
Number(opts.uploadTimeout),
|
|
490
|
+
"Upload timed out waiting for Zalo's upload-complete event",
|
|
491
|
+
);
|
|
492
|
+
return { result, listenerStarted };
|
|
493
|
+
} catch (e) {
|
|
494
|
+
return { error: e.message, listenerStarted };
|
|
495
|
+
} finally {
|
|
496
|
+
if (listenerStarted) {
|
|
497
|
+
try {
|
|
498
|
+
api.listener.stop();
|
|
499
|
+
} catch {
|
|
500
|
+
// Nothing useful to do — we're exiting anyway.
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Reject with `message` if `promise` hasn't settled within `ms`.
|
|
508
|
+
*
|
|
509
|
+
* Used by the attachment path: zca-js's non-inline upload waits on a
|
|
510
|
+
* WebSocket event with no timeout of its own, so a dropped or missed
|
|
511
|
+
* upload-complete frame would otherwise hang the command indefinitely.
|
|
512
|
+
* Better to fail loudly than to look frozen.
|
|
513
|
+
*
|
|
514
|
+
* @param {Promise} promise
|
|
515
|
+
* @param {number} ms
|
|
516
|
+
* @param {string} message
|
|
517
|
+
*/
|
|
518
|
+
function withTimeout(promise, ms, message) {
|
|
519
|
+
if (!Number.isFinite(ms) || ms <= 0) return promise;
|
|
520
|
+
let timer;
|
|
521
|
+
return Promise.race([
|
|
522
|
+
promise.finally(() => clearTimeout(timer)),
|
|
523
|
+
new Promise((_, reject) => {
|
|
524
|
+
timer = setTimeout(() => reject(new Error(message)), ms);
|
|
525
|
+
}),
|
|
526
|
+
]);
|
|
527
|
+
}
|
|
528
|
+
|
|
77
529
|
/**
|
|
78
530
|
* Parse manual style specs: "start:len:style" → { start, len, st }
|
|
79
531
|
* Style names: bold, italic, underline, strikethrough, red, orange, yellow, green, big, small
|
|
@@ -92,12 +544,32 @@ function parseStyleSpecs(specs) {
|
|
|
92
544
|
export function registerMsgCommands(program) {
|
|
93
545
|
const msg = program.command("msg").description("Send and manage messages");
|
|
94
546
|
|
|
547
|
+
// `me` (or the own uid) as a thread argument means My Documents, a 1-1
|
|
548
|
+
// thread of its own -- see src/utils/my-documents.js. Resolved once, here,
|
|
549
|
+
// for every msg subcommand that takes a threadId. Runs after the program's
|
|
550
|
+
// hook, so the session is already logged in.
|
|
551
|
+
msg.hook("preAction", (_msgCommand, actionCommand) => {
|
|
552
|
+
const out = applySelfThreadAlias(actionCommand, {
|
|
553
|
+
ownId: getOwnId(),
|
|
554
|
+
send2meId: () => getApi().getContext().loginInfo?.send2me_id,
|
|
555
|
+
});
|
|
556
|
+
if (out?.error) {
|
|
557
|
+
error(out.error);
|
|
558
|
+
process.exit(1);
|
|
559
|
+
}
|
|
560
|
+
if (out?.notice) info(out.notice);
|
|
561
|
+
});
|
|
562
|
+
|
|
95
563
|
msg.command("send <threadId> <message>")
|
|
96
|
-
.description("Send a text message with optional formatting")
|
|
564
|
+
.description("Send a text message with optional formatting. <threadId> may be `me` for My Documents")
|
|
97
565
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
98
566
|
.option(
|
|
99
567
|
"--mention <specs...>",
|
|
100
|
-
"Mention users
|
|
568
|
+
"Mention users by raw offset. Format: pos:userId:len (e.g. 0:USER_ID:5). Prefer writing @[userId] in the message — offsets are then computed for you. Use userId=-1 for @All.",
|
|
569
|
+
)
|
|
570
|
+
.option(
|
|
571
|
+
"--quote <msgId>",
|
|
572
|
+
"Send as a quote-reply to this message. Text messages only, and it must already be in the local cache. A running `listen`/`mcp` daemon is what puts messages there as they arrive; `msg history`/`sync` backfill older ones, but neither can seed a message you just sent.",
|
|
101
573
|
)
|
|
102
574
|
.option("--style <specs...>", "Text styles. Format: start:len:style (e.g. 0:5:bold 6:5:italic)")
|
|
103
575
|
.option("--md", "Parse markdown-like formatting: **bold** *italic* __underline__ ~~strike~~ {red:text}")
|
|
@@ -105,13 +577,17 @@ export function registerMsgCommands(program) {
|
|
|
105
577
|
"--react <icon>",
|
|
106
578
|
"Auto-react to sent message. Codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
|
|
107
579
|
)
|
|
580
|
+
.option(
|
|
581
|
+
"--urgency <level>",
|
|
582
|
+
"Mark the message the way the apps' Important/Urgent option does: important | urgent",
|
|
583
|
+
parseUrgency,
|
|
584
|
+
)
|
|
108
585
|
.action(async (threadId, message, opts) => {
|
|
109
586
|
try {
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
587
|
+
// One cache open serves both the @[uid] name lookups and the
|
|
588
|
+
// --quote rebuild. Absent cache is not fatal for either: names
|
|
589
|
+
// fall back to the uid, and --quote reports why it cannot.
|
|
590
|
+
const cached = openAccountDb();
|
|
115
591
|
|
|
116
592
|
// Parse text styles
|
|
117
593
|
let styles = [];
|
|
@@ -129,26 +605,139 @@ export function registerMsgCommands(program) {
|
|
|
129
605
|
styles = styles.concat(parseStyleSpecs(opts.style));
|
|
130
606
|
}
|
|
131
607
|
|
|
132
|
-
//
|
|
133
|
-
|
|
608
|
+
// Mentions expand last, on the post-markdown text: a `@[uid]`
|
|
609
|
+
// token contains no markdown metacharacters, whereas a display
|
|
610
|
+
// name may well contain `*` or `_` and would be eaten the other
|
|
611
|
+
// way round. Styles are then moved across the substitutions,
|
|
612
|
+
// since their offsets were counted before the names went in.
|
|
613
|
+
//
|
|
614
|
+
// Expanding is pure and cheap, so it runs twice: once off the
|
|
615
|
+
// cache to learn which uids it could not name, then again with
|
|
616
|
+
// whatever one batched lookup filled in.
|
|
617
|
+
const missing = new Set();
|
|
618
|
+
let expanded = expandMentions(finalMsg, (uid) => {
|
|
619
|
+
const name = mentionName(uid, cached);
|
|
620
|
+
if (!name && uid !== ALL_MENTION_UID) missing.add(uid);
|
|
621
|
+
return name;
|
|
622
|
+
});
|
|
623
|
+
if (missing.size > 0 && Number(opts.type) === 1) {
|
|
624
|
+
const fetched = await fetchMentionNames([...missing]);
|
|
625
|
+
if (fetched.size > 0) {
|
|
626
|
+
expanded = expandMentions(finalMsg, (uid) => fetched.get(uid) || mentionName(uid, cached));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
finalMsg = expanded.text;
|
|
631
|
+
styles = shiftStyles(styles, expanded.edits);
|
|
632
|
+
const mentions = [...parseMentionSpecs(opts.mention), ...expanded.mentions];
|
|
633
|
+
|
|
634
|
+
// zca-js drops mentions outside a group, so a `-t 0` send would
|
|
635
|
+
// quietly arrive with the names as plain text and nobody tagged.
|
|
636
|
+
if (mentions.length > 0 && Number(opts.type) !== 1) {
|
|
637
|
+
warning("Mentions only apply to group messages — pass -t 1 to tag anyone.");
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
let quote;
|
|
641
|
+
if (opts.quote) {
|
|
642
|
+
const built = buildQuote(cached ? getMessageById(opts.quote) : null, {
|
|
643
|
+
msgId: opts.quote,
|
|
644
|
+
threadId,
|
|
645
|
+
});
|
|
646
|
+
if (built.error) {
|
|
647
|
+
error(built.error);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (built.warning) warning(built.warning);
|
|
651
|
+
quote = built.quote;
|
|
652
|
+
// A sync-restored row's sender is a noised id that Zalo
|
|
653
|
+
// rejects outright (code 114), so resolve it rather than
|
|
654
|
+
// send something that cannot land.
|
|
655
|
+
if (built.opaqueSender) {
|
|
656
|
+
const fixed = await resolveQuoteSender(quote, getApi());
|
|
657
|
+
if (fixed.error) {
|
|
658
|
+
error(fixed.error);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if (fixed.resolved) info(`Resolved the quoted message's sender: ${fixed.resolved}`);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// Build message content. `urgency` is 1 (important) or 2
|
|
666
|
+
// (urgent); zca-js turns it into the `metaData: {urgency}`
|
|
667
|
+
// object Zalo Web sends, on every text endpoint.
|
|
668
|
+
const urgency = opts.urgency;
|
|
669
|
+
const hasExtras = mentions.length > 0 || styles.length > 0 || Boolean(quote) || Boolean(urgency);
|
|
134
670
|
const msgContent = hasExtras
|
|
135
|
-
? {
|
|
671
|
+
? {
|
|
672
|
+
msg: finalMsg,
|
|
673
|
+
...(mentions.length > 0 && { mentions }),
|
|
674
|
+
...(styles.length > 0 && { styles }),
|
|
675
|
+
...(quote && { quote }),
|
|
676
|
+
...(urgency && { urgency }),
|
|
677
|
+
}
|
|
136
678
|
: finalMsg;
|
|
137
679
|
|
|
138
|
-
const cliMsgId = String(Date.now());
|
|
139
680
|
const result = await getApi().sendMessage(msgContent, threadId, Number(opts.type));
|
|
140
|
-
|
|
681
|
+
|
|
682
|
+
// The cliMsgId comes back from zca-js, which hands over the
|
|
683
|
+
// clientId it actually put on the wire (patches/zca-js+2.2.0.patch
|
|
684
|
+
// — upstream stamps `params.clientId = Date.now()` inside
|
|
685
|
+
// handleMessage() and returns only {msgId}).
|
|
686
|
+
//
|
|
687
|
+
// This used to be a second `Date.now()` read here, taken before
|
|
688
|
+
// the call. That is a different number from the one zca-js sent,
|
|
689
|
+
// by however long the AES encrypt and the POST took — usually
|
|
690
|
+
// 0-2ms, never guaranteed equal. So every id `send --json`
|
|
691
|
+
// printed was a near-miss, and all three things that key on it
|
|
692
|
+
// (`msg react`, `msg undo`, and `--quote`, which rebuilds the
|
|
693
|
+
// payload from a cached row's cliMsgId) failed silently on it.
|
|
694
|
+
//
|
|
695
|
+
// Report only an id Zalo really holds. When there is none, say
|
|
696
|
+
// so — a fabricated one is worse than an absent one.
|
|
697
|
+
const cliMsgId = result.message?.cliMsgId ? String(result.message.cliMsgId) : null;
|
|
698
|
+
if (cliMsgId) result.cliMsgId = cliMsgId;
|
|
141
699
|
output(result, program.opts().json, () => success("Message sent"));
|
|
142
700
|
|
|
701
|
+
if (result.message && !cliMsgId) {
|
|
702
|
+
warning(
|
|
703
|
+
"Zalo returned no cliMsgId for this send, so none is reported — the zca-js patch " +
|
|
704
|
+
"is missing (run `npx patch-package`). `msg react`/`msg undo`/`msg send --quote` " +
|
|
705
|
+
"need one; the local cache gets the real value once `listen` or `sync` sees " +
|
|
706
|
+
"Zalo echo the message back.",
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
|
|
143
710
|
// Auto-react if --react flag provided
|
|
144
711
|
if (opts.react && result.message?.msgId) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
712
|
+
// addReaction needs the message's real cliMsgId — with the
|
|
713
|
+
// msgId in its place Zalo accepts the call and the
|
|
714
|
+
// reaction never shows up. It used to fall back to exactly
|
|
715
|
+
// that on an install whose zca-js patch had not applied;
|
|
716
|
+
// now the reaction is skipped and the way to add it later
|
|
717
|
+
// is named. The message itself has already gone out.
|
|
718
|
+
//
|
|
719
|
+
// Exit status stays 0: the send succeeded, and a caller
|
|
720
|
+
// that read a failure here would send the message twice.
|
|
721
|
+
const sentMsgId = String(result.message.msgId);
|
|
722
|
+
const target = reactionCliMsgId(
|
|
723
|
+
{ msgId: sentMsgId, threadId, cliMsgId },
|
|
724
|
+
{ lookup: cachedInAccount },
|
|
725
|
+
);
|
|
726
|
+
if (target.error) {
|
|
727
|
+
warning(
|
|
728
|
+
`--react skipped: Zalo returned no cliMsgId for this send, and a reaction keyed on ` +
|
|
729
|
+
`the msgId is accepted but never shown. Once \`listen\` has cached the message, ` +
|
|
730
|
+
`run: msg react ${sentMsgId} ${threadId} <icon> (or pass -c <cliMsgId>).`,
|
|
731
|
+
);
|
|
732
|
+
} else {
|
|
733
|
+
const dest = {
|
|
734
|
+
data: { msgId: sentMsgId, cliMsgId: target.cliMsgId },
|
|
735
|
+
threadId,
|
|
736
|
+
type: Number(opts.type),
|
|
737
|
+
};
|
|
738
|
+
await getApi().addReaction(opts.react, dest);
|
|
739
|
+
success(`Auto-reacted with '${opts.react}'`);
|
|
740
|
+
}
|
|
152
741
|
}
|
|
153
742
|
} catch (e) {
|
|
154
743
|
error(e.message);
|
|
@@ -156,39 +745,84 @@ export function registerMsgCommands(program) {
|
|
|
156
745
|
});
|
|
157
746
|
|
|
158
747
|
msg.command("send-image <threadId> <paths...>")
|
|
159
|
-
.description("Send one or more images")
|
|
748
|
+
.description("Send one or more images (jpg/jpeg/png/webp/gif render inline; other formats arrive as files)")
|
|
160
749
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
161
750
|
.option("-m, --caption <text>", "Caption text", "")
|
|
751
|
+
.option("--upload-timeout <ms>", "Max wait for the upload-complete event", "120000")
|
|
162
752
|
.action(async (threadId, paths, opts) => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
753
|
+
const absPaths = paths.map((p) => resolve(p));
|
|
754
|
+
|
|
755
|
+
// A format Zalo does not render inline (bmp, tiff, heic, …) is
|
|
756
|
+
// still uploaded — Zalo only denylists executables — but it
|
|
757
|
+
// arrives as a file attachment. Say so rather than letting the
|
|
758
|
+
// command name quietly mislead.
|
|
759
|
+
const offbeat = absPaths.filter((p) => !INLINE_IMAGE_EXTS.has(p.split(".").pop().toLowerCase()));
|
|
760
|
+
if (offbeat.length && !program.opts().json) {
|
|
761
|
+
warning(
|
|
762
|
+
`Not an inline image format: ${offbeat.map((p) => p.split(/[\\/]/).pop()).join(", ")} — ` +
|
|
763
|
+
`will arrive as a file attachment. Convert to PNG/JPEG for an inline image.`,
|
|
169
764
|
);
|
|
170
|
-
output(result, program.opts().json, () => success(`Image(s) sent to ${threadId}`));
|
|
171
|
-
} catch (e) {
|
|
172
|
-
error(e.message);
|
|
173
765
|
}
|
|
766
|
+
|
|
767
|
+
const {
|
|
768
|
+
result,
|
|
769
|
+
error: err,
|
|
770
|
+
listenerStarted,
|
|
771
|
+
viaDaemon,
|
|
772
|
+
} = await sendAttachments(getApi(), absPaths, threadId, Number(opts.type), opts);
|
|
773
|
+
if (err) error(err);
|
|
774
|
+
// Surface which socket carried this. sendAttachments() has always
|
|
775
|
+
// returned viaDaemon, and every caller dropped it on the floor —
|
|
776
|
+
// so the one branch whose entire reason for existing is that a
|
|
777
|
+
// second socket evicts the running daemon with cmd 3000 was
|
|
778
|
+
// invisible from the outside, and untestable.
|
|
779
|
+
else
|
|
780
|
+
output(
|
|
781
|
+
{ ...result, sent: sentAttachmentIds(result), viaDaemon: Boolean(viaDaemon) },
|
|
782
|
+
program.opts().json,
|
|
783
|
+
() => success(`Image(s) sent to ${threadId}${viaDaemon ? " (via the running daemon)" : ""}`),
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
// Only force-exit when the listener ran; it leaves handles behind
|
|
787
|
+
// that keep the event loop alive. The pure-inline path needs no
|
|
788
|
+
// such thing, so leave its exit behavior untouched.
|
|
789
|
+
if (listenerStarted) process.exit(err ? 1 : 0);
|
|
790
|
+
else if (err) process.exitCode = 1;
|
|
174
791
|
});
|
|
175
792
|
|
|
176
793
|
msg.command("send-file <threadId> <paths...>")
|
|
177
794
|
.description("Send files (docx, pdf, zip, etc.)")
|
|
178
795
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
179
796
|
.option("-m, --caption <text>", "Caption text", "")
|
|
797
|
+
.option("--upload-timeout <ms>", "Max wait for the upload-complete event", "120000")
|
|
180
798
|
.action(async (threadId, paths, opts) => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
799
|
+
// Shares sendAttachments() with `send-image`. It used to carry its
|
|
800
|
+
// own copy of the bring-the-listener-up dance, which meant the
|
|
801
|
+
// hand-off to a running daemon only ever applied to send-image --
|
|
802
|
+
// and send-file is the command that needs it most, since every
|
|
803
|
+
// non-inline attachment takes the socket path.
|
|
804
|
+
const absPaths = paths.map((p) => resolve(p));
|
|
805
|
+
const {
|
|
806
|
+
result,
|
|
807
|
+
error: err,
|
|
808
|
+
listenerStarted,
|
|
809
|
+
viaDaemon,
|
|
810
|
+
} = await sendAttachments(getApi(), absPaths, threadId, Number(opts.type), opts);
|
|
811
|
+
if (err) error(err);
|
|
812
|
+
else
|
|
813
|
+
output(
|
|
814
|
+
{ ...result, sent: sentAttachmentIds(result), viaDaemon: Boolean(viaDaemon) },
|
|
815
|
+
program.opts().json,
|
|
816
|
+
() => success(`File(s) sent to ${threadId}${viaDaemon ? " (via the running daemon)" : ""}`),
|
|
187
817
|
);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
818
|
+
|
|
819
|
+
// listener.stop() closes the socket but does not release every
|
|
820
|
+
// handle it registered, so the event loop stays alive and the
|
|
821
|
+
// command would sit there, done but not exited. `msg history`
|
|
822
|
+
// resolves the same problem the same way. Nothing to force when
|
|
823
|
+
// the daemon did the upload -- this process never opened a socket.
|
|
824
|
+
if (listenerStarted) process.exit(err ? 1 : 0);
|
|
825
|
+
else if (err) process.exitCode = 1;
|
|
192
826
|
});
|
|
193
827
|
|
|
194
828
|
msg.command("send-card <threadId> <userId>")
|
|
@@ -243,7 +877,7 @@ export function registerMsgCommands(program) {
|
|
|
243
877
|
msg.command("send-qr-transfer <threadId> <accountNumber>")
|
|
244
878
|
.description("Generate VietQR and send as image")
|
|
245
879
|
.requiredOption("-b, --bank <name>", "Bank name or BIN code")
|
|
246
|
-
.option("-a, --amount <n>", "Transfer amount in VND",
|
|
880
|
+
.option("-a, --amount <n>", "Transfer amount in VND", parseIntOption)
|
|
247
881
|
.option("-m, --content <text>", "Transfer content (max 50 chars)")
|
|
248
882
|
.option("--template <tpl>", "QR style: compact, print, qronly", "compact")
|
|
249
883
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
@@ -329,7 +963,7 @@ export function registerMsgCommands(program) {
|
|
|
329
963
|
msg.command("send-voice <threadId> <voiceUrl>")
|
|
330
964
|
.description("Send a voice message from URL")
|
|
331
965
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
332
|
-
.option("--ttl <ms>", "Time to live in milliseconds",
|
|
966
|
+
.option("--ttl <ms>", "Time to live in milliseconds", parseIntOption, 0)
|
|
333
967
|
.action(async (threadId, voiceUrl, opts) => {
|
|
334
968
|
try {
|
|
335
969
|
info(`Sending voice: ${voiceUrl}`);
|
|
@@ -359,9 +993,9 @@ export function registerMsgCommands(program) {
|
|
|
359
993
|
.requiredOption("--thumb <url>", "Thumbnail image URL")
|
|
360
994
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
361
995
|
.option("-m, --caption <text>", "Caption text", "")
|
|
362
|
-
.option("-d, --duration <ms>", "Video duration in milliseconds",
|
|
363
|
-
.option("-W, --width <px>", "Video width",
|
|
364
|
-
.option("-H, --height <px>", "Video height",
|
|
996
|
+
.option("-d, --duration <ms>", "Video duration in milliseconds", parseIntOption)
|
|
997
|
+
.option("-W, --width <px>", "Video width", parseIntOption, 1280)
|
|
998
|
+
.option("-H, --height <px>", "Video height", parseIntOption, 720)
|
|
365
999
|
.action(async (threadId, videoUrl, opts) => {
|
|
366
1000
|
try {
|
|
367
1001
|
info(`Sending video: ${videoUrl}`);
|
|
@@ -426,12 +1060,26 @@ export function registerMsgCommands(program) {
|
|
|
426
1060
|
"React to a message. Reaction codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
|
|
427
1061
|
)
|
|
428
1062
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
429
|
-
.option(
|
|
1063
|
+
.option(
|
|
1064
|
+
"-c, --cli-msg-id <id>",
|
|
1065
|
+
"Message's cliMsgId. Looked up in the local cache when omitted; the reaction is refused when neither has it",
|
|
1066
|
+
)
|
|
430
1067
|
.action(async (msgId, threadId, reaction, opts) => {
|
|
431
1068
|
try {
|
|
432
|
-
// zca-js addReaction(icon, dest) — dest needs msgId + cliMsgId
|
|
1069
|
+
// zca-js addReaction(icon, dest) — dest needs msgId + cliMsgId.
|
|
1070
|
+
// The cliMsgId used to fall back to the msgId, which Zalo
|
|
1071
|
+
// accepts and never displays. Resolved before getApi(), so an
|
|
1072
|
+
// uncached message is refused without touching the network.
|
|
1073
|
+
const target = reactionCliMsgId(
|
|
1074
|
+
{ msgId, threadId, cliMsgId: opts.cliMsgId },
|
|
1075
|
+
{ lookup: cachedInAccount },
|
|
1076
|
+
);
|
|
1077
|
+
if (target.error) {
|
|
1078
|
+
refuse(target.error);
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
433
1081
|
const dest = {
|
|
434
|
-
data: { msgId, cliMsgId:
|
|
1082
|
+
data: { msgId, cliMsgId: target.cliMsgId },
|
|
435
1083
|
threadId,
|
|
436
1084
|
type: Number(opts.type),
|
|
437
1085
|
};
|
|
@@ -443,12 +1091,59 @@ export function registerMsgCommands(program) {
|
|
|
443
1091
|
});
|
|
444
1092
|
|
|
445
1093
|
msg.command("delete <msgId> <threadId>")
|
|
446
|
-
.description("Delete a message
|
|
1094
|
+
.description("Delete a message from your own view only (use `msg undo` to recall it for everyone)")
|
|
447
1095
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
1096
|
+
.option("-c, --cli-msg-id <id>", "Message's cliMsgId. Looked up in the local cache when omitted")
|
|
1097
|
+
.option("--uid-from <id>", "Message sender's id (defaults to your own id)")
|
|
1098
|
+
.option(
|
|
1099
|
+
"--everyone",
|
|
1100
|
+
"Delete for everyone instead of just you. Only valid for SOMEONE ELSE'S message in a group — " +
|
|
1101
|
+
"Zalo rejects it for your own messages (use `msg undo`) and in private chats",
|
|
1102
|
+
)
|
|
448
1103
|
.action(async (msgId, threadId, opts) => {
|
|
449
1104
|
try {
|
|
450
|
-
const
|
|
451
|
-
|
|
1105
|
+
const type = Number(opts.type);
|
|
1106
|
+
|
|
1107
|
+
// zca-js takes deleteMessage(dest, onlyMe) where dest is
|
|
1108
|
+
// {data: {cliMsgId, msgId, uidFrom}, threadId, type} — NOT
|
|
1109
|
+
// (msgId, threadId, type), which is what this used to pass.
|
|
1110
|
+
// That shape put a bare string where `dest` belongs, so every
|
|
1111
|
+
// invocation died on "Cannot read properties of undefined
|
|
1112
|
+
// (reading 'uidFrom')" before reaching the network.
|
|
1113
|
+
//
|
|
1114
|
+
// cliMsgId is not derivable from msgId, exactly as for `undo`:
|
|
1115
|
+
// it is a client-generated id that only the sender ever saw.
|
|
1116
|
+
// Look in the local cache first, then insist the caller
|
|
1117
|
+
// supplies it rather than guessing.
|
|
1118
|
+
let cliMsgId = opts.cliMsgId;
|
|
1119
|
+
let uidFrom = opts.uidFrom;
|
|
1120
|
+
|
|
1121
|
+
if (!cliMsgId || !uidFrom) {
|
|
1122
|
+
const cached = cachedInAccount(threadId, msgId);
|
|
1123
|
+
cliMsgId = cliMsgId || cached?.cliMsgId;
|
|
1124
|
+
uidFrom = uidFrom || cached?.uidFrom;
|
|
1125
|
+
}
|
|
1126
|
+
uidFrom = uidFrom || getOwnId();
|
|
1127
|
+
|
|
1128
|
+
if (!cliMsgId) {
|
|
1129
|
+
error(
|
|
1130
|
+
"cliMsgId is required to delete a message and is not in the local cache. " +
|
|
1131
|
+
"Pass --cli-msg-id (from `listen --json`).",
|
|
1132
|
+
);
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const result = await getApi().deleteMessage(
|
|
1137
|
+
{
|
|
1138
|
+
data: { cliMsgId: String(cliMsgId), msgId: String(msgId), uidFrom: String(uidFrom) },
|
|
1139
|
+
threadId,
|
|
1140
|
+
type,
|
|
1141
|
+
},
|
|
1142
|
+
Boolean(opts.everyone) === false,
|
|
1143
|
+
);
|
|
1144
|
+
output(result, program.opts().json, () =>
|
|
1145
|
+
success(opts.everyone ? "Message deleted for everyone" : "Message deleted from your view"),
|
|
1146
|
+
);
|
|
452
1147
|
} catch (e) {
|
|
453
1148
|
error(e.message);
|
|
454
1149
|
}
|
|
@@ -457,14 +1152,33 @@ export function registerMsgCommands(program) {
|
|
|
457
1152
|
msg.command("undo <msgId> <threadId>")
|
|
458
1153
|
.description("Recall/undo a message for both sides (like Zalo app recall). Requires cliMsgId.")
|
|
459
1154
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
460
|
-
.option("-c, --cli-msg-id <id>", "
|
|
1155
|
+
.option("-c, --cli-msg-id <id>", "Message's cliMsgId. Looked up in the local cache when omitted")
|
|
461
1156
|
.action(async (msgId, threadId, opts) => {
|
|
462
1157
|
try {
|
|
463
|
-
|
|
464
|
-
|
|
1158
|
+
// Same lookup `msg delete` does. cliMsgId is client-generated
|
|
1159
|
+
// and not derivable from msgId, but anything `listen`, `mcp` or
|
|
1160
|
+
// a sync captured has it -- so asking the caller for it was
|
|
1161
|
+
// only ever necessary for a message this machine never saw.
|
|
1162
|
+
//
|
|
1163
|
+
// `send --json` is a valid source again. It used to print a
|
|
1164
|
+
// second Date.now() of its own -- zca-js stamps the real
|
|
1165
|
+
// clientId inside handleMessage() and upstream returns only
|
|
1166
|
+
// {msgId} -- so the id it gave matched only by luck. The zca-js
|
|
1167
|
+
// patch now hands that clientId back, and `msg send` reports
|
|
1168
|
+
// that value or none at all.
|
|
1169
|
+
//
|
|
1170
|
+
// The resolution is shared with `zalo_undo`
|
|
1171
|
+
// (src/core/cached-message.js). The refusal exits 0 here, as
|
|
1172
|
+
// it always has.
|
|
1173
|
+
const target = recallCliMsgId(
|
|
1174
|
+
{ msgId, threadId, cliMsgId: opts.cliMsgId },
|
|
1175
|
+
{ lookup: cachedInAccount },
|
|
1176
|
+
);
|
|
1177
|
+
if (target.error) {
|
|
1178
|
+
error(target.error);
|
|
465
1179
|
return;
|
|
466
1180
|
}
|
|
467
|
-
const payload = { msgId, cliMsgId:
|
|
1181
|
+
const payload = { msgId, cliMsgId: target.cliMsgId };
|
|
468
1182
|
const result = await getApi().undo(payload, threadId, Number(opts.type));
|
|
469
1183
|
output(result, program.opts().json, () => success("Message recalled (undone)"));
|
|
470
1184
|
} catch (e) {
|
|
@@ -473,129 +1187,563 @@ export function registerMsgCommands(program) {
|
|
|
473
1187
|
});
|
|
474
1188
|
|
|
475
1189
|
msg.command("forward <msgId> <threadId>")
|
|
476
|
-
.description(
|
|
1190
|
+
.description(
|
|
1191
|
+
"Forward a cached message to another conversation. Text goes out as a real forward, badged the way " +
|
|
1192
|
+
"the apps badge it; other kinds are re-sent as a message of their own type",
|
|
1193
|
+
)
|
|
477
1194
|
.option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
|
|
478
1195
|
.action(async (msgId, threadId, opts) => {
|
|
1196
|
+
// This command could never have worked. zca-js takes
|
|
1197
|
+
// `forwardMessage(payload, threadIds, type)` where payload is
|
|
1198
|
+
// `{ message: string }` and threadIds is an ARRAY; the old call
|
|
1199
|
+
// passed the msgId string as the payload and a bare string as the
|
|
1200
|
+
// thread list. `if (!payload.message) throw` fires on the first
|
|
1201
|
+
// line of the API, so every invocation died with "Missing message
|
|
1202
|
+
// content" before touching the network -- identically for -t 0 and
|
|
1203
|
+
// -t 1, for every message type. The zca-api-surface test did not
|
|
1204
|
+
// catch it because the method does exist; only its arity was wrong.
|
|
1205
|
+
const jsonMode = program.opts().json;
|
|
1206
|
+
const activeAcc = getActive();
|
|
1207
|
+
if (!activeAcc) {
|
|
1208
|
+
error("No active account. Please login first.");
|
|
1209
|
+
process.exit(1);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
let row;
|
|
479
1213
|
try {
|
|
480
|
-
|
|
481
|
-
|
|
1214
|
+
initDb(join(CONFIG_DIR, "accounts", activeAcc.ownId, "zalo.db"));
|
|
1215
|
+
row = getMessageById(msgId);
|
|
1216
|
+
} catch (e) {
|
|
1217
|
+
error(
|
|
1218
|
+
`Local cache unavailable (${e.message}). Run \`zalo-agent listen\` or \`zalo-agent sync\` first.`,
|
|
1219
|
+
);
|
|
1220
|
+
process.exit(1);
|
|
1221
|
+
}
|
|
1222
|
+
if (!row) {
|
|
1223
|
+
error(`Message ${msgId} is not in the local cache.`);
|
|
1224
|
+
info("Fetch the conversation first: zalo-agent msg history <threadId> -t <0|1>");
|
|
1225
|
+
process.exit(1);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// "Forward" is not one operation in Zalo. Only TEXT rides the
|
|
1229
|
+
// mforward API and gets the "forwarded" badge. Everything else the
|
|
1230
|
+
// app re-sends as a fresh message of its own kind -- measured
|
|
1231
|
+
// 2026-09-28 by forwarding a contact card by hand: the copy that
|
|
1232
|
+
// arrived carried no `reference` and no `fwLvl` at all, where a
|
|
1233
|
+
// forwarded text carries both. So dispatch on the row's classified
|
|
1234
|
+
// type and reproduce what the app does.
|
|
1235
|
+
//
|
|
1236
|
+
// Guard on `type`, never on `typeof text === "string"`: a synced
|
|
1237
|
+
// photo/file/sticker stores a human placeholder ("[Hình ảnh]",
|
|
1238
|
+
// "[File] x.pdf") in the text column, and a type-of check would
|
|
1239
|
+
// forward that placeholder and call it a forwarded photo.
|
|
1240
|
+
const api = getApi();
|
|
1241
|
+
const threadType = Number(opts.type);
|
|
1242
|
+
let raw = {};
|
|
1243
|
+
try {
|
|
1244
|
+
raw = JSON.parse(row.raw_data || "{}");
|
|
1245
|
+
} catch {
|
|
1246
|
+
/* a row with unreadable raw_data can still forward as text */
|
|
1247
|
+
}
|
|
1248
|
+
const c = raw.content && typeof raw.content === "object" ? raw.content : null;
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Re-send a downloaded file as its own attachment.
|
|
1252
|
+
*
|
|
1253
|
+
* Goes through sendAttachments, not api.sendMessage: a non-inline
|
|
1254
|
+
* upload needs a socket to settle its upload-complete frame, and a
|
|
1255
|
+
* running daemon holds the account's only one. Calling sendMessage
|
|
1256
|
+
* directly parks the send in ctx.uploadCallbacks with nothing left
|
|
1257
|
+
* to settle it -- measured, a file forward simply hung for four
|
|
1258
|
+
* minutes and returned nothing at all. sendAttachments hands the
|
|
1259
|
+
* upload to the daemon and falls back to its own socket when none
|
|
1260
|
+
* is running.
|
|
1261
|
+
*/
|
|
1262
|
+
const resendLocal = async () => {
|
|
1263
|
+
if (!row.localPath || !existsSync(row.localPath)) {
|
|
1264
|
+
error(`Message ${msgId} is "${row.type}" but its media is not downloaded locally.`);
|
|
1265
|
+
info("Fetch it first: zalo-agent sync-media -T <threadId>");
|
|
1266
|
+
process.exit(1);
|
|
1267
|
+
}
|
|
1268
|
+
const out = await sendAttachments(api, [resolve(row.localPath)], threadId, threadType, {
|
|
1269
|
+
caption: "",
|
|
1270
|
+
uploadTimeout: 120000,
|
|
1271
|
+
});
|
|
1272
|
+
if (out.error) throw new Error(out.error);
|
|
1273
|
+
return out.result;
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
const forwarders = {
|
|
1277
|
+
// action "recommened.user" carries the shared person's uid in
|
|
1278
|
+
// `params`; sendCard reproduces the card exactly as the app does.
|
|
1279
|
+
card: async () => api.sendCard({ userId: String(c?.params ?? "").trim() }, threadId, threadType),
|
|
1280
|
+
sticker: async () =>
|
|
1281
|
+
api.sendSticker({ id: c?.id, cateId: c?.catId, type: c?.type ?? 3 }, threadId, threadType),
|
|
1282
|
+
link: async () => api.sendLink({ link: c?.href }, threadId, threadType),
|
|
1283
|
+
// sendVideo wants the geometry too; Zalo rejects the call with
|
|
1284
|
+
// code 114 when duration/width/height are missing. They live in
|
|
1285
|
+
// the payload's `params` blob, not as top-level fields.
|
|
1286
|
+
video: async () => {
|
|
1287
|
+
let p = {};
|
|
1288
|
+
try {
|
|
1289
|
+
p = typeof c?.params === "string" ? JSON.parse(c.params) : (c?.params ?? {});
|
|
1290
|
+
} catch {
|
|
1291
|
+
/* geometry falls back to the defaults below */
|
|
1292
|
+
}
|
|
1293
|
+
return api.sendVideo(
|
|
1294
|
+
{
|
|
1295
|
+
videoUrl: c?.href,
|
|
1296
|
+
thumbnailUrl: c?.thumb || "",
|
|
1297
|
+
duration: Number(p.duration) || 0,
|
|
1298
|
+
width: Number(p.video_width || p.video_original_width) || 1280,
|
|
1299
|
+
height: Number(p.video_height || p.video_original_height) || 720,
|
|
1300
|
+
},
|
|
1301
|
+
threadId,
|
|
1302
|
+
threadType,
|
|
1303
|
+
);
|
|
1304
|
+
},
|
|
1305
|
+
voice: async () => api.sendVoice({ voiceUrl: c?.href }, threadId, threadType),
|
|
1306
|
+
photo: resendLocal,
|
|
1307
|
+
file: resendLocal,
|
|
1308
|
+
gif: resendLocal,
|
|
1309
|
+
doodle: resendLocal,
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
// A shared contact arrives as a link whose action says otherwise.
|
|
1313
|
+
const kind = c?.action === "recommened.user" ? "card" : row.type;
|
|
1314
|
+
|
|
1315
|
+
if (kind !== "text") {
|
|
1316
|
+
const send = forwarders[kind];
|
|
1317
|
+
if (!send) {
|
|
1318
|
+
error(`Cannot forward a "${row.type}" message — no send path reproduces it.`);
|
|
1319
|
+
info("Text uses the forward API; other kinds are re-sent as a new message of their own type.");
|
|
1320
|
+
process.exit(1);
|
|
1321
|
+
}
|
|
1322
|
+
try {
|
|
1323
|
+
const res = await send();
|
|
1324
|
+
output(res, jsonMode, () => success(`Forwarded ${kind} to ${threadId}`));
|
|
1325
|
+
} catch (e) {
|
|
1326
|
+
error(`Forward failed (${kind}): ${e.message}`);
|
|
1327
|
+
process.exit(1);
|
|
1328
|
+
}
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
const text = cachedText(row);
|
|
1332
|
+
if (!text) {
|
|
1333
|
+
error(`Message ${msgId} has no text to forward.`);
|
|
1334
|
+
process.exit(1);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
// A forward is the text plus a `reference` naming the source
|
|
1338
|
+
// message. Without it the copy arrives as plain text with no
|
|
1339
|
+
// "forwarded" badge, which is all this command used to send. The
|
|
1340
|
+
// reference id is md5(cliMsgId + senderUid + conversationKey),
|
|
1341
|
+
// derived the way Zalo Web derives it -- src/core/forward.js has
|
|
1342
|
+
// the derivation and the capture it reproduces. Refuse rather than
|
|
1343
|
+
// send a reference built from a guess.
|
|
1344
|
+
const source = await forwardSource(api, row);
|
|
1345
|
+
if (source.error) {
|
|
1346
|
+
error(`Cannot forward message ${msgId}: ${source.error}.`);
|
|
1347
|
+
info("To send the words without the forward, use: zalo-agent msg send <threadId> <text>");
|
|
1348
|
+
process.exit(1);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
try {
|
|
1352
|
+
const { reference, decorLog } = buildForwardReference(source);
|
|
1353
|
+
const result = await sendForward(
|
|
1354
|
+
api,
|
|
1355
|
+
{ message: text, reference, decorLog },
|
|
1356
|
+
[threadId],
|
|
1357
|
+
Number(opts.type),
|
|
1358
|
+
);
|
|
1359
|
+
|
|
1360
|
+
// Zalo answers {success: [...], failed: [...]}. This read
|
|
1361
|
+
// `result.fail`, which is never a key on that response, so
|
|
1362
|
+
// the count was always 0 and a rejected target was reported
|
|
1363
|
+
// as a success. Accept both spellings rather than betting on
|
|
1364
|
+
// one.
|
|
1365
|
+
const rejected = result?.failed ?? result?.fail ?? [];
|
|
1366
|
+
if (rejected.length > 0) {
|
|
1367
|
+
error(`Forward rejected for ${rejected.length} target(s): ${JSON.stringify(rejected)}`);
|
|
1368
|
+
process.exit(1);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// Pair each target's msgId with the cliMsgId, the same
|
|
1372
|
+
// `sent` shape send-image and send-file report. The forward
|
|
1373
|
+
// call mints ONE clientId for the whole call; Zalo echoes it
|
|
1374
|
+
// per target as `clientId`, and sendForward reports it at the
|
|
1375
|
+
// top level as `cliMsgId` (as patches/zca-js+2.2.0.patch does
|
|
1376
|
+
// for zca-js's forwardMessage) -- neither spot alone gives a
|
|
1377
|
+
// caller the {msgId, cliMsgId} pair that `msg undo` needs.
|
|
1378
|
+
// Tier 4 hit exactly that: it recorded the forwarded msgId
|
|
1379
|
+
// with a null id and could not recall the message.
|
|
1380
|
+
const shared = (result?.cliMsgId ?? null) === null ? null : String(result.cliMsgId);
|
|
1381
|
+
const sent = (Array.isArray(result?.success) ? result.success : [])
|
|
1382
|
+
.filter((x) => (x?.msgId ?? null) !== null)
|
|
1383
|
+
.map((x) => ({
|
|
1384
|
+
msgId: String(x.msgId),
|
|
1385
|
+
cliMsgId: (x.clientId ?? shared ?? null) === null ? null : String(x.clientId ?? shared),
|
|
1386
|
+
}));
|
|
1387
|
+
|
|
1388
|
+
output({ ...result, sent }, jsonMode, () => success(`Forwarded to ${threadId}`));
|
|
482
1389
|
} catch (e) {
|
|
483
1390
|
error(e.message);
|
|
484
1391
|
}
|
|
485
1392
|
});
|
|
486
1393
|
|
|
1394
|
+
msg.command("pin <msgId> [threadId]")
|
|
1395
|
+
.description(
|
|
1396
|
+
"Pin a text message to the top of its conversation, as the apps do. The message must be in the local " +
|
|
1397
|
+
"cache; [threadId] defaults to the one it was cached under",
|
|
1398
|
+
)
|
|
1399
|
+
.option("-t, --type <n>", "Thread type: 0=User, 1=Group (default: the cached conversation's kind)", "0")
|
|
1400
|
+
.action(async (msgId, threadId, opts, cmd) => {
|
|
1401
|
+
try {
|
|
1402
|
+
// Everything the pin carries -- cliMsgId, sender, text -- comes
|
|
1403
|
+
// from the cached row, so every refusal below happens before
|
|
1404
|
+
// any request.
|
|
1405
|
+
const row = openAccountDb() ? getMessageById(msgId) : null;
|
|
1406
|
+
if (!row) {
|
|
1407
|
+
refuse(
|
|
1408
|
+
`Message ${msgId} is not in the local cache, so it cannot be pinned: a pin carries the ` +
|
|
1409
|
+
`message's cliMsgId, sender and text. \`listen\` caches messages as they arrive and ` +
|
|
1410
|
+
`\`sync\` restores older ones.`,
|
|
1411
|
+
);
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
if (threadId && row.threadId && String(row.threadId) !== String(threadId)) {
|
|
1415
|
+
refuse(`Message ${msgId} belongs to thread ${row.threadId}, not ${threadId}.`);
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
if (row.type !== "text") {
|
|
1419
|
+
refuse(
|
|
1420
|
+
`Only text messages can be pinned from the CLI; message ${msgId} is a ` +
|
|
1421
|
+
`${row.type || "message of unknown kind"}. Pin it from the app.`,
|
|
1422
|
+
);
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
const cliMsgId = cachedCliMsgId(row);
|
|
1426
|
+
if (!cliMsgId) {
|
|
1427
|
+
refuse(`Message ${msgId}'s cliMsgId was never cached, and a pin must name it.`);
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
const conversation = String(threadId || row.threadId);
|
|
1431
|
+
const isGroup = threadIsGroup(conversation, opts, cmd);
|
|
1432
|
+
|
|
1433
|
+
const api = getApi();
|
|
1434
|
+
const sender = await resolveSenderUid(api, row.senderId, getOwnId());
|
|
1435
|
+
if (sender.error) {
|
|
1436
|
+
refuse(`Cannot pin message ${msgId}: ${sender.error}.`);
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
const params = textPinParams({
|
|
1440
|
+
cliMsgId,
|
|
1441
|
+
msgId,
|
|
1442
|
+
senderUid: sender.uid,
|
|
1443
|
+
senderName: row.senderName,
|
|
1444
|
+
text: cachedText(row),
|
|
1445
|
+
});
|
|
1446
|
+
const result = await pinMessage(api, { threadId: conversation, isGroup, params });
|
|
1447
|
+
output(result, program.opts().json, () => success(`Pinned message ${msgId} in ${conversation}`));
|
|
1448
|
+
} catch (e) {
|
|
1449
|
+
refuse(`Pin failed: ${describeZaloError(e)}`);
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
|
|
1453
|
+
msg.command("unpin <msgId> [threadId]")
|
|
1454
|
+
.description(
|
|
1455
|
+
"Unpin a message. [threadId] defaults to the conversation the message is cached under, and is " +
|
|
1456
|
+
"required when it is not cached",
|
|
1457
|
+
)
|
|
1458
|
+
.option("-t, --type <n>", "Thread type: 0=User, 1=Group (default: the cached conversation's kind)", "0")
|
|
1459
|
+
.action(async (msgId, threadId, opts, cmd) => {
|
|
1460
|
+
try {
|
|
1461
|
+
// Unpinning takes the pin's topic id, which comes from the
|
|
1462
|
+
// conversation's live pin list -- so only the conversation has
|
|
1463
|
+
// to be known, not the message.
|
|
1464
|
+
const row = openAccountDb() ? getMessageById(msgId) : null;
|
|
1465
|
+
if (threadId && row?.threadId && String(row.threadId) !== String(threadId)) {
|
|
1466
|
+
refuse(`Message ${msgId} belongs to thread ${row.threadId}, not ${threadId}.`);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
const conversation = threadId || row?.threadId;
|
|
1470
|
+
if (!conversation) {
|
|
1471
|
+
refuse(
|
|
1472
|
+
`Message ${msgId} is not in the local cache, so its thread is unknown. ` +
|
|
1473
|
+
`Name it: zalo-agent msg unpin ${msgId} <threadId> -t <0|1>`,
|
|
1474
|
+
);
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
const isGroup = threadIsGroup(String(conversation), opts, cmd);
|
|
1478
|
+
const result = await unpinMessage(getApi(), { threadId: String(conversation), isGroup, msgId });
|
|
1479
|
+
if (result.notPinned) {
|
|
1480
|
+
refuse(`Message ${msgId} is not pinned in ${conversation}.`);
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1483
|
+
output(result, program.opts().json, () => success(`Unpinned message ${msgId} in ${conversation}`));
|
|
1484
|
+
} catch (e) {
|
|
1485
|
+
refuse(`Unpin failed: ${describeZaloError(e)}`);
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
|
|
487
1489
|
msg.command("history <threadId>")
|
|
488
|
-
.description("Fetch message history
|
|
1490
|
+
.description("Fetch message history. Groups try REST API then fallback to WebSocket. DMs use WebSocket.")
|
|
489
1491
|
.option("-t, --type <n>", "Thread type: 0=User(DM), 1=Group", "0")
|
|
490
|
-
.option("-n, --limit <n>", "Max messages to fetch
|
|
1492
|
+
.option("-n, --limit <n>", "Max most-recent messages to fetch", "50")
|
|
1493
|
+
.option("--scan <n>", "Max raw global messages to scan (WebSocket only)", "2000")
|
|
1494
|
+
.option("--from-msg-id <id>", "Anchor message ID to scan older messages from")
|
|
491
1495
|
.option("--timeout <ms>", "Timeout in milliseconds waiting for response", "15000")
|
|
1496
|
+
.option("--no-cache", "Force live fetch instead of using local cache, and amend db")
|
|
492
1497
|
.action(async (threadId, opts) => {
|
|
493
1498
|
const jsonMode = program.opts().json;
|
|
494
1499
|
const threadType = Number(opts.type);
|
|
495
1500
|
const limit = Number(opts.limit);
|
|
496
1501
|
const timeout = Number(opts.timeout);
|
|
1502
|
+
const scanLimit = Number(opts.scan);
|
|
1503
|
+
|
|
1504
|
+
// Order matters: getApi() throws when there is no session, and
|
|
1505
|
+
// this line sits outside any try/catch. Calling it ABOVE the
|
|
1506
|
+
// guard made the friendly message unreachable — a logged-out
|
|
1507
|
+
// user got a raw Node stack trace instead. `conv recent` gets
|
|
1508
|
+
// this order right; keep them consistent.
|
|
1509
|
+
const activeAcc = getActive();
|
|
1510
|
+
if (!activeAcc) {
|
|
1511
|
+
error("No active account. Please login first.");
|
|
1512
|
+
process.exit(1);
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
let api;
|
|
1516
|
+
try {
|
|
1517
|
+
api = getApi();
|
|
1518
|
+
} catch (e) {
|
|
1519
|
+
error(e.message);
|
|
1520
|
+
process.exit(1);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
if (!jsonMode) {
|
|
1524
|
+
info(
|
|
1525
|
+
"Note: To maintain a complete local cache without missing gaps, ensure the 'zalo-cli listen' daemon is running continuously on this device.",
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
let localMsgs = [];
|
|
1530
|
+
let dbActive = false;
|
|
1531
|
+
|
|
1532
|
+
try {
|
|
1533
|
+
const accountDir = join(CONFIG_DIR, "accounts", activeAcc.ownId);
|
|
1534
|
+
initDb(join(accountDir, "zalo.db"));
|
|
1535
|
+
dbActive = true;
|
|
1536
|
+
|
|
1537
|
+
if (opts.cache !== false) {
|
|
1538
|
+
localMsgs = getMessages(threadId, limit);
|
|
1539
|
+
if (localMsgs && localMsgs.length >= limit) {
|
|
1540
|
+
if (!jsonMode) info(`Found ${localMsgs.length} messages in local cache.`);
|
|
1541
|
+
// Fetch through the shared downloader, which writes to
|
|
1542
|
+
// accounts/<ownId>/media/<threadName>/ and records the
|
|
1543
|
+
// path itself. The old per-command downloader used a
|
|
1544
|
+
// different flat layout and its extension logic keyed off
|
|
1545
|
+
// Number(message.type) -- always NaN for a string type --
|
|
1546
|
+
// so reading history quietly scattered files into a second
|
|
1547
|
+
// location that nothing else knew about.
|
|
1548
|
+
try {
|
|
1549
|
+
await downloadSyncedMedia({
|
|
1550
|
+
api,
|
|
1551
|
+
accountDir,
|
|
1552
|
+
threadId,
|
|
1553
|
+
limit,
|
|
1554
|
+
concurrency: 2,
|
|
1555
|
+
});
|
|
1556
|
+
localMsgs = getMessages(threadId, limit);
|
|
1557
|
+
} catch {
|
|
1558
|
+
/* showing history must not fail because media did */
|
|
1559
|
+
}
|
|
1560
|
+
const messages = await withCurrentSenderNames(
|
|
1561
|
+
api,
|
|
1562
|
+
localMsgs.map((m) => ({
|
|
1563
|
+
msgId: m.msgId,
|
|
1564
|
+
threadId: m.threadId,
|
|
1565
|
+
senderId: m.senderId,
|
|
1566
|
+
senderName: m.senderName,
|
|
1567
|
+
text: m.text,
|
|
1568
|
+
timestamp: m.timestamp,
|
|
1569
|
+
type: m.type,
|
|
1570
|
+
localPath: m.localPath,
|
|
1571
|
+
})),
|
|
1572
|
+
threadType === 0 ? [threadId] : [],
|
|
1573
|
+
);
|
|
1574
|
+
|
|
1575
|
+
output(
|
|
1576
|
+
{
|
|
1577
|
+
threadId,
|
|
1578
|
+
threadType: threadType === 0 ? "dm" : "group",
|
|
1579
|
+
count: messages.length,
|
|
1580
|
+
source: "sqlite",
|
|
1581
|
+
messages,
|
|
1582
|
+
},
|
|
1583
|
+
jsonMode,
|
|
1584
|
+
() => {
|
|
1585
|
+
success(`${messages.length} message(s) from ${threadId} (Local Cache)`);
|
|
1586
|
+
for (const m of messages) {
|
|
1587
|
+
const date = m.timestamp ? new Date(m.timestamp).toLocaleString() : "?";
|
|
1588
|
+
const name = m.senderDisplayName || m.senderId || "?";
|
|
1589
|
+
const mediaInfo = m.localPath ? ` [Media: ${m.localPath}]` : "";
|
|
1590
|
+
console.log(` [${date}] ${name}: ${(m.text || "").slice(0, 200)}${mediaInfo}`);
|
|
1591
|
+
}
|
|
1592
|
+
},
|
|
1593
|
+
);
|
|
1594
|
+
return;
|
|
1595
|
+
} else if (localMsgs && localMsgs.length > 0 && !jsonMode) {
|
|
1596
|
+
info(
|
|
1597
|
+
`Found only ${localMsgs.length} messages in cache. Falling back to live fetch to reach limit of ${limit}.`,
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1600
|
+
} else if (opts.cache === false && !jsonMode) {
|
|
1601
|
+
info(`--no-cache specified. Fetching live from server and amending database.`);
|
|
1602
|
+
}
|
|
1603
|
+
} catch (err) {
|
|
1604
|
+
if (!jsonMode && err.message !== "Database not initialized") {
|
|
1605
|
+
warning(`Local DB query failed: ${err.message}. Falling back to network.`);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
497
1608
|
|
|
498
1609
|
try {
|
|
499
1610
|
if (!jsonMode && limit > 100) {
|
|
500
|
-
info(
|
|
501
|
-
`Warning: fetching up to ${limit} messages. Large history may use significant memory and bandwidth.`,
|
|
502
|
-
);
|
|
1611
|
+
info(`Warning: fetching up to ${limit} messages.`);
|
|
503
1612
|
}
|
|
504
1613
|
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
1614
|
+
/** One progress line from the fetch, whichever process runs it. */
|
|
1615
|
+
const report = (e) => {
|
|
1616
|
+
if (jsonMode || !e?.detail) return;
|
|
1617
|
+
if (e.level === "warn") warning(e.detail);
|
|
1618
|
+
else info(e.detail);
|
|
1619
|
+
};
|
|
1620
|
+
const fetchOpts = { limit, scanLimit, timeoutMs: timeout, fromMsgId: opts.fromMsgId || null };
|
|
1621
|
+
|
|
1622
|
+
// The group store, the WebSocket global stream scanning and the
|
|
1623
|
+
// cache write after them are one function, fetchAndCacheHistory,
|
|
1624
|
+
// run by whichever process holds the account: it owns the one web
|
|
1625
|
+
// session the scan needs and is the one db writer (AGENTS.md
|
|
1626
|
+
// §13). With a daemon up that is the daemon, and this command
|
|
1627
|
+
// only displays what it returns.
|
|
1628
|
+
const daemonDir = join(CONFIG_DIR, "accounts", activeAcc.ownId);
|
|
1629
|
+
const daemon = getDaemonChannel(daemonDir);
|
|
1630
|
+
let fetched = null;
|
|
1631
|
+
let handledByDaemon = false;
|
|
1632
|
+
if (daemon) {
|
|
1633
|
+
// Nothing below fetches, writes or opens a socket in this
|
|
1634
|
+
// process beside a live daemon: when it cannot answer, the
|
|
1635
|
+
// command fails and says why.
|
|
1636
|
+
if (!getSyncChannel(daemonDir, "history")) {
|
|
1637
|
+
throw new Error(
|
|
1638
|
+
`a listen/mcp daemon (pid ${daemon.pid}) holds this account but predates the ` +
|
|
1639
|
+
"history hand-off — restart it, then run this again.",
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
report({
|
|
1643
|
+
detail: `A listen/mcp daemon (pid ${daemon.pid}) holds this account — it fetches and caches; this command only displays.`,
|
|
516
1644
|
});
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
1645
|
+
const viaDaemon = await syncViaDaemon(daemonDir, {
|
|
1646
|
+
stage: "history",
|
|
1647
|
+
params: { threadId, threadType, ...fetchOpts },
|
|
1648
|
+
onEvent: report,
|
|
520
1649
|
});
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
const handler = (messages) => {
|
|
528
|
-
clearTimeout(timer);
|
|
529
|
-
api.listener.removeListener("old_messages", handler);
|
|
530
|
-
resolve(messages);
|
|
531
|
-
};
|
|
532
|
-
const timer = setTimeout(() => {
|
|
533
|
-
api.listener.removeListener("old_messages", handler);
|
|
534
|
-
resolve([]);
|
|
535
|
-
}, timeout);
|
|
1650
|
+
if (viaDaemon && !viaDaemon.ok) throw new Error(daemonHistoryFailure(viaDaemon, daemon.pid));
|
|
1651
|
+
// null: gone before the request reached it. Confirmed gone,
|
|
1652
|
+
// so the session is this process's again.
|
|
1653
|
+
handledByDaemon = viaDaemon !== null;
|
|
1654
|
+
fetched = viaDaemon?.result ?? null;
|
|
1655
|
+
}
|
|
536
1656
|
|
|
537
|
-
|
|
538
|
-
|
|
1657
|
+
if (!handledByDaemon) {
|
|
1658
|
+
fetched = await fetchAndCacheHistory(api, threadId, threadType, {
|
|
1659
|
+
...fetchOpts,
|
|
1660
|
+
cache: dbActive,
|
|
1661
|
+
onProgress: report,
|
|
1662
|
+
// No daemon: the session is this process's, and so is
|
|
1663
|
+
// opening the socket for the scan and closing it after.
|
|
1664
|
+
connect: async () => {
|
|
1665
|
+
await new Promise((resolve, reject) => {
|
|
1666
|
+
const timer = setTimeout(() => reject(new Error("Listener connection timeout")), 10000);
|
|
1667
|
+
api.listener.once("connected", () => {
|
|
1668
|
+
clearTimeout(timer);
|
|
1669
|
+
resolve();
|
|
1670
|
+
});
|
|
1671
|
+
api.listener.once("error", (err) => {
|
|
1672
|
+
clearTimeout(timer);
|
|
1673
|
+
reject(err);
|
|
1674
|
+
});
|
|
1675
|
+
api.listener.start({ retryOnClose: false });
|
|
1676
|
+
});
|
|
1677
|
+
return () => {
|
|
1678
|
+
try {
|
|
1679
|
+
api.listener.stop();
|
|
1680
|
+
} catch {}
|
|
1681
|
+
};
|
|
1682
|
+
},
|
|
539
1683
|
});
|
|
1684
|
+
}
|
|
540
1685
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
1686
|
+
const frames = Array.isArray(fetched?.frames) ? fetched.frames : [];
|
|
1687
|
+
const fetchedMessages = frames.map((f) => historyRow(f.data, f.threadId));
|
|
1688
|
+
if (handledByDaemon && typeof fetched?.added !== "number") {
|
|
1689
|
+
// Its history stage from before this version returned frames
|
|
1690
|
+
// for the CLI to write, and nothing here writes them.
|
|
1691
|
+
warning(
|
|
1692
|
+
`The listen/mcp daemon (pid ${daemon.pid}) predates cached history: it fetched this ` +
|
|
1693
|
+
"but cached none of it. Restart it so what msg history fetches is cached.",
|
|
1694
|
+
);
|
|
1695
|
+
} else if (!jsonMode && fetched?.cached && frames.length > 0) {
|
|
1696
|
+
info(
|
|
1697
|
+
`${handledByDaemon ? "The daemon cached" : "Cached"} ${fetched.added} message(s) the local ` +
|
|
1698
|
+
`database did not have; ${fetched.untouched} already there or not storable were left untouched.`,
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
545
1701
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const target = String(threadId);
|
|
552
|
-
if (msgThread !== target && msgSender !== target) continue;
|
|
553
|
-
allMessages.push({
|
|
554
|
-
msgId: msg.data?.msgId,
|
|
555
|
-
threadId: msg.threadId,
|
|
556
|
-
senderId: msg.data?.uidFrom || null,
|
|
557
|
-
senderName: msg.data?.dName || null,
|
|
558
|
-
text:
|
|
559
|
-
typeof msg.data?.content === "string"
|
|
560
|
-
? msg.data.content
|
|
561
|
-
: extractMessageText(msg.data?.content, msg.data?.msgType),
|
|
562
|
-
timestamp: msg.data?.ts ? Number(msg.data.ts) : null,
|
|
563
|
-
type: typeof msg.data?.content === "string" ? "text" : msg.data?.msgType || "attachment",
|
|
564
|
-
});
|
|
565
|
-
}
|
|
1702
|
+
// Merge and sort
|
|
1703
|
+
// If we fetched live, we might want to merge with localMsgs in case we didn't fetch enough to hit the limit
|
|
1704
|
+
const mergedMap = new Map();
|
|
1705
|
+
for (const m of localMsgs) mergedMap.set(m.msgId, m);
|
|
1706
|
+
for (const m of fetchedMessages) mergedMap.set(m.msgId, m);
|
|
566
1707
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
lastMsgId = nextId;
|
|
574
|
-
}
|
|
1708
|
+
const mergedArray = Array.from(mergedMap.values());
|
|
1709
|
+
// Sort newest-first (descending timestamp)
|
|
1710
|
+
mergedArray.sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0));
|
|
1711
|
+
|
|
1712
|
+
const result = mergedArray.slice(0, limit);
|
|
575
1713
|
|
|
576
|
-
//
|
|
577
|
-
|
|
1714
|
+
// Format final output
|
|
1715
|
+
const cleanResult = await withCurrentSenderNames(
|
|
1716
|
+
api,
|
|
1717
|
+
result.map((m) => {
|
|
1718
|
+
const r = { ...m };
|
|
1719
|
+
delete r.raw_data;
|
|
1720
|
+
return r;
|
|
1721
|
+
}),
|
|
1722
|
+
threadType === 0 ? [threadId] : [],
|
|
1723
|
+
);
|
|
578
1724
|
|
|
579
1725
|
output(
|
|
580
1726
|
{
|
|
581
1727
|
threadId,
|
|
582
1728
|
threadType: threadType === 0 ? "dm" : "group",
|
|
583
|
-
count:
|
|
584
|
-
|
|
1729
|
+
count: cleanResult.length,
|
|
1730
|
+
source: "live",
|
|
1731
|
+
// A group's store withheld older messages (since-login only).
|
|
1732
|
+
filtered: fetched?.filtered === true,
|
|
1733
|
+
messages: cleanResult,
|
|
585
1734
|
},
|
|
586
1735
|
jsonMode,
|
|
587
1736
|
() => {
|
|
588
|
-
success(`${
|
|
589
|
-
for (const m of
|
|
1737
|
+
success(`${cleanResult.length} message(s) from ${threadId}`);
|
|
1738
|
+
for (const m of cleanResult) {
|
|
590
1739
|
const date = m.timestamp ? new Date(m.timestamp).toLocaleString() : "?";
|
|
591
|
-
const name = m.
|
|
592
|
-
|
|
1740
|
+
const name = m.senderDisplayName || m.senderId || "?";
|
|
1741
|
+
const mediaInfo = m.localPath ? ` [Media: ${m.localPath}]` : "";
|
|
1742
|
+
console.log(` [${date}] ${name}: ${(m.text || "").slice(0, 200)}${mediaInfo}`);
|
|
593
1743
|
}
|
|
594
1744
|
},
|
|
595
1745
|
);
|
|
596
1746
|
|
|
597
|
-
// Clean up listener
|
|
598
|
-
api.listener.stop();
|
|
599
1747
|
process.exit(0);
|
|
600
1748
|
} catch (e) {
|
|
601
1749
|
try {
|