@ardennguyen/zalo-agent-cli 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DISCLAIMER.md +2 -2
- package/README.md +146 -69
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/bignumber.js/CHANGELOG.md +381 -0
- package/node_modules/bignumber.js/LICENCE.md +26 -0
- package/node_modules/bignumber.js/README.md +289 -0
- package/node_modules/bignumber.js/bignumber.d.mts +6 -0
- package/node_modules/bignumber.js/bignumber.d.ts +5 -0
- package/node_modules/bignumber.js/bignumber.js +2922 -0
- package/node_modules/bignumber.js/bignumber.mjs +2907 -0
- package/node_modules/bignumber.js/doc/API.html +2249 -0
- package/node_modules/bignumber.js/package.json +60 -0
- package/node_modules/bignumber.js/types.d.ts +1821 -0
- package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/crypto-js/CONTRIBUTING.md +28 -0
- package/node_modules/crypto-js/LICENSE +24 -0
- package/node_modules/crypto-js/README.md +275 -0
- package/node_modules/crypto-js/aes.js +234 -0
- package/node_modules/crypto-js/blowfish.js +471 -0
- package/node_modules/crypto-js/bower.json +39 -0
- package/node_modules/crypto-js/cipher-core.js +895 -0
- package/node_modules/crypto-js/core.js +807 -0
- package/node_modules/crypto-js/crypto-js.js +6657 -0
- package/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
- package/node_modules/crypto-js/enc-base64.js +136 -0
- package/node_modules/crypto-js/enc-base64url.js +148 -0
- package/node_modules/crypto-js/enc-hex.js +18 -0
- package/node_modules/crypto-js/enc-latin1.js +18 -0
- package/node_modules/crypto-js/enc-utf16.js +149 -0
- package/node_modules/crypto-js/enc-utf8.js +18 -0
- package/node_modules/crypto-js/evpkdf.js +134 -0
- package/node_modules/crypto-js/format-hex.js +66 -0
- package/node_modules/crypto-js/format-openssl.js +18 -0
- package/node_modules/crypto-js/hmac-md5.js +18 -0
- package/node_modules/crypto-js/hmac-ripemd160.js +18 -0
- package/node_modules/crypto-js/hmac-sha1.js +18 -0
- package/node_modules/crypto-js/hmac-sha224.js +18 -0
- package/node_modules/crypto-js/hmac-sha256.js +18 -0
- package/node_modules/crypto-js/hmac-sha3.js +18 -0
- package/node_modules/crypto-js/hmac-sha384.js +18 -0
- package/node_modules/crypto-js/hmac-sha512.js +18 -0
- package/node_modules/crypto-js/hmac.js +143 -0
- package/node_modules/crypto-js/index.js +18 -0
- package/node_modules/crypto-js/lib-typedarrays.js +76 -0
- package/node_modules/crypto-js/md5.js +268 -0
- package/node_modules/crypto-js/mode-cfb.js +80 -0
- package/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
- package/node_modules/crypto-js/mode-ctr.js +58 -0
- package/node_modules/crypto-js/mode-ecb.js +40 -0
- package/node_modules/crypto-js/mode-ofb.js +54 -0
- package/node_modules/crypto-js/package.json +42 -0
- package/node_modules/crypto-js/pad-ansix923.js +49 -0
- package/node_modules/crypto-js/pad-iso10126.js +44 -0
- package/node_modules/crypto-js/pad-iso97971.js +40 -0
- package/node_modules/crypto-js/pad-nopadding.js +30 -0
- package/node_modules/crypto-js/pad-pkcs7.js +18 -0
- package/node_modules/crypto-js/pad-zeropadding.js +47 -0
- package/node_modules/crypto-js/pbkdf2.js +145 -0
- package/node_modules/crypto-js/rabbit-legacy.js +190 -0
- package/node_modules/crypto-js/rabbit.js +192 -0
- package/node_modules/crypto-js/rc4.js +139 -0
- package/node_modules/crypto-js/ripemd160.js +267 -0
- package/node_modules/crypto-js/sha1.js +150 -0
- package/node_modules/crypto-js/sha224.js +80 -0
- package/node_modules/crypto-js/sha256.js +199 -0
- package/node_modules/crypto-js/sha3.js +326 -0
- package/node_modules/crypto-js/sha384.js +83 -0
- package/node_modules/crypto-js/sha512.js +326 -0
- package/node_modules/crypto-js/tripledes.js +779 -0
- package/node_modules/crypto-js/x64-core.js +304 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/dunder-proto/.eslintrc +5 -0
- package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +24 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +30 -0
- package/node_modules/dunder-proto/package.json +76 -0
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/es-object-atoms/.eslintrc +16 -0
- package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
- package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
- package/node_modules/es-object-atoms/LICENSE +21 -0
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +79 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +7 -0
- package/node_modules/es-set-tostringtag/.eslintrc +13 -0
- package/node_modules/es-set-tostringtag/.nycrc +9 -0
- package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
- package/node_modules/es-set-tostringtag/LICENSE +21 -0
- package/node_modules/es-set-tostringtag/README.md +53 -0
- package/node_modules/es-set-tostringtag/index.d.ts +10 -0
- package/node_modules/es-set-tostringtag/index.js +35 -0
- package/node_modules/es-set-tostringtag/package.json +78 -0
- package/node_modules/es-set-tostringtag/test/index.js +85 -0
- package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
- package/node_modules/form-data/CHANGELOG.md +686 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md +355 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +4 -0
- package/node_modules/form-data/lib/form_data.js +506 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-db/README.md +100 -0
- package/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
- package/node_modules/form-data/node_modules/mime-db/index.js +12 -0
- package/node_modules/form-data/node_modules/mime-db/package.json +60 -0
- package/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/form-data/node_modules/mime-types/README.md +113 -0
- package/node_modules/form-data/node_modules/mime-types/index.js +188 -0
- package/node_modules/form-data/node_modules/mime-types/package.json +44 -0
- package/node_modules/form-data/package.json +82 -0
- package/node_modules/function-bind/.eslintrc +21 -0
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +46 -0
- package/node_modules/function-bind/implementation.js +84 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +87 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +42 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +378 -0
- package/node_modules/get-intrinsic/package.json +97 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/get-proto/.github/FUNDING.yml +12 -0
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/get-proto/LICENSE +21 -0
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/get-proto/package.json +81 -0
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +91 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +14 -0
- package/node_modules/has-symbols/package.json +111 -0
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +45 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +29 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
- package/node_modules/has-symbols/test/tests.js +58 -0
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/has-tostringtag/.eslintrc +5 -0
- package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
- package/node_modules/has-tostringtag/.nycrc +13 -0
- package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
- package/node_modules/has-tostringtag/LICENSE +21 -0
- package/node_modules/has-tostringtag/README.md +46 -0
- package/node_modules/has-tostringtag/index.d.ts +3 -0
- package/node_modules/has-tostringtag/index.js +8 -0
- package/node_modules/has-tostringtag/package.json +108 -0
- package/node_modules/has-tostringtag/shams.d.ts +3 -0
- package/node_modules/has-tostringtag/shams.js +8 -0
- package/node_modules/has-tostringtag/test/index.js +21 -0
- package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
- package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
- package/node_modules/has-tostringtag/test/tests.js +15 -0
- package/node_modules/has-tostringtag/tsconfig.json +49 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +58 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +6 -0
- package/node_modules/json-bigint/LICENSE +20 -0
- package/node_modules/json-bigint/README.md +240 -0
- package/node_modules/json-bigint/index.js +12 -0
- package/node_modules/json-bigint/lib/parse.js +443 -0
- package/node_modules/json-bigint/lib/stringify.js +384 -0
- package/node_modules/json-bigint/package.json +34 -0
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/pako/LICENSE +21 -0
- package/node_modules/pako/README.md +155 -0
- package/node_modules/pako/dist/pako.es5.js +6760 -0
- package/node_modules/pako/dist/pako.es5.min.js +2 -0
- package/node_modules/pako/dist/pako.esm.mjs +6945 -0
- package/node_modules/pako/dist/pako.js +6964 -0
- package/node_modules/pako/dist/pako.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.es5.js +3953 -0
- package/node_modules/pako/dist/pako_deflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_deflate.js +4154 -0
- package/node_modules/pako/dist/pako_deflate.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.es5.js +3272 -0
- package/node_modules/pako/dist/pako_inflate.es5.min.js +2 -0
- package/node_modules/pako/dist/pako_inflate.js +3279 -0
- package/node_modules/pako/dist/pako_inflate.min.js +2 -0
- package/node_modules/pako/index.js +18 -0
- package/node_modules/pako/lib/deflate.js +387 -0
- package/node_modules/pako/lib/inflate.js +456 -0
- package/node_modules/pako/lib/utils/common.js +48 -0
- package/node_modules/pako/lib/utils/strings.js +174 -0
- package/node_modules/pako/lib/zlib/README +59 -0
- package/node_modules/pako/lib/zlib/adler32.js +51 -0
- package/node_modules/pako/lib/zlib/constants.js +68 -0
- package/node_modules/pako/lib/zlib/crc32.js +59 -0
- package/node_modules/pako/lib/zlib/deflate.js +2069 -0
- package/node_modules/pako/lib/zlib/gzheader.js +58 -0
- package/node_modules/pako/lib/zlib/inffast.js +344 -0
- package/node_modules/pako/lib/zlib/inflate.js +1575 -0
- package/node_modules/pako/lib/zlib/inftrees.js +340 -0
- package/node_modules/pako/lib/zlib/messages.js +32 -0
- package/node_modules/pako/lib/zlib/trees.js +1179 -0
- package/node_modules/pako/lib/zlib/zstream.js +47 -0
- package/node_modules/pako/package.json +73 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/spark-md5/LICENSE +13 -0
- package/node_modules/spark-md5/README.md +191 -0
- package/node_modules/spark-md5/package.json +35 -0
- package/node_modules/spark-md5/spark-md5.js +751 -0
- package/node_modules/spark-md5/spark-md5.min.js +1 -0
- package/node_modules/tldts/LICENSE +13 -0
- package/node_modules/tldts/README.md +327 -0
- package/node_modules/tldts/bin/cli.js +21 -0
- package/node_modules/tldts/dist/cjs/index.js +666 -0
- package/node_modules/tldts/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
- package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
- package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/es6/index.js +33 -0
- package/node_modules/tldts/dist/es6/index.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
- package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
- package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
- package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts/dist/index.cjs.min.js +2 -0
- package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
- package/node_modules/tldts/dist/index.esm.min.js +2 -0
- package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
- package/node_modules/tldts/dist/index.umd.min.js +2 -0
- package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
- package/node_modules/tldts/dist/types/index.d.ts +7 -0
- package/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
- package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
- package/node_modules/tldts/index.ts +62 -0
- package/node_modules/tldts/package.json +91 -0
- package/node_modules/tldts/src/data/trie.ts +14 -0
- package/node_modules/tldts/src/suffix-trie.ts +110 -0
- package/node_modules/tldts-core/LICENSE +13 -0
- package/node_modules/tldts-core/README.md +3 -0
- package/node_modules/tldts-core/dist/cjs/index.js +561 -0
- package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
- package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
- package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
- package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js +104 -0
- package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
- package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
- package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
- package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
- package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/es6/index.js +4 -0
- package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
- package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
- package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
- package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js +99 -0
- package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
- package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
- package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/options.js +19 -0
- package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
- package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
- package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
- package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
- package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
- package/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
- package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
- package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
- package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
- package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
- package/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
- package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
- package/node_modules/tldts-core/index.ts +10 -0
- package/node_modules/tldts-core/package.json +68 -0
- package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
- package/node_modules/tldts-core/src/domain.ts +100 -0
- package/node_modules/tldts-core/src/extract-hostname.ts +170 -0
- package/node_modules/tldts-core/src/factory.ts +160 -0
- package/node_modules/tldts-core/src/is-ip.ts +87 -0
- package/node_modules/tldts-core/src/is-valid.ts +79 -0
- package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
- package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
- package/node_modules/tldts-core/src/options.ts +39 -0
- package/node_modules/tldts-core/src/subdomain.ts +11 -0
- package/node_modules/tough-cookie/LICENSE +12 -0
- package/node_modules/tough-cookie/README.md +154 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +33 -0
- package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +65 -0
- package/node_modules/tough-cookie/dist/cookie/constants.d.ts +54 -0
- package/node_modules/tough-cookie/dist/cookie/constants.js +38 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +326 -0
- package/node_modules/tough-cookie/dist/cookie/cookie.js +831 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +58 -0
- package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +84 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +621 -0
- package/node_modules/tough-cookie/dist/cookie/cookieJar.js +1000 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +40 -0
- package/node_modules/tough-cookie/dist/cookie/defaultPath.js +60 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +38 -0
- package/node_modules/tough-cookie/dist/cookie/domainMatch.js +94 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +15 -0
- package/node_modules/tough-cookie/dist/cookie/formatDate.js +20 -0
- package/node_modules/tough-cookie/dist/cookie/index.d.ts +29 -0
- package/node_modules/tough-cookie/dist/cookie/index.js +54 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +103 -0
- package/node_modules/tough-cookie/dist/cookie/parseDate.js +323 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +14 -0
- package/node_modules/tough-cookie/dist/cookie/permutePath.js +32 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +55 -0
- package/node_modules/tough-cookie/dist/getPublicSuffix.js +71 -0
- package/node_modules/tough-cookie/dist/memstore.d.ts +220 -0
- package/node_modules/tough-cookie/dist/memstore.js +187 -0
- package/node_modules/tough-cookie/dist/pathMatch.d.ts +17 -0
- package/node_modules/tough-cookie/dist/pathMatch.js +40 -0
- package/node_modules/tough-cookie/dist/permuteDomain.d.ts +15 -0
- package/node_modules/tough-cookie/dist/permuteDomain.js +44 -0
- package/node_modules/tough-cookie/dist/store.d.ts +211 -0
- package/node_modules/tough-cookie/dist/store.js +76 -0
- package/node_modules/tough-cookie/dist/utils.d.ts +34 -0
- package/node_modules/tough-cookie/dist/utils.js +99 -0
- package/node_modules/tough-cookie/dist/validators.d.ts +24 -0
- package/node_modules/tough-cookie/dist/validators.js +90 -0
- package/node_modules/tough-cookie/dist/version.d.ts +5 -0
- package/node_modules/tough-cookie/dist/version.js +8 -0
- package/node_modules/tough-cookie/package.json +144 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/zca-js/.prettierrc +5 -0
- package/node_modules/zca-js/CODE_OF_CONDUCT.md +163 -0
- package/node_modules/zca-js/CONTRIBUTING.md +470 -0
- package/node_modules/zca-js/LICENSE +21 -0
- package/node_modules/zca-js/README.md +225 -0
- package/node_modules/zca-js/SECURITY.md +83 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiError.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/node_modules/zca-js/dist/Errors/index.d.ts +4 -0
- package/node_modules/zca-js/dist/Errors/index.js +4 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/addGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/addPollOptions.js +26 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/addQuickMessage.js +60 -0
- package/node_modules/zca-js/dist/apis/addReaction.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/addReaction.js +294 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/addUnreadMark.js +52 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/addUserToGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/blockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/blockViewFeed.js +30 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +52 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/changeFriendAlias.js +27 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +44 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupName.js +32 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/changeGroupOwner.js +30 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/createAutoReply.js +37 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/createBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/createCatalog.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createCatalog.js +29 -0
- package/node_modules/zca-js/dist/apis/createGroup.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/createGroup.js +43 -0
- package/node_modules/zca-js/dist/apis/createNote.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/createNote.js +47 -0
- package/node_modules/zca-js/dist/apis/createPoll.d.ts +36 -0
- package/node_modules/zca-js/dist/apis/createPoll.js +40 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/createProductCatalog.js +50 -0
- package/node_modules/zca-js/dist/apis/createReminder.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/createReminder.js +63 -0
- package/node_modules/zca-js/dist/apis/custom.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/custom.js +15 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/deleteAutoReply.js +29 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteAvatar.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/deleteBankAccount.js +32 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/deleteCatalog.js +28 -0
- package/node_modules/zca-js/dist/apis/deleteChat.d.ts +19 -0
- package/node_modules/zca-js/dist/apis/deleteChat.js +50 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +27 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/deleteMessage.js +52 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +31 -0
- package/node_modules/zca-js/dist/apis/deleteSnapshotMobileMsg.js +18 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disableGroupLink.js +24 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/disperseGroup.js +28 -0
- package/node_modules/zca-js/dist/apis/editNote.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/editNote.js +46 -0
- package/node_modules/zca-js/dist/apis/editReminder.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/editReminder.js +61 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/enableGroupLink.js +25 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +10 -0
- package/node_modules/zca-js/dist/apis/findUser.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUser.js +42 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/findUserByUsername.js +27 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/forwardMessage.js +114 -0
- package/node_modules/zca-js/dist/apis/getAliasList.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getAliasList.js +27 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getAllFriends.js +34 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAllGroups.js +10 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getArchivedChatList.js +23 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +21 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getAutoReplyList.js +24 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/getAvatarList.js +28 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +30 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +24 -0
- package/node_modules/zca-js/dist/apis/getBizAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getCatalogList.js +32 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getCloseFriends.js +20 -0
- package/node_modules/zca-js/dist/apis/getContext.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getContext.js +4 -0
- package/node_modules/zca-js/dist/apis/getCookie.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getCookie.js +9 -0
- package/node_modules/zca-js/dist/apis/getCrossDB.js +18 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFriendBoardList.js +26 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getFriendOnlines.js +35 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +27 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +25 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getFullAvatar.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +29 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +36 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/getGroupInfo.js +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +31 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +25 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +34 -0
- package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +28 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +24 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getHiddenConversations.js +23 -0
- package/node_modules/zca-js/dist/apis/getLabels.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getLabels.js +28 -0
- package/node_modules/zca-js/dist/apis/getListBank.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getListBank.js +20 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getListBankAccount.js +27 -0
- package/node_modules/zca-js/dist/apis/getListBoard.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/getListBoard.js +45 -0
- package/node_modules/zca-js/dist/apis/getListDevice.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/getListDevice.js +22 -0
- package/node_modules/zca-js/dist/apis/getListReminder.d.ts +28 -0
- package/node_modules/zca-js/dist/apis/getListReminder.js +47 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +39 -0
- package/node_modules/zca-js/dist/apis/getMute.d.ts +13 -0
- package/node_modules/zca-js/dist/apis/getMute.js +22 -0
- package/node_modules/zca-js/dist/apis/getOwnId.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getOwnId.js +4 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +27 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getPinConversations.js +22 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getPollDetail.js +30 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/getProductCatalogList.js +33 -0
- package/node_modules/zca-js/dist/apis/getQR.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/getQR.js +29 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/getQuickMessageList.js +24 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +30 -0
- package/node_modules/zca-js/dist/apis/getReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getReminder.js +25 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/getReminderResponses.js +24 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +24 -0
- package/node_modules/zca-js/dist/apis/getSettings.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getSettings.js +20 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +24 -0
- package/node_modules/zca-js/dist/apis/getStickers.d.ts +1 -0
- package/node_modules/zca-js/dist/apis/getStickers.js +40 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/getStickersDetail.js +40 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/getUnreadMark.js +30 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/getUserInfo.js +44 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +30 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +25 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/joinGroupLink.js +27 -0
- package/node_modules/zca-js/dist/apis/keepAlive.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/keepAlive.js +22 -0
- package/node_modules/zca-js/dist/apis/lastOnline.d.ts +7 -0
- package/node_modules/zca-js/dist/apis/lastOnline.js +26 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/leaveGroup.js +33 -0
- package/node_modules/zca-js/dist/apis/listen.d.ts +102 -0
- package/node_modules/zca-js/dist/apis/listen.js +425 -0
- package/node_modules/zca-js/dist/apis/lockPoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/lockPoll.js +28 -0
- package/node_modules/zca-js/dist/apis/login.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/login.js +96 -0
- package/node_modules/zca-js/dist/apis/loginQR.d.ts +71 -0
- package/node_modules/zca-js/dist/apis/loginQR.js +376 -0
- package/node_modules/zca-js/dist/apis/logoutV2.js +79 -0
- package/node_modules/zca-js/dist/apis/lostFocus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/lostFocus.js +23 -0
- package/node_modules/zca-js/dist/apis/parseLink.d.ts +21 -0
- package/node_modules/zca-js/dist/apis/parseLink.js +27 -0
- package/node_modules/zca-js/dist/apis/pullMobileMsg.js +22 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/registerCatalog.js +27 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/removeFriend.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriend.js +28 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeFriendAlias.js +24 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +28 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +30 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/removeQuickMessage.js +27 -0
- package/node_modules/zca-js/dist/apis/removeReminder.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/removeReminder.js +40 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +8 -0
- package/node_modules/zca-js/dist/apis/removeUnreadMark.js +50 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +34 -0
- package/node_modules/zca-js/dist/apis/requestSyncMessage.js +18 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +20 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/reuseAvatar.js +26 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/node_modules/zca-js/dist/apis/scanURL.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/scanURL.js +28 -0
- package/node_modules/zca-js/dist/apis/searchSticker.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/searchSticker.js +28 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/sendBankCard.js +53 -0
- package/node_modules/zca-js/dist/apis/sendCard.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendCard.js +75 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +55 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sendFriendRequest.js +39 -0
- package/node_modules/zca-js/dist/apis/sendLink.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendLink.js +78 -0
- package/node_modules/zca-js/dist/apis/sendMessage.d.ts +105 -0
- package/node_modules/zca-js/dist/apis/sendMessage.js +486 -0
- package/node_modules/zca-js/dist/apis/sendReport.d.ts +17 -0
- package/node_modules/zca-js/dist/apis/sendReport.js +53 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/sendSeenEvent.js +63 -0
- package/node_modules/zca-js/dist/apis/sendSticker.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/sendSticker.js +74 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/sendTypingEvent.js +33 -0
- package/node_modules/zca-js/dist/apis/sendVideo.d.ts +35 -0
- package/node_modules/zca-js/dist/apis/sendVideo.js +134 -0
- package/node_modules/zca-js/dist/apis/sendVoice.d.ts +12 -0
- package/node_modules/zca-js/dist/apis/sendVoice.js +89 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setHiddenConversations.js +39 -0
- package/node_modules/zca-js/dist/apis/setMute.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/setMute.js +67 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +3 -0
- package/node_modules/zca-js/dist/apis/setPinnedConversations.js +34 -0
- package/node_modules/zca-js/dist/apis/sharePoll.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/sharePoll.js +28 -0
- package/node_modules/zca-js/dist/apis/unblockUser.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/unblockUser.js +28 -0
- package/node_modules/zca-js/dist/apis/undo.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/undo.js +42 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/undoFriendRequest.js +27 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +4 -0
- package/node_modules/zca-js/dist/apis/updateActiveStatus.js +27 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +10 -0
- package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +34 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +40 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateAutoReply.js +38 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +9 -0
- package/node_modules/zca-js/dist/apis/updateBankAccount.js +31 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateCatalog.js +30 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +40 -0
- package/node_modules/zca-js/dist/apis/updateGroupSettings.js +43 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +30 -0
- package/node_modules/zca-js/dist/apis/updateLabels.d.ts +15 -0
- package/node_modules/zca-js/dist/apis/updateLabels.js +34 -0
- package/node_modules/zca-js/dist/apis/updateLang.d.ts +6 -0
- package/node_modules/zca-js/dist/apis/updateLang.js +30 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +25 -0
- package/node_modules/zca-js/dist/apis/updateProductCatalog.js +51 -0
- package/node_modules/zca-js/dist/apis/updateProfile.d.ts +20 -0
- package/node_modules/zca-js/dist/apis/updateProfile.js +43 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/updateProfileBio.js +27 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +11 -0
- package/node_modules/zca-js/dist/apis/updateQuickMessage.js +61 -0
- package/node_modules/zca-js/dist/apis/updateSettings.d.ts +16 -0
- package/node_modules/zca-js/dist/apis/updateSettings.js +90 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
- package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +27 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +50 -0
- package/node_modules/zca-js/dist/apis/uploadAttachment.js +197 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +50 -0
- package/node_modules/zca-js/dist/apis/votePoll.d.ts +5 -0
- package/node_modules/zca-js/dist/apis/votePoll.js +29 -0
- package/node_modules/zca-js/dist/apis.d.ts +317 -0
- package/node_modules/zca-js/dist/apis.js +327 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
- package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +308 -0
- package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +52 -0
- package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/custom.cjs +19 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/deleteSnapshotMobileMsg.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +75 -0
- package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +41 -0
- package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +129 -0
- package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +14 -0
- package/node_modules/zca-js/dist/cjs/apis/getCrossDB.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +40 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +59 -0
- package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +61 -0
- package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +58 -0
- package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
- package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/node_modules/zca-js/dist/cjs/apis/listen.cjs +440 -0
- package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/login.cjs +102 -0
- package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +368 -0
- package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +83 -0
- package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +28 -0
- package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/pullMobileMsg.cjs +26 -0
- package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +64 -0
- package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/requestSyncMessage.cjs +22 -0
- package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +68 -0
- package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +89 -0
- package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
- package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +92 -0
- package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +500 -0
- package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +67 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +77 -0
- package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +88 -0
- package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +47 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +148 -0
- package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +103 -0
- package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +53 -0
- package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +81 -0
- package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +33 -0
- package/node_modules/zca-js/dist/cjs/apis/undo.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
- package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +43 -0
- package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +36 -0
- package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +48 -0
- package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +95 -0
- package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +211 -0
- package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/apis.cjs +332 -0
- package/node_modules/zca-js/dist/cjs/context.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/index.cjs +159 -0
- package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/Bank.cjs +263 -0
- package/node_modules/zca-js/dist/cjs/models/Board.cjs +8 -0
- package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Enum.cjs +27 -0
- package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +87 -0
- package/node_modules/zca-js/dist/cjs/models/Group.cjs +13 -0
- package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +94 -0
- package/node_modules/zca-js/dist/cjs/models/Message.cjs +35 -0
- package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +74 -0
- package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +9 -0
- package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Typing.cjs +23 -0
- package/node_modules/zca-js/dist/cjs/models/Undo.cjs +16 -0
- package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +39 -0
- package/node_modules/zca-js/dist/cjs/update.cjs +34 -0
- package/node_modules/zca-js/dist/cjs/utils.cjs +703 -0
- package/node_modules/zca-js/dist/cjs/zalo.cjs +112 -0
- package/node_modules/zca-js/dist/context.d.ts +179 -0
- package/node_modules/zca-js/dist/context.js +28 -0
- package/node_modules/zca-js/dist/index.d.ts +166 -0
- package/node_modules/zca-js/dist/index.js +14 -0
- package/node_modules/zca-js/dist/models/Attachment.d.ts +9 -0
- package/node_modules/zca-js/dist/models/Attachment.js +1 -0
- package/node_modules/zca-js/dist/models/AutoReply.d.ts +20 -0
- package/node_modules/zca-js/dist/models/AutoReply.js +7 -0
- package/node_modules/zca-js/dist/models/Bank.d.ts +291 -0
- package/node_modules/zca-js/dist/models/Bank.js +262 -0
- package/node_modules/zca-js/dist/models/Board.d.ts +60 -0
- package/node_modules/zca-js/dist/models/Board.js +6 -0
- package/node_modules/zca-js/dist/models/Catalog.d.ts +16 -0
- package/node_modules/zca-js/dist/models/Catalog.js +1 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +27 -0
- package/node_modules/zca-js/dist/models/DeliveredMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Enum.d.ts +21 -0
- package/node_modules/zca-js/dist/models/Enum.js +25 -0
- package/node_modules/zca-js/dist/models/FriendEvent.d.ts +107 -0
- package/node_modules/zca-js/dist/models/FriendEvent.js +83 -0
- package/node_modules/zca-js/dist/models/Group.d.ts +125 -0
- package/node_modules/zca-js/dist/models/Group.js +11 -0
- package/node_modules/zca-js/dist/models/GroupEvent.d.ts +178 -0
- package/node_modules/zca-js/dist/models/GroupEvent.js +90 -0
- package/node_modules/zca-js/dist/models/Label.d.ts +10 -0
- package/node_modules/zca-js/dist/models/Label.js +1 -0
- package/node_modules/zca-js/dist/models/Message.d.ts +91 -0
- package/node_modules/zca-js/dist/models/Message.js +29 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +17 -0
- package/node_modules/zca-js/dist/models/ProductCatalog.js +1 -0
- package/node_modules/zca-js/dist/models/QuickMessage.d.ts +25 -0
- package/node_modules/zca-js/dist/models/QuickMessage.js +1 -0
- package/node_modules/zca-js/dist/models/Reaction.d.ts +85 -0
- package/node_modules/zca-js/dist/models/Reaction.js +70 -0
- package/node_modules/zca-js/dist/models/Reminder.d.ts +51 -0
- package/node_modules/zca-js/dist/models/Reminder.js +7 -0
- package/node_modules/zca-js/dist/models/SeenMessage.d.ts +26 -0
- package/node_modules/zca-js/dist/models/SeenMessage.js +17 -0
- package/node_modules/zca-js/dist/models/Sticker.d.ts +27 -0
- package/node_modules/zca-js/dist/models/Sticker.js +1 -0
- package/node_modules/zca-js/dist/models/Typing.d.ts +24 -0
- package/node_modules/zca-js/dist/models/Typing.js +17 -0
- package/node_modules/zca-js/dist/models/Undo.d.ts +34 -0
- package/node_modules/zca-js/dist/models/Undo.js +12 -0
- package/node_modules/zca-js/dist/models/User.d.ts +70 -0
- package/node_modules/zca-js/dist/models/User.js +1 -0
- package/node_modules/zca-js/dist/models/ZBusiness.d.ts +22 -0
- package/node_modules/zca-js/dist/models/ZBusiness.js +35 -0
- package/node_modules/zca-js/dist/models/index.d.ts +22 -0
- package/node_modules/zca-js/dist/models/index.js +22 -0
- package/node_modules/zca-js/dist/update.d.ts +2 -0
- package/node_modules/zca-js/dist/update.js +29 -0
- package/node_modules/zca-js/dist/utils.d.ts +167 -0
- package/node_modules/zca-js/dist/utils.js +719 -0
- package/node_modules/zca-js/dist/zalo.d.ts +41 -0
- package/node_modules/zca-js/dist/zalo.js +107 -0
- package/node_modules/zca-js/eslint.config.js +21 -0
- package/node_modules/zca-js/index.d.ts +2 -0
- package/node_modules/zca-js/package.json +78 -0
- package/node_modules/zca-js/rollup.config.js +28 -0
- package/package.json +79 -62
- package/patches/zca-js+2.2.0.patch +1677 -0
- package/src/cli.test.js +34 -5
- package/src/commands/account.js +98 -5
- package/src/commands/auto-reply.js +30 -10
- package/src/commands/catalog.js +5 -4
- package/src/commands/conv.js +551 -14
- package/src/commands/friend.js +19 -7
- package/src/commands/group.js +82 -31
- package/src/commands/listen.js +607 -65
- package/src/commands/login.js +179 -20
- package/src/commands/mcp.js +392 -41
- package/src/commands/msg.js +1278 -139
- package/src/commands/oa-listen.js +130 -20
- package/src/commands/oa.js +26 -5
- package/src/commands/poll.js +7 -2
- package/src/commands/profile.js +3 -2
- package/src/commands/sync.js +2052 -0
- package/src/core/accounts.js +69 -6
- package/src/core/cached-message.js +200 -0
- package/src/core/coverage.js +90 -0
- package/src/core/daemon-channel.js +638 -0
- package/src/core/daemon-sync.js +181 -0
- package/src/core/db.js +1610 -0
- package/src/core/forward.js +112 -0
- package/src/core/group-history.js +248 -0
- package/src/core/group-members.js +68 -0
- package/src/core/group-settings.js +250 -0
- package/src/core/history-fetch.js +208 -0
- package/src/core/listener-lifecycle.js +90 -0
- package/src/core/live-api.js +47 -0
- package/src/core/live-store.js +733 -0
- package/src/core/lock.js +129 -0
- package/src/core/logout.js +289 -0
- package/src/core/offline-queue.js +194 -0
- package/src/core/pin.js +222 -0
- package/src/core/read-state.js +318 -0
- package/src/core/receipts.js +679 -0
- package/src/core/recent-conversations.js +30 -0
- package/src/core/self-heal.js +522 -0
- package/src/core/socket-tap.js +154 -0
- package/src/core/sync-v2/assets.js +181 -0
- package/src/core/sync-v2/board.js +338 -0
- package/src/core/sync-v2/conv-state.js +152 -0
- package/src/core/sync-v2/gap-advice.js +110 -0
- package/src/core/sync-v2/gid.js +103 -0
- package/src/core/sync-v2/index.js +1208 -0
- package/src/core/sync-v2/keepalive.js +177 -0
- package/src/core/sync-v2/media.js +704 -0
- package/src/core/sync-v2/message-types.js +522 -0
- package/src/core/sync-v2/plan.js +95 -0
- package/src/core/sync-v2/reactions.js +236 -0
- package/src/core/sync-v2/renewlink.js +124 -0
- package/src/core/sync-v2/zcloud-cipher.js +88 -0
- package/src/core/sync-v2/zcloud.js +675 -0
- package/src/core/sync.js +540 -0
- package/src/core/zalo-client.js +179 -61
- package/src/core/zca-custom.js +78 -0
- package/src/index.js +14 -3
- package/src/mcp/mcp-config.js +40 -3
- package/src/mcp/mcp-http-transport.js +11 -2
- package/src/mcp/mcp-server.js +4 -2
- package/src/mcp/mcp-tools.js +837 -97
- package/src/mcp/message-buffer.js +38 -8
- package/src/mcp/message-buffer.test.js +67 -15
- package/src/mcp/notifier.js +17 -1
- package/src/mcp/notifier.test.js +6 -0
- package/src/utils/bank-helpers.js +8 -3
- package/src/utils/device-fingerprint.js +72 -0
- package/src/utils/mentions.js +140 -0
- package/src/utils/my-documents.js +95 -0
- package/src/utils/open-file.js +49 -0
- package/src/utils/output.js +75 -4
- package/src/utils/parse-options.js +56 -0
- package/src/utils/qr-http-server.js +44 -7
- package/src/utils/quote.js +203 -0
- package/src/utils/thread-type.js +72 -0
- package/src/utils/update-check.js +42 -1
- package/src/utils/urgency.js +29 -0
- package/src/mcp/media-downloader.js +0 -191
- package/src/mcp/media-downloader.test.js +0 -45
- package/src/utils/qr-display.test.js +0 -97
|
@@ -0,0 +1,1407 @@
|
|
|
1
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const EventEmitter = require('events');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const http = require('http');
|
|
8
|
+
const net = require('net');
|
|
9
|
+
const tls = require('tls');
|
|
10
|
+
const { randomBytes, createHash } = require('crypto');
|
|
11
|
+
const { Duplex, Readable } = require('stream');
|
|
12
|
+
const { URL } = require('url');
|
|
13
|
+
|
|
14
|
+
const PerMessageDeflate = require('./permessage-deflate');
|
|
15
|
+
const Receiver = require('./receiver');
|
|
16
|
+
const Sender = require('./sender');
|
|
17
|
+
const { isBlob } = require('./validation');
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
BINARY_TYPES,
|
|
21
|
+
CLOSE_TIMEOUT,
|
|
22
|
+
EMPTY_BUFFER,
|
|
23
|
+
GUID,
|
|
24
|
+
kForOnEventAttribute,
|
|
25
|
+
kListener,
|
|
26
|
+
kStatusCode,
|
|
27
|
+
kWebSocket,
|
|
28
|
+
NOOP
|
|
29
|
+
} = require('./constants');
|
|
30
|
+
const {
|
|
31
|
+
EventTarget: { addEventListener, removeEventListener }
|
|
32
|
+
} = require('./event-target');
|
|
33
|
+
const { format, parse } = require('./extension');
|
|
34
|
+
const { toBuffer } = require('./buffer-util');
|
|
35
|
+
|
|
36
|
+
const kAborted = Symbol('kAborted');
|
|
37
|
+
const protocolVersions = [8, 13];
|
|
38
|
+
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
39
|
+
const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Class representing a WebSocket.
|
|
43
|
+
*
|
|
44
|
+
* @extends EventEmitter
|
|
45
|
+
*/
|
|
46
|
+
class WebSocket extends EventEmitter {
|
|
47
|
+
/**
|
|
48
|
+
* Create a new `WebSocket`.
|
|
49
|
+
*
|
|
50
|
+
* @param {(String|URL)} address The URL to which to connect
|
|
51
|
+
* @param {(String|String[])} [protocols] The subprotocols
|
|
52
|
+
* @param {Object} [options] Connection options
|
|
53
|
+
*/
|
|
54
|
+
constructor(address, protocols, options) {
|
|
55
|
+
super();
|
|
56
|
+
|
|
57
|
+
this._binaryType = BINARY_TYPES[0];
|
|
58
|
+
this._closeCode = 1006;
|
|
59
|
+
this._closeFrameReceived = false;
|
|
60
|
+
this._closeFrameSent = false;
|
|
61
|
+
this._closeMessage = EMPTY_BUFFER;
|
|
62
|
+
this._closeTimer = null;
|
|
63
|
+
this._errorEmitted = false;
|
|
64
|
+
this._extensions = {};
|
|
65
|
+
this._paused = false;
|
|
66
|
+
this._protocol = '';
|
|
67
|
+
this._readyState = WebSocket.CONNECTING;
|
|
68
|
+
this._receiver = null;
|
|
69
|
+
this._sender = null;
|
|
70
|
+
this._socket = null;
|
|
71
|
+
|
|
72
|
+
if (address !== null) {
|
|
73
|
+
this._bufferedAmount = 0;
|
|
74
|
+
this._isServer = false;
|
|
75
|
+
this._redirects = 0;
|
|
76
|
+
|
|
77
|
+
if (protocols === undefined) {
|
|
78
|
+
protocols = [];
|
|
79
|
+
} else if (!Array.isArray(protocols)) {
|
|
80
|
+
if (typeof protocols === 'object' && protocols !== null) {
|
|
81
|
+
options = protocols;
|
|
82
|
+
protocols = [];
|
|
83
|
+
} else {
|
|
84
|
+
protocols = [protocols];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
initAsClient(this, address, protocols, options);
|
|
89
|
+
} else {
|
|
90
|
+
this._autoPong = options.autoPong;
|
|
91
|
+
this._closeTimeout = options.closeTimeout;
|
|
92
|
+
this._isServer = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
98
|
+
* instead of "blob".
|
|
99
|
+
*
|
|
100
|
+
* @type {String}
|
|
101
|
+
*/
|
|
102
|
+
get binaryType() {
|
|
103
|
+
return this._binaryType;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
set binaryType(type) {
|
|
107
|
+
if (!BINARY_TYPES.includes(type)) return;
|
|
108
|
+
|
|
109
|
+
this._binaryType = type;
|
|
110
|
+
|
|
111
|
+
//
|
|
112
|
+
// Allow to change `binaryType` on the fly.
|
|
113
|
+
//
|
|
114
|
+
if (this._receiver) this._receiver._binaryType = type;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @type {Number}
|
|
119
|
+
*/
|
|
120
|
+
get bufferedAmount() {
|
|
121
|
+
if (!this._socket) return this._bufferedAmount;
|
|
122
|
+
|
|
123
|
+
return this._socket._writableState.length + this._sender._bufferedBytes;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @type {String}
|
|
128
|
+
*/
|
|
129
|
+
get extensions() {
|
|
130
|
+
return Object.keys(this._extensions).join();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @type {Boolean}
|
|
135
|
+
*/
|
|
136
|
+
get isPaused() {
|
|
137
|
+
return this._paused;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @type {Function}
|
|
142
|
+
*/
|
|
143
|
+
/* istanbul ignore next */
|
|
144
|
+
get onclose() {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @type {Function}
|
|
150
|
+
*/
|
|
151
|
+
/* istanbul ignore next */
|
|
152
|
+
get onerror() {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @type {Function}
|
|
158
|
+
*/
|
|
159
|
+
/* istanbul ignore next */
|
|
160
|
+
get onopen() {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @type {Function}
|
|
166
|
+
*/
|
|
167
|
+
/* istanbul ignore next */
|
|
168
|
+
get onmessage() {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @type {String}
|
|
174
|
+
*/
|
|
175
|
+
get protocol() {
|
|
176
|
+
return this._protocol;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @type {Number}
|
|
181
|
+
*/
|
|
182
|
+
get readyState() {
|
|
183
|
+
return this._readyState;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @type {String}
|
|
188
|
+
*/
|
|
189
|
+
get url() {
|
|
190
|
+
return this._url;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Set up the socket and the internal resources.
|
|
195
|
+
*
|
|
196
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
197
|
+
* @param {Buffer} head The first packet of the upgraded stream
|
|
198
|
+
* @param {Object} options Options object
|
|
199
|
+
* @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
|
|
200
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
201
|
+
* multiple times in the same tick
|
|
202
|
+
* @param {Function} [options.generateMask] The function used to generate the
|
|
203
|
+
* masking key
|
|
204
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
205
|
+
* buffered data chunks
|
|
206
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
207
|
+
* fragments
|
|
208
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
209
|
+
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
210
|
+
* not to skip UTF-8 validation for text and close messages
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
setSocket(socket, head, options) {
|
|
214
|
+
const receiver = new Receiver({
|
|
215
|
+
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
216
|
+
binaryType: this.binaryType,
|
|
217
|
+
extensions: this._extensions,
|
|
218
|
+
isServer: this._isServer,
|
|
219
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
220
|
+
maxFragments: options.maxFragments,
|
|
221
|
+
maxPayload: options.maxPayload,
|
|
222
|
+
skipUTF8Validation: options.skipUTF8Validation
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
226
|
+
|
|
227
|
+
this._receiver = receiver;
|
|
228
|
+
this._sender = sender;
|
|
229
|
+
this._socket = socket;
|
|
230
|
+
|
|
231
|
+
receiver[kWebSocket] = this;
|
|
232
|
+
sender[kWebSocket] = this;
|
|
233
|
+
socket[kWebSocket] = this;
|
|
234
|
+
|
|
235
|
+
receiver.on('conclude', receiverOnConclude);
|
|
236
|
+
receiver.on('drain', receiverOnDrain);
|
|
237
|
+
receiver.on('error', receiverOnError);
|
|
238
|
+
receiver.on('message', receiverOnMessage);
|
|
239
|
+
receiver.on('ping', receiverOnPing);
|
|
240
|
+
receiver.on('pong', receiverOnPong);
|
|
241
|
+
|
|
242
|
+
sender.onerror = senderOnError;
|
|
243
|
+
|
|
244
|
+
//
|
|
245
|
+
// These methods may not be available if `socket` is just a `Duplex`.
|
|
246
|
+
//
|
|
247
|
+
if (socket.setTimeout) socket.setTimeout(0);
|
|
248
|
+
if (socket.setNoDelay) socket.setNoDelay();
|
|
249
|
+
|
|
250
|
+
if (head.length > 0) socket.unshift(head);
|
|
251
|
+
|
|
252
|
+
socket.on('close', socketOnClose);
|
|
253
|
+
socket.on('data', socketOnData);
|
|
254
|
+
socket.on('end', socketOnEnd);
|
|
255
|
+
socket.on('error', socketOnError);
|
|
256
|
+
|
|
257
|
+
this._readyState = WebSocket.OPEN;
|
|
258
|
+
this.emit('open');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Emit the `'close'` event.
|
|
263
|
+
*
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
emitClose() {
|
|
267
|
+
if (!this._socket) {
|
|
268
|
+
this._readyState = WebSocket.CLOSED;
|
|
269
|
+
this.emit('close', this._closeCode, this._closeMessage);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (this._extensions[PerMessageDeflate.extensionName]) {
|
|
274
|
+
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
this._receiver.removeAllListeners();
|
|
278
|
+
this._readyState = WebSocket.CLOSED;
|
|
279
|
+
this.emit('close', this._closeCode, this._closeMessage);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Start a closing handshake.
|
|
284
|
+
*
|
|
285
|
+
* +----------+ +-----------+ +----------+
|
|
286
|
+
* - - -|ws.close()|-->|close frame|-->|ws.close()|- - -
|
|
287
|
+
* | +----------+ +-----------+ +----------+ |
|
|
288
|
+
* +----------+ +-----------+ |
|
|
289
|
+
* CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING
|
|
290
|
+
* +----------+ +-----------+ |
|
|
291
|
+
* | | | +---+ |
|
|
292
|
+
* +------------------------+-->|fin| - - - -
|
|
293
|
+
* | +---+ | +---+
|
|
294
|
+
* - - - - -|fin|<---------------------+
|
|
295
|
+
* +---+
|
|
296
|
+
*
|
|
297
|
+
* @param {Number} [code] Status code explaining why the connection is closing
|
|
298
|
+
* @param {(String|Buffer)} [data] The reason why the connection is
|
|
299
|
+
* closing
|
|
300
|
+
* @public
|
|
301
|
+
*/
|
|
302
|
+
close(code, data) {
|
|
303
|
+
if (this.readyState === WebSocket.CLOSED) return;
|
|
304
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
305
|
+
const msg = 'WebSocket was closed before the connection was established';
|
|
306
|
+
abortHandshake(this, this._req, msg);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (this.readyState === WebSocket.CLOSING) {
|
|
311
|
+
if (
|
|
312
|
+
this._closeFrameSent &&
|
|
313
|
+
(this._closeFrameReceived || this._receiver._writableState.errorEmitted)
|
|
314
|
+
) {
|
|
315
|
+
this._socket.end();
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
this._readyState = WebSocket.CLOSING;
|
|
322
|
+
this._sender.close(code, data, !this._isServer, (err) => {
|
|
323
|
+
//
|
|
324
|
+
// This error is handled by the `'error'` listener on the socket. We only
|
|
325
|
+
// want to know if the close frame has been sent here.
|
|
326
|
+
//
|
|
327
|
+
if (err) return;
|
|
328
|
+
|
|
329
|
+
this._closeFrameSent = true;
|
|
330
|
+
|
|
331
|
+
if (
|
|
332
|
+
this._closeFrameReceived ||
|
|
333
|
+
this._receiver._writableState.errorEmitted
|
|
334
|
+
) {
|
|
335
|
+
this._socket.end();
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
setCloseTimer(this);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Pause the socket.
|
|
344
|
+
*
|
|
345
|
+
* @public
|
|
346
|
+
*/
|
|
347
|
+
pause() {
|
|
348
|
+
if (
|
|
349
|
+
this.readyState === WebSocket.CONNECTING ||
|
|
350
|
+
this.readyState === WebSocket.CLOSED
|
|
351
|
+
) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
this._paused = true;
|
|
356
|
+
this._socket.pause();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Send a ping.
|
|
361
|
+
*
|
|
362
|
+
* @param {*} [data] The data to send
|
|
363
|
+
* @param {Boolean} [mask] Indicates whether or not to mask `data`
|
|
364
|
+
* @param {Function} [cb] Callback which is executed when the ping is sent
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
ping(data, mask, cb) {
|
|
368
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
369
|
+
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (typeof data === 'function') {
|
|
373
|
+
cb = data;
|
|
374
|
+
data = mask = undefined;
|
|
375
|
+
} else if (typeof mask === 'function') {
|
|
376
|
+
cb = mask;
|
|
377
|
+
mask = undefined;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (typeof data === 'number') data = data.toString();
|
|
381
|
+
|
|
382
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
383
|
+
sendAfterClose(this, data, cb);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (mask === undefined) mask = !this._isServer;
|
|
388
|
+
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Send a pong.
|
|
393
|
+
*
|
|
394
|
+
* @param {*} [data] The data to send
|
|
395
|
+
* @param {Boolean} [mask] Indicates whether or not to mask `data`
|
|
396
|
+
* @param {Function} [cb] Callback which is executed when the pong is sent
|
|
397
|
+
* @public
|
|
398
|
+
*/
|
|
399
|
+
pong(data, mask, cb) {
|
|
400
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
401
|
+
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (typeof data === 'function') {
|
|
405
|
+
cb = data;
|
|
406
|
+
data = mask = undefined;
|
|
407
|
+
} else if (typeof mask === 'function') {
|
|
408
|
+
cb = mask;
|
|
409
|
+
mask = undefined;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (typeof data === 'number') data = data.toString();
|
|
413
|
+
|
|
414
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
415
|
+
sendAfterClose(this, data, cb);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (mask === undefined) mask = !this._isServer;
|
|
420
|
+
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Resume the socket.
|
|
425
|
+
*
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
resume() {
|
|
429
|
+
if (
|
|
430
|
+
this.readyState === WebSocket.CONNECTING ||
|
|
431
|
+
this.readyState === WebSocket.CLOSED
|
|
432
|
+
) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
this._paused = false;
|
|
437
|
+
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Send a data message.
|
|
442
|
+
*
|
|
443
|
+
* @param {*} data The message to send
|
|
444
|
+
* @param {Object} [options] Options object
|
|
445
|
+
* @param {Boolean} [options.binary] Specifies whether `data` is binary or
|
|
446
|
+
* text
|
|
447
|
+
* @param {Boolean} [options.compress] Specifies whether or not to compress
|
|
448
|
+
* `data`
|
|
449
|
+
* @param {Boolean} [options.fin=true] Specifies whether the fragment is the
|
|
450
|
+
* last one
|
|
451
|
+
* @param {Boolean} [options.mask] Specifies whether or not to mask `data`
|
|
452
|
+
* @param {Function} [cb] Callback which is executed when data is written out
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
455
|
+
send(data, options, cb) {
|
|
456
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
457
|
+
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (typeof options === 'function') {
|
|
461
|
+
cb = options;
|
|
462
|
+
options = {};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (typeof data === 'number') data = data.toString();
|
|
466
|
+
|
|
467
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
468
|
+
sendAfterClose(this, data, cb);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const opts = {
|
|
473
|
+
binary: typeof data !== 'string',
|
|
474
|
+
mask: !this._isServer,
|
|
475
|
+
compress: true,
|
|
476
|
+
fin: true,
|
|
477
|
+
...options
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
if (!this._extensions[PerMessageDeflate.extensionName]) {
|
|
481
|
+
opts.compress = false;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Forcibly close the connection.
|
|
489
|
+
*
|
|
490
|
+
* @public
|
|
491
|
+
*/
|
|
492
|
+
terminate() {
|
|
493
|
+
if (this.readyState === WebSocket.CLOSED) return;
|
|
494
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
495
|
+
const msg = 'WebSocket was closed before the connection was established';
|
|
496
|
+
abortHandshake(this, this._req, msg);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (this._socket) {
|
|
501
|
+
this._readyState = WebSocket.CLOSING;
|
|
502
|
+
this._socket.destroy();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* @constant {Number} CONNECTING
|
|
509
|
+
* @memberof WebSocket
|
|
510
|
+
*/
|
|
511
|
+
Object.defineProperty(WebSocket, 'CONNECTING', {
|
|
512
|
+
enumerable: true,
|
|
513
|
+
value: readyStates.indexOf('CONNECTING')
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* @constant {Number} CONNECTING
|
|
518
|
+
* @memberof WebSocket.prototype
|
|
519
|
+
*/
|
|
520
|
+
Object.defineProperty(WebSocket.prototype, 'CONNECTING', {
|
|
521
|
+
enumerable: true,
|
|
522
|
+
value: readyStates.indexOf('CONNECTING')
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @constant {Number} OPEN
|
|
527
|
+
* @memberof WebSocket
|
|
528
|
+
*/
|
|
529
|
+
Object.defineProperty(WebSocket, 'OPEN', {
|
|
530
|
+
enumerable: true,
|
|
531
|
+
value: readyStates.indexOf('OPEN')
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* @constant {Number} OPEN
|
|
536
|
+
* @memberof WebSocket.prototype
|
|
537
|
+
*/
|
|
538
|
+
Object.defineProperty(WebSocket.prototype, 'OPEN', {
|
|
539
|
+
enumerable: true,
|
|
540
|
+
value: readyStates.indexOf('OPEN')
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* @constant {Number} CLOSING
|
|
545
|
+
* @memberof WebSocket
|
|
546
|
+
*/
|
|
547
|
+
Object.defineProperty(WebSocket, 'CLOSING', {
|
|
548
|
+
enumerable: true,
|
|
549
|
+
value: readyStates.indexOf('CLOSING')
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @constant {Number} CLOSING
|
|
554
|
+
* @memberof WebSocket.prototype
|
|
555
|
+
*/
|
|
556
|
+
Object.defineProperty(WebSocket.prototype, 'CLOSING', {
|
|
557
|
+
enumerable: true,
|
|
558
|
+
value: readyStates.indexOf('CLOSING')
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* @constant {Number} CLOSED
|
|
563
|
+
* @memberof WebSocket
|
|
564
|
+
*/
|
|
565
|
+
Object.defineProperty(WebSocket, 'CLOSED', {
|
|
566
|
+
enumerable: true,
|
|
567
|
+
value: readyStates.indexOf('CLOSED')
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @constant {Number} CLOSED
|
|
572
|
+
* @memberof WebSocket.prototype
|
|
573
|
+
*/
|
|
574
|
+
Object.defineProperty(WebSocket.prototype, 'CLOSED', {
|
|
575
|
+
enumerable: true,
|
|
576
|
+
value: readyStates.indexOf('CLOSED')
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
[
|
|
580
|
+
'binaryType',
|
|
581
|
+
'bufferedAmount',
|
|
582
|
+
'extensions',
|
|
583
|
+
'isPaused',
|
|
584
|
+
'protocol',
|
|
585
|
+
'readyState',
|
|
586
|
+
'url'
|
|
587
|
+
].forEach((property) => {
|
|
588
|
+
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
//
|
|
592
|
+
// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes.
|
|
593
|
+
// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface
|
|
594
|
+
//
|
|
595
|
+
['open', 'error', 'close', 'message'].forEach((method) => {
|
|
596
|
+
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
597
|
+
enumerable: true,
|
|
598
|
+
get() {
|
|
599
|
+
for (const listener of this.listeners(method)) {
|
|
600
|
+
if (listener[kForOnEventAttribute]) return listener[kListener];
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return null;
|
|
604
|
+
},
|
|
605
|
+
set(handler) {
|
|
606
|
+
for (const listener of this.listeners(method)) {
|
|
607
|
+
if (listener[kForOnEventAttribute]) {
|
|
608
|
+
this.removeListener(method, listener);
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (typeof handler !== 'function') return;
|
|
614
|
+
|
|
615
|
+
this.addEventListener(method, handler, {
|
|
616
|
+
[kForOnEventAttribute]: true
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
WebSocket.prototype.addEventListener = addEventListener;
|
|
623
|
+
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
624
|
+
|
|
625
|
+
module.exports = WebSocket;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Initialize a WebSocket client.
|
|
629
|
+
*
|
|
630
|
+
* @param {WebSocket} websocket The client to initialize
|
|
631
|
+
* @param {(String|URL)} address The URL to which to connect
|
|
632
|
+
* @param {Array} protocols The subprotocols
|
|
633
|
+
* @param {Object} [options] Connection options
|
|
634
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any
|
|
635
|
+
* of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple
|
|
636
|
+
* times in the same tick
|
|
637
|
+
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
638
|
+
* automatically send a pong in response to a ping
|
|
639
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
|
|
640
|
+
* for the closing handshake to finish after `websocket.close()` is called
|
|
641
|
+
* @param {Function} [options.finishRequest] A function which can be used to
|
|
642
|
+
* customize the headers of each http request before it is sent
|
|
643
|
+
* @param {Boolean} [options.followRedirects=false] Whether or not to follow
|
|
644
|
+
* redirects
|
|
645
|
+
* @param {Function} [options.generateMask] The function used to generate the
|
|
646
|
+
* masking key
|
|
647
|
+
* @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
|
|
648
|
+
* handshake request
|
|
649
|
+
* @param {Number} [options.maxBufferedChunks=262144] The maximum number of
|
|
650
|
+
* buffered data chunks
|
|
651
|
+
* @param {Number} [options.maxFragments=16384] The maximum number of message
|
|
652
|
+
* fragments
|
|
653
|
+
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
654
|
+
* size
|
|
655
|
+
* @param {Number} [options.maxRedirects=10] The maximum number of redirects
|
|
656
|
+
* allowed
|
|
657
|
+
* @param {String} [options.origin] Value of the `Origin` or
|
|
658
|
+
* `Sec-WebSocket-Origin` header
|
|
659
|
+
* @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable
|
|
660
|
+
* permessage-deflate
|
|
661
|
+
* @param {Number} [options.protocolVersion=13] Value of the
|
|
662
|
+
* `Sec-WebSocket-Version` header
|
|
663
|
+
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
664
|
+
* not to skip UTF-8 validation for text and close messages
|
|
665
|
+
* @private
|
|
666
|
+
*/
|
|
667
|
+
function initAsClient(websocket, address, protocols, options) {
|
|
668
|
+
const opts = {
|
|
669
|
+
allowSynchronousEvents: true,
|
|
670
|
+
autoPong: true,
|
|
671
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
672
|
+
protocolVersion: protocolVersions[1],
|
|
673
|
+
maxBufferedChunks: 256 * 1024,
|
|
674
|
+
maxFragments: 16 * 1024,
|
|
675
|
+
maxPayload: 100 * 1024 * 1024,
|
|
676
|
+
skipUTF8Validation: false,
|
|
677
|
+
perMessageDeflate: true,
|
|
678
|
+
followRedirects: false,
|
|
679
|
+
maxRedirects: 10,
|
|
680
|
+
...options,
|
|
681
|
+
socketPath: undefined,
|
|
682
|
+
hostname: undefined,
|
|
683
|
+
protocol: undefined,
|
|
684
|
+
timeout: undefined,
|
|
685
|
+
method: 'GET',
|
|
686
|
+
host: undefined,
|
|
687
|
+
path: undefined,
|
|
688
|
+
port: undefined
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
websocket._autoPong = opts.autoPong;
|
|
692
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
693
|
+
|
|
694
|
+
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
695
|
+
throw new RangeError(
|
|
696
|
+
`Unsupported protocol version: ${opts.protocolVersion} ` +
|
|
697
|
+
`(supported versions: ${protocolVersions.join(', ')})`
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
let parsedUrl;
|
|
702
|
+
|
|
703
|
+
if (address instanceof URL) {
|
|
704
|
+
parsedUrl = address;
|
|
705
|
+
} else {
|
|
706
|
+
try {
|
|
707
|
+
parsedUrl = new URL(address);
|
|
708
|
+
} catch {
|
|
709
|
+
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
if (parsedUrl.protocol === 'http:') {
|
|
714
|
+
parsedUrl.protocol = 'ws:';
|
|
715
|
+
} else if (parsedUrl.protocol === 'https:') {
|
|
716
|
+
parsedUrl.protocol = 'wss:';
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
websocket._url = parsedUrl.href;
|
|
720
|
+
|
|
721
|
+
const isSecure = parsedUrl.protocol === 'wss:';
|
|
722
|
+
const isIpcUrl = parsedUrl.protocol === 'ws+unix:';
|
|
723
|
+
let invalidUrlMessage;
|
|
724
|
+
|
|
725
|
+
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
726
|
+
invalidUrlMessage =
|
|
727
|
+
'The URL\'s protocol must be one of "ws:", "wss:", ' +
|
|
728
|
+
'"http:", "https:", or "ws+unix:"';
|
|
729
|
+
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
730
|
+
invalidUrlMessage = "The URL's pathname is empty";
|
|
731
|
+
} else if (parsedUrl.hash) {
|
|
732
|
+
invalidUrlMessage = 'The URL contains a fragment identifier';
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
if (invalidUrlMessage) {
|
|
736
|
+
const err = new SyntaxError(invalidUrlMessage);
|
|
737
|
+
|
|
738
|
+
if (websocket._redirects === 0) {
|
|
739
|
+
throw err;
|
|
740
|
+
} else {
|
|
741
|
+
emitErrorAndClose(websocket, err);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const defaultPort = isSecure ? 443 : 80;
|
|
747
|
+
const key = randomBytes(16).toString('base64');
|
|
748
|
+
const request = isSecure ? https.request : http.request;
|
|
749
|
+
const protocolSet = new Set();
|
|
750
|
+
let perMessageDeflate;
|
|
751
|
+
|
|
752
|
+
opts.createConnection =
|
|
753
|
+
opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
754
|
+
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
755
|
+
opts.port = parsedUrl.port || defaultPort;
|
|
756
|
+
opts.host = parsedUrl.hostname.startsWith('[')
|
|
757
|
+
? parsedUrl.hostname.slice(1, -1)
|
|
758
|
+
: parsedUrl.hostname;
|
|
759
|
+
opts.headers = {
|
|
760
|
+
...opts.headers,
|
|
761
|
+
'Sec-WebSocket-Version': opts.protocolVersion,
|
|
762
|
+
'Sec-WebSocket-Key': key,
|
|
763
|
+
Connection: 'Upgrade',
|
|
764
|
+
Upgrade: 'websocket'
|
|
765
|
+
};
|
|
766
|
+
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
767
|
+
opts.timeout = opts.handshakeTimeout;
|
|
768
|
+
|
|
769
|
+
if (opts.perMessageDeflate) {
|
|
770
|
+
perMessageDeflate = new PerMessageDeflate({
|
|
771
|
+
...opts.perMessageDeflate,
|
|
772
|
+
isServer: false,
|
|
773
|
+
maxPayload: opts.maxPayload
|
|
774
|
+
});
|
|
775
|
+
opts.headers['Sec-WebSocket-Extensions'] = format({
|
|
776
|
+
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
if (protocols.length) {
|
|
780
|
+
for (const protocol of protocols) {
|
|
781
|
+
if (
|
|
782
|
+
typeof protocol !== 'string' ||
|
|
783
|
+
!subprotocolRegex.test(protocol) ||
|
|
784
|
+
protocolSet.has(protocol)
|
|
785
|
+
) {
|
|
786
|
+
throw new SyntaxError(
|
|
787
|
+
'An invalid or duplicated subprotocol was specified'
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
protocolSet.add(protocol);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
opts.headers['Sec-WebSocket-Protocol'] = protocols.join(',');
|
|
795
|
+
}
|
|
796
|
+
if (opts.origin) {
|
|
797
|
+
if (opts.protocolVersion < 13) {
|
|
798
|
+
opts.headers['Sec-WebSocket-Origin'] = opts.origin;
|
|
799
|
+
} else {
|
|
800
|
+
opts.headers.Origin = opts.origin;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (parsedUrl.username || parsedUrl.password) {
|
|
804
|
+
opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
if (isIpcUrl) {
|
|
808
|
+
const parts = opts.path.split(':');
|
|
809
|
+
|
|
810
|
+
opts.socketPath = parts[0];
|
|
811
|
+
opts.path = parts[1];
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
let req;
|
|
815
|
+
|
|
816
|
+
if (opts.followRedirects) {
|
|
817
|
+
if (websocket._redirects === 0) {
|
|
818
|
+
websocket._originalIpc = isIpcUrl;
|
|
819
|
+
websocket._originalSecure = isSecure;
|
|
820
|
+
websocket._originalHostOrSocketPath = isIpcUrl
|
|
821
|
+
? opts.socketPath
|
|
822
|
+
: parsedUrl.host;
|
|
823
|
+
|
|
824
|
+
const headers = options && options.headers;
|
|
825
|
+
|
|
826
|
+
//
|
|
827
|
+
// Shallow copy the user provided options so that headers can be changed
|
|
828
|
+
// without mutating the original object.
|
|
829
|
+
//
|
|
830
|
+
options = { ...options, headers: {} };
|
|
831
|
+
|
|
832
|
+
if (headers) {
|
|
833
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
834
|
+
options.headers[key.toLowerCase()] = value;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
} else if (websocket.listenerCount('redirect') === 0) {
|
|
838
|
+
const isSameHost = isIpcUrl
|
|
839
|
+
? websocket._originalIpc
|
|
840
|
+
? opts.socketPath === websocket._originalHostOrSocketPath
|
|
841
|
+
: false
|
|
842
|
+
: websocket._originalIpc
|
|
843
|
+
? false
|
|
844
|
+
: parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
845
|
+
|
|
846
|
+
if (!isSameHost || (websocket._originalSecure && !isSecure)) {
|
|
847
|
+
//
|
|
848
|
+
// Match curl 7.77.0 behavior and drop the following headers. These
|
|
849
|
+
// headers are also dropped when following a redirect to a subdomain.
|
|
850
|
+
//
|
|
851
|
+
delete opts.headers.authorization;
|
|
852
|
+
delete opts.headers.cookie;
|
|
853
|
+
|
|
854
|
+
if (!isSameHost) delete opts.headers.host;
|
|
855
|
+
|
|
856
|
+
opts.auth = undefined;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
//
|
|
861
|
+
// Match curl 7.77.0 behavior and make the first `Authorization` header win.
|
|
862
|
+
// If the `Authorization` header is set, then there is nothing to do as it
|
|
863
|
+
// will take precedence.
|
|
864
|
+
//
|
|
865
|
+
if (opts.auth && !options.headers.authorization) {
|
|
866
|
+
options.headers.authorization =
|
|
867
|
+
'Basic ' + Buffer.from(opts.auth).toString('base64');
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
req = websocket._req = request(opts);
|
|
871
|
+
|
|
872
|
+
if (websocket._redirects) {
|
|
873
|
+
//
|
|
874
|
+
// Unlike what is done for the `'upgrade'` event, no early exit is
|
|
875
|
+
// triggered here if the user calls `websocket.close()` or
|
|
876
|
+
// `websocket.terminate()` from a listener of the `'redirect'` event. This
|
|
877
|
+
// is because the user can also call `request.destroy()` with an error
|
|
878
|
+
// before calling `websocket.close()` or `websocket.terminate()` and this
|
|
879
|
+
// would result in an error being emitted on the `request` object with no
|
|
880
|
+
// `'error'` event listeners attached.
|
|
881
|
+
//
|
|
882
|
+
websocket.emit('redirect', websocket.url, req);
|
|
883
|
+
}
|
|
884
|
+
} else {
|
|
885
|
+
req = websocket._req = request(opts);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if (opts.timeout) {
|
|
889
|
+
req.on('timeout', () => {
|
|
890
|
+
abortHandshake(websocket, req, 'Opening handshake has timed out');
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
req.on('error', (err) => {
|
|
895
|
+
if (req === null || req[kAborted]) return;
|
|
896
|
+
|
|
897
|
+
req = websocket._req = null;
|
|
898
|
+
emitErrorAndClose(websocket, err);
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
req.on('response', (res) => {
|
|
902
|
+
const location = res.headers.location;
|
|
903
|
+
const statusCode = res.statusCode;
|
|
904
|
+
|
|
905
|
+
if (
|
|
906
|
+
location &&
|
|
907
|
+
opts.followRedirects &&
|
|
908
|
+
statusCode >= 300 &&
|
|
909
|
+
statusCode < 400
|
|
910
|
+
) {
|
|
911
|
+
if (++websocket._redirects > opts.maxRedirects) {
|
|
912
|
+
abortHandshake(websocket, req, 'Maximum redirects exceeded');
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
req.abort();
|
|
917
|
+
|
|
918
|
+
let addr;
|
|
919
|
+
|
|
920
|
+
try {
|
|
921
|
+
addr = new URL(location, address);
|
|
922
|
+
} catch (e) {
|
|
923
|
+
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
924
|
+
emitErrorAndClose(websocket, err);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
initAsClient(websocket, addr, protocols, options);
|
|
929
|
+
} else if (!websocket.emit('unexpected-response', req, res)) {
|
|
930
|
+
abortHandshake(
|
|
931
|
+
websocket,
|
|
932
|
+
req,
|
|
933
|
+
`Unexpected server response: ${res.statusCode}`
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
req.on('upgrade', (res, socket, head) => {
|
|
939
|
+
websocket.emit('upgrade', res);
|
|
940
|
+
|
|
941
|
+
//
|
|
942
|
+
// The user may have closed the connection from a listener of the
|
|
943
|
+
// `'upgrade'` event.
|
|
944
|
+
//
|
|
945
|
+
if (websocket.readyState !== WebSocket.CONNECTING) return;
|
|
946
|
+
|
|
947
|
+
req = websocket._req = null;
|
|
948
|
+
|
|
949
|
+
const upgrade = res.headers.upgrade;
|
|
950
|
+
|
|
951
|
+
if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
|
|
952
|
+
abortHandshake(websocket, socket, 'Invalid Upgrade header');
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
const digest = createHash('sha1')
|
|
957
|
+
.update(key + GUID)
|
|
958
|
+
.digest('base64');
|
|
959
|
+
|
|
960
|
+
if (res.headers['sec-websocket-accept'] !== digest) {
|
|
961
|
+
abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header');
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
const serverProt = res.headers['sec-websocket-protocol'];
|
|
966
|
+
let protError;
|
|
967
|
+
|
|
968
|
+
if (serverProt !== undefined) {
|
|
969
|
+
if (!protocolSet.size) {
|
|
970
|
+
protError = 'Server sent a subprotocol but none was requested';
|
|
971
|
+
} else if (!protocolSet.has(serverProt)) {
|
|
972
|
+
protError = 'Server sent an invalid subprotocol';
|
|
973
|
+
}
|
|
974
|
+
} else if (protocolSet.size) {
|
|
975
|
+
protError = 'Server sent no subprotocol';
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (protError) {
|
|
979
|
+
abortHandshake(websocket, socket, protError);
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
if (serverProt) websocket._protocol = serverProt;
|
|
984
|
+
|
|
985
|
+
const secWebSocketExtensions = res.headers['sec-websocket-extensions'];
|
|
986
|
+
|
|
987
|
+
if (secWebSocketExtensions !== undefined) {
|
|
988
|
+
if (!perMessageDeflate) {
|
|
989
|
+
const message =
|
|
990
|
+
'Server sent a Sec-WebSocket-Extensions header but no extension ' +
|
|
991
|
+
'was requested';
|
|
992
|
+
abortHandshake(websocket, socket, message);
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
let extensions;
|
|
997
|
+
|
|
998
|
+
try {
|
|
999
|
+
extensions = parse(secWebSocketExtensions);
|
|
1000
|
+
} catch (err) {
|
|
1001
|
+
const message = 'Invalid Sec-WebSocket-Extensions header';
|
|
1002
|
+
abortHandshake(websocket, socket, message);
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
const extensionNames = Object.keys(extensions);
|
|
1007
|
+
|
|
1008
|
+
if (
|
|
1009
|
+
extensionNames.length !== 1 ||
|
|
1010
|
+
extensionNames[0] !== PerMessageDeflate.extensionName
|
|
1011
|
+
) {
|
|
1012
|
+
const message = 'Server indicated an extension that was not requested';
|
|
1013
|
+
abortHandshake(websocket, socket, message);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
try {
|
|
1018
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
|
|
1019
|
+
} catch (err) {
|
|
1020
|
+
const message = 'Invalid Sec-WebSocket-Extensions header';
|
|
1021
|
+
abortHandshake(websocket, socket, message);
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
websocket._extensions[PerMessageDeflate.extensionName] =
|
|
1026
|
+
perMessageDeflate;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
websocket.setSocket(socket, head, {
|
|
1030
|
+
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
1031
|
+
generateMask: opts.generateMask,
|
|
1032
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
1033
|
+
maxFragments: opts.maxFragments,
|
|
1034
|
+
maxPayload: opts.maxPayload,
|
|
1035
|
+
skipUTF8Validation: opts.skipUTF8Validation
|
|
1036
|
+
});
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
if (opts.finishRequest) {
|
|
1040
|
+
opts.finishRequest(req, websocket);
|
|
1041
|
+
} else {
|
|
1042
|
+
req.end();
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Emit the `'error'` and `'close'` events.
|
|
1048
|
+
*
|
|
1049
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
1050
|
+
* @param {Error} The error to emit
|
|
1051
|
+
* @private
|
|
1052
|
+
*/
|
|
1053
|
+
function emitErrorAndClose(websocket, err) {
|
|
1054
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1055
|
+
//
|
|
1056
|
+
// The following assignment is practically useless and is done only for
|
|
1057
|
+
// consistency.
|
|
1058
|
+
//
|
|
1059
|
+
websocket._errorEmitted = true;
|
|
1060
|
+
websocket.emit('error', err);
|
|
1061
|
+
websocket.emitClose();
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Create a `net.Socket` and initiate a connection.
|
|
1066
|
+
*
|
|
1067
|
+
* @param {Object} options Connection options
|
|
1068
|
+
* @return {net.Socket} The newly created socket used to start the connection
|
|
1069
|
+
* @private
|
|
1070
|
+
*/
|
|
1071
|
+
function netConnect(options) {
|
|
1072
|
+
options.path = options.socketPath;
|
|
1073
|
+
return net.connect(options);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Create a `tls.TLSSocket` and initiate a connection.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {Object} options Connection options
|
|
1080
|
+
* @return {tls.TLSSocket} The newly created socket used to start the connection
|
|
1081
|
+
* @private
|
|
1082
|
+
*/
|
|
1083
|
+
function tlsConnect(options) {
|
|
1084
|
+
options.path = undefined;
|
|
1085
|
+
|
|
1086
|
+
if (!options.servername && options.servername !== '') {
|
|
1087
|
+
options.servername = net.isIP(options.host) ? '' : options.host;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
return tls.connect(options);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Abort the handshake and emit an error.
|
|
1095
|
+
*
|
|
1096
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
1097
|
+
* @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to
|
|
1098
|
+
* abort or the socket to destroy
|
|
1099
|
+
* @param {String} message The error message
|
|
1100
|
+
* @private
|
|
1101
|
+
*/
|
|
1102
|
+
function abortHandshake(websocket, stream, message) {
|
|
1103
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1104
|
+
|
|
1105
|
+
const err = new Error(message);
|
|
1106
|
+
Error.captureStackTrace(err, abortHandshake);
|
|
1107
|
+
|
|
1108
|
+
if (stream.setHeader) {
|
|
1109
|
+
stream[kAborted] = true;
|
|
1110
|
+
stream.abort();
|
|
1111
|
+
|
|
1112
|
+
if (stream.socket && !stream.socket.destroyed) {
|
|
1113
|
+
//
|
|
1114
|
+
// On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if
|
|
1115
|
+
// called after the request completed. See
|
|
1116
|
+
// https://github.com/websockets/ws/issues/1869.
|
|
1117
|
+
//
|
|
1118
|
+
stream.socket.destroy();
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
process.nextTick(emitErrorAndClose, websocket, err);
|
|
1122
|
+
} else {
|
|
1123
|
+
stream.destroy(err);
|
|
1124
|
+
stream.once('error', websocket.emit.bind(websocket, 'error'));
|
|
1125
|
+
stream.once('close', websocket.emitClose.bind(websocket));
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Handle cases where the `ping()`, `pong()`, or `send()` methods are called
|
|
1131
|
+
* when the `readyState` attribute is `CLOSING` or `CLOSED`.
|
|
1132
|
+
*
|
|
1133
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
1134
|
+
* @param {*} [data] The data to send
|
|
1135
|
+
* @param {Function} [cb] Callback
|
|
1136
|
+
* @private
|
|
1137
|
+
*/
|
|
1138
|
+
function sendAfterClose(websocket, data, cb) {
|
|
1139
|
+
if (data) {
|
|
1140
|
+
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
1141
|
+
|
|
1142
|
+
//
|
|
1143
|
+
// The `_bufferedAmount` property is used only when the peer is a client and
|
|
1144
|
+
// the opening handshake fails. Under these circumstances, in fact, the
|
|
1145
|
+
// `setSocket()` method is not called, so the `_socket` and `_sender`
|
|
1146
|
+
// properties are set to `null`.
|
|
1147
|
+
//
|
|
1148
|
+
if (websocket._socket) websocket._sender._bufferedBytes += length;
|
|
1149
|
+
else websocket._bufferedAmount += length;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
if (cb) {
|
|
1153
|
+
const err = new Error(
|
|
1154
|
+
`WebSocket is not open: readyState ${websocket.readyState} ` +
|
|
1155
|
+
`(${readyStates[websocket.readyState]})`
|
|
1156
|
+
);
|
|
1157
|
+
process.nextTick(cb, err);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* The listener of the `Receiver` `'conclude'` event.
|
|
1163
|
+
*
|
|
1164
|
+
* @param {Number} code The status code
|
|
1165
|
+
* @param {Buffer} reason The reason for closing
|
|
1166
|
+
* @private
|
|
1167
|
+
*/
|
|
1168
|
+
function receiverOnConclude(code, reason) {
|
|
1169
|
+
const websocket = this[kWebSocket];
|
|
1170
|
+
|
|
1171
|
+
websocket._closeFrameReceived = true;
|
|
1172
|
+
websocket._closeMessage = reason;
|
|
1173
|
+
websocket._closeCode = code;
|
|
1174
|
+
|
|
1175
|
+
if (websocket._socket[kWebSocket] === undefined) return;
|
|
1176
|
+
|
|
1177
|
+
websocket._socket.removeListener('data', socketOnData);
|
|
1178
|
+
process.nextTick(resume, websocket._socket);
|
|
1179
|
+
|
|
1180
|
+
if (code === 1005) websocket.close();
|
|
1181
|
+
else websocket.close(code, reason);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* The listener of the `Receiver` `'drain'` event.
|
|
1186
|
+
*
|
|
1187
|
+
* @private
|
|
1188
|
+
*/
|
|
1189
|
+
function receiverOnDrain() {
|
|
1190
|
+
const websocket = this[kWebSocket];
|
|
1191
|
+
|
|
1192
|
+
if (!websocket.isPaused) websocket._socket.resume();
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* The listener of the `Receiver` `'error'` event.
|
|
1197
|
+
*
|
|
1198
|
+
* @param {(RangeError|Error)} err The emitted error
|
|
1199
|
+
* @private
|
|
1200
|
+
*/
|
|
1201
|
+
function receiverOnError(err) {
|
|
1202
|
+
const websocket = this[kWebSocket];
|
|
1203
|
+
|
|
1204
|
+
if (websocket._socket[kWebSocket] !== undefined) {
|
|
1205
|
+
websocket._socket.removeListener('data', socketOnData);
|
|
1206
|
+
|
|
1207
|
+
//
|
|
1208
|
+
// On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See
|
|
1209
|
+
// https://github.com/websockets/ws/issues/1940.
|
|
1210
|
+
//
|
|
1211
|
+
process.nextTick(resume, websocket._socket);
|
|
1212
|
+
|
|
1213
|
+
websocket.close(err[kStatusCode]);
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
if (!websocket._errorEmitted) {
|
|
1217
|
+
websocket._errorEmitted = true;
|
|
1218
|
+
websocket.emit('error', err);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* The listener of the `Receiver` `'finish'` event.
|
|
1224
|
+
*
|
|
1225
|
+
* @private
|
|
1226
|
+
*/
|
|
1227
|
+
function receiverOnFinish() {
|
|
1228
|
+
this[kWebSocket].emitClose();
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* The listener of the `Receiver` `'message'` event.
|
|
1233
|
+
*
|
|
1234
|
+
* @param {Buffer|ArrayBuffer|Buffer[])} data The message
|
|
1235
|
+
* @param {Boolean} isBinary Specifies whether the message is binary or not
|
|
1236
|
+
* @private
|
|
1237
|
+
*/
|
|
1238
|
+
function receiverOnMessage(data, isBinary) {
|
|
1239
|
+
this[kWebSocket].emit('message', data, isBinary);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* The listener of the `Receiver` `'ping'` event.
|
|
1244
|
+
*
|
|
1245
|
+
* @param {Buffer} data The data included in the ping frame
|
|
1246
|
+
* @private
|
|
1247
|
+
*/
|
|
1248
|
+
function receiverOnPing(data) {
|
|
1249
|
+
const websocket = this[kWebSocket];
|
|
1250
|
+
|
|
1251
|
+
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
|
|
1252
|
+
websocket.emit('ping', data);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* The listener of the `Receiver` `'pong'` event.
|
|
1257
|
+
*
|
|
1258
|
+
* @param {Buffer} data The data included in the pong frame
|
|
1259
|
+
* @private
|
|
1260
|
+
*/
|
|
1261
|
+
function receiverOnPong(data) {
|
|
1262
|
+
this[kWebSocket].emit('pong', data);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Resume a readable stream
|
|
1267
|
+
*
|
|
1268
|
+
* @param {Readable} stream The readable stream
|
|
1269
|
+
* @private
|
|
1270
|
+
*/
|
|
1271
|
+
function resume(stream) {
|
|
1272
|
+
stream.resume();
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* The `Sender` error event handler.
|
|
1277
|
+
*
|
|
1278
|
+
* @param {Error} The error
|
|
1279
|
+
* @private
|
|
1280
|
+
*/
|
|
1281
|
+
function senderOnError(err) {
|
|
1282
|
+
const websocket = this[kWebSocket];
|
|
1283
|
+
|
|
1284
|
+
if (websocket.readyState === WebSocket.CLOSED) return;
|
|
1285
|
+
if (websocket.readyState === WebSocket.OPEN) {
|
|
1286
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1287
|
+
setCloseTimer(websocket);
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
//
|
|
1291
|
+
// `socket.end()` is used instead of `socket.destroy()` to allow the other
|
|
1292
|
+
// peer to finish sending queued data. There is no need to set a timer here
|
|
1293
|
+
// because `CLOSING` means that it is already set or not needed.
|
|
1294
|
+
//
|
|
1295
|
+
this._socket.end();
|
|
1296
|
+
|
|
1297
|
+
if (!websocket._errorEmitted) {
|
|
1298
|
+
websocket._errorEmitted = true;
|
|
1299
|
+
websocket.emit('error', err);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Set a timer to destroy the underlying raw socket of a WebSocket.
|
|
1305
|
+
*
|
|
1306
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
1307
|
+
* @private
|
|
1308
|
+
*/
|
|
1309
|
+
function setCloseTimer(websocket) {
|
|
1310
|
+
websocket._closeTimer = setTimeout(
|
|
1311
|
+
websocket._socket.destroy.bind(websocket._socket),
|
|
1312
|
+
websocket._closeTimeout
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* The listener of the socket `'close'` event.
|
|
1318
|
+
*
|
|
1319
|
+
* @private
|
|
1320
|
+
*/
|
|
1321
|
+
function socketOnClose() {
|
|
1322
|
+
const websocket = this[kWebSocket];
|
|
1323
|
+
|
|
1324
|
+
this.removeListener('close', socketOnClose);
|
|
1325
|
+
this.removeListener('data', socketOnData);
|
|
1326
|
+
this.removeListener('end', socketOnEnd);
|
|
1327
|
+
|
|
1328
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1329
|
+
|
|
1330
|
+
//
|
|
1331
|
+
// The close frame might not have been received or the `'end'` event emitted,
|
|
1332
|
+
// for example, if the socket was destroyed due to an error. Ensure that the
|
|
1333
|
+
// `receiver` stream is closed after writing any remaining buffered data to
|
|
1334
|
+
// it. If the readable side of the socket is in flowing mode then there is no
|
|
1335
|
+
// buffered data as everything has been already written. If instead, the
|
|
1336
|
+
// socket is paused, any possible buffered data will be read as a single
|
|
1337
|
+
// chunk.
|
|
1338
|
+
//
|
|
1339
|
+
if (
|
|
1340
|
+
!this._readableState.endEmitted &&
|
|
1341
|
+
!websocket._closeFrameReceived &&
|
|
1342
|
+
!websocket._receiver._writableState.errorEmitted &&
|
|
1343
|
+
this._readableState.length !== 0
|
|
1344
|
+
) {
|
|
1345
|
+
const chunk = this.read(this._readableState.length);
|
|
1346
|
+
|
|
1347
|
+
websocket._receiver.write(chunk);
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
websocket._receiver.end();
|
|
1351
|
+
|
|
1352
|
+
this[kWebSocket] = undefined;
|
|
1353
|
+
|
|
1354
|
+
clearTimeout(websocket._closeTimer);
|
|
1355
|
+
|
|
1356
|
+
if (
|
|
1357
|
+
websocket._receiver._writableState.finished ||
|
|
1358
|
+
websocket._receiver._writableState.errorEmitted
|
|
1359
|
+
) {
|
|
1360
|
+
websocket.emitClose();
|
|
1361
|
+
} else {
|
|
1362
|
+
websocket._receiver.on('error', receiverOnFinish);
|
|
1363
|
+
websocket._receiver.on('finish', receiverOnFinish);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* The listener of the socket `'data'` event.
|
|
1369
|
+
*
|
|
1370
|
+
* @param {Buffer} chunk A chunk of data
|
|
1371
|
+
* @private
|
|
1372
|
+
*/
|
|
1373
|
+
function socketOnData(chunk) {
|
|
1374
|
+
if (!this[kWebSocket]._receiver.write(chunk)) {
|
|
1375
|
+
this.pause();
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* The listener of the socket `'end'` event.
|
|
1381
|
+
*
|
|
1382
|
+
* @private
|
|
1383
|
+
*/
|
|
1384
|
+
function socketOnEnd() {
|
|
1385
|
+
const websocket = this[kWebSocket];
|
|
1386
|
+
|
|
1387
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1388
|
+
websocket._receiver.end();
|
|
1389
|
+
this.end();
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* The listener of the socket `'error'` event.
|
|
1394
|
+
*
|
|
1395
|
+
* @private
|
|
1396
|
+
*/
|
|
1397
|
+
function socketOnError() {
|
|
1398
|
+
const websocket = this[kWebSocket];
|
|
1399
|
+
|
|
1400
|
+
this.removeListener('error', socketOnError);
|
|
1401
|
+
this.on('error', NOOP);
|
|
1402
|
+
|
|
1403
|
+
if (websocket) {
|
|
1404
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
1405
|
+
this.destroy();
|
|
1406
|
+
}
|
|
1407
|
+
}
|