structured-outputs 0.1.0-beta.2 → 0.1.0-beta.20
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +77 -6
- package/esm/ResponseFormat.js +33 -5
- package/esm/ResponseFormat.js.map +1 -1
- package/esm/Tool.js +17 -0
- package/esm/Tool.js.map +1 -0
- package/esm/_dnt.polyfills.js +16 -0
- package/esm/_dnt.polyfills.js.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/almost_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/array_includes.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/array_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/assert.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/assertion_error.js +31 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/assertion_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/equal.js +184 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/equals.js +46 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/exists.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/exists.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/fail.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/fail.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/false.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/greater.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/greater.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/instance_of.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/is_error.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/is_error.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/less.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/less.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/less_or_equal.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/less_or_equal.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/mod.js +46 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_equals.js +33 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_instance_of.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_instance_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_match.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.js +33 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/object_match.js +160 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/object_match.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/rejects.js +54 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/rejects.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/strict_equals.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/string_includes.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/string_includes.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/throws.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/throws.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/unimplemented.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/unimplemented.js.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/unreachable.js +21 -0
- package/esm/deps/jsr.io/@std/assert/1.0.8/unreachable.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js +19 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js +51 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js +45 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js +51 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js +96 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js +28 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js +45 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js +42 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js +36 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js +59 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js +47 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js +42 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js +13 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js +15 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js +17 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js +15 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js +17 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js +75 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js +16 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js +54 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js +58 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js +40 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js +57 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js +30 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.js +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js +46 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js +28 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js +43 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js.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.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.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.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.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.js +3 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.js.map +1 -0
- package/esm/mod.js +3 -10
- package/esm/mod.js.map +1 -1
- package/esm/types/Ref.js +11 -0
- package/esm/types/Ref.js.map +1 -0
- package/esm/types/RootTy.js +19 -0
- package/esm/types/RootTy.js.map +1 -0
- package/esm/types/Ty.js +17 -0
- package/esm/types/Ty.js.map +1 -0
- package/esm/types/array.js +9 -0
- package/esm/types/array.js.map +1 -0
- package/esm/types/constant.js +8 -0
- package/esm/types/constant.js.map +1 -0
- package/esm/types/constantUnion.js +25 -0
- package/esm/types/constantUnion.js.map +1 -0
- package/esm/types/leaves.js +18 -0
- package/esm/types/leaves.js.map +1 -0
- package/esm/types/mod.js +11 -0
- package/esm/types/mod.js.map +1 -0
- package/esm/{object.js → types/object.js} +4 -4
- package/esm/types/object.js.map +1 -0
- package/esm/types/std/Option.js +9 -0
- package/esm/types/std/Option.js.map +1 -0
- package/esm/types/std/Wrapper.js +5 -0
- package/esm/types/std/Wrapper.js.map +1 -0
- package/esm/types/std/mod.js +3 -0
- package/esm/types/std/mod.js.map +1 -0
- package/esm/types/taggedUnion.js +20 -0
- package/esm/types/taggedUnion.js.map +1 -0
- package/esm/util/phantoms.js +4 -0
- package/esm/util/phantoms.js.map +1 -0
- package/esm/util/recombineTaggedTemplateArgs.js +4 -0
- package/esm/util/recombineTaggedTemplateArgs.js.map +1 -0
- package/package.json +10 -7
- package/src/ResponseFormat.ts +76 -25
- package/src/Tool.ts +38 -0
- package/src/_dnt.polyfills.ts +27 -0
- package/src/_dnt.shims.ts +60 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/almost_equals.ts +55 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/array_includes.ts +57 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/assert.ts +23 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/equal.ts +210 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/equals.ts +52 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/exists.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/fail.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/false.ts +26 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/greater.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/less.ts +29 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/less_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/mod.ts +47 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/not_equals.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/object_match.ts +202 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/strict_equals.ts +67 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/string_includes.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/throws.ts +111 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/unimplemented.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.8/unreachable.ts +21 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/_utils.ts +26 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.ts +62 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/associate_by.ts +50 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/associate_with.ts +46 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/chunk.ts +56 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/deep_merge.ts +578 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/distinct.ts +29 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/distinct_by.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/drop_last_while.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/drop_while.ts +39 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_entries.ts +48 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_keys.ts +51 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/filter_values.ts +51 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/find_single.ts +48 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.ts +47 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/includes_value.ts +45 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/intersect.ts +35 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/invert.ts +38 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/invert_by.ts +56 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/join_to_string.ts +109 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_entries.ts +53 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_keys.ts +47 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.ts +49 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/map_values.ts +96 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_by.ts +153 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_of.ts +90 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/max_with.ts +46 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_by.ts +151 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_of.ts +90 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/min_with.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/mod.ts +76 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/omit.ts +34 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/partition.ts +85 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/partition_entries.ts +58 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/permutations.ts +66 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/pick.ts +34 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/reduce_groups.ts +45 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/running_reduce.ts +38 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sample.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sliding_windows.ts +86 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sort_by.ts +219 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/sum_of.ts +42 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/take_last_while.ts +37 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/take_while.ts +44 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/union.ts +36 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/unzip.ts +50 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/without_all.ts +28 -0
- package/src/deps/jsr.io/@std/collections/1.0.9/zip.ts +49 -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/mod.ts +3 -18
- package/src/types/Ref.ts +16 -0
- package/src/types/RootTy.ts +40 -0
- package/src/types/Ty.ts +57 -0
- package/src/types/array.ts +9 -0
- package/src/types/constant.ts +8 -0
- package/src/types/constantUnion.ts +27 -0
- package/src/types/leaves.ts +21 -0
- package/src/types/mod.ts +10 -0
- package/src/types/object.ts +15 -0
- package/src/types/std/Option.ts +15 -0
- package/src/types/std/Wrapper.ts +8 -0
- package/src/types/std/mod.ts +2 -0
- package/src/types/taggedUnion.ts +28 -0
- package/src/util/phantoms.ts +3 -0
- package/src/util/recombineTaggedTemplateArgs.ts +6 -0
- package/types/ResponseFormat.d.ts +26 -0
- package/types/ResponseFormat.d.ts.map +1 -0
- package/types/Tool.d.ts +13 -0
- package/types/Tool.d.ts.map +1 -0
- package/types/_dnt.polyfills.d.ts +12 -0
- package/types/_dnt.polyfills.d.ts.map +1 -0
- package/types/_dnt.shims.d.ts +2 -0
- package/types/_dnt.shims.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/almost_equals.d.ts +29 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/almost_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/array_includes.d.ts +24 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/array_includes.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/assert.d.ts +16 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/assert.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/assertion_error.d.ts +26 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/assertion_error.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/equal.d.ts +17 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/equals.d.ts +22 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/exists.d.ts +18 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/exists.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/fail.d.ts +15 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/fail.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/false.d.ts +18 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/false.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/greater.d.ts +20 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/greater.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.d.ts +20 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/instance_of.d.ts +23 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/instance_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/is_error.d.ts +25 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/is_error.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/less.d.ts +19 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/less.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/less_or_equal.d.ts +20 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/less_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/match.d.ts +18 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/mod.d.ts +44 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_equals.d.ts +21 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_instance_of.d.ts +20 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_instance_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_match.d.ts +18 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.d.ts +23 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/object_match.d.ts +28 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/object_match.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/rejects.d.ts +42 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/rejects.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/strict_equals.d.ts +24 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/strict_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/string_includes.d.ts +18 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/string_includes.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/throws.d.ts +45 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/throws.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/unimplemented.d.ts +15 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/unimplemented.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/unreachable.d.ts +15 -0
- package/types/deps/jsr.io/@std/assert/1.0.8/unreachable.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts +6 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts +41 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts +37 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts +33 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts +38 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts +322 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts +23 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts +26 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts +26 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts +25 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts +32 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts +36 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts +35 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts +31 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts +32 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts +29 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts +25 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/invert.d.ts +29 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/invert.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts +34 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts +75 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts +37 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts +33 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts +32 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts +71 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts +117 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts +61 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts +29 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts +115 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts +61 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts +25 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/mod.d.ts +73 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/omit.d.ts +24 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/omit.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/partition.d.ts +60 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/partition.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts +39 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts +27 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/pick.d.ts +25 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/pick.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts +35 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts +27 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sample.d.ts +24 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sample.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts +66 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts +161 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts +29 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts +27 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts +30 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/union.d.ts +24 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/union.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts +32 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts +23 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/zip.d.ts +34 -0
- package/types/deps/jsr.io/@std/collections/1.0.9/zip.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
- package/types/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/types/mod.d.ts +5 -0
- package/types/mod.d.ts.map +1 -0
- package/types/types/Ref.d.ts +4 -0
- package/types/types/Ref.d.ts.map +1 -0
- package/types/types/RootTy.d.ts +8 -0
- package/types/types/RootTy.d.ts.map +1 -0
- package/types/types/Ty.d.ts +27 -0
- package/types/types/Ty.d.ts.map +1 -0
- package/types/types/array.d.ts +3 -0
- package/types/types/array.d.ts.map +1 -0
- package/types/types/constant.d.ts +3 -0
- package/types/types/constant.d.ts.map +1 -0
- package/types/types/constantUnion.d.ts +3 -0
- package/types/types/constantUnion.d.ts.map +1 -0
- package/types/types/leaves.d.ts +6 -0
- package/types/types/leaves.d.ts.map +1 -0
- package/types/types/mod.d.ts +11 -0
- package/types/types/mod.d.ts.map +1 -0
- package/types/types/object.d.ts +6 -0
- package/types/types/object.d.ts.map +1 -0
- package/types/types/std/Option.d.ts +7 -0
- package/types/types/std/Option.d.ts.map +1 -0
- package/types/types/std/Wrapper.d.ts +7 -0
- package/types/types/std/Wrapper.d.ts.map +1 -0
- package/types/types/std/mod.d.ts +3 -0
- package/types/types/std/mod.d.ts.map +1 -0
- package/types/types/taggedUnion.d.ts +8 -0
- package/types/types/taggedUnion.d.ts.map +1 -0
- package/types/util/phantoms.d.ts +2 -0
- package/types/util/phantoms.d.ts.map +1 -0
- package/types/util/recombineTaggedTemplateArgs.d.ts +2 -0
- package/types/util/recombineTaggedTemplateArgs.d.ts.map +1 -0
- package/esm/F.d.ts +0 -13
- package/esm/F.d.ts.map +0 -1
- package/esm/F.js +0 -10
- package/esm/F.js.map +0 -1
- package/esm/ResponseFormat.d.ts +0 -14
- package/esm/ResponseFormat.d.ts.map +0 -1
- package/esm/_base.d.ts +0 -13
- package/esm/_base.d.ts.map +0 -1
- package/esm/_base.js +0 -40
- package/esm/_base.js.map +0 -1
- package/esm/array.d.ts +0 -4
- package/esm/array.d.ts.map +0 -1
- package/esm/array.js +0 -9
- package/esm/array.js.map +0 -1
- package/esm/common.d.ts +0 -6
- package/esm/common.d.ts.map +0 -1
- package/esm/common.js +0 -2
- package/esm/common.js.map +0 -1
- package/esm/literal.d.ts +0 -4
- package/esm/literal.d.ts.map +0 -1
- package/esm/literal.js +0 -8
- package/esm/literal.js.map +0 -1
- package/esm/mod.d.ts +0 -16
- package/esm/mod.d.ts.map +0 -1
- package/esm/number.d.ts +0 -4
- package/esm/number.d.ts.map +0 -1
- package/esm/number.js +0 -8
- package/esm/number.js.map +0 -1
- package/esm/object.d.ts +0 -7
- package/esm/object.d.ts.map +0 -1
- package/esm/object.js.map +0 -1
- package/esm/schema.d.ts +0 -4
- package/esm/schema.d.ts.map +0 -1
- package/esm/schema.js +0 -9
- package/esm/schema.js.map +0 -1
- package/esm/string.d.ts +0 -4
- package/esm/string.d.ts.map +0 -1
- package/esm/string.js +0 -8
- package/esm/string.js.map +0 -1
- package/esm/union.d.ts +0 -6
- package/esm/union.d.ts.map +0 -1
- package/esm/union.js +0 -8
- package/esm/union.js.map +0 -1
- package/src/F.ts +0 -27
- package/src/_base.ts +0 -25
- package/src/array.ts +0 -11
- package/src/common.ts +0 -6
- package/src/literal.ts +0 -10
- package/src/number.ts +0 -10
- package/src/object.ts +0 -17
- package/src/schema.ts +0 -10
- package/src/string.ts +0 -10
- package/src/union.ts +0 -12
@@ -0,0 +1,208 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
4
|
+
// on npm.
|
5
|
+
// This code is vendored from `fmt/colors.ts`.
|
6
|
+
// deno-lint-ignore no-explicit-any
|
7
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
8
|
+
const { Deno } = dntShim.dntGlobalThis;
|
9
|
+
const noColor = typeof Deno?.noColor === "boolean"
|
10
|
+
? Deno.noColor
|
11
|
+
: false;
|
12
|
+
const enabled = !noColor;
|
13
|
+
function code(open, close) {
|
14
|
+
return {
|
15
|
+
open: `\x1b[${open.join(";")}m`,
|
16
|
+
close: `\x1b[${close}m`,
|
17
|
+
regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
|
18
|
+
};
|
19
|
+
}
|
20
|
+
function run(str, code) {
|
21
|
+
return enabled
|
22
|
+
? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
|
23
|
+
: str;
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* Sets the style of text to be printed to bold.
|
27
|
+
*
|
28
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
29
|
+
*
|
30
|
+
* @param str Text to make bold
|
31
|
+
*
|
32
|
+
* @returns Bold text for printing
|
33
|
+
*
|
34
|
+
* @example Usage
|
35
|
+
* ```ts no-assert
|
36
|
+
* import { bold } from "@std/internal/styles";
|
37
|
+
*
|
38
|
+
* console.log(bold("Hello, world!")); // Prints "Hello, world!" in bold
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export function bold(str) {
|
42
|
+
return run(str, code([1], 22));
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Sets the color of text to be printed to red.
|
46
|
+
*
|
47
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
48
|
+
*
|
49
|
+
* @param str Text to make red
|
50
|
+
*
|
51
|
+
* @returns Red text for printing
|
52
|
+
*
|
53
|
+
* @example Usage
|
54
|
+
* ```ts no-assert
|
55
|
+
* import { red } from "@std/internal/styles";
|
56
|
+
*
|
57
|
+
* console.log(red("Hello, world!")); // Prints "Hello, world!" in red
|
58
|
+
* ```
|
59
|
+
*/
|
60
|
+
export function red(str) {
|
61
|
+
return run(str, code([31], 39));
|
62
|
+
}
|
63
|
+
/**
|
64
|
+
* Sets the color of text to be printed to green.
|
65
|
+
*
|
66
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
67
|
+
*
|
68
|
+
* @param str Text to make green
|
69
|
+
*
|
70
|
+
* @returns Green text for print
|
71
|
+
*
|
72
|
+
* @example Usage
|
73
|
+
* ```ts no-assert
|
74
|
+
* import { green } from "@std/internal/styles";
|
75
|
+
*
|
76
|
+
* console.log(green("Hello, world!")); // Prints "Hello, world!" in green
|
77
|
+
* ```
|
78
|
+
*/
|
79
|
+
export function green(str) {
|
80
|
+
return run(str, code([32], 39));
|
81
|
+
}
|
82
|
+
/**
|
83
|
+
* Sets the color of text to be printed to yellow.
|
84
|
+
*
|
85
|
+
* Disable by setting the `NO_COLOR` environmental variable.
|
86
|
+
*
|
87
|
+
* @param str Text to make yellow
|
88
|
+
*
|
89
|
+
* @returns Yellow text for print
|
90
|
+
*
|
91
|
+
* @example Usage
|
92
|
+
* ```ts no-assert
|
93
|
+
* import { yellow } from "@std/internal/styles";
|
94
|
+
*
|
95
|
+
* console.log(yellow("Hello, world!")); // Prints "Hello, world!" in yellow
|
96
|
+
* ```
|
97
|
+
*/
|
98
|
+
export function yellow(str) {
|
99
|
+
return run(str, code([33], 39));
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Sets the color of text to be printed to white.
|
103
|
+
*
|
104
|
+
* @param str Text to make white
|
105
|
+
*
|
106
|
+
* @returns White text for print
|
107
|
+
*
|
108
|
+
* @example Usage
|
109
|
+
* ```ts no-assert
|
110
|
+
* import { white } from "@std/internal/styles";
|
111
|
+
*
|
112
|
+
* console.log(white("Hello, world!")); // Prints "Hello, world!" in white
|
113
|
+
* ```
|
114
|
+
*/
|
115
|
+
export function white(str) {
|
116
|
+
return run(str, code([37], 39));
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Sets the color of text to be printed to gray.
|
120
|
+
*
|
121
|
+
* @param str Text to make gray
|
122
|
+
*
|
123
|
+
* @returns Gray text for print
|
124
|
+
*
|
125
|
+
* @example Usage
|
126
|
+
* ```ts no-assert
|
127
|
+
* import { gray } from "@std/internal/styles";
|
128
|
+
*
|
129
|
+
* console.log(gray("Hello, world!")); // Prints "Hello, world!" in gray
|
130
|
+
* ```
|
131
|
+
*/
|
132
|
+
export function gray(str) {
|
133
|
+
return brightBlack(str);
|
134
|
+
}
|
135
|
+
/**
|
136
|
+
* Sets the color of text to be printed to bright-black.
|
137
|
+
*
|
138
|
+
* @param str Text to make bright-black
|
139
|
+
*
|
140
|
+
* @returns Bright-black text for print
|
141
|
+
*
|
142
|
+
* @example Usage
|
143
|
+
* ```ts no-assert
|
144
|
+
* import { brightBlack } from "@std/internal/styles";
|
145
|
+
*
|
146
|
+
* console.log(brightBlack("Hello, world!")); // Prints "Hello, world!" in bright-black
|
147
|
+
* ```
|
148
|
+
*/
|
149
|
+
export function brightBlack(str) {
|
150
|
+
return run(str, code([90], 39));
|
151
|
+
}
|
152
|
+
/**
|
153
|
+
* Sets the background color of text to be printed to red.
|
154
|
+
*
|
155
|
+
* @param str Text to make its background red
|
156
|
+
*
|
157
|
+
* @returns Red background text for print
|
158
|
+
*
|
159
|
+
* @example Usage
|
160
|
+
* ```ts no-assert
|
161
|
+
* import { bgRed } from "@std/internal/styles";
|
162
|
+
*
|
163
|
+
* console.log(bgRed("Hello, world!")); // Prints "Hello, world!" with red background
|
164
|
+
* ```
|
165
|
+
*/
|
166
|
+
export function bgRed(str) {
|
167
|
+
return run(str, code([41], 49));
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* Sets the background color of text to be printed to green.
|
171
|
+
*
|
172
|
+
* @param str Text to make its background green
|
173
|
+
*
|
174
|
+
* @returns Green background text for print
|
175
|
+
*
|
176
|
+
* @example Usage
|
177
|
+
* ```ts no-assert
|
178
|
+
* import { bgGreen } from "@std/internal/styles";
|
179
|
+
*
|
180
|
+
* console.log(bgGreen("Hello, world!")); // Prints "Hello, world!" with green background
|
181
|
+
* ```
|
182
|
+
*/
|
183
|
+
export function bgGreen(str) {
|
184
|
+
return run(str, code([42], 49));
|
185
|
+
}
|
186
|
+
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
187
|
+
const ANSI_PATTERN = new RegExp([
|
188
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
189
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
|
190
|
+
].join("|"), "g");
|
191
|
+
/**
|
192
|
+
* Remove ANSI escape codes from the string.
|
193
|
+
*
|
194
|
+
* @param string Text to remove ANSI escape codes from
|
195
|
+
*
|
196
|
+
* @returns Text without ANSI escape codes
|
197
|
+
*
|
198
|
+
* @example Usage
|
199
|
+
* ```ts no-assert
|
200
|
+
* import { red, stripAnsiCode } from "@std/internal/styles";
|
201
|
+
*
|
202
|
+
* console.log(stripAnsiCode(red("Hello, world!"))); // Prints "Hello, world!"
|
203
|
+
* ```
|
204
|
+
*/
|
205
|
+
export function stripAnsiCode(string) {
|
206
|
+
return string.replace(ANSI_PATTERN, "");
|
207
|
+
}
|
208
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/styles.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AACrC,+EAA+E;AAC/E,UAAU;AAEV,8CAA8C;AAE9C,mCAAmC;AACnC,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAExD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAoB,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,IAAI,EAAE,OAAO,KAAK,SAAS;IAChD,CAAC,CAAC,IAAI,CAAC,OAAkB;IACzB,CAAC,CAAC,KAAK,CAAC;AAQV,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC;AAEzB,SAAS,IAAI,CAAC,IAAc,EAAE,KAAa;IACzC,OAAO;QACL,IAAI,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;QAC/B,KAAK,EAAE,QAAQ,KAAK,GAAG;QACvB,MAAM,EAAE,IAAI,MAAM,CAAC,WAAW,KAAK,GAAG,EAAE,GAAG,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,SAAS,GAAG,CAAC,GAAW,EAAE,IAAU;IAClC,OAAO,OAAO;QACZ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE;QACnE,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,GAAG,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,6FAA6F;AAC7F,MAAM,YAAY,GAAG,IAAI,MAAM,CAC7B;IACE,8HAA8H;IAC9H,2DAA2D;CAC5D,CAAC,IAAI,CAAC,GAAG,CAAC,EACX,GAAG,CACJ,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/types.ts"],"names":[],"mappings":"AAAA,0EAA0E"}
|
package/esm/mod.js
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
|
2
|
-
export * from "./
|
3
|
-
export * from "./common.js";
|
4
|
-
export * from "./F.js";
|
5
|
-
export * from "./literal.js";
|
6
|
-
export * from "./number.js";
|
7
|
-
export * from "./object.js";
|
1
|
+
import "./_dnt.polyfills.js";
|
2
|
+
export * as T from "./types/mod.js";
|
8
3
|
export * from "./ResponseFormat.js";
|
9
|
-
export * from "./
|
10
|
-
export * from "./string.js";
|
11
|
-
export * from "./union.js";
|
4
|
+
export * from "./Tool.js";
|
12
5
|
//# sourceMappingURL=mod.js.map
|
package/esm/mod.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA"}
|
package/esm/types/Ref.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { recombineTaggedTemplateArgs } from "../util/recombineTaggedTemplateArgs.js";
|
2
|
+
export function Ref(applied) {
|
3
|
+
return (ty) => {
|
4
|
+
applied = { ...applied, ...ty.applied };
|
5
|
+
const description = ty.descriptions
|
6
|
+
.map(({ template, placeheld }) => recombineTaggedTemplateArgs(template, placeheld.map((k) => applied[k])))
|
7
|
+
.join(" ");
|
8
|
+
return ty.toSchema(description, Ref(applied));
|
9
|
+
};
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=Ref.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Ref.js","sourceRoot":"","sources":["../../src/types/Ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAA;AAIpF,MAAM,UAAU,GAAG,CAAC,OAAgB;IAClC,OAAO,CAAC,EAAE,EAAE,EAAE;QACZ,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAA;QACvC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY;aAChC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,CAC/B,2BAA2B,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC,CACzE;aACA,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,OAAO,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/C,CAAC,CAAA;AACH,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { phantoms } from "../util/phantoms.js";
|
2
|
+
import { Ref } from "./Ref.js";
|
3
|
+
export function RootTy(toSchema, descriptions = [], applied = {}) {
|
4
|
+
return Object.assign((template, ...placeheld) => RootTy(toSchema, [{ template, placeheld }, ...descriptions], applied), phantoms(), {
|
5
|
+
toSchema,
|
6
|
+
descriptions,
|
7
|
+
applied,
|
8
|
+
apply: (values) => {
|
9
|
+
return RootTy(toSchema, descriptions, { ...applied, ...values });
|
10
|
+
},
|
11
|
+
schema() {
|
12
|
+
return Ref({})(this);
|
13
|
+
},
|
14
|
+
isRoot() {
|
15
|
+
return true;
|
16
|
+
},
|
17
|
+
});
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=RootTy.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RootTy.js","sourceRoot":"","sources":["../../src/types/RootTy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAG9B,MAAM,UAAU,MAAM,CACpB,QAAkB,EAClB,eAAmC,EAAE,EACrC,UAAmB,EAAE;IAErB,OAAO,MAAM,CAAC,MAAM,CAClB,CAA2B,QAA8B,EAAE,GAAG,SAAa,EAAE,EAAE,CAC7E,MAAM,CAAoB,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,YAAY,CAAC,EAAE,OAAO,CAAC,EAC1F,QAAQ,EAA4B,EACpC;QACE,QAAQ;QACR,YAAY;QACZ,OAAO;QACP,KAAK,EAAE,CAAgD,MAAS,EAAE,EAAE;YAClE,OAAO,MAAM,CAAyB,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;QAC1F,CAAC;QACD,MAAM;YACJ,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACtB,CAAC;QACD,MAAM;YACJ,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CACF,CAAA;AACH,CAAC"}
|
package/esm/types/Ty.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import { phantoms } from "../util/phantoms.js";
|
2
|
+
export function Ty(toSchema, descriptions = [], applied = {}) {
|
3
|
+
return Object.assign((template, ...placeheld) => Ty(toSchema, [{ template, placeheld }, ...descriptions], applied), phantoms(), {
|
4
|
+
toSchema,
|
5
|
+
descriptions,
|
6
|
+
applied,
|
7
|
+
apply: (values) => {
|
8
|
+
return Ty(toSchema, descriptions, { ...applied, ...values });
|
9
|
+
},
|
10
|
+
isRoot() {
|
11
|
+
return false;
|
12
|
+
},
|
13
|
+
});
|
14
|
+
}
|
15
|
+
(function (Ty) {
|
16
|
+
})(Ty || (Ty = {}));
|
17
|
+
//# sourceMappingURL=Ty.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Ty.js","sourceRoot":"","sources":["../../src/types/Ty.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAG9C,MAAM,UAAU,EAAE,CAChB,QAAkB,EAClB,eAAmC,EAAE,EACrC,UAAmB,EAAE;IAErB,OAAO,MAAM,CAAC,MAAM,CAClB,CAA2B,QAA8B,EAAE,GAAG,SAAa,EAAE,EAAE,CAC7E,EAAE,CAAoB,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,YAAY,CAAC,EAAE,OAAO,CAAC,EACtF,QAAQ,EAA4B,EACpC;QACE,QAAQ;QACR,YAAY;QACZ,OAAO;QACP,KAAK,EAAE,CAAgD,MAAS,EAAE,EAAE;YAClE,OAAO,EAAE,CAAyB,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;QACtF,CAAC;QACD,MAAM;YACJ,OAAO,KAAK,CAAA;QACd,CAAC;KACF,CACF,CAAA;AACH,CAAC;AAgBD,WAAiB,EAAE;AAKnB,CAAC,EALgB,EAAE,KAAF,EAAE,QAKlB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/types/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,UAAU,KAAK,CAAe,OAAU;IAC5C,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,EAAE,OAAO;QACb,WAAW;QACX,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;KACpB,CAAC,CAAC,CAAA;AACL,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/types/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,UAAU,QAAQ,CAA4B,KAAQ;IAC1D,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1B,KAAK,EAAE,KAAK;QACZ,WAAW;KACZ,CAAC,CAAC,CAAA;AACL,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { partition } from "../deps/jsr.io/@std/collections/1.0.9/mod.js";
|
2
|
+
import { Ty } from "./Ty.js";
|
3
|
+
export function constantUnion(...members) {
|
4
|
+
const [strings, numbers] = partition(members, (v) => typeof v === "string");
|
5
|
+
return Ty((description) => {
|
6
|
+
return {
|
7
|
+
anyOf: [
|
8
|
+
...strings.length
|
9
|
+
? [{
|
10
|
+
type: "string",
|
11
|
+
enum: strings,
|
12
|
+
}]
|
13
|
+
: [],
|
14
|
+
...numbers.length
|
15
|
+
? [{
|
16
|
+
type: "number",
|
17
|
+
enum: numbers,
|
18
|
+
}]
|
19
|
+
: [],
|
20
|
+
],
|
21
|
+
description,
|
22
|
+
};
|
23
|
+
});
|
24
|
+
}
|
25
|
+
//# sourceMappingURL=constantUnion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constantUnion.js","sourceRoot":"","sources":["../../src/types/constantUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,UAAU,aAAa,CAC3B,GAAG,OAAU;IAEb,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAA;IAC3E,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE;QACxB,OAAO;YACL,KAAK,EAAE;gBACL,GAAG,OAAO,CAAC,MAAM;oBACf,CAAC,CAAC,CAAC;4BACD,IAAI,EAAE,QAAQ;4BACd,IAAI,EAAE,OAAO;yBACd,CAAC;oBACF,CAAC,CAAC,EAAE;gBACN,GAAG,OAAO,CAAC,MAAM;oBACf,CAAC,CAAC,CAAC;4BACD,IAAI,EAAE,QAAQ;4BACd,IAAI,EAAE,OAAO;yBACd,CAAC;oBACF,CAAC,CAAC,EAAE;aACP;YACD,WAAW;SACZ,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Ty } from "./Ty.js";
|
2
|
+
export const none = Ty((description) => ({
|
3
|
+
type: "null",
|
4
|
+
description,
|
5
|
+
}));
|
6
|
+
export const boolean = Ty((description) => ({
|
7
|
+
type: "boolean",
|
8
|
+
description,
|
9
|
+
}));
|
10
|
+
export const number = Ty((description) => ({
|
11
|
+
type: "number",
|
12
|
+
description,
|
13
|
+
}));
|
14
|
+
export const string = Ty((description) => ({
|
15
|
+
type: "string",
|
16
|
+
description,
|
17
|
+
}));
|
18
|
+
//# sourceMappingURL=leaves.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"leaves.js","sourceRoot":"","sources":["../../src/types/leaves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,CAAC,MAAM,IAAI,GAAoB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,EAAE,MAAM;IACZ,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAuB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC9D,IAAI,EAAE,SAAS;IACf,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,MAAM,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,MAAM,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA"}
|
package/esm/types/mod.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
export * from "./array.js";
|
2
|
+
export * from "./leaves.js";
|
3
|
+
export * from "./constant.js";
|
4
|
+
export * from "./constantUnion.js";
|
5
|
+
export * from "./std/mod.js";
|
6
|
+
export * from "./object.js";
|
7
|
+
export * from "./Ref.js";
|
8
|
+
export * from "./taggedUnion.js";
|
9
|
+
export * from "./Ty.js";
|
10
|
+
export * from "./RootTy.js";
|
11
|
+
//# sourceMappingURL=mod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/types/mod.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
export function object(
|
3
|
-
return
|
1
|
+
import { RootTy } from "./RootTy.js";
|
2
|
+
export function object(fields) {
|
3
|
+
return RootTy((description, ref) => ({
|
4
4
|
type: "object",
|
5
5
|
description,
|
6
|
-
properties: Object.fromEntries(Object.entries(fields).map(([k, v]) => [k,
|
6
|
+
properties: Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, ref(v)])),
|
7
7
|
additionalProperties: false,
|
8
8
|
required: Object.keys(fields),
|
9
9
|
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/types/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,UAAU,MAAM,CAA+B,MAAS;IAI5D,OAAO,MAAM,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,EAAE,QAAQ;QACd,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KAC9B,CAAC,CAAC,CAAA;AACL,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Option.js","sourceRoot":"","sources":["../../../src/types/std/Option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,MAAM,UAAU,MAAM,CAAe,IAAO;IAM1C,OAAO,WAAW,CAAC;QACjB,IAAI;QACJ,IAAI,EAAE,IAAI;KACX,CAAC,CAAA,uCAAuC,CAAA;AAC3C,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Wrapper.js","sourceRoot":"","sources":["../../../src/types/std/Wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAIrC,MAAM,UAAU,OAAO,CAAe,KAAQ;IAC5C,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAC1B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../src/types/std/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Ty } from "./Ty.js";
|
2
|
+
export function taggedUnion(members) {
|
3
|
+
return Ty((description, ref) => ({
|
4
|
+
description,
|
5
|
+
discriminator: "type",
|
6
|
+
anyOf: Object.entries(members).map(([k, v]) => ({
|
7
|
+
type: "object",
|
8
|
+
properties: {
|
9
|
+
type: {
|
10
|
+
type: "string",
|
11
|
+
const: k,
|
12
|
+
},
|
13
|
+
value: ref(v),
|
14
|
+
},
|
15
|
+
required: ["type", "value"],
|
16
|
+
additionalProperties: false,
|
17
|
+
})),
|
18
|
+
}));
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=taggedUnion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"taggedUnion.js","sourceRoot":"","sources":["../../src/types/taggedUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,UAAU,WAAW,CAA+B,OAAU;IASlE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,WAAW;QACX,aAAa,EAAE,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9C,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,CAAC;iBACT;gBACD,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;aACd;YACD,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YAC3B,oBAAoB,EAAE,KAAK;SAC5B,CAAC,CAAC;KACJ,CAAC,CAAC,CAAA;AACL,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"phantoms.js","sourceRoot":"","sources":["../../src/util/phantoms.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO,EAAO,CAAA;AAChB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recombineTaggedTemplateArgs.js","sourceRoot":"","sources":["../../src/util/recombineTaggedTemplateArgs.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,2BAA2B,CACzC,OAA6B,EAC7B,MAA8B;IAE9B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC"}
|
package/package.json
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"name": "structured-outputs",
|
3
|
-
"version": "0.1.0-beta.
|
4
|
-
"description": "
|
3
|
+
"version": "0.1.0-beta.20",
|
4
|
+
"description": "Compose OpenAI structured output schemas.",
|
5
5
|
"repository": "github:harrysolovay/structured-outputs.git",
|
6
6
|
"license": "Apache-2.0",
|
7
|
+
"main": "./esm/mod.js",
|
7
8
|
"module": "./esm/mod.js",
|
9
|
+
"types": "./types/mod.d.ts",
|
8
10
|
"exports": {
|
9
11
|
".": {
|
10
|
-
"import":
|
12
|
+
"import": {
|
13
|
+
"types": "./types/mod.d.ts",
|
14
|
+
"default": "./esm/mod.js"
|
15
|
+
}
|
11
16
|
}
|
12
17
|
},
|
13
18
|
"dependencies": {
|
14
|
-
"tslib": "^2.6.2"
|
15
|
-
|
16
|
-
"devDependencies": {
|
17
|
-
"@types/node": "^20.9.0"
|
19
|
+
"tslib": "^2.6.2",
|
20
|
+
"openai": "^4.68.1"
|
18
21
|
},
|
19
22
|
"_generatedBy": "dnt@dev"
|
20
23
|
}
|
package/src/ResponseFormat.ts
CHANGED
@@ -1,31 +1,82 @@
|
|
1
|
-
import
|
2
|
-
import type
|
3
|
-
import {
|
1
|
+
import { assert } from "./deps/jsr.io/@std/assert/1.0.8/mod.js"
|
2
|
+
import type Openai from "openai"
|
3
|
+
import type { ResponseFormatJSONSchema } from "openai/resources/index.js"
|
4
|
+
import type { RootTy } from "./types/mod.js"
|
5
|
+
import { recombineTaggedTemplateArgs } from "./util/recombineTaggedTemplateArgs.js"
|
4
6
|
|
5
|
-
export
|
6
|
-
|
7
|
-
/** The desired return type in JSON Schema. */
|
8
|
-
json_schema: {
|
9
|
-
name: string
|
10
|
-
description: string
|
11
|
-
schema: Record<string, unknown>
|
12
|
-
strict: true
|
13
|
-
}
|
7
|
+
export function ResponseFormat<T>(name: string, ty: RootTy<T, never>): ResponseFormat<T> {
|
8
|
+
return ResponseFormat_(name, ty)
|
14
9
|
}
|
15
10
|
|
16
|
-
|
11
|
+
function ResponseFormat_<T>(
|
17
12
|
name: string,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
ty: RootTy<T, never>,
|
14
|
+
description?: string,
|
15
|
+
): ResponseFormat<T> {
|
16
|
+
return Object.assign(
|
17
|
+
(template: TemplateStringsArray, ...quasis: Array<string>) =>
|
18
|
+
ResponseFormat_(
|
19
|
+
name,
|
20
|
+
ty,
|
21
|
+
description ? `${description} ${recombineTaggedTemplateArgs(template, quasis)}` : undefined,
|
22
|
+
),
|
23
|
+
{
|
24
|
+
type: "json_schema" as const,
|
25
|
+
json_schema: {
|
26
|
+
name,
|
27
|
+
description,
|
28
|
+
schema: ty.schema(),
|
29
|
+
strict: true,
|
30
|
+
},
|
31
|
+
parse(completion: ChatCompletion): TypedChatCompletion<T> {
|
32
|
+
return {
|
33
|
+
...completion,
|
34
|
+
choices: completion.choices.map((choice) => ({
|
35
|
+
...choice,
|
36
|
+
message: {
|
37
|
+
...choice.message,
|
38
|
+
content: choice.message.content ? JSON.parse(choice.message.content) : null,
|
39
|
+
},
|
40
|
+
})),
|
41
|
+
}
|
42
|
+
},
|
43
|
+
parseFirstOrThrow(completion: ChatCompletion): T {
|
44
|
+
const { choices: [firstChoice], usage } = completion
|
45
|
+
assert(firstChoice)
|
46
|
+
const { finish_reason, message } = firstChoice
|
47
|
+
const { content, refusal } = message
|
48
|
+
assert(content, JSON.stringify({ finish_reason, refusal, usage }))
|
49
|
+
return JSON.parse(content)
|
50
|
+
},
|
51
|
+
toJSON() {
|
52
|
+
const { type, json_schema } = this
|
53
|
+
return { type, json_schema }
|
54
|
+
},
|
29
55
|
},
|
30
|
-
|
56
|
+
)
|
31
57
|
}
|
58
|
+
|
59
|
+
export interface ResponseFormat<T> {
|
60
|
+
(template: TemplateStringsArray, ...quasis: Array<string>): ResponseFormat<T>
|
61
|
+
type: "json_schema"
|
62
|
+
/** The desired return type in JSON Schema. */
|
63
|
+
json_schema: ResponseFormatJSONSchema.JSONSchema
|
64
|
+
/** Parse inner responses into a typed object. */
|
65
|
+
parse(completion: ChatCompletion): TypedChatCompletion<T>
|
66
|
+
/** Parse and return the first inner response into a typed object. */
|
67
|
+
parseFirstOrThrow(completion: ChatCompletion): T
|
68
|
+
}
|
69
|
+
|
70
|
+
export type TypedChatCompletion<T> = Omit<ChatCompletion, "choices"> & {
|
71
|
+
choices: Array<
|
72
|
+
Omit<ChatCompletionChoice, "message"> & {
|
73
|
+
message: Omit<ChatCompletionMessage, "content"> & {
|
74
|
+
content: T
|
75
|
+
}
|
76
|
+
}
|
77
|
+
>
|
78
|
+
}
|
79
|
+
|
80
|
+
type ChatCompletion = Openai.Chat.ChatCompletion
|
81
|
+
type ChatCompletionChoice = Openai.Chat.ChatCompletion.Choice
|
82
|
+
type ChatCompletionMessage = Openai.Chat.Completions.ChatCompletionMessage
|