liminal 0.1.0-beta.25
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/LICENSE +202 -0
- package/README.md +26 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/client/Adapter.d.ts +46 -0
- package/esm/client/Adapter.d.ts.map +1 -0
- package/esm/client/Adapter.js +2 -0
- package/esm/client/Adapter.js.map +1 -0
- package/esm/client/Liminal.d.ts +19 -0
- package/esm/client/Liminal.d.ts.map +1 -0
- package/esm/client/Liminal.js +154 -0
- package/esm/client/Liminal.js.map +1 -0
- package/esm/client/Tool.d.ts +15 -0
- package/esm/client/Tool.d.ts.map +1 -0
- package/esm/client/Tool.js +23 -0
- package/esm/client/Tool.js.map +1 -0
- package/esm/client/constants.d.ts +2 -0
- package/esm/client/constants.d.ts.map +1 -0
- package/esm/client/constants.js +7 -0
- package/esm/client/constants.js.map +1 -0
- package/esm/client/mod.d.ts +5 -0
- package/esm/client/mod.d.ts.map +1 -0
- package/esm/client/mod.js +6 -0
- package/esm/client/mod.js.map +1 -0
- package/esm/core/DescriptionContext.d.ts +11 -0
- package/esm/core/DescriptionContext.d.ts.map +1 -0
- package/esm/core/DescriptionContext.js +103 -0
- package/esm/core/DescriptionContext.js.map +1 -0
- package/esm/core/L.d.ts +4 -0
- package/esm/core/L.d.ts.map +1 -0
- package/esm/core/L.js +4 -0
- package/esm/core/L.js.map +1 -0
- package/esm/core/ReduceDependencies.d.ts +6 -0
- package/esm/core/ReduceDependencies.d.ts.map +1 -0
- package/esm/core/ReduceDependencies.js +2 -0
- package/esm/core/ReduceDependencies.js.map +1 -0
- package/esm/core/Type.d.ts +30 -0
- package/esm/core/Type.d.ts.map +1 -0
- package/esm/core/Type.js +2 -0
- package/esm/core/Type.js.map +1 -0
- package/esm/core/TypeVisitor.d.ts +15 -0
- package/esm/core/TypeVisitor.d.ts.map +1 -0
- package/esm/core/TypeVisitor.js +12 -0
- package/esm/core/TypeVisitor.js.map +1 -0
- package/esm/core/annotations/Annotation.d.ts +7 -0
- package/esm/core/annotations/Annotation.d.ts.map +1 -0
- package/esm/core/annotations/Annotation.js +2 -0
- package/esm/core/annotations/Annotation.js.map +1 -0
- package/esm/core/annotations/Assertion.d.ts +8 -0
- package/esm/core/annotations/Assertion.d.ts.map +1 -0
- package/esm/core/annotations/Assertion.js +8 -0
- package/esm/core/annotations/Assertion.js.map +1 -0
- package/esm/core/annotations/Description.d.ts +7 -0
- package/esm/core/annotations/Description.d.ts.map +1 -0
- package/esm/core/annotations/Description.js +8 -0
- package/esm/core/annotations/Description.js.map +1 -0
- package/esm/core/annotations/Param.d.ts +13 -0
- package/esm/core/annotations/Param.d.ts.map +1 -0
- package/esm/core/annotations/Param.js +11 -0
- package/esm/core/annotations/Param.js.map +1 -0
- package/esm/core/annotations/Template.d.ts +10 -0
- package/esm/core/annotations/Template.d.ts.map +1 -0
- package/esm/core/annotations/Template.js +2 -0
- package/esm/core/annotations/Template.js.map +1 -0
- package/esm/core/annotations/mod.d.ts +6 -0
- package/esm/core/annotations/mod.d.ts.map +1 -0
- package/esm/core/annotations/mod.js +7 -0
- package/esm/core/annotations/mod.js.map +1 -0
- package/esm/core/assert.d.ts +22 -0
- package/esm/core/assert.d.ts.map +1 -0
- package/esm/core/assert.js +155 -0
- package/esm/core/assert.js.map +1 -0
- package/esm/core/declareIntrinsic.d.ts +4 -0
- package/esm/core/declareIntrinsic.d.ts.map +1 -0
- package/esm/core/declareIntrinsic.js +26 -0
- package/esm/core/declareIntrinsic.js.map +1 -0
- package/esm/core/deserialize.d.ts +3 -0
- package/esm/core/deserialize.d.ts.map +1 -0
- package/esm/core/deserialize.js +32 -0
- package/esm/core/deserialize.js.map +1 -0
- package/esm/core/display.d.ts +3 -0
- package/esm/core/display.d.ts.map +1 -0
- package/esm/core/display.js +75 -0
- package/esm/core/display.js.map +1 -0
- package/esm/core/inspect.node.d.ts +5 -0
- package/esm/core/inspect.node.d.ts.map +1 -0
- package/esm/core/inspect.node.js +7 -0
- package/esm/core/inspect.node.js.map +1 -0
- package/esm/core/intrinsics.d.ts +19 -0
- package/esm/core/intrinsics.d.ts.map +1 -0
- package/esm/core/intrinsics.js +64 -0
- package/esm/core/intrinsics.js.map +1 -0
- package/esm/core/intrinsics_util.d.ts +6 -0
- package/esm/core/intrinsics_util.d.ts.map +1 -0
- package/esm/core/intrinsics_util.js +46 -0
- package/esm/core/intrinsics_util.js.map +1 -0
- package/esm/core/isType.d.ts +4 -0
- package/esm/core/isType.d.ts.map +1 -0
- package/esm/core/isType.js +18 -0
- package/esm/core/isType.js.map +1 -0
- package/esm/core/mod.d.ts +13 -0
- package/esm/core/mod.d.ts.map +1 -0
- package/esm/core/mod.js +14 -0
- package/esm/core/mod.js.map +1 -0
- package/esm/core/signature.d.ts +4 -0
- package/esm/core/signature.d.ts.map +1 -0
- package/esm/core/signature.js +93 -0
- package/esm/core/signature.js.map +1 -0
- package/esm/core/utility/Flatten.d.ts +8 -0
- package/esm/core/utility/Flatten.d.ts.map +1 -0
- package/esm/core/utility/Flatten.js +6 -0
- package/esm/core/utility/Flatten.js.map +1 -0
- package/esm/core/utility/Intersection.d.ts +12 -0
- package/esm/core/utility/Intersection.d.ts.map +1 -0
- package/esm/core/utility/Intersection.js +5 -0
- package/esm/core/utility/Intersection.js.map +1 -0
- package/esm/core/utility/Option.d.ts +3 -0
- package/esm/core/utility/Option.d.ts.map +1 -0
- package/esm/core/utility/Option.js +5 -0
- package/esm/core/utility/Option.js.map +1 -0
- package/esm/core/utility/Record.d.ts +3 -0
- package/esm/core/utility/Record.d.ts.map +1 -0
- package/esm/core/utility/Record.js +6 -0
- package/esm/core/utility/Record.js.map +1 -0
- package/esm/core/utility/Set.d.ts +4 -0
- package/esm/core/utility/Set.d.ts.map +1 -0
- package/esm/core/utility/Set.js +7 -0
- package/esm/core/utility/Set.js.map +1 -0
- package/esm/core/utility/TaggedUnion.d.ts +13 -0
- package/esm/core/utility/TaggedUnion.d.ts.map +1 -0
- package/esm/core/utility/TaggedUnion.js +8 -0
- package/esm/core/utility/TaggedUnion.js.map +1 -0
- package/esm/core/utility/Tuple.d.ts +9 -0
- package/esm/core/utility/Tuple.d.ts.map +1 -0
- package/esm/core/utility/Tuple.js +11 -0
- package/esm/core/utility/Tuple.js.map +1 -0
- package/esm/core/utility/mod.d.ts +8 -0
- package/esm/core/utility/mod.d.ts.map +1 -0
- package/esm/core/utility/mod.js +9 -0
- package/esm/core/utility/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts +16 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js +31 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js +184 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts +35 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js +59 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js +46 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js +34 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js +33 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js +161 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts +42 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts +17 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js +184 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +27 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts +59 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js +153 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js +70 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js +132 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js +164 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts +37 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js +110 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts +22 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js +23 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts +118 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js +208 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +111 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +277 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +180 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +38 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +208 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +3 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js.map +1 -0
- package/esm/json_schema/Hydrated.d.ts +4 -0
- package/esm/json_schema/Hydrated.d.ts.map +1 -0
- package/esm/json_schema/Hydrated.js +49 -0
- package/esm/json_schema/Hydrated.js.map +1 -0
- package/esm/json_schema/JSONSchema.d.ts +50 -0
- package/esm/json_schema/JSONSchema.d.ts.map +1 -0
- package/esm/json_schema/JSONSchema.js +46 -0
- package/esm/json_schema/JSONSchema.js.map +1 -0
- package/esm/json_schema/MetaType.d.ts +4 -0
- package/esm/json_schema/MetaType.d.ts.map +1 -0
- package/esm/json_schema/MetaType.js +25 -0
- package/esm/json_schema/MetaType.js.map +1 -0
- package/esm/json_schema/MetaTypeMigration.d.ts +19 -0
- package/esm/json_schema/MetaTypeMigration.d.ts.map +1 -0
- package/esm/json_schema/MetaTypeMigration.js +15 -0
- package/esm/json_schema/MetaTypeMigration.js.map +1 -0
- package/esm/json_schema/PathLike.d.ts +4 -0
- package/esm/json_schema/PathLike.d.ts.map +1 -0
- package/esm/json_schema/PathLike.js +3 -0
- package/esm/json_schema/PathLike.js.map +1 -0
- package/esm/json_schema/mod.d.ts +7 -0
- package/esm/json_schema/mod.d.ts.map +1 -0
- package/esm/json_schema/mod.js +8 -0
- package/esm/json_schema/mod.js.map +1 -0
- package/esm/json_schema/toJSONSchema.d.ts +4 -0
- package/esm/json_schema/toJSONSchema.d.ts.map +1 -0
- package/esm/json_schema/toJSONSchema.js +117 -0
- package/esm/json_schema/toJSONSchema.js.map +1 -0
- package/esm/mod.d.ts +4 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +4 -0
- package/esm/mod.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/providers/OpenAI/OpenAIAdapter.d.ts +17 -0
- package/esm/providers/OpenAI/OpenAIAdapter.d.ts.map +1 -0
- package/esm/providers/OpenAI/OpenAIAdapter.js +56 -0
- package/esm/providers/OpenAI/OpenAIAdapter.js.map +1 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts +18 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts.map +1 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.js +26 -0
- package/esm/providers/OpenAI/OpenAIResponseFormat.js.map +1 -0
- package/esm/providers/OpenAI/TokenAllowance.d.ts +17 -0
- package/esm/providers/OpenAI/TokenAllowance.d.ts.map +1 -0
- package/esm/providers/OpenAI/TokenAllowance.js +32 -0
- package/esm/providers/OpenAI/TokenAllowance.js.map +1 -0
- package/esm/providers/OpenAI/mod.d.ts +6 -0
- package/esm/providers/OpenAI/mod.d.ts.map +1 -0
- package/esm/providers/OpenAI/mod.js +7 -0
- package/esm/providers/OpenAI/mod.js.map +1 -0
- package/esm/providers/OpenAI/openai_util.d.ts +4 -0
- package/esm/providers/OpenAI/openai_util.d.ts.map +1 -0
- package/esm/providers/OpenAI/openai_util.js +14 -0
- package/esm/providers/OpenAI/openai_util.js.map +1 -0
- package/esm/providers/OpenAI/refine.d.ts +2 -0
- package/esm/providers/OpenAI/refine.d.ts.map +1 -0
- package/esm/providers/OpenAI/refine.js +166 -0
- package/esm/providers/OpenAI/refine.js.map +1 -0
- package/esm/util/ArrayOfLength.d.ts +2 -0
- package/esm/util/ArrayOfLength.d.ts.map +1 -0
- package/esm/util/ArrayOfLength.js +2 -0
- package/esm/util/ArrayOfLength.js.map +1 -0
- package/esm/util/PromiseOr.d.ts +2 -0
- package/esm/util/PromiseOr.d.ts.map +1 -0
- package/esm/util/PromiseOr.js +2 -0
- package/esm/util/PromiseOr.js.map +1 -0
- package/esm/util/WeakMemo.d.ts +7 -0
- package/esm/util/WeakMemo.d.ts.map +1 -0
- package/esm/util/WeakMemo.js +32 -0
- package/esm/util/WeakMemo.js.map +1 -0
- package/esm/util/collect.d.ts +2 -0
- package/esm/util/collect.d.ts.map +1 -0
- package/esm/util/collect.js +8 -0
- package/esm/util/collect.js.map +1 -0
- package/esm/util/isPromise.d.ts +2 -0
- package/esm/util/isPromise.d.ts.map +1 -0
- package/esm/util/isPromise.js +7 -0
- package/esm/util/isPromise.js.map +1 -0
- package/esm/util/isTemplateStringsArray.d.ts +2 -0
- package/esm/util/isTemplateStringsArray.d.ts.map +1 -0
- package/esm/util/isTemplateStringsArray.js +4 -0
- package/esm/util/isTemplateStringsArray.js.map +1 -0
- package/esm/util/mod.d.ts +10 -0
- package/esm/util/mod.d.ts.map +1 -0
- package/esm/util/mod.js +11 -0
- package/esm/util/mod.js.map +1 -0
- package/esm/util/recombine.d.ts +2 -0
- package/esm/util/recombine.d.ts.map +1 -0
- package/esm/util/recombine.js +11 -0
- package/esm/util/recombine.js.map +1 -0
- package/esm/util/splitLast.d.ts +2 -0
- package/esm/util/splitLast.d.ts.map +1 -0
- package/esm/util/splitLast.js +8 -0
- package/esm/util/splitLast.js.map +1 -0
- package/esm/util/type_util.d.ts +5 -0
- package/esm/util/type_util.d.ts.map +1 -0
- package/esm/util/type_util.js +2 -0
- package/esm/util/type_util.js.map +1 -0
- package/package.json +22 -0
- package/src/_dnt.shims.ts +60 -0
- package/src/client/Adapter.ts +50 -0
- package/src/client/Liminal.ts +113 -0
- package/src/client/Tool.ts +17 -0
- package/src/client/constants.ts +6 -0
- package/src/client/mod.ts +6 -0
- package/src/core/DescriptionContext.ts +89 -0
- package/src/core/L.ts +3 -0
- package/src/core/ReduceDependencies.ts +9 -0
- package/src/core/Type.ts +45 -0
- package/src/core/TypeVisitor.ts +44 -0
- package/src/core/annotations/Annotation.ts +14 -0
- package/src/core/annotations/Assertion.ts +18 -0
- package/src/core/annotations/Description.ts +16 -0
- package/src/core/annotations/Param.ts +30 -0
- package/src/core/annotations/Template.ts +11 -0
- package/src/core/annotations/mod.ts +7 -0
- package/src/core/assert.ts +145 -0
- package/src/core/declareIntrinsic.ts +45 -0
- package/src/core/deserialize.ts +36 -0
- package/src/core/display.ts +68 -0
- package/src/core/inspect.node.ts +13 -0
- package/src/core/intrinsics.ts +86 -0
- package/src/core/intrinsics_util.ts +50 -0
- package/src/core/isType.ts +20 -0
- package/src/core/mod.ts +15 -0
- package/src/core/signature.ts +90 -0
- package/src/core/utility/Flatten.ts +14 -0
- package/src/core/utility/Intersection.ts +24 -0
- package/src/core/utility/Option.ts +6 -0
- package/src/core/utility/Record.ts +7 -0
- package/src/core/utility/Set.ts +8 -0
- package/src/core/utility/TaggedUnion.ts +23 -0
- package/src/core/utility/Tuple.ts +24 -0
- package/src/core/utility/mod.ts +9 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/almost_equals.ts +55 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/array_includes.ts +57 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/assert.ts +23 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/equal.ts +210 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/equals.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/exists.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/fail.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/false.ts +26 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/greater.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/less.ts +29 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/less_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/mod.ts +47 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_equals.ts +37 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/object_match.ts +203 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/strict_equals.ts +67 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/string_includes.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/throws.ts +111 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/unimplemented.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.10/unreachable.ts +21 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/_base32_common.ts +218 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.ts +29 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/ascii85.ts +203 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base32.ts +73 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base58.ts +173 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base64.ts +174 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/base64url.ts +88 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/hex.ts +120 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/mod.ts +24 -0
- package/src/deps/jsr.io/@std/encoding/1.0.6/varint.ts +242 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +134 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +317 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +204 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +39 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +233 -0
- package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +18 -0
- package/src/json_schema/Hydrated.ts +52 -0
- package/src/json_schema/JSONSchema.ts +95 -0
- package/src/json_schema/MetaType.ts +32 -0
- package/src/json_schema/MetaTypeMigration.ts +31 -0
- package/src/json_schema/PathLike.ts +9 -0
- package/src/json_schema/mod.ts +8 -0
- package/src/json_schema/toJSONSchema.ts +114 -0
- package/src/mod.ts +3 -0
- package/src/providers/OpenAI/OpenAIAdapter.ts +89 -0
- package/src/providers/OpenAI/OpenAIResponseFormat.ts +54 -0
- package/src/providers/OpenAI/TokenAllowance.ts +29 -0
- package/src/providers/OpenAI/mod.ts +7 -0
- package/src/providers/OpenAI/openai_util.ts +19 -0
- package/src/providers/OpenAI/refine.ts +171 -0
- package/src/util/ArrayOfLength.ts +5 -0
- package/src/util/PromiseOr.ts +1 -0
- package/src/util/WeakMemo.ts +13 -0
- package/src/util/collect.ts +7 -0
- package/src/util/isPromise.ts +8 -0
- package/src/util/isTemplateStringsArray.ts +3 -0
- package/src/util/mod.ts +11 -0
- package/src/util/recombine.ts +10 -0
- package/src/util/splitLast.ts +7 -0
- package/src/util/type_util.ts +3 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { encodeBase32 } from "../deps/jsr.io/@std/encoding/1.0.6/mod.js"
|
|
2
|
+
import { WeakMemo } from "../util/WeakMemo.js"
|
|
3
|
+
import { IntrinsicName } from "./intrinsics_util.js"
|
|
4
|
+
import type { PartialType } from "./Type.js"
|
|
5
|
+
import { TypeVisitor } from "./TypeVisitor.js"
|
|
6
|
+
|
|
7
|
+
export function signature(type: PartialType): string {
|
|
8
|
+
return signatureMemo.getOrInit(type)
|
|
9
|
+
}
|
|
10
|
+
const signatureMemo = new WeakMemo<PartialType, string>((type) => {
|
|
11
|
+
const ctx = new SignatureVisitorContext()
|
|
12
|
+
visit(ctx, type)
|
|
13
|
+
return `{\n ${Object.entries(ctx.defs).map(([k, v]) => `${k}: ${v}`).join("\n ")}\n}`
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export function signatureHash(type: PartialType): Promise<string> {
|
|
17
|
+
return signatureHashMemo.getOrInit(type)
|
|
18
|
+
}
|
|
19
|
+
const signatureHashMemo = new WeakMemo<PartialType, Promise<string>>((type) =>
|
|
20
|
+
crypto.subtle
|
|
21
|
+
.digest("SHA-256", new TextEncoder().encode(signatureMemo.getOrInit(type)))
|
|
22
|
+
.then(encodeBase32)
|
|
23
|
+
.then((v) => v.slice(0, -4))
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
class SignatureVisitorContext {
|
|
27
|
+
ids: Map<PartialType, string> = new Map()
|
|
28
|
+
defs: Record<string, undefined | string> = {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const visit = TypeVisitor<SignatureVisitorContext, string>({
|
|
32
|
+
hook(next, ctx, type): string {
|
|
33
|
+
const { ids, defs } = ctx
|
|
34
|
+
switch (IntrinsicName(type)) {
|
|
35
|
+
case "array":
|
|
36
|
+
case "object":
|
|
37
|
+
case "union": {
|
|
38
|
+
let id = ids.get(type)
|
|
39
|
+
if (id === undefined) {
|
|
40
|
+
id = ids.size.toString()
|
|
41
|
+
ids.set(type, id)
|
|
42
|
+
}
|
|
43
|
+
if (id in defs) {
|
|
44
|
+
return `i(${id})`
|
|
45
|
+
}
|
|
46
|
+
defs[id] = undefined
|
|
47
|
+
const signature = next(ctx, type)
|
|
48
|
+
defs[id] = signature
|
|
49
|
+
return `i(${id})`
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return next(ctx, type)
|
|
53
|
+
},
|
|
54
|
+
const(_0, _1, _2, value): string {
|
|
55
|
+
if (typeof value === "string") {
|
|
56
|
+
return `"${escapeDoubleQuotes(value)}"`
|
|
57
|
+
}
|
|
58
|
+
return JSON.stringify(value)
|
|
59
|
+
},
|
|
60
|
+
array(ctx, _1, element): string {
|
|
61
|
+
return `array(${visit(ctx, element)})`
|
|
62
|
+
},
|
|
63
|
+
object(ctx, _1, fields): string {
|
|
64
|
+
return `object({ ${
|
|
65
|
+
Object
|
|
66
|
+
.entries(fields)
|
|
67
|
+
.map(([k, v]) => `${escapeDoubleQuotes(k)}: ${visit(ctx, v)}`)
|
|
68
|
+
.join(", ")
|
|
69
|
+
} })`
|
|
70
|
+
},
|
|
71
|
+
enum(_0, _1, ...values) {
|
|
72
|
+
return `enum("${values.map(escapeDoubleQuotes).join(`", "`)}")`
|
|
73
|
+
},
|
|
74
|
+
union(ctx, _1, ...members): string {
|
|
75
|
+
return `union(${members.map((member) => visit(ctx, member)).join(", ")})`
|
|
76
|
+
},
|
|
77
|
+
ref(ctx, _1, get): string {
|
|
78
|
+
return visit(ctx, get())
|
|
79
|
+
},
|
|
80
|
+
transform(ctx, _1, from): string {
|
|
81
|
+
return visit(ctx, from)
|
|
82
|
+
},
|
|
83
|
+
fallback(_0, type) {
|
|
84
|
+
return IntrinsicName(type)
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
function escapeDoubleQuotes(value: string): string {
|
|
89
|
+
return value.indexOf(`"`) !== -1 ? JSON.stringify(value) : value
|
|
90
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as I from "../intrinsics.js"
|
|
2
|
+
import type { PartialType, Type } from "../Type.js"
|
|
3
|
+
import { Tuple } from "./Tuple.js"
|
|
4
|
+
|
|
5
|
+
export function Flattened<A extends Array<PartialType<Array<unknown>>>>(
|
|
6
|
+
...sources: A
|
|
7
|
+
): Type<NativeFlattened<A>, A[number]["D"]> {
|
|
8
|
+
return I.transform(Tuple(...sources), (value) => value.flat()) as never
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type NativeFlattened<A extends Array<PartialType<Array<unknown>>>> = A extends
|
|
12
|
+
[infer E0 extends PartialType, ...infer ERest extends PartialType[]]
|
|
13
|
+
? [...E0["T"], ...NativeFlattened<ERest>]
|
|
14
|
+
: []
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Expand, U2I } from "../../util/mod.js"
|
|
2
|
+
import * as I from "../intrinsics.js"
|
|
3
|
+
import type { PartialType, Type } from "../Type.js"
|
|
4
|
+
|
|
5
|
+
export function Intersection<S extends Array<PartialType>>(
|
|
6
|
+
...sources: Ensure<S>
|
|
7
|
+
): Type<Expand<U2I<S[number]["T"]>>, S[number]["D"]> {
|
|
8
|
+
return I.object(
|
|
9
|
+
Object.fromEntries(
|
|
10
|
+
sources.flatMap((source) => Object.entries(source.declaration.args![0]!)),
|
|
11
|
+
) as never,
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type Ensure<S extends Array<PartialType>> = [ConflictingKey<S>] extends [never] ? S
|
|
16
|
+
: never
|
|
17
|
+
|
|
18
|
+
type ConflictingKey<S extends Array<PartialType>, V extends string = never> = S extends [
|
|
19
|
+
infer E0 extends PartialType,
|
|
20
|
+
...infer ERest extends Array<PartialType>,
|
|
21
|
+
] ?
|
|
22
|
+
| keyof { [K in keyof E0["T"] as K extends V ? K : never]: true }
|
|
23
|
+
| ConflictingKey<ERest, V | Extract<keyof E0["T"], string>>
|
|
24
|
+
: never
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as I from "../intrinsics.js"
|
|
2
|
+
import type { Type } from "../Type.js"
|
|
3
|
+
import { Tuple } from "./Tuple.js"
|
|
4
|
+
|
|
5
|
+
export function Record<V, P extends symbol>(value: Type<V, P>): Type<Record<string, V>, P> {
|
|
6
|
+
return I.transform(I.array(Tuple(I.string, value)), Object.fromEntries)
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as I from "../intrinsics.js"
|
|
2
|
+
import type { Type } from "../Type.js"
|
|
3
|
+
|
|
4
|
+
export { Set_ as Set }
|
|
5
|
+
function Set_<T extends number | string, P extends symbol>(element: Type<T, P>): Type<Set<T>, P> {
|
|
6
|
+
return I.transform(I.array(element), (value) => new Set(value))
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(Set_, "name", { value: "Set" })
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Falsy } from "../../deps/jsr.io/@std/assert/1.0.10/mod.js"
|
|
2
|
+
import type { Expand } from "../../util/mod.js"
|
|
3
|
+
import * as I from "../intrinsics.js"
|
|
4
|
+
import type { PartialType, Type } from "../Type.js"
|
|
5
|
+
|
|
6
|
+
export function TaggedUnion<M extends Record<string, Falsy | PartialType>>(members: M): Type<
|
|
7
|
+
{
|
|
8
|
+
[K in keyof M]: Expand<
|
|
9
|
+
& { type: K }
|
|
10
|
+
& (M[K] extends PartialType ? { value: M[K]["T"] } : { value?: never })
|
|
11
|
+
>
|
|
12
|
+
}[keyof M],
|
|
13
|
+
Extract<M[keyof M], PartialType>["D"]
|
|
14
|
+
> {
|
|
15
|
+
return I.union(
|
|
16
|
+
...Object.keys(members).toSorted().map((tag) =>
|
|
17
|
+
I.object({
|
|
18
|
+
type: I.const(I.string, tag),
|
|
19
|
+
value: members[tag] ? members[tag] : I.null,
|
|
20
|
+
} as never)
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ArrayOfLength } from "../../util/mod.js"
|
|
2
|
+
import * as I from "../intrinsics.js"
|
|
3
|
+
import type { PartialType, Type } from "../Type.js"
|
|
4
|
+
|
|
5
|
+
export function Tuple<M extends Array<PartialType>>(
|
|
6
|
+
...members: M
|
|
7
|
+
): Type<{ [I in keyof M]: M[I]["T"] }, M[number]["D"]> {
|
|
8
|
+
return I.transform(
|
|
9
|
+
I.object(Object.fromEntries(members.map((type, i) => [i, type]))),
|
|
10
|
+
(value) => Object.values(value) as never,
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export namespace Tuple {
|
|
15
|
+
export function N<T, P extends symbol, N extends number>(
|
|
16
|
+
member: Type<T, P>,
|
|
17
|
+
length: N,
|
|
18
|
+
): Type<ArrayOfLength<T, N>, P> {
|
|
19
|
+
return I.transform(
|
|
20
|
+
I.object(Object.fromEntries(Array.from({ length }, (_0, i) => [i, member]))),
|
|
21
|
+
(value) => Object.values(value) as never,
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion that `actual` and `expected` are almost equal numbers
|
|
7
|
+
* through a given tolerance. It can be used to take into account IEEE-754
|
|
8
|
+
* double-precision floating-point representation limitations. If the values
|
|
9
|
+
* are not almost equal then throw.
|
|
10
|
+
*
|
|
11
|
+
* The default tolerance is one hundred thousandth of a percent of the
|
|
12
|
+
* expected value.
|
|
13
|
+
*
|
|
14
|
+
* @example Usage
|
|
15
|
+
* ```ts ignore
|
|
16
|
+
* import { assertAlmostEquals } from "@std/assert";
|
|
17
|
+
*
|
|
18
|
+
* assertAlmostEquals(0.01, 0.02); // Throws
|
|
19
|
+
* assertAlmostEquals(1e-8, 1e-9); // Throws
|
|
20
|
+
* assertAlmostEquals(1.000000001e-8, 1.000000002e-8); // Doesn't throw
|
|
21
|
+
* assertAlmostEquals(0.01, 0.02, 0.1); // Doesn't throw
|
|
22
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16); // Doesn't throw
|
|
23
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17); // Throws
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param actual The actual value to compare.
|
|
27
|
+
* @param expected The expected value to compare.
|
|
28
|
+
* @param tolerance The tolerance to consider the values almost equal. The
|
|
29
|
+
* default is one hundred thousandth of a percent of the expected value.
|
|
30
|
+
* @param msg The optional message to include in the error.
|
|
31
|
+
*/
|
|
32
|
+
export function assertAlmostEquals(
|
|
33
|
+
actual: number,
|
|
34
|
+
expected: number,
|
|
35
|
+
tolerance?: number,
|
|
36
|
+
msg?: string,
|
|
37
|
+
) {
|
|
38
|
+
if (Object.is(actual, expected)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const delta = Math.abs(expected - actual);
|
|
42
|
+
if (tolerance === undefined) {
|
|
43
|
+
tolerance = isFinite(expected) ? Math.abs(expected * 1e-7) : 1e-7;
|
|
44
|
+
}
|
|
45
|
+
if (delta <= tolerance) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
50
|
+
const f = (n: number) => Number.isInteger(n) ? n : n.toExponential();
|
|
51
|
+
throw new AssertionError(
|
|
52
|
+
`Expected actual: "${f(actual)}" to be close to "${f(expected)}": \
|
|
53
|
+
delta "${f(delta)}" is greater than "${f(tolerance)}"${msgSuffix}`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { equal } from "./equal.js";
|
|
4
|
+
import { format } from "../../internal/1.0.5/format.js";
|
|
5
|
+
import { AssertionError } from "./assertion_error.js";
|
|
6
|
+
|
|
7
|
+
/** An array-like object (`Array`, `Uint8Array`, `NodeList`, etc.) that is not a string */
|
|
8
|
+
export type ArrayLikeArg<T> = ArrayLike<T> & object;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Make an assertion that `actual` includes the `expected` values. If not then
|
|
12
|
+
* an error will be thrown.
|
|
13
|
+
*
|
|
14
|
+
* Type parameter can be specified to ensure values under comparison have the
|
|
15
|
+
* same type.
|
|
16
|
+
*
|
|
17
|
+
* @example Usage
|
|
18
|
+
* ```ts ignore
|
|
19
|
+
* import { assertArrayIncludes } from "@std/assert";
|
|
20
|
+
*
|
|
21
|
+
* assertArrayIncludes([1, 2], [2]); // Doesn't throw
|
|
22
|
+
* assertArrayIncludes([1, 2], [3]); // Throws
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @typeParam T The type of the elements in the array to compare.
|
|
26
|
+
* @param actual The array-like object to check for.
|
|
27
|
+
* @param expected The array-like object to check for.
|
|
28
|
+
* @param msg The optional message to display if the assertion fails.
|
|
29
|
+
*/
|
|
30
|
+
export function assertArrayIncludes<T>(
|
|
31
|
+
actual: ArrayLikeArg<T>,
|
|
32
|
+
expected: ArrayLikeArg<T>,
|
|
33
|
+
msg?: string,
|
|
34
|
+
) {
|
|
35
|
+
const missing: unknown[] = [];
|
|
36
|
+
for (let i = 0; i < expected.length; i++) {
|
|
37
|
+
let found = false;
|
|
38
|
+
for (let j = 0; j < actual.length; j++) {
|
|
39
|
+
if (equal(expected[i], actual[j])) {
|
|
40
|
+
found = true;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!found) {
|
|
45
|
+
missing.push(expected[i]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (missing.length === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
53
|
+
msg = `Expected actual: "${format(actual)}" to include: "${
|
|
54
|
+
format(expected)
|
|
55
|
+
}"${msgSuffix}\nmissing: ${format(missing)}`;
|
|
56
|
+
throw new AssertionError(msg);
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts ignore
|
|
10
|
+
* import { assert } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assert("hello".includes("ello")); // Doesn't throw
|
|
13
|
+
* assert("hello".includes("world")); // Throws
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param expr The expression to test.
|
|
17
|
+
* @param msg The optional message to display if the assertion fails.
|
|
18
|
+
*/
|
|
19
|
+
export function assert(expr: unknown, msg = ""): asserts expr {
|
|
20
|
+
if (!expr) {
|
|
21
|
+
throw new AssertionError(msg);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when an assertion fails.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts ignore
|
|
9
|
+
* import { AssertionError } from "@std/assert";
|
|
10
|
+
*
|
|
11
|
+
* try {
|
|
12
|
+
* throw new AssertionError("foo", { cause: "bar" });
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* if (error instanceof AssertionError) {
|
|
15
|
+
* error.message === "foo"; // true
|
|
16
|
+
* error.cause === "bar"; // true
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class AssertionError extends Error {
|
|
22
|
+
/** Constructs a new instance.
|
|
23
|
+
*
|
|
24
|
+
* @param message The error message.
|
|
25
|
+
* @param options Additional options. This argument is still unstable. It may change in the future release.
|
|
26
|
+
*/
|
|
27
|
+
constructor(message: string, options?: ErrorOptions) {
|
|
28
|
+
super(message, options);
|
|
29
|
+
this.name = "AssertionError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type KeyedCollection = Set<unknown> | Map<unknown, unknown>;
|
|
7
|
+
function isKeyedCollection(x: unknown): x is KeyedCollection {
|
|
8
|
+
return x instanceof Set || x instanceof Map;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function prototypesEqual(a: object, b: object) {
|
|
12
|
+
const pa = Object.getPrototypeOf(a);
|
|
13
|
+
const pb = Object.getPrototypeOf(b);
|
|
14
|
+
return pa === pb ||
|
|
15
|
+
pa === Object.prototype && pb === null ||
|
|
16
|
+
pa === null && pb === Object.prototype;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isBasicObjectOrArray(obj: object) {
|
|
20
|
+
const proto = Object.getPrototypeOf(obj);
|
|
21
|
+
return proto === null || proto === Object.prototype ||
|
|
22
|
+
proto === Array.prototype;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Slightly faster than Reflect.ownKeys in V8 as of 12.9.202.13-rusty (2024-10-28)
|
|
26
|
+
function ownKeys(obj: object) {
|
|
27
|
+
return [
|
|
28
|
+
...Object.getOwnPropertyNames(obj),
|
|
29
|
+
...Object.getOwnPropertySymbols(obj),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getKeysDeep(obj: object) {
|
|
34
|
+
const keys = new Set<string | symbol>();
|
|
35
|
+
|
|
36
|
+
while (obj !== Object.prototype && obj !== Array.prototype && obj != null) {
|
|
37
|
+
for (const key of ownKeys(obj)) {
|
|
38
|
+
keys.add(key);
|
|
39
|
+
}
|
|
40
|
+
obj = Object.getPrototypeOf(obj);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return keys;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// deno-lint-ignore no-explicit-any
|
|
47
|
+
const Temporal: any = (dntShim.dntGlobalThis as any).Temporal ??
|
|
48
|
+
new Proxy({}, { get: () => {} });
|
|
49
|
+
|
|
50
|
+
/** A non-exhaustive list of prototypes that can be accurately fast-path compared with `String(instance)` */
|
|
51
|
+
const stringComparablePrototypes = new Set<unknown>(
|
|
52
|
+
[
|
|
53
|
+
Intl.Locale,
|
|
54
|
+
RegExp,
|
|
55
|
+
Temporal.Duration,
|
|
56
|
+
Temporal.Instant,
|
|
57
|
+
Temporal.PlainDate,
|
|
58
|
+
Temporal.PlainDateTime,
|
|
59
|
+
Temporal.PlainTime,
|
|
60
|
+
Temporal.PlainYearMonth,
|
|
61
|
+
Temporal.PlainMonthDay,
|
|
62
|
+
Temporal.ZonedDateTime,
|
|
63
|
+
URL,
|
|
64
|
+
URLSearchParams,
|
|
65
|
+
].filter((x) => x != null).map((x) => x.prototype),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
function isPrimitive(x: unknown) {
|
|
69
|
+
return typeof x === "string" ||
|
|
70
|
+
typeof x === "number" ||
|
|
71
|
+
typeof x === "boolean" ||
|
|
72
|
+
typeof x === "bigint" ||
|
|
73
|
+
typeof x === "symbol" ||
|
|
74
|
+
x == null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
type TypedArray = Pick<Uint8Array | BigUint64Array, "length" | number>;
|
|
78
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
79
|
+
function compareTypedArrays(a: TypedArray, b: TypedArray) {
|
|
80
|
+
if (a.length !== b.length) return false;
|
|
81
|
+
for (let i = 0; i < b.length; i++) {
|
|
82
|
+
if (!sameValueZero(a[i], b[i])) return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Check both strict equality (`0 == -0`) and `Object.is` (`NaN == NaN`) */
|
|
88
|
+
function sameValueZero(a: unknown, b: unknown) {
|
|
89
|
+
return a === b || Object.is(a, b);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Deep equality comparison used in assertions.
|
|
94
|
+
*
|
|
95
|
+
* @param a The actual value
|
|
96
|
+
* @param b The expected value
|
|
97
|
+
* @returns `true` if the values are deeply equal, `false` otherwise
|
|
98
|
+
*
|
|
99
|
+
* @example Usage
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { equal } from "@std/assert/equal";
|
|
102
|
+
*
|
|
103
|
+
* equal({ foo: "bar" }, { foo: "bar" }); // Returns `true`
|
|
104
|
+
* equal({ foo: "bar" }, { foo: "baz" }); // Returns `false`
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export function equal(a: unknown, b: unknown): boolean {
|
|
108
|
+
const seen = new Map<unknown, unknown>();
|
|
109
|
+
return (function compare(a: unknown, b: unknown): boolean {
|
|
110
|
+
if (sameValueZero(a, b)) return true;
|
|
111
|
+
if (isPrimitive(a) || isPrimitive(b)) return false;
|
|
112
|
+
|
|
113
|
+
if (a instanceof Date && b instanceof Date) {
|
|
114
|
+
return Object.is(a.getTime(), b.getTime());
|
|
115
|
+
}
|
|
116
|
+
if (a && typeof a === "object" && b && typeof b === "object") {
|
|
117
|
+
if (!prototypesEqual(a, b)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
if (a instanceof TypedArray) {
|
|
121
|
+
return compareTypedArrays(a as TypedArray, b as TypedArray);
|
|
122
|
+
}
|
|
123
|
+
if (a instanceof WeakMap) {
|
|
124
|
+
throw new TypeError("cannot compare WeakMap instances");
|
|
125
|
+
}
|
|
126
|
+
if (a instanceof WeakSet) {
|
|
127
|
+
throw new TypeError("cannot compare WeakSet instances");
|
|
128
|
+
}
|
|
129
|
+
if (a instanceof WeakRef) {
|
|
130
|
+
return compare(a.deref(), (b as WeakRef<WeakKey>).deref());
|
|
131
|
+
}
|
|
132
|
+
if (seen.get(a) === b) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
seen.set(a, b);
|
|
139
|
+
if (isKeyedCollection(a) && isKeyedCollection(b)) {
|
|
140
|
+
if (a.size !== b.size) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const aKeys = [...a.keys()];
|
|
145
|
+
const primitiveKeysFastPath = aKeys.every(isPrimitive);
|
|
146
|
+
if (primitiveKeysFastPath) {
|
|
147
|
+
if (a instanceof Set) {
|
|
148
|
+
return a.symmetricDifference(b).size === 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (const key of aKeys) {
|
|
152
|
+
if (
|
|
153
|
+
!b.has(key) ||
|
|
154
|
+
!compare(a.get(key), (b as Map<unknown, unknown>).get(key))
|
|
155
|
+
) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let unmatchedEntries = a.size;
|
|
163
|
+
|
|
164
|
+
for (const [aKey, aValue] of a.entries()) {
|
|
165
|
+
for (const [bKey, bValue] of b.entries()) {
|
|
166
|
+
/* Given that Map keys can be references, we need
|
|
167
|
+
* to ensure that they are also deeply equal */
|
|
168
|
+
|
|
169
|
+
if (!compare(aKey, bKey)) continue;
|
|
170
|
+
|
|
171
|
+
if (
|
|
172
|
+
(aKey === aValue && bKey === bValue) ||
|
|
173
|
+
(compare(aValue, bValue))
|
|
174
|
+
) {
|
|
175
|
+
unmatchedEntries--;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return unmatchedEntries === 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
let keys: Iterable<string | symbol>;
|
|
185
|
+
|
|
186
|
+
if (isBasicObjectOrArray(a)) {
|
|
187
|
+
// fast path
|
|
188
|
+
keys = ownKeys({ ...a, ...b });
|
|
189
|
+
} else if (stringComparablePrototypes.has(Object.getPrototypeOf(a))) {
|
|
190
|
+
// medium path
|
|
191
|
+
return String(a) === String(b);
|
|
192
|
+
} else {
|
|
193
|
+
// slow path
|
|
194
|
+
keys = getKeysDeep(a).union(getKeysDeep(b));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
for (const key of keys) {
|
|
198
|
+
type Key = keyof typeof a;
|
|
199
|
+
if (!compare(a[key as Key], b[key as Key])) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
if (((key in a) && (!(key in b))) || ((key in b) && (!(key in a)))) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
})(a, b);
|
|
210
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { equal } from "./equal.js";
|
|
4
|
+
import { buildMessage } from "../../internal/1.0.5/build_message.js";
|
|
5
|
+
import { diff } from "../../internal/1.0.5/diff.js";
|
|
6
|
+
import { diffStr } from "../../internal/1.0.5/diff_str.js";
|
|
7
|
+
import { format } from "../../internal/1.0.5/format.js";
|
|
8
|
+
|
|
9
|
+
import { AssertionError } from "./assertion_error.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Make an assertion that `actual` and `expected` are equal, deeply. If not
|
|
13
|
+
* deeply equal, then throw.
|
|
14
|
+
*
|
|
15
|
+
* Type parameter can be specified to ensure values under comparison have the
|
|
16
|
+
* same type.
|
|
17
|
+
*
|
|
18
|
+
* Note: When comparing `Blob` objects, you should first convert them to
|
|
19
|
+
* `Uint8Array` using the `Blob.bytes()` method and then compare their
|
|
20
|
+
* contents.
|
|
21
|
+
*
|
|
22
|
+
* @example Usage
|
|
23
|
+
* ```ts ignore
|
|
24
|
+
* import { assertEquals } from "@std/assert";
|
|
25
|
+
*
|
|
26
|
+
* assertEquals("world", "world"); // Doesn't throw
|
|
27
|
+
* assertEquals("hello", "world"); // Throws
|
|
28
|
+
* ```
|
|
29
|
+
* @example Compare `Blob` objects
|
|
30
|
+
* ```ts ignore
|
|
31
|
+
* import { assertEquals } from "@std/assert";
|
|
32
|
+
*
|
|
33
|
+
* const bytes1 = await new Blob(["foo"]).bytes();
|
|
34
|
+
* const bytes2 = await new Blob(["foo"]).bytes();
|
|
35
|
+
*
|
|
36
|
+
* assertEquals(bytes1, bytes2);
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @typeParam T The type of the values to compare. This is usually inferred.
|
|
40
|
+
* @param actual The actual value to compare.
|
|
41
|
+
* @param expected The expected value to compare.
|
|
42
|
+
* @param msg The optional message to display if the assertion fails.
|
|
43
|
+
*/
|
|
44
|
+
export function assertEquals<T>(
|
|
45
|
+
actual: T,
|
|
46
|
+
expected: T,
|
|
47
|
+
msg?: string,
|
|
48
|
+
) {
|
|
49
|
+
if (equal(actual, expected)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
53
|
+
let message = `Values are not equal${msgSuffix}`;
|
|
54
|
+
|
|
55
|
+
const actualString = format(actual);
|
|
56
|
+
const expectedString = format(expected);
|
|
57
|
+
const stringDiff = (typeof actual === "string") &&
|
|
58
|
+
(typeof expected === "string");
|
|
59
|
+
const diffResult = stringDiff
|
|
60
|
+
? diffStr(actual as string, expected as string)
|
|
61
|
+
: diff(actualString.split("\n"), expectedString.split("\n"));
|
|
62
|
+
const diffMsg = buildMessage(diffResult, { stringDiff }).join("\n");
|
|
63
|
+
message = `${message}\n${diffMsg}`;
|
|
64
|
+
throw new AssertionError(message);
|
|
65
|
+
}
|