functionalscript 0.13.1 → 0.14.1
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/{types → fs}/asn.1/module.f.d.ts +1 -1
- package/{types → fs}/asn.1/module.f.js +3 -3
- package/{types → fs}/asn.1/test.f.js +2 -2
- package/{types → fs}/base128/module.f.d.ts +1 -1
- package/{types → fs}/base128/module.f.js +1 -1
- package/{types → fs}/base128/test.f.js +2 -2
- package/{bnf → fs/bnf}/data/module.f.d.ts +1 -1
- package/{cas → fs/cas}/module.f.d.ts +4 -4
- package/{cas → fs/cas}/module.f.js +1 -1
- package/{types → fs}/cbase32/module.f.d.ts +2 -2
- package/{types → fs}/cbase32/module.f.js +1 -1
- package/{types → fs}/cbase32/test.f.js +1 -1
- package/fs/ci/bun/module.f.d.ts +2 -0
- package/fs/ci/bun/module.f.js +20 -0
- package/fs/ci/common/module.f.d.ts +43 -0
- package/fs/ci/common/module.f.js +32 -0
- package/fs/ci/config/module.f.d.ts +25 -0
- package/fs/ci/config/module.f.js +34 -0
- package/fs/ci/deno/module.f.d.ts +2 -0
- package/fs/ci/deno/module.f.js +13 -0
- package/{ci → fs/ci}/module.f.d.ts +1 -1
- package/fs/ci/module.f.js +43 -0
- package/fs/ci/node/module.f.d.ts +6 -0
- package/fs/ci/node/module.f.js +36 -0
- package/fs/ci/playwright/module.f.d.ts +2 -0
- package/fs/ci/playwright/module.f.js +23 -0
- package/fs/ci/rust/module.f.d.ts +2 -0
- package/fs/ci/rust/module.f.js +49 -0
- package/{dev/tf → fs/ci}/test.f.d.ts +2 -1
- package/fs/ci/test.f.js +40 -0
- package/{crypto → fs/crypto}/secp/module.f.d.ts +1 -2
- package/{dev → fs/dev}/module.f.d.ts +2 -0
- package/{dev → fs/dev}/module.f.js +5 -0
- package/{dev → fs/dev}/tf/all.test.js +7 -5
- package/{dev → fs/dev}/tf/module.f.d.ts +1 -1
- package/{dev → fs/dev}/tf/module.f.js +12 -9
- package/fs/dev/tf/test.f.d.ts +16 -0
- package/fs/dev/tf/test.f.js +22 -0
- package/fs/dev/version/module.f.d.ts +3 -0
- package/{djs → fs/djs}/tokenizer/module.f.js +3 -3
- package/{djs/parser-new → fs/djs/tokenizer-new}/test.f.d.ts +2 -1
- package/fs/djs/tokenizer-new/test.f.js +894 -0
- package/{js → fs/js}/tokenizer/module.f.js +34 -34
- package/{json → fs/json}/tokenizer/module.f.js +1 -1
- package/{path → fs/path}/module.f.d.ts +1 -1
- package/fs/sul/id/module.f.d.ts +33 -0
- package/fs/sul/id/module.f.js +94 -0
- package/fs/sul/id/test.f.d.ts +21 -0
- package/fs/sul/id/test.f.js +75 -0
- package/fs/sul/level/hash/module.f.d.ts +38 -0
- package/fs/sul/level/hash/module.f.js +43 -0
- package/fs/sul/level/hash/test.f.d.ts +14 -0
- package/fs/sul/level/hash/test.f.js +112 -0
- package/fs/sul/level/literal/module.f.d.ts +64 -0
- package/fs/sul/level/literal/module.f.js +88 -0
- package/fs/sul/level/literal/test.f.d.ts +12 -0
- package/fs/sul/level/literal/test.f.js +722 -0
- package/fs/sul/module.f.d.ts +23 -0
- package/fs/sul/module.f.js +46 -0
- package/fs/sul/test.f.d.ts +10 -0
- package/fs/sul/test.f.js +47 -0
- package/{text → fs/text}/module.f.d.ts +1 -1
- package/{text → fs/text}/utf16/module.f.js +8 -8
- package/{text → fs/text}/utf8/module.f.js +2 -2
- package/{types → fs/types}/bit_vec/module.f.d.ts +13 -1
- package/{types → fs/types}/bit_vec/module.f.js +33 -15
- package/{types → fs/types}/effects/module.f.d.ts +1 -0
- package/{types → fs/types}/effects/node/virtual/module.f.d.ts +3 -3
- package/{types → fs/types}/function/operator/module.f.d.ts +1 -1
- package/{types → fs/types}/function/operator/module.f.js +1 -1
- package/{types → fs/types}/list/module.f.js +1 -1
- package/fs/types/patricia_trie/module.f.d.ts +25 -0
- package/fs/types/patricia_trie/module.f.js +35 -0
- package/fs/types/patricia_trie/test.f.d.ts +8 -0
- package/fs/types/patricia_trie/test.f.js +121 -0
- package/{types → fs/types}/rtti/module.f.d.ts +12 -1
- package/fs/types/rtti/module.f.js +100 -0
- package/fs/types/rtti/parse/module.f.d.ts +32 -0
- package/fs/types/rtti/parse/module.f.js +113 -0
- package/fs/types/rtti/parse/test.f.d.ts +116 -0
- package/fs/types/rtti/parse/test.f.js +345 -0
- package/fs/types/rtti/test.f.d.ts +34 -0
- package/fs/types/rtti/test.f.js +123 -0
- package/fs/types/rtti/validate/module.f.d.ts +80 -0
- package/{types → fs/types}/rtti/validate/module.f.js +33 -25
- package/{types → fs/types}/rtti/validate/test.f.d.ts +23 -0
- package/{types → fs/types}/rtti/validate/test.f.js +67 -0
- package/{types → fs/types}/uint8array/module.f.d.ts +2 -2
- package/package.json +8 -8
- package/ci/module.f.js +0 -183
- package/dev/tf/test.f.js +0 -5
- package/dev/version/module.f.d.ts +0 -3
- package/djs/parser-new/test.f.js +0 -202
- package/types/rtti/module.f.js +0 -27
- package/types/rtti/test.f.d.ts +0 -6
- package/types/rtti/test.f.js +0 -22
- package/types/rtti/validate/module.f.d.ts +0 -50
- /package/{types → fs}/asn.1/test.f.d.ts +0 -0
- /package/{cas → fs/base128}/test.f.d.ts +0 -0
- /package/{bnf → fs/bnf}/data/module.f.js +0 -0
- /package/{bnf → fs/bnf}/data/test.f.d.ts +0 -0
- /package/{bnf → fs/bnf}/data/test.f.js +0 -0
- /package/{bnf → fs/bnf}/module.f.d.ts +0 -0
- /package/{bnf → fs/bnf}/module.f.js +0 -0
- /package/{bnf → fs/bnf}/test.f.d.ts +0 -0
- /package/{bnf → fs/bnf}/test.f.js +0 -0
- /package/{bnf → fs/bnf}/testlib.f.d.ts +0 -0
- /package/{bnf → fs/bnf}/testlib.f.js +0 -0
- /package/{types/base128 → fs/cas}/test.f.d.ts +0 -0
- /package/{cas → fs/cas}/test.f.js +0 -0
- /package/{types → fs}/cbase32/test.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/hmac/module.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/hmac/module.f.js +0 -0
- /package/{crypto → fs/crypto}/hmac/test.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/hmac/test.f.js +0 -0
- /package/{crypto → fs/crypto}/secp/module.f.js +0 -0
- /package/{crypto → fs/crypto}/secp/test.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/secp/test.f.js +0 -0
- /package/{crypto → fs/crypto}/sha2/module.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/sha2/module.f.js +0 -0
- /package/{crypto → fs/crypto}/sha2/test.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/sha2/test.f.js +0 -0
- /package/{crypto → fs/crypto}/sign/module.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/sign/module.f.js +0 -0
- /package/{crypto → fs/crypto}/sign/test.f.d.ts +0 -0
- /package/{crypto → fs/crypto}/sign/test.f.js +0 -0
- /package/{dev → fs/dev}/index/module.f.d.ts +0 -0
- /package/{dev → fs/dev}/index/module.f.js +0 -0
- /package/{dev → fs/dev}/test.f.d.ts +0 -0
- /package/{dev → fs/dev}/test.f.js +0 -0
- /package/{dev → fs/dev}/tf/all.test.d.ts +0 -0
- /package/{dev → fs/dev}/version/module.f.js +0 -0
- /package/{dev → fs/dev}/version/test.f.d.ts +0 -0
- /package/{dev → fs/dev}/version/test.f.js +0 -0
- /package/{djs → fs/djs}/ast/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/ast/module.f.js +0 -0
- /package/{djs → fs/djs}/ast/test.f.d.ts +0 -0
- /package/{djs → fs/djs}/ast/test.f.js +0 -0
- /package/{djs → fs/djs}/examples/input.f.d.ts +0 -0
- /package/{djs → fs/djs}/examples/input.f.js +0 -0
- /package/{djs → fs/djs}/examples/m.f.d.ts +0 -0
- /package/{djs → fs/djs}/examples/m.f.js +0 -0
- /package/{djs → fs/djs}/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/module.f.js +0 -0
- /package/{djs → fs/djs}/parser/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/parser/module.f.js +0 -0
- /package/{djs → fs/djs}/parser/test.f.d.ts +0 -0
- /package/{djs → fs/djs}/parser/test.f.js +0 -0
- /package/{djs → fs/djs}/serializer/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/serializer/module.f.js +0 -0
- /package/{djs → fs/djs}/serializer/test.f.d.ts +0 -0
- /package/{djs → fs/djs}/serializer/test.f.js +0 -0
- /package/{djs → fs/djs}/tokenizer/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/tokenizer/test.f.d.ts +0 -0
- /package/{djs → fs/djs}/tokenizer/test.f.js +0 -0
- /package/{djs/parser-new → fs/djs/tokenizer-new}/module.f.d.ts +0 -0
- /package/{djs/parser-new → fs/djs/tokenizer-new}/module.f.js +0 -0
- /package/{djs → fs/djs}/transpiler/module.f.d.ts +0 -0
- /package/{djs → fs/djs}/transpiler/module.f.js +0 -0
- /package/{djs → fs/djs}/transpiler/test.f.d.ts +0 -0
- /package/{djs → fs/djs}/transpiler/test.f.js +0 -0
- /package/{fjs → fs/fjs}/module.d.ts +0 -0
- /package/{fjs → fs/fjs}/module.f.d.ts +0 -0
- /package/{fjs → fs/fjs}/module.f.js +0 -0
- /package/{fjs → fs/fjs}/module.js +0 -0
- /package/{fsc → fs/fsc}/bnf.f.d.ts +0 -0
- /package/{fsc → fs/fsc}/bnf.f.js +0 -0
- /package/{fsc → fs/fsc}/json.f.d.ts +0 -0
- /package/{fsc → fs/fsc}/json.f.js +0 -0
- /package/{fsc → fs/fsc}/module.f.d.ts +0 -0
- /package/{fsc → fs/fsc}/module.f.js +0 -0
- /package/{fsc → fs/fsc}/test.f.d.ts +0 -0
- /package/{fsc → fs/fsc}/test.f.js +0 -0
- /package/{fsm → fs/fsm}/module.f.d.ts +0 -0
- /package/{fsm → fs/fsm}/module.f.js +0 -0
- /package/{fsm → fs/fsm}/test.f.d.ts +0 -0
- /package/{fsm → fs/fsm}/test.f.js +0 -0
- /package/{html → fs/html}/module.f.d.ts +0 -0
- /package/{html → fs/html}/module.f.js +0 -0
- /package/{html → fs/html}/test.f.d.ts +0 -0
- /package/{html → fs/html}/test.f.js +0 -0
- /package/{io → fs/io}/module.d.ts +0 -0
- /package/{io → fs/io}/module.f.d.ts +0 -0
- /package/{io → fs/io}/module.f.js +0 -0
- /package/{io → fs/io}/module.js +0 -0
- /package/{io → fs/io}/virtual/module.f.d.ts +0 -0
- /package/{io → fs/io}/virtual/module.f.js +0 -0
- /package/{js → fs/js}/tokenizer/module.f.d.ts +0 -0
- /package/{js → fs/js}/tokenizer/test.f.d.ts +0 -0
- /package/{js → fs/js}/tokenizer/test.f.js +0 -0
- /package/{json → fs/json}/module.f.d.ts +0 -0
- /package/{json → fs/json}/module.f.js +0 -0
- /package/{json → fs/json}/parser/module.f.d.ts +0 -0
- /package/{json → fs/json}/parser/module.f.js +0 -0
- /package/{json → fs/json}/parser/test.f.d.ts +0 -0
- /package/{json → fs/json}/parser/test.f.js +0 -0
- /package/{json → fs/json}/serializer/module.f.d.ts +0 -0
- /package/{json → fs/json}/serializer/module.f.js +0 -0
- /package/{json → fs/json}/serializer/test.f.d.ts +0 -0
- /package/{json → fs/json}/serializer/test.f.js +0 -0
- /package/{json → fs/json}/test.f.d.ts +0 -0
- /package/{json → fs/json}/test.f.js +0 -0
- /package/{json → fs/json}/tokenizer/module.f.d.ts +0 -0
- /package/{json → fs/json}/tokenizer/test.f.d.ts +0 -0
- /package/{json → fs/json}/tokenizer/test.f.js +0 -0
- /package/{path → fs/path}/module.f.js +0 -0
- /package/{path → fs/path}/test.f.d.ts +0 -0
- /package/{path → fs/path}/test.f.js +0 -0
- /package/{text → fs/text}/ascii/module.f.d.ts +0 -0
- /package/{text → fs/text}/ascii/module.f.js +0 -0
- /package/{text → fs/text}/ascii/test.f.d.ts +0 -0
- /package/{text → fs/text}/ascii/test.f.js +0 -0
- /package/{text → fs/text}/module.f.js +0 -0
- /package/{text → fs/text}/sgr/module.f.d.ts +0 -0
- /package/{text → fs/text}/sgr/module.f.js +0 -0
- /package/{text → fs/text}/sgr/test.f.d.ts +0 -0
- /package/{text → fs/text}/sgr/test.f.js +0 -0
- /package/{text → fs/text}/test.f.d.ts +0 -0
- /package/{text → fs/text}/test.f.js +0 -0
- /package/{text → fs/text}/utf16/module.f.d.ts +0 -0
- /package/{text → fs/text}/utf16/test.f.d.ts +0 -0
- /package/{text → fs/text}/utf16/test.f.js +0 -0
- /package/{text → fs/text}/utf8/module.f.d.ts +0 -0
- /package/{text → fs/text}/utf8/test.f.d.ts +0 -0
- /package/{text → fs/text}/utf8/test.f.js +0 -0
- /package/{types → fs/types}/array/module.f.d.ts +0 -0
- /package/{types → fs/types}/array/module.f.js +0 -0
- /package/{types → fs/types}/array/test.f.d.ts +0 -0
- /package/{types → fs/types}/array/test.f.js +0 -0
- /package/{types → fs/types}/bigfloat/module.f.d.ts +0 -0
- /package/{types → fs/types}/bigfloat/module.f.js +0 -0
- /package/{types → fs/types}/bigfloat/test.f.d.ts +0 -0
- /package/{types → fs/types}/bigfloat/test.f.js +0 -0
- /package/{types → fs/types}/bigint/module.f.d.ts +0 -0
- /package/{types → fs/types}/bigint/module.f.js +0 -0
- /package/{types → fs/types}/bigint/test.f.d.ts +0 -0
- /package/{types → fs/types}/bigint/test.f.js +0 -0
- /package/{types → fs/types}/bit_vec/test.f.d.ts +0 -0
- /package/{types → fs/types}/bit_vec/test.f.js +0 -0
- /package/{types → fs/types}/btree/find/module.f.d.ts +0 -0
- /package/{types → fs/types}/btree/find/module.f.js +0 -0
- /package/{types → fs/types}/btree/find/test.f.d.ts +0 -0
- /package/{types → fs/types}/btree/find/test.f.js +0 -0
- /package/{types → fs/types}/btree/module.f.d.ts +0 -0
- /package/{types → fs/types}/btree/module.f.js +0 -0
- /package/{types → fs/types}/btree/remove/module.f.d.ts +0 -0
- /package/{types → fs/types}/btree/remove/module.f.js +0 -0
- /package/{types → fs/types}/btree/remove/test.f.d.ts +0 -0
- /package/{types → fs/types}/btree/remove/test.f.js +0 -0
- /package/{types → fs/types}/btree/set/module.f.d.ts +0 -0
- /package/{types → fs/types}/btree/set/module.f.js +0 -0
- /package/{types → fs/types}/btree/set/test.f.d.ts +0 -0
- /package/{types → fs/types}/btree/set/test.f.js +0 -0
- /package/{types → fs/types}/btree/test.f.d.ts +0 -0
- /package/{types → fs/types}/btree/test.f.js +0 -0
- /package/{types → fs/types}/btree/types/module.f.d.ts +0 -0
- /package/{types → fs/types}/btree/types/module.f.js +0 -0
- /package/{types → fs/types}/byte_set/module.f.d.ts +0 -0
- /package/{types → fs/types}/byte_set/module.f.js +0 -0
- /package/{types → fs/types}/byte_set/test.f.d.ts +0 -0
- /package/{types → fs/types}/byte_set/test.f.js +0 -0
- /package/{types → fs/types}/effects/mock/module.f.d.ts +0 -0
- /package/{types → fs/types}/effects/mock/module.f.js +0 -0
- /package/{types → fs/types}/effects/module.d.ts +0 -0
- /package/{types → fs/types}/effects/module.f.js +0 -0
- /package/{types → fs/types}/effects/module.js +0 -0
- /package/{types → fs/types}/effects/node/module.f.d.ts +0 -0
- /package/{types → fs/types}/effects/node/module.f.js +0 -0
- /package/{types → fs/types}/effects/node/test.f.d.ts +0 -0
- /package/{types → fs/types}/effects/node/test.f.js +0 -0
- /package/{types → fs/types}/effects/node/virtual/module.f.js +0 -0
- /package/{types → fs/types}/function/compare/module.f.d.ts +0 -0
- /package/{types → fs/types}/function/compare/module.f.js +0 -0
- /package/{types → fs/types}/function/compare/test.f.d.ts +0 -0
- /package/{types → fs/types}/function/compare/test.f.js +0 -0
- /package/{types → fs/types}/function/module.f.d.ts +0 -0
- /package/{types → fs/types}/function/module.f.js +0 -0
- /package/{types → fs/types}/function/test.f.d.ts +0 -0
- /package/{types → fs/types}/function/test.f.js +0 -0
- /package/{types → fs/types}/list/module.f.d.ts +0 -0
- /package/{types → fs/types}/list/test.f.d.ts +0 -0
- /package/{types → fs/types}/list/test.f.js +0 -0
- /package/{types → fs/types}/map/module.f.d.ts +0 -0
- /package/{types → fs/types}/map/module.f.js +0 -0
- /package/{types → fs/types}/map/test.f.d.ts +0 -0
- /package/{types → fs/types}/map/test.f.js +0 -0
- /package/{types → fs/types}/monoid/module.f.d.ts +0 -0
- /package/{types → fs/types}/monoid/module.f.js +0 -0
- /package/{types → fs/types}/monoid/test.f.d.ts +0 -0
- /package/{types → fs/types}/monoid/test.f.js +0 -0
- /package/{types → fs/types}/nibble_set/module.f.d.ts +0 -0
- /package/{types → fs/types}/nibble_set/module.f.js +0 -0
- /package/{types → fs/types}/nibble_set/test.f.d.ts +0 -0
- /package/{types → fs/types}/nibble_set/test.f.js +0 -0
- /package/{types → fs/types}/nominal/module.f.d.ts +0 -0
- /package/{types → fs/types}/nominal/module.f.js +0 -0
- /package/{types → fs/types}/nominal/test.f.d.ts +0 -0
- /package/{types → fs/types}/nominal/test.f.js +0 -0
- /package/{types → fs/types}/nullable/module.f.d.ts +0 -0
- /package/{types → fs/types}/nullable/module.f.js +0 -0
- /package/{types → fs/types}/nullable/test.f.d.ts +0 -0
- /package/{types → fs/types}/nullable/test.f.js +0 -0
- /package/{types → fs/types}/number/module.f.d.ts +0 -0
- /package/{types → fs/types}/number/module.f.js +0 -0
- /package/{types → fs/types}/number/test.f.d.ts +0 -0
- /package/{types → fs/types}/number/test.f.js +0 -0
- /package/{types → fs/types}/object/module.f.d.ts +0 -0
- /package/{types → fs/types}/object/module.f.js +0 -0
- /package/{types → fs/types}/object/test.f.d.ts +0 -0
- /package/{types → fs/types}/object/test.f.js +0 -0
- /package/{types → fs/types}/option/module.f.d.ts +0 -0
- /package/{types → fs/types}/option/module.f.js +0 -0
- /package/{types → fs/types}/ordered_map/module.f.d.ts +0 -0
- /package/{types → fs/types}/ordered_map/module.f.js +0 -0
- /package/{types → fs/types}/ordered_map/test.f.d.ts +0 -0
- /package/{types → fs/types}/ordered_map/test.f.js +0 -0
- /package/{types → fs/types}/prime_field/module.f.d.ts +0 -0
- /package/{types → fs/types}/prime_field/module.f.js +0 -0
- /package/{types → fs/types}/prime_field/test.f.d.ts +0 -0
- /package/{types → fs/types}/prime_field/test.f.js +0 -0
- /package/{types → fs/types}/range/module.f.d.ts +0 -0
- /package/{types → fs/types}/range/module.f.js +0 -0
- /package/{types → fs/types}/range/test.f.d.ts +0 -0
- /package/{types → fs/types}/range/test.f.js +0 -0
- /package/{types → fs/types}/range_map/module.f.d.ts +0 -0
- /package/{types → fs/types}/range_map/module.f.js +0 -0
- /package/{types → fs/types}/range_map/test.f.d.ts +0 -0
- /package/{types → fs/types}/range_map/test.f.js +0 -0
- /package/{types → fs/types}/result/module.d.ts +0 -0
- /package/{types → fs/types}/result/module.f.d.ts +0 -0
- /package/{types → fs/types}/result/module.f.js +0 -0
- /package/{types → fs/types}/result/module.js +0 -0
- /package/{types → fs/types}/result/test.f.d.ts +0 -0
- /package/{types → fs/types}/result/test.f.js +0 -0
- /package/{types → fs/types}/rtti/ts/module.f.d.ts +0 -0
- /package/{types → fs/types}/rtti/ts/module.f.js +0 -0
- /package/{types → fs/types}/rtti/ts/test.f.d.ts +0 -0
- /package/{types → fs/types}/rtti/ts/test.f.js +0 -0
- /package/{types → fs/types}/sorted_list/module.f.d.ts +0 -0
- /package/{types → fs/types}/sorted_list/module.f.js +0 -0
- /package/{types → fs/types}/sorted_list/test.f.d.ts +0 -0
- /package/{types → fs/types}/sorted_list/test.f.js +0 -0
- /package/{types → fs/types}/sorted_set/module.f.d.ts +0 -0
- /package/{types → fs/types}/sorted_set/module.f.js +0 -0
- /package/{types → fs/types}/sorted_set/test.f.d.ts +0 -0
- /package/{types → fs/types}/sorted_set/test.f.js +0 -0
- /package/{types → fs/types}/string/module.f.d.ts +0 -0
- /package/{types → fs/types}/string/module.f.js +0 -0
- /package/{types → fs/types}/string/test.f.d.ts +0 -0
- /package/{types → fs/types}/string/test.f.js +0 -0
- /package/{types → fs/types}/string_set/module.f.d.ts +0 -0
- /package/{types → fs/types}/string_set/module.f.js +0 -0
- /package/{types → fs/types}/string_set/test.f.d.ts +0 -0
- /package/{types → fs/types}/string_set/test.f.js +0 -0
- /package/{types → fs/types}/ts/module.f.d.ts +0 -0
- /package/{types → fs/types}/ts/module.f.js +0 -0
- /package/{types → fs/types}/uint8array/module.f.js +0 -0
- /package/{types → fs/types}/uint8array/test.f.d.ts +0 -0
- /package/{types → fs/types}/uint8array/test.f.js +0 -0
- /package/{website → fs/website}/module.f.d.ts +0 -0
- /package/{website → fs/website}/module.f.js +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { includes } from "../array/module.f.js";
|
|
2
|
+
const primitive0List = ['bigint', 'boolean', 'number', 'string'];
|
|
3
|
+
export const tag0List = [...primitive0List, 'unknown'];
|
|
4
|
+
const type0 = (tag) => () => [tag];
|
|
5
|
+
/** Schema that validates `boolean` values. */
|
|
6
|
+
export const boolean = type0('boolean');
|
|
7
|
+
/** Schema that validates `number` values. */
|
|
8
|
+
export const number = type0('number');
|
|
9
|
+
/** Schema that validates `string` values. */
|
|
10
|
+
export const string = type0('string');
|
|
11
|
+
/** Schema that validates `bigint` values. */
|
|
12
|
+
export const bigint = type0('bigint');
|
|
13
|
+
/** Schema that validates any DJS-compatible value. */
|
|
14
|
+
export const unknown = type0('unknown');
|
|
15
|
+
const tag1List = ['array', 'record'];
|
|
16
|
+
export const isTag1 = includes(tag1List);
|
|
17
|
+
const type1 = (key) => t => () => [key, t];
|
|
18
|
+
/** Constructs a schema that validates `readonly Ts<T>[]`. */
|
|
19
|
+
export const array = type1('array');
|
|
20
|
+
/** Constructs a schema that validates `{ readonly[K in string]: Ts<T> }`. */
|
|
21
|
+
export const record = type1('record');
|
|
22
|
+
/** Reads the tag of a thunk variant, or returns `null` for a `Const`. */
|
|
23
|
+
const variantTag = (t) => typeof t === 'function' ? t()[0] : null;
|
|
24
|
+
const isPrim0 = includes(primitive0List);
|
|
25
|
+
const flattenStep = ([visited, out], t) => {
|
|
26
|
+
if (typeof t === 'function' && !visited.has(t)) {
|
|
27
|
+
const nextVisited = new Set([...visited, t]);
|
|
28
|
+
const info = t();
|
|
29
|
+
if (info[0] === 'or') {
|
|
30
|
+
const [v, inner] = info.slice(1)
|
|
31
|
+
.reduce(flattenStep, [nextVisited, []]);
|
|
32
|
+
return [v, [...out, ...inner]];
|
|
33
|
+
}
|
|
34
|
+
return [nextVisited, [...out, t]];
|
|
35
|
+
}
|
|
36
|
+
return [visited, [...out, t]];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Walks `types` and produces a flat list of `or` variants:
|
|
40
|
+
*
|
|
41
|
+
* - Variants whose thunk resolves to `['or', ...]` are inlined.
|
|
42
|
+
* - Each thunk is resolved at most once; thunks reached a second time are
|
|
43
|
+
* kept as-is, so self-referential `or` schemas terminate.
|
|
44
|
+
*/
|
|
45
|
+
const flattenOr = (types) => types.reduce(flattenStep, [new Set(), []])[1];
|
|
46
|
+
const collectStep = ([u, p], t) => {
|
|
47
|
+
if (u) {
|
|
48
|
+
return [u, p];
|
|
49
|
+
}
|
|
50
|
+
const tag = variantTag(t);
|
|
51
|
+
if (tag === 'unknown') {
|
|
52
|
+
return [true, p];
|
|
53
|
+
}
|
|
54
|
+
return tag !== null && isPrim0(tag) ? [u, new Set([...p, tag])] : [u, p];
|
|
55
|
+
};
|
|
56
|
+
const dedupStep = ([primThunks, acc], t) => primThunks.has(typeof t) || acc.some(r => Object.is(r, t))
|
|
57
|
+
? [primThunks, acc]
|
|
58
|
+
: [primThunks, [...acc, t]];
|
|
59
|
+
/**
|
|
60
|
+
* Drops variants that are trivially subsumed by another variant.
|
|
61
|
+
*
|
|
62
|
+
* Trivial subset rules handled here:
|
|
63
|
+
* - any variant ⊆ `unknown` — if `unknown` is present, the entire union is
|
|
64
|
+
* `unknown`.
|
|
65
|
+
* - a primitive const ⊆ its primitive type thunk — `42 ⊆ number`,
|
|
66
|
+
* `'hi' ⊆ string`, `true ⊆ boolean`, `7n ⊆ bigint`.
|
|
67
|
+
*
|
|
68
|
+
* `Object.is` is used for deduplication, so `NaN` collapses with itself and
|
|
69
|
+
* `+0` and `-0` stay distinct — matching `constPrimitiveValidate`.
|
|
70
|
+
*
|
|
71
|
+
* Full structural subset (tuples/structs/`or`/recursive schemas) is left to
|
|
72
|
+
* a future change — see goals 1 and 3 of issue 130.
|
|
73
|
+
*/
|
|
74
|
+
const reduceOr = (types) => {
|
|
75
|
+
const flat = flattenOr(types);
|
|
76
|
+
const [hasUnknown, primThunks] = flat.reduce(collectStep, [false, new Set()]);
|
|
77
|
+
return hasUnknown
|
|
78
|
+
? [unknown]
|
|
79
|
+
: flat.reduce(dedupStep, [primThunks, []])[1];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Constructs a schema that validates a value matching any of the given schemas.
|
|
83
|
+
*
|
|
84
|
+
* The resulting `or` is normalized at construction time:
|
|
85
|
+
* - nested `or` thunks are flattened into the outer union,
|
|
86
|
+
* - any `unknown` variant collapses the whole union to `unknown`,
|
|
87
|
+
* - primitive consts subsumed by a matching primitive thunk are dropped
|
|
88
|
+
* (e.g. `or(42, number)` → `or(number)`),
|
|
89
|
+
* - duplicate variants are deduplicated via `Object.is`.
|
|
90
|
+
*
|
|
91
|
+
* See `issues/130-or-optimization.md`.
|
|
92
|
+
*/
|
|
93
|
+
export const or = (...types) => {
|
|
94
|
+
const reduced = reduceOr(types);
|
|
95
|
+
return (() => ['or', ...reduced]);
|
|
96
|
+
};
|
|
97
|
+
/** Constructs a schema that validates a value matching `T` or `undefined`. */
|
|
98
|
+
export const option = (t) => or(t, undefined);
|
|
99
|
+
/** Schema that never matches any value — the empty union, corresponding to TypeScript's `never`. */
|
|
100
|
+
export const never = or();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Type } from '../module.f.ts';
|
|
2
|
+
import { type Result as ValidateResult, type Validate } from '../validate/module.f.ts';
|
|
3
|
+
export type { Path, ValidationError } from '../validate/module.f.ts';
|
|
4
|
+
/** Parse result: either the freshly constructed typed value or a `ValidationError`. */
|
|
5
|
+
export type Result<T extends Type> = ValidateResult<T>;
|
|
6
|
+
/** A function that parses an unknown value into the schema `T`. */
|
|
7
|
+
export type Parse<T extends Type> = Validate<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a parser function for the given RTTI schema.
|
|
10
|
+
*
|
|
11
|
+
* The returned function takes an unknown value and returns either
|
|
12
|
+
* `['ok', newValue]` containing a freshly constructed value matching the schema,
|
|
13
|
+
* or `['error', { path, message }]` describing the failure location.
|
|
14
|
+
*
|
|
15
|
+
* @param rtti - A schema `Type`: a `Thunk` for tag-based schemas, or a `Const`
|
|
16
|
+
* (primitive literal, tuple, or struct) for exact-value schemas.
|
|
17
|
+
* @returns A `Parse<T>` function.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const p = parse(array(number))
|
|
22
|
+
* p([1, 2, 3]) // ['ok', [1, 2, 3]] (a new array)
|
|
23
|
+
* p([1, 'two']) // ['error', { path: ['1'], message: 'unexpected value' }]
|
|
24
|
+
*
|
|
25
|
+
* // tuples are closed: extra elements are dropped
|
|
26
|
+
* parse([number, number] as const)([1, 2, 3]) // ['ok', [1, 2]]
|
|
27
|
+
*
|
|
28
|
+
* // structs drop undeclared keys
|
|
29
|
+
* parse({ a: number } as const)({ a: 1, b: 2 }) // ['ok', { a: 1 }]
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const parse: <T extends Type>(rtti: T) => Parse<T>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {} from "../module.f.js";
|
|
2
|
+
import { ok } from "../../result/module.f.js";
|
|
3
|
+
import { constPrimitiveValidate, prependPath, primitive0Validate, verror, } from "../validate/module.f.js";
|
|
4
|
+
import { isArray as commonIsArray } from "../../array/module.f.js";
|
|
5
|
+
import { isObject as commonIsObject } from "../../object/module.f.js";
|
|
6
|
+
import { find, map as listMap } from "../../list/module.f.js";
|
|
7
|
+
const indexedFirstError = (results) => {
|
|
8
|
+
// TODO: findIndex breaks type inference,
|
|
9
|
+
// we should replace it with something else.
|
|
10
|
+
const i = results.findIndex(r => r[0] === 'error');
|
|
11
|
+
return i < 0 ? null : [i, results[i]];
|
|
12
|
+
};
|
|
13
|
+
const keyedFirstError = (results) => {
|
|
14
|
+
const e = results.find(([, r]) => r[0] === 'error');
|
|
15
|
+
return e === undefined ? null : [e[0], e[1]];
|
|
16
|
+
};
|
|
17
|
+
const arrayParse = (item) => value => {
|
|
18
|
+
if (!commonIsArray(value)) {
|
|
19
|
+
return verror('unexpected value');
|
|
20
|
+
}
|
|
21
|
+
if (value.length === 0) {
|
|
22
|
+
return ok([]);
|
|
23
|
+
}
|
|
24
|
+
// Note: we shouldn't instantiate `itemParse` until we know the array is non-empty.
|
|
25
|
+
// Otherwise, we can get infinite recursion on empty arrays for recursive schemas.
|
|
26
|
+
const itemParse = parse(item);
|
|
27
|
+
const results = value.map(itemParse);
|
|
28
|
+
const err = indexedFirstError(results);
|
|
29
|
+
return (err === null
|
|
30
|
+
? ok(results.map(r => r[1]))
|
|
31
|
+
: prependPath(String(err[0]), err[1]));
|
|
32
|
+
};
|
|
33
|
+
const recordParse = (item) => value => {
|
|
34
|
+
if (!commonIsObject(value)) {
|
|
35
|
+
return verror('unexpected value');
|
|
36
|
+
}
|
|
37
|
+
const entries = Object.entries(value);
|
|
38
|
+
if (entries.length === 0) {
|
|
39
|
+
return ok({});
|
|
40
|
+
}
|
|
41
|
+
const itemParse = parse(item);
|
|
42
|
+
const results = entries.map(([k, v]) => [k, itemParse(v)]);
|
|
43
|
+
const err = keyedFirstError(results);
|
|
44
|
+
return (err === null
|
|
45
|
+
? ok(Object.fromEntries(results.map(([k, r]) => [k, r[1]])))
|
|
46
|
+
: prependPath(err[0], err[1]));
|
|
47
|
+
};
|
|
48
|
+
const tupleParse = (rtti) => value => {
|
|
49
|
+
if (!commonIsArray(value)) {
|
|
50
|
+
return verror('unexpected value');
|
|
51
|
+
}
|
|
52
|
+
const results = rtti.map((t, i) => parse(t)(value[i]));
|
|
53
|
+
const err = indexedFirstError(results);
|
|
54
|
+
return (err === null
|
|
55
|
+
? ok(results.map(r => r[1]))
|
|
56
|
+
: prependPath(String(err[0]), err[1]));
|
|
57
|
+
};
|
|
58
|
+
const structParse = (rtti) => value => {
|
|
59
|
+
if (!commonIsObject(value)) {
|
|
60
|
+
return verror('unexpected value');
|
|
61
|
+
}
|
|
62
|
+
const results = Object.entries(rtti).map(([k, t]) => [k, parse(t)(value[k])]);
|
|
63
|
+
const err = keyedFirstError(results);
|
|
64
|
+
return (err === null
|
|
65
|
+
? ok(Object.fromEntries(results.map(([k, r]) => [k, r[1]])))
|
|
66
|
+
: prependPath(err[0], err[1]));
|
|
67
|
+
};
|
|
68
|
+
const constObjectParse = (rtti) => commonIsArray(rtti)
|
|
69
|
+
? tupleParse(rtti)
|
|
70
|
+
: structParse(rtti);
|
|
71
|
+
const constParse = (rtti) => typeof rtti === 'object' && rtti !== null
|
|
72
|
+
? constObjectParse(rtti)
|
|
73
|
+
: constPrimitiveValidate(rtti);
|
|
74
|
+
const findFirst = find(verror('no match'))((k) => k[0] === 'ok');
|
|
75
|
+
const orParse = (rtti) => value => findFirst(listMap(t => parse(t)(value))(rtti));
|
|
76
|
+
/**
|
|
77
|
+
* Creates a parser function for the given RTTI schema.
|
|
78
|
+
*
|
|
79
|
+
* The returned function takes an unknown value and returns either
|
|
80
|
+
* `['ok', newValue]` containing a freshly constructed value matching the schema,
|
|
81
|
+
* or `['error', { path, message }]` describing the failure location.
|
|
82
|
+
*
|
|
83
|
+
* @param rtti - A schema `Type`: a `Thunk` for tag-based schemas, or a `Const`
|
|
84
|
+
* (primitive literal, tuple, or struct) for exact-value schemas.
|
|
85
|
+
* @returns A `Parse<T>` function.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const p = parse(array(number))
|
|
90
|
+
* p([1, 2, 3]) // ['ok', [1, 2, 3]] (a new array)
|
|
91
|
+
* p([1, 'two']) // ['error', { path: ['1'], message: 'unexpected value' }]
|
|
92
|
+
*
|
|
93
|
+
* // tuples are closed: extra elements are dropped
|
|
94
|
+
* parse([number, number] as const)([1, 2, 3]) // ['ok', [1, 2]]
|
|
95
|
+
*
|
|
96
|
+
* // structs drop undeclared keys
|
|
97
|
+
* parse({ a: number } as const)({ a: 1, b: 2 }) // ['ok', { a: 1 }]
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export const parse = (rtti) => {
|
|
101
|
+
if (typeof rtti === 'function') {
|
|
102
|
+
const [tag, ...value] = rtti();
|
|
103
|
+
switch (tag) {
|
|
104
|
+
case 'const': return constParse(value[0]);
|
|
105
|
+
case 'array': return arrayParse(value[0]);
|
|
106
|
+
case 'record': return recordParse(value[0]);
|
|
107
|
+
case 'unknown': return ok;
|
|
108
|
+
case 'or': return orParse(value);
|
|
109
|
+
}
|
|
110
|
+
return primitive0Validate(tag);
|
|
111
|
+
}
|
|
112
|
+
return constParse(rtti);
|
|
113
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
boolean: {
|
|
3
|
+
ok: () => void;
|
|
4
|
+
error: () => void;
|
|
5
|
+
};
|
|
6
|
+
number: {
|
|
7
|
+
ok: () => void;
|
|
8
|
+
error: () => void;
|
|
9
|
+
};
|
|
10
|
+
string: {
|
|
11
|
+
ok: () => void;
|
|
12
|
+
error: () => void;
|
|
13
|
+
};
|
|
14
|
+
bigint: {
|
|
15
|
+
ok: () => void;
|
|
16
|
+
error: () => void;
|
|
17
|
+
};
|
|
18
|
+
unknown: {
|
|
19
|
+
ok: () => void;
|
|
20
|
+
};
|
|
21
|
+
const: {
|
|
22
|
+
null: {
|
|
23
|
+
ok: () => void;
|
|
24
|
+
error: () => void;
|
|
25
|
+
};
|
|
26
|
+
undefined: {
|
|
27
|
+
ok: () => void;
|
|
28
|
+
error: () => void;
|
|
29
|
+
};
|
|
30
|
+
number: {
|
|
31
|
+
ok: () => void;
|
|
32
|
+
error: () => void;
|
|
33
|
+
};
|
|
34
|
+
nan: {
|
|
35
|
+
ok: () => void;
|
|
36
|
+
error: () => void;
|
|
37
|
+
};
|
|
38
|
+
infinity: {
|
|
39
|
+
ok: () => void;
|
|
40
|
+
error: () => void;
|
|
41
|
+
};
|
|
42
|
+
signedZero: {
|
|
43
|
+
distinct: () => void;
|
|
44
|
+
self: () => void;
|
|
45
|
+
};
|
|
46
|
+
string: {
|
|
47
|
+
ok: () => void;
|
|
48
|
+
error: () => void;
|
|
49
|
+
};
|
|
50
|
+
bigint: {
|
|
51
|
+
ok: () => void;
|
|
52
|
+
error: () => void;
|
|
53
|
+
};
|
|
54
|
+
boolean: {
|
|
55
|
+
ok: () => void;
|
|
56
|
+
error: () => void;
|
|
57
|
+
};
|
|
58
|
+
tuple: {
|
|
59
|
+
ok: () => void;
|
|
60
|
+
extraItemsDropped: () => void;
|
|
61
|
+
error: () => void;
|
|
62
|
+
};
|
|
63
|
+
struct: {
|
|
64
|
+
ok: () => void;
|
|
65
|
+
extraKeysDropped: () => void;
|
|
66
|
+
error: () => void;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
array: {
|
|
70
|
+
empty: () => void;
|
|
71
|
+
ok: () => void;
|
|
72
|
+
freshArray: () => void;
|
|
73
|
+
error: () => void;
|
|
74
|
+
nested: () => void;
|
|
75
|
+
};
|
|
76
|
+
record: {
|
|
77
|
+
empty: () => void;
|
|
78
|
+
ok: () => void;
|
|
79
|
+
freshRecord: () => void;
|
|
80
|
+
error: () => void;
|
|
81
|
+
};
|
|
82
|
+
constThunk: {
|
|
83
|
+
primitive: () => void;
|
|
84
|
+
};
|
|
85
|
+
or: {
|
|
86
|
+
consts: {
|
|
87
|
+
ok: () => void;
|
|
88
|
+
error: () => void;
|
|
89
|
+
};
|
|
90
|
+
thunks: {
|
|
91
|
+
ok: () => void;
|
|
92
|
+
error: () => void;
|
|
93
|
+
};
|
|
94
|
+
firstMatchWins: () => void;
|
|
95
|
+
};
|
|
96
|
+
option: {
|
|
97
|
+
ok: () => void;
|
|
98
|
+
error: () => void;
|
|
99
|
+
};
|
|
100
|
+
path: {
|
|
101
|
+
rootMismatch: () => void;
|
|
102
|
+
arrayIndex: () => void;
|
|
103
|
+
recordKey: () => void;
|
|
104
|
+
nestedArray: () => void;
|
|
105
|
+
tupleIndex: () => void;
|
|
106
|
+
structKey: () => void;
|
|
107
|
+
deepStruct: () => void;
|
|
108
|
+
recursiveSchema: () => void;
|
|
109
|
+
orRoot: () => void;
|
|
110
|
+
};
|
|
111
|
+
recursive: {
|
|
112
|
+
arrayOfArrays: () => void;
|
|
113
|
+
recordOfRecords: () => void;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export default _default;
|