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
package/fjs/cas/evo/module.f.mjs
CHANGED
|
@@ -53,14 +53,13 @@
|
|
|
53
53
|
* @import { Hash, Subject, RevisionData, SubjectState, Cache, Evo } from './types.ts'
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
-
import { pure, foldStep } from '../../effects/module.f.mjs'
|
|
57
|
-
import { eff } from '../../effects/eff/module.f.mjs'
|
|
56
|
+
import { pure, foldStep, mapStep, step } from '../../effects/module.f.mjs'
|
|
58
57
|
import { create, read, write } from '../../effects/memory/module.f.mjs'
|
|
59
58
|
import { collectRead } from '../module.f.mjs'
|
|
60
59
|
import { cBase32ToVec, vecToCBase32 } from '../../basen/cbase32/module.f.mjs'
|
|
61
60
|
import { fromVec } from '../../text/utf8/module.f.mjs'
|
|
62
61
|
import { tryUtf8 } from '../../text/module.f.mjs'
|
|
63
|
-
import { ok, error } from '../../types/result/module.f.mjs'
|
|
62
|
+
import { ok, error, okThen } from '../../types/result/module.f.mjs'
|
|
64
63
|
import { nonEmpty, empty as elEmpty } from '../../effects/list/module.f.mjs'
|
|
65
64
|
import { at, definedEntries } from '../../types/object/module.f.mjs'
|
|
66
65
|
import { unwrap } from '../../types/nullable/module.f.mjs'
|
|
@@ -185,9 +184,9 @@ export const decodeRevisionVec = value => {
|
|
|
185
184
|
* @returns {(hash: Vec) => Effect<O, Revision | null>}
|
|
186
185
|
*/
|
|
187
186
|
export const decodeRevisionBlob = cas => hash =>
|
|
188
|
-
|
|
189
|
-
.
|
|
190
|
-
|
|
187
|
+
mapStep(
|
|
188
|
+
collectRead(cas.read(hash)),
|
|
189
|
+
([tag, value]) => tag === 'error' ? null : decodeRevisionVec(value))
|
|
191
190
|
|
|
192
191
|
/**
|
|
193
192
|
* Scans every hash in `cas` and builds a fresh {@link Cache} from the
|
|
@@ -202,11 +201,10 @@ export const buildCache = cas =>
|
|
|
202
201
|
cas.list(),
|
|
203
202
|
emptyCache,
|
|
204
203
|
hash => cache =>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
.value)
|
|
204
|
+
mapStep(
|
|
205
|
+
decodeRevisionBlob(cas)(hash),
|
|
206
|
+
revision =>
|
|
207
|
+
revision === null ? cache : addRevisionToCache(vecToCBase32(hash), revision)(cache)))
|
|
210
208
|
|
|
211
209
|
/**
|
|
212
210
|
* Scans `cas` once and allocates a memory slot holding the resulting {@link Cache}.
|
|
@@ -216,17 +214,13 @@ export const buildCache = cas =>
|
|
|
216
214
|
* @returns {Effect<O | MemOp, Key<Cache>>}
|
|
217
215
|
*/
|
|
218
216
|
export const initEvo = cas =>
|
|
219
|
-
|
|
220
|
-
.step(cache => create(cache))
|
|
221
|
-
.value
|
|
217
|
+
step(buildCache(cas), cache => create(cache))
|
|
222
218
|
|
|
223
219
|
/** Reads, then rewrites, the cache at `cacheKey` with `revision` folded in at `hash`.
|
|
224
220
|
* @type {(cacheKey: Key<Cache>) => (hash: Hash) => (revision: Revision) => Effect<MemOp, void>}
|
|
225
221
|
*/
|
|
226
222
|
const foldIntoCache = cacheKey => hash => revision =>
|
|
227
|
-
|
|
228
|
-
.step(cache => write(cacheKey, addRevisionToCache(hash, revision)(cache)))
|
|
229
|
-
.value
|
|
223
|
+
step(read(cacheKey), cache => write(cacheKey, addRevisionToCache(hash, revision)(cache)))
|
|
230
224
|
|
|
231
225
|
/**
|
|
232
226
|
* Folds `value` — bytes already written to a `Cas` at `hash` by some other
|
|
@@ -259,11 +253,9 @@ const resolveParent = cas => parentRef => {
|
|
|
259
253
|
if (parentHash === null) {
|
|
260
254
|
return pure(error(`invalid parent hash: ${parentRef}`))
|
|
261
255
|
}
|
|
262
|
-
return
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
)
|
|
266
|
-
.value
|
|
256
|
+
return mapStep(
|
|
257
|
+
decodeRevisionBlob(cas)(parentHash),
|
|
258
|
+
parent => parent === null ? error(`parent is not a revision blob: ${parentRef}`) : ok(parent))
|
|
267
259
|
}
|
|
268
260
|
|
|
269
261
|
/**
|
|
@@ -281,12 +273,11 @@ const resolveParents = cas => parents => {
|
|
|
281
273
|
init,
|
|
282
274
|
parentRef => (/** @type {Result<readonly Revision[], string>} */ acc) => {
|
|
283
275
|
if (acc[0] === 'error') { return pure(acc) }
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
.value
|
|
276
|
+
return mapStep(
|
|
277
|
+
resolveParent(cas)(parentRef),
|
|
278
|
+
(/** @type {Result<Revision, string>} */ parentResult) =>
|
|
279
|
+
/** @type {Result<readonly Revision[], string>} */
|
|
280
|
+
(parentResult[0] === 'error' ? parentResult : ok([...acc[1], parentResult[1]])))
|
|
290
281
|
})
|
|
291
282
|
}
|
|
292
283
|
|
|
@@ -366,21 +357,73 @@ const computeGeneration = parents =>
|
|
|
366
357
|
parents.length === 0 ? 0 : 1 + parents.reduce((max, p) => Math.max(max, p.generation), 0)
|
|
367
358
|
|
|
368
359
|
/**
|
|
369
|
-
*
|
|
360
|
+
* The pure half of {@link addRevision}: turns already-resolved `parents` into
|
|
361
|
+
* the exact `Revision` that will be stored, or the first reason it cannot be.
|
|
370
362
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* ({@link
|
|
375
|
-
* ({@link computeGeneration}), assemble a `Revision` and check its hash /
|
|
363
|
+
* Resolves `subject` ({@link resolveSubject}) and checks every parent belongs
|
|
364
|
+
* to it ({@link validateParentSubjects}), resolves `snapshot`
|
|
365
|
+
* ({@link resolveSnapshot}) and computes `generation`
|
|
366
|
+
* ({@link computeGeneration}), assembles the `Revision` and checks its hash /
|
|
376
367
|
* generation semantics (`fjs/media/revision` `checkReferences` — the same rule
|
|
377
|
-
* a reader applies; the shape itself is already guaranteed by
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
368
|
+
* a reader applies; the shape itself is already guaranteed by the field types
|
|
369
|
+
* here), then canonicalizes it.
|
|
370
|
+
*
|
|
371
|
+
* Canonicalizing parent/snapshot spellings is only safe once `checkReferences`
|
|
372
|
+
* has confirmed they decode, which makes the `unwrap` inside
|
|
373
|
+
* {@link canonicalHash} safe. It is not optional: two `add` calls describing
|
|
374
|
+
* the same logical revision but spelled differently (case, `i`/`l`/`o`
|
|
375
|
+
* aliases) must serialize identically, or they would produce two distinct CAS
|
|
376
|
+
* blobs that both remain heads — the point of `canonicalHash` (see the module
|
|
377
|
+
* doc) is defeated if this module itself writes non-canonical spellings.
|
|
378
|
+
*
|
|
379
|
+
* Separate from {@link addRevision} because none of it touches the store:
|
|
380
|
+
* everything up to the bytes is a plain `Result` pipeline, so `addRevision` is
|
|
381
|
+
* left holding only the encode, the write, and the cache fold. Each step also
|
|
382
|
+
* reads values resolved by earlier ones, which is why the guards are a flat
|
|
383
|
+
* sequence rather than an `okThen` chain — see `okThen`'s own note in
|
|
384
|
+
* [`fjs/types/result`](../../types/result/module.f.mjs).
|
|
385
|
+
*
|
|
386
|
+
* @param {RevisionData} input
|
|
387
|
+
* @returns {(parents: readonly Revision[]) => Result<Revision, string>}
|
|
388
|
+
*/
|
|
389
|
+
const buildRevision = input => parents => {
|
|
390
|
+
const subjectResult = resolveSubject(input)(parents)
|
|
391
|
+
if (subjectResult[0] === 'error') { return subjectResult }
|
|
392
|
+
const subject = subjectResult[1]
|
|
393
|
+
const parentSubjectsResult = validateParentSubjects(subject)(parents)
|
|
394
|
+
if (parentSubjectsResult[0] === 'error') { return parentSubjectsResult }
|
|
395
|
+
const snapshotResult = resolveSnapshot(input)(subject)(parents)
|
|
396
|
+
if (snapshotResult[0] === 'error') { return snapshotResult }
|
|
397
|
+
/** @type {Revision} */
|
|
398
|
+
const revision = {
|
|
399
|
+
dialect,
|
|
400
|
+
subject,
|
|
401
|
+
parents: input.parents,
|
|
402
|
+
snapshot: snapshotResult[1],
|
|
403
|
+
generation: computeGeneration(parents),
|
|
404
|
+
archived: input.archived,
|
|
405
|
+
lock: input.lock,
|
|
406
|
+
}
|
|
407
|
+
const referencesResult = checkReferences(revision)
|
|
408
|
+
if (referencesResult[0] === 'error') { return referencesResult }
|
|
409
|
+
return ok({
|
|
410
|
+
...revision,
|
|
411
|
+
parents: revision.parents.map(canonicalHash),
|
|
412
|
+
snapshot: canonicalHash(revision.snapshot),
|
|
413
|
+
lock: revision.lock === undefined ? undefined : canonicalLock(revision.lock),
|
|
414
|
+
})
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Adds a new revision to `cas` and folds it into the cache at `cacheKey`.
|
|
419
|
+
*
|
|
420
|
+
* Steps: resolve and validate every parent ({@link resolveParents}), derive
|
|
421
|
+
* the revision to store from them ({@link buildRevision}), then encode it,
|
|
422
|
+
* write it to `cas`, and fold it into the cache. Every failure — an invalid
|
|
423
|
+
* or missing parent, a cross-subject parent, an unresolvable subject or
|
|
424
|
+
* snapshot, an invalid revision, a blob too large to encode, or a store write
|
|
425
|
+
* failure — is reported as `error(message)` rather than thrown, so a caller
|
|
426
|
+
* (e.g. an MCP tool handler) can surface it without a `throw`/`catch`.
|
|
384
427
|
*
|
|
385
428
|
* `input.generation` is ignored: it exists on {@link RevisionData} only so a
|
|
386
429
|
* value read back by {@link readRevision} round-trips into `add` unchanged,
|
|
@@ -392,58 +435,26 @@ const computeGeneration = parents =>
|
|
|
392
435
|
* @returns {(cacheKey: Key<Cache>) => (input: RevisionData) => Effect<O | MemOp, Result<Hash, string>>}
|
|
393
436
|
*/
|
|
394
437
|
export const addRevision = cas => cacheKey => input =>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
const
|
|
401
|
-
if (parentSubjectsResult[0] === 'error') { return pure(parentSubjectsResult) }
|
|
402
|
-
const snapshotResult = resolveSnapshot(input)(subjectResult[1])(parentsResult[1])
|
|
403
|
-
if (snapshotResult[0] === 'error') { return pure(snapshotResult) }
|
|
404
|
-
/** @type {Revision} */
|
|
405
|
-
const revision = {
|
|
406
|
-
dialect,
|
|
407
|
-
subject: subjectResult[1],
|
|
408
|
-
parents: input.parents,
|
|
409
|
-
snapshot: snapshotResult[1],
|
|
410
|
-
generation: computeGeneration(parentsResult[1]),
|
|
411
|
-
archived: input.archived,
|
|
412
|
-
lock: input.lock,
|
|
413
|
-
}
|
|
414
|
-
const referencesResult = checkReferences(revision)
|
|
415
|
-
if (referencesResult[0] === 'error') { return pure(referencesResult) }
|
|
416
|
-
// Canonicalize parent/snapshot spellings now that checkReferences has
|
|
417
|
-
// confirmed they decode (`unwrap` inside `canonicalHash` is safe):
|
|
418
|
-
// two `add` calls describing the same logical revision but spelled
|
|
419
|
-
// differently (case, `i`/`l`/`o` aliases) must serialize identically,
|
|
420
|
-
// or they'd produce two distinct CAS blobs that both remain heads —
|
|
421
|
-
// the point of `canonicalHash` (see the module doc) is defeated if
|
|
422
|
-
// this module itself writes non-canonical spellings.
|
|
423
|
-
/** @type {Revision} */
|
|
424
|
-
const canonicalRevision = {
|
|
425
|
-
...revision,
|
|
426
|
-
parents: revision.parents.map(canonicalHash),
|
|
427
|
-
snapshot: canonicalHash(revision.snapshot),
|
|
428
|
-
lock: revision.lock === undefined ? undefined : canonicalLock(revision.lock),
|
|
429
|
-
}
|
|
438
|
+
step(
|
|
439
|
+
resolveParents(cas)(input.parents),
|
|
440
|
+
(/** @type {Result<readonly Revision[], string>} */ parentsResult) => {
|
|
441
|
+
const revisionResult = okThen(buildRevision(input))(parentsResult)
|
|
442
|
+
if (revisionResult[0] === 'error') { return pure(revisionResult) }
|
|
443
|
+
const canonicalRevision = revisionResult[1]
|
|
430
444
|
const bytes = tryUtf8(encodeText(canonicalRevision))
|
|
431
445
|
if (bytes === null) {
|
|
432
446
|
return pure(error('revision too large to encode'))
|
|
433
447
|
}
|
|
434
|
-
return
|
|
435
|
-
.
|
|
448
|
+
return step(
|
|
449
|
+
cas.write(nonEmpty(ok(bytes), /** @type {List<never, Ok<Vec>>} */ (elEmpty()))),
|
|
450
|
+
(/** @type {IoResult<Vec>} */ writeResult) => {
|
|
436
451
|
if (writeResult[0] === 'error') {
|
|
437
452
|
return /** @type {Effect<MemOp, Result<Hash, string>>} */ (pure(error('failed to write revision to CAS')))
|
|
438
453
|
}
|
|
439
454
|
const hash = vecToCBase32(writeResult[1])
|
|
440
|
-
return
|
|
441
|
-
.step(() => pure(ok(hash)))
|
|
442
|
-
.value
|
|
455
|
+
return mapStep(foldIntoCache(cacheKey)(hash)(canonicalRevision), () => ok(hash))
|
|
443
456
|
})
|
|
444
|
-
.value
|
|
445
457
|
})
|
|
446
|
-
.value
|
|
447
458
|
|
|
448
459
|
/**
|
|
449
460
|
* Projects a decoded `Revision` into the shared {@link RevisionData}
|
|
@@ -525,9 +536,7 @@ export const readRevision = cas => hash => {
|
|
|
525
536
|
const hashVec = cBase32ToVec(hash)
|
|
526
537
|
return hashVec === null
|
|
527
538
|
? pure(error(`invalid hash: ${hash}`))
|
|
528
|
-
:
|
|
529
|
-
.map(decodeReadRevision(hash))
|
|
530
|
-
.value
|
|
539
|
+
: mapStep(collectRead(cas.read(hashVec)), decodeReadRevision(hash))
|
|
531
540
|
}
|
|
532
541
|
|
|
533
542
|
/**
|
|
@@ -540,17 +549,15 @@ export const readRevision = cas => hash => {
|
|
|
540
549
|
export const evo = cas => cacheKey => ({
|
|
541
550
|
list: archived => {
|
|
542
551
|
const listed = subjectListed(archived)
|
|
543
|
-
return
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
552
|
+
return mapStep(
|
|
553
|
+
read(cacheKey),
|
|
554
|
+
cache => definedEntries(cache.bySubject)
|
|
555
|
+
.flatMap(([subject, state]) => listed(state) ? [subject] : []))
|
|
547
556
|
},
|
|
548
|
-
head: subject =>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
})
|
|
553
|
-
.value,
|
|
557
|
+
head: subject => mapStep(read(cacheKey), cache => {
|
|
558
|
+
const state = at(subject)(cache.bySubject)
|
|
559
|
+
return state === null ? [] : headsOf(state)
|
|
560
|
+
}),
|
|
554
561
|
add: input => addRevision(cas)(cacheKey)(input),
|
|
555
562
|
revision: readRevision(cas),
|
|
556
563
|
})
|
package/fjs/cas/evo/proof.f.mjs
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* @import { RevisionData } from './types.ts'
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
assert,
|
|
12
|
+
assertEq,
|
|
13
|
+
assertStructurallySame,
|
|
14
|
+
} from '../../asserts/module.f.mjs'
|
|
11
15
|
import { pure } from '../../effects/module.f.mjs'
|
|
12
16
|
import { fileCas } from '../module.f.mjs'
|
|
13
17
|
import { sha256 } from '../../crypto/sha2/module.f.mjs'
|
|
@@ -18,7 +22,6 @@ import { unwrap } from '../../types/nullable/module.f.mjs'
|
|
|
18
22
|
import { ok, error } from '../../types/result/module.f.mjs'
|
|
19
23
|
import { nonEmpty, empty as elEmpty } from '../../effects/list/module.f.mjs'
|
|
20
24
|
import { tryUtf8 } from '../../text/module.f.mjs'
|
|
21
|
-
|
|
22
25
|
import { dialect as revisionDialect } from '../../media/revision/module.f.mjs'
|
|
23
26
|
import {
|
|
24
27
|
buildCache, decodeRevisionBlob, initEvo, evo, emptyCache, syncRevision,
|
|
@@ -65,7 +68,7 @@ export const proof = {
|
|
|
65
68
|
buildCacheEmptyStoreYieldsEmptyCache: () => {
|
|
66
69
|
const c = fileCas(sha256)(home)
|
|
67
70
|
const [, cache] = virtual(emptyState)(buildCache(c))
|
|
68
|
-
|
|
71
|
+
assertStructurallySame(cache, emptyCache)
|
|
69
72
|
},
|
|
70
73
|
buildCacheSkipsNonRevisionBlob: () => {
|
|
71
74
|
const c = fileCas(sha256)(home)
|
package/fjs/cas/module.f.mjs
CHANGED
|
@@ -22,8 +22,7 @@ import { sha256 } from '../crypto/sha2/module.f.mjs'
|
|
|
22
22
|
import { join, normalize, parse } from '../path/module.f.mjs'
|
|
23
23
|
import { empty, length, maxLength, maxLengthBytes, msb, vec } from '../types/bit_vec/module.f.mjs'
|
|
24
24
|
import { cBase32ToVec, vecToCBase32 } from '../basen/cbase32/module.f.mjs'
|
|
25
|
-
import { foldStep, forEachStep, history, historyStep, okStep, pure, step } from '../effects/module.f.mjs'
|
|
26
|
-
import { eff } from '../effects/eff/module.f.mjs'
|
|
25
|
+
import { foldStep, forEachStep, history, historyStep, mapStep, okStep, pure, step } from '../effects/module.f.mjs'
|
|
27
26
|
import {
|
|
28
27
|
access,
|
|
29
28
|
createExclusive,
|
|
@@ -74,18 +73,16 @@ export const toPath = key => {
|
|
|
74
73
|
export const collectRead = stream => {
|
|
75
74
|
/** @type {(acc: Vec) => (s: List<O, IoResult<Vec>>) => Effect<O, IoResult<Vec>>} */
|
|
76
75
|
const loop = acc => s =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
88
|
-
.value
|
|
76
|
+
step(s, node => {
|
|
77
|
+
if (node === undefined) { return pure(ok(acc)) }
|
|
78
|
+
const { first, tail } = node
|
|
79
|
+
const [t, v] = first
|
|
80
|
+
if (t === 'error') { return pure(first) }
|
|
81
|
+
if (length(acc) + length(v) > maxLength) {
|
|
82
|
+
return pure(error(`cas blob exceeds maximum vector length of ${maxLength} bits`))
|
|
83
|
+
}
|
|
84
|
+
return loop(msb.concat(acc)(v))(tail)
|
|
85
|
+
})
|
|
89
86
|
return loop(empty)(stream)
|
|
90
87
|
}
|
|
91
88
|
|
|
@@ -133,21 +130,24 @@ const deadlineOf = name => Number(name.slice(0, name.indexOf('-')))
|
|
|
133
130
|
* @param {string} stageDir
|
|
134
131
|
* @returns {Effect<O, void>}
|
|
135
132
|
*/
|
|
136
|
-
const gcStage = stageDir =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
const gcStage = stageDir => {
|
|
134
|
+
// The `readdir` result and the `now()` timestamp are both needed by the last
|
|
135
|
+
// link, so the timestamp is carried forward in a history rather than closed
|
|
136
|
+
// over by a nested continuation.
|
|
137
|
+
const listed = historyStep(
|
|
138
|
+
history(now()),
|
|
139
|
+
() => readdir(stageDir, {}))
|
|
140
|
+
return step(
|
|
141
|
+
listed,
|
|
142
|
+
([[k, v], t]) => {
|
|
140
143
|
if (k === 'error') { return pure(undefined) }
|
|
141
144
|
const expired = v.flatMap(d =>
|
|
142
145
|
d.isFile && deadlineOf(d.name) < t ? [d.name] : [])
|
|
143
146
|
return forEachStep(
|
|
144
147
|
pure(expired),
|
|
145
|
-
name =>
|
|
146
|
-
eff(rm(join(stageDir, name)))
|
|
147
|
-
.step(() => pure(undefined))
|
|
148
|
-
.value)
|
|
148
|
+
name => mapStep(rm(join(stageDir, name)), () => undefined))
|
|
149
149
|
})
|
|
150
|
-
|
|
150
|
+
}
|
|
151
151
|
|
|
152
152
|
// Lock-free staging upload (plan/staging-lease.md): stream each chunk straight
|
|
153
153
|
// to a `_stage/<deadline>-<rand>` file via `writeBytes` while folding it into the
|
|
@@ -176,69 +176,61 @@ const writeImpl = (sha2, path, stageDir, payload) => {
|
|
|
176
176
|
const rel = toPath(hash)
|
|
177
177
|
const dst = join(path, rel)
|
|
178
178
|
const dstDir = join(path, ...parse(rel).slice(0, -1))
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
.
|
|
179
|
+
const created = step(mkdir(dstDir, { recursive: true }), () => rename(curPath, dst))
|
|
180
|
+
const removed = step(created, () => rm(curPath))
|
|
181
|
+
const stated = step(removed, () => stat(dst))
|
|
182
|
+
return mapStep(
|
|
183
|
+
stated,
|
|
184
|
+
st => st[0] === 'ok' && st[1].size === offset ? ok(hash) : error('publish size mismatch'))
|
|
185
185
|
}
|
|
186
186
|
// Any streaming error fails closed: delete the partial file, return the error.
|
|
187
187
|
/** @type {(curPath: string, e: unknown) => Effect<FileCasOperation, IoResult<Vec>>} */
|
|
188
188
|
const fail = (curPath, e) =>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
rt === 'error'
|
|
226
|
-
? fail(curPath, v)
|
|
227
|
-
: loop(newState, newOffset, next)(tail))
|
|
228
|
-
})
|
|
229
|
-
.value
|
|
230
|
-
})
|
|
231
|
-
.value
|
|
232
|
-
return eff(mkdir(stageDir, { recursive: true }))
|
|
233
|
-
.step(() => now())
|
|
234
|
-
.step(t0 => {
|
|
235
|
-
const path0 = join(stageDir, stageName(t0 + leaseDelta, rndStr))
|
|
236
|
-
return eff(createExclusive(path0))
|
|
237
|
-
.step(okStep(() => loop(sha2.init, 0, path0)(payload)))
|
|
238
|
-
.value
|
|
189
|
+
mapStep(rm(curPath), () => error(e))
|
|
190
|
+
const rndEffect = step(gcStage(stageDir), () => random256)
|
|
191
|
+
return step(rndEffect, rnd => {
|
|
192
|
+
const rndStr = vecToCBase32(rnd)
|
|
193
|
+
/** @type {(state: Sha2State, offset: number, curPath: string) => (stream: List<O1, IoResult<Vec>>) => Effect<O1 | FileCasOperation, IoResult<Vec>>} */
|
|
194
|
+
const loop = (state, offset, curPath) =>
|
|
195
|
+
stream =>
|
|
196
|
+
step(stream, node => {
|
|
197
|
+
if (node === undefined) {
|
|
198
|
+
return publish(state, offset, curPath)
|
|
199
|
+
}
|
|
200
|
+
const { first, tail } = node
|
|
201
|
+
if (first[0] === 'error') {
|
|
202
|
+
return fail(curPath, first[1])
|
|
203
|
+
}
|
|
204
|
+
const chunk = first[1]
|
|
205
|
+
return step(writeBytes(curPath, offset, chunk), wb => {
|
|
206
|
+
if (wb[0] === 'error') { return fail(curPath, wb[1]) }
|
|
207
|
+
const newState = sha2.append(chunk)(state)
|
|
208
|
+
const newOffset = offset + Number(length(chunk) / 8n)
|
|
209
|
+
// Renew the lease: rename to a fresh deadline (keeps `delta` constant).
|
|
210
|
+
// The new path is still needed after the rename, to recurse with,
|
|
211
|
+
// so the rename captures it rather than closing over it.
|
|
212
|
+
const nextPath = step(
|
|
213
|
+
now(),
|
|
214
|
+
t => pure(join(stageDir, stageName(t + leaseDelta, rndStr))))
|
|
215
|
+
const renamed = historyStep(
|
|
216
|
+
history(nextPath),
|
|
217
|
+
next => rename(curPath, next))
|
|
218
|
+
return step(
|
|
219
|
+
renamed,
|
|
220
|
+
([[rt, v], next]) =>
|
|
221
|
+
rt === 'error'
|
|
222
|
+
? fail(curPath, v)
|
|
223
|
+
: loop(newState, newOffset, next)(tail))
|
|
224
|
+
})
|
|
239
225
|
})
|
|
240
|
-
|
|
241
|
-
|
|
226
|
+
const started = step(mkdir(stageDir, { recursive: true }), () => now())
|
|
227
|
+
return step(started, t0 => {
|
|
228
|
+
const path0 = join(stageDir, stageName(t0 + leaseDelta, rndStr))
|
|
229
|
+
return step(
|
|
230
|
+
createExclusive(path0),
|
|
231
|
+
okStep(() => loop(sha2.init, 0, path0)(payload)))
|
|
232
|
+
})
|
|
233
|
+
})
|
|
242
234
|
}
|
|
243
235
|
|
|
244
236
|
/**
|
|
@@ -255,8 +247,9 @@ export const fileCas = sha2 => path => {
|
|
|
255
247
|
const p = join(path, toPath(hash))
|
|
256
248
|
/** @type {(offset: number) => List<FileCasOperation, IoResult<Vec>>} */
|
|
257
249
|
const loop = offset =>
|
|
258
|
-
|
|
259
|
-
|
|
250
|
+
step(
|
|
251
|
+
readBytes(p, offset, chunkBytes),
|
|
252
|
+
/** @type {(result: IoResult<Vec>) => List<FileCasOperation, IoResult<Vec>>} */ (result) => {
|
|
260
253
|
const [t, v] = result
|
|
261
254
|
// A missing shard or read error is an explicit error item, never EOF.
|
|
262
255
|
if (t === 'error') {
|
|
@@ -268,7 +261,6 @@ export const fileCas = sha2 => path => {
|
|
|
268
261
|
? elEmpty()
|
|
269
262
|
: nonEmpty(ok(v), loop(offset + chunkBytes))
|
|
270
263
|
})
|
|
271
|
-
.value
|
|
272
264
|
return loop(0)
|
|
273
265
|
},
|
|
274
266
|
write: payload => writeImpl(sha2, path, stageDir, payload),
|
|
@@ -277,20 +269,18 @@ export const fileCas = sha2 => path => {
|
|
|
277
269
|
// empty store, mirroring how `read` maps a missing shard to an error item.
|
|
278
270
|
// A `.cas` that exists but cannot be read (permissions, corruption) is a
|
|
279
271
|
// genuine storage error and is surfaced, not masked as "no hashes".
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (a[
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
})
|
|
293
|
-
.value,
|
|
272
|
+
step(access(storePrefix), a => {
|
|
273
|
+
if (a[0] === 'error') {
|
|
274
|
+
if (isNotFound(a[1])) { return pure(/** @type {readonly Vec[]} */ ([])) }
|
|
275
|
+
throw a[1]
|
|
276
|
+
}
|
|
277
|
+
return mapStep(
|
|
278
|
+
readdir(storePrefix, { recursive: true }),
|
|
279
|
+
r => unwrap(r).flatMap(({ name, parentPath, isFile }) =>
|
|
280
|
+
toOption(isFile
|
|
281
|
+
? cBase32ToVec(normalize(parentPath).substring(normalizedStorePrefix.length).replaceAll('/', '') + name)
|
|
282
|
+
: null)))
|
|
283
|
+
}),
|
|
294
284
|
url: hash =>
|
|
295
285
|
join(path, toPath(hash))
|
|
296
286
|
}
|
|
@@ -305,9 +295,7 @@ const random256 =
|
|
|
305
295
|
pure([0, 1, 2, 3, 4, 5, 6, 7]),
|
|
306
296
|
empty,
|
|
307
297
|
() => (/** @type {Vec} */ acc) =>
|
|
308
|
-
|
|
309
|
-
.step(r => pure(msb.concat(acc)(vec(32n)(BigInt(r)))))
|
|
310
|
-
.value)
|
|
298
|
+
mapStep(randomInt(), r => msb.concat(acc)(vec(32n)(BigInt(r)))))
|
|
311
299
|
|
|
312
300
|
/** Streams any file at `filePath` in `<=128 KiB` chunks as a `ListEffect` of `ok` items.
|
|
313
301
|
*
|
|
@@ -316,8 +304,9 @@ const random256 =
|
|
|
316
304
|
const streamFile = filePath => {
|
|
317
305
|
/** @type {(offset: number) => List<ReadBytes, IoResult<Vec>>} */
|
|
318
306
|
const loop = offset =>
|
|
319
|
-
|
|
320
|
-
|
|
307
|
+
step(
|
|
308
|
+
readBytes(filePath, offset, chunkBytes),
|
|
309
|
+
/** @type {(result: IoResult<Vec>) => List<ReadBytes, IoResult<Vec>>} */ (result) => {
|
|
321
310
|
if (result[0] === 'error') {
|
|
322
311
|
return nonEmpty(result, elEmpty())
|
|
323
312
|
}
|
|
@@ -326,7 +315,6 @@ const streamFile = filePath => {
|
|
|
326
315
|
? elEmpty()
|
|
327
316
|
: nonEmpty(ok(chunk), loop(offset + chunkBytes))
|
|
328
317
|
})
|
|
329
|
-
.value
|
|
330
318
|
return loop(0)
|
|
331
319
|
}
|
|
332
320
|
|
|
@@ -355,9 +343,8 @@ export const casAddFile = cas => path =>
|
|
|
355
343
|
export const casUpload = home => fileName => {
|
|
356
344
|
const src = join(home, 'cas_upload', fileName)
|
|
357
345
|
const c = fileCas(sha256)(home)
|
|
358
|
-
return
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
.value
|
|
346
|
+
return step(
|
|
347
|
+
casAddFile(c)(src),
|
|
348
|
+
okStep(/** @type {(v: Vec) => Effect<Rm, IoResult<Vec>>} */ (v =>
|
|
349
|
+
mapStep(rm(src), () => ok(v)))))
|
|
363
350
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Step, Job, MetaStep } from './types.ts';
|
|
2
1
|
/**
|
|
3
2
|
* Shared CI types and helpers: GitHub Actions step/job RTTI schemas, the
|
|
4
3
|
* `MetaStep` representation used by tool-specific modules, and assemblers like
|
|
@@ -10,6 +9,7 @@ import type { Step, Job, MetaStep } from './types.ts';
|
|
|
10
9
|
*
|
|
11
10
|
* @import { Step, Job, MetaStep, StepType } from './types.ts'
|
|
12
11
|
*/
|
|
12
|
+
import type { Step, Job, MetaStep } from './types.ts';
|
|
13
13
|
import { actions } from '../config/module.f.mjs';
|
|
14
14
|
export declare const os: readonly ['ubuntu', 'macos', 'windows'];
|
|
15
15
|
export declare const architecture: readonly ['intel', 'arm'];
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @import { Step, Job, MetaStep, StepType } from './types.ts'
|
|
11
11
|
*/
|
|
12
|
+
|
|
12
13
|
import { actions, images } from '../config/module.f.mjs'
|
|
13
14
|
import { option, array, record, string } from '../../types/rtti/module.f.mjs'
|
|
14
15
|
import { parse as rttiParse } from '../../types/rtti/parse/module.f.mjs'
|