@openclaw/whatsapp 2026.7.1-beta.2 → 2026.7.1-beta.4
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/dist/{access-control-88UPniDc.js → access-control-DYE5dXna.js} +5 -3
- package/dist/{accounts-DgViSyJx.js → accounts-4YgwroRU.js} +1 -1
- package/dist/{action-runtime-hqza0J8B.js → action-runtime-DPahAqxV.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{active-listener-CFwkn3ho.js → active-listener-B4SDebQ6.js} +1 -1
- package/dist/api.js +14 -13
- package/dist/{approval-handler.runtime-9_SV7vhc.js → approval-handler.runtime-DNWS4aYQ.js} +1 -1
- package/dist/auth-presence.js +1 -1
- package/dist/{auth-store-ECx4h57q.js → auth-store-Db-wfApd.js} +23 -13
- package/dist/call-tool-api.js +233 -0
- package/dist/{channel-fcXxWXic.js → channel-BWp7h1uY.js} +44 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-Dgy9uUMl.js → channel-react-action-CKJHL_Wf.js} +3 -3
- package/dist/{channel.runtime-B4ThooGF.js → channel.runtime-CAssfx9p.js} +5 -5
- package/dist/{channel.setup-C_WEdyJR.js → channel.setup-CURc5rEt.js} +2 -2
- package/dist/{config-schema-CROZuhT-.js → config-schema-mBX2nmn1.js} +4 -0
- package/dist/{connection-controller-u-tfAFhJ.js → connection-controller-DkbrFSIn.js} +6 -5
- package/dist/connection-controller-registry-TSX_udJp.js +22 -0
- package/dist/contract-api.js +1 -1
- package/dist/{quoted-message-CpA_ujXK.js → group-session-key-BhC1RQOE.js} +31 -2
- package/dist/{identity-CmsTmkKR.js → identity-Dqft3mFA.js} +2 -1
- package/dist/index.js +9 -2
- package/dist/light-runtime-api.js +3 -3
- package/dist/{login-8lHwLmXj.js → login-C48y0jlx.js} +14 -7
- package/dist/{login-qr-BEZZqrTb.js → login-qr-BjId7dll.js} +7 -7
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BqkJ4MpT.js → monitor-DD8bXohk.js} +249 -160
- package/dist/runtime-api.js +9 -9
- package/dist/{send-i8Xk5mBQ.js → send-C5CpFcBG.js} +27 -9
- package/dist/{send-api-DndiBJhN.js → send-api-DLlXl8CH.js} +6 -5
- package/dist/{session-WU4SVP8f.js → session-DriaHt7V.js} +3 -3
- package/dist/{session-errors-CbsoQqoy.js → session-errors-BAj9D2La.js} +1 -22
- package/dist/{setup-core-KjSBbWX4.js → setup-core-DH-DFPLY.js} +4 -4
- package/dist/{setup-finalize-WedNP30s.js → setup-finalize-c8dl34sO.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-IOdkbWsQ.js → setup-surface-DlWb0Z09.js} +3 -3
- package/dist/{socket-timing-DvMNkIge.js → socket-timing-DhbVFjah.js} +17 -5
- package/dist/{text-runtime-C88QkuU9.js → targets-runtime-C-GiVn6Y.js} +2 -3
- package/dist/text-runtime-DdX6-mC_.js +4 -0
- package/node_modules/@cacheable/memory/README.md +177 -0
- package/node_modules/@cacheable/memory/dist/index.cjs +867 -820
- package/node_modules/@cacheable/memory/dist/index.d.cts +382 -280
- package/node_modules/@cacheable/memory/dist/index.d.mts +412 -0
- package/node_modules/@cacheable/memory/dist/index.mjs +841 -0
- package/node_modules/@cacheable/memory/package.json +9 -9
- package/node_modules/@cacheable/utils/README.md +342 -8
- package/node_modules/@cacheable/utils/dist/index.cjs +1322 -619
- package/node_modules/@cacheable/utils/dist/index.d.cts +769 -173
- package/node_modules/@cacheable/utils/dist/index.d.mts +903 -0
- package/node_modules/@cacheable/utils/dist/index.mjs +1355 -0
- package/node_modules/@cacheable/utils/package.json +8 -8
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/assert/strict.d.ts +10 -1
- package/node_modules/@types/node/assert.d.ts +144 -17
- package/node_modules/@types/node/async_hooks.d.ts +9 -9
- package/node_modules/@types/node/buffer.d.ts +64 -30
- package/node_modules/@types/node/child_process.d.ts +17 -21
- package/node_modules/@types/node/cluster.d.ts +13 -13
- package/node_modules/@types/node/console.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +471 -575
- package/node_modules/@types/node/diagnostics_channel.d.ts +274 -32
- package/node_modules/@types/node/dns.d.ts +15 -15
- package/node_modules/@types/node/events.d.ts +3 -3
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +7 -4
- package/node_modules/@types/node/fs.d.ts +24 -18
- package/node_modules/@types/node/globals.d.ts +4 -4
- package/node_modules/@types/node/http.d.ts +30 -5
- package/node_modules/@types/node/http2.d.ts +5 -1
- package/node_modules/@types/node/index.d.ts +1 -3
- package/node_modules/@types/node/inspector.d.ts +1 -1
- package/node_modules/@types/node/module.d.ts +16 -45
- package/node_modules/@types/node/net.d.ts +1 -1
- package/node_modules/@types/node/os.d.ts +2 -2
- package/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/node/perf_hooks.d.ts +1 -9
- package/node_modules/@types/node/process.d.ts +25 -12
- package/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/node/readline.d.ts +12 -11
- package/node_modules/@types/node/repl.d.ts +10 -10
- package/node_modules/@types/node/sqlite.d.ts +56 -1
- package/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/node/stream/promises.d.ts +2 -2
- package/node_modules/@types/node/stream/web.d.ts +1 -1
- package/node_modules/@types/node/stream.d.ts +37 -5
- package/node_modules/@types/node/test/reporters.d.ts +1 -1
- package/node_modules/@types/node/test.d.ts +120 -10
- package/node_modules/@types/node/tls.d.ts +1 -1
- package/node_modules/@types/node/ts5.6/index.d.ts +2 -4
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -3
- package/node_modules/@types/node/url.d.ts +3 -3
- package/node_modules/@types/node/util/types.d.ts +1 -1
- package/node_modules/@types/node/util.d.ts +22 -22
- package/node_modules/@types/node/v8.d.ts +85 -3
- package/node_modules/@types/node/vm.d.ts +9 -9
- package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
- package/node_modules/@types/node/worker_threads.d.ts +10 -12
- package/node_modules/@types/node/zlib.d.ts +3 -3
- package/node_modules/cacheable/README.md +309 -30
- package/node_modules/cacheable/dist/index.cjs +1307 -1153
- package/node_modules/cacheable/dist/index.d.cts +741 -469
- package/node_modules/cacheable/dist/index.d.mts +766 -0
- package/node_modules/cacheable/dist/index.mjs +1210 -0
- package/node_modules/cacheable/package.json +10 -10
- package/node_modules/content-type/README.md +32 -57
- package/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/content-type/package.json +35 -25
- package/node_modules/media-typer/README.md +19 -33
- package/node_modules/media-typer/dist/index.d.ts +29 -0
- package/node_modules/media-typer/dist/index.js +64 -0
- package/node_modules/media-typer/dist/index.js.map +1 -0
- package/node_modules/media-typer/package.json +37 -22
- package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +2 -2
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +65 -13
- package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +10 -0
- package/node_modules/music-metadata/lib/wav/WaveChunk.js +13 -3
- package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +1 -0
- package/node_modules/music-metadata/lib/wav/WaveParser.js +6 -5
- package/node_modules/music-metadata/package.json +5 -5
- package/node_modules/typebox/build/compile/validator.d.mts +2 -7
- package/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/node_modules/typebox/build/format/_idna.mjs +36 -6
- package/node_modules/typebox/build/format/_puny.mjs +4 -1
- package/node_modules/typebox/build/format/uuid.d.mts +2 -2
- package/node_modules/typebox/build/format/uuid.mjs +3 -3
- package/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/node_modules/typebox/build/guard/guard.d.mts +4 -8
- package/node_modules/typebox/build/guard/guard.mjs +5 -13
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
- package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
- package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
- package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
- package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
- package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
- package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
- package/node_modules/typebox/build/type/action/index.d.mts +7 -4
- package/node_modules/typebox/build/type/action/index.mjs +7 -4
- package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
- package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
- package/node_modules/typebox/build/type/action/module.d.mts +8 -7
- package/node_modules/typebox/build/type/action/module.mjs +7 -6
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
- package/node_modules/typebox/build/type/action/with.d.mts +11 -0
- package/node_modules/typebox/build/type/action/with.mjs +11 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
- package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
- package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/index.mjs +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
- package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
- package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
- package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
- package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
- package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
- package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
- package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
- package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
- package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
- package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
- package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
- package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
- package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
- package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
- package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
- package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
- package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
- package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
- package/node_modules/typebox/build/type/extends/object.mjs +25 -3
- package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
- package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
- package/node_modules/typebox/build/type/extends/record.mjs +23 -0
- package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
- package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
- package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
- package/node_modules/typebox/build/type/extends/union.mjs +2 -2
- package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
- package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
- package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
- package/node_modules/typebox/build/type/script/parser.mjs +22 -22
- package/node_modules/typebox/build/type/script/script.d.mts +3 -4
- package/node_modules/typebox/build/type/script/script.mjs +3 -2
- package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
- package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
- package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
- package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
- package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
- package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
- package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
- package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/node_modules/typebox/build/type/types/call.d.mts +3 -3
- package/node_modules/typebox/build/type/types/call.mjs +3 -2
- package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
- package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
- package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
- package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
- package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
- package/node_modules/typebox/build/type/types/enum.mjs +5 -0
- package/node_modules/typebox/build/type/types/index.d.mts +1 -4
- package/node_modules/typebox/build/type/types/index.mjs +1 -4
- package/node_modules/typebox/build/type/types/number.d.mts +1 -1
- package/node_modules/typebox/build/type/types/number.mjs +1 -1
- package/node_modules/typebox/build/type/types/record.d.mts +13 -7
- package/node_modules/typebox/build/type/types/record.mjs +15 -9
- package/node_modules/typebox/build/type/types/static.d.mts +2 -5
- package/node_modules/typebox/build/typebox.d.mts +4 -8
- package/node_modules/typebox/build/typebox.mjs +4 -8
- package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
- package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
- package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
- package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
- package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
- package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/index.d.mts +0 -1
- package/node_modules/typebox/build/value/index.mjs +0 -1
- package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
- package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
- package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
- package/node_modules/typebox/build/value/value.d.mts +0 -1
- package/node_modules/typebox/build/value/value.mjs +0 -1
- package/node_modules/typebox/package.json +25 -25
- package/node_modules/typebox/readme.md +97 -80
- package/node_modules/undici-types/agent.d.ts +0 -2
- package/node_modules/undici-types/client.d.ts +25 -19
- package/node_modules/undici-types/dispatcher.d.ts +7 -33
- package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici-types/fetch.d.ts +24 -4
- package/node_modules/undici-types/h2c-client.d.ts +6 -6
- package/node_modules/undici-types/handlers.d.ts +1 -2
- package/node_modules/undici-types/header.d.ts +5 -0
- package/node_modules/undici-types/index.d.ts +3 -1
- package/node_modules/undici-types/interceptors.d.ts +1 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/pool.d.ts +0 -2
- package/node_modules/undici-types/proxy-agent.d.ts +2 -2
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -2
- package/node_modules/undici-types/snapshot-agent.d.ts +4 -0
- package/node_modules/undici-types/socks5-proxy-agent.d.ts +2 -2
- package/node_modules/undici-types/webidl.d.ts +0 -1
- package/npm-shrinkwrap.json +49 -41
- package/openclaw.plugin.json +12 -0
- package/package.json +5 -5
- package/node_modules/@cacheable/memory/dist/index.d.ts +0 -310
- package/node_modules/@cacheable/memory/dist/index.js +0 -807
- package/node_modules/@cacheable/utils/dist/index.d.ts +0 -307
- package/node_modules/@cacheable/utils/dist/index.js +0 -630
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/node_modules/cacheable/dist/index.d.ts +0 -494
- package/node_modules/cacheable/dist/index.js +0 -1141
- package/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/content-type/index.js +0 -225
- package/node_modules/media-typer/HISTORY.md +0 -50
- package/node_modules/media-typer/index.js +0 -143
- package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
- package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
- package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/node_modules/typebox/build/type/action/options.d.mts +0 -11
- package/node_modules/typebox/build/type/action/options.mjs +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
- package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
- package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- package/dist/{approval-resolver-e1hAVRRy.js → approval-resolver-DF-lu8k5.js} +1 -1
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegExp to match type in RFC 6838
|
|
3
|
+
*
|
|
4
|
+
* type-name = restricted-name
|
|
5
|
+
* subtype-name = restricted-name
|
|
6
|
+
* restricted-name = restricted-name-first *126restricted-name-chars
|
|
7
|
+
* restricted-name-first = ALPHA / DIGIT
|
|
8
|
+
* restricted-name-chars = ALPHA / DIGIT / "!" / "#" /
|
|
9
|
+
* "$" / "&" / "-" / "^" / "_"
|
|
10
|
+
* restricted-name-chars =/ "." ; Characters before first dot always
|
|
11
|
+
* ; specify a facet name
|
|
12
|
+
* restricted-name-chars =/ "+" ; Characters after last plus always
|
|
13
|
+
* ; specify a structured syntax suffix
|
|
14
|
+
* ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
|
|
15
|
+
* DIGIT = %x30-39 ; 0-9
|
|
16
|
+
*/
|
|
17
|
+
const subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/;
|
|
18
|
+
const typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/;
|
|
19
|
+
const typeRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/;
|
|
20
|
+
/**
|
|
21
|
+
* Format object to media type.
|
|
22
|
+
*/
|
|
23
|
+
export function format(obj) {
|
|
24
|
+
const { type, subtype, suffix } = obj;
|
|
25
|
+
if (!type || !typeNameRegExp.test(type)) {
|
|
26
|
+
throw new TypeError(`Invalid type: ${type}`);
|
|
27
|
+
}
|
|
28
|
+
if (!subtype || !subtypeNameRegExp.test(subtype)) {
|
|
29
|
+
throw new TypeError(`Invalid subtype: ${subtype}`);
|
|
30
|
+
}
|
|
31
|
+
let str = type + "/" + subtype;
|
|
32
|
+
if (suffix !== undefined) {
|
|
33
|
+
if (!typeNameRegExp.test(suffix)) {
|
|
34
|
+
throw new TypeError(`Invalid suffix: ${suffix}`);
|
|
35
|
+
}
|
|
36
|
+
str += "+" + suffix;
|
|
37
|
+
}
|
|
38
|
+
return str;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parse media type to object.
|
|
42
|
+
*/
|
|
43
|
+
export function parse(str) {
|
|
44
|
+
if (!typeRegExp.test(str)) {
|
|
45
|
+
throw new TypeError(`Invalid media type: ${str}`);
|
|
46
|
+
}
|
|
47
|
+
const slashIndex = str.indexOf("/");
|
|
48
|
+
const type = str.slice(0, slashIndex).toLowerCase();
|
|
49
|
+
let subtype = str.slice(slashIndex + 1).toLowerCase();
|
|
50
|
+
let suffix;
|
|
51
|
+
const index = subtype.lastIndexOf("+");
|
|
52
|
+
if (index !== -1) {
|
|
53
|
+
suffix = subtype.slice(index + 1);
|
|
54
|
+
subtype = subtype.slice(0, index);
|
|
55
|
+
}
|
|
56
|
+
return { type, subtype, suffix };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Test media type.
|
|
60
|
+
*/
|
|
61
|
+
export function test(str) {
|
|
62
|
+
return typeRegExp.test(str);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,iBAAiB,GAAG,0CAA0C,CAAC;AACrE,MAAM,cAAc,GAAG,wCAAwC,CAAC;AAChE,MAAM,UAAU,GACd,gFAAgF,CAAC;AAoBnF;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,GAAc;IACnC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEtC,IAAI,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,SAAS,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC;IAE/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,SAAS,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,GAAG,IAAI,GAAG,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,IAAI,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,MAA0B,CAAC;IAE/B,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAClC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * RegExp to match type in RFC 6838\n *\n * type-name = restricted-name\n * subtype-name = restricted-name\n * restricted-name = restricted-name-first *126restricted-name-chars\n * restricted-name-first = ALPHA / DIGIT\n * restricted-name-chars = ALPHA / DIGIT / \"!\" / \"#\" /\n * \"$\" / \"&\" / \"-\" / \"^\" / \"_\"\n * restricted-name-chars =/ \".\" ; Characters before first dot always\n * ; specify a facet name\n * restricted-name-chars =/ \"+\" ; Characters after last plus always\n * ; specify a structured syntax suffix\n * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n * DIGIT = %x30-39 ; 0-9\n */\nconst subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/;\nconst typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/;\nconst typeRegExp =\n /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}\\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/;\n\n/**\n * Media type object.\n */\nexport interface MediaType {\n /**\n * The type of the media type.\n */\n type: string;\n /**\n * The subtype of the media type.\n */\n subtype: string;\n /**\n * The structured syntax suffix of the media type.\n */\n suffix?: string;\n}\n\n/**\n * Format object to media type.\n */\nexport function format(obj: MediaType): string {\n const { type, subtype, suffix } = obj;\n\n if (!type || !typeNameRegExp.test(type)) {\n throw new TypeError(`Invalid type: ${type}`);\n }\n\n if (!subtype || !subtypeNameRegExp.test(subtype)) {\n throw new TypeError(`Invalid subtype: ${subtype}`);\n }\n\n let str = type + \"/\" + subtype;\n\n if (suffix !== undefined) {\n if (!typeNameRegExp.test(suffix)) {\n throw new TypeError(`Invalid suffix: ${suffix}`);\n }\n\n str += \"+\" + suffix;\n }\n\n return str;\n}\n\n/**\n * Parse media type to object.\n */\nexport function parse(str: string): MediaType {\n if (!typeRegExp.test(str)) {\n throw new TypeError(`Invalid media type: ${str}`);\n }\n\n const slashIndex = str.indexOf(\"/\");\n const type = str.slice(0, slashIndex).toLowerCase();\n let subtype = str.slice(slashIndex + 1).toLowerCase();\n let suffix: string | undefined;\n\n const index = subtype.lastIndexOf(\"+\");\n if (index !== -1) {\n suffix = subtype.slice(index + 1);\n subtype = subtype.slice(0, index);\n }\n\n return { type, subtype, suffix };\n}\n\n/**\n * Test media type.\n */\nexport function test(str: string): boolean {\n return typeRegExp.test(str);\n}\n"]}
|
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "media-typer",
|
|
3
|
+
"version": "2.0.0",
|
|
3
4
|
"description": "Simple RFC 6838 media type parser and formatter",
|
|
4
|
-
"version": "1.1.0",
|
|
5
|
-
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
|
-
"license": "MIT",
|
|
7
5
|
"repository": "jshttp/media-typer",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"eslint-plugin-import": "2.17.2",
|
|
12
|
-
"eslint-plugin-markdown": "1.0.0",
|
|
13
|
-
"eslint-plugin-node": "8.0.1",
|
|
14
|
-
"eslint-plugin-promise": "4.1.1",
|
|
15
|
-
"eslint-plugin-standard": "4.0.0",
|
|
16
|
-
"mocha": "6.1.4",
|
|
17
|
-
"nyc": "14.0.0"
|
|
6
|
+
"funding": {
|
|
7
|
+
"type": "opencollective",
|
|
8
|
+
"url": "https://opencollective.com/express"
|
|
18
9
|
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": "./dist/index.js",
|
|
19
15
|
"files": [
|
|
20
|
-
"
|
|
21
|
-
"HISTORY.md",
|
|
22
|
-
"index.js"
|
|
16
|
+
"dist/"
|
|
23
17
|
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"bench": "vitest bench",
|
|
20
|
+
"build": "ts-scripts build",
|
|
21
|
+
"format": "ts-scripts format",
|
|
22
|
+
"prepare": "ts-scripts install",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"size": "size-limit",
|
|
25
|
+
"specs": "ts-scripts specs",
|
|
26
|
+
"test": "ts-scripts test && npm run size"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@borderless/ts-scripts": "^0.15.0",
|
|
30
|
+
"@size-limit/preset-small-lib": "^12.0.0",
|
|
31
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
32
|
+
"size-limit": "^12.0.0",
|
|
33
|
+
"typescript": "^5.6.2",
|
|
34
|
+
"vitest": "^3.2.4"
|
|
35
|
+
},
|
|
24
36
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
37
|
+
"node": ">=18"
|
|
26
38
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
"size-limit": [
|
|
40
|
+
{
|
|
41
|
+
"path": "dist/index.js",
|
|
42
|
+
"limit": "600 B"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"ts-scripts": {
|
|
46
|
+
"project": "tsconfig.build.json"
|
|
32
47
|
}
|
|
33
48
|
}
|
|
@@ -95,8 +95,8 @@ export class ID3v1Parser extends BasicParser {
|
|
|
95
95
|
debug('Skip checking for ID3v1 because the file-size is unknown');
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
if (this.apeHeader) {
|
|
99
|
-
this.tokenizer.
|
|
98
|
+
if (this.apeHeader && this.tokenizer.supportsRandomAccess()) {
|
|
99
|
+
this.tokenizer.setPosition(this.apeHeader.offset);
|
|
100
100
|
const apeParser = new APEv2Parser(this.metadata, this.tokenizer, this.options);
|
|
101
101
|
await apeParser.parseTags(this.apeHeader.footer);
|
|
102
102
|
}
|
|
@@ -3,6 +3,7 @@ import initDebug from 'debug';
|
|
|
3
3
|
import { FourCcToken } from '../common/FourCC.js';
|
|
4
4
|
import { makeUnexpectedFileContentError } from '../ParseError.js';
|
|
5
5
|
import * as util from '../common/Util.js';
|
|
6
|
+
import { FieldDecodingError } from '../ParseError.js';
|
|
6
7
|
const debug = initDebug('music-metadata:parser:MP4:atom');
|
|
7
8
|
export class Mp4ContentError extends makeUnexpectedFileContentError('MP4') {
|
|
8
9
|
}
|
|
@@ -79,6 +80,13 @@ const SecondsSinceMacEpoch = {
|
|
|
79
80
|
return new Date(secondsSinceUnixEpoch * 1000);
|
|
80
81
|
}
|
|
81
82
|
};
|
|
83
|
+
const SecondsSinceMacEpoch64 = {
|
|
84
|
+
len: 8,
|
|
85
|
+
get: (buf, off) => {
|
|
86
|
+
const secondsSinceUnixEpoch = Number(Token.UINT64_BE.get(buf, off)) - 2082844800;
|
|
87
|
+
return new Date(secondsSinceUnixEpoch * 1000);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
82
90
|
/**
|
|
83
91
|
* Token: Media Header Atom
|
|
84
92
|
* Ref:
|
|
@@ -90,16 +98,35 @@ export class MdhdAtom extends FixedLengthAtom {
|
|
|
90
98
|
super(len, 24, 'mdhd');
|
|
91
99
|
}
|
|
92
100
|
get(buf, off) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const version = Token.UINT8.get(buf, off + 0);
|
|
102
|
+
const flags = Token.UINT24_BE.get(buf, off + 1);
|
|
103
|
+
switch (version) {
|
|
104
|
+
case 0:
|
|
105
|
+
// Version 0: 32-bit fields
|
|
106
|
+
return {
|
|
107
|
+
version,
|
|
108
|
+
flags,
|
|
109
|
+
creationTime: SecondsSinceMacEpoch.get(buf, off + 4),
|
|
110
|
+
modificationTime: SecondsSinceMacEpoch.get(buf, off + 8),
|
|
111
|
+
timeScale: Token.UINT32_BE.get(buf, off + 12),
|
|
112
|
+
duration: Token.UINT32_BE.get(buf, off + 16),
|
|
113
|
+
language: Token.UINT16_BE.get(buf, off + 20),
|
|
114
|
+
quality: Token.UINT16_BE.get(buf, off + 22)
|
|
115
|
+
};
|
|
116
|
+
case 1:
|
|
117
|
+
return {
|
|
118
|
+
version,
|
|
119
|
+
flags,
|
|
120
|
+
creationTime: SecondsSinceMacEpoch64.get(buf, off + 4),
|
|
121
|
+
modificationTime: SecondsSinceMacEpoch64.get(buf, off + 12),
|
|
122
|
+
timeScale: Token.UINT32_BE.get(buf, off + 20),
|
|
123
|
+
duration: Number(Token.UINT64_BE.get(buf, off + 24)),
|
|
124
|
+
language: Token.UINT16_BE.get(buf, off + 32),
|
|
125
|
+
quality: Token.UINT16_BE.get(buf, off + 34)
|
|
126
|
+
};
|
|
127
|
+
default:
|
|
128
|
+
throw new FieldDecodingError('Invalid mdhd version header');
|
|
129
|
+
}
|
|
103
130
|
}
|
|
104
131
|
}
|
|
105
132
|
/**
|
|
@@ -110,16 +137,41 @@ export class MvhdAtom extends FixedLengthAtom {
|
|
|
110
137
|
super(len, 100, 'mvhd');
|
|
111
138
|
}
|
|
112
139
|
get(buf, off) {
|
|
140
|
+
const version = Token.UINT8.get(buf, off);
|
|
141
|
+
const flags = Token.UINT24_BE.get(buf, off + 1);
|
|
142
|
+
if (version === 1) {
|
|
143
|
+
// Version 1: 64-bit creation/modification times and duration
|
|
144
|
+
return {
|
|
145
|
+
version,
|
|
146
|
+
flags,
|
|
147
|
+
creationTime: SecondsSinceMacEpoch64.get(buf, off + 4),
|
|
148
|
+
modificationTime: SecondsSinceMacEpoch64.get(buf, off + 12),
|
|
149
|
+
timeScale: Token.UINT32_BE.get(buf, off + 20),
|
|
150
|
+
duration: Number(Token.UINT64_BE.get(buf, off + 24)),
|
|
151
|
+
preferredRate: Token.UINT32_BE.get(buf, off + 32),
|
|
152
|
+
preferredVolume: Token.UINT16_BE.get(buf, off + 36),
|
|
153
|
+
// ignore reserved: 10 bytes
|
|
154
|
+
// ignore matrix structure: 36 bytes
|
|
155
|
+
previewTime: Token.UINT32_BE.get(buf, off + 84),
|
|
156
|
+
previewDuration: Token.UINT32_BE.get(buf, off + 88),
|
|
157
|
+
posterTime: Token.UINT32_BE.get(buf, off + 92),
|
|
158
|
+
selectionTime: Token.UINT32_BE.get(buf, off + 96),
|
|
159
|
+
selectionDuration: Token.UINT32_BE.get(buf, off + 100),
|
|
160
|
+
currentTime: Token.UINT32_BE.get(buf, off + 104),
|
|
161
|
+
nextTrackID: Token.UINT32_BE.get(buf, off + 108)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Version 0: 32-bit fields
|
|
113
165
|
return {
|
|
114
|
-
version
|
|
115
|
-
flags
|
|
166
|
+
version,
|
|
167
|
+
flags,
|
|
116
168
|
creationTime: SecondsSinceMacEpoch.get(buf, off + 4),
|
|
117
169
|
modificationTime: SecondsSinceMacEpoch.get(buf, off + 8),
|
|
118
170
|
timeScale: Token.UINT32_BE.get(buf, off + 12),
|
|
119
171
|
duration: Token.UINT32_BE.get(buf, off + 16),
|
|
120
172
|
preferredRate: Token.UINT32_BE.get(buf, off + 20),
|
|
121
173
|
preferredVolume: Token.UINT16_BE.get(buf, off + 24),
|
|
122
|
-
// ignore
|
|
174
|
+
// ignore reserved: 10 bytes
|
|
123
175
|
// ignore matrix structure: 36 bytes
|
|
124
176
|
previewTime: Token.UINT32_BE.get(buf, off + 72),
|
|
125
177
|
previewDuration: Token.UINT32_BE.get(buf, off + 76),
|
|
@@ -21,6 +21,10 @@ export declare const WaveFormat: {
|
|
|
21
21
|
PCM: number;
|
|
22
22
|
ADPCM: number;
|
|
23
23
|
IEEE_FLOAT: number;
|
|
24
|
+
ALAW: number;
|
|
25
|
+
MULAW: number;
|
|
26
|
+
DVI_ADPCM: number;
|
|
27
|
+
GSM610: number;
|
|
24
28
|
MPEG_ADTS_AAC: number;
|
|
25
29
|
MPEG_LOAS: number;
|
|
26
30
|
RAW_AAC1: number;
|
|
@@ -31,12 +35,17 @@ export declare const WaveFormat: {
|
|
|
31
35
|
DRM: number;
|
|
32
36
|
DTS2: number;
|
|
33
37
|
MPEG: number;
|
|
38
|
+
MPEGLAYER3: number;
|
|
34
39
|
};
|
|
35
40
|
export type WaveFormat = typeof WaveFormat[keyof typeof WaveFormat];
|
|
36
41
|
export declare const WaveFormatNameMap: {
|
|
37
42
|
[WaveFormat.PCM]: string;
|
|
38
43
|
[WaveFormat.ADPCM]: string;
|
|
39
44
|
[WaveFormat.IEEE_FLOAT]: string;
|
|
45
|
+
[WaveFormat.ALAW]: string;
|
|
46
|
+
[WaveFormat.MULAW]: string;
|
|
47
|
+
[WaveFormat.DVI_ADPCM]: string;
|
|
48
|
+
[WaveFormat.GSM610]: string;
|
|
40
49
|
[WaveFormat.MPEG_ADTS_AAC]: string;
|
|
41
50
|
[WaveFormat.MPEG_LOAS]: string;
|
|
42
51
|
[WaveFormat.RAW_AAC1]: string;
|
|
@@ -47,6 +56,7 @@ export declare const WaveFormatNameMap: {
|
|
|
47
56
|
[WaveFormat.DRM]: string;
|
|
48
57
|
[WaveFormat.DTS2]: string;
|
|
49
58
|
[WaveFormat.MPEG]: string;
|
|
59
|
+
[WaveFormat.MPEGLAYER3]: string;
|
|
50
60
|
};
|
|
51
61
|
/**
|
|
52
62
|
* "fmt" sub-chunk describes the sound data's format
|
|
@@ -7,9 +7,13 @@ export class WaveContentError extends makeUnexpectedFileContentError('Wave') {
|
|
|
7
7
|
*/
|
|
8
8
|
export const WaveFormat = {
|
|
9
9
|
PCM: 0x0001,
|
|
10
|
-
// MPEG-4 and AAC Audio Types
|
|
11
10
|
ADPCM: 0x0002,
|
|
12
11
|
IEEE_FLOAT: 0x0003,
|
|
12
|
+
ALAW: 0x0006,
|
|
13
|
+
MULAW: 0x0007,
|
|
14
|
+
DVI_ADPCM: 0x0011,
|
|
15
|
+
GSM610: 0x0031,
|
|
16
|
+
// MPEG-4 and AAC Audio Types
|
|
13
17
|
MPEG_ADTS_AAC: 0x1600,
|
|
14
18
|
MPEG_LOAS: 0x1602,
|
|
15
19
|
RAW_AAC1: 0x00FF,
|
|
@@ -20,12 +24,17 @@ export const WaveFormat = {
|
|
|
20
24
|
ESST_AC3: 0x0241,
|
|
21
25
|
DRM: 0x0009,
|
|
22
26
|
DTS2: 0x2001,
|
|
23
|
-
MPEG: 0x0050
|
|
27
|
+
MPEG: 0x0050,
|
|
28
|
+
MPEGLAYER3: 0x0055
|
|
24
29
|
};
|
|
25
30
|
export const WaveFormatNameMap = {
|
|
26
31
|
[WaveFormat.PCM]: 'PCM',
|
|
27
32
|
[WaveFormat.ADPCM]: 'ADPCM',
|
|
28
33
|
[WaveFormat.IEEE_FLOAT]: 'IEEE_FLOAT',
|
|
34
|
+
[WaveFormat.ALAW]: 'ALAW',
|
|
35
|
+
[WaveFormat.MULAW]: 'MULAW',
|
|
36
|
+
[WaveFormat.DVI_ADPCM]: 'DVI_ADPCM',
|
|
37
|
+
[WaveFormat.GSM610]: 'GSM610',
|
|
29
38
|
[WaveFormat.MPEG_ADTS_AAC]: 'MPEG_ADTS_AAC',
|
|
30
39
|
[WaveFormat.MPEG_LOAS]: 'MPEG_LOAS',
|
|
31
40
|
[WaveFormat.RAW_AAC1]: 'RAW_AAC1',
|
|
@@ -35,7 +44,8 @@ export const WaveFormatNameMap = {
|
|
|
35
44
|
[WaveFormat.ESST_AC3]: 'ESST_AC3',
|
|
36
45
|
[WaveFormat.DRM]: 'DRM',
|
|
37
46
|
[WaveFormat.DTS2]: 'DTS2',
|
|
38
|
-
[WaveFormat.MPEG]: 'MPEG'
|
|
47
|
+
[WaveFormat.MPEG]: 'MPEG',
|
|
48
|
+
[WaveFormat.MPEGLAYER3]: 'MPEGLAYER3'
|
|
39
49
|
};
|
|
40
50
|
/**
|
|
41
51
|
* format chunk; chunk-id is "fmt "
|
|
@@ -14,6 +14,7 @@ import { BasicParser } from '../common/BasicParser.js';
|
|
|
14
14
|
export declare class WaveParser extends BasicParser {
|
|
15
15
|
private fact;
|
|
16
16
|
private blockAlign;
|
|
17
|
+
private avgBytesPerSec;
|
|
17
18
|
private header;
|
|
18
19
|
parse(): Promise<void>;
|
|
19
20
|
parseRiffChunk(chunkSize: number): Promise<void>;
|
|
@@ -25,6 +25,7 @@ export class WaveParser extends BasicParser {
|
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.blockAlign = 0;
|
|
28
|
+
this.avgBytesPerSec = 0;
|
|
28
29
|
}
|
|
29
30
|
async parse() {
|
|
30
31
|
const riffHeader = await this.tokenizer.readToken(riff.Header);
|
|
@@ -76,8 +77,8 @@ export class WaveParser extends BasicParser {
|
|
|
76
77
|
this.metadata.setFormat('bitsPerSample', fmt.wBitsPerSample);
|
|
77
78
|
this.metadata.setFormat('sampleRate', fmt.nSamplesPerSec);
|
|
78
79
|
this.metadata.setFormat('numberOfChannels', fmt.nChannels);
|
|
79
|
-
this.metadata.setFormat('bitrate', fmt.nBlockAlign * fmt.nSamplesPerSec * 8);
|
|
80
80
|
this.blockAlign = fmt.nBlockAlign;
|
|
81
|
+
this.avgBytesPerSec = fmt.nAvgBytesPerSec;
|
|
81
82
|
break;
|
|
82
83
|
}
|
|
83
84
|
case 'id3 ': // The way Picard, FooBar currently stores, ID3 meta-data
|
|
@@ -106,11 +107,11 @@ export class WaveParser extends BasicParser {
|
|
|
106
107
|
this.metadata.setFormat('duration', numberOfSamples / this.metadata.format.sampleRate);
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
if (this.
|
|
110
|
-
this.metadata.setFormat('bitrate',
|
|
110
|
+
if (this.avgBytesPerSec > 0) {
|
|
111
|
+
this.metadata.setFormat('bitrate', this.avgBytesPerSec * 8);
|
|
111
112
|
}
|
|
112
|
-
else if (this.metadata.format.
|
|
113
|
-
this.metadata.setFormat('bitrate',
|
|
113
|
+
else if (this.metadata.format.duration) {
|
|
114
|
+
this.metadata.setFormat('bitrate', chunkSize * 8 / this.metadata.format.duration);
|
|
114
115
|
}
|
|
115
116
|
await this.tokenizer.ignore(header.chunkSize);
|
|
116
117
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-metadata",
|
|
3
3
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.13.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -114,11 +114,11 @@
|
|
|
114
114
|
"dependencies": {
|
|
115
115
|
"@borewit/text-codec": "^0.2.2",
|
|
116
116
|
"@tokenizer/token": "^0.3.0",
|
|
117
|
-
"content-type": "^
|
|
117
|
+
"content-type": "^2.0.0",
|
|
118
118
|
"debug": "^4.4.3",
|
|
119
|
-
"file-type": "^21.3.
|
|
120
|
-
"media-typer": "^
|
|
121
|
-
"strtok3": "^10.3.
|
|
119
|
+
"file-type": "^21.3.4",
|
|
120
|
+
"media-typer": "^2.0.0",
|
|
121
|
+
"strtok3": "^10.3.5",
|
|
122
122
|
"token-types": "^6.1.2",
|
|
123
123
|
"uint8array-extras": "^1.5.0",
|
|
124
124
|
"win-guid": "^0.2.1"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TLocalizedValidationError } from '../error/index.mjs';
|
|
2
|
-
import { type StaticDecode, type StaticEncode, type TProperties, type TSchema
|
|
2
|
+
import { type StaticDecode, type StaticEncode, type TProperties, type TSchema } from '../type/index.mjs';
|
|
3
3
|
import { BuildResult, EvaluateResult } from '../schema/index.mjs';
|
|
4
|
-
export declare class Validator<Context extends TProperties = TProperties, Type extends TSchema = TSchema, Encode extends unknown = StaticEncode<Type, Context>, Decode extends unknown = StaticDecode<Type, Context>>
|
|
4
|
+
export declare class Validator<Context extends TProperties = TProperties, Type extends TSchema = TSchema, Encode extends unknown = StaticEncode<Type, Context>, Decode extends unknown = StaticDecode<Type, Context>> {
|
|
5
5
|
private readonly hasCodec;
|
|
6
6
|
private readonly buildResult;
|
|
7
7
|
private readonly evaluateResult;
|
|
@@ -35,9 +35,4 @@ export declare class Validator<Context extends TProperties = TProperties, Type e
|
|
|
35
35
|
Decode(value: unknown): Decode;
|
|
36
36
|
/** Encodes a value */
|
|
37
37
|
Encode(value: unknown): Encode;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Validator instances should not support Clone because they are owners of JIT evaluated functions. This function will be
|
|
40
|
-
* removed in the next version of TypeBox (relates to Type.Base deprecation)
|
|
41
|
-
*/
|
|
42
|
-
Clone(): Validator<Context, Type>;
|
|
43
38
|
}
|
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Settings } from '../system/settings/index.mjs';
|
|
3
|
-
import { Arguments } from '../system/arguments/index.mjs';
|
|
4
|
-
import { Base } from '../type/index.mjs';
|
|
5
3
|
import { Errors, Clean, Convert, Create, Default, Decode, Encode, HasCodec, Parser, ParseError } from '../value/index.mjs';
|
|
6
|
-
import { Build
|
|
4
|
+
import { Build } from '../schema/index.mjs';
|
|
7
5
|
// ------------------------------------------------------------------
|
|
8
6
|
// Validator<...>
|
|
9
7
|
// ------------------------------------------------------------------
|
|
10
|
-
export class Validator
|
|
8
|
+
export class Validator {
|
|
11
9
|
/** Constructs a Validator. */
|
|
12
|
-
constructor(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
2: (context, type) => [context, type]
|
|
17
|
-
});
|
|
18
|
-
// Note: The Base type requires this Validator to be Clone, but where we cannot safely clone
|
|
19
|
-
// the BuildResult or the EvaluateResult. For now we pass the Validator constructor a shared
|
|
20
|
-
// reference of BuildResult and EvaluateResult to mitigate re-compile on Clone. We must remove
|
|
21
|
-
// this overload when Base is removed (memory-gc-ref)
|
|
22
|
-
if (matched.length === 3 && matched[1] instanceof BuildResult && matched[2] instanceof EvaluateResult) {
|
|
23
|
-
const [hasCodec, buildResult, evaluateResult] = matched;
|
|
24
|
-
this.hasCodec = hasCodec;
|
|
25
|
-
this.buildResult = buildResult;
|
|
26
|
-
this.evaluateResult = evaluateResult;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const [context, type] = matched;
|
|
30
|
-
this.hasCodec = HasCodec(context, type);
|
|
31
|
-
this.buildResult = Build(context, type);
|
|
32
|
-
this.evaluateResult = this.buildResult.Evaluate();
|
|
33
|
-
}
|
|
10
|
+
constructor(context, type) {
|
|
11
|
+
this.hasCodec = HasCodec(context, type);
|
|
12
|
+
this.buildResult = Build(context, type);
|
|
13
|
+
this.evaluateResult = this.buildResult.Evaluate();
|
|
34
14
|
}
|
|
35
15
|
// ----------------------------------------------------------------
|
|
36
16
|
// IsAccelerated
|
|
@@ -108,14 +88,4 @@ export class Validator extends Base {
|
|
|
108
88
|
const result = this.hasCodec ? Encode(this.Context(), this.Type(), value) : this.Parse(value);
|
|
109
89
|
return result;
|
|
110
90
|
}
|
|
111
|
-
// ----------------------------------------------------------------
|
|
112
|
-
// Deprecations
|
|
113
|
-
// ----------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated Validator instances should not support Clone because they are owners of JIT evaluated functions. This function will be
|
|
116
|
-
* removed in the next version of TypeBox (relates to Type.Base deprecation)
|
|
117
|
-
*/
|
|
118
|
-
Clone() {
|
|
119
|
-
return new Validator(this.hasCodec, this.buildResult, this.evaluateResult);
|
|
120
|
-
}
|
|
121
91
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TValidationError = TAdditionalPropertiesError | TAnyOfError | TBooleanError | TConstError | TContainsError | TDependenciesError | TDependentRequiredError | TEnumError | TExclusiveMaximumError | TExclusiveMinimumError | TFormatError |
|
|
1
|
+
export type TValidationError = TAdditionalPropertiesError | TAnyOfError | TBooleanError | TConstError | TContainsError | TDependenciesError | TDependentRequiredError | TEnumError | TExclusiveMaximumError | TExclusiveMinimumError | TFormatError | TIfError | TMaximumError | TMaxItemsError | TMaxLengthError | TMaxPropertiesError | TMinimumError | TMinItemsError | TMinLengthError | TMinPropertiesError | TMultipleOfError | TNotError | TOneOfError | TPatternError | TPropertyNamesError | TRefineError | TRequiredError | TTypeError | TUnevaluatedItemsError | TUnevaluatedPropertiesError | TUniqueItemsError;
|
|
2
2
|
export declare function IsValidationError(value: unknown): value is TValidationError;
|
|
3
3
|
export type TLocalizedValidationError = TValidationError & {
|
|
4
4
|
message: string;
|
|
@@ -78,12 +78,6 @@ export interface TFormatError extends TValidationErrorBase {
|
|
|
78
78
|
format: string;
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
export interface TGuardError extends TValidationErrorBase {
|
|
82
|
-
keyword: '~guard';
|
|
83
|
-
params: {
|
|
84
|
-
errors: object[];
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
81
|
export interface TIfError extends TValidationErrorBase {
|
|
88
82
|
keyword: 'if';
|
|
89
83
|
params: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Unreachable } from '../system/unreachable/index.mjs';
|
|
1
2
|
import * as Puny from './_puny.mjs';
|
|
2
3
|
// ------------------------------------------------------------------
|
|
3
4
|
// Unicode General Category Helper (RFC 5892)
|
|
@@ -34,7 +35,8 @@ const RFC5892_DISALLOWED = new Set([
|
|
|
34
35
|
// ------------------------------------------------------------------
|
|
35
36
|
// A set of Virama (halant) code points used to validate CONTEXTJ
|
|
36
37
|
// rules (RFC 5892 Appendix A.1). These characters allow a subsequent
|
|
37
|
-
// Zero Width Joiner (U+
|
|
38
|
+
// Zero Width Non-Joiner (U+200C) or Zero Width Joiner (U+200D) to
|
|
39
|
+
// be valid in a label.
|
|
38
40
|
// ------------------------------------------------------------------
|
|
39
41
|
const VIRAMA_CPS = new Set([
|
|
40
42
|
0x094d,
|
|
@@ -101,8 +103,10 @@ function IsVirama(cp) {
|
|
|
101
103
|
// IsUnicodeLabel
|
|
102
104
|
// ------------------------------------------------------------------
|
|
103
105
|
function IsUnicodeLabel(value) {
|
|
106
|
+
// deno-coverage-ignore-start - unable to reach via format guards
|
|
104
107
|
if (value.length === 0)
|
|
105
|
-
return false
|
|
108
|
+
return Unreachable(); // false
|
|
109
|
+
// deno-coverage-ignore-stop
|
|
106
110
|
// Use spread to handle surrogate pairs and provide O(1) neighbor access
|
|
107
111
|
const cps = [...value].map((c) => c.codePointAt(0));
|
|
108
112
|
const len = cps.length;
|
|
@@ -145,10 +149,17 @@ function IsUnicodeLabel(value) {
|
|
|
145
149
|
if (prev === undefined || !IsHebrew(prev))
|
|
146
150
|
return false;
|
|
147
151
|
break; // Hebrew GERESH
|
|
148
|
-
case
|
|
152
|
+
case 0x200c: // ZWNJ - RFC 5892 Appendix A.1
|
|
153
|
+
// Note: Full validation requires a Unicode joining type table. We reject
|
|
154
|
+
// only when preceded by ASCII (U+0000-U+007F), which can never satisfy
|
|
155
|
+
// the Virama or cursive-joining rules.
|
|
156
|
+
if (prev === undefined || (prev < 0x0080 && !IsVirama(prev)))
|
|
157
|
+
return false;
|
|
158
|
+
break;
|
|
159
|
+
case 0x200d: // ZWJ - RFC 5892 Appendix A.2
|
|
149
160
|
if (prev === undefined || !IsVirama(prev))
|
|
150
161
|
return false;
|
|
151
|
-
break;
|
|
162
|
+
break;
|
|
152
163
|
case 0x30fb: /* Checked at end via hasJapanese */
|
|
153
164
|
break; // KATAKANA MIDDLE DOT
|
|
154
165
|
}
|
|
@@ -192,10 +203,29 @@ function IsPuny(value) {
|
|
|
192
203
|
}
|
|
193
204
|
function IsPunyLabel(value) {
|
|
194
205
|
try {
|
|
195
|
-
|
|
206
|
+
const payload = value.slice(4).toLowerCase();
|
|
207
|
+
// 1. Structural Validation (RFC 3492 syntax)
|
|
208
|
+
//
|
|
209
|
+
// If the payload contains a hyphen, it MUST be a delimiter separating basic
|
|
210
|
+
// ASCII characters from the variable-length integers. A payload consisting
|
|
211
|
+
// of ONLY a hyphen or starting with multiple hyphens without basic ASCII
|
|
212
|
+
// characters (like "-9uc") is fundamentally malformed.
|
|
213
|
+
//
|
|
214
|
+
const lastHyphen = payload.lastIndexOf('-');
|
|
215
|
+
if (lastHyphen === 0) {
|
|
216
|
+
// Catches "-9uc" right here because the delimiter is at index 0, meaning 0
|
|
217
|
+
// basic ASCII characters preceded it, which is non-canonical.
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
// 2. Decode the payload
|
|
221
|
+
const decoded = Puny.Decode(payload);
|
|
222
|
+
if (!decoded)
|
|
223
|
+
return false;
|
|
224
|
+
// 3. Validate the output rules against RFC 5892
|
|
225
|
+
return IsUnicodeLabel(decoded);
|
|
196
226
|
}
|
|
197
227
|
catch {
|
|
198
|
-
return false;
|
|
228
|
+
return false;
|
|
199
229
|
}
|
|
200
230
|
}
|
|
201
231
|
// ------------------------------------------------------------------
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Unreachable } from '../system/unreachable/index.mjs';
|
|
1
2
|
// ------------------------------------------------------------------
|
|
2
3
|
// PunyCode (RFC 3492)
|
|
3
4
|
// ------------------------------------------------------------------
|
|
@@ -52,8 +53,10 @@ export function Decode(value) {
|
|
|
52
53
|
digit = ch - 0x61; // a-z => 0-25
|
|
53
54
|
else if (ch >= 0x30 && ch <= 0x39)
|
|
54
55
|
digit = ch - 0x30 + 26; // 0-9 => 26-35
|
|
56
|
+
// deno-coverage-ignore-start - _idna.ts maps input to lowercase, so we can't reach here
|
|
55
57
|
else if (ch >= 0x41 && ch <= 0x5a)
|
|
56
|
-
digit = ch - 0x41
|
|
58
|
+
Unreachable(); // digit = ch - 0x41 // A-Z => 0-25
|
|
59
|
+
// deno-coverage-ignore-stop
|
|
57
60
|
else
|
|
58
61
|
throw new Error('Invalid punycode: bad digit character');
|
|
59
62
|
i += digit * w;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns true if the value is a uuid
|
|
3
|
-
* @specification
|
|
4
|
-
* @
|
|
3
|
+
* @specification https://www.rfc-editor.org/info/rfc4122/
|
|
4
|
+
* @specification https://www.rfc-editor.org/info/rfc9562/
|
|
5
5
|
*/
|
|
6
6
|
export declare function IsUuid(value: string): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const Uuid = /^
|
|
1
|
+
const Uuid = /^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is a uuid
|
|
4
|
-
* @specification
|
|
5
|
-
* @
|
|
4
|
+
* @specification https://www.rfc-editor.org/info/rfc4122/
|
|
5
|
+
* @specification https://www.rfc-editor.org/info/rfc9562/
|
|
6
6
|
*/
|
|
7
7
|
export function IsUuid(value) {
|
|
8
8
|
return Uuid.test(value);
|