structured-outputs 0.1.0-beta.16 → 0.1.0-beta.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/README.md +2 -2
  2. package/esm/mod.js +1 -2
  3. package/esm/mod.js.map +1 -1
  4. package/esm/types/Ref.js.map +1 -0
  5. package/esm/types/RootTy.js.map +1 -0
  6. package/esm/types/Ty.js.map +1 -0
  7. package/esm/{core/vec.js → types/array.js} +2 -2
  8. package/esm/types/array.js.map +1 -0
  9. package/esm/types/constant.js.map +1 -0
  10. package/esm/types/constantUnion.js.map +1 -0
  11. package/esm/{core → types}/leaves.js +3 -3
  12. package/esm/types/leaves.js.map +1 -0
  13. package/esm/{core → types}/mod.js +3 -2
  14. package/esm/types/mod.js.map +1 -0
  15. package/esm/{core/struct.js → types/object.js} +2 -2
  16. package/esm/types/object.js.map +1 -0
  17. package/esm/types/std/Option.js +9 -0
  18. package/esm/types/std/Option.js.map +1 -0
  19. package/esm/types/std/Wrapper.js +5 -0
  20. package/esm/types/std/Wrapper.js.map +1 -0
  21. package/esm/types/std/mod.js.map +1 -0
  22. package/esm/types/taggedUnion.js.map +1 -0
  23. package/package.json +1 -1
  24. package/src/ResponseFormat.ts +1 -1
  25. package/src/Tool.ts +1 -1
  26. package/src/mod.ts +1 -2
  27. package/src/{core/vec.ts → types/array.ts} +1 -3
  28. package/src/{core → types}/constant.ts +0 -2
  29. package/src/{core → types}/constantUnion.ts +0 -2
  30. package/src/types/leaves.ts +21 -0
  31. package/src/{core → types}/mod.ts +3 -2
  32. package/src/{core/struct.ts → types/object.ts} +1 -5
  33. package/src/types/std/Option.ts +15 -0
  34. package/src/types/std/Wrapper.ts +8 -0
  35. package/src/{core → types}/taggedUnion.ts +1 -7
  36. package/types/ResponseFormat.d.ts +1 -1
  37. package/types/ResponseFormat.d.ts.map +1 -1
  38. package/types/Tool.d.ts +1 -1
  39. package/types/Tool.d.ts.map +1 -1
  40. package/types/mod.d.ts +1 -2
  41. package/types/mod.d.ts.map +1 -1
  42. package/types/types/Ref.d.ts.map +1 -0
  43. package/types/types/RootTy.d.ts.map +1 -0
  44. package/types/types/Ty.d.ts.map +1 -0
  45. package/types/types/array.d.ts +3 -0
  46. package/types/types/array.d.ts.map +1 -0
  47. package/types/types/constant.d.ts +3 -0
  48. package/types/types/constant.d.ts.map +1 -0
  49. package/types/types/constantUnion.d.ts +3 -0
  50. package/types/types/constantUnion.d.ts.map +1 -0
  51. package/types/types/leaves.d.ts +6 -0
  52. package/types/types/leaves.d.ts.map +1 -0
  53. package/types/{core → types}/mod.d.ts +3 -2
  54. package/types/types/mod.d.ts.map +1 -0
  55. package/types/types/object.d.ts +6 -0
  56. package/types/types/object.d.ts.map +1 -0
  57. package/types/types/std/Option.d.ts +7 -0
  58. package/types/types/std/Option.d.ts.map +1 -0
  59. package/types/types/std/Wrapper.d.ts +7 -0
  60. package/types/types/std/Wrapper.d.ts.map +1 -0
  61. package/types/types/std/mod.d.ts.map +1 -0
  62. package/types/types/taggedUnion.d.ts +8 -0
  63. package/types/types/taggedUnion.d.ts.map +1 -0
  64. package/esm/core/Ref.js.map +0 -1
  65. package/esm/core/RootTy.js.map +0 -1
  66. package/esm/core/Ty.js.map +0 -1
  67. package/esm/core/constant.js.map +0 -1
  68. package/esm/core/constantUnion.js.map +0 -1
  69. package/esm/core/leaves.js.map +0 -1
  70. package/esm/core/mod.js.map +0 -1
  71. package/esm/core/struct.js.map +0 -1
  72. package/esm/core/taggedUnion.js.map +0 -1
  73. package/esm/core/vec.js.map +0 -1
  74. package/esm/std/Option.js +0 -11
  75. package/esm/std/Option.js.map +0 -1
  76. package/esm/std/Wrapper.js +0 -5
  77. package/esm/std/Wrapper.js.map +0 -1
  78. package/esm/std/mod.js.map +0 -1
  79. package/src/core/leaves.ts +0 -25
  80. package/src/std/Option.ts +0 -20
  81. package/src/std/Wrapper.ts +0 -7
  82. package/types/core/Ref.d.ts.map +0 -1
  83. package/types/core/RootTy.d.ts.map +0 -1
  84. package/types/core/Ty.d.ts.map +0 -1
  85. package/types/core/constant.d.ts +0 -4
  86. package/types/core/constant.d.ts.map +0 -1
  87. package/types/core/constantUnion.d.ts +0 -4
  88. package/types/core/constantUnion.d.ts.map +0 -1
  89. package/types/core/leaves.d.ts +0 -10
  90. package/types/core/leaves.d.ts.map +0 -1
  91. package/types/core/mod.d.ts.map +0 -1
  92. package/types/core/struct.d.ts +0 -8
  93. package/types/core/struct.d.ts.map +0 -1
  94. package/types/core/taggedUnion.d.ts +0 -10
  95. package/types/core/taggedUnion.d.ts.map +0 -1
  96. package/types/core/vec.d.ts +0 -4
  97. package/types/core/vec.d.ts.map +0 -1
  98. package/types/std/Option.d.ts +0 -9
  99. package/types/std/Option.d.ts.map +0 -1
  100. package/types/std/Wrapper.d.ts +0 -6
  101. package/types/std/Wrapper.d.ts.map +0 -1
  102. package/types/std/mod.d.ts.map +0 -1
  103. /package/esm/{core → types}/Ref.js +0 -0
  104. /package/esm/{core → types}/RootTy.js +0 -0
  105. /package/esm/{core → types}/Ty.js +0 -0
  106. /package/esm/{core → types}/constant.js +0 -0
  107. /package/esm/{core → types}/constantUnion.js +0 -0
  108. /package/esm/{std → types/std}/mod.js +0 -0
  109. /package/esm/{core → types}/taggedUnion.js +0 -0
  110. /package/src/{core → types}/Ref.ts +0 -0
  111. /package/src/{core → types}/RootTy.ts +0 -0
  112. /package/src/{core → types}/Ty.ts +0 -0
  113. /package/src/{std → types/std}/mod.ts +0 -0
  114. /package/types/{core → types}/Ref.d.ts +0 -0
  115. /package/types/{core → types}/RootTy.d.ts +0 -0
  116. /package/types/{core → types}/Ty.d.ts +0 -0
  117. /package/types/{std → types/std}/mod.d.ts +0 -0
package/README.md CHANGED
@@ -25,7 +25,7 @@ deno add jsr:@crosshatch/structured-outputs
25
25
  import { ResponseFormat, T } from "structured-outputs"
26
26
 
27
27
  // 1. Define the shape of the desired response.
28
- const Character = T.struct({
28
+ const Character = T.object({
29
29
  name: T.string,
30
30
  age: T.number`Ensure between 1 and 110.`,
31
31
  })
@@ -68,7 +68,7 @@ We can also attach a description to the response format.
68
68
  ### Dependency Injection
69
69
 
70
70
  ```ts
71
- const Character = T.struct({
71
+ const Character = T.object({
72
72
  name: T.string`Preferably names common to those who are {"national identity"}.`,
73
73
  age: T.number`Ensure between 1 and 110.`,
74
74
  })
package/esm/mod.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import "./_dnt.polyfills.js";
2
- export * as T from "./core/mod.js";
3
- export * as std from "./std/mod.js";
2
+ export * as T from "./types/mod.js";
4
3
  export * from "./ResponseFormat.js";
5
4
  export * from "./Tool.js";
6
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":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,eAAe,CAAA;AAClC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA"}
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"}
@@ -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 @@
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"}
@@ -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"}
@@ -1,9 +1,9 @@
1
1
  import { Ty } from "./Ty.js";
2
- export function vec(element) {
2
+ export function array(element) {
3
3
  return Ty((description, ref) => ({
4
4
  type: "array",
5
5
  description,
6
6
  items: ref(element),
7
7
  }));
8
8
  }
9
- //# sourceMappingURL=vec.js.map
9
+ //# sourceMappingURL=array.js.map
@@ -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 @@
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"}
@@ -3,15 +3,15 @@ export const none = Ty((description) => ({
3
3
  type: "null",
4
4
  description,
5
5
  }));
6
- export const bool = Ty((description) => ({
6
+ export const boolean = Ty((description) => ({
7
7
  type: "boolean",
8
8
  description,
9
9
  }));
10
- export const num = Ty((description) => ({
10
+ export const number = Ty((description) => ({
11
11
  type: "number",
12
12
  description,
13
13
  }));
14
- export const str = Ty((description) => ({
14
+ export const string = Ty((description) => ({
15
15
  type: "string",
16
16
  description,
17
17
  }));
@@ -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"}
@@ -1,8 +1,9 @@
1
- export * from "./vec.js";
1
+ export * from "./array.js";
2
2
  export * from "./leaves.js";
3
3
  export * from "./constant.js";
4
4
  export * from "./constantUnion.js";
5
- export * from "./struct.js";
5
+ export * from "./std/mod.js";
6
+ export * from "./object.js";
6
7
  export * from "./Ref.js";
7
8
  export * from "./taggedUnion.js";
8
9
  export * from "./Ty.js";
@@ -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,5 +1,5 @@
1
1
  import { RootTy } from "./RootTy.js";
2
- export function struct(fields) {
2
+ export function object(fields) {
3
3
  return RootTy((description, ref) => ({
4
4
  type: "object",
5
5
  description,
@@ -8,4 +8,4 @@ export function struct(fields) {
8
8
  required: Object.keys(fields),
9
9
  }));
10
10
  }
11
- //# sourceMappingURL=struct.js.map
11
+ //# sourceMappingURL=object.js.map
@@ -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,9 @@
1
+ import { none } from "../leaves.js";
2
+ import { taggedUnion } from "../taggedUnion.js";
3
+ export function option(Some) {
4
+ return taggedUnion({
5
+ Some,
6
+ None: none,
7
+ }) `An option of specified \`some\` type.`;
8
+ }
9
+ //# sourceMappingURL=Option.js.map
@@ -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,5 @@
1
+ import { object } from "../object.js";
2
+ export function Wrapper(value) {
3
+ return object({ value });
4
+ }
5
+ //# sourceMappingURL=Wrapper.js.map
@@ -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 @@
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-outputs",
3
- "version": "0.1.0-beta.16",
3
+ "version": "0.1.0-beta.19",
4
4
  "description": "Compose OpenAI structured output schemas.",
5
5
  "repository": "github:harrysolovay/structured-outputs.git",
6
6
  "license": "Apache-2.0",
@@ -1,7 +1,7 @@
1
1
  import { assert } from "./deps/jsr.io/@std/assert/1.0.8/mod.js"
2
2
  import type Openai from "openai"
3
3
  import type { ResponseFormatJSONSchema } from "openai/resources/index.js"
4
- import type { RootTy } from "./core/mod.js"
4
+ import type { RootTy } from "./types/mod.js"
5
5
  import { recombineTaggedTemplateArgs } from "./util/recombineTaggedTemplateArgs.js"
6
6
 
7
7
  export function ResponseFormat<T>(name: string, ty: RootTy<T, never>): ResponseFormat<T> {
package/src/Tool.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RootTy, Schema } from "./core/mod.js"
1
+ import type { RootTy, Schema } from "./types/mod.js"
2
2
  import { recombineTaggedTemplateArgs } from "./util/recombineTaggedTemplateArgs.js"
3
3
 
4
4
  export function Tool<T>(name: string, ty: RootTy<T, never>): Tool<T> {
package/src/mod.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import "./_dnt.polyfills.js";
2
- export * as T from "./core/mod.js"
3
- export * as std from "./std/mod.js"
2
+ export * as T from "./types/mod.js"
4
3
  export * from "./ResponseFormat.js"
5
4
  export * from "./Tool.js"
@@ -1,8 +1,6 @@
1
1
  import { Ty } from "./Ty.js"
2
2
 
3
- export type vec<E extends Ty> = ReturnType<typeof vec<E>>
4
-
5
- export function vec<E extends Ty>(element: E): Ty<Array<E[Ty.T]>, E[Ty.P]> {
3
+ export function array<E extends Ty>(element: E): Ty<Array<E[Ty.T]>, E[Ty.P]> {
6
4
  return Ty((description, ref) => ({
7
5
  type: "array",
8
6
  description,
@@ -1,7 +1,5 @@
1
1
  import { Ty } from "./Ty.js"
2
2
 
3
- export type constant<V extends number | string> = ReturnType<typeof constant<V>>
4
-
5
3
  export function constant<V extends number | string>(value: V): Ty<V, never> {
6
4
  return Ty((description) => ({
7
5
  const: value,
@@ -1,8 +1,6 @@
1
1
  import { partition } from "../deps/jsr.io/@std/collections/1.0.9/mod.js"
2
2
  import { Ty } from "./Ty.js"
3
3
 
4
- export type constantUnion<M extends Array<number | string>> = ReturnType<typeof constantUnion<M>>
5
-
6
4
  export function constantUnion<M extends Array<number | string>>(
7
5
  ...members: M
8
6
  ): Ty<M[number], never> {
@@ -0,0 +1,21 @@
1
+ import { Ty } from "./Ty.js"
2
+
3
+ export const none: Ty<null, never> = Ty((description) => ({
4
+ type: "null",
5
+ description,
6
+ }))
7
+
8
+ export const boolean: Ty<boolean, never> = Ty((description) => ({
9
+ type: "boolean",
10
+ description,
11
+ }))
12
+
13
+ export const number: Ty<number, never> = Ty((description) => ({
14
+ type: "number",
15
+ description,
16
+ }))
17
+
18
+ export const string: Ty<string, never> = Ty((description) => ({
19
+ type: "string",
20
+ description,
21
+ }))
@@ -1,8 +1,9 @@
1
- export * from "./vec.js"
1
+ export * from "./array.js"
2
2
  export * from "./leaves.js"
3
3
  export * from "./constant.js"
4
4
  export * from "./constantUnion.js"
5
- export * from "./struct.js"
5
+ export * from "./std/mod.js"
6
+ export * from "./object.js"
6
7
  export * from "./Ref.js"
7
8
  export * from "./taggedUnion.js"
8
9
  export * from "./Ty.js"
@@ -1,9 +1,7 @@
1
1
  import { RootTy } from "./RootTy.js"
2
2
  import type { Ty } from "./Ty.js"
3
3
 
4
- export type struct<F extends StructFields = StructFields> = ReturnType<typeof struct<F>>
5
-
6
- export function struct<F extends StructFields>(fields: F): RootTy<
4
+ export function object<F extends Record<string, Ty>>(fields: F): RootTy<
7
5
  { [K in keyof F]: F[K][Ty.T] },
8
6
  F[keyof F][Ty.P]
9
7
  > {
@@ -15,5 +13,3 @@ export function struct<F extends StructFields>(fields: F): RootTy<
15
13
  required: Object.keys(fields),
16
14
  }))
17
15
  }
18
-
19
- export type StructFields = Record<string, Ty>
@@ -0,0 +1,15 @@
1
+ import { none } from "../leaves.js"
2
+ import { taggedUnion } from "../taggedUnion.js"
3
+ import type { Ty } from "../Ty.js"
4
+
5
+ export function option<S extends Ty>(Some: S): ReturnType<
6
+ typeof taggedUnion<{
7
+ Some: S
8
+ None: Ty<null, never>
9
+ }>
10
+ > {
11
+ return taggedUnion({
12
+ Some,
13
+ None: none,
14
+ })`An option of specified \`some\` type.`
15
+ }
@@ -0,0 +1,8 @@
1
+ import type { Ty } from "../mod.js"
2
+ import { object } from "../object.js"
3
+
4
+ export type Wrapper<X extends Ty = Ty> = ReturnType<typeof Wrapper<X>>
5
+
6
+ export function Wrapper<X extends Ty>(value: X): ReturnType<typeof object<{ value: X }>> {
7
+ return object({ value })
8
+ }
@@ -1,10 +1,6 @@
1
1
  import { Ty } from "./Ty.js"
2
2
 
3
- export type taggedUnion<M extends TaggedUnionMembers = TaggedUnionMembers> = ReturnType<
4
- typeof taggedUnion<M>
5
- >
6
-
7
- export function taggedUnion<M extends TaggedUnionMembers>(members: M): Ty<
3
+ export function taggedUnion<M extends Record<string, Ty>>(members: M): Ty<
8
4
  {
9
5
  [K in keyof M]: {
10
6
  type: K
@@ -30,5 +26,3 @@ export function taggedUnion<M extends TaggedUnionMembers>(members: M): Ty<
30
26
  })),
31
27
  }))
32
28
  }
33
-
34
- export type TaggedUnionMembers = Record<string, Ty>
@@ -1,6 +1,6 @@
1
1
  import type Openai from "openai";
2
2
  import type { ResponseFormatJSONSchema } from "openai/resources/index.js";
3
- import type { RootTy } from "./core/mod.js";
3
+ import type { RootTy } from "./types/mod.js";
4
4
  export declare function ResponseFormat<T>(name: string, ty: RootTy<T, never>): ResponseFormat<T>;
5
5
  export interface ResponseFormat<T> {
6
6
  (template: TemplateStringsArray, ...quasis: Array<string>): ResponseFormat<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseFormat.d.ts","sourceRoot":"","sources":["../src/ResponseFormat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAEvF;AAkDD,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;IAC7E,IAAI,EAAE,aAAa,CAAA;IACnB,8CAA8C;IAC9C,WAAW,EAAE,wBAAwB,CAAC,UAAU,CAAA;IAChD,iDAAiD;IACjD,KAAK,CAAC,UAAU,EAAE,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IACzD,qEAAqE;IACrE,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,CAAC,CAAA;CACjD;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG;IACrE,OAAO,EAAE,KAAK,CACZ,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG;QACtC,OAAO,EAAE,IAAI,CAAC,qBAAq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AC,oBAAoB,EAAE,SAAS,CAAC,GAAG;QACtC,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG;YAChD,OAAO,EAAE,CAAC,CAAA;SACX,CAAA;KACF,CACF,CAAA;CACF,CAAA;AAED,KAAK,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAA;AAChD,KAAK,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAA;AAC7D,KAAK,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAA"}
package/types/Tool.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RootTy, Schema } from "./core/mod.js";
1
+ import type { RootTy, Schema } from "./types/mod.js";
2
2
  export declare function Tool<T>(name: string, ty: RootTy<T, never>): Tool<T>;
3
3
  export interface Tool<T = any> {
4
4
  (template: TemplateStringsArray, ...quasis: Array<string>): Tool<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../src/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGnD,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAEnE;AAuBD,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,GAAG;IAC3B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACnE,IAAI,EAAE,UAAU,CAAA;IAChB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
1
+ {"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../src/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGpD,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAEnE;AAuBD,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,GAAG;IAC3B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACnE,IAAI,EAAE,UAAU,CAAA;IAChB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
package/types/mod.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import "./_dnt.polyfills.js";
2
- export * as T from "./core/mod.js";
3
- export * as std from "./std/mod.js";
2
+ export * as T from "./types/mod.js";
4
3
  export * from "./ResponseFormat.js";
5
4
  export * from "./Tool.js";
6
5
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,eAAe,CAAA;AAClC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../src/types/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAGlD,MAAM,MAAM,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,MAAM,CAAA;AAEpC,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAUzC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootTy.d.ts","sourceRoot":"","sources":["../../src/types/RootTy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAEzE,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,KAAK,EAChD,QAAQ,EAAE,QAAQ,EAClB,YAAY,GAAE,KAAK,CAAC,WAAW,CAAM,EACrC,OAAO,GAAE,OAAY,GACpB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAoBd;AAED,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC,EAAE,SAAS,KAAK,CAAC,MAAM,CAAC,EACvB,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,SAAS,EAAE,EAAE,GACf,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,KAAK,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EACnD,MAAM,EAAE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AE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;IAC/F,MAAM,IAAI,IAAI,IAAI,MAAM,CAAA;CACzB;AAED,yBAAiB,EAAE,CAAC;IAClB,KAAY,CAAC,GAAG,OAAO,CAAC,CAAA;IACT,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;IACrC,KAAY,CAAC,GAAG,OAAO,CAAC,CAAA;IACT,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;CACtC;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAA;AAC5E,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE5C,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACzB;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Ty } from "./Ty.js";
2
+ export declare function array<E extends Ty>(element: E): Ty<Array<E[Ty.T]>, E[Ty.P]>;
3
+ //# sourceMappingURL=array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/types/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,wBAAgB,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAM3E"}
@@ -0,0 +1,3 @@
1
+ import { Ty } from "./Ty.js";
2
+ export declare function constant<V extends number | string>(value: V): Ty<V, never>;
3
+ //# sourceMappingURL=constant.d.ts.map
@@ -0,0 +1 @@
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,CAK1E"}
@@ -0,0 +1,3 @@
1
+ import { Ty } from "./Ty.js";
2
+ export declare function constantUnion<M extends Array<number | string>>(...members: M): Ty<M[number], never>;
3
+ //# sourceMappingURL=constantUnion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constantUnion.d.ts","sourceRoot":"","sources":["../../src/types/constantUnion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC5D,GAAG,OAAO,EAAE,CAAC,GACZ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAqBtB"}
@@ -0,0 +1,6 @@
1
+ import { Ty } from "./Ty.js";
2
+ export declare const none: Ty<null, never>;
3
+ export declare const boolean: Ty<boolean, never>;
4
+ export declare const number: Ty<number, never>;
5
+ export declare const string: Ty<string, never>;
6
+ //# sourceMappingURL=leaves.d.ts.map
@@ -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"}
@@ -1,8 +1,9 @@
1
- export * from "./vec.js";
1
+ export * from "./array.js";
2
2
  export * from "./leaves.js";
3
3
  export * from "./constant.js";
4
4
  export * from "./constantUnion.js";
5
- export * from "./struct.js";
5
+ export * from "./std/mod.js";
6
+ export * from "./object.js";
6
7
  export * from "./Ref.js";
7
8
  export * from "./taggedUnion.js";
8
9
  export * from "./Ty.js";
@@ -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"}
@@ -0,0 +1,6 @@
1
+ import { RootTy } from "./RootTy.js";
2
+ import type { Ty } from "./Ty.js";
3
+ export declare function object<F extends Record<string, Ty>>(fields: F): RootTy<{
4
+ [K in keyof F]: F[K][Ty.T];
5
+ }, F[keyof F][Ty.P]>;
6
+ //# sourceMappingURL=object.d.ts.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ import { taggedUnion } from "../taggedUnion.js";
2
+ import type { Ty } from "../Ty.js";
3
+ export declare function option<S extends Ty>(Some: S): ReturnType<typeof taggedUnion<{
4
+ Some: S;
5
+ None: Ty<null, never>;
6
+ }>>;
7
+ //# sourceMappingURL=Option.d.ts.map
@@ -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,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":"mod.d.ts","sourceRoot":"","sources":["../../../src/types/std/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Ty } from "./Ty.js";
2
+ export declare function taggedUnion<M extends Record<string, Ty>>(members: M): Ty<{
3
+ [K in keyof M]: {
4
+ type: K;
5
+ value: M[K][Ty.T];
6
+ };
7
+ }[keyof M], M[keyof M][Ty.P]>;
8
+ //# sourceMappingURL=taggedUnion.d.ts.map
@@ -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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Ref.js","sourceRoot":"","sources":["../../src/core/Ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EA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,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Ty.js","sourceRoot":"","sources":["../../src/core/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/core/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAI5B,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constantUnion.js","sourceRoot":"","sources":["../../src/core/constantUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAI5B,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaves.js","sourceRoot":"","sources":["../../src/core/leaves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAG5B,MAAM,CAAC,MAAM,IAAI,GAAoB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,EAAE,MAAM;IACZ,WAAW;CACZ,CAAC,CAAC,CAAA;AAGH,MAAM,CAAC,MAAM,IAAI,GAAuB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC3D,IAAI,EAAE,SAAS;IACf,WAAW;CACZ,CAAC,CAAC,CAAA;AAGH,MAAM,CAAC,MAAM,GAAG,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA;AAGH,MAAM,CAAC,MAAM,GAAG,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/core/mod.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"struct.js","sourceRoot":"","sources":["../../src/core/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAKpC,MAAM,UAAU,MAAM,CAAyB,MAAS;IAItD,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"taggedUnion.js","sourceRoot":"","sources":["../../src/core/taggedUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAM5B,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vec.js","sourceRoot":"","sources":["../../src/core/vec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAI5B,MAAM,UAAU,GAAG,CAAe,OAAU;IAC1C,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"}
package/esm/std/Option.js DELETED
@@ -1,11 +0,0 @@
1
- import { none } from "../core/leaves.js";
2
- import { taggedUnion } from "../core/taggedUnion.js";
3
- export function Option(Some) {
4
- // TODO: There should be no need to supply the following type arg.
5
- // Determine where inference isn't smart enough to avoid widening `none`'s `P` to `string`.
6
- return taggedUnion({
7
- Some,
8
- None: none,
9
- }) `An option of specified \`some\` type.`;
10
- }
11
- //# sourceMappingURL=Option.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Option.js","sourceRoot":"","sources":["../../src/std/Option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAKpD,MAAM,UAAU,MAAM,CAAe,IAAO;IAI1C,kEAAkE;IAClE,iGAAiG;IACjG,OAAO,WAAW,CAGf;QACD,IAAI;QACJ,IAAI,EAAE,IAAI;KACX,CAAC,CAAA,uCAAuC,CAAA;AAC3C,CAAC"}
@@ -1,5 +0,0 @@
1
- import { struct } from "../core/mod.js";
2
- export function Wrapper(value) {
3
- return struct({ value });
4
- }
5
- //# sourceMappingURL=Wrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wrapper.js","sourceRoot":"","sources":["../../src/std/Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,gBAAgB,CAAA;AAIhD,MAAM,UAAU,OAAO,CAAe,KAAQ;IAC5C,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAC1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/std/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -1,25 +0,0 @@
1
- import { Ty } from "./Ty.js"
2
-
3
- export type none<P extends string = string> = Ty<null, P>
4
- export const none: Ty<null, never> = Ty((description) => ({
5
- type: "null",
6
- description,
7
- }))
8
-
9
- export type bool<P extends string = string> = Ty<boolean, P>
10
- export const bool: Ty<boolean, never> = Ty((description) => ({
11
- type: "boolean",
12
- description,
13
- }))
14
-
15
- export type num<P extends string = string> = Ty<number, P>
16
- export const num: Ty<number, never> = Ty((description) => ({
17
- type: "number",
18
- description,
19
- }))
20
-
21
- export type str<P extends string = string> = Ty<string, P>
22
- export const str: Ty<string, never> = Ty((description) => ({
23
- type: "string",
24
- description,
25
- }))
package/src/std/Option.ts DELETED
@@ -1,20 +0,0 @@
1
- import { none } from "../core/leaves.js"
2
- import { taggedUnion } from "../core/taggedUnion.js"
3
- import type { Ty } from "../core/Ty.js"
4
-
5
- export type Option<S extends Ty> = ReturnType<typeof Option<S>>
6
-
7
- export function Option<S extends Ty>(Some: S): taggedUnion<{
8
- Some: S
9
- None: none<never>
10
- }> {
11
- // TODO: There should be no need to supply the following type arg.
12
- // Determine where inference isn't smart enough to avoid widening `none`'s `P` to `string`.
13
- return taggedUnion<{
14
- Some: S
15
- None: none<never>
16
- }>({
17
- Some,
18
- None: none,
19
- })`An option of specified \`some\` type.`
20
- }
@@ -1,7 +0,0 @@
1
- import { struct, type Ty } from "../core/mod.js"
2
-
3
- export type Wrapper<X extends Ty = Ty> = ReturnType<typeof Wrapper<X>>
4
-
5
- export function Wrapper<X extends Ty>(value: X): struct<{ value: X }> {
6
- return struct({ value })
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../src/core/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAGlD,MAAM,MAAM,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,MAAM,CAAA;AAEpC,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAUzC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RootTy.d.ts","sourceRoot":"","sources":["../../src/core/RootTy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAEzE,wBAAgB,MAAM,CAAC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M,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export type constant<V extends number | string> = ReturnType<typeof constant<V>>;
3
- export declare function constant<V extends number | string>(value: V): Ty<V, never>;
4
- //# sourceMappingURL=constant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/core/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AAEhF,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAK1E"}
@@ -1,4 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export type constantUnion<M extends Array<number | string>> = ReturnType<typeof constantUnion<M>>;
3
- export declare function constantUnion<M extends Array<number | string>>(...members: M): Ty<M[number], never>;
4
- //# sourceMappingURL=constantUnion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constantUnion.d.ts","sourceRoot":"","sources":["../../src/core/constantUnion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjG,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC5D,GAAG,OAAO,EAAE,CAAC,GACZ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAqBtB"}
@@ -1,10 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export type none<P extends string = string> = Ty<null, P>;
3
- export declare const none: Ty<null, never>;
4
- export type bool<P extends string = string> = Ty<boolean, P>;
5
- export declare const bool: Ty<boolean, never>;
6
- export type num<P extends string = string> = Ty<number, P>;
7
- export declare const num: Ty<number, never>;
8
- export type str<P extends string = string> = Ty<string, P>;
9
- export declare const str: Ty<string, never>;
10
- //# sourceMappingURL=leaves.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaves.d.ts","sourceRoot":"","sources":["../../src/core/leaves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AACzD,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAG9B,CAAA;AAEH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;AAC5D,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,CAGjC,CAAA;AAEH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAC1D,eAAO,MAAM,GAAG,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAG/B,CAAA;AAEH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAC1D,eAAO,MAAM,GAAG,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAG/B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/core/mod.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
@@ -1,8 +0,0 @@
1
- import { RootTy } from "./RootTy.js";
2
- import type { Ty } from "./Ty.js";
3
- export type struct<F extends StructFields = StructFields> = ReturnType<typeof struct<F>>;
4
- export declare function struct<F extends StructFields>(fields: F): RootTy<{
5
- [K in keyof F]: F[K][Ty.T];
6
- }, F[keyof F][Ty.P]>;
7
- export type StructFields = Record<string, Ty>;
8
- //# sourceMappingURL=struct.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../src/core/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAExF,wBAAgB,MAAM,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAC/D;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;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA"}
@@ -1,10 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export type taggedUnion<M extends TaggedUnionMembers = TaggedUnionMembers> = ReturnType<typeof taggedUnion<M>>;
3
- export declare function taggedUnion<M extends TaggedUnionMembers>(members: M): Ty<{
4
- [K in keyof M]: {
5
- type: K;
6
- value: M[K][Ty.T];
7
- };
8
- }[keyof M], M[keyof M][Ty.P]>;
9
- export type TaggedUnionMembers = Record<string, Ty>;
10
- //# sourceMappingURL=taggedUnion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"taggedUnion.d.ts","sourceRoot":"","sources":["../../src/core/taggedUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAAI,UAAU,CACrF,OAAO,WAAW,CAAC,CAAC,CAAC,CACtB,CAAA;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,kBAAkB,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;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export type vec<E extends Ty> = ReturnType<typeof vec<E>>;
3
- export declare function vec<E extends Ty>(element: E): Ty<Array<E[Ty.T]>, E[Ty.P]>;
4
- //# sourceMappingURL=vec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vec.d.ts","sourceRoot":"","sources":["../../src/core/vec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzD,wBAAgB,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAMzE"}
@@ -1,9 +0,0 @@
1
- import { none } from "../core/leaves.js";
2
- import { taggedUnion } from "../core/taggedUnion.js";
3
- import type { Ty } from "../core/Ty.js";
4
- export type Option<S extends Ty> = ReturnType<typeof Option<S>>;
5
- export declare function Option<S extends Ty>(Some: S): taggedUnion<{
6
- Some: S;
7
- None: none<never>;
8
- }>;
9
- //# sourceMappingURL=Option.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../src/std/Option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,EAAE,IAAI,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/D,wBAAgB,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC;IACzD,IAAI,EAAE,CAAC,CAAA;IACP,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;CAClB,CAAC,CAUD"}
@@ -1,6 +0,0 @@
1
- import { struct, type Ty } from "../core/mod.js";
2
- export type Wrapper<X extends Ty = Ty> = ReturnType<typeof Wrapper<X>>;
3
- export declare function Wrapper<X extends Ty>(value: X): struct<{
4
- value: X;
5
- }>;
6
- //# sourceMappingURL=Wrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../src/std/Wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEhD,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,MAAM,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAEpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/std/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes