@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,562 +0,0 @@
|
|
|
1
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const EventEmitter = require('events');
|
|
6
|
-
const http = require('http');
|
|
7
|
-
const { Duplex } = require('stream');
|
|
8
|
-
const { createHash } = require('crypto');
|
|
9
|
-
|
|
10
|
-
const extension = require('./extension');
|
|
11
|
-
const PerMessageDeflate = require('./permessage-deflate');
|
|
12
|
-
const subprotocol = require('./subprotocol');
|
|
13
|
-
const WebSocket = require('./websocket');
|
|
14
|
-
const { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants');
|
|
15
|
-
|
|
16
|
-
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
17
|
-
|
|
18
|
-
const RUNNING = 0;
|
|
19
|
-
const CLOSING = 1;
|
|
20
|
-
const CLOSED = 2;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Class representing a WebSocket server.
|
|
24
|
-
*
|
|
25
|
-
* @extends EventEmitter
|
|
26
|
-
*/
|
|
27
|
-
class WebSocketServer extends EventEmitter {
|
|
28
|
-
/**
|
|
29
|
-
* Create a `WebSocketServer` instance.
|
|
30
|
-
*
|
|
31
|
-
* @param {Object} options Configuration options
|
|
32
|
-
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
33
|
-
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
34
|
-
* multiple times in the same tick
|
|
35
|
-
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
36
|
-
* automatically send a pong in response to a ping
|
|
37
|
-
* @param {Number} [options.backlog=511] The maximum length of the queue of
|
|
38
|
-
* pending connections
|
|
39
|
-
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
40
|
-
* track clients
|
|
41
|
-
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
42
|
-
* wait for the closing handshake to finish after `websocket.close()` is
|
|
43
|
-
* called
|
|
44
|
-
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
45
|
-
* @param {String} [options.host] The hostname where to bind the server
|
|
46
|
-
* @param {Number} [options.maxBufferedChunks=262144] The maximum number of
|
|
47
|
-
* buffered data chunks
|
|
48
|
-
* @param {Number} [options.maxFragments=16384] The maximum number of message
|
|
49
|
-
* fragments
|
|
50
|
-
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
51
|
-
* size
|
|
52
|
-
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
53
|
-
* @param {String} [options.path] Accept only connections matching this path
|
|
54
|
-
* @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
|
|
55
|
-
* permessage-deflate
|
|
56
|
-
* @param {Number} [options.port] The port where to bind the server
|
|
57
|
-
* @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S
|
|
58
|
-
* server to use
|
|
59
|
-
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
60
|
-
* not to skip UTF-8 validation for text and close messages
|
|
61
|
-
* @param {Function} [options.verifyClient] A hook to reject connections
|
|
62
|
-
* @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
|
|
63
|
-
* class to use. It must be the `WebSocket` class or class that extends it
|
|
64
|
-
* @param {Function} [callback] A listener for the `listening` event
|
|
65
|
-
*/
|
|
66
|
-
constructor(options, callback) {
|
|
67
|
-
super();
|
|
68
|
-
|
|
69
|
-
options = {
|
|
70
|
-
allowSynchronousEvents: true,
|
|
71
|
-
autoPong: true,
|
|
72
|
-
maxBufferedChunks: 256 * 1024,
|
|
73
|
-
maxFragments: 16 * 1024,
|
|
74
|
-
maxPayload: 100 * 1024 * 1024,
|
|
75
|
-
skipUTF8Validation: false,
|
|
76
|
-
perMessageDeflate: false,
|
|
77
|
-
handleProtocols: null,
|
|
78
|
-
clientTracking: true,
|
|
79
|
-
closeTimeout: CLOSE_TIMEOUT,
|
|
80
|
-
verifyClient: null,
|
|
81
|
-
noServer: false,
|
|
82
|
-
backlog: null, // use default (511 as implemented in net.js)
|
|
83
|
-
server: null,
|
|
84
|
-
host: null,
|
|
85
|
-
path: null,
|
|
86
|
-
port: null,
|
|
87
|
-
WebSocket,
|
|
88
|
-
...options
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
(options.port == null && !options.server && !options.noServer) ||
|
|
93
|
-
(options.port != null && (options.server || options.noServer)) ||
|
|
94
|
-
(options.server && options.noServer)
|
|
95
|
-
) {
|
|
96
|
-
throw new TypeError(
|
|
97
|
-
'One and only one of the "port", "server", or "noServer" options ' +
|
|
98
|
-
'must be specified'
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (options.port != null) {
|
|
103
|
-
this._server = http.createServer((req, res) => {
|
|
104
|
-
const body = http.STATUS_CODES[426];
|
|
105
|
-
|
|
106
|
-
res.writeHead(426, {
|
|
107
|
-
'Content-Length': body.length,
|
|
108
|
-
'Content-Type': 'text/plain'
|
|
109
|
-
});
|
|
110
|
-
res.end(body);
|
|
111
|
-
});
|
|
112
|
-
this._server.listen(
|
|
113
|
-
options.port,
|
|
114
|
-
options.host,
|
|
115
|
-
options.backlog,
|
|
116
|
-
callback
|
|
117
|
-
);
|
|
118
|
-
} else if (options.server) {
|
|
119
|
-
this._server = options.server;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (this._server) {
|
|
123
|
-
const emitConnection = this.emit.bind(this, 'connection');
|
|
124
|
-
|
|
125
|
-
this._removeListeners = addListeners(this._server, {
|
|
126
|
-
listening: this.emit.bind(this, 'listening'),
|
|
127
|
-
error: this.emit.bind(this, 'error'),
|
|
128
|
-
upgrade: (req, socket, head) => {
|
|
129
|
-
this.handleUpgrade(req, socket, head, emitConnection);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (options.perMessageDeflate === true) options.perMessageDeflate = {};
|
|
135
|
-
if (options.clientTracking) {
|
|
136
|
-
this.clients = new Set();
|
|
137
|
-
this._shouldEmitClose = false;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.options = options;
|
|
141
|
-
this._state = RUNNING;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Returns the bound address, the address family name, and port of the server
|
|
146
|
-
* as reported by the operating system if listening on an IP socket.
|
|
147
|
-
* If the server is listening on a pipe or UNIX domain socket, the name is
|
|
148
|
-
* returned as a string.
|
|
149
|
-
*
|
|
150
|
-
* @return {(Object|String|null)} The address of the server
|
|
151
|
-
* @public
|
|
152
|
-
*/
|
|
153
|
-
address() {
|
|
154
|
-
if (this.options.noServer) {
|
|
155
|
-
throw new Error('The server is operating in "noServer" mode');
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (!this._server) return null;
|
|
159
|
-
return this._server.address();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Stop the server from accepting new connections and emit the `'close'` event
|
|
164
|
-
* when all existing connections are closed.
|
|
165
|
-
*
|
|
166
|
-
* @param {Function} [cb] A one-time listener for the `'close'` event
|
|
167
|
-
* @public
|
|
168
|
-
*/
|
|
169
|
-
close(cb) {
|
|
170
|
-
if (this._state === CLOSED) {
|
|
171
|
-
if (cb) {
|
|
172
|
-
this.once('close', () => {
|
|
173
|
-
cb(new Error('The server is not running'));
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
process.nextTick(emitClose, this);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (cb) this.once('close', cb);
|
|
182
|
-
|
|
183
|
-
if (this._state === CLOSING) return;
|
|
184
|
-
this._state = CLOSING;
|
|
185
|
-
|
|
186
|
-
if (this.options.noServer || this.options.server) {
|
|
187
|
-
if (this._server) {
|
|
188
|
-
this._removeListeners();
|
|
189
|
-
this._removeListeners = this._server = null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (this.clients) {
|
|
193
|
-
if (!this.clients.size) {
|
|
194
|
-
process.nextTick(emitClose, this);
|
|
195
|
-
} else {
|
|
196
|
-
this._shouldEmitClose = true;
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
process.nextTick(emitClose, this);
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
const server = this._server;
|
|
203
|
-
|
|
204
|
-
this._removeListeners();
|
|
205
|
-
this._removeListeners = this._server = null;
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
// The HTTP/S server was created internally. Close it, and rely on its
|
|
209
|
-
// `'close'` event.
|
|
210
|
-
//
|
|
211
|
-
server.close(() => {
|
|
212
|
-
emitClose(this);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* See if a given request should be handled by this server instance.
|
|
219
|
-
*
|
|
220
|
-
* @param {http.IncomingMessage} req Request object to inspect
|
|
221
|
-
* @return {Boolean} `true` if the request is valid, else `false`
|
|
222
|
-
* @public
|
|
223
|
-
*/
|
|
224
|
-
shouldHandle(req) {
|
|
225
|
-
if (this.options.path) {
|
|
226
|
-
const index = req.url.indexOf('?');
|
|
227
|
-
const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
|
|
228
|
-
|
|
229
|
-
if (pathname !== this.options.path) return false;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Handle a HTTP Upgrade request.
|
|
237
|
-
*
|
|
238
|
-
* @param {http.IncomingMessage} req The request object
|
|
239
|
-
* @param {Duplex} socket The network socket between the server and client
|
|
240
|
-
* @param {Buffer} head The first packet of the upgraded stream
|
|
241
|
-
* @param {Function} cb Callback
|
|
242
|
-
* @public
|
|
243
|
-
*/
|
|
244
|
-
handleUpgrade(req, socket, head, cb) {
|
|
245
|
-
socket.on('error', socketOnError);
|
|
246
|
-
|
|
247
|
-
const key = req.headers['sec-websocket-key'];
|
|
248
|
-
const upgrade = req.headers.upgrade;
|
|
249
|
-
const version = +req.headers['sec-websocket-version'];
|
|
250
|
-
|
|
251
|
-
if (req.method !== 'GET') {
|
|
252
|
-
const message = 'Invalid HTTP method';
|
|
253
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
|
|
258
|
-
const message = 'Invalid Upgrade header';
|
|
259
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (key === undefined || !keyRegex.test(key)) {
|
|
264
|
-
const message = 'Missing or invalid Sec-WebSocket-Key header';
|
|
265
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (version !== 13 && version !== 8) {
|
|
270
|
-
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
271
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
272
|
-
'Sec-WebSocket-Version': '13, 8'
|
|
273
|
-
});
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (!this.shouldHandle(req)) {
|
|
278
|
-
abortHandshake(socket, 400);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const secWebSocketProtocol = req.headers['sec-websocket-protocol'];
|
|
283
|
-
let protocols = new Set();
|
|
284
|
-
|
|
285
|
-
if (secWebSocketProtocol !== undefined) {
|
|
286
|
-
try {
|
|
287
|
-
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
288
|
-
} catch (err) {
|
|
289
|
-
const message = 'Invalid Sec-WebSocket-Protocol header';
|
|
290
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const secWebSocketExtensions = req.headers['sec-websocket-extensions'];
|
|
296
|
-
const extensions = {};
|
|
297
|
-
|
|
298
|
-
if (
|
|
299
|
-
this.options.perMessageDeflate &&
|
|
300
|
-
secWebSocketExtensions !== undefined
|
|
301
|
-
) {
|
|
302
|
-
const perMessageDeflate = new PerMessageDeflate({
|
|
303
|
-
...this.options.perMessageDeflate,
|
|
304
|
-
isServer: true,
|
|
305
|
-
maxPayload: this.options.maxPayload
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
try {
|
|
309
|
-
const offers = extension.parse(secWebSocketExtensions);
|
|
310
|
-
|
|
311
|
-
if (offers[PerMessageDeflate.extensionName]) {
|
|
312
|
-
perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
|
|
313
|
-
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
314
|
-
}
|
|
315
|
-
} catch (err) {
|
|
316
|
-
const message =
|
|
317
|
-
'Invalid or unacceptable Sec-WebSocket-Extensions header';
|
|
318
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
//
|
|
324
|
-
// Optionally call external client verification handler.
|
|
325
|
-
//
|
|
326
|
-
if (this.options.verifyClient) {
|
|
327
|
-
const info = {
|
|
328
|
-
origin:
|
|
329
|
-
req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`],
|
|
330
|
-
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
331
|
-
req
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
if (this.options.verifyClient.length === 2) {
|
|
335
|
-
this.options.verifyClient(info, (verified, code, message, headers) => {
|
|
336
|
-
if (!verified) {
|
|
337
|
-
return abortHandshake(socket, code || 401, message, headers);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
this.completeUpgrade(
|
|
341
|
-
extensions,
|
|
342
|
-
key,
|
|
343
|
-
protocols,
|
|
344
|
-
req,
|
|
345
|
-
socket,
|
|
346
|
-
head,
|
|
347
|
-
cb
|
|
348
|
-
);
|
|
349
|
-
});
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Upgrade the connection to WebSocket.
|
|
361
|
-
*
|
|
362
|
-
* @param {Object} extensions The accepted extensions
|
|
363
|
-
* @param {String} key The value of the `Sec-WebSocket-Key` header
|
|
364
|
-
* @param {Set} protocols The subprotocols
|
|
365
|
-
* @param {http.IncomingMessage} req The request object
|
|
366
|
-
* @param {Duplex} socket The network socket between the server and client
|
|
367
|
-
* @param {Buffer} head The first packet of the upgraded stream
|
|
368
|
-
* @param {Function} cb Callback
|
|
369
|
-
* @throws {Error} If called more than once with the same socket
|
|
370
|
-
* @private
|
|
371
|
-
*/
|
|
372
|
-
completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
|
|
373
|
-
//
|
|
374
|
-
// Destroy the socket if the client has already sent a FIN packet.
|
|
375
|
-
//
|
|
376
|
-
if (!socket.readable || !socket.writable) return socket.destroy();
|
|
377
|
-
|
|
378
|
-
if (socket[kWebSocket]) {
|
|
379
|
-
throw new Error(
|
|
380
|
-
'server.handleUpgrade() was called more than once with the same ' +
|
|
381
|
-
'socket, possibly due to a misconfiguration'
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
386
|
-
|
|
387
|
-
const digest = createHash('sha1')
|
|
388
|
-
.update(key + GUID)
|
|
389
|
-
.digest('base64');
|
|
390
|
-
|
|
391
|
-
const headers = [
|
|
392
|
-
'HTTP/1.1 101 Switching Protocols',
|
|
393
|
-
'Upgrade: websocket',
|
|
394
|
-
'Connection: Upgrade',
|
|
395
|
-
`Sec-WebSocket-Accept: ${digest}`
|
|
396
|
-
];
|
|
397
|
-
|
|
398
|
-
const ws = new this.options.WebSocket(null, undefined, this.options);
|
|
399
|
-
|
|
400
|
-
if (protocols.size) {
|
|
401
|
-
//
|
|
402
|
-
// Optionally call external protocol selection handler.
|
|
403
|
-
//
|
|
404
|
-
const protocol = this.options.handleProtocols
|
|
405
|
-
? this.options.handleProtocols(protocols, req)
|
|
406
|
-
: protocols.values().next().value;
|
|
407
|
-
|
|
408
|
-
if (protocol) {
|
|
409
|
-
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
410
|
-
ws._protocol = protocol;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (extensions[PerMessageDeflate.extensionName]) {
|
|
415
|
-
const params = extensions[PerMessageDeflate.extensionName].params;
|
|
416
|
-
const value = extension.format({
|
|
417
|
-
[PerMessageDeflate.extensionName]: [params]
|
|
418
|
-
});
|
|
419
|
-
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
420
|
-
ws._extensions = extensions;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
//
|
|
424
|
-
// Allow external modification/inspection of handshake headers.
|
|
425
|
-
//
|
|
426
|
-
this.emit('headers', headers, req);
|
|
427
|
-
|
|
428
|
-
socket.write(headers.concat('\r\n').join('\r\n'));
|
|
429
|
-
socket.removeListener('error', socketOnError);
|
|
430
|
-
|
|
431
|
-
ws.setSocket(socket, head, {
|
|
432
|
-
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
433
|
-
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
434
|
-
maxFragments: this.options.maxFragments,
|
|
435
|
-
maxPayload: this.options.maxPayload,
|
|
436
|
-
skipUTF8Validation: this.options.skipUTF8Validation
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
if (this.clients) {
|
|
440
|
-
this.clients.add(ws);
|
|
441
|
-
ws.on('close', () => {
|
|
442
|
-
this.clients.delete(ws);
|
|
443
|
-
|
|
444
|
-
if (this._shouldEmitClose && !this.clients.size) {
|
|
445
|
-
process.nextTick(emitClose, this);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
cb(ws, req);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
module.exports = WebSocketServer;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Add event listeners on an `EventEmitter` using a map of <event, listener>
|
|
458
|
-
* pairs.
|
|
459
|
-
*
|
|
460
|
-
* @param {EventEmitter} server The event emitter
|
|
461
|
-
* @param {Object.<String, Function>} map The listeners to add
|
|
462
|
-
* @return {Function} A function that will remove the added listeners when
|
|
463
|
-
* called
|
|
464
|
-
* @private
|
|
465
|
-
*/
|
|
466
|
-
function addListeners(server, map) {
|
|
467
|
-
for (const event of Object.keys(map)) server.on(event, map[event]);
|
|
468
|
-
|
|
469
|
-
return function removeListeners() {
|
|
470
|
-
for (const event of Object.keys(map)) {
|
|
471
|
-
server.removeListener(event, map[event]);
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Emit a `'close'` event on an `EventEmitter`.
|
|
478
|
-
*
|
|
479
|
-
* @param {EventEmitter} server The event emitter
|
|
480
|
-
* @private
|
|
481
|
-
*/
|
|
482
|
-
function emitClose(server) {
|
|
483
|
-
server._state = CLOSED;
|
|
484
|
-
server.emit('close');
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Handle socket errors.
|
|
489
|
-
*
|
|
490
|
-
* @private
|
|
491
|
-
*/
|
|
492
|
-
function socketOnError() {
|
|
493
|
-
this.destroy();
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Close the connection when preconditions are not fulfilled.
|
|
498
|
-
*
|
|
499
|
-
* @param {Duplex} socket The socket of the upgrade request
|
|
500
|
-
* @param {Number} code The HTTP response status code
|
|
501
|
-
* @param {String} [message] The HTTP response body
|
|
502
|
-
* @param {Object} [headers] Additional HTTP response headers
|
|
503
|
-
* @private
|
|
504
|
-
*/
|
|
505
|
-
function abortHandshake(socket, code, message, headers) {
|
|
506
|
-
//
|
|
507
|
-
// The socket is writable unless the user destroyed or ended it before calling
|
|
508
|
-
// `server.handleUpgrade()` or in the `verifyClient` function, which is a user
|
|
509
|
-
// error. Handling this does not make much sense as the worst that can happen
|
|
510
|
-
// is that some of the data written by the user might be discarded due to the
|
|
511
|
-
// call to `socket.end()` below, which triggers an `'error'` event that in
|
|
512
|
-
// turn causes the socket to be destroyed.
|
|
513
|
-
//
|
|
514
|
-
message = message || http.STATUS_CODES[code];
|
|
515
|
-
headers = {
|
|
516
|
-
Connection: 'close',
|
|
517
|
-
'Content-Type': 'text/html',
|
|
518
|
-
'Content-Length': Buffer.byteLength(message),
|
|
519
|
-
...headers
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
socket.once('finish', socket.destroy);
|
|
523
|
-
|
|
524
|
-
socket.end(
|
|
525
|
-
`HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` +
|
|
526
|
-
Object.keys(headers)
|
|
527
|
-
.map((h) => `${h}: ${headers[h]}`)
|
|
528
|
-
.join('\r\n') +
|
|
529
|
-
'\r\n\r\n' +
|
|
530
|
-
message
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least
|
|
536
|
-
* one listener for it, otherwise call `abortHandshake()`.
|
|
537
|
-
*
|
|
538
|
-
* @param {WebSocketServer} server The WebSocket server
|
|
539
|
-
* @param {http.IncomingMessage} req The request object
|
|
540
|
-
* @param {Duplex} socket The socket of the upgrade request
|
|
541
|
-
* @param {Number} code The HTTP response status code
|
|
542
|
-
* @param {String} message The HTTP response body
|
|
543
|
-
* @param {Object} [headers] The HTTP response headers
|
|
544
|
-
* @private
|
|
545
|
-
*/
|
|
546
|
-
function abortHandshakeOrEmitwsClientError(
|
|
547
|
-
server,
|
|
548
|
-
req,
|
|
549
|
-
socket,
|
|
550
|
-
code,
|
|
551
|
-
message,
|
|
552
|
-
headers
|
|
553
|
-
) {
|
|
554
|
-
if (server.listenerCount('wsClientError')) {
|
|
555
|
-
const err = new Error(message);
|
|
556
|
-
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
557
|
-
|
|
558
|
-
server.emit('wsClientError', err, socket, req);
|
|
559
|
-
} else {
|
|
560
|
-
abortHandshake(socket, code, message, headers);
|
|
561
|
-
}
|
|
562
|
-
}
|