structured-outputs 0.1.0-beta.22 → 0.1.0-beta.23
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/esm/ResponseFormat.d.ts +8 -8
- package/esm/ResponseFormat.d.ts.map +1 -1
- package/esm/ResponseFormat.js +4 -7
- package/esm/ResponseFormat.js.map +1 -1
- package/esm/Tool.d.ts +2 -3
- package/esm/Tool.d.ts.map +1 -1
- package/esm/Tool.js +2 -3
- package/esm/Tool.js.map +1 -1
- package/esm/types/Ty.d.ts +19 -12
- package/esm/types/Ty.d.ts.map +1 -1
- package/esm/types/Ty.js +28 -7
- package/esm/types/Ty.js.map +1 -1
- package/esm/types/array.d.ts +1 -1
- package/esm/types/array.d.ts.map +1 -1
- package/esm/types/array.js +1 -1
- package/esm/types/array.js.map +1 -1
- package/esm/types/constantUnion.d.ts +1 -1
- package/esm/types/constantUnion.d.ts.map +1 -1
- package/esm/types/constantUnion.js +1 -1
- package/esm/types/constantUnion.js.map +1 -1
- package/esm/types/mod.d.ts +2 -3
- package/esm/types/mod.d.ts.map +1 -1
- package/esm/types/mod.js +2 -3
- package/esm/types/mod.js.map +1 -1
- package/esm/types/object.d.ts +3 -4
- package/esm/types/object.d.ts.map +1 -1
- package/esm/types/object.js +3 -3
- package/esm/types/object.js.map +1 -1
- package/esm/types/primitives.d.ts +4 -4
- package/esm/types/primitives.d.ts.map +1 -1
- package/esm/types/primitives.js +4 -4
- package/esm/types/primitives.js.map +1 -1
- package/esm/types/std/Date.d.ts +4 -0
- package/esm/types/std/Date.d.ts.map +1 -0
- package/esm/types/std/Date.js +14 -0
- package/esm/types/std/Date.js.map +1 -0
- package/esm/types/std/Option.d.ts +3 -2
- package/esm/types/std/Option.d.ts.map +1 -1
- package/esm/types/std/Option.js +1 -1
- package/esm/types/std/color.d.ts +8 -0
- package/esm/types/std/color.d.ts.map +1 -0
- package/esm/types/std/color.js +13 -0
- package/esm/types/std/color.js.map +1 -0
- package/esm/types/std/mod.d.ts +2 -0
- package/esm/types/std/mod.d.ts.map +1 -1
- package/esm/types/std/mod.js +2 -0
- package/esm/types/std/mod.js.map +1 -1
- package/esm/types/taggedUnion.d.ts +1 -1
- package/esm/types/taggedUnion.d.ts.map +1 -1
- package/esm/types/taggedUnion.js +20 -14
- package/esm/types/taggedUnion.js.map +1 -1
- package/esm/types/transform.d.ts +3 -0
- package/esm/types/transform.d.ts.map +1 -0
- package/esm/types/transform.js +5 -0
- package/esm/types/transform.js.map +1 -0
- package/esm/types/tuple.d.ts +5 -0
- package/esm/types/tuple.d.ts.map +1 -0
- package/esm/types/tuple.js +11 -0
- package/esm/types/tuple.js.map +1 -0
- package/esm/util/recombine.d.ts +2 -0
- package/esm/util/recombine.d.ts.map +1 -0
- package/esm/util/recombine.js +4 -0
- package/esm/util/recombine.js.map +1 -0
- package/package.json +1 -1
- package/src/ResponseFormat.ts +14 -17
- package/src/Tool.ts +5 -6
- package/src/types/Ty.ts +71 -30
- package/src/types/array.ts +9 -5
- package/src/types/constantUnion.ts +2 -2
- package/src/types/mod.ts +2 -3
- package/src/types/object.ts +15 -9
- package/src/types/primitives.ts +8 -8
- package/src/types/std/Date.ts +19 -0
- package/src/types/std/Option.ts +2 -2
- package/src/types/std/color.ts +27 -0
- package/src/types/std/mod.ts +2 -0
- package/src/types/taggedUnion.ts +28 -15
- package/src/types/transform.ts +8 -0
- package/src/types/tuple.ts +17 -0
- package/src/util/recombine.ts +3 -0
- package/esm/oai.d.ts +0 -5
- package/esm/oai.d.ts.map +0 -1
- package/esm/oai.js +0 -2
- package/esm/oai.js.map +0 -1
- package/esm/types/Ref.d.ts +0 -4
- package/esm/types/Ref.d.ts.map +0 -1
- package/esm/types/Ref.js +0 -14
- package/esm/types/Ref.js.map +0 -1
- package/esm/types/RootTy.d.ts +0 -8
- package/esm/types/RootTy.d.ts.map +0 -1
- package/esm/types/RootTy.js +0 -17
- package/esm/types/RootTy.js.map +0 -1
- package/esm/types/constant.d.ts +0 -3
- package/esm/types/constant.d.ts.map +0 -1
- package/esm/types/constant.js +0 -7
- package/esm/types/constant.js.map +0 -1
- package/esm/util/phantoms.d.ts +0 -2
- package/esm/util/phantoms.d.ts.map +0 -1
- package/esm/util/phantoms.js +0 -4
- package/esm/util/phantoms.js.map +0 -1
- package/esm/util/recombineTaggedTemplateArgs.d.ts +0 -2
- package/esm/util/recombineTaggedTemplateArgs.d.ts.map +0 -1
- package/esm/util/recombineTaggedTemplateArgs.js +0 -4
- package/esm/util/recombineTaggedTemplateArgs.js.map +0 -1
- package/src/oai.ts +0 -5
- package/src/types/Ref.ts +0 -19
- package/src/types/RootTy.ts +0 -38
- package/src/types/constant.ts +0 -7
- package/src/util/phantoms.ts +0 -3
- package/src/util/recombineTaggedTemplateArgs.ts +0 -6
package/esm/types/RootTy.js.map
DELETED
@@ -1 +0,0 @@
|
|
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,UAA0B,EAAE,EAC5B,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,OAAO,CAAC,EAAE,OAAO,CAAC,EACrF,QAAQ,EAAkB,EAC1B;QACE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE;QAClC,IAAI,EAAE,CAAgD,MAAS,EAAE,EAAE;YACjE,OAAO,MAAM,CAAyB,QAAQ,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;QACrF,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/constant.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/types/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAI1E"}
|
package/esm/types/constant.js
DELETED
@@ -1 +0,0 @@
|
|
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,GAAG,EAAE,CAAC,CAAC;QACf,KAAK,EAAE,KAAK;KACb,CAAC,CAAC,CAAA;AACL,CAAC"}
|
package/esm/util/phantoms.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"phantoms.d.ts","sourceRoot":"","sources":["../../src/util/phantoms.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,KAAK,CAAC,CAE/B"}
|
package/esm/util/phantoms.js
DELETED
package/esm/util/phantoms.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"phantoms.js","sourceRoot":"","sources":["../../src/util/phantoms.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO,EAAO,CAAA;AAChB,CAAC"}
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1 +0,0 @@
|
|
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/src/oai.ts
DELETED
package/src/types/Ref.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { recombineTaggedTemplateArgs } from "../util/recombineTaggedTemplateArgs.js"
|
2
|
-
import type { Applied, Schema, Ty } from "./Ty.js"
|
3
|
-
|
4
|
-
export type Ref = (ty: Ty) => Schema
|
5
|
-
|
6
|
-
export function Ref(applied: Applied): Ref {
|
7
|
-
return (ty) => {
|
8
|
-
applied = { ...applied, ...ty[""].applied }
|
9
|
-
const description = ty[""].context
|
10
|
-
.map(({ template, placeheld }) =>
|
11
|
-
recombineTaggedTemplateArgs(template, placeheld.map((k) => applied[k]!))
|
12
|
-
)
|
13
|
-
.join(" ")
|
14
|
-
return {
|
15
|
-
...ty[""].toSchema(Ref(applied)),
|
16
|
-
...description ? { description } : {},
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
package/src/types/RootTy.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { phantoms } from "../util/phantoms.js"
|
2
|
-
import { Ref } from "./Ref.js"
|
3
|
-
import type { Applied, Context, Schema, ToSchema, Ty } from "./Ty.js"
|
4
|
-
|
5
|
-
export function RootTy<T, P extends keyof any = never>(
|
6
|
-
toSchema: ToSchema,
|
7
|
-
context: Array<Context> = [],
|
8
|
-
applied: Applied = {},
|
9
|
-
): RootTy<T, P> {
|
10
|
-
return Object.assign(
|
11
|
-
<P2 extends Array<string>>(template: TemplateStringsArray, ...placeheld: P2) =>
|
12
|
-
RootTy<T, P | P2[number]>(toSchema, [{ template, placeheld }, ...context], applied),
|
13
|
-
phantoms<{ T: T; P: P }>(),
|
14
|
-
{
|
15
|
-
"": { toSchema, context, applied },
|
16
|
-
fill: <A extends Partial<Record<P, string | number>>>(values: A) => {
|
17
|
-
return RootTy<T, Exclude<P, keyof A>>(toSchema, context, { ...applied, ...values })
|
18
|
-
},
|
19
|
-
schema(this: RootTy<T, never>) {
|
20
|
-
return Ref({})(this)
|
21
|
-
},
|
22
|
-
isRoot(): this is RootTy {
|
23
|
-
return true
|
24
|
-
},
|
25
|
-
},
|
26
|
-
)
|
27
|
-
}
|
28
|
-
|
29
|
-
export interface RootTy<T = any, P extends keyof any = keyof any> extends Ty<T, P> {
|
30
|
-
<P2 extends Array<keyof any>>(
|
31
|
-
template: TemplateStringsArray,
|
32
|
-
...placeheld: P2
|
33
|
-
): RootTy<T, P | P2[number]>
|
34
|
-
fill: <A extends Partial<Record<P, number | string>>>(
|
35
|
-
values: A,
|
36
|
-
) => RootTy<T, Exclude<P, keyof A>>
|
37
|
-
schema(this: RootTy<T, never>): Schema
|
38
|
-
}
|
package/src/types/constant.ts
DELETED
package/src/util/phantoms.ts
DELETED