@openclaw/mattermost 2026.9.3 → 2026.9.5
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/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/channel-plugin-api-CKz3b0dp.mjs +40 -0
- package/dist/.setup/channel-plugin-api-N-mnrhds.mjs +3 -0
- package/dist/{channel-plugin-runtime-C4u91PKh.js → .setup/channel-plugin-runtime-Ca4cZHq2.mjs} +15 -30
- package/dist/{channel.runtime-CGEfnc2y.js → .setup/channel.runtime-C074p7wv.mjs} +377 -115
- package/dist/{client-Dt7Q-j5B.js → .setup/client-Cx71KZ1x.mjs} +27 -15
- package/dist/{interactions-DF1FH27_.js → .setup/interactions-BG-CQbVD.mjs} +3 -3
- package/dist/{monitor-auth-C6RGYyn-.js → .setup/monitor-auth-DBoM2Bja.mjs} +16 -3
- package/dist/{normalize-R-ATEEHC.js → .setup/normalize-BQzx2u8S.mjs} +47 -7
- package/dist/.setup/secret-contract-api-Drab0Nqx.mjs +3 -0
- package/dist/{slash-state-BjBTvP7u.js → .setup/slash-state-CmyIYDIc.mjs} +59 -15
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +2 -39
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/gateway-auth-api.js +1 -1
- package/dist/policy-api.js +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -2
- package/dist/slash-route-api.js +1 -1
- package/node_modules/zod/README.md +27 -0
- package/node_modules/zod/compile.cjs +77 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +2 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/package.json +13 -2
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +452 -262
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +720 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +183 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +33 -2
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +127 -5
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +1639 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +10 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +135 -56
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +72 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +43 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +30 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +2 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +11 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +4 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -18
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +82 -19
- package/node_modules/zod/v4/core/doc.cjs +5 -7
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +272 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +195 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +15 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +12 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +63 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/parse.cjs +3 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +16 -29
- package/package.json +8 -8
- package/node_modules/ws/LICENSE +0 -20
- package/node_modules/ws/README.md +0 -548
- package/node_modules/ws/browser.js +0 -8
- package/node_modules/ws/index.js +0 -22
- package/node_modules/ws/lib/buffer-util.js +0 -131
- package/node_modules/ws/lib/constants.js +0 -19
- package/node_modules/ws/lib/event-target.js +0 -292
- package/node_modules/ws/lib/extension.js +0 -203
- package/node_modules/ws/lib/limiter.js +0 -55
- package/node_modules/ws/lib/permessage-deflate.js +0 -530
- package/node_modules/ws/lib/receiver.js +0 -743
- package/node_modules/ws/lib/sender.js +0 -607
- package/node_modules/ws/lib/stream.js +0 -161
- package/node_modules/ws/lib/subprotocol.js +0 -62
- package/node_modules/ws/lib/validation.js +0 -152
- package/node_modules/ws/lib/websocket-server.js +0 -562
- package/node_modules/ws/lib/websocket.js +0 -1407
- package/node_modules/ws/package.json +0 -74
- package/node_modules/ws/wrapper.mjs +0 -21
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{doctor-contract-mvORF4f6.js → .setup/doctor-contract-mvORF4f6.mjs} +0 -0
- /package/dist/{gateway-auth-bypass-B93t91oq.js → .setup/gateway-auth-bypass-B93t91oq.mjs} +0 -0
- /package/dist/{ingress-identity-DNl4yQSc.js → .setup/ingress-identity-DNl4yQSc.mjs} +0 -0
- /package/dist/{runtime-CNB4YGqJ.js → .setup/runtime-CNB4YGqJ.mjs} +0 -0
- /package/dist/{secret-contract-qg3NXRlS.js → .setup/secret-contract-qg3NXRlS.mjs} +0 -0
|
@@ -1,607 +0,0 @@
|
|
|
1
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const { Duplex } = require('stream');
|
|
6
|
-
const { randomFillSync } = require('crypto');
|
|
7
|
-
const {
|
|
8
|
-
types: { isUint8Array }
|
|
9
|
-
} = require('util');
|
|
10
|
-
|
|
11
|
-
const PerMessageDeflate = require('./permessage-deflate');
|
|
12
|
-
const { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');
|
|
13
|
-
const { isBlob, isValidStatusCode } = require('./validation');
|
|
14
|
-
const { mask: applyMask, toBuffer } = require('./buffer-util');
|
|
15
|
-
|
|
16
|
-
const kByteLength = Symbol('kByteLength');
|
|
17
|
-
const maskBuffer = Buffer.alloc(4);
|
|
18
|
-
const RANDOM_POOL_SIZE = 8 * 1024;
|
|
19
|
-
let randomPool;
|
|
20
|
-
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
21
|
-
|
|
22
|
-
const DEFAULT = 0;
|
|
23
|
-
const DEFLATING = 1;
|
|
24
|
-
const GET_BLOB_DATA = 2;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* HyBi Sender implementation.
|
|
28
|
-
*/
|
|
29
|
-
class Sender {
|
|
30
|
-
/**
|
|
31
|
-
* Creates a Sender instance.
|
|
32
|
-
*
|
|
33
|
-
* @param {Duplex} socket The connection socket
|
|
34
|
-
* @param {Object} [extensions] An object containing the negotiated extensions
|
|
35
|
-
* @param {Function} [generateMask] The function used to generate the masking
|
|
36
|
-
* key
|
|
37
|
-
*/
|
|
38
|
-
constructor(socket, extensions, generateMask) {
|
|
39
|
-
this._extensions = extensions || {};
|
|
40
|
-
|
|
41
|
-
if (generateMask) {
|
|
42
|
-
this._generateMask = generateMask;
|
|
43
|
-
this._maskBuffer = Buffer.alloc(4);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this._socket = socket;
|
|
47
|
-
|
|
48
|
-
this._firstFragment = true;
|
|
49
|
-
this._compress = false;
|
|
50
|
-
|
|
51
|
-
this._bufferedBytes = 0;
|
|
52
|
-
this._queue = [];
|
|
53
|
-
this._state = DEFAULT;
|
|
54
|
-
this.onerror = NOOP;
|
|
55
|
-
this[kWebSocket] = undefined;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Frames a piece of data according to the HyBi WebSocket protocol.
|
|
60
|
-
*
|
|
61
|
-
* @param {(Buffer|String)} data The data to frame
|
|
62
|
-
* @param {Object} options Options object
|
|
63
|
-
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
64
|
-
* FIN bit
|
|
65
|
-
* @param {Function} [options.generateMask] The function used to generate the
|
|
66
|
-
* masking key
|
|
67
|
-
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
68
|
-
* `data`
|
|
69
|
-
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
70
|
-
* key
|
|
71
|
-
* @param {Number} options.opcode The opcode
|
|
72
|
-
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
73
|
-
* modified
|
|
74
|
-
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
75
|
-
* RSV1 bit
|
|
76
|
-
* @return {(Buffer|String)[]} The framed data
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
static frame(data, options) {
|
|
80
|
-
let mask;
|
|
81
|
-
let merge = false;
|
|
82
|
-
let offset = 2;
|
|
83
|
-
let skipMasking = false;
|
|
84
|
-
|
|
85
|
-
if (options.mask) {
|
|
86
|
-
mask = options.maskBuffer || maskBuffer;
|
|
87
|
-
|
|
88
|
-
if (options.generateMask) {
|
|
89
|
-
options.generateMask(mask);
|
|
90
|
-
} else {
|
|
91
|
-
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
92
|
-
/* istanbul ignore else */
|
|
93
|
-
if (randomPool === undefined) {
|
|
94
|
-
//
|
|
95
|
-
// This is lazily initialized because server-sent frames must not
|
|
96
|
-
// be masked so it may never be used.
|
|
97
|
-
//
|
|
98
|
-
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
102
|
-
randomPoolPointer = 0;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
mask[0] = randomPool[randomPoolPointer++];
|
|
106
|
-
mask[1] = randomPool[randomPoolPointer++];
|
|
107
|
-
mask[2] = randomPool[randomPoolPointer++];
|
|
108
|
-
mask[3] = randomPool[randomPoolPointer++];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
112
|
-
offset = 6;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let dataLength;
|
|
116
|
-
|
|
117
|
-
if (typeof data === 'string') {
|
|
118
|
-
if (
|
|
119
|
-
(!options.mask || skipMasking) &&
|
|
120
|
-
options[kByteLength] !== undefined
|
|
121
|
-
) {
|
|
122
|
-
dataLength = options[kByteLength];
|
|
123
|
-
} else {
|
|
124
|
-
data = Buffer.from(data);
|
|
125
|
-
dataLength = data.length;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
dataLength = data.length;
|
|
129
|
-
merge = options.mask && options.readOnly && !skipMasking;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
let payloadLength = dataLength;
|
|
133
|
-
|
|
134
|
-
if (dataLength >= 65536) {
|
|
135
|
-
offset += 8;
|
|
136
|
-
payloadLength = 127;
|
|
137
|
-
} else if (dataLength > 125) {
|
|
138
|
-
offset += 2;
|
|
139
|
-
payloadLength = 126;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
|
|
143
|
-
|
|
144
|
-
target[0] = options.fin ? options.opcode | 0x80 : options.opcode;
|
|
145
|
-
if (options.rsv1) target[0] |= 0x40;
|
|
146
|
-
|
|
147
|
-
target[1] = payloadLength;
|
|
148
|
-
|
|
149
|
-
if (payloadLength === 126) {
|
|
150
|
-
target.writeUInt16BE(dataLength, 2);
|
|
151
|
-
} else if (payloadLength === 127) {
|
|
152
|
-
target[2] = target[3] = 0;
|
|
153
|
-
target.writeUIntBE(dataLength, 4, 6);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (!options.mask) return [target, data];
|
|
157
|
-
|
|
158
|
-
target[1] |= 0x80;
|
|
159
|
-
target[offset - 4] = mask[0];
|
|
160
|
-
target[offset - 3] = mask[1];
|
|
161
|
-
target[offset - 2] = mask[2];
|
|
162
|
-
target[offset - 1] = mask[3];
|
|
163
|
-
|
|
164
|
-
if (skipMasking) return [target, data];
|
|
165
|
-
|
|
166
|
-
if (merge) {
|
|
167
|
-
applyMask(data, mask, target, offset, dataLength);
|
|
168
|
-
return [target];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
applyMask(data, mask, data, 0, dataLength);
|
|
172
|
-
return [target, data];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Sends a close message to the other peer.
|
|
177
|
-
*
|
|
178
|
-
* @param {Number} [code] The status code component of the body
|
|
179
|
-
* @param {(String|Buffer)} [data] The message component of the body
|
|
180
|
-
* @param {Boolean} [mask=false] Specifies whether or not to mask the message
|
|
181
|
-
* @param {Function} [cb] Callback
|
|
182
|
-
* @public
|
|
183
|
-
*/
|
|
184
|
-
close(code, data, mask, cb) {
|
|
185
|
-
let buf;
|
|
186
|
-
|
|
187
|
-
if (code === undefined) {
|
|
188
|
-
buf = EMPTY_BUFFER;
|
|
189
|
-
} else if (typeof code !== 'number' || !isValidStatusCode(code)) {
|
|
190
|
-
throw new TypeError('First argument must be a valid error code number');
|
|
191
|
-
} else if (data === undefined || !data.length) {
|
|
192
|
-
buf = Buffer.allocUnsafe(2);
|
|
193
|
-
buf.writeUInt16BE(code, 0);
|
|
194
|
-
} else {
|
|
195
|
-
const length = Buffer.byteLength(data);
|
|
196
|
-
|
|
197
|
-
if (length > 123) {
|
|
198
|
-
throw new RangeError('The message must not be greater than 123 bytes');
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
buf = Buffer.allocUnsafe(2 + length);
|
|
202
|
-
buf.writeUInt16BE(code, 0);
|
|
203
|
-
|
|
204
|
-
if (typeof data === 'string') {
|
|
205
|
-
buf.write(data, 2);
|
|
206
|
-
} else if (isUint8Array(data)) {
|
|
207
|
-
buf.set(data, 2);
|
|
208
|
-
} else {
|
|
209
|
-
throw new TypeError('Second argument must be a string or a Uint8Array');
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const options = {
|
|
214
|
-
[kByteLength]: buf.length,
|
|
215
|
-
fin: true,
|
|
216
|
-
generateMask: this._generateMask,
|
|
217
|
-
mask,
|
|
218
|
-
maskBuffer: this._maskBuffer,
|
|
219
|
-
opcode: 0x08,
|
|
220
|
-
readOnly: false,
|
|
221
|
-
rsv1: false
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
if (this._state !== DEFAULT) {
|
|
225
|
-
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
226
|
-
} else {
|
|
227
|
-
this.sendFrame(Sender.frame(buf, options), cb);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Sends a ping message to the other peer.
|
|
233
|
-
*
|
|
234
|
-
* @param {*} data The message to send
|
|
235
|
-
* @param {Boolean} [mask=false] Specifies whether or not to mask `data`
|
|
236
|
-
* @param {Function} [cb] Callback
|
|
237
|
-
* @public
|
|
238
|
-
*/
|
|
239
|
-
ping(data, mask, cb) {
|
|
240
|
-
let byteLength;
|
|
241
|
-
let readOnly;
|
|
242
|
-
|
|
243
|
-
if (typeof data === 'string') {
|
|
244
|
-
byteLength = Buffer.byteLength(data);
|
|
245
|
-
readOnly = false;
|
|
246
|
-
} else if (isBlob(data)) {
|
|
247
|
-
byteLength = data.size;
|
|
248
|
-
readOnly = false;
|
|
249
|
-
} else {
|
|
250
|
-
data = toBuffer(data);
|
|
251
|
-
byteLength = data.length;
|
|
252
|
-
readOnly = toBuffer.readOnly;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (byteLength > 125) {
|
|
256
|
-
throw new RangeError('The data size must not be greater than 125 bytes');
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const options = {
|
|
260
|
-
[kByteLength]: byteLength,
|
|
261
|
-
fin: true,
|
|
262
|
-
generateMask: this._generateMask,
|
|
263
|
-
mask,
|
|
264
|
-
maskBuffer: this._maskBuffer,
|
|
265
|
-
opcode: 0x09,
|
|
266
|
-
readOnly,
|
|
267
|
-
rsv1: false
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
if (isBlob(data)) {
|
|
271
|
-
if (this._state !== DEFAULT) {
|
|
272
|
-
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
273
|
-
} else {
|
|
274
|
-
this.getBlobData(data, false, options, cb);
|
|
275
|
-
}
|
|
276
|
-
} else if (this._state !== DEFAULT) {
|
|
277
|
-
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
278
|
-
} else {
|
|
279
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Sends a pong message to the other peer.
|
|
285
|
-
*
|
|
286
|
-
* @param {*} data The message to send
|
|
287
|
-
* @param {Boolean} [mask=false] Specifies whether or not to mask `data`
|
|
288
|
-
* @param {Function} [cb] Callback
|
|
289
|
-
* @public
|
|
290
|
-
*/
|
|
291
|
-
pong(data, mask, cb) {
|
|
292
|
-
let byteLength;
|
|
293
|
-
let readOnly;
|
|
294
|
-
|
|
295
|
-
if (typeof data === 'string') {
|
|
296
|
-
byteLength = Buffer.byteLength(data);
|
|
297
|
-
readOnly = false;
|
|
298
|
-
} else if (isBlob(data)) {
|
|
299
|
-
byteLength = data.size;
|
|
300
|
-
readOnly = false;
|
|
301
|
-
} else {
|
|
302
|
-
data = toBuffer(data);
|
|
303
|
-
byteLength = data.length;
|
|
304
|
-
readOnly = toBuffer.readOnly;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (byteLength > 125) {
|
|
308
|
-
throw new RangeError('The data size must not be greater than 125 bytes');
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const options = {
|
|
312
|
-
[kByteLength]: byteLength,
|
|
313
|
-
fin: true,
|
|
314
|
-
generateMask: this._generateMask,
|
|
315
|
-
mask,
|
|
316
|
-
maskBuffer: this._maskBuffer,
|
|
317
|
-
opcode: 0x0a,
|
|
318
|
-
readOnly,
|
|
319
|
-
rsv1: false
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
if (isBlob(data)) {
|
|
323
|
-
if (this._state !== DEFAULT) {
|
|
324
|
-
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
325
|
-
} else {
|
|
326
|
-
this.getBlobData(data, false, options, cb);
|
|
327
|
-
}
|
|
328
|
-
} else if (this._state !== DEFAULT) {
|
|
329
|
-
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
330
|
-
} else {
|
|
331
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Sends a data message to the other peer.
|
|
337
|
-
*
|
|
338
|
-
* @param {*} data The message to send
|
|
339
|
-
* @param {Object} options Options object
|
|
340
|
-
* @param {Boolean} [options.binary=false] Specifies whether `data` is binary
|
|
341
|
-
* or text
|
|
342
|
-
* @param {Boolean} [options.compress=false] Specifies whether or not to
|
|
343
|
-
* compress `data`
|
|
344
|
-
* @param {Boolean} [options.fin=false] Specifies whether the fragment is the
|
|
345
|
-
* last one
|
|
346
|
-
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
347
|
-
* `data`
|
|
348
|
-
* @param {Function} [cb] Callback
|
|
349
|
-
* @public
|
|
350
|
-
*/
|
|
351
|
-
send(data, options, cb) {
|
|
352
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
353
|
-
let opcode = options.binary ? 2 : 1;
|
|
354
|
-
let rsv1 = options.compress;
|
|
355
|
-
|
|
356
|
-
let byteLength;
|
|
357
|
-
let readOnly;
|
|
358
|
-
|
|
359
|
-
if (typeof data === 'string') {
|
|
360
|
-
byteLength = Buffer.byteLength(data);
|
|
361
|
-
readOnly = false;
|
|
362
|
-
} else if (isBlob(data)) {
|
|
363
|
-
byteLength = data.size;
|
|
364
|
-
readOnly = false;
|
|
365
|
-
} else {
|
|
366
|
-
data = toBuffer(data);
|
|
367
|
-
byteLength = data.length;
|
|
368
|
-
readOnly = toBuffer.readOnly;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (this._firstFragment) {
|
|
372
|
-
this._firstFragment = false;
|
|
373
|
-
if (
|
|
374
|
-
rsv1 &&
|
|
375
|
-
perMessageDeflate &&
|
|
376
|
-
perMessageDeflate.params[
|
|
377
|
-
perMessageDeflate._isServer
|
|
378
|
-
? 'server_no_context_takeover'
|
|
379
|
-
: 'client_no_context_takeover'
|
|
380
|
-
]
|
|
381
|
-
) {
|
|
382
|
-
rsv1 = byteLength >= perMessageDeflate._threshold;
|
|
383
|
-
}
|
|
384
|
-
this._compress = rsv1;
|
|
385
|
-
} else {
|
|
386
|
-
rsv1 = false;
|
|
387
|
-
opcode = 0;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (options.fin) this._firstFragment = true;
|
|
391
|
-
|
|
392
|
-
const opts = {
|
|
393
|
-
[kByteLength]: byteLength,
|
|
394
|
-
fin: options.fin,
|
|
395
|
-
generateMask: this._generateMask,
|
|
396
|
-
mask: options.mask,
|
|
397
|
-
maskBuffer: this._maskBuffer,
|
|
398
|
-
opcode,
|
|
399
|
-
readOnly,
|
|
400
|
-
rsv1
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
if (isBlob(data)) {
|
|
404
|
-
if (this._state !== DEFAULT) {
|
|
405
|
-
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
406
|
-
} else {
|
|
407
|
-
this.getBlobData(data, this._compress, opts, cb);
|
|
408
|
-
}
|
|
409
|
-
} else if (this._state !== DEFAULT) {
|
|
410
|
-
this.enqueue([this.dispatch, data, this._compress, opts, cb]);
|
|
411
|
-
} else {
|
|
412
|
-
this.dispatch(data, this._compress, opts, cb);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Gets the contents of a blob as binary data.
|
|
418
|
-
*
|
|
419
|
-
* @param {Blob} blob The blob
|
|
420
|
-
* @param {Boolean} [compress=false] Specifies whether or not to compress
|
|
421
|
-
* the data
|
|
422
|
-
* @param {Object} options Options object
|
|
423
|
-
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
424
|
-
* FIN bit
|
|
425
|
-
* @param {Function} [options.generateMask] The function used to generate the
|
|
426
|
-
* masking key
|
|
427
|
-
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
428
|
-
* `data`
|
|
429
|
-
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
430
|
-
* key
|
|
431
|
-
* @param {Number} options.opcode The opcode
|
|
432
|
-
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
433
|
-
* modified
|
|
434
|
-
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
435
|
-
* RSV1 bit
|
|
436
|
-
* @param {Function} [cb] Callback
|
|
437
|
-
* @private
|
|
438
|
-
*/
|
|
439
|
-
getBlobData(blob, compress, options, cb) {
|
|
440
|
-
this._bufferedBytes += options[kByteLength];
|
|
441
|
-
this._state = GET_BLOB_DATA;
|
|
442
|
-
|
|
443
|
-
blob
|
|
444
|
-
.arrayBuffer()
|
|
445
|
-
.then((arrayBuffer) => {
|
|
446
|
-
if (this._socket.destroyed) {
|
|
447
|
-
const err = new Error(
|
|
448
|
-
'The socket was closed while the blob was being read'
|
|
449
|
-
);
|
|
450
|
-
|
|
451
|
-
//
|
|
452
|
-
// `callCallbacks` is called in the next tick to ensure that errors
|
|
453
|
-
// that might be thrown in the callbacks behave like errors thrown
|
|
454
|
-
// outside the promise chain.
|
|
455
|
-
//
|
|
456
|
-
process.nextTick(callCallbacks, this, err, cb);
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
this._bufferedBytes -= options[kByteLength];
|
|
461
|
-
const data = toBuffer(arrayBuffer);
|
|
462
|
-
|
|
463
|
-
if (!compress) {
|
|
464
|
-
this._state = DEFAULT;
|
|
465
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
466
|
-
this.dequeue();
|
|
467
|
-
} else {
|
|
468
|
-
this.dispatch(data, compress, options, cb);
|
|
469
|
-
}
|
|
470
|
-
})
|
|
471
|
-
.catch((err) => {
|
|
472
|
-
//
|
|
473
|
-
// `onError` is called in the next tick for the same reason that
|
|
474
|
-
// `callCallbacks` above is.
|
|
475
|
-
//
|
|
476
|
-
process.nextTick(onError, this, err, cb);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Dispatches a message.
|
|
482
|
-
*
|
|
483
|
-
* @param {(Buffer|String)} data The message to send
|
|
484
|
-
* @param {Boolean} [compress=false] Specifies whether or not to compress
|
|
485
|
-
* `data`
|
|
486
|
-
* @param {Object} options Options object
|
|
487
|
-
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
488
|
-
* FIN bit
|
|
489
|
-
* @param {Function} [options.generateMask] The function used to generate the
|
|
490
|
-
* masking key
|
|
491
|
-
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
492
|
-
* `data`
|
|
493
|
-
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
494
|
-
* key
|
|
495
|
-
* @param {Number} options.opcode The opcode
|
|
496
|
-
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
497
|
-
* modified
|
|
498
|
-
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
499
|
-
* RSV1 bit
|
|
500
|
-
* @param {Function} [cb] Callback
|
|
501
|
-
* @private
|
|
502
|
-
*/
|
|
503
|
-
dispatch(data, compress, options, cb) {
|
|
504
|
-
if (!compress) {
|
|
505
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
510
|
-
|
|
511
|
-
this._bufferedBytes += options[kByteLength];
|
|
512
|
-
this._state = DEFLATING;
|
|
513
|
-
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
514
|
-
if (this._socket.destroyed) {
|
|
515
|
-
const err = new Error(
|
|
516
|
-
'The socket was closed while data was being compressed'
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
callCallbacks(this, err, cb);
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
this._bufferedBytes -= options[kByteLength];
|
|
524
|
-
this._state = DEFAULT;
|
|
525
|
-
options.readOnly = false;
|
|
526
|
-
this.sendFrame(Sender.frame(buf, options), cb);
|
|
527
|
-
this.dequeue();
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Executes queued send operations.
|
|
533
|
-
*
|
|
534
|
-
* @private
|
|
535
|
-
*/
|
|
536
|
-
dequeue() {
|
|
537
|
-
while (this._state === DEFAULT && this._queue.length) {
|
|
538
|
-
const params = this._queue.shift();
|
|
539
|
-
|
|
540
|
-
this._bufferedBytes -= params[3][kByteLength];
|
|
541
|
-
Reflect.apply(params[0], this, params.slice(1));
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Enqueues a send operation.
|
|
547
|
-
*
|
|
548
|
-
* @param {Array} params Send operation parameters.
|
|
549
|
-
* @private
|
|
550
|
-
*/
|
|
551
|
-
enqueue(params) {
|
|
552
|
-
this._bufferedBytes += params[3][kByteLength];
|
|
553
|
-
this._queue.push(params);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Sends a frame.
|
|
558
|
-
*
|
|
559
|
-
* @param {(Buffer | String)[]} list The frame to send
|
|
560
|
-
* @param {Function} [cb] Callback
|
|
561
|
-
* @private
|
|
562
|
-
*/
|
|
563
|
-
sendFrame(list, cb) {
|
|
564
|
-
if (list.length === 2) {
|
|
565
|
-
this._socket.cork();
|
|
566
|
-
this._socket.write(list[0]);
|
|
567
|
-
this._socket.write(list[1], cb);
|
|
568
|
-
this._socket.uncork();
|
|
569
|
-
} else {
|
|
570
|
-
this._socket.write(list[0], cb);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
module.exports = Sender;
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Calls queued callbacks with an error.
|
|
579
|
-
*
|
|
580
|
-
* @param {Sender} sender The `Sender` instance
|
|
581
|
-
* @param {Error} err The error to call the callbacks with
|
|
582
|
-
* @param {Function} [cb] The first callback
|
|
583
|
-
* @private
|
|
584
|
-
*/
|
|
585
|
-
function callCallbacks(sender, err, cb) {
|
|
586
|
-
if (typeof cb === 'function') cb(err);
|
|
587
|
-
|
|
588
|
-
for (let i = 0; i < sender._queue.length; i++) {
|
|
589
|
-
const params = sender._queue[i];
|
|
590
|
-
const callback = params[params.length - 1];
|
|
591
|
-
|
|
592
|
-
if (typeof callback === 'function') callback(err);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Handles a `Sender` error.
|
|
598
|
-
*
|
|
599
|
-
* @param {Sender} sender The `Sender` instance
|
|
600
|
-
* @param {Error} err The error
|
|
601
|
-
* @param {Function} [cb] The first pending callback
|
|
602
|
-
* @private
|
|
603
|
-
*/
|
|
604
|
-
function onError(sender, err, cb) {
|
|
605
|
-
callCallbacks(sender, err, cb);
|
|
606
|
-
sender.onerror(err);
|
|
607
|
-
}
|