functionalscript 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fjs/asn.1/proof.f.d.mts +5 -0
- package/fjs/asn.1/proof.f.mjs +15 -3
- package/fjs/asserts/module.f.d.mts +14 -0
- package/fjs/asserts/module.f.mjs +20 -0
- package/fjs/asserts/proof.f.d.mts +3 -0
- package/fjs/asserts/proof.f.mjs +15 -1
- package/fjs/basen/base128/proof.f.d.mts +3 -1
- package/fjs/basen/base128/proof.f.mjs +3 -1
- package/fjs/basen/base64/module.f.mjs +7 -3
- package/fjs/basen/base64/proof.f.d.mts +3 -1
- package/fjs/basen/base64/proof.f.mjs +7 -4
- package/fjs/basen/cbase32/proof.f.d.mts +3 -1
- package/fjs/basen/cbase32/proof.f.mjs +3 -1
- package/fjs/bnf/data/proof.f.mjs +0 -1
- package/fjs/bnf/descent/module.f.d.mts +17 -2
- package/fjs/bnf/descent/module.f.mjs +118 -41
- package/fjs/bnf/descent/proof.f.d.mts +1 -0
- package/fjs/bnf/descent/proof.f.mjs +77 -1
- package/fjs/bnf/descent/types.d.ts +12 -4
- package/fjs/bnf/ll1/module.f.d.mts +28 -2
- package/fjs/bnf/ll1/module.f.mjs +180 -38
- package/fjs/bnf/ll1/proof.f.d.mts +2 -0
- package/fjs/bnf/ll1/proof.f.mjs +62 -1
- package/fjs/bnf/ll1/types.d.ts +14 -8
- package/fjs/bnf/module.f.d.mts +15 -6
- package/fjs/bnf/module.f.mjs +52 -11
- package/fjs/bnf/proof.f.d.mts +2 -0
- package/fjs/bnf/proof.f.mjs +79 -3
- package/fjs/bnf/token_symbol/module.f.d.mts +4 -3
- package/fjs/bnf/token_symbol/module.f.mjs +7 -6
- package/fjs/bnf/token_symbol/proof.f.mjs +5 -2
- package/fjs/bnf/token_symbol/types.d.ts +2 -2
- package/fjs/bnf/types.d.ts +10 -3
- package/fjs/cas/cli/proof.f.d.mts +3 -1
- package/fjs/cas/cli/proof.f.mjs +3 -1
- package/fjs/cas/evo/module.f.d.mts +7 -13
- package/fjs/cas/evo/module.f.mjs +103 -96
- package/fjs/cas/evo/proof.f.mjs +6 -3
- package/fjs/cas/module.f.mjs +96 -109
- package/fjs/ci/common/module.f.d.mts +1 -1
- package/fjs/ci/common/module.f.mjs +1 -0
- package/fjs/ci/config/module.f.d.mts +2 -2
- package/fjs/ci/config/module.f.mjs +2 -2
- package/fjs/ci/nix/proof.f.d.mts +2 -0
- package/fjs/ci/nix/proof.f.mjs +2 -2
- package/fjs/ci/proof.f.d.mts +4 -2
- package/fjs/ci/proof.f.mjs +4 -3
- package/fjs/cli/proof.f.d.mts +4 -2
- package/fjs/cli/proof.f.mjs +4 -2
- package/fjs/common/monoid/module.f.d.mts +70 -12
- package/fjs/common/monoid/module.f.mjs +177 -14
- package/fjs/common/monoid/proof.f.d.mts +12 -1
- package/fjs/common/monoid/proof.f.mjs +88 -4
- package/fjs/common/monoid/types.d.ts +23 -0
- package/fjs/crypto/secp/proof.f.d.mts +3 -1
- package/fjs/crypto/secp/proof.f.mjs +3 -1
- package/fjs/crypto/sha2/proof.f.d.mts +3 -1
- package/fjs/crypto/sha2/proof.f.mjs +3 -1
- package/fjs/crypto/vdf/module.f.d.mts +23 -4
- package/fjs/crypto/vdf/module.f.mjs +6 -4
- package/fjs/dev/module.f.d.mts +5 -2
- package/fjs/dev/module.f.mjs +5 -4
- package/fjs/dev/package_json/module.f.d.mts +7 -0
- package/fjs/dev/package_json/module.f.mjs +10 -7
- package/fjs/dev/update/module.f.d.mts +3 -0
- package/fjs/dev/update/module.f.mjs +3 -2
- package/fjs/dev/update/proof.f.d.mts +3 -0
- package/fjs/dev/update/proof.f.mjs +1 -2
- package/fjs/djs/parser/module.f.d.mts +3 -0
- package/fjs/djs/parser/module.f.mjs +18 -0
- package/fjs/djs/parser/proof.f.d.mts +3 -0
- package/fjs/djs/parser/proof.f.mjs +13 -1
- package/fjs/djs/proof.f.d.mts +3 -0
- package/fjs/djs/proof.f.mjs +4 -1
- package/fjs/djs/serializer/module.f.mjs +5 -4
- package/fjs/djs/tokenizer/module.f.mjs +21 -13
- package/fjs/djs/tokenizer/proof.f.d.mts +3 -0
- package/fjs/djs/tokenizer/proof.f.mjs +14 -2
- package/fjs/djs/transpiler/module.f.d.mts +1 -12
- package/fjs/djs/transpiler/module.f.mjs +1 -20
- package/fjs/djs/transpiler/types.d.ts +25 -0
- package/fjs/effects/eff/module.f.d.mts +10 -0
- package/fjs/effects/eff/module.f.mjs +4 -2
- package/fjs/effects/eff/proof.f.d.mts +3 -0
- package/fjs/effects/eff/proof.f.mjs +4 -1
- package/fjs/effects/list/module.f.d.mts +10 -2
- package/fjs/effects/list/module.f.mjs +4 -2
- package/fjs/effects/memory/module.f.d.mts +4 -2
- package/fjs/effects/memory/module.f.mjs +4 -3
- package/fjs/effects/memory/proof.f.d.mts +4 -0
- package/fjs/effects/memory/proof.f.mjs +5 -2
- package/fjs/effects/mock/module.f.d.mts +10 -2
- package/fjs/effects/mock/module.f.mjs +4 -2
- package/fjs/effects/module.d.mts +8 -0
- package/fjs/effects/module.f.d.mts +6 -4
- package/fjs/effects/module.f.mjs +6 -5
- package/fjs/effects/module.mjs +9 -1
- package/fjs/effects/node/memory/module.d.mts +3 -0
- package/fjs/effects/node/memory/module.mjs +3 -2
- package/fjs/effects/node/memory/proof.d.mts +2 -0
- package/fjs/effects/node/memory/proof.mjs +2 -1
- package/fjs/effects/node/module.d.mts +5 -0
- package/fjs/effects/node/module.f.d.mts +17 -12
- package/fjs/effects/node/module.f.mjs +6 -12
- package/fjs/effects/node/module.mjs +5 -17
- package/fjs/effects/node/virtual/module.f.d.mts +6 -3
- package/fjs/effects/node/virtual/module.f.mjs +6 -5
- package/fjs/effects/node/virtual/proof.f.d.mts +4 -1
- package/fjs/effects/node/virtual/proof.f.mjs +13 -1
- package/fjs/effects/proof.f.d.mts +3 -0
- package/fjs/effects/proof.f.mjs +4 -1
- package/fjs/emergent_testing/all.test.d.mts +8 -0
- package/fjs/emergent_testing/all.test.mjs +14 -0
- package/fjs/emergent_testing/module.f.d.mts +6 -1
- package/fjs/emergent_testing/module.f.mjs +40 -66
- package/fjs/emergent_testing/proof.f.mjs +5 -5
- package/fjs/fsc/bnf.f.d.mts +3 -0
- package/fjs/fsc/bnf.f.mjs +4 -1
- package/fjs/fsc/json.f.d.mts +3 -0
- package/fjs/fsc/json.f.mjs +4 -1
- package/fjs/fsc/module.f.d.mts +9 -0
- package/fjs/fsc/module.f.mjs +5 -3
- package/fjs/fsm/proof.f.d.mts +3 -0
- package/fjs/fsm/proof.f.mjs +4 -1
- package/fjs/js/tokenizer/module.f.d.mts +7 -0
- package/fjs/js/tokenizer/module.f.mjs +19 -55
- package/fjs/mcp/module.f.d.mts +36 -1
- package/fjs/mcp/module.f.mjs +9 -7
- package/fjs/mcp/proof.f.d.mts +11 -1
- package/fjs/mcp/proof.f.mjs +11 -18
- package/fjs/media/html/module.f.d.mts +12 -0
- package/fjs/media/html/module.f.mjs +6 -4
- package/fjs/media/html/proof.f.d.mts +3 -0
- package/fjs/media/html/proof.f.mjs +4 -1
- package/fjs/media/json/parser/module.f.d.mts +1 -1
- package/fjs/media/json/parser/module.f.mjs +25 -8
- package/fjs/media/json/parser/types.d.ts +5 -0
- package/fjs/media/json/rtti/proof.f.d.mts +3 -0
- package/fjs/media/json/rtti/proof.f.mjs +3 -3
- package/fjs/media/json/schema/module.f.d.mts +61 -27
- package/fjs/media/json/schema/module.f.mjs +228 -63
- package/fjs/media/json/schema/proof.f.d.mts +41 -0
- package/fjs/media/json/schema/proof.f.mjs +219 -7
- package/fjs/media/json/serializer/module.f.d.mts +13 -0
- package/fjs/media/json/serializer/module.f.mjs +7 -7
- package/fjs/media/json/tokenizer/module.f.d.mts +8 -0
- package/fjs/media/json/tokenizer/module.f.mjs +24 -5
- package/fjs/media/nix/module.f.d.mts +13 -0
- package/fjs/media/nix/module.f.mjs +4 -2
- package/fjs/media/nix/proof.f.d.mts +3 -0
- package/fjs/media/nix/proof.f.mjs +4 -1
- package/fjs/media/revision/module.f.d.mts +5 -0
- package/fjs/media/revision/module.f.mjs +8 -11
- package/fjs/media/revision/proof.f.d.mts +4 -0
- package/fjs/media/revision/proof.f.mjs +5 -2
- package/fjs/media/type/module.f.d.mts +28 -11
- package/fjs/media/type/module.f.mjs +69 -85
- package/fjs/media/type/proof.f.d.mts +16 -0
- package/fjs/media/type/proof.f.mjs +44 -4
- package/fjs/module.d.mts +5 -0
- package/fjs/module.f.d.mts +8 -0
- package/fjs/module.f.mjs +4 -2
- package/fjs/module.mjs +6 -0
- package/fjs/path/module.f.d.mts +8 -0
- package/fjs/path/module.f.mjs +4 -2
- package/fjs/proof.f.d.mts +4 -0
- package/fjs/proof.f.mjs +5 -2
- package/fjs/protocol/json_rpc/module.f.d.mts +1 -1
- package/fjs/protocol/json_rpc/module.f.mjs +7 -4
- package/fjs/protocol/json_rpc/proof.f.d.mts +6 -0
- package/fjs/protocol/json_rpc/proof.f.mjs +22 -1
- package/fjs/protocol/mcp/proof.f.d.mts +4 -0
- package/fjs/protocol/mcp/proof.f.mjs +47 -24
- package/fjs/protocol/mcp/stdio/module.f.d.mts +2 -4
- package/fjs/protocol/mcp/stdio/module.f.mjs +1 -8
- package/fjs/protocol/mcp/stdio/proof.f.d.mts +1 -1
- package/fjs/protocol/mcp/stdio/proof.f.mjs +1 -1
- package/fjs/protocol/mcp/stdio/types.d.ts +14 -0
- package/fjs/sul/id/module.f.d.mts +5 -0
- package/fjs/sul/id/module.f.mjs +5 -4
- package/fjs/sul/level/hash/module.f.d.mts +4 -1
- package/fjs/sul/level/hash/module.f.mjs +4 -3
- package/fjs/sul/level/hash/proof.f.d.mts +4 -0
- package/fjs/sul/level/hash/proof.f.mjs +5 -2
- package/fjs/sul/level/literal/module.f.d.mts +4 -1
- package/fjs/sul/level/literal/module.f.mjs +4 -3
- package/fjs/sul/level/literal/proof.f.d.mts +3 -0
- package/fjs/sul/level/literal/proof.f.mjs +4 -1
- package/fjs/sul/module.f.d.mts +5 -3
- package/fjs/sul/module.f.mjs +5 -4
- package/fjs/sul/proof.f.d.mts +4 -0
- package/fjs/sul/proof.f.mjs +5 -2
- package/fjs/text/ascii/module.f.d.mts +26 -0
- package/fjs/text/ascii/module.f.mjs +49 -1
- package/fjs/text/ascii/proof.f.d.mts +10 -0
- package/fjs/text/ascii/proof.f.mjs +33 -1
- package/fjs/text/code_point/module.f.d.mts +21 -3
- package/fjs/text/code_point/module.f.mjs +24 -8
- package/fjs/text/code_point/proof.f.d.mts +1 -0
- package/fjs/text/code_point/proof.f.mjs +28 -0
- package/fjs/text/module.f.d.mts +4 -2
- package/fjs/text/module.f.mjs +4 -3
- package/fjs/text/proof.f.d.mts +3 -0
- package/fjs/text/proof.f.mjs +4 -1
- package/fjs/text/sgr/module.f.d.mts +4 -1
- package/fjs/text/sgr/module.f.mjs +4 -3
- package/fjs/text/sgr/proof.f.d.mts +3 -0
- package/fjs/text/sgr/proof.f.mjs +4 -1
- package/fjs/text/utf16/module.f.d.mts +5 -1
- package/fjs/text/utf16/module.f.mjs +31 -33
- package/fjs/text/utf16/proof.f.d.mts +3 -1
- package/fjs/text/utf16/proof.f.mjs +18 -1
- package/fjs/text/utf8/module.f.d.mts +9 -5
- package/fjs/text/utf8/module.f.mjs +16 -18
- package/fjs/types/array/module.f.d.mts +2 -1
- package/fjs/types/array/module.f.mjs +2 -2
- package/fjs/types/bigfloat/module.f.d.mts +21 -1
- package/fjs/types/bigfloat/module.f.mjs +33 -7
- package/fjs/types/bigfloat/proof.f.d.mts +1 -0
- package/fjs/types/bigfloat/proof.f.mjs +46 -0
- package/fjs/types/bigint/module.f.d.mts +4 -0
- package/fjs/types/bigint/module.f.mjs +4 -3
- package/fjs/types/bit_vec/module.f.d.mts +10 -14
- package/fjs/types/bit_vec/module.f.mjs +61 -71
- package/fjs/types/bit_vec/proof.f.d.mts +6 -0
- package/fjs/types/bit_vec/proof.f.mjs +29 -3
- package/fjs/types/btree/find/module.f.d.mts +5 -1
- package/fjs/types/btree/find/module.f.mjs +5 -5
- package/fjs/types/btree/find/proof.f.d.mts +5 -1
- package/fjs/types/btree/find/proof.f.mjs +5 -3
- package/fjs/types/btree/module.f.d.mts +3 -0
- package/fjs/types/btree/module.f.mjs +3 -2
- package/fjs/types/btree/proof.f.d.mts +5 -1
- package/fjs/types/btree/proof.f.mjs +5 -3
- package/fjs/types/btree/remove/module.f.d.mts +11 -0
- package/fjs/types/btree/remove/module.f.mjs +9 -9
- package/fjs/types/btree/remove/proof.f.d.mts +3 -0
- package/fjs/types/btree/remove/proof.f.mjs +4 -1
- package/fjs/types/btree/set/module.f.d.mts +9 -0
- package/fjs/types/btree/set/module.f.mjs +5 -6
- package/fjs/types/btree/set/proof.f.d.mts +3 -0
- package/fjs/types/btree/set/proof.f.mjs +4 -1
- package/fjs/types/btree/types/module.f.d.mts +2 -1
- package/fjs/types/btree/types/module.f.mjs +2 -1
- package/fjs/types/byte_set/module.f.d.mts +10 -1
- package/fjs/types/byte_set/module.f.mjs +5 -3
- package/fjs/types/byte_set/proof.f.d.mts +3 -1
- package/fjs/types/byte_set/proof.f.mjs +3 -1
- package/fjs/types/function/compare/module.f.d.mts +3 -2
- package/fjs/types/function/compare/module.f.mjs +3 -2
- package/fjs/types/function/module.f.d.mts +8 -1
- package/fjs/types/function/module.f.mjs +8 -1
- package/fjs/types/function/operator/module.f.d.mts +2 -1
- package/fjs/types/function/operator/module.f.mjs +2 -2
- package/fjs/types/list/module.f.d.mts +9 -2
- package/fjs/types/list/module.f.mjs +5 -3
- package/fjs/types/list/proof.f.d.mts +4 -1
- package/fjs/types/list/proof.f.mjs +4 -2
- package/fjs/types/nibble_set/module.f.d.mts +2 -1
- package/fjs/types/nibble_set/module.f.mjs +2 -2
- package/fjs/types/nominal/module.f.d.mts +2 -1
- package/fjs/types/nominal/module.f.mjs +2 -1
- package/fjs/types/nullable/module.f.d.mts +8 -2
- package/fjs/types/nullable/module.f.mjs +4 -2
- package/fjs/types/number/module.f.d.mts +4 -0
- package/fjs/types/number/module.f.mjs +4 -3
- package/fjs/types/object/module.f.d.mts +14 -2
- package/fjs/types/object/module.f.mjs +15 -6
- package/fjs/types/object/proof.f.d.mts +5 -2
- package/fjs/types/object/proof.f.mjs +6 -3
- package/fjs/types/object/structurally_same/module.f.d.mts +39 -0
- package/fjs/types/object/structurally_same/module.f.mjs +59 -0
- package/fjs/types/object/structurally_same/proof.f.d.mts +6 -0
- package/fjs/types/object/structurally_same/proof.f.mjs +73 -0
- package/fjs/types/ordered_map/module.f.d.mts +5 -0
- package/fjs/types/ordered_map/module.f.mjs +5 -4
- package/fjs/types/ordered_map/proof.f.d.mts +3 -0
- package/fjs/types/ordered_map/proof.f.mjs +4 -1
- package/fjs/types/patricia_trie/module.f.d.mts +2 -1
- package/fjs/types/patricia_trie/module.f.mjs +2 -2
- package/fjs/types/patricia_trie/proof.f.d.mts +3 -0
- package/fjs/types/patricia_trie/proof.f.mjs +4 -1
- package/fjs/types/prime_field/module.f.d.mts +3 -1
- package/fjs/types/prime_field/module.f.mjs +3 -2
- package/fjs/types/range/module.f.d.mts +2 -1
- package/fjs/types/range/module.f.mjs +2 -2
- package/fjs/types/range_map/module.f.d.mts +6 -0
- package/fjs/types/range_map/module.f.mjs +6 -9
- package/fjs/types/range_map/proof.f.d.mts +5 -1
- package/fjs/types/range_map/proof.f.mjs +5 -3
- package/fjs/types/range_set/module.f.d.mts +5 -0
- package/fjs/types/range_set/module.f.mjs +1 -0
- package/fjs/types/range_set/proof.f.d.mts +3 -0
- package/fjs/types/range_set/proof.f.mjs +4 -1
- package/fjs/types/result/module.d.mts +8 -0
- package/fjs/types/result/module.f.d.mts +37 -7
- package/fjs/types/result/module.f.mjs +38 -8
- package/fjs/types/result/module.mjs +9 -1
- package/fjs/types/result/proof.f.d.mts +5 -0
- package/fjs/types/result/proof.f.mjs +22 -2
- package/fjs/types/rtti/common/module.f.d.mts +35 -2
- package/fjs/types/rtti/common/module.f.mjs +9 -7
- package/fjs/types/rtti/common/proof.f.d.mts +4 -0
- package/fjs/types/rtti/common/proof.f.mjs +5 -2
- package/fjs/types/rtti/data/module.f.d.mts +120 -0
- package/fjs/types/rtti/data/module.f.mjs +1030 -0
- package/fjs/types/rtti/data/proof.f.d.mts +75 -0
- package/fjs/types/rtti/data/proof.f.mjs +566 -0
- package/fjs/types/rtti/data/types.d.ts +83 -0
- package/fjs/types/rtti/module.f.d.mts +12 -5
- package/fjs/types/rtti/module.f.mjs +7 -5
- package/fjs/types/rtti/parse/module.f.d.mts +38 -0
- package/fjs/types/rtti/parse/module.f.mjs +9 -7
- package/fjs/types/rtti/parse/proof.f.mjs +18 -38
- package/fjs/types/rtti/proof.f.d.mts +3 -1
- package/fjs/types/rtti/proof.f.mjs +3 -1
- package/fjs/types/rtti/ts/module.f.d.mts +68 -9
- package/fjs/types/rtti/ts/module.f.mjs +262 -30
- package/fjs/types/rtti/ts/proof.f.d.mts +44 -0
- package/fjs/types/rtti/ts/proof.f.mjs +152 -4
- package/fjs/types/rtti/ts/types.d.ts +11 -0
- package/fjs/types/rtti/types.d.ts +40 -0
- package/fjs/types/rtti/validate/module.f.d.mts +36 -1
- package/fjs/types/rtti/validate/module.f.mjs +6 -4
- package/fjs/types/sorted_list/module.f.d.mts +4 -1
- package/fjs/types/sorted_list/module.f.mjs +21 -12
- package/fjs/types/sorted_list/proof.f.d.mts +3 -1
- package/fjs/types/sorted_list/proof.f.mjs +3 -1
- package/fjs/types/sorted_set/module.f.d.mts +31 -1
- package/fjs/types/sorted_set/module.f.mjs +4 -2
- package/fjs/types/sorted_set/proof.f.d.mts +3 -1
- package/fjs/types/sorted_set/proof.f.mjs +3 -1
- package/fjs/types/string/module.f.d.mts +4 -0
- package/fjs/types/string/module.f.mjs +4 -3
- package/fjs/types/string_set/module.f.d.mts +3 -1
- package/fjs/types/string_set/module.f.mjs +3 -2
- package/fjs/types/ts/module.f.d.mts +2 -0
- package/fjs/types/ts/module.f.mjs +3 -3
- package/fjs/types/ts/proof.f.d.mts +1 -0
- package/fjs/types/ts/proof.f.mjs +5 -0
- package/fjs/types/ts/types.d.ts +6 -1
- package/fjs/types/uint8array/module.f.d.mts +13 -2
- package/fjs/types/uint8array/module.f.mjs +20 -15
- package/fjs/website/module.f.d.mts +3 -0
- package/fjs/website/module.f.mjs +3 -2
- package/package.json +3 -3
- package/fjs/asn.1/types.js +0 -6
- package/fjs/asserts/types.js +0 -6
- package/fjs/basen/types.js +0 -6
- package/fjs/bnf/data/types.js +0 -6
- package/fjs/bnf/descent/types.js +0 -6
- package/fjs/bnf/ll1/types.js +0 -6
- package/fjs/bnf/token_symbol/types.js +0 -6
- package/fjs/bnf/types.js +0 -6
- package/fjs/cas/evo/types.js +0 -7
- package/fjs/cas/types.js +0 -6
- package/fjs/ci/common/types.js +0 -1
- package/fjs/ci/nix/types.js +0 -6
- package/fjs/ci/types.js +0 -6
- package/fjs/cli/types.js +0 -6
- package/fjs/common/monoid/types.js +0 -6
- package/fjs/crypto/pow/types.js +0 -6
- package/fjs/crypto/secp/types.js +0 -6
- package/fjs/crypto/sha2/types.js +0 -6
- package/fjs/crypto/sign/types.js +0 -6
- package/fjs/crypto/vdf/types.js +0 -6
- package/fjs/dev/types.js +0 -6
- package/fjs/djs/ast/types.js +0 -8
- package/fjs/djs/parser/types.js +0 -7
- package/fjs/djs/tokenizer/types.js +0 -7
- package/fjs/djs/types.js +0 -7
- package/fjs/effects/eff/types.js +0 -6
- package/fjs/effects/list/types.js +0 -6
- package/fjs/effects/memory/types.js +0 -6
- package/fjs/effects/mock/types.js +0 -6
- package/fjs/effects/node/types.js +0 -6
- package/fjs/effects/node/virtual/types.js +0 -7
- package/fjs/effects/types.js +0 -6
- package/fjs/emergent_testing/all.test.d.ts +0 -1
- package/fjs/emergent_testing/all.test.js +0 -5
- package/fjs/emergent_testing/scenarios/all.d.ts +0 -1
- package/fjs/emergent_testing/scenarios/all.js +0 -1
- package/fjs/emergent_testing/scenarios/async-subtests.fail.d.ts +0 -6
- package/fjs/emergent_testing/scenarios/async-subtests.fail.js +0 -9
- package/fjs/emergent_testing/scenarios/async-subtests.pass.d.ts +0 -6
- package/fjs/emergent_testing/scenarios/async-subtests.pass.js +0 -9
- package/fjs/emergent_testing/scenarios/async.fail.d.ts +0 -3
- package/fjs/emergent_testing/scenarios/async.fail.js +0 -6
- package/fjs/emergent_testing/scenarios/async.pass.d.ts +0 -3
- package/fjs/emergent_testing/scenarios/async.pass.js +0 -5
- package/fjs/emergent_testing/scenarios/fail.fail.d.ts +0 -3
- package/fjs/emergent_testing/scenarios/fail.fail.js +0 -3
- package/fjs/emergent_testing/scenarios/return-value.pass.d.ts +0 -3
- package/fjs/emergent_testing/scenarios/return-value.pass.js +0 -4
- package/fjs/emergent_testing/scenarios/thenable.pass.d.ts +0 -5
- package/fjs/emergent_testing/scenarios/thenable.pass.js +0 -11
- package/fjs/emergent_testing/scenarios/thenable2.pass.d.ts +0 -5
- package/fjs/emergent_testing/scenarios/thenable2.pass.js +0 -3
- package/fjs/emergent_testing/scenarios/throw.pass.d.ts +0 -5
- package/fjs/emergent_testing/scenarios/throw.pass.js +0 -3
- package/fjs/emergent_testing/types.js +0 -6
- package/fjs/js/tokenizer/types.js +0 -6
- package/fjs/media/html/types.js +0 -6
- package/fjs/media/json/parser/types.js +0 -6
- package/fjs/media/json/tokenizer/types.js +0 -6
- package/fjs/media/json/types.js +0 -13
- package/fjs/media/nix/types.js +0 -6
- package/fjs/media/revision/types.js +0 -8
- package/fjs/media/type/types.js +0 -6
- package/fjs/media/types.js +0 -7
- package/fjs/nanvm/types.js +0 -11
- package/fjs/protocol/json_rpc/types.js +0 -8
- package/fjs/protocol/mcp/types.js +0 -8
- package/fjs/sul/id/types.js +0 -6
- package/fjs/sul/level/hash/types.js +0 -6
- package/fjs/sul/level/literal/types.js +0 -6
- package/fjs/sul/types.js +0 -6
- package/fjs/text/sgr/types.js +0 -6
- package/fjs/text/types.js +0 -6
- package/fjs/text/utf16/types.js +0 -6
- package/fjs/text/utf8/types.js +0 -6
- package/fjs/types/array/types.js +0 -6
- package/fjs/types/bigfloat/types.js +0 -6
- package/fjs/types/bigint/types.js +0 -6
- package/fjs/types/bit_vec/types.js +0 -6
- package/fjs/types/btree/find/types.js +0 -6
- package/fjs/types/btree/types/types.js +0 -6
- package/fjs/types/byte_set/types.js +0 -6
- package/fjs/types/function/compare/types.js +0 -6
- package/fjs/types/function/operator/types.js +0 -6
- package/fjs/types/function/types.js +0 -6
- package/fjs/types/list/types.js +0 -6
- package/fjs/types/nibble_set/types.js +0 -6
- package/fjs/types/nominal/types.js +0 -6
- package/fjs/types/nullable/types.js +0 -6
- package/fjs/types/object/types.js +0 -8
- package/fjs/types/option/types.js +0 -6
- package/fjs/types/ordered_map/types.js +0 -6
- package/fjs/types/patricia_trie/types.js +0 -6
- package/fjs/types/phantom/types.js +0 -11
- package/fjs/types/prime_field/types.js +0 -6
- package/fjs/types/range/types.js +0 -6
- package/fjs/types/range_map/types.js +0 -6
- package/fjs/types/result/types.js +0 -6
- package/fjs/types/rtti/common/types.js +0 -1
- package/fjs/types/rtti/parse/types.js +0 -1
- package/fjs/types/rtti/ts/types.js +0 -1
- package/fjs/types/rtti/types.js +0 -1
- package/fjs/types/rtti/validate/types.js +0 -1
- package/fjs/types/sorted_list/types.js +0 -6
- package/fjs/types/sorted_set/types.js +0 -6
- package/fjs/types/string_set/types.js +0 -6
- package/fjs/types/ts/types.js +0 -8
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import { Unknown as JsonValue } from '../types.ts'
|
|
3
3
|
* @import { Unknown } from './module.f.mjs'
|
|
4
|
+
* @import { Data } from '../../../types/rtti/data/types.ts'
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
import { boolean, number, string, bigint, unknown, array, record, or, option } from '../../../types/rtti/module.f.mjs'
|
|
7
|
+
import { boolean, number, string, bigint, never, unknown, array, record, or, option } from '../../../types/rtti/module.f.mjs'
|
|
7
8
|
import { stringify } from '../module.f.mjs'
|
|
8
|
-
import { toJsonSchema, unknown as schemaUnknown } from './module.f.mjs'
|
|
9
|
+
import { dataToJsonSchema, toJsonSchema, unknown as schemaUnknown } from './module.f.mjs'
|
|
10
|
+
import { unitBit } from '../../../types/rtti/data/module.f.mjs'
|
|
9
11
|
import { assert, assertEq } from '../../../asserts/module.f.mjs'
|
|
10
12
|
|
|
11
13
|
/** @type {(v: Unknown) => string} */
|
|
@@ -18,6 +20,46 @@ const eq = (rtti, expected) => () => {
|
|
|
18
20
|
assertEq(result, exp, [result, exp])
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
/** @type {(data: Data, expected: Unknown) => () => void} */
|
|
24
|
+
const eqData = (data, expected) => () => {
|
|
25
|
+
const result = serialize(dataToJsonSchema(data))
|
|
26
|
+
const exp = serialize(expected)
|
|
27
|
+
assertEq(result, exp, [result, exp])
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A recursive list: `type _List = readonly _List[]`. */
|
|
31
|
+
/** @typedef {() => readonly ['array', _List]} _List */
|
|
32
|
+
/** @type {_List} */
|
|
33
|
+
const list = () => ['array', list]
|
|
34
|
+
|
|
35
|
+
/** Mutual recursion through a container. */
|
|
36
|
+
/** @typedef {() => readonly ['or', typeof number, _Forest]} _Tree */
|
|
37
|
+
/** @typedef {() => readonly ['array', _Tree]} _Forest */
|
|
38
|
+
/** @type {_Tree} */
|
|
39
|
+
const tree = () => ['or', number, forest]
|
|
40
|
+
/** @type {_Forest} */
|
|
41
|
+
const forest = () => ['array', tree]
|
|
42
|
+
|
|
43
|
+
/** The recursive revision lock schema. Its cycle closes through the
|
|
44
|
+
* anonymous `or` thunk, which becomes the (empty-string-named) rule. */
|
|
45
|
+
/** @typedef {() => readonly ['record', () => readonly ['or', typeof string, _Lock]]} _Lock */
|
|
46
|
+
/** @type {_Lock} */
|
|
47
|
+
const lock = () => ['record', or(string, lock)]
|
|
48
|
+
|
|
49
|
+
/** Self-recursive record. */
|
|
50
|
+
/** @typedef {() => readonly ['record', _Rec]} _Rec */
|
|
51
|
+
/** @type {_Rec} */
|
|
52
|
+
const rec = () => ['record', rec]
|
|
53
|
+
|
|
54
|
+
const listRef = /** @type {const} */ ({ $ref: '#/$defs/list' })
|
|
55
|
+
const treeRef = /** @type {const} */ ({ $ref: '#/$defs/tree' })
|
|
56
|
+
|
|
57
|
+
/** @type {Unknown} */
|
|
58
|
+
const listDef = { type: 'array', items: listRef }
|
|
59
|
+
|
|
60
|
+
/** @type {Unknown} */
|
|
61
|
+
const treeDef = { anyOf: [{ type: 'number' }, { type: 'array', items: treeRef }] }
|
|
62
|
+
|
|
21
63
|
export const proof = {
|
|
22
64
|
tag0: {
|
|
23
65
|
boolean: eq(boolean, { type: 'boolean' }),
|
|
@@ -37,10 +79,12 @@ export const proof = {
|
|
|
37
79
|
},
|
|
38
80
|
array: eq(array(number), { type: 'array', items: { type: 'number' } }),
|
|
39
81
|
record: eq(record(string), { type: 'object', additionalProperties: { type: 'string' } }),
|
|
40
|
-
|
|
82
|
+
// `anyOf` members follow the canonical kind order, not the operand order
|
|
83
|
+
or: eq(or(string, number), { anyOf: [{ type: 'number' }, { type: 'string' }] }),
|
|
41
84
|
tuple: eq(/** @type {const} */ ([number, string]), {
|
|
42
85
|
type: 'array',
|
|
43
86
|
prefixItems: [{ type: 'number' }, { type: 'string' }],
|
|
87
|
+
minItems: 2,
|
|
44
88
|
items: false,
|
|
45
89
|
}),
|
|
46
90
|
struct: {
|
|
@@ -58,16 +102,35 @@ export const proof = {
|
|
|
58
102
|
type: 'object',
|
|
59
103
|
properties: { x: { type: 'number' } },
|
|
60
104
|
}),
|
|
61
|
-
|
|
105
|
+
// an unconstrained struct is the whole object kind
|
|
106
|
+
empty: eq(/** @type {const} */ ({}), { type: 'object' }),
|
|
62
107
|
orOptional: eq(/** @type {const} */ ({ x: or(string, number, undefined) }), {
|
|
63
108
|
type: 'object',
|
|
64
|
-
properties: { x: { anyOf: [{ type: '
|
|
109
|
+
properties: { x: { anyOf: [{ type: 'number' }, { type: 'string' }] } },
|
|
65
110
|
}),
|
|
66
111
|
withConst: eq(/** @type {const} */ ({ x: null, y: string }), {
|
|
67
112
|
type: 'object',
|
|
68
113
|
properties: { x: { const: null }, y: { type: 'string' } },
|
|
69
114
|
required: ['x', 'y'],
|
|
70
115
|
}),
|
|
116
|
+
optionalOfEveryKind: eq(/** @type {const} */ ({
|
|
117
|
+
a: option(number),
|
|
118
|
+
b: option(string),
|
|
119
|
+
c: option(bigint),
|
|
120
|
+
d: option(array(number)),
|
|
121
|
+
e: option(record(string)),
|
|
122
|
+
f: or(null, undefined),
|
|
123
|
+
}), {
|
|
124
|
+
type: 'object',
|
|
125
|
+
properties: {
|
|
126
|
+
a: { type: 'number' },
|
|
127
|
+
b: { type: 'string' },
|
|
128
|
+
c: { type: 'integer' },
|
|
129
|
+
d: { type: 'array', items: { type: 'number' } },
|
|
130
|
+
e: { type: 'object', additionalProperties: { type: 'string' } },
|
|
131
|
+
f: { const: null },
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
71
134
|
},
|
|
72
135
|
schemaUnknownTag: () => {
|
|
73
136
|
const r = schemaUnknown()
|
|
@@ -79,15 +142,164 @@ export const proof = {
|
|
|
79
142
|
items: { type: 'object', additionalProperties: { type: 'boolean' } },
|
|
80
143
|
}),
|
|
81
144
|
orWithConst: eq(or(null, string, /** @type {const} */ (42)), {
|
|
82
|
-
anyOf: [{ const: null }, {
|
|
145
|
+
anyOf: [{ const: null }, { const: 42 }, { type: 'string' }],
|
|
83
146
|
}),
|
|
84
147
|
structWithOr: eq(/** @type {const} */ ({ id: or(string, number), name: option(string) }), {
|
|
85
148
|
type: 'object',
|
|
86
149
|
properties: {
|
|
87
|
-
id: { anyOf: [{ type: '
|
|
150
|
+
id: { anyOf: [{ type: 'number' }, { type: 'string' }] },
|
|
88
151
|
name: { type: 'string' },
|
|
89
152
|
},
|
|
90
153
|
required: ['id'],
|
|
91
154
|
}),
|
|
155
|
+
topInsideTuple: eq(/** @type {const} */ ([unknown, number]), {
|
|
156
|
+
type: 'array',
|
|
157
|
+
prefixItems: [{}, { type: 'number' }],
|
|
158
|
+
minItems: 2,
|
|
159
|
+
items: false,
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
normalization: {
|
|
163
|
+
booleanFromConsts: eq(or(true, false), { type: 'boolean' }),
|
|
164
|
+
unitMembers: eq(or(null, undefined, true), {
|
|
165
|
+
anyOf: [{ const: null }, { not: {} }, { const: true }],
|
|
166
|
+
}),
|
|
167
|
+
literalAbsorbed: eq(or(/** @type {const} */ (42), number), { type: 'number' }),
|
|
168
|
+
duplicateLiteral: eq(or(/** @type {const} */ (1), /** @type {const} */ (1)), { const: 1 }),
|
|
169
|
+
never: eq(never, { not: {} }),
|
|
170
|
+
emptyTuple: eq(/** @type {const} */ ([]), { type: 'array', items: false }),
|
|
171
|
+
// `readonly [number] ⊂ readonly number[]` — the tuple pattern is dropped
|
|
172
|
+
coverageCollapse: eq(or(/** @type {const} */ ([number]), array(number)), {
|
|
173
|
+
type: 'array',
|
|
174
|
+
items: { type: 'number' },
|
|
175
|
+
}),
|
|
176
|
+
commutative: () => {
|
|
177
|
+
const a = serialize(toJsonSchema(or(string, number)))
|
|
178
|
+
const b = serialize(toJsonSchema(or(number, string)))
|
|
179
|
+
assertEq(a, b, [a, b])
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
recursion: {
|
|
183
|
+
selfList: eq(list, { ...listRef, $defs: { list: listDef } }),
|
|
184
|
+
mutualEntry: eq(tree, { ...treeRef, $defs: { tree: treeDef } }),
|
|
185
|
+
mutualInline: eq(forest, { type: 'array', items: treeRef, $defs: { tree: treeDef } }),
|
|
186
|
+
recursiveUnion: eq(or(number, list), {
|
|
187
|
+
anyOf: [{ type: 'number' }, { type: 'array', items: listRef }],
|
|
188
|
+
$defs: { list: listDef },
|
|
189
|
+
}),
|
|
190
|
+
recursiveRecord: eq(rec, {
|
|
191
|
+
$ref: '#/$defs/rec',
|
|
192
|
+
$defs: { rec: { type: 'object', additionalProperties: { $ref: '#/$defs/rec' } } },
|
|
193
|
+
}),
|
|
194
|
+
optionalRecursiveProperty: eq(/** @type {const} */ ({ p: option(list) }), {
|
|
195
|
+
type: 'object',
|
|
196
|
+
properties: { p: { type: 'array', items: listRef } },
|
|
197
|
+
$defs: { list: listDef },
|
|
198
|
+
}),
|
|
199
|
+
revisionLock: eq(lock, {
|
|
200
|
+
type: 'object',
|
|
201
|
+
additionalProperties: { $ref: '#/$defs/' },
|
|
202
|
+
$defs: {
|
|
203
|
+
'': {
|
|
204
|
+
anyOf: [
|
|
205
|
+
{ type: 'string' },
|
|
206
|
+
{ type: 'object', additionalProperties: { $ref: '#/$defs/' } },
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
}),
|
|
211
|
+
sharedNonRecursive: () => {
|
|
212
|
+
// a shared, non-recursive definition is inlined at each use — no `$defs`
|
|
213
|
+
const person = /** @type {const} */ ({ name: string })
|
|
214
|
+
/** @type {Unknown} */
|
|
215
|
+
const personSchema = {
|
|
216
|
+
type: 'object',
|
|
217
|
+
properties: { name: { type: 'string' } },
|
|
218
|
+
required: ['name'],
|
|
219
|
+
}
|
|
220
|
+
eq(/** @type {const} */ ([person, person]), {
|
|
221
|
+
type: 'array',
|
|
222
|
+
prefixItems: [personSchema, personSchema],
|
|
223
|
+
minItems: 2,
|
|
224
|
+
items: false,
|
|
225
|
+
})()
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
data: (() => {
|
|
229
|
+
/** @type {Data} */
|
|
230
|
+
const tupleWithRest = [{}, { array: [{ prefix: [{ number: true }], rest: { string: true } }] }]
|
|
231
|
+
/** @type {Data} */
|
|
232
|
+
const structWithRest = [{}, {
|
|
233
|
+
object: [{ props: { a: { number: true } }, rest: { string: true } }],
|
|
234
|
+
}]
|
|
235
|
+
/** @type {Data} */
|
|
236
|
+
const optionalByReference = [
|
|
237
|
+
{ r: { unit: unitBit(null) | unitBit(undefined), number: true } },
|
|
238
|
+
{ object: [{ props: { p: 'r' } }] },
|
|
239
|
+
]
|
|
240
|
+
return {
|
|
241
|
+
plain: eqData([{}, { number: true }], { type: 'number' }),
|
|
242
|
+
tupleWithRest: eqData(tupleWithRest, {
|
|
243
|
+
type: 'array',
|
|
244
|
+
prefixItems: [{ type: 'number' }],
|
|
245
|
+
minItems: 1,
|
|
246
|
+
items: { type: 'string' },
|
|
247
|
+
}),
|
|
248
|
+
structWithRest: eqData(structWithRest, {
|
|
249
|
+
type: 'object',
|
|
250
|
+
properties: { a: { type: 'number' } },
|
|
251
|
+
required: ['a'],
|
|
252
|
+
additionalProperties: { type: 'string' },
|
|
253
|
+
}),
|
|
254
|
+
// a referenced definition admitting `undefined` makes the key
|
|
255
|
+
// optional; the reference itself is kept as the property schema
|
|
256
|
+
optionalByReference: eqData(optionalByReference, {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: { p: { $ref: '#/$defs/r' } },
|
|
259
|
+
$defs: { r: { anyOf: [{ const: null }, { not: {} }, { type: 'number' }] } },
|
|
260
|
+
}),
|
|
261
|
+
}
|
|
262
|
+
})(),
|
|
263
|
+
refEncoding: (() => {
|
|
264
|
+
/** @type {Data} */
|
|
265
|
+
const d = [
|
|
266
|
+
{
|
|
267
|
+
'a~b': { number: true },
|
|
268
|
+
'a/b': { number: true },
|
|
269
|
+
'%2F': { number: true },
|
|
270
|
+
'a b': { number: true },
|
|
271
|
+
'é': { number: true },
|
|
272
|
+
},
|
|
273
|
+
{ array: [{ prefix: ['a~b', 'a/b', '%2F', 'a b', 'é'] }] },
|
|
274
|
+
]
|
|
275
|
+
return eqData(d, {
|
|
276
|
+
type: 'array',
|
|
277
|
+
prefixItems: [
|
|
278
|
+
{ $ref: '#/$defs/a~0b' },
|
|
279
|
+
{ $ref: '#/$defs/a~1b' },
|
|
280
|
+
{ $ref: '#/$defs/%252F' },
|
|
281
|
+
{ $ref: '#/$defs/a%20b' },
|
|
282
|
+
{ $ref: '#/$defs/%C3%A9' },
|
|
283
|
+
],
|
|
284
|
+
minItems: 5,
|
|
285
|
+
items: false,
|
|
286
|
+
$defs: {
|
|
287
|
+
'a~b': { type: 'number' },
|
|
288
|
+
'a/b': { type: 'number' },
|
|
289
|
+
'%2F': { type: 'number' },
|
|
290
|
+
'a b': { type: 'number' },
|
|
291
|
+
'é': { type: 'number' },
|
|
292
|
+
},
|
|
293
|
+
})
|
|
294
|
+
})(),
|
|
295
|
+
throw: {
|
|
296
|
+
missingRootDefinition: () => dataToJsonSchema([{}, 'nope']),
|
|
297
|
+
// an `Object.prototype` member name is still a missing definition
|
|
298
|
+
missingPrototypeDefinition: () => dataToJsonSchema([{}, 'toString']),
|
|
299
|
+
missingNestedDefinition: () => {
|
|
300
|
+
/** @type {Data} */
|
|
301
|
+
const d = [{ a: { array: [{ prefix: [], rest: 'missing' }] } }, 'a']
|
|
302
|
+
return dataToJsonSchema(d)
|
|
303
|
+
},
|
|
92
304
|
},
|
|
93
305
|
}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON serializer for deterministic string output.
|
|
3
|
+
*
|
|
4
|
+
* `stringSerialize` is FunctionalScript, not the host's `JSON.stringify`: it
|
|
5
|
+
* escapes over this repository's own UTF-16 decoder and reproduces the
|
|
6
|
+
* ECMAScript `QuoteJSONString` result exactly, lone surrogates included.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*
|
|
10
|
+
* @import { List } from '../../../types/list/types.ts'
|
|
11
|
+
* @import { Reduce } from '../../../types/function/operator/types.ts'
|
|
12
|
+
* @import { CodePoint } from '../../../text/utf16/types.ts'
|
|
13
|
+
*/
|
|
1
14
|
import type { List } from '../../../types/list/types.ts';
|
|
2
15
|
/**
|
|
3
16
|
* Serializes a string as a JSON string literal.
|
|
@@ -6,21 +6,22 @@
|
|
|
6
6
|
* ECMAScript `QuoteJSONString` result exactly, lone surrogates included.
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
|
+
*
|
|
10
|
+
* @import { List } from '../../../types/list/types.ts'
|
|
11
|
+
* @import { Reduce } from '../../../types/function/operator/types.ts'
|
|
12
|
+
* @import { CodePoint } from '../../../text/utf16/types.ts'
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
|
|
11
15
|
import { flat, map, reduce, empty } from '../../../types/list/module.f.mjs'
|
|
12
|
-
/** @import { Reduce } from '../../../types/function/operator/types.ts' */
|
|
13
16
|
import { concat } from '../../../types/string/module.f.mjs'
|
|
14
|
-
/** @import { CodePoint } from '../../../text/utf16/types.ts' */
|
|
15
17
|
import { codePointToString, stringToCodePointList } from '../../../text/utf16/module.f.mjs'
|
|
16
18
|
import { errorMask } from '../../../text/code_point/module.f.mjs'
|
|
17
19
|
import {
|
|
18
20
|
backspace,
|
|
19
21
|
cr,
|
|
20
|
-
digit0,
|
|
21
22
|
ff,
|
|
23
|
+
hexDigitCodePoint,
|
|
22
24
|
ht,
|
|
23
|
-
latinSmallLetterA,
|
|
24
25
|
lf,
|
|
25
26
|
quotationMark,
|
|
26
27
|
reverseSolidus,
|
|
@@ -46,8 +47,7 @@ const escapeTable = /** @type {const} */ ({
|
|
|
46
47
|
})
|
|
47
48
|
|
|
48
49
|
/** @type {(value: number) => string} */
|
|
49
|
-
const hexDigit = value =>
|
|
50
|
-
fromCharCode(value < 10 ? digit0 + value : latinSmallLetterA + value - 10)
|
|
50
|
+
const hexDigit = value => fromCharCode(hexDigitCodePoint(value))
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* `\uXXXX` with lowercase hex digits, matching ECMAScript's `UnicodeEscape`.
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Tokenizer for JSON lexical analysis.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
|
+
*
|
|
6
|
+
* @import { StateScan } from '../../../types/function/operator/types.ts'
|
|
7
|
+
* @import { List } from '../../../types/list/types.ts'
|
|
8
|
+
* @import { JsToken } from '../../../js/tokenizer/types.ts'
|
|
9
|
+
* @import { JsonToken, _ScanState, _ScanInput } from './types.ts'
|
|
5
10
|
*/
|
|
6
11
|
import type { List } from '../../../types/list/types.ts';
|
|
7
12
|
import type { JsonToken } from './types.ts';
|
|
@@ -15,3 +20,6 @@ import type { JsonToken } from './types.ts';
|
|
|
15
20
|
* @type {(input: List<number>) => List<JsonToken>}
|
|
16
21
|
*/
|
|
17
22
|
export declare const tokenize: (input: List<number>) => List<JsonToken>;
|
|
23
|
+
export declare const proof: {
|
|
24
|
+
parseMinusStateEof: () => void;
|
|
25
|
+
};
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* Tokenizer for JSON lexical analysis.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
|
+
*
|
|
6
|
+
* @import { StateScan } from '../../../types/function/operator/types.ts'
|
|
7
|
+
* @import { List } from '../../../types/list/types.ts'
|
|
8
|
+
* @import { JsToken } from '../../../js/tokenizer/types.ts'
|
|
9
|
+
* @import { JsonToken, _ScanState, _ScanInput } from './types.ts'
|
|
5
10
|
*/
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
/** @import { List } from '../../../types/list/types.ts' */
|
|
9
|
-
import { concat, empty, flat, stateScan } from '../../../types/list/module.f.mjs'
|
|
12
|
+
import { concat, empty, flat, stateScan, toArray } from '../../../types/list/module.f.mjs'
|
|
10
13
|
import { multiply } from '../../../types/bigfloat/module.f.mjs'
|
|
11
14
|
import { tokenize as jsTokenize } from '../../../js/tokenizer/module.f.mjs'
|
|
12
|
-
|
|
13
|
-
/** @import { JsonToken, _ScanState, _ScanInput } from './types.ts' */
|
|
15
|
+
import { assertEq } from '../../../asserts/module.f.mjs'
|
|
14
16
|
|
|
15
17
|
/** @type {(input: JsToken) => List<JsonToken>} */
|
|
16
18
|
const mapToken = input => {
|
|
@@ -75,3 +77,20 @@ export const tokenize = input => {
|
|
|
75
77
|
const jsTokens = jsTokenize(input)('')
|
|
76
78
|
return flat(stateScan(scanToken)({ kind: 'def' })(concat(jsTokens)([null])))
|
|
77
79
|
}
|
|
80
|
+
|
|
81
|
+
export const proof = {
|
|
82
|
+
// `parseMinusState` only sees `null` if the JSON tokenizer's own EOF
|
|
83
|
+
// sentinel arrives while still in state '-' — i.e. input ends right after
|
|
84
|
+
// a lone `-`. Unreachable through the public `tokenize`: the underlying
|
|
85
|
+
// JS tokenizer always emits its own `eof` token first, and consuming that
|
|
86
|
+
// (the default branch, any kind other than '-' or 'number') resets state
|
|
87
|
+
// to 'def' before the sentinel `null` is ever seen. Call the private
|
|
88
|
+
// state handler directly to cover the branch anyway.
|
|
89
|
+
parseMinusStateEof: () => {
|
|
90
|
+
const [tokens, state] = parseMinusState(null)
|
|
91
|
+
assertEq(state.kind, 'def')
|
|
92
|
+
const a = toArray(tokens)
|
|
93
|
+
assertEq(a.length, 1)
|
|
94
|
+
assertEq(a[0].kind, 'error')
|
|
95
|
+
},
|
|
96
|
+
}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal, checked eDSL for constructing and serializing Nix expressions.
|
|
3
|
+
*
|
|
4
|
+
* The tree deliberately models syntax rather than evaluated Nix values. String
|
|
5
|
+
* expressions are escaped double-quoted strings; the other supported forms are
|
|
6
|
+
* represented by tagged tuples. See `./types.ts` for the `Expression`
|
|
7
|
+
* type-level API.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*
|
|
11
|
+
* @import { List as ChunkList } from '../../types/list/types.ts'
|
|
12
|
+
* @import { Expression, _AttributePath, _Binding, _Reference, _AttributeSet, _NixList, _Application, _OpenSetPattern, _Lambda, _Let, _Chunks } from './types.ts'
|
|
13
|
+
*/
|
|
1
14
|
import type { List as ChunkList } from '../../types/list/types.ts';
|
|
2
15
|
import type { Expression } from './types.ts';
|
|
3
16
|
/**
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* type-level API.
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
|
+
*
|
|
11
|
+
* @import { List as ChunkList } from '../../types/list/types.ts'
|
|
12
|
+
* @import { Expression, _AttributePath, _Binding, _Reference, _AttributeSet, _NixList, _Application, _OpenSetPattern, _Lambda, _Let, _Chunks } from './types.ts'
|
|
10
13
|
*/
|
|
11
|
-
|
|
14
|
+
|
|
12
15
|
import { toArray } from '../../types/list/module.f.mjs'
|
|
13
16
|
import { concat } from '../../types/string/module.f.mjs'
|
|
14
17
|
import { includes } from '../../types/array/module.f.mjs'
|
|
@@ -19,7 +22,6 @@ import {
|
|
|
19
22
|
range,
|
|
20
23
|
} from '../../text/ascii/module.f.mjs'
|
|
21
24
|
import { fromRange, get, merge } from '../../types/range_set/module.f.mjs'
|
|
22
|
-
/** @import { Expression, _AttributePath, _Binding, _Reference, _AttributeSet, _NixList, _Application, _OpenSetPattern, _Lambda, _Let, _Chunks } from './types.ts' */
|
|
23
25
|
|
|
24
26
|
const reservedWords = /** @type {const} */ ([
|
|
25
27
|
'assert',
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { Expression } from './types.ts'
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import { assert, assertEq } from '../../asserts/module.f.mjs'
|
|
2
6
|
import { toArray } from '../../types/list/module.f.mjs'
|
|
3
7
|
import { nix, nixToString } from './module.f.mjs'
|
|
4
|
-
/** @import { Expression } from './types.ts' */
|
|
5
8
|
|
|
6
9
|
/** @type {(nodePackage: string, shellHook: boolean) => Expression} */
|
|
7
10
|
const nodeFlake = (nodePackage, shellHook) => ['set',
|
|
@@ -97,6 +97,11 @@ export declare const checkReferences: (r: Revision) => Result<Revision, string>;
|
|
|
97
97
|
* Validates an already-parsed JSON value as a `revision` BLOB: structural
|
|
98
98
|
* (rtti) validation followed by the hash / generation semantic checks.
|
|
99
99
|
*
|
|
100
|
+
* `RevisionError` is the union of the two stages' own error types, so each
|
|
101
|
+
* failure reaches the caller as it was raised — `ValidationError` from the
|
|
102
|
+
* schema, `string` from {@link checkReferences} — which is exactly what
|
|
103
|
+
* `okThen` produces here.
|
|
104
|
+
*
|
|
100
105
|
* @type {(value: Unknown) => Result<Revision, RevisionError>}
|
|
101
106
|
*/
|
|
102
107
|
export declare const validate: (value: Unknown) => Result<Revision, RevisionError>;
|
|
@@ -24,7 +24,7 @@ import { array, number, option, record, string } from '../../types/rtti/module.f
|
|
|
24
24
|
import { validate as rttiValidate } from '../../types/rtti/validate/module.f.mjs'
|
|
25
25
|
import { parse as parseJson } from '../json/module.f.mjs'
|
|
26
26
|
import { cBase32ToVec } from '../../basen/cbase32/module.f.mjs'
|
|
27
|
-
import { error, ok } from '../../types/result/module.f.mjs'
|
|
27
|
+
import { error, ok, okThen } from '../../types/result/module.f.mjs'
|
|
28
28
|
import { dialectEntry } from '../module.f.mjs'
|
|
29
29
|
import { definedEntries, sort } from '../../types/object/module.f.mjs'
|
|
30
30
|
import { stringify } from '../json/module.f.mjs'
|
|
@@ -126,13 +126,14 @@ export const checkReferences = r => {
|
|
|
126
126
|
* Validates an already-parsed JSON value as a `revision` BLOB: structural
|
|
127
127
|
* (rtti) validation followed by the hash / generation semantic checks.
|
|
128
128
|
*
|
|
129
|
+
* `RevisionError` is the union of the two stages' own error types, so each
|
|
130
|
+
* failure reaches the caller as it was raised — `ValidationError` from the
|
|
131
|
+
* schema, `string` from {@link checkReferences} — which is exactly what
|
|
132
|
+
* `okThen` produces here.
|
|
133
|
+
*
|
|
129
134
|
* @type {(value: Unknown) => Result<Revision, RevisionError>}
|
|
130
135
|
*/
|
|
131
|
-
export const validate = value =>
|
|
132
|
-
const [t, v] = validateShape(value)
|
|
133
|
-
if (t === 'error') { return error(v) }
|
|
134
|
-
return checkReferences(v)
|
|
135
|
-
}
|
|
136
|
+
export const validate = value => okThen(checkReferences)(validateShape(value))
|
|
136
137
|
|
|
137
138
|
/**
|
|
138
139
|
* Decodes `text` as a `revision` BLOB: JSON-parses it, then validates it per
|
|
@@ -141,11 +142,7 @@ export const validate = value => {
|
|
|
141
142
|
*
|
|
142
143
|
* @type {(text: string) => Result<Revision, RevisionError>}
|
|
143
144
|
*/
|
|
144
|
-
export const decodeText = text =>
|
|
145
|
-
const [t, v] = parseJson(text)
|
|
146
|
-
if (t === 'error') { return error(v) }
|
|
147
|
-
return validate(v)
|
|
148
|
-
}
|
|
145
|
+
export const decodeText = text => okThen(validate)(parseJson(text))
|
|
149
146
|
|
|
150
147
|
/** {@link checkReferences} as the `boolean` refinement a {@link DialectEntry} takes.
|
|
151
148
|
* @type {(r: Revision) => boolean}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Object as JsonObject } from '../json/types.ts'
|
|
3
|
+
* @import { LockMap } from './types.ts'
|
|
4
|
+
*/
|
|
5
|
+
|
|
3
6
|
import { assert, assertEq } from '../../asserts/module.f.mjs'
|
|
4
7
|
import { dialect, mediaType, isHash, validate, decodeText, encodeText } from './module.f.mjs'
|
|
5
8
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Magic-byte MIME type detection.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* One list — `signatures` — declares every recognized magic-byte pattern, and
|
|
5
|
+
* both detectors read it through the same eliminator (`magicStep`): `detect`
|
|
6
|
+
* folds a whole `Vec` and returns a MIME type string or `null`, while
|
|
7
|
+
* `detectStream` folds a read stream one chunk at a time.
|
|
7
8
|
*
|
|
8
|
-
* Beside
|
|
9
|
-
* state machine (length × magic-byte eliminator × UTF-8 validity
|
|
10
|
-
* `{ length, mime_type, type }` by folding a CAS read stream in
|
|
11
|
-
* ever buffering the blob into a single `maxLength`-bounded
|
|
12
|
-
* for the factored design.
|
|
9
|
+
* Beside `detect`, `detectStream` is the **streaming counterpart**: a
|
|
10
|
+
* byte-accepting state machine (length × magic-byte eliminator × UTF-8 validity
|
|
11
|
+
* DFA) that derives `{ length, mime_type, type }` by folding a CAS read stream in
|
|
12
|
+
* O(1) space, without ever buffering the blob into a single `maxLength`-bounded
|
|
13
|
+
* `Vec`. See the README for the factored design.
|
|
13
14
|
*
|
|
14
15
|
* The CAS store is type-agnostic and keeps raw bytes only, so type is never
|
|
15
16
|
* stored; it is recovered on read by sniffing the content. Callers decide what
|
|
@@ -27,12 +28,19 @@
|
|
|
27
28
|
* | `application/zip` | `50 4B 03 04` / `05 06` / `07 08` (`"PK"` entry, empty, or spanned) |
|
|
28
29
|
*
|
|
29
30
|
* WebP is the one signature with a gap: the four-byte little-endian file size
|
|
30
|
-
* sits between the `RIFF` and `WEBP` markers, so
|
|
31
|
-
*
|
|
31
|
+
* sits between the `RIFF` and `WEBP` markers, so its pattern carries four
|
|
32
|
+
* wildcard bytes rather than being one contiguous run.
|
|
32
33
|
*
|
|
33
34
|
* See `./types.ts` for the type-level API.
|
|
34
35
|
*
|
|
35
36
|
* @module
|
|
37
|
+
*
|
|
38
|
+
* @import { Vec } from '../../types/bit_vec/types.ts'
|
|
39
|
+
* @import { Nullable } from '../../types/nullable/types.ts'
|
|
40
|
+
* @import { Effect, Operation } from '../../effects/types.ts'
|
|
41
|
+
* @import { List } from '../../effects/list/types.ts'
|
|
42
|
+
* @import { IoResult } from '../../effects/node/types.ts'
|
|
43
|
+
* @import { DetectMeta, DetectState, _MagicState, _Signature, _Utf8Detect } from './types.ts'
|
|
36
44
|
*/
|
|
37
45
|
import type { Vec } from '../../types/bit_vec/types.ts';
|
|
38
46
|
import type { Nullable } from '../../types/nullable/types.ts';
|
|
@@ -41,7 +49,16 @@ import type { List } from '../../effects/list/types.ts';
|
|
|
41
49
|
import type { IoResult } from '../../effects/node/types.ts';
|
|
42
50
|
import type { DetectMeta, DetectState } from './types.ts';
|
|
43
51
|
/**
|
|
44
|
-
* Detects the MIME type of `bytes` from its leading magic-byte signature
|
|
52
|
+
* Detects the MIME type of `bytes` from its leading magic-byte signature by
|
|
53
|
+
* folding them through the same eliminator the streaming detector uses. Both
|
|
54
|
+
* absorbing states end the fold: a `matched` signature is the answer, and a
|
|
55
|
+
* `dead` eliminator can no longer produce one. Bytes still in `scan` at the end
|
|
56
|
+
* of the `Vec` — a prefix too short to complete any signature — leave the
|
|
57
|
+
* eliminator unsettled, which reads as `null`.
|
|
58
|
+
*
|
|
59
|
+
* The bytes come from `u8List`, so a `Vec` whose length is not a whole number of
|
|
60
|
+
* bytes has its trailing partial byte zero-padded — the same reading of a ragged
|
|
61
|
+
* `Vec` the streaming detector already uses.
|
|
45
62
|
*
|
|
46
63
|
* @returns the MIME type string for a recognized format, or `null` when the
|
|
47
64
|
* leading bytes match no known signature (including any `Vec` shorter than
|