structured-outputs 0.1.0-beta.2 → 0.1.0-beta.21
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.d.ts +18 -11
- package/esm/ResponseFormat.d.ts.map +1 -1
- package/esm/ResponseFormat.js +57 -5
- package/esm/ResponseFormat.js.map +1 -1
- package/esm/Tool.d.ts +13 -0
- package/esm/Tool.d.ts.map +1 -0
- package/esm/Tool.js +17 -0
- package/esm/Tool.js.map +1 -0
- package/esm/_dnt.polyfills.d.ts +12 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +16 -0
- package/esm/_dnt.polyfills.js.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts +6 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts.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.d.ts +41 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts.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.d.ts +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts.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.d.ts +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts.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.d.ts +38 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts.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.d.ts +322 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts.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.d.ts +23 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts.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.d.ts +26 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts.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.d.ts +26 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts.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.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts.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.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts.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.d.ts +36 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts.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.d.ts +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts.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.d.ts +31 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts.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.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts.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.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts.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.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts.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.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert.d.ts.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.d.ts +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts.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.d.ts +75 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts.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.d.ts +37 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts.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.d.ts +33 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts.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.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts.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.d.ts +71 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts.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.d.ts +117 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts.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.d.ts +61 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts.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.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts.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.d.ts +115 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts.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.d.ts +61 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts.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.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts.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.d.ts +73 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/mod.d.ts.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.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/omit.d.ts.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.d.ts +60 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition.d.ts.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.d.ts +39 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts.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.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts.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.d.ts +25 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/pick.d.ts.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.d.ts +35 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts.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.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts.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.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sample.d.ts.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.d.ts +66 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts.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.d.ts +161 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts.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.d.ts +29 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts.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.d.ts +27 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts.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.d.ts +30 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts.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.d.ts +24 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/union.d.ts.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.d.ts +32 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts.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.d.ts +23 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts.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.d.ts +34 -0
- package/esm/deps/jsr.io/@std/collections/1.0.9/zip.d.ts.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/mod.d.ts +3 -14
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -10
- package/esm/mod.js.map +1 -1
- package/esm/oai.d.ts +5 -0
- package/esm/oai.d.ts.map +1 -0
- package/esm/oai.js +2 -0
- package/esm/oai.js.map +1 -0
- package/esm/types/Ref.d.ts +4 -0
- package/esm/types/Ref.d.ts.map +1 -0
- package/esm/types/Ref.js +11 -0
- package/esm/types/Ref.js.map +1 -0
- package/esm/types/RootTy.d.ts +8 -0
- package/esm/types/RootTy.d.ts.map +1 -0
- package/esm/types/RootTy.js +19 -0
- package/esm/types/RootTy.js.map +1 -0
- package/esm/types/Ty.d.ts +27 -0
- package/esm/types/Ty.d.ts.map +1 -0
- package/esm/types/Ty.js +17 -0
- package/esm/types/Ty.js.map +1 -0
- package/esm/types/array.d.ts +3 -0
- package/esm/types/array.d.ts.map +1 -0
- package/esm/types/array.js +9 -0
- package/esm/types/array.js.map +1 -0
- package/esm/types/constant.d.ts +3 -0
- package/esm/types/constant.d.ts.map +1 -0
- package/esm/types/constant.js +8 -0
- package/esm/types/constant.js.map +1 -0
- package/esm/types/constantUnion.d.ts +3 -0
- package/esm/types/constantUnion.d.ts.map +1 -0
- package/esm/types/constantUnion.js +25 -0
- package/esm/types/constantUnion.js.map +1 -0
- package/esm/types/leaves.d.ts +6 -0
- package/esm/types/leaves.d.ts.map +1 -0
- package/esm/types/leaves.js +18 -0
- package/esm/types/leaves.js.map +1 -0
- package/esm/types/mod.d.ts +11 -0
- package/esm/types/mod.d.ts.map +1 -0
- package/esm/types/mod.js +11 -0
- package/esm/types/mod.js.map +1 -0
- package/esm/types/object.d.ts +6 -0
- package/esm/types/object.d.ts.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.d.ts +7 -0
- package/esm/types/std/Option.d.ts.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.d.ts +7 -0
- package/esm/types/std/Wrapper.d.ts.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.d.ts +3 -0
- package/esm/types/std/mod.d.ts.map +1 -0
- package/esm/types/std/mod.js +3 -0
- package/esm/types/std/mod.js.map +1 -0
- package/esm/types/taggedUnion.d.ts +8 -0
- package/esm/types/taggedUnion.d.ts.map +1 -0
- package/esm/types/taggedUnion.js +20 -0
- package/esm/types/taggedUnion.js.map +1 -0
- package/esm/util/phantoms.d.ts +2 -0
- package/esm/util/phantoms.d.ts.map +1 -0
- package/esm/util/phantoms.js +4 -0
- package/esm/util/phantoms.js.map +1 -0
- package/esm/util/recombineTaggedTemplateArgs.d.ts +2 -0
- package/esm/util/recombineTaggedTemplateArgs.d.ts.map +1 -0
- package/esm/util/recombineTaggedTemplateArgs.js +4 -0
- package/esm/util/recombineTaggedTemplateArgs.js.map +1 -0
- package/package.json +7 -9
- package/src/ResponseFormat.ts +80 -22
- package/src/Tool.ts +38 -0
- package/src/_dnt.polyfills.ts +27 -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/mod.ts +3 -18
- package/src/oai.ts +5 -0
- 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/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/_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/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,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 @@
|
|
1
|
+
{"version":3,"file":"leaves.d.ts","sourceRoot":"","sources":["../../src/types/leaves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAG9B,CAAA;AAEH,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,CAGpC,CAAA;AAEH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAGlC,CAAA;AAEH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAGlC,CAAA"}
|
@@ -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"}
|
@@ -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.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mod.d.ts","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"}
|
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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/types/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAEjC,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CACrE;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAAE,EAC9B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACjB,CAQA"}
|
@@ -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.d.ts","sourceRoot":"","sources":["../../../src/types/std/Option.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAElC,wBAAgB,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU,CACvD,OAAO,WAAW,CAAC;IACjB,IAAI,EAAE,CAAC,CAAA;IACP,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;CACtB,CAAC,CACH,CAKA"}
|
@@ -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,7 @@
|
|
1
|
+
import type { Ty } from "../mod.js";
|
2
|
+
import { object } from "../object.js";
|
3
|
+
export type Wrapper<X extends Ty = Ty> = ReturnType<typeof Wrapper<X>>;
|
4
|
+
export declare function Wrapper<X extends Ty>(value: X): ReturnType<typeof object<{
|
5
|
+
value: X;
|
6
|
+
}>>;
|
7
|
+
//# sourceMappingURL=Wrapper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/types/std/Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtE,wBAAgB,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC,CAEvF"}
|
@@ -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.d.ts","sourceRoot":"","sources":["../../../src/types/std/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
@@ -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 @@
|
|
1
|
+
{"version":3,"file":"taggedUnion.d.ts","sourceRoot":"","sources":["../../src/types/taggedUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CACvE;KACG,CAAC,IAAI,MAAM,CAAC,GAAG;QACd,IAAI,EAAE,CAAC,CAAA;QACP,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KAClB;CACF,CAAC,MAAM,CAAC,CAAC,EACV,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CACjB,CAiBA"}
|
@@ -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.d.ts","sourceRoot":"","sources":["../../src/util/phantoms.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,KAAK,CAAC,CAE/B"}
|
@@ -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.d.ts","sourceRoot":"","sources":["../../src/util/recombineTaggedTemplateArgs.ts"],"names":[],"mappings":"AAAA,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAC7B,MAAM,CAER"}
|
@@ -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,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "structured-outputs",
|
3
|
-
"version": "0.1.0-beta.
|
4
|
-
"description": "
|
3
|
+
"version": "0.1.0-beta.21",
|
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",
|
8
9
|
"exports": {
|
9
10
|
".": {
|
10
11
|
"import": "./esm/mod.js"
|
11
12
|
}
|
12
13
|
},
|
13
|
-
"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"@types/node": "^20.9.0"
|
18
|
-
},
|
19
|
-
"_generatedBy": "dnt@dev"
|
14
|
+
"_generatedBy": "dnt@dev",
|
15
|
+
"peerDependencies": {
|
16
|
+
"openai": "^4.68.1"
|
17
|
+
}
|
20
18
|
}
|
package/src/ResponseFormat.ts
CHANGED
@@ -1,31 +1,89 @@
|
|
1
|
-
import type {
|
2
|
-
import
|
3
|
-
import {
|
1
|
+
import type { RootTy } from "./types/mod.js"
|
2
|
+
import { recombineTaggedTemplateArgs } from "./util/recombineTaggedTemplateArgs.js"
|
3
|
+
import type { ChatCompletion, ChatCompletionChoice, JsonSchema } from "./oai.js"
|
4
4
|
|
5
|
-
export
|
5
|
+
export interface ResponseFormat<T> {
|
6
|
+
(template: TemplateStringsArray, ...quasis: Array<string>): ResponseFormat<T>
|
6
7
|
type: "json_schema"
|
7
8
|
/** The desired return type in JSON Schema. */
|
8
|
-
json_schema:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
json_schema: JsonSchema
|
10
|
+
/** Parse the content of the first choice into a typed object. */
|
11
|
+
parseFirstChoice(completion: ChatCompletion): T
|
12
|
+
/** Parse all choice contents into an array of typed object. */
|
13
|
+
parseChoices(completion: ChatCompletion): Array<T>
|
14
|
+
}
|
15
|
+
|
16
|
+
export function ResponseFormat<T>(name: string, ty: RootTy<T, never>): ResponseFormat<T> {
|
17
|
+
return ResponseFormat_(name, ty)
|
14
18
|
}
|
15
19
|
|
16
|
-
|
20
|
+
function ResponseFormat_<T>(
|
17
21
|
name: string,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
ty: RootTy<T, never>,
|
23
|
+
description?: string,
|
24
|
+
): ResponseFormat<T> {
|
25
|
+
return Object.assign(
|
26
|
+
(template: TemplateStringsArray, ...quasis: Array<string>) =>
|
27
|
+
ResponseFormat_(
|
28
|
+
name,
|
29
|
+
ty,
|
30
|
+
description ? `${description} ${recombineTaggedTemplateArgs(template, quasis)}` : undefined,
|
31
|
+
),
|
32
|
+
{
|
33
|
+
type: "json_schema" as const,
|
34
|
+
json_schema: {
|
35
|
+
name,
|
36
|
+
description,
|
37
|
+
schema: ty.schema(),
|
38
|
+
strict: true,
|
39
|
+
},
|
40
|
+
parseFirstChoice: (completion: ChatCompletion): T => {
|
41
|
+
return JSON.parse(ResponseFormat.unwrapFirstChoice(completion))
|
42
|
+
},
|
43
|
+
parseChoices: (completion: ChatCompletion): Array<T> => {
|
44
|
+
return ResponseFormat.unwrapChoices(completion).map((content) => JSON.parse(content))
|
45
|
+
},
|
46
|
+
toJSON() {
|
47
|
+
const { type, json_schema } = this
|
48
|
+
return { type, json_schema }
|
49
|
+
},
|
29
50
|
},
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
export namespace ResponseFormat {
|
55
|
+
export function unwrapFirstChoice(completion: ChatCompletion): string {
|
56
|
+
const { choices: [firstChoice] } = completion
|
57
|
+
if (!firstChoice) {
|
58
|
+
throw new ResponseFormatUnwrapError("No choices contained within the completion response.")
|
59
|
+
}
|
60
|
+
return unwrapChoice(firstChoice)
|
30
61
|
}
|
62
|
+
|
63
|
+
export function unwrapChoices(completions: ChatCompletion): string[] {
|
64
|
+
return completions.choices.map(unwrapChoice)
|
65
|
+
}
|
66
|
+
|
67
|
+
function unwrapChoice(choice: ChatCompletionChoice) {
|
68
|
+
const { finish_reason, message } = choice
|
69
|
+
if (finish_reason !== "stop") {
|
70
|
+
throw new ResponseFormatUnwrapError(
|
71
|
+
`Completion responded with "${finish_reason}" as finish reason; ${message}`,
|
72
|
+
)
|
73
|
+
}
|
74
|
+
const { content, refusal } = message
|
75
|
+
if (refusal) {
|
76
|
+
throw new ResponseFormatUnwrapError(
|
77
|
+
`Openai refused to fulfill completion request; ${refusal}`,
|
78
|
+
)
|
79
|
+
}
|
80
|
+
if (!content) {
|
81
|
+
throw new ResponseFormatUnwrapError("First response choice contained no content.")
|
82
|
+
}
|
83
|
+
return content
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
export class ResponseFormatUnwrapError extends Error {
|
88
|
+
override readonly name = "UnwrapResponseError"
|
31
89
|
}
|
package/src/Tool.ts
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { RootTy, Schema } from "./types/mod.js"
|
2
|
+
import { recombineTaggedTemplateArgs } from "./util/recombineTaggedTemplateArgs.js"
|
3
|
+
|
4
|
+
export function Tool<T>(name: string, ty: RootTy<T, never>): Tool<T> {
|
5
|
+
return Tool_(name, ty)
|
6
|
+
}
|
7
|
+
|
8
|
+
function Tool_<T>(name: string, ty: RootTy<T, never>, description?: string): Tool<T> {
|
9
|
+
return Object.assign(
|
10
|
+
(template: TemplateStringsArray, ...quasis: Array<string>) =>
|
11
|
+
Tool_(
|
12
|
+
name,
|
13
|
+
ty,
|
14
|
+
description ? `${description} ${recombineTaggedTemplateArgs(template, quasis)}` : undefined,
|
15
|
+
),
|
16
|
+
{
|
17
|
+
type: "function" as const,
|
18
|
+
name,
|
19
|
+
description,
|
20
|
+
parameters: ty.schema(),
|
21
|
+
toJson() {
|
22
|
+
const { type, name, description, parameters } = this
|
23
|
+
return { type, name, description, parameters }
|
24
|
+
},
|
25
|
+
},
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface Tool<T = any> {
|
30
|
+
(template: TemplateStringsArray, ...quasis: Array<string>): Tool<T>
|
31
|
+
type: "function"
|
32
|
+
/** The name with which OpenAI recognizes the tool. */
|
33
|
+
name: string
|
34
|
+
/** A description to inform the LLM of when/how to use the tool. */
|
35
|
+
description?: string
|
36
|
+
/** The tool implementation's argument type in JSON Schema. */
|
37
|
+
parameters?: Schema
|
38
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
2
|
+
if (!Object.hasOwn) {
|
3
|
+
Object.defineProperty(Object, "hasOwn", {
|
4
|
+
value: function (object: any, property: any) {
|
5
|
+
if (object == null) {
|
6
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
7
|
+
}
|
8
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
9
|
+
},
|
10
|
+
configurable: true,
|
11
|
+
enumerable: false,
|
12
|
+
writable: true,
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
declare global {
|
17
|
+
interface Object {
|
18
|
+
/**
|
19
|
+
* Determines whether an object has a property with the specified name.
|
20
|
+
* @param o An object.
|
21
|
+
* @param v A property name.
|
22
|
+
*/
|
23
|
+
hasOwn(o: object, v: PropertyKey): boolean;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
export {};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Filters the given array, removing all elements that do not match the given predicate
|
6
|
+
* **in place. This means `array` will be modified!**.
|
7
|
+
*/
|
8
|
+
export function filterInPlace<T>(
|
9
|
+
array: Array<T>,
|
10
|
+
predicate: (el: T) => boolean,
|
11
|
+
): Array<T> {
|
12
|
+
let outputIndex = 0;
|
13
|
+
|
14
|
+
for (const cur of array) {
|
15
|
+
if (!predicate(cur)) {
|
16
|
+
continue;
|
17
|
+
}
|
18
|
+
|
19
|
+
array[outputIndex] = cur;
|
20
|
+
outputIndex += 1;
|
21
|
+
}
|
22
|
+
|
23
|
+
array.splice(outputIndex);
|
24
|
+
|
25
|
+
return array;
|
26
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
|
4
|
+
import { mapEntries } from "./map_entries.js";
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Applies the given aggregator to each group in the given grouping, returning the
|
8
|
+
* results together with the respective group keys
|
9
|
+
*
|
10
|
+
* @typeParam T Type of the values in the input record.
|
11
|
+
* @typeParam A Type of the accumulator value, which will match the returned
|
12
|
+
* record's values.
|
13
|
+
*
|
14
|
+
* @param record The grouping to aggregate.
|
15
|
+
* @param aggregator The function to apply to each group.
|
16
|
+
*
|
17
|
+
* @returns A record with the same keys as the input record, but with the values
|
18
|
+
* being the result of applying the aggregator to each group.
|
19
|
+
*
|
20
|
+
* @example Basic usage
|
21
|
+
* ```ts
|
22
|
+
* import { aggregateGroups } from "@std/collections/aggregate-groups";
|
23
|
+
* import { assertEquals } from "@std/assert";
|
24
|
+
*
|
25
|
+
* const foodProperties = {
|
26
|
+
* Curry: ["spicy", "vegan"],
|
27
|
+
* Omelette: ["creamy", "vegetarian"],
|
28
|
+
* };
|
29
|
+
*
|
30
|
+
* const descriptions = aggregateGroups(
|
31
|
+
* foodProperties,
|
32
|
+
* (current, key, first, acc) => {
|
33
|
+
* return first
|
34
|
+
* ? `${key} is ${current}`
|
35
|
+
* : `${acc} and ${current}`;
|
36
|
+
* },
|
37
|
+
* );
|
38
|
+
*
|
39
|
+
* assertEquals(descriptions, {
|
40
|
+
* Curry: "Curry is spicy and vegan",
|
41
|
+
* Omelette: "Omelette is creamy and vegetarian",
|
42
|
+
* });
|
43
|
+
* ```
|
44
|
+
*/
|
45
|
+
export function aggregateGroups<T, A>(
|
46
|
+
record: Readonly<Record<string, ReadonlyArray<T>>>,
|
47
|
+
aggregator: (current: T, key: string, first: boolean, accumulator?: A) => A,
|
48
|
+
): Record<string, A> {
|
49
|
+
return mapEntries(
|
50
|
+
record,
|
51
|
+
([key, values]) => [
|
52
|
+
key,
|
53
|
+
// Need the type assertions here because the reduce type does not support
|
54
|
+
// the type transition we need
|
55
|
+
values.reduce(
|
56
|
+
(accumulator, current, currentIndex) =>
|
57
|
+
aggregator(current, key, currentIndex === 0, accumulator),
|
58
|
+
undefined as A | undefined,
|
59
|
+
) as A,
|
60
|
+
],
|
61
|
+
);
|
62
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Creates a record by associating each element of the input array with a key
|
6
|
+
* generated by the selector function.
|
7
|
+
*
|
8
|
+
* If the selector produces the same key for multiple elements, the latest one
|
9
|
+
* will be used (overriding the ones before it).
|
10
|
+
*
|
11
|
+
* @typeParam T Type of the elements in the input array.
|
12
|
+
*
|
13
|
+
* @param array The array to transform.
|
14
|
+
* @param selector The function to extract the key from each element.
|
15
|
+
*
|
16
|
+
* @returns A record with the keys produced by the selector and the elements as
|
17
|
+
* values.
|
18
|
+
*
|
19
|
+
* @example Basic usage
|
20
|
+
* ```ts
|
21
|
+
* import { associateBy } from "@std/collections/associate-by";
|
22
|
+
* import { assertEquals } from "@std/assert";
|
23
|
+
*
|
24
|
+
* const users = [
|
25
|
+
* { id: "a2e", userName: "Anna" },
|
26
|
+
* { id: "5f8", userName: "Arnold" },
|
27
|
+
* { id: "d2c", userName: "Kim" },
|
28
|
+
* ];
|
29
|
+
*
|
30
|
+
* const usersById = associateBy(users, (user) => user.id);
|
31
|
+
*
|
32
|
+
* assertEquals(usersById, {
|
33
|
+
* "a2e": { id: "a2e", userName: "Anna" },
|
34
|
+
* "5f8": { id: "5f8", userName: "Arnold" },
|
35
|
+
* "d2c": { id: "d2c", userName: "Kim" },
|
36
|
+
* });
|
37
|
+
* ```
|
38
|
+
*/
|
39
|
+
export function associateBy<T>(
|
40
|
+
array: Iterable<T>,
|
41
|
+
selector: (el: T) => string,
|
42
|
+
): Record<string, T> {
|
43
|
+
const result: Record<string, T> = {};
|
44
|
+
|
45
|
+
for (const element of array) {
|
46
|
+
result[selector(element)] = element;
|
47
|
+
}
|
48
|
+
|
49
|
+
return result;
|
50
|
+
}
|