effect 3.9.2 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/Arbitrary/package.json +6 -0
  2. package/FastCheck/package.json +6 -0
  3. package/JSONSchema/package.json +6 -0
  4. package/ParseResult/package.json +6 -0
  5. package/Pretty/package.json +6 -0
  6. package/Schema/package.json +6 -0
  7. package/SchemaAST/package.json +6 -0
  8. package/TSubscriptionRef/package.json +6 -0
  9. package/dist/cjs/Arbitrary.js +490 -0
  10. package/dist/cjs/Arbitrary.js.map +1 -0
  11. package/dist/cjs/Effect.js +247 -16
  12. package/dist/cjs/Effect.js.map +1 -1
  13. package/dist/cjs/FastCheck.js +17 -0
  14. package/dist/cjs/FastCheck.js.map +1 -0
  15. package/dist/cjs/Inspectable.js +43 -3
  16. package/dist/cjs/Inspectable.js.map +1 -1
  17. package/dist/cjs/JSONSchema.js +418 -0
  18. package/dist/cjs/JSONSchema.js.map +1 -0
  19. package/dist/cjs/ParseResult.js +1539 -0
  20. package/dist/cjs/ParseResult.js.map +1 -0
  21. package/dist/cjs/Predicate.js +3 -1
  22. package/dist/cjs/Predicate.js.map +1 -1
  23. package/dist/cjs/Pretty.js +183 -0
  24. package/dist/cjs/Pretty.js.map +1 -0
  25. package/dist/cjs/Schema.js +5529 -0
  26. package/dist/cjs/Schema.js.map +1 -0
  27. package/dist/cjs/SchemaAST.js +2365 -0
  28. package/dist/cjs/SchemaAST.js.map +1 -0
  29. package/dist/cjs/Stream.js +17 -3
  30. package/dist/cjs/Stream.js.map +1 -1
  31. package/dist/cjs/TPubSub.js +9 -1
  32. package/dist/cjs/TPubSub.js.map +1 -1
  33. package/dist/cjs/TQueue.js.map +1 -1
  34. package/dist/cjs/TRef.js.map +1 -1
  35. package/dist/cjs/TSubscriptionRef.js +96 -0
  36. package/dist/cjs/TSubscriptionRef.js.map +1 -0
  37. package/dist/cjs/index.js +18 -2
  38. package/dist/cjs/index.js.map +1 -1
  39. package/dist/cjs/internal/cause.js +2 -2
  40. package/dist/cjs/internal/cause.js.map +1 -1
  41. package/dist/cjs/internal/channel/channelExecutor.js +160 -161
  42. package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
  43. package/dist/cjs/internal/core.js +4 -4
  44. package/dist/cjs/internal/core.js.map +1 -1
  45. package/dist/cjs/internal/fiberRuntime.js +14 -12
  46. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  47. package/dist/cjs/internal/logger.js +7 -6
  48. package/dist/cjs/internal/logger.js.map +1 -1
  49. package/dist/cjs/internal/redacted.js +4 -0
  50. package/dist/cjs/internal/redacted.js.map +1 -1
  51. package/dist/cjs/internal/schema/errors.js +116 -0
  52. package/dist/cjs/internal/schema/errors.js.map +1 -0
  53. package/dist/cjs/internal/schema/filters.js +41 -0
  54. package/dist/cjs/internal/schema/filters.js.map +1 -0
  55. package/dist/cjs/internal/schema/util.js +96 -0
  56. package/dist/cjs/internal/schema/util.js.map +1 -0
  57. package/dist/cjs/internal/stm/core.js +2 -3
  58. package/dist/cjs/internal/stm/core.js.map +1 -1
  59. package/dist/cjs/internal/stm/tPubSub.js.map +1 -1
  60. package/dist/cjs/internal/stm/tQueue.js +1 -2
  61. package/dist/cjs/internal/stm/tQueue.js.map +1 -1
  62. package/dist/cjs/internal/stm/tRef.js +6 -2
  63. package/dist/cjs/internal/stm/tRef.js.map +1 -1
  64. package/dist/cjs/internal/stm/tSubscriptionRef.js +178 -0
  65. package/dist/cjs/internal/stm/tSubscriptionRef.js.map +1 -0
  66. package/dist/cjs/internal/stream.js +36 -16
  67. package/dist/cjs/internal/stream.js.map +1 -1
  68. package/dist/cjs/internal/version.js +1 -1
  69. package/dist/cjs/internal/version.js.map +1 -1
  70. package/dist/dts/Arbitrary.d.ts +45 -0
  71. package/dist/dts/Arbitrary.d.ts.map +1 -0
  72. package/dist/dts/Effect.d.ts +298 -30
  73. package/dist/dts/Effect.d.ts.map +1 -1
  74. package/dist/dts/FastCheck.d.ts +9 -0
  75. package/dist/dts/FastCheck.d.ts.map +1 -0
  76. package/dist/dts/Inspectable.d.ts +28 -0
  77. package/dist/dts/Inspectable.d.ts.map +1 -1
  78. package/dist/dts/JSONSchema.d.ts +181 -0
  79. package/dist/dts/JSONSchema.d.ts.map +1 -0
  80. package/dist/dts/ParseResult.d.ts +551 -0
  81. package/dist/dts/ParseResult.d.ts.map +1 -0
  82. package/dist/dts/Predicate.d.ts.map +1 -1
  83. package/dist/dts/Pretty.d.ts +26 -0
  84. package/dist/dts/Pretty.d.ts.map +1 -0
  85. package/dist/dts/Schema.d.ts +4562 -0
  86. package/dist/dts/Schema.d.ts.map +1 -0
  87. package/dist/dts/SchemaAST.d.ts +1321 -0
  88. package/dist/dts/SchemaAST.d.ts.map +1 -0
  89. package/dist/dts/Stream.d.ts +67 -2
  90. package/dist/dts/Stream.d.ts.map +1 -1
  91. package/dist/dts/TPubSub.d.ts +8 -0
  92. package/dist/dts/TPubSub.d.ts.map +1 -1
  93. package/dist/dts/TQueue.d.ts +7 -7
  94. package/dist/dts/TQueue.d.ts.map +1 -1
  95. package/dist/dts/TRef.d.ts +2 -1
  96. package/dist/dts/TRef.d.ts.map +1 -1
  97. package/dist/dts/TSubscriptionRef.d.ts +251 -0
  98. package/dist/dts/TSubscriptionRef.d.ts.map +1 -0
  99. package/dist/dts/index.d.ts +32 -0
  100. package/dist/dts/index.d.ts.map +1 -1
  101. package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
  102. package/dist/dts/internal/schema/errors.d.ts +2 -0
  103. package/dist/dts/internal/schema/errors.d.ts.map +1 -0
  104. package/dist/dts/internal/schema/filters.d.ts +2 -0
  105. package/dist/dts/internal/schema/filters.d.ts.map +1 -0
  106. package/dist/dts/internal/schema/util.d.ts +2 -0
  107. package/dist/dts/internal/schema/util.d.ts.map +1 -0
  108. package/dist/dts/internal/stm/tRef.d.ts +3 -1
  109. package/dist/dts/internal/stm/tRef.d.ts.map +1 -1
  110. package/dist/dts/internal/stm/tSubscriptionRef.d.ts +2 -0
  111. package/dist/dts/internal/stm/tSubscriptionRef.d.ts.map +1 -0
  112. package/dist/dts/internal/stream.d.ts.map +1 -1
  113. package/dist/esm/Arbitrary.js +472 -0
  114. package/dist/esm/Arbitrary.js.map +1 -0
  115. package/dist/esm/Effect.js +256 -18
  116. package/dist/esm/Effect.js.map +1 -1
  117. package/dist/esm/FastCheck.js +9 -0
  118. package/dist/esm/FastCheck.js.map +1 -0
  119. package/dist/esm/Inspectable.js +39 -2
  120. package/dist/esm/Inspectable.js.map +1 -1
  121. package/dist/esm/JSONSchema.js +408 -0
  122. package/dist/esm/JSONSchema.js.map +1 -0
  123. package/dist/esm/ParseResult.js +1503 -0
  124. package/dist/esm/ParseResult.js.map +1 -0
  125. package/dist/esm/Predicate.js +2 -1
  126. package/dist/esm/Predicate.js.map +1 -1
  127. package/dist/esm/Pretty.js +173 -0
  128. package/dist/esm/Pretty.js.map +1 -0
  129. package/dist/esm/Schema.js +5328 -0
  130. package/dist/esm/Schema.js.map +1 -0
  131. package/dist/esm/SchemaAST.js +2300 -0
  132. package/dist/esm/SchemaAST.js.map +1 -0
  133. package/dist/esm/Stream.js +14 -0
  134. package/dist/esm/Stream.js.map +1 -1
  135. package/dist/esm/TPubSub.js +8 -0
  136. package/dist/esm/TPubSub.js.map +1 -1
  137. package/dist/esm/TQueue.js.map +1 -1
  138. package/dist/esm/TRef.js.map +1 -1
  139. package/dist/esm/TSubscriptionRef.js +87 -0
  140. package/dist/esm/TSubscriptionRef.js.map +1 -0
  141. package/dist/esm/index.js +32 -0
  142. package/dist/esm/index.js.map +1 -1
  143. package/dist/esm/internal/cause.js +3 -3
  144. package/dist/esm/internal/cause.js.map +1 -1
  145. package/dist/esm/internal/channel/channelExecutor.js +160 -161
  146. package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
  147. package/dist/esm/internal/core.js +4 -4
  148. package/dist/esm/internal/core.js.map +1 -1
  149. package/dist/esm/internal/fiberRuntime.js +14 -12
  150. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  151. package/dist/esm/internal/logger.js +7 -6
  152. package/dist/esm/internal/logger.js.map +1 -1
  153. package/dist/esm/internal/redacted.js +4 -0
  154. package/dist/esm/internal/redacted.js.map +1 -1
  155. package/dist/esm/internal/schema/errors.js +87 -0
  156. package/dist/esm/internal/schema/errors.js.map +1 -0
  157. package/dist/esm/internal/schema/filters.js +35 -0
  158. package/dist/esm/internal/schema/filters.js.map +1 -0
  159. package/dist/esm/internal/schema/util.js +78 -0
  160. package/dist/esm/internal/schema/util.js.map +1 -0
  161. package/dist/esm/internal/stm/core.js +1 -2
  162. package/dist/esm/internal/stm/core.js.map +1 -1
  163. package/dist/esm/internal/stm/tPubSub.js.map +1 -1
  164. package/dist/esm/internal/stm/tQueue.js +1 -2
  165. package/dist/esm/internal/stm/tQueue.js.map +1 -1
  166. package/dist/esm/internal/stm/tRef.js +5 -1
  167. package/dist/esm/internal/stm/tRef.js.map +1 -1
  168. package/dist/esm/internal/stm/tSubscriptionRef.js +166 -0
  169. package/dist/esm/internal/stm/tSubscriptionRef.js.map +1 -0
  170. package/dist/esm/internal/stream.js +33 -15
  171. package/dist/esm/internal/stream.js.map +1 -1
  172. package/dist/esm/internal/version.js +1 -1
  173. package/dist/esm/internal/version.js.map +1 -1
  174. package/package.json +68 -1
  175. package/src/Arbitrary.ts +563 -0
  176. package/src/Effect.ts +302 -31
  177. package/src/FastCheck.ts +9 -0
  178. package/src/Inspectable.ts +56 -2
  179. package/src/JSONSchema.ts +601 -0
  180. package/src/ParseResult.ts +2027 -0
  181. package/src/Predicate.ts +3 -1
  182. package/src/Pretty.ts +204 -0
  183. package/src/Schema.ts +10388 -0
  184. package/src/SchemaAST.ts +2827 -0
  185. package/src/Stream.ts +77 -9
  186. package/src/TPubSub.ts +9 -0
  187. package/src/TQueue.ts +7 -7
  188. package/src/TRef.ts +2 -1
  189. package/src/TSubscriptionRef.ts +284 -0
  190. package/src/index.ts +40 -0
  191. package/src/internal/cause.ts +3 -3
  192. package/src/internal/channel/channelExecutor.ts +213 -214
  193. package/src/internal/core-effect.ts +2 -2
  194. package/src/internal/core.ts +4 -4
  195. package/src/internal/fiberRuntime.ts +14 -12
  196. package/src/internal/logger.ts +7 -6
  197. package/src/internal/redacted.ts +4 -0
  198. package/src/internal/schema/errors.ts +189 -0
  199. package/src/internal/schema/filters.ts +86 -0
  200. package/src/internal/schema/util.ts +113 -0
  201. package/src/internal/stm/core.ts +1 -2
  202. package/src/internal/stm/tPubSub.ts +1 -0
  203. package/src/internal/stm/tQueue.ts +2 -2
  204. package/src/internal/stm/tRef.ts +7 -2
  205. package/src/internal/stm/tSubscriptionRef.ts +286 -0
  206. package/src/internal/stream.ts +97 -20
  207. package/src/internal/version.ts +1 -1
@@ -0,0 +1,4562 @@
1
+ /**
2
+ * @since 3.10.0
3
+ */
4
+ import type { ArbitraryAnnotation } from "./Arbitrary.js";
5
+ import * as array_ from "./Array.js";
6
+ import * as bigDecimal_ from "./BigDecimal.js";
7
+ import type { Brand } from "./Brand.js";
8
+ import * as cause_ from "./Cause.js";
9
+ import * as chunk_ from "./Chunk.js";
10
+ import * as config_ from "./Config.js";
11
+ import * as dateTime from "./DateTime.js";
12
+ import * as duration_ from "./Duration.js";
13
+ import * as Effect from "./Effect.js";
14
+ import * as either_ from "./Either.js";
15
+ import * as Equivalence from "./Equivalence.js";
16
+ import * as exit_ from "./Exit.js";
17
+ import * as fiberId_ from "./FiberId.js";
18
+ import type { LazyArg } from "./Function.js";
19
+ import * as hashMap_ from "./HashMap.js";
20
+ import * as hashSet_ from "./HashSet.js";
21
+ import * as list_ from "./List.js";
22
+ import * as option_ from "./Option.js";
23
+ import type * as Order from "./Order.js";
24
+ import * as ParseResult from "./ParseResult.js";
25
+ import type { Pipeable } from "./Pipeable.js";
26
+ import type * as pretty_ from "./Pretty.js";
27
+ import * as redacted_ from "./Redacted.js";
28
+ import * as Request from "./Request.js";
29
+ import type { ParseOptions } from "./SchemaAST.js";
30
+ import * as AST from "./SchemaAST.js";
31
+ import * as sortedSet_ from "./SortedSet.js";
32
+ import type * as Types from "./Types.js";
33
+ /**
34
+ * @since 3.10.0
35
+ */
36
+ export type Simplify<A> = {
37
+ [K in keyof A]: A[K];
38
+ } & {};
39
+ /**
40
+ * @since 3.10.0
41
+ */
42
+ export type SimplifyMutable<A> = {
43
+ -readonly [K in keyof A]: A[K];
44
+ } extends infer B ? B : never;
45
+ /**
46
+ * @since 3.10.0
47
+ * @category symbol
48
+ */
49
+ export declare const TypeId: unique symbol;
50
+ /**
51
+ * @since 3.10.0
52
+ * @category symbol
53
+ */
54
+ export type TypeId = typeof TypeId;
55
+ /**
56
+ * @category model
57
+ * @since 3.10.0
58
+ */
59
+ export interface Schema<in out A, in out I = A, out R = never> extends Schema.Variance<A, I, R>, Pipeable {
60
+ readonly Type: A;
61
+ readonly Encoded: I;
62
+ readonly Context: R;
63
+ readonly ast: AST.AST;
64
+ /**
65
+ * Merges a set of new annotations with existing ones, potentially overwriting
66
+ * any duplicates.
67
+ */
68
+ annotations(annotations: Annotations.Schema<A>): Schema<A, I, R>;
69
+ }
70
+ /**
71
+ * @category model
72
+ * @since 3.10.0
73
+ */
74
+ export interface SchemaClass<A, I = A, R = never> extends AnnotableClass<SchemaClass<A, I, R>, A, I, R> {
75
+ }
76
+ /**
77
+ * @category constructors
78
+ * @since 3.10.0
79
+ */
80
+ export declare const make: <A, I = A, R = never>(ast: AST.AST) => SchemaClass<A, I, R>;
81
+ /**
82
+ * @category annotations
83
+ * @since 3.10.0
84
+ */
85
+ export declare namespace Annotable {
86
+ /**
87
+ * @since 3.10.0
88
+ */
89
+ type Self<S extends All> = ReturnType<S["annotations"]>;
90
+ /**
91
+ * @since 3.10.0
92
+ */
93
+ type Any = Annotable<any, any, any, unknown>;
94
+ /**
95
+ * @since 3.10.0
96
+ */
97
+ type All = Any | Annotable<any, any, never, unknown> | Annotable<any, never, any, unknown> | Annotable<any, never, never, unknown>;
98
+ }
99
+ /**
100
+ * @category annotations
101
+ * @since 3.10.0
102
+ */
103
+ export interface Annotable<Self extends Schema<A, I, R>, A, I = A, R = never> extends Schema<A, I, R> {
104
+ annotations(annotations: Annotations.Schema<A>): Self;
105
+ }
106
+ /**
107
+ * @category annotations
108
+ * @since 3.10.0
109
+ */
110
+ export interface AnnotableClass<Self extends Schema<A, I, R>, A, I = A, R = never> extends Annotable<Self, A, I, R> {
111
+ new (_: never): Schema.Variance<A, I, R>;
112
+ }
113
+ /**
114
+ * @since 3.10.0
115
+ */
116
+ export declare const asSchema: <S extends Schema.All>(schema: S) => Schema<Schema.Type<S>, Schema.Encoded<S>, Schema.Context<S>>;
117
+ /**
118
+ * @category formatting
119
+ * @since 3.10.0
120
+ */
121
+ export declare const format: <S extends Schema.All>(schema: S) => string;
122
+ /**
123
+ * @since 3.10.0
124
+ */
125
+ export declare namespace Schema {
126
+ /**
127
+ * @since 3.10.0
128
+ */
129
+ interface Variance<A, I, R> {
130
+ readonly [TypeId]: {
131
+ readonly _A: Types.Invariant<A>;
132
+ readonly _I: Types.Invariant<I>;
133
+ readonly _R: Types.Covariant<R>;
134
+ };
135
+ }
136
+ /**
137
+ * @since 3.10.0
138
+ */
139
+ type Type<S> = S extends Schema.Variance<infer A, infer _I, infer _R> ? A : never;
140
+ /**
141
+ * @since 3.10.0
142
+ */
143
+ type Encoded<S> = S extends Schema.Variance<infer _A, infer I, infer _R> ? I : never;
144
+ /**
145
+ * @since 3.10.0
146
+ */
147
+ type Context<S> = S extends Schema.Variance<infer _A, infer _I, infer R> ? R : never;
148
+ /**
149
+ * @since 3.10.0
150
+ */
151
+ type ToAsserts<S extends AnyNoContext> = (input: unknown, options?: AST.ParseOptions) => asserts input is Schema.Type<S>;
152
+ /**
153
+ * Any schema, except for `never`.
154
+ *
155
+ * @since 3.10.0
156
+ */
157
+ type Any = Schema<any, any, unknown>;
158
+ /**
159
+ * Any schema with `Context = never`, except for `never`.
160
+ *
161
+ * @since 3.10.0
162
+ */
163
+ type AnyNoContext = Schema<any, any, never>;
164
+ /**
165
+ * Any schema, including `never`.
166
+ *
167
+ * @since 3.10.0
168
+ */
169
+ type All = Any | Schema<any, never, unknown> | Schema<never, any, unknown> | Schema<never, never, unknown>;
170
+ /**
171
+ * Type-level counterpart of `Schema.asSchema` function.
172
+ *
173
+ * @since 3.10.0
174
+ */
175
+ type AsSchema<S extends All> = Schema<Type<S>, Encoded<S>, Context<S>>;
176
+ }
177
+ /**
178
+ * The `encodedSchema` function allows you to extract the `Encoded` portion of a
179
+ * schema, creating a new schema that conforms to the properties defined in the
180
+ * original schema without retaining any refinements or transformations that
181
+ * were applied previously.
182
+ *
183
+ * @since 3.10.0
184
+ */
185
+ export declare const encodedSchema: <A, I, R>(schema: Schema<A, I, R>) => SchemaClass<I>;
186
+ /**
187
+ * The `encodedBoundSchema` function is similar to `encodedSchema` but preserves
188
+ * the refinements up to the first transformation point in the original schema.
189
+ *
190
+ * @since 3.10.0
191
+ */
192
+ export declare const encodedBoundSchema: <A, I, R>(schema: Schema<A, I, R>) => SchemaClass<I>;
193
+ /**
194
+ * The `typeSchema` function allows you to extract the `Type` portion of a
195
+ * schema, creating a new schema that conforms to the properties defined in the
196
+ * original schema without considering the initial encoding or transformation
197
+ * processes.
198
+ *
199
+ * @since 3.10.0
200
+ */
201
+ export declare const typeSchema: <A, I, R>(schema: Schema<A, I, R>) => SchemaClass<A>;
202
+ export {
203
+ /**
204
+ * By default the option `exact` is set to `true`.
205
+ *
206
+ * @throws `ParseError`
207
+ * @category validation
208
+ * @since 3.10.0
209
+ */
210
+ asserts,
211
+ /**
212
+ * @category decoding
213
+ * @since 3.10.0
214
+ */
215
+ decodeOption,
216
+ /**
217
+ * @throws `ParseError`
218
+ * @category decoding
219
+ * @since 3.10.0
220
+ */
221
+ decodeSync,
222
+ /**
223
+ * @category decoding
224
+ * @since 3.10.0
225
+ */
226
+ decodeUnknownOption,
227
+ /**
228
+ * @throws `ParseError`
229
+ * @category decoding
230
+ * @since 3.10.0
231
+ */
232
+ decodeUnknownSync,
233
+ /**
234
+ * @category encoding
235
+ * @since 3.10.0
236
+ */
237
+ encodeOption,
238
+ /**
239
+ * @throws `ParseError`
240
+ * @category encoding
241
+ * @since 3.10.0
242
+ */
243
+ encodeSync,
244
+ /**
245
+ * @category encoding
246
+ * @since 3.10.0
247
+ */
248
+ encodeUnknownOption,
249
+ /**
250
+ * @throws `ParseError`
251
+ * @category encoding
252
+ * @since 3.10.0
253
+ */
254
+ encodeUnknownSync,
255
+ /**
256
+ * By default the option `exact` is set to `true`.
257
+ *
258
+ * @category validation
259
+ * @since 3.10.0
260
+ */
261
+ is,
262
+ /**
263
+ * @category validation
264
+ * @since 3.10.0
265
+ */
266
+ validateOption,
267
+ /**
268
+ * @throws `ParseError`
269
+ * @category validation
270
+ * @since 3.10.0
271
+ */
272
+ validateSync } from "./ParseResult.js";
273
+ /**
274
+ * @category encoding
275
+ * @since 3.10.0
276
+ */
277
+ export declare const encodeUnknown: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect<I, ParseResult.ParseError, R>;
278
+ /**
279
+ * @category encoding
280
+ * @since 3.10.0
281
+ */
282
+ export declare const encodeUnknownEither: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either<I, ParseResult.ParseError>;
283
+ /**
284
+ * @category encoding
285
+ * @since 3.10.0
286
+ */
287
+ export declare const encodeUnknownPromise: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise<I>;
288
+ /**
289
+ * @category encoding
290
+ * @since 3.10.0
291
+ */
292
+ export declare const encode: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Effect.Effect<I, ParseResult.ParseError, R>;
293
+ /**
294
+ * @category encoding
295
+ * @since 3.10.0
296
+ */
297
+ export declare const encodeEither: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => either_.Either<I, ParseResult.ParseError>;
298
+ /**
299
+ * @category encoding
300
+ * @since 3.10.0
301
+ */
302
+ export declare const encodePromise: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (a: A, overrideOptions?: ParseOptions) => Promise<I>;
303
+ /**
304
+ * @category decoding
305
+ * @since 3.10.0
306
+ */
307
+ export declare const decodeUnknown: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect<A, ParseResult.ParseError, R>;
308
+ /**
309
+ * @category decoding
310
+ * @since 3.10.0
311
+ */
312
+ export declare const decodeUnknownEither: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either<A, ParseResult.ParseError>;
313
+ /**
314
+ * @category decoding
315
+ * @since 3.10.0
316
+ */
317
+ export declare const decodeUnknownPromise: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise<A>;
318
+ /**
319
+ * @category decoding
320
+ * @since 3.10.0
321
+ */
322
+ export declare const decode: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Effect.Effect<A, ParseResult.ParseError, R>;
323
+ /**
324
+ * @category decoding
325
+ * @since 3.10.0
326
+ */
327
+ export declare const decodeEither: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => either_.Either<A, ParseResult.ParseError>;
328
+ /**
329
+ * @category decoding
330
+ * @since 3.10.0
331
+ */
332
+ export declare const decodePromise: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (i: I, overrideOptions?: ParseOptions) => Promise<A>;
333
+ /**
334
+ * @category validation
335
+ * @since 3.10.0
336
+ */
337
+ export declare const validate: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Effect.Effect<A, ParseResult.ParseError, R>;
338
+ /**
339
+ * @category validation
340
+ * @since 3.10.0
341
+ */
342
+ export declare const validateEither: <A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => either_.Either<A, ParseResult.ParseError>;
343
+ /**
344
+ * @category validation
345
+ * @since 3.10.0
346
+ */
347
+ export declare const validatePromise: <A, I>(schema: Schema<A, I, never>, options?: ParseOptions) => (u: unknown, overrideOptions?: ParseOptions) => Promise<A>;
348
+ /**
349
+ * Tests if a value is a `Schema`.
350
+ *
351
+ * @category guards
352
+ * @since 3.10.0
353
+ */
354
+ export declare const isSchema: (u: unknown) => u is Schema.Any;
355
+ /**
356
+ * @category api interface
357
+ * @since 3.10.0
358
+ */
359
+ export interface Literal<Literals extends array_.NonEmptyReadonlyArray<AST.LiteralValue>> extends AnnotableClass<Literal<Literals>, Literals[number]> {
360
+ readonly literals: Readonly<Literals>;
361
+ }
362
+ /**
363
+ * @category constructors
364
+ * @since 3.10.0
365
+ */
366
+ export declare function Literal<Literals extends array_.NonEmptyReadonlyArray<AST.LiteralValue>>(...literals: Literals): Literal<Literals>;
367
+ export declare function Literal(): Never;
368
+ export declare function Literal<Literals extends ReadonlyArray<AST.LiteralValue>>(...literals: Literals): Schema<Literals[number]>;
369
+ /**
370
+ * Creates a new `Schema` from a literal schema.
371
+ *
372
+ * @example
373
+ * import * as Schema from "effect/Schema"
374
+ * import { Either } from "effect"
375
+ *
376
+ * const schema = Schema.Literal("a", "b", "c").pipe(Schema.pickLiteral("a", "b"))
377
+ *
378
+ * assert.deepStrictEqual(Schema.decodeSync(schema)("a"), "a")
379
+ * assert.deepStrictEqual(Schema.decodeSync(schema)("b"), "b")
380
+ * assert.strictEqual(Either.isLeft(Schema.decodeUnknownEither(schema)("c")), true)
381
+ *
382
+ * @category constructors
383
+ * @since 3.10.0
384
+ */
385
+ export declare const pickLiteral: <A extends AST.LiteralValue, L extends array_.NonEmptyReadonlyArray<A>>(...literals: L) => <I, R>(_schema: Schema<A, I, R>) => Literal<[...L]>;
386
+ /**
387
+ * @category constructors
388
+ * @since 3.10.0
389
+ */
390
+ export declare const UniqueSymbolFromSelf: <S extends symbol>(symbol: S) => SchemaClass<S>;
391
+ /**
392
+ * @category api interface
393
+ * @since 3.10.0
394
+ */
395
+ export interface Enums<A extends EnumsDefinition> extends AnnotableClass<Enums<A>, A[keyof A]> {
396
+ readonly enums: A;
397
+ }
398
+ /**
399
+ * @since 3.10.0
400
+ */
401
+ export type EnumsDefinition = {
402
+ [x: string]: string | number;
403
+ };
404
+ /**
405
+ * @category constructors
406
+ * @since 3.10.0
407
+ */
408
+ export declare const Enums: <A extends EnumsDefinition>(enums: A) => Enums<A>;
409
+ type Join<Params> = Params extends [infer Head, ...infer Tail] ? `${(Head extends Schema<infer A> ? A : Head) & (AST.LiteralValue)}${Join<Tail>}` : "";
410
+ /**
411
+ * @category API interface
412
+ * @since 3.10.0
413
+ */
414
+ export interface TemplateLiteral<A> extends SchemaClass<A> {
415
+ }
416
+ type TemplateLiteralParameter = Schema.AnyNoContext | AST.LiteralValue;
417
+ /**
418
+ * @category template literal
419
+ * @since 3.10.0
420
+ */
421
+ export declare const TemplateLiteral: <Params extends array_.NonEmptyReadonlyArray<TemplateLiteralParameter>>(...[head, ...tail]: Params) => TemplateLiteral<Join<Params>>;
422
+ type TemplateLiteralParserParameters = Schema.Any | AST.LiteralValue;
423
+ type TemplateLiteralParserParametersType<T> = T extends [infer Head, ...infer Tail] ? readonly [Head extends Schema<infer A, infer _I, infer _R> ? A : Head, ...TemplateLiteralParserParametersType<Tail>] : [];
424
+ type TemplateLiteralParserParametersEncoded<T> = T extends [infer Head, ...infer Tail] ? `${(Head extends Schema<infer _A, infer I, infer _R> ? I : Head) & (AST.LiteralValue)}${TemplateLiteralParserParametersEncoded<Tail>}` : "";
425
+ /**
426
+ * @category API interface
427
+ * @since 3.10.0
428
+ */
429
+ export interface TemplateLiteralParser<Params extends array_.NonEmptyReadonlyArray<TemplateLiteralParserParameters>> extends Schema<TemplateLiteralParserParametersType<Params>, TemplateLiteralParserParametersEncoded<Params>, Schema.Context<Params[number]>> {
430
+ readonly params: Params;
431
+ }
432
+ /**
433
+ * @category template literal
434
+ * @since 3.10.0
435
+ */
436
+ export declare const TemplateLiteralParser: <Params extends array_.NonEmptyReadonlyArray<TemplateLiteralParserParameters>>(...params: Params) => TemplateLiteralParser<Params>;
437
+ /**
438
+ * The constraint `R extends Schema.Context<P[number]>` enforces dependencies solely from `typeParameters`.
439
+ * This ensures that when you call `Schema.to` or `Schema.from`, you receive a schema with a `never` context.
440
+ *
441
+ * @category constructors
442
+ * @since 3.10.0
443
+ */
444
+ export declare const declare: {
445
+ /**
446
+ * The constraint `R extends Schema.Context<P[number]>` enforces dependencies solely from `typeParameters`.
447
+ * This ensures that when you call `Schema.to` or `Schema.from`, you receive a schema with a `never` context.
448
+ *
449
+ * @category constructors
450
+ * @since 3.10.0
451
+ */
452
+ <A>(is: (input: unknown) => input is A, annotations?: Annotations.Schema<A>): SchemaClass<A>;
453
+ /**
454
+ * The constraint `R extends Schema.Context<P[number]>` enforces dependencies solely from `typeParameters`.
455
+ * This ensures that when you call `Schema.to` or `Schema.from`, you receive a schema with a `never` context.
456
+ *
457
+ * @category constructors
458
+ * @since 3.10.0
459
+ */
460
+ <const P extends ReadonlyArray<Schema.All>, I, A>(typeParameters: P, options: {
461
+ readonly decode: (...typeParameters: {
462
+ readonly [K in keyof P]: Schema<Schema.Type<P[K]>, Schema.Encoded<P[K]>, never>;
463
+ }) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect<A, ParseResult.ParseIssue, never>;
464
+ readonly encode: (...typeParameters: {
465
+ readonly [K in keyof P]: Schema<Schema.Type<P[K]>, Schema.Encoded<P[K]>, never>;
466
+ }) => (input: unknown, options: ParseOptions, ast: AST.Declaration) => Effect.Effect<I, ParseResult.ParseIssue, never>;
467
+ }, annotations?: Annotations.Schema<A, {
468
+ readonly [K in keyof P]: Schema.Type<P[K]>;
469
+ }>): SchemaClass<A, I, Schema.Context<P[number]>>;
470
+ };
471
+ /**
472
+ * @category schema id
473
+ * @since 3.10.0
474
+ */
475
+ export declare const BrandSchemaId: unique symbol;
476
+ /**
477
+ * @category constructors
478
+ * @since 3.10.0
479
+ */
480
+ export declare const fromBrand: <C extends Brand<string | symbol>, A extends Brand.Unbranded<C>>(constructor: Brand.Constructor<C>, annotations?: Annotations.Filter<C, A>) => <I, R>(self: Schema<A, I, R>) => BrandSchema<A & C, I, R>;
481
+ /**
482
+ * @category schema id
483
+ * @since 3.10.0
484
+ */
485
+ export declare const InstanceOfSchemaId: unique symbol;
486
+ /**
487
+ * @category api interface
488
+ * @since 3.10.0
489
+ */
490
+ export interface instanceOf<A> extends AnnotableClass<instanceOf<A>, A> {
491
+ }
492
+ /**
493
+ * @category constructors
494
+ * @since 3.10.0
495
+ */
496
+ export declare const instanceOf: <A extends abstract new (...args: any) => any>(constructor: A, annotations?: Annotations.Schema<InstanceType<A>>) => instanceOf<InstanceType<A>>;
497
+ declare const Undefined_base: SchemaClass<undefined, undefined, never>;
498
+ /**
499
+ * @category primitives
500
+ * @since 3.10.0
501
+ */
502
+ export declare class Undefined extends Undefined_base {
503
+ }
504
+ declare const Void_base: SchemaClass<void, void, never>;
505
+ /**
506
+ * @category primitives
507
+ * @since 3.10.0
508
+ */
509
+ export declare class Void extends Void_base {
510
+ }
511
+ declare const Null_base: SchemaClass<null, null, never>;
512
+ /**
513
+ * @category primitives
514
+ * @since 3.10.0
515
+ */
516
+ export declare class Null extends Null_base {
517
+ }
518
+ declare const Never_base: SchemaClass<never, never, never>;
519
+ /**
520
+ * @category primitives
521
+ * @since 3.10.0
522
+ */
523
+ export declare class Never extends Never_base {
524
+ }
525
+ declare const Unknown_base: SchemaClass<unknown, unknown, never>;
526
+ /**
527
+ * @category primitives
528
+ * @since 3.10.0
529
+ */
530
+ export declare class Unknown extends Unknown_base {
531
+ }
532
+ declare const Any_base: SchemaClass<any, any, never>;
533
+ /**
534
+ * @category primitives
535
+ * @since 3.10.0
536
+ */
537
+ export declare class Any extends Any_base {
538
+ }
539
+ declare const BigIntFromSelf_base: SchemaClass<bigint, bigint, never>;
540
+ /**
541
+ * @category primitives
542
+ * @since 3.10.0
543
+ */
544
+ export declare class BigIntFromSelf extends BigIntFromSelf_base {
545
+ }
546
+ declare const SymbolFromSelf_base: SchemaClass<symbol, symbol, never>;
547
+ /**
548
+ * @category primitives
549
+ * @since 3.10.0
550
+ */
551
+ export declare class SymbolFromSelf extends SymbolFromSelf_base {
552
+ }
553
+ declare const String$_base: SchemaClass<string, string, never>;
554
+ /** @ignore */
555
+ declare class String$ extends String$_base {
556
+ }
557
+ declare const Number$_base: SchemaClass<number, number, never>;
558
+ /** @ignore */
559
+ declare class Number$ extends Number$_base {
560
+ }
561
+ declare const Boolean$_base: SchemaClass<boolean, boolean, never>;
562
+ /** @ignore */
563
+ declare class Boolean$ extends Boolean$_base {
564
+ }
565
+ declare const Object$_base: SchemaClass<object, object, never>;
566
+ /** @ignore */
567
+ declare class Object$ extends Object$_base {
568
+ }
569
+ export {
570
+ /**
571
+ * @category primitives
572
+ * @since 3.10.0
573
+ */
574
+ Boolean$ as Boolean,
575
+ /**
576
+ * @category primitives
577
+ * @since 3.10.0
578
+ */
579
+ Number$ as Number,
580
+ /**
581
+ * @category primitives
582
+ * @since 3.10.0
583
+ */
584
+ Object$ as Object,
585
+ /**
586
+ * @category primitives
587
+ * @since 3.10.0
588
+ */
589
+ String$ as String };
590
+ /**
591
+ * @category api interface
592
+ * @since 3.10.0
593
+ */
594
+ export interface Union<Members extends ReadonlyArray<Schema.All>> extends AnnotableClass<Union<Members>, Schema.Type<Members[number]>, Schema.Encoded<Members[number]>, Schema.Context<Members[number]>> {
595
+ readonly members: Readonly<Members>;
596
+ annotations(annotations: Annotations.Schema<Schema.Type<Members[number]>>): Union<Members>;
597
+ }
598
+ /**
599
+ * @category combinators
600
+ * @since 3.10.0
601
+ */
602
+ export declare function Union<Members extends AST.Members<Schema.All>>(...members: Members): Union<Members>;
603
+ export declare function Union<Member extends Schema.All>(member: Member): Member;
604
+ export declare function Union(): typeof Never;
605
+ export declare function Union<Members extends ReadonlyArray<Schema.All>>(...members: Members): Schema<Schema.Type<Members[number]>, Schema.Encoded<Members[number]>, Schema.Context<Members[number]>>;
606
+ /**
607
+ * @category api interface
608
+ * @since 3.10.0
609
+ */
610
+ export interface NullOr<S extends Schema.All> extends Union<[S, typeof Null]> {
611
+ annotations(annotations: Annotations.Schema<Schema.Type<S> | null>): NullOr<S>;
612
+ }
613
+ /**
614
+ * @category combinators
615
+ * @since 3.10.0
616
+ */
617
+ export declare const NullOr: <S extends Schema.All>(self: S) => NullOr<S>;
618
+ /**
619
+ * @category api interface
620
+ * @since 3.10.0
621
+ */
622
+ export interface UndefinedOr<S extends Schema.All> extends Union<[S, typeof Undefined]> {
623
+ annotations(annotations: Annotations.Schema<Schema.Type<S> | undefined>): UndefinedOr<S>;
624
+ }
625
+ /**
626
+ * @category combinators
627
+ * @since 3.10.0
628
+ */
629
+ export declare const UndefinedOr: <S extends Schema.All>(self: S) => UndefinedOr<S>;
630
+ /**
631
+ * @category api interface
632
+ * @since 3.10.0
633
+ */
634
+ export interface NullishOr<S extends Schema.All> extends Union<[S, typeof Null, typeof Undefined]> {
635
+ annotations(annotations: Annotations.Schema<Schema.Type<S> | null | undefined>): NullishOr<S>;
636
+ }
637
+ /**
638
+ * @category combinators
639
+ * @since 3.10.0
640
+ */
641
+ export declare const NullishOr: <S extends Schema.All>(self: S) => NullishOr<S>;
642
+ /**
643
+ * @category combinators
644
+ * @since 3.10.0
645
+ */
646
+ export declare const keyof: <A, I, R>(self: Schema<A, I, R>) => SchemaClass<keyof A>;
647
+ /**
648
+ * @since 3.10.0
649
+ */
650
+ export declare namespace Element {
651
+ /**
652
+ * @since 3.10.0
653
+ */
654
+ interface Annotations<A> extends Annotations.Doc<A> {
655
+ readonly missingMessage?: AST.MissingMessageAnnotation;
656
+ }
657
+ /**
658
+ * @since 3.10.0
659
+ */
660
+ type Token = "" | "?";
661
+ }
662
+ /**
663
+ * @category API interface
664
+ * @since 3.10.0
665
+ */
666
+ export interface Element<S extends Schema.Any, Token extends Element.Token> extends Schema.Variance<Schema.Type<S>, Schema.Encoded<S>, Schema.Context<S>> {
667
+ readonly _Token: Token;
668
+ readonly ast: AST.OptionalType;
669
+ readonly from: S;
670
+ annotations(annotations: Element.Annotations<Schema.Type<S>>): Element<S, Token>;
671
+ }
672
+ /**
673
+ * @since 3.10.0
674
+ */
675
+ export declare const element: <S extends Schema.Any>(self: S) => Element<S, "">;
676
+ /**
677
+ * @since 3.10.0
678
+ */
679
+ export declare const optionalElement: <S extends Schema.Any>(self: S) => Element<S, "?">;
680
+ /**
681
+ * @since 3.10.0
682
+ */
683
+ export declare namespace TupleType {
684
+ type ElementsType<Elements, Out extends ReadonlyArray<any> = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends Element<infer T, "?"> ? ElementsType<Tail, readonly [...Out, Schema.Type<T>?]> : ElementsType<Tail, readonly [...Out, Schema.Type<Head>]> : Out;
685
+ type ElementsEncoded<Elements, Out extends ReadonlyArray<any> = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends Element<infer T, "?"> ? ElementsEncoded<Tail, readonly [...Out, Schema.Encoded<T>?]> : ElementsEncoded<Tail, readonly [...Out, Schema.Encoded<Head>]> : Out;
686
+ /**
687
+ * @since 3.10.0
688
+ */
689
+ type Elements = ReadonlyArray<Schema.Any | Element<Schema.Any, Element.Token>>;
690
+ /**
691
+ * @since 3.10.0
692
+ */
693
+ type Rest = ReadonlyArray<Schema.Any | Element<Schema.Any, "">>;
694
+ /**
695
+ * @since 3.10.0
696
+ */
697
+ type Type<Elements extends TupleType.Elements, Rest extends TupleType.Rest> = Rest extends [
698
+ infer Head,
699
+ ...infer Tail
700
+ ] ? Readonly<[
701
+ ...ElementsType<Elements>,
702
+ ...ReadonlyArray<Schema.Type<Head>>,
703
+ ...{
704
+ readonly [K in keyof Tail]: Schema.Type<Tail[K]>;
705
+ }
706
+ ]> : ElementsType<Elements>;
707
+ /**
708
+ * @since 3.10.0
709
+ */
710
+ type Encoded<Elements extends TupleType.Elements, Rest extends TupleType.Rest> = Rest extends [
711
+ infer Head,
712
+ ...infer Tail
713
+ ] ? Readonly<[
714
+ ...ElementsEncoded<Elements>,
715
+ ...ReadonlyArray<Schema.Encoded<Head>>,
716
+ ...{
717
+ readonly [K in keyof Tail]: Schema.Encoded<Tail[K]>;
718
+ }
719
+ ]> : ElementsEncoded<Elements>;
720
+ }
721
+ /**
722
+ * @category api interface
723
+ * @since 3.10.0
724
+ */
725
+ export interface TupleType<Elements extends TupleType.Elements, Rest extends TupleType.Rest> extends AnnotableClass<TupleType<Elements, Rest>, TupleType.Type<Elements, Rest>, TupleType.Encoded<Elements, Rest>, Schema.Context<Elements[number]> | Schema.Context<Rest[number]>> {
726
+ readonly elements: Readonly<Elements>;
727
+ readonly rest: Readonly<Rest>;
728
+ }
729
+ /**
730
+ * @category api interface
731
+ * @since 3.10.0
732
+ */
733
+ export interface Tuple<Elements extends TupleType.Elements> extends TupleType<Elements, []> {
734
+ annotations(annotations: Annotations.Schema<TupleType.Type<Elements, []>>): Tuple<Elements>;
735
+ }
736
+ /**
737
+ * @category constructors
738
+ * @since 3.10.0
739
+ */
740
+ export declare function Tuple<const Elements extends TupleType.Elements, Rest extends array_.NonEmptyReadonlyArray<TupleType.Rest[number]>>(elements: Elements, ...rest: Rest): TupleType<Elements, Rest>;
741
+ export declare function Tuple<Elements extends TupleType.Elements>(...elements: Elements): Tuple<Elements>;
742
+ /**
743
+ * @category api interface
744
+ * @since 3.10.0
745
+ */
746
+ export interface Array$<Value extends Schema.Any> extends TupleType<[], [Value]> {
747
+ readonly value: Value;
748
+ annotations(annotations: Annotations.Schema<TupleType.Type<[], [Value]>>): Array$<Value>;
749
+ }
750
+ declare const Array$: <Value extends Schema.Any>(value: Value) => Array$<Value>;
751
+ export {
752
+ /**
753
+ * @category constructors
754
+ * @since 3.10.0
755
+ */
756
+ Array$ as Array };
757
+ /**
758
+ * @category api interface
759
+ * @since 3.10.0
760
+ */
761
+ export interface NonEmptyArray<Value extends Schema.Any> extends TupleType<[Value], [Value]> {
762
+ readonly value: Value;
763
+ annotations(annotations: Annotations.Schema<TupleType.Type<[Value], [Value]>>): NonEmptyArray<Value>;
764
+ }
765
+ /**
766
+ * @category constructors
767
+ * @since 3.10.0
768
+ */
769
+ export declare const NonEmptyArray: <Value extends Schema.Any>(value: Value) => NonEmptyArray<Value>;
770
+ /**
771
+ * @category api interface
772
+ * @since 3.10.0
773
+ */
774
+ export interface ArrayEnsure<Value extends Schema.Any> extends AnnotableClass<ArrayEnsure<Value>, ReadonlyArray<Schema.Type<Value>>, Schema.Encoded<Value> | ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
775
+ }
776
+ /**
777
+ * @category constructors
778
+ * @since 3.10.0
779
+ */
780
+ export declare const ArrayEnsure: <Value extends Schema.Any>(value: Value) => ArrayEnsure<Value>;
781
+ /**
782
+ * @category api interface
783
+ * @since 3.10.0
784
+ */
785
+ export interface NonEmptyArrayEnsure<Value extends Schema.Any> extends AnnotableClass<NonEmptyArrayEnsure<Value>, array_.NonEmptyReadonlyArray<Schema.Type<Value>>, Schema.Encoded<Value> | array_.NonEmptyReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
786
+ }
787
+ /**
788
+ * @category constructors
789
+ * @since 3.10.0
790
+ */
791
+ export declare const NonEmptyArrayEnsure: <Value extends Schema.Any>(value: Value) => NonEmptyArrayEnsure<Value>;
792
+ /**
793
+ * @since 3.10.0
794
+ */
795
+ export declare namespace PropertySignature {
796
+ /**
797
+ * @since 3.10.0
798
+ */
799
+ type Token = "?:" | ":";
800
+ /**
801
+ * @since 3.10.0
802
+ */
803
+ type Any<Key extends PropertyKey = PropertyKey> = PropertySignature<Token, any, Key, Token, any, boolean, unknown>;
804
+ /**
805
+ * @since 3.10.0
806
+ */
807
+ type All<Key extends PropertyKey = PropertyKey> = Any<Key> | PropertySignature<Token, never, Key, Token, any, boolean, unknown> | PropertySignature<Token, any, Key, Token, never, boolean, unknown> | PropertySignature<Token, never, Key, Token, never, boolean, unknown>;
808
+ /**
809
+ * @since 3.10.0
810
+ */
811
+ type AST = PropertySignatureDeclaration | PropertySignatureTransformation;
812
+ /**
813
+ * @since 3.10.0
814
+ */
815
+ interface Annotations<A> extends Annotations.Doc<A> {
816
+ readonly missingMessage?: AST.MissingMessageAnnotation;
817
+ }
818
+ }
819
+ /**
820
+ * @category PropertySignature
821
+ * @since 3.10.0
822
+ */
823
+ export declare class PropertySignatureDeclaration extends AST.OptionalType {
824
+ readonly isReadonly: boolean;
825
+ readonly defaultValue: (() => unknown) | undefined;
826
+ /**
827
+ * @since 3.10.0
828
+ */
829
+ readonly _tag = "PropertySignatureDeclaration";
830
+ constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, defaultValue: (() => unknown) | undefined);
831
+ /**
832
+ * @since 3.10.0
833
+ */
834
+ toString(): string;
835
+ }
836
+ /**
837
+ * @category PropertySignature
838
+ * @since 3.10.0
839
+ */
840
+ export declare class FromPropertySignature extends AST.OptionalType {
841
+ readonly isReadonly: boolean;
842
+ readonly fromKey?: PropertyKey | undefined;
843
+ constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, fromKey?: PropertyKey | undefined);
844
+ }
845
+ /**
846
+ * @category PropertySignature
847
+ * @since 3.10.0
848
+ */
849
+ export declare class ToPropertySignature extends AST.OptionalType {
850
+ readonly isReadonly: boolean;
851
+ readonly defaultValue: (() => unknown) | undefined;
852
+ constructor(type: AST.AST, isOptional: boolean, isReadonly: boolean, annotations: AST.Annotations, defaultValue: (() => unknown) | undefined);
853
+ }
854
+ /**
855
+ * @category PropertySignature
856
+ * @since 3.10.0
857
+ */
858
+ export declare class PropertySignatureTransformation {
859
+ readonly from: FromPropertySignature;
860
+ readonly to: ToPropertySignature;
861
+ readonly decode: AST.PropertySignatureTransformation["decode"];
862
+ readonly encode: AST.PropertySignatureTransformation["encode"];
863
+ /**
864
+ * @since 3.10.0
865
+ */
866
+ readonly _tag = "PropertySignatureTransformation";
867
+ constructor(from: FromPropertySignature, to: ToPropertySignature, decode: AST.PropertySignatureTransformation["decode"], encode: AST.PropertySignatureTransformation["encode"]);
868
+ /**
869
+ * @since 3.10.0
870
+ */
871
+ toString(): string;
872
+ }
873
+ /**
874
+ * @since 3.10.0
875
+ * @category symbol
876
+ */
877
+ export declare const PropertySignatureTypeId: unique symbol;
878
+ /**
879
+ * @since 3.10.0
880
+ * @category symbol
881
+ */
882
+ export type PropertySignatureTypeId = typeof PropertySignatureTypeId;
883
+ /**
884
+ * @since 3.10.0
885
+ * @category guards
886
+ */
887
+ export declare const isPropertySignature: (u: unknown) => u is PropertySignature.All;
888
+ /**
889
+ * @category PropertySignature
890
+ * @since 3.10.0
891
+ */
892
+ export interface PropertySignature<TypeToken extends PropertySignature.Token, Type, Key extends PropertyKey, EncodedToken extends PropertySignature.Token, Encoded, HasDefault extends boolean = false, R = never> extends Schema.Variance<Type, Encoded, R>, Pipeable {
893
+ readonly [PropertySignatureTypeId]: null;
894
+ readonly _TypeToken: TypeToken;
895
+ readonly _EncodedToken: EncodedToken;
896
+ readonly _HasDefault: HasDefault;
897
+ readonly _Key: Key;
898
+ readonly ast: PropertySignature.AST;
899
+ annotations(annotations: PropertySignature.Annotations<Type>): PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R>;
900
+ }
901
+ declare class PropertySignatureImpl<TypeToken extends PropertySignature.Token, Type, Key extends PropertyKey, EncodedToken extends PropertySignature.Token, Encoded, HasDefault extends boolean = false, R = never> implements PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R> {
902
+ readonly ast: PropertySignature.AST;
903
+ readonly [TypeId]: Schema.Variance<Type, Encoded, R>[TypeId];
904
+ readonly [PropertySignatureTypeId]: null;
905
+ readonly _TypeToken: TypeToken;
906
+ readonly _Key: Key;
907
+ readonly _EncodedToken: EncodedToken;
908
+ readonly _HasDefault: HasDefault;
909
+ constructor(ast: PropertySignature.AST);
910
+ pipe(): unknown;
911
+ annotations(annotations: PropertySignature.Annotations<Type>): PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R>;
912
+ toString(): string;
913
+ }
914
+ /**
915
+ * @category PropertySignature
916
+ * @since 3.10.0
917
+ */
918
+ export declare const makePropertySignature: <TypeToken extends PropertySignature.Token, Type, Key extends PropertyKey, EncodedToken extends PropertySignature.Token, Encoded, HasDefault extends boolean = false, R = never>(ast: PropertySignature.AST) => PropertySignatureImpl<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R>;
919
+ /**
920
+ * @category API interface
921
+ * @since 1.0.0
922
+ */
923
+ export interface propertySignature<S extends Schema.All> extends PropertySignature<":", Schema.Type<S>, never, ":", Schema.Encoded<S>, false, Schema.Context<S>> {
924
+ readonly from: S;
925
+ annotations(annotations: PropertySignature.Annotations<Schema.Type<S>>): propertySignature<S>;
926
+ }
927
+ /**
928
+ * Lifts a `Schema` into a `PropertySignature`.
929
+ *
930
+ * @category PropertySignature
931
+ * @since 3.10.0
932
+ */
933
+ export declare const propertySignature: <S extends Schema.All>(self: S) => propertySignature<S>;
934
+ /**
935
+ * Enhances a property signature with a default constructor value.
936
+ *
937
+ * @category PropertySignature
938
+ * @since 3.10.0
939
+ */
940
+ export declare const withConstructorDefault: {
941
+ /**
942
+ * Enhances a property signature with a default constructor value.
943
+ *
944
+ * @category PropertySignature
945
+ * @since 3.10.0
946
+ */
947
+ <Type>(defaultValue: () => Types.NoInfer<Type>): <TypeToken extends PropertySignature.Token, Key extends PropertyKey, EncodedToken extends PropertySignature.Token, Encoded, R>(self: PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, boolean, R>) => PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, true, R>;
948
+ /**
949
+ * Enhances a property signature with a default constructor value.
950
+ *
951
+ * @category PropertySignature
952
+ * @since 3.10.0
953
+ */
954
+ <TypeToken extends PropertySignature.Token, Type, Key extends PropertyKey, EncodedToken extends PropertySignature.Token, Encoded, R>(self: PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, boolean, R>, defaultValue: () => Types.NoInfer<Type>): PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, true, R>;
955
+ };
956
+ /**
957
+ * Enhances a property signature with a default decoding value.
958
+ *
959
+ * @category PropertySignature
960
+ * @since 3.10.0
961
+ */
962
+ export declare const withDecodingDefault: {
963
+ /**
964
+ * Enhances a property signature with a default decoding value.
965
+ *
966
+ * @category PropertySignature
967
+ * @since 3.10.0
968
+ */
969
+ <Type>(defaultValue: () => Types.NoInfer<Type>): <Key extends PropertyKey, Encoded, HasDefault extends boolean, R>(self: PropertySignature<"?:", Type, Key, "?:", Encoded, HasDefault, R>) => PropertySignature<":", Exclude<Type, undefined>, Key, "?:", Encoded, HasDefault, R>;
970
+ /**
971
+ * Enhances a property signature with a default decoding value.
972
+ *
973
+ * @category PropertySignature
974
+ * @since 3.10.0
975
+ */
976
+ <Type, Key extends PropertyKey, Encoded, HasDefault extends boolean, R>(self: PropertySignature<"?:", Type, Key, "?:", Encoded, HasDefault, R>, defaultValue: () => Types.NoInfer<Type>): PropertySignature<":", Exclude<Type, undefined>, Key, "?:", Encoded, HasDefault, R>;
977
+ };
978
+ /**
979
+ * Enhances a property signature with a default decoding value and a default constructor value.
980
+ *
981
+ * @category PropertySignature
982
+ * @since 3.10.0
983
+ */
984
+ export declare const withDefaults: {
985
+ /**
986
+ * Enhances a property signature with a default decoding value and a default constructor value.
987
+ *
988
+ * @category PropertySignature
989
+ * @since 3.10.0
990
+ */
991
+ <Type>(defaults: {
992
+ constructor: () => Types.NoInfer<Exclude<Type, undefined>>;
993
+ decoding: () => Types.NoInfer<Type>;
994
+ }): <Key extends PropertyKey, Encoded, R>(self: PropertySignature<"?:", Type, Key, "?:", Encoded, boolean, R>) => PropertySignature<":", Exclude<Type, undefined>, Key, "?:", Encoded, true, R>;
995
+ /**
996
+ * Enhances a property signature with a default decoding value and a default constructor value.
997
+ *
998
+ * @category PropertySignature
999
+ * @since 3.10.0
1000
+ */
1001
+ <Type, Key extends PropertyKey, Encoded, R>(self: PropertySignature<"?:", Type, Key, "?:", Encoded, boolean, R>, defaults: {
1002
+ constructor: () => Types.NoInfer<Exclude<Type, undefined>>;
1003
+ decoding: () => Types.NoInfer<Type>;
1004
+ }): PropertySignature<":", Exclude<Type, undefined>, Key, "?:", Encoded, true, R>;
1005
+ };
1006
+ /**
1007
+ * Enhances a property signature by specifying a different key for it in the Encoded type.
1008
+ *
1009
+ * @category PropertySignature
1010
+ * @since 3.10.0
1011
+ */
1012
+ export declare const fromKey: {
1013
+ /**
1014
+ * Enhances a property signature by specifying a different key for it in the Encoded type.
1015
+ *
1016
+ * @category PropertySignature
1017
+ * @since 3.10.0
1018
+ */
1019
+ <Key extends PropertyKey>(key: Key): <TypeToken extends PropertySignature.Token, Type, EncodedToken extends PropertySignature.Token, Encoded, HasDefault extends boolean, R>(self: PropertySignature<TypeToken, Type, PropertyKey, EncodedToken, Encoded, HasDefault, R>) => PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R>;
1020
+ /**
1021
+ * Enhances a property signature by specifying a different key for it in the Encoded type.
1022
+ *
1023
+ * @category PropertySignature
1024
+ * @since 3.10.0
1025
+ */
1026
+ <Type, TypeToken extends PropertySignature.Token, Encoded, EncodedToken extends PropertySignature.Token, HasDefault extends boolean, R, Key extends PropertyKey>(self: PropertySignature<TypeToken, Type, PropertyKey, EncodedToken, Encoded, HasDefault, R>, key: Key): PropertySignature<TypeToken, Type, Key, EncodedToken, Encoded, HasDefault, R>;
1027
+ };
1028
+ /**
1029
+ * Converts an optional property to a required one through a transformation `Option -> Type`.
1030
+ *
1031
+ * - `decode`: `none` as argument means the value is missing in the input.
1032
+ * - `encode`: `none` as return value means the value will be missing in the output.
1033
+ *
1034
+ * @category PropertySignature
1035
+ * @since 3.10.0
1036
+ */
1037
+ export declare const optionalToRequired: <FA, FI, FR, TA, TI, TR>(from: Schema<FA, FI, FR>, to: Schema<TA, TI, TR>, options: {
1038
+ readonly decode: (o: option_.Option<FA>) => TI;
1039
+ readonly encode: (ti: TI) => option_.Option<FA>;
1040
+ }) => PropertySignature<":", TA, never, "?:", FI, false, FR | TR>;
1041
+ /**
1042
+ * Converts an optional property to a required one through a transformation `Type -> Option`.
1043
+ *
1044
+ * - `decode`: `none` as return value means the value will be missing in the output.
1045
+ * - `encode`: `none` as argument means the value is missing in the input.
1046
+ *
1047
+ * @category PropertySignature
1048
+ * @since 3.10.0
1049
+ */
1050
+ export declare const requiredToOptional: <FA, FI, FR, TA, TI, TR>(from: Schema<FA, FI, FR>, to: Schema<TA, TI, TR>, options: {
1051
+ readonly decode: (fa: FA) => option_.Option<TI>;
1052
+ readonly encode: (o: option_.Option<TI>) => FA;
1053
+ }) => PropertySignature<"?:", TA, never, ":", FI, false, FR | TR>;
1054
+ /**
1055
+ * Converts an optional property to another optional property through a transformation `Option -> Option`.
1056
+ *
1057
+ * - `decode`:
1058
+ * - `none` as argument means the value is missing in the input.
1059
+ * - `none` as return value means the value will be missing in the output.
1060
+ * - `encode`:
1061
+ * - `none` as argument means the value is missing in the input.
1062
+ * - `none` as return value means the value will be missing in the output.
1063
+ *
1064
+ * @category PropertySignature
1065
+ * @since 3.10.0
1066
+ */
1067
+ export declare const optionalToOptional: <FA, FI, FR, TA, TI, TR>(from: Schema<FA, FI, FR>, to: Schema<TA, TI, TR>, options: {
1068
+ readonly decode: (o: option_.Option<FA>) => option_.Option<TI>;
1069
+ readonly encode: (o: option_.Option<TI>) => option_.Option<FA>;
1070
+ }) => PropertySignature<"?:", TA, never, "?:", FI, false, FR | TR>;
1071
+ /**
1072
+ * @since 3.10.0
1073
+ */
1074
+ export type OptionalOptions<A> = {
1075
+ readonly default?: never;
1076
+ readonly as?: never;
1077
+ readonly exact?: true;
1078
+ readonly nullable?: true;
1079
+ } | {
1080
+ readonly default: LazyArg<A>;
1081
+ readonly as?: never;
1082
+ readonly exact?: true;
1083
+ readonly nullable?: true;
1084
+ } | {
1085
+ readonly as: "Option";
1086
+ readonly default?: never;
1087
+ readonly exact?: never;
1088
+ readonly nullable?: never;
1089
+ readonly onNoneEncoding?: LazyArg<option_.Option<undefined>>;
1090
+ } | {
1091
+ readonly as: "Option";
1092
+ readonly default?: never;
1093
+ readonly exact?: never;
1094
+ readonly nullable: true;
1095
+ readonly onNoneEncoding?: LazyArg<option_.Option<null | undefined>>;
1096
+ } | {
1097
+ readonly as: "Option";
1098
+ readonly default?: never;
1099
+ readonly exact: true;
1100
+ readonly nullable?: never;
1101
+ readonly onNoneEncoding?: never;
1102
+ } | {
1103
+ readonly as: "Option";
1104
+ readonly default?: never;
1105
+ readonly exact: true;
1106
+ readonly nullable: true;
1107
+ readonly onNoneEncoding?: LazyArg<option_.Option<null>>;
1108
+ } | undefined;
1109
+ /**
1110
+ * @category api interface
1111
+ * @since 3.10.0
1112
+ */
1113
+ export interface optional<S extends Schema.All> extends PropertySignature<"?:", Schema.Type<S> | undefined, never, "?:", Schema.Encoded<S> | undefined, false, Schema.Context<S>> {
1114
+ readonly from: S;
1115
+ annotations(annotations: PropertySignature.Annotations<Schema.Type<S> | undefined>): optional<S>;
1116
+ }
1117
+ /**
1118
+ * @category api interface
1119
+ * @since 3.10.0
1120
+ */
1121
+ export interface optionalWith<S extends Schema.All, Options> extends PropertySignature<Types.Has<Options, "as" | "default"> extends true ? ":" : "?:", (Types.Has<Options, "as"> extends true ? option_.Option<Schema.Type<S>> : Schema.Type<S>) | (Types.Has<Options, "as" | "default" | "exact"> extends true ? never : undefined), never, "?:", Schema.Encoded<S> | (Types.Has<Options, "nullable"> extends true ? null : never) | (Types.Has<Options, "exact"> extends true ? never : undefined), Types.Has<Options, "default">, Schema.Context<S>> {
1122
+ readonly from: S;
1123
+ annotations(annotations: PropertySignature.Annotations<(Types.Has<Options, "as"> extends true ? option_.Option<Schema.Type<S>> : Schema.Type<S>) | (Types.Has<Options, "as" | "default" | "exact"> extends true ? never : undefined)>): optionalWith<S, Options>;
1124
+ }
1125
+ /**
1126
+ * @category PropertySignature
1127
+ * @since 3.10.0
1128
+ */
1129
+ export declare const optional: <S extends Schema.All>(self: S) => optional<S>;
1130
+ /**
1131
+ * @category PropertySignature
1132
+ * @since 3.10.0
1133
+ */
1134
+ export declare const optionalWith: {
1135
+ /**
1136
+ * @category PropertySignature
1137
+ * @since 3.10.0
1138
+ */
1139
+ <S extends Schema.All, Options extends OptionalOptions<Schema.Type<S>>>(options: Options): (self: S) => optionalWith<S, Options>;
1140
+ /**
1141
+ * @category PropertySignature
1142
+ * @since 3.10.0
1143
+ */
1144
+ <S extends Schema.All, Options extends OptionalOptions<Schema.Type<S>>>(self: S, options: Options): optionalWith<S, Options>;
1145
+ };
1146
+ /**
1147
+ * @since 3.10.0
1148
+ */
1149
+ export declare namespace Struct {
1150
+ /**
1151
+ * @since 3.10.0
1152
+ */
1153
+ type Fields = {
1154
+ readonly [x: PropertyKey]: Schema.All | PropertySignature.All;
1155
+ };
1156
+ type Key<F extends Fields, K extends keyof F> = [K] extends [never] ? never : F[K] extends PropertySignature.All<infer Key> ? [Key] extends [never] ? K : Key : K;
1157
+ type EncodedTokenKeys<Fields extends Struct.Fields> = {
1158
+ [K in keyof Fields]: Fields[K] extends PropertySignature<PropertySignature.Token, any, PropertyKey, "?:", any, boolean, unknown> | PropertySignature<PropertySignature.Token, any, PropertyKey, "?:", never, boolean, unknown> | PropertySignature<PropertySignature.Token, never, PropertyKey, "?:", any, boolean, unknown> | PropertySignature<PropertySignature.Token, never, PropertyKey, "?:", never, boolean, unknown> ? K : never;
1159
+ }[keyof Fields];
1160
+ type TypeTokenKeys<Fields extends Struct.Fields> = {
1161
+ [K in keyof Fields]: Fields[K] extends OptionalPropertySignature ? K : never;
1162
+ }[keyof Fields];
1163
+ type OptionalPropertySignature = PropertySignature<"?:", any, PropertyKey, PropertySignature.Token, any, boolean, unknown> | PropertySignature<"?:", any, PropertyKey, PropertySignature.Token, never, boolean, unknown> | PropertySignature<"?:", never, PropertyKey, PropertySignature.Token, any, boolean, unknown> | PropertySignature<"?:", never, PropertyKey, PropertySignature.Token, never, boolean, unknown>;
1164
+ /**
1165
+ * @since 3.10.0
1166
+ */
1167
+ type Type<F extends Fields> = Types.UnionToIntersection<{
1168
+ [K in keyof F]: F[K] extends OptionalPropertySignature ? {
1169
+ readonly [H in K]?: Schema.Type<F[H]>;
1170
+ } : {
1171
+ readonly [h in K]: Schema.Type<F[h]>;
1172
+ };
1173
+ }[keyof F]> extends infer Q ? Q : never;
1174
+ /**
1175
+ * @since 3.10.0
1176
+ */
1177
+ type Encoded<F extends Fields> = {
1178
+ readonly [K in Exclude<keyof F, EncodedTokenKeys<F>> as Key<F, K>]: Schema.Encoded<F[K]>;
1179
+ } & {
1180
+ readonly [K in EncodedTokenKeys<F> as Key<F, K>]?: Schema.Encoded<F[K]>;
1181
+ };
1182
+ /**
1183
+ * @since 3.10.0
1184
+ */
1185
+ type Context<F extends Fields> = Schema.Context<F[keyof F]>;
1186
+ type PropertySignatureWithDefault = PropertySignature<PropertySignature.Token, any, PropertyKey, PropertySignature.Token, any, true, unknown> | PropertySignature<PropertySignature.Token, any, PropertyKey, PropertySignature.Token, never, true, unknown> | PropertySignature<PropertySignature.Token, never, PropertyKey, PropertySignature.Token, any, true, unknown> | PropertySignature<PropertySignature.Token, never, PropertyKey, PropertySignature.Token, never, true, unknown>;
1187
+ /**
1188
+ * @since 3.10.0
1189
+ */
1190
+ type Constructor<F extends Fields> = Types.UnionToIntersection<{
1191
+ [K in keyof F]: F[K] extends OptionalPropertySignature ? {
1192
+ readonly [H in K]?: Schema.Type<F[H]>;
1193
+ } : F[K] extends PropertySignatureWithDefault ? {
1194
+ readonly [H in K]?: Schema.Type<F[H]>;
1195
+ } : {
1196
+ readonly [h in K]: Schema.Type<F[h]>;
1197
+ };
1198
+ }[keyof F]> extends infer Q ? Q : never;
1199
+ }
1200
+ /**
1201
+ * @since 3.10.0
1202
+ */
1203
+ export declare namespace IndexSignature {
1204
+ /**
1205
+ * @since 3.10.0
1206
+ */
1207
+ type Record = {
1208
+ readonly key: Schema.All;
1209
+ readonly value: Schema.All;
1210
+ };
1211
+ /**
1212
+ * @since 3.10.0
1213
+ */
1214
+ type Records = ReadonlyArray<Record>;
1215
+ /**
1216
+ * @since 3.10.0
1217
+ */
1218
+ type NonEmptyRecords = array_.NonEmptyReadonlyArray<Record>;
1219
+ /**
1220
+ * @since 3.10.0
1221
+ */
1222
+ type Type<Records extends IndexSignature.Records> = Types.UnionToIntersection<{
1223
+ [K in keyof Records]: {
1224
+ readonly [P in Schema.Type<Records[K]["key"]>]: Schema.Type<Records[K]["value"]>;
1225
+ };
1226
+ }[number]>;
1227
+ /**
1228
+ * @since 3.10.0
1229
+ */
1230
+ type Encoded<Records extends IndexSignature.Records> = Types.UnionToIntersection<{
1231
+ [K in keyof Records]: {
1232
+ readonly [P in Schema.Encoded<Records[K]["key"]>]: Schema.Encoded<Records[K]["value"]>;
1233
+ };
1234
+ }[number]>;
1235
+ /**
1236
+ * @since 3.10.0
1237
+ */
1238
+ type Context<Records extends IndexSignature.Records> = {
1239
+ [K in keyof Records]: Schema.Context<Records[K]["key"]> | Schema.Context<Records[K]["value"]>;
1240
+ }[number];
1241
+ }
1242
+ /**
1243
+ * @since 3.10.0
1244
+ */
1245
+ export declare namespace TypeLiteral {
1246
+ /**
1247
+ * @since 3.10.0
1248
+ */
1249
+ type Type<Fields extends Struct.Fields, Records extends IndexSignature.Records> = Struct.Type<Fields> & IndexSignature.Type<Records>;
1250
+ /**
1251
+ * @since 3.10.0
1252
+ */
1253
+ type Encoded<Fields extends Struct.Fields, Records extends IndexSignature.Records> = Struct.Encoded<Fields> & IndexSignature.Encoded<Records>;
1254
+ /**
1255
+ * @since 3.10.0
1256
+ */
1257
+ type Constructor<Fields extends Struct.Fields, Records extends IndexSignature.Records> = Struct.Constructor<Fields> & IndexSignature.Type<Records>;
1258
+ }
1259
+ /**
1260
+ * @category api interface
1261
+ * @since 3.10.0
1262
+ */
1263
+ export interface TypeLiteral<Fields extends Struct.Fields, Records extends IndexSignature.Records> extends AnnotableClass<TypeLiteral<Fields, Records>, Simplify<TypeLiteral.Type<Fields, Records>>, Simplify<TypeLiteral.Encoded<Fields, Records>>, Struct.Context<Fields> | IndexSignature.Context<Records>> {
1264
+ readonly fields: {
1265
+ readonly [K in keyof Fields]: Fields[K];
1266
+ };
1267
+ readonly records: Readonly<Records>;
1268
+ annotations(annotations: Annotations.Schema<Simplify<TypeLiteral.Type<Fields, Records>>>): TypeLiteral<Fields, Records>;
1269
+ make(props: Simplify<TypeLiteral.Constructor<Fields, Records>>, options?: MakeOptions): Simplify<TypeLiteral.Type<Fields, Records>>;
1270
+ }
1271
+ /**
1272
+ * @category api interface
1273
+ * @since 3.10.0
1274
+ */
1275
+ export interface Struct<Fields extends Struct.Fields> extends TypeLiteral<Fields, []> {
1276
+ annotations(annotations: Annotations.Schema<Simplify<Struct.Type<Fields>>>): Struct<Fields>;
1277
+ pick<Keys extends ReadonlyArray<keyof Fields>>(...keys: Keys): Struct<Simplify<Pick<Fields, Keys[number]>>>;
1278
+ omit<Keys extends ReadonlyArray<keyof Fields>>(...keys: Keys): Struct<Simplify<Omit<Fields, Keys[number]>>>;
1279
+ }
1280
+ /**
1281
+ * @category constructors
1282
+ * @since 3.10.0
1283
+ */
1284
+ export declare function Struct<Fields extends Struct.Fields, const Records extends IndexSignature.NonEmptyRecords>(fields: Fields, ...records: Records): TypeLiteral<Fields, Records>;
1285
+ export declare function Struct<Fields extends Struct.Fields>(fields: Fields): Struct<Fields>;
1286
+ /**
1287
+ * @category api interface
1288
+ * @since 3.10.0
1289
+ */
1290
+ export interface tag<Tag extends AST.LiteralValue> extends PropertySignature<":", Tag, never, ":", Tag, true, never> {
1291
+ }
1292
+ /**
1293
+ * Returns a property signature that represents a tag.
1294
+ * A tag is a literal value that is used to distinguish between different types of objects.
1295
+ * The tag is optional when using the `make` method.
1296
+ *
1297
+ * @see {@link TaggedStruct}
1298
+ *
1299
+ * @example
1300
+ * import { Schema } from "effect"
1301
+ *
1302
+ * const User = Schema.Struct({
1303
+ * _tag: Schema.tag("User"),
1304
+ * name: Schema.String,
1305
+ * age: Schema.Number
1306
+ * })
1307
+ *
1308
+ * assert.deepStrictEqual(User.make({ name: "John", age: 44 }), { _tag: "User", name: "John", age: 44 })
1309
+ *
1310
+ * @since 3.10.0
1311
+ */
1312
+ export declare const tag: <Tag extends AST.LiteralValue>(tag: Tag) => tag<Tag>;
1313
+ /**
1314
+ * @category api interface
1315
+ * @since 3.10.0
1316
+ */
1317
+ export type TaggedStruct<Tag extends AST.LiteralValue, Fields extends Struct.Fields> = Struct<{
1318
+ _tag: tag<Tag>;
1319
+ } & Fields>;
1320
+ /**
1321
+ * A tagged struct is a struct that has a tag property that is used to distinguish between different types of objects.
1322
+ *
1323
+ * The tag is optional when using the `make` method.
1324
+ *
1325
+ * @example
1326
+ * import { Schema } from "effect"
1327
+ *
1328
+ * const User = Schema.TaggedStruct("User", {
1329
+ * name: Schema.String,
1330
+ * age: Schema.Number
1331
+ * })
1332
+ *
1333
+ * assert.deepStrictEqual(User.make({ name: "John", age: 44 }), { _tag: "User", name: "John", age: 44 })
1334
+ *
1335
+ * @category constructors
1336
+ * @since 3.10.0
1337
+ */
1338
+ export declare const TaggedStruct: <Tag extends AST.LiteralValue, Fields extends Struct.Fields>(value: Tag, fields: Fields) => TaggedStruct<Tag, Fields>;
1339
+ /**
1340
+ * @category api interface
1341
+ * @since 3.10.0
1342
+ */
1343
+ export interface Record$<K extends Schema.All, V extends Schema.All> extends TypeLiteral<{}, [{
1344
+ key: K;
1345
+ value: V;
1346
+ }]> {
1347
+ readonly key: K;
1348
+ readonly value: V;
1349
+ annotations(annotations: Annotations.Schema<Simplify<TypeLiteral.Type<{}, [{
1350
+ key: K;
1351
+ value: V;
1352
+ }]>>>): Record$<K, V>;
1353
+ }
1354
+ /**
1355
+ * @category constructors
1356
+ * @since 3.10.0
1357
+ */
1358
+ export declare const Record: <K extends Schema.All, V extends Schema.All>(options: {
1359
+ readonly key: K;
1360
+ readonly value: V;
1361
+ }) => Record$<K, V>;
1362
+ /**
1363
+ * @category struct transformations
1364
+ * @since 3.10.0
1365
+ */
1366
+ export declare const pick: <A, I, Keys extends ReadonlyArray<keyof A & keyof I>>(...keys: Keys) => <R>(self: Schema<A, I, R>) => SchemaClass<Simplify<Pick<A, Keys[number]>>, Simplify<Pick<I, Keys[number]>>, R>;
1367
+ /**
1368
+ * @category struct transformations
1369
+ * @since 3.10.0
1370
+ */
1371
+ export declare const omit: <A, I, Keys extends ReadonlyArray<keyof A & keyof I>>(...keys: Keys) => <R>(self: Schema<A, I, R>) => SchemaClass<Simplify<Omit<A, Keys[number]>>, Simplify<Omit<I, Keys[number]>>, R>;
1372
+ /**
1373
+ * Given a schema `Schema<A, I, R>` and a key `key: K`, this function extracts a specific field from the `A` type,
1374
+ * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`.
1375
+ *
1376
+ * @example
1377
+ * import * as Schema from "effect/Schema"
1378
+ *
1379
+ * // ---------------------------------------------
1380
+ * // use case: pull out a single field from a
1381
+ * // struct through a transformation
1382
+ * // ---------------------------------------------
1383
+ *
1384
+ * const mytable = Schema.Struct({
1385
+ * column1: Schema.NumberFromString,
1386
+ * column2: Schema.Number
1387
+ * })
1388
+ *
1389
+ * // const pullOutColumn: S.Schema<number, {
1390
+ * // readonly column1: string;
1391
+ * // }, never>
1392
+ * const pullOutColumn = mytable.pipe(Schema.pluck("column1"))
1393
+ *
1394
+ * console.log(Schema.decodeUnknownEither(Schema.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }]))
1395
+ * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] }
1396
+ *
1397
+ * @category struct transformations
1398
+ * @since 3.10.0
1399
+ */
1400
+ export declare const pluck: {
1401
+ /**
1402
+ * Given a schema `Schema<A, I, R>` and a key `key: K`, this function extracts a specific field from the `A` type,
1403
+ * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`.
1404
+ *
1405
+ * @example
1406
+ * import * as Schema from "effect/Schema"
1407
+ *
1408
+ * // ---------------------------------------------
1409
+ * // use case: pull out a single field from a
1410
+ * // struct through a transformation
1411
+ * // ---------------------------------------------
1412
+ *
1413
+ * const mytable = Schema.Struct({
1414
+ * column1: Schema.NumberFromString,
1415
+ * column2: Schema.Number
1416
+ * })
1417
+ *
1418
+ * // const pullOutColumn: S.Schema<number, {
1419
+ * // readonly column1: string;
1420
+ * // }, never>
1421
+ * const pullOutColumn = mytable.pipe(Schema.pluck("column1"))
1422
+ *
1423
+ * console.log(Schema.decodeUnknownEither(Schema.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }]))
1424
+ * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] }
1425
+ *
1426
+ * @category struct transformations
1427
+ * @since 3.10.0
1428
+ */
1429
+ <A, I, K extends keyof A & keyof I>(key: K): <R>(schema: Schema<A, I, R>) => Schema<A[K], {
1430
+ readonly [P in K]: I[P];
1431
+ }, R>;
1432
+ /**
1433
+ * Given a schema `Schema<A, I, R>` and a key `key: K`, this function extracts a specific field from the `A` type,
1434
+ * producing a new schema that represents a transformation from the `{ readonly [key]: I[K] }` type to `A[K]`.
1435
+ *
1436
+ * @example
1437
+ * import * as Schema from "effect/Schema"
1438
+ *
1439
+ * // ---------------------------------------------
1440
+ * // use case: pull out a single field from a
1441
+ * // struct through a transformation
1442
+ * // ---------------------------------------------
1443
+ *
1444
+ * const mytable = Schema.Struct({
1445
+ * column1: Schema.NumberFromString,
1446
+ * column2: Schema.Number
1447
+ * })
1448
+ *
1449
+ * // const pullOutColumn: S.Schema<number, {
1450
+ * // readonly column1: string;
1451
+ * // }, never>
1452
+ * const pullOutColumn = mytable.pipe(Schema.pluck("column1"))
1453
+ *
1454
+ * console.log(Schema.decodeUnknownEither(Schema.Array(pullOutColumn))([{ column1: "1", column2: 100 }, { column1: "2", column2: 300 }]))
1455
+ * // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] }
1456
+ *
1457
+ * @category struct transformations
1458
+ * @since 3.10.0
1459
+ */
1460
+ <A, I, R, K extends keyof A & keyof I>(schema: Schema<A, I, R>, key: K): Schema<A[K], {
1461
+ readonly [P in K]: I[P];
1462
+ }, R>;
1463
+ };
1464
+ /**
1465
+ * @category branding
1466
+ * @since 3.10.0
1467
+ */
1468
+ export interface BrandSchema<A extends Brand<any>, I = A, R = never> extends AnnotableClass<BrandSchema<A, I, R>, A, I, R> {
1469
+ make(a: Brand.Unbranded<A>, options?: MakeOptions): A;
1470
+ }
1471
+ /**
1472
+ * @category api interface
1473
+ * @since 3.10.0
1474
+ */
1475
+ export interface brand<S extends Schema.Any, B extends string | symbol> extends BrandSchema<Schema.Type<S> & Brand<B>, Schema.Encoded<S>, Schema.Context<S>> {
1476
+ annotations(annotations: Annotations.Schema<Schema.Type<S> & Brand<B>>): brand<S, B>;
1477
+ }
1478
+ /**
1479
+ * Returns a nominal branded schema by applying a brand to a given schema.
1480
+ *
1481
+ * ```
1482
+ * Schema<A> + B -> Schema<A & Brand<B>>
1483
+ * ```
1484
+ *
1485
+ * @param self - The input schema to be combined with the brand.
1486
+ * @param brand - The brand to apply.
1487
+ *
1488
+ * @example
1489
+ * import * as Schema from "effect/Schema"
1490
+ *
1491
+ * const Int = Schema.Number.pipe(Schema.int(), Schema.brand("Int"))
1492
+ * type Int = Schema.Schema.Type<typeof Int> // number & Brand<"Int">
1493
+ *
1494
+ * @category branding
1495
+ * @since 3.10.0
1496
+ */
1497
+ export declare const brand: <S extends Schema.AnyNoContext, B extends string | symbol>(brand: B, annotations?: Annotations.Schema<Schema.Type<S> & Brand<B>>) => (self: S) => brand<S, B>;
1498
+ /**
1499
+ * @category combinators
1500
+ * @since 3.10.0
1501
+ */
1502
+ export declare const partial: <A, I, R>(self: Schema<A, I, R>) => SchemaClass<{ [K in keyof A]?: A[K] | undefined; }, { [K in keyof I]?: I[K] | undefined; }, R>;
1503
+ /**
1504
+ * @category combinators
1505
+ * @since 3.10.0
1506
+ */
1507
+ export declare const partialWith: {
1508
+ /**
1509
+ * @category combinators
1510
+ * @since 3.10.0
1511
+ */
1512
+ <const Options extends {
1513
+ readonly exact: true;
1514
+ }>(options: Options): <A, I, R>(self: Schema<A, I, R>) => SchemaClass<{
1515
+ [K in keyof A]?: A[K];
1516
+ }, {
1517
+ [K in keyof I]?: I[K];
1518
+ }, R>;
1519
+ /**
1520
+ * @category combinators
1521
+ * @since 3.10.0
1522
+ */
1523
+ <A, I, R, const Options extends {
1524
+ readonly exact: true;
1525
+ } | undefined>(self: Schema<A, I, R>, options: Options): SchemaClass<{
1526
+ [K in keyof A]?: A[K];
1527
+ }, {
1528
+ [K in keyof I]?: I[K];
1529
+ }, R>;
1530
+ };
1531
+ /**
1532
+ * @category combinators
1533
+ * @since 3.10.0
1534
+ */
1535
+ export declare const required: <A, I, R>(self: Schema<A, I, R>) => SchemaClass<{ [K in keyof A]-?: A[K]; }, { [K in keyof I]-?: I[K]; }, R>;
1536
+ /**
1537
+ * @category api interface
1538
+ * @since 3.10.0
1539
+ */
1540
+ export interface mutable<S extends Schema.Any> extends AnnotableClass<mutable<S>, SimplifyMutable<Schema.Type<S>>, SimplifyMutable<Schema.Encoded<S>>, Schema.Context<S>> {
1541
+ }
1542
+ /**
1543
+ * Creates a new schema with shallow mutability applied to its properties.
1544
+ *
1545
+ * @param schema - The original schema to make properties mutable (shallowly).
1546
+ *
1547
+ * @category combinators
1548
+ * @since 3.10.0
1549
+ */
1550
+ export declare const mutable: <S extends Schema.Any>(schema: S) => mutable<S>;
1551
+ /**
1552
+ * @category api interface
1553
+ * @since 3.10.0
1554
+ */
1555
+ export interface extend<Self extends Schema.Any, That extends Schema.Any> extends AnnotableClass<extend<Self, That>, Schema.Type<Self> & Schema.Type<That>, Schema.Encoded<Self> & Schema.Encoded<That>, Schema.Context<Self> | Schema.Context<That>> {
1556
+ }
1557
+ /**
1558
+ * Extends a schema with another schema.
1559
+ *
1560
+ * Not all extensions are supported, and their support depends on the nature of the involved schemas.
1561
+ *
1562
+ * Possible extensions include:
1563
+ * - `Schema.String` with another `Schema.String` refinement or a string literal
1564
+ * - `Schema.Number` with another `Schema.Number` refinement or a number literal
1565
+ * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal
1566
+ * - A struct with another struct where overlapping fields support extension
1567
+ * - A struct with in index signature
1568
+ * - A struct with a union of supported schemas
1569
+ * - A refinement of a struct with a supported schema
1570
+ * - A suspend of a struct with a supported schema
1571
+ *
1572
+ * @example
1573
+ * import * as Schema from "effect/Schema"
1574
+ *
1575
+ * const schema = Schema.Struct({
1576
+ * a: Schema.String,
1577
+ * b: Schema.String
1578
+ * })
1579
+ *
1580
+ * // const extended: Schema<
1581
+ * // {
1582
+ * // readonly a: string
1583
+ * // readonly b: string
1584
+ * // } & {
1585
+ * // readonly c: string
1586
+ * // } & {
1587
+ * // readonly [x: string]: string
1588
+ * // }
1589
+ * // >
1590
+ * const extended = Schema.asSchema(schema.pipe(
1591
+ * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields
1592
+ * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures
1593
+ * ))
1594
+ *
1595
+ * @category combinators
1596
+ * @since 3.10.0
1597
+ */
1598
+ export declare const extend: {
1599
+ /**
1600
+ * Extends a schema with another schema.
1601
+ *
1602
+ * Not all extensions are supported, and their support depends on the nature of the involved schemas.
1603
+ *
1604
+ * Possible extensions include:
1605
+ * - `Schema.String` with another `Schema.String` refinement or a string literal
1606
+ * - `Schema.Number` with another `Schema.Number` refinement or a number literal
1607
+ * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal
1608
+ * - A struct with another struct where overlapping fields support extension
1609
+ * - A struct with in index signature
1610
+ * - A struct with a union of supported schemas
1611
+ * - A refinement of a struct with a supported schema
1612
+ * - A suspend of a struct with a supported schema
1613
+ *
1614
+ * @example
1615
+ * import * as Schema from "effect/Schema"
1616
+ *
1617
+ * const schema = Schema.Struct({
1618
+ * a: Schema.String,
1619
+ * b: Schema.String
1620
+ * })
1621
+ *
1622
+ * // const extended: Schema<
1623
+ * // {
1624
+ * // readonly a: string
1625
+ * // readonly b: string
1626
+ * // } & {
1627
+ * // readonly c: string
1628
+ * // } & {
1629
+ * // readonly [x: string]: string
1630
+ * // }
1631
+ * // >
1632
+ * const extended = Schema.asSchema(schema.pipe(
1633
+ * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields
1634
+ * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures
1635
+ * ))
1636
+ *
1637
+ * @category combinators
1638
+ * @since 3.10.0
1639
+ */
1640
+ <That extends Schema.Any>(that: That): <Self extends Schema.Any>(self: Self) => extend<Self, That>;
1641
+ /**
1642
+ * Extends a schema with another schema.
1643
+ *
1644
+ * Not all extensions are supported, and their support depends on the nature of the involved schemas.
1645
+ *
1646
+ * Possible extensions include:
1647
+ * - `Schema.String` with another `Schema.String` refinement or a string literal
1648
+ * - `Schema.Number` with another `Schema.Number` refinement or a number literal
1649
+ * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal
1650
+ * - A struct with another struct where overlapping fields support extension
1651
+ * - A struct with in index signature
1652
+ * - A struct with a union of supported schemas
1653
+ * - A refinement of a struct with a supported schema
1654
+ * - A suspend of a struct with a supported schema
1655
+ *
1656
+ * @example
1657
+ * import * as Schema from "effect/Schema"
1658
+ *
1659
+ * const schema = Schema.Struct({
1660
+ * a: Schema.String,
1661
+ * b: Schema.String
1662
+ * })
1663
+ *
1664
+ * // const extended: Schema<
1665
+ * // {
1666
+ * // readonly a: string
1667
+ * // readonly b: string
1668
+ * // } & {
1669
+ * // readonly c: string
1670
+ * // } & {
1671
+ * // readonly [x: string]: string
1672
+ * // }
1673
+ * // >
1674
+ * const extended = Schema.asSchema(schema.pipe(
1675
+ * Schema.extend(Schema.Struct({ c: Schema.String })), // <= you can add more fields
1676
+ * Schema.extend(Schema.Record({ key: Schema.String, value: Schema.String })) // <= you can add index signatures
1677
+ * ))
1678
+ *
1679
+ * @category combinators
1680
+ * @since 3.10.0
1681
+ */
1682
+ <Self extends Schema.Any, That extends Schema.Any>(self: Self, that: That): extend<Self, That>;
1683
+ };
1684
+ /**
1685
+ * @category combinators
1686
+ * @since 3.10.0
1687
+ */
1688
+ export declare const compose: {
1689
+ /**
1690
+ * @category combinators
1691
+ * @since 3.10.0
1692
+ */
1693
+ <D, C extends B, R2, B>(to: Schema<D, C, R2>): <A, R1>(from: Schema<B, A, R1>) => SchemaClass<D, A, R1 | R2>;
1694
+ /**
1695
+ * @category combinators
1696
+ * @since 3.10.0
1697
+ */
1698
+ <D, C, R2>(to: Schema<D, C, R2>): <B extends C, A, R1>(from: Schema<B, A, R1>) => SchemaClass<D, A, R1 | R2>;
1699
+ /**
1700
+ * @category combinators
1701
+ * @since 3.10.0
1702
+ */
1703
+ <C, B, R2>(to: Schema<C, B, R2>, options?: {
1704
+ readonly strict: true;
1705
+ }): <A, R1>(from: Schema<B, A, R1>) => SchemaClass<C, A, R1 | R2>;
1706
+ /**
1707
+ * @category combinators
1708
+ * @since 3.10.0
1709
+ */
1710
+ <D, C, R2>(to: Schema<D, C, R2>, options: {
1711
+ readonly strict: false;
1712
+ }): <B, A, R1>(from: Schema<B, A, R1>) => SchemaClass<D, A, R1 | R2>;
1713
+ /**
1714
+ * @category combinators
1715
+ * @since 3.10.0
1716
+ */
1717
+ <B, A, R1, D, C extends B, R2>(from: Schema<B, A, R1>, to: Schema<D, C, R2>): SchemaClass<D, A, R1 | R2>;
1718
+ /**
1719
+ * @category combinators
1720
+ * @since 3.10.0
1721
+ */
1722
+ <B extends C, A, R1, D, C, R2>(from: Schema<B, A, R1>, to: Schema<D, C, R2>): SchemaClass<D, A, R1 | R2>;
1723
+ /**
1724
+ * @category combinators
1725
+ * @since 3.10.0
1726
+ */
1727
+ <B, A, R1, C, R2>(from: Schema<B, A, R1>, to: Schema<C, B, R2>, options?: {
1728
+ readonly strict: true;
1729
+ }): SchemaClass<C, A, R1 | R2>;
1730
+ /**
1731
+ * @category combinators
1732
+ * @since 3.10.0
1733
+ */
1734
+ <B, A, R1, D, C, R2>(from: Schema<B, A, R1>, to: Schema<D, C, R2>, options: {
1735
+ readonly strict: false;
1736
+ }): SchemaClass<D, A, R1 | R2>;
1737
+ };
1738
+ /**
1739
+ * @category api interface
1740
+ * @since 3.10.0
1741
+ */
1742
+ export interface suspend<A, I, R> extends AnnotableClass<suspend<A, I, R>, A, I, R> {
1743
+ }
1744
+ /**
1745
+ * @category constructors
1746
+ * @since 3.10.0
1747
+ */
1748
+ export declare const suspend: <A, I, R>(f: () => Schema<A, I, R>) => suspend<A, I, R>;
1749
+ /**
1750
+ * @since 3.10.0
1751
+ * @category symbol
1752
+ */
1753
+ export declare const RefineSchemaId: unique symbol;
1754
+ /**
1755
+ * @since 3.10.0
1756
+ * @category symbol
1757
+ */
1758
+ export type RefineSchemaId = typeof RefineSchemaId;
1759
+ /**
1760
+ * @category api interface
1761
+ * @since 3.10.0
1762
+ */
1763
+ export interface refine<A, From extends Schema.Any> extends AnnotableClass<refine<A, From>, A, Schema.Encoded<From>, Schema.Context<From>> {
1764
+ readonly [RefineSchemaId]: From;
1765
+ readonly from: From;
1766
+ readonly filter: (a: Schema.Type<From>, options: ParseOptions, self: AST.Refinement) => option_.Option<ParseResult.ParseIssue>;
1767
+ make(a: Schema.Type<From>, options?: MakeOptions): A;
1768
+ }
1769
+ /**
1770
+ * @category api interface
1771
+ * @since 3.10.0
1772
+ */
1773
+ export interface filter<From extends Schema.Any> extends refine<Schema.Type<From>, From> {
1774
+ }
1775
+ /**
1776
+ * @category filtering
1777
+ * @since 3.10.0
1778
+ */
1779
+ export interface FilterIssue {
1780
+ readonly path: ReadonlyArray<PropertyKey>;
1781
+ readonly message: string;
1782
+ }
1783
+ /**
1784
+ * @category filtering
1785
+ * @since 3.10.0
1786
+ */
1787
+ export type FilterOutput = undefined | boolean | string | ParseResult.ParseIssue | FilterIssue;
1788
+ type FilterReturnType = FilterOutput | ReadonlyArray<FilterOutput>;
1789
+ /**
1790
+ * @category filtering
1791
+ * @since 3.10.0
1792
+ */
1793
+ export declare function filter<C extends A, B extends A, A = C>(refinement: (a: A, options: ParseOptions, self: AST.Refinement) => a is B, annotations?: Annotations.Filter<C & B, C>): <I, R>(self: Schema<C, I, R>) => refine<C & B, Schema<A, I, R>>;
1794
+ export declare function filter<A, B extends A>(refinement: (a: A, options: ParseOptions, self: AST.Refinement) => a is B, annotations?: Annotations.Filter<B, A>): <I, R>(self: Schema<A, I, R>) => refine<B, Schema<A, I, R>>;
1795
+ export declare function filter<S extends Schema.Any>(predicate: (a: Types.NoInfer<Schema.Type<S>>, options: ParseOptions, self: AST.Refinement) => FilterReturnType, annotations?: Annotations.Filter<Types.NoInfer<Schema.Type<S>>>): (self: S) => filter<S>;
1796
+ /**
1797
+ * @category api interface
1798
+ * @since 3.10.0
1799
+ */
1800
+ export interface filterEffect<S extends Schema.Any, FD = never> extends transformOrFail<S, SchemaClass<Schema.Type<S>>, FD> {
1801
+ }
1802
+ /**
1803
+ * @category transformations
1804
+ * @since 3.10.0
1805
+ */
1806
+ export declare const filterEffect: {
1807
+ /**
1808
+ * @category transformations
1809
+ * @since 3.10.0
1810
+ */
1811
+ <S extends Schema.Any, FD>(f: (a: Types.NoInfer<Schema.Type<S>>, options: ParseOptions, self: AST.Transformation) => Effect.Effect<FilterReturnType, never, FD>): (self: S) => filterEffect<S, FD>;
1812
+ /**
1813
+ * @category transformations
1814
+ * @since 3.10.0
1815
+ */
1816
+ <S extends Schema.Any, RD>(self: S, f: (a: Types.NoInfer<Schema.Type<S>>, options: ParseOptions, self: AST.Transformation) => Effect.Effect<FilterReturnType, never, RD>): filterEffect<S, RD>;
1817
+ };
1818
+ /**
1819
+ * @category api interface
1820
+ * @since 3.10.0
1821
+ */
1822
+ export interface transformOrFail<From extends Schema.Any, To extends Schema.Any, R = never> extends AnnotableClass<transformOrFail<From, To, R>, Schema.Type<To>, Schema.Encoded<From>, Schema.Context<From> | Schema.Context<To> | R> {
1823
+ readonly from: From;
1824
+ readonly to: To;
1825
+ }
1826
+ /**
1827
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1828
+ * using the provided decoding functions.
1829
+ *
1830
+ * @category transformations
1831
+ * @since 3.10.0
1832
+ */
1833
+ export declare const transformOrFail: {
1834
+ /**
1835
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1836
+ * using the provided decoding functions.
1837
+ *
1838
+ * @category transformations
1839
+ * @since 3.10.0
1840
+ */
1841
+ <To extends Schema.Any, From extends Schema.Any, RD, RE>(to: To, options: {
1842
+ readonly decode: (fromA: Schema.Type<From>, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded<From>) => Effect.Effect<Schema.Encoded<To>, ParseResult.ParseIssue, RD>;
1843
+ readonly encode: (toI: Schema.Encoded<To>, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type<To>) => Effect.Effect<Schema.Type<From>, ParseResult.ParseIssue, RE>;
1844
+ readonly strict?: true;
1845
+ } | {
1846
+ readonly decode: (fromA: Schema.Type<From>, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded<From>) => Effect.Effect<unknown, ParseResult.ParseIssue, RD>;
1847
+ readonly encode: (toI: Schema.Encoded<To>, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type<To>) => Effect.Effect<unknown, ParseResult.ParseIssue, RE>;
1848
+ readonly strict: false;
1849
+ }): (from: From) => transformOrFail<From, To, RD | RE>;
1850
+ /**
1851
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1852
+ * using the provided decoding functions.
1853
+ *
1854
+ * @category transformations
1855
+ * @since 3.10.0
1856
+ */
1857
+ <To extends Schema.Any, From extends Schema.Any, RD, RE>(from: From, to: To, options: {
1858
+ readonly decode: (fromA: Schema.Type<From>, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded<From>) => Effect.Effect<Schema.Encoded<To>, ParseResult.ParseIssue, RD>;
1859
+ readonly encode: (toI: Schema.Encoded<To>, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type<To>) => Effect.Effect<Schema.Type<From>, ParseResult.ParseIssue, RE>;
1860
+ readonly strict?: true;
1861
+ } | {
1862
+ readonly decode: (fromA: Schema.Type<From>, options: ParseOptions, ast: AST.Transformation, fromI: Schema.Encoded<From>) => Effect.Effect<unknown, ParseResult.ParseIssue, RD>;
1863
+ readonly encode: (toI: Schema.Encoded<To>, options: ParseOptions, ast: AST.Transformation, toA: Schema.Type<To>) => Effect.Effect<unknown, ParseResult.ParseIssue, RE>;
1864
+ readonly strict: false;
1865
+ }): transformOrFail<From, To, RD | RE>;
1866
+ };
1867
+ /**
1868
+ * @category api interface
1869
+ * @since 3.10.0
1870
+ */
1871
+ export interface transform<From extends Schema.Any, To extends Schema.Any> extends transformOrFail<From, To> {
1872
+ annotations(annotations: Annotations.Schema<Schema.Type<To>>): transform<From, To>;
1873
+ }
1874
+ /**
1875
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1876
+ * using the provided mapping functions.
1877
+ *
1878
+ * @category transformations
1879
+ * @since 3.10.0
1880
+ */
1881
+ export declare const transform: {
1882
+ /**
1883
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1884
+ * using the provided mapping functions.
1885
+ *
1886
+ * @category transformations
1887
+ * @since 3.10.0
1888
+ */
1889
+ <To extends Schema.Any, From extends Schema.Any>(to: To, options: {
1890
+ readonly decode: (fromA: Schema.Type<From>, fromI: Schema.Encoded<From>) => Schema.Encoded<To>;
1891
+ readonly encode: (toI: Schema.Encoded<To>, toA: Schema.Type<To>) => Schema.Type<From>;
1892
+ readonly strict?: true;
1893
+ } | {
1894
+ readonly decode: (fromA: Schema.Type<From>, fromI: Schema.Encoded<From>) => unknown;
1895
+ readonly encode: (toI: Schema.Encoded<To>, toA: Schema.Type<To>) => unknown;
1896
+ readonly strict: false;
1897
+ }): (from: From) => transform<From, To>;
1898
+ /**
1899
+ * Create a new `Schema` by transforming the input and output of an existing `Schema`
1900
+ * using the provided mapping functions.
1901
+ *
1902
+ * @category transformations
1903
+ * @since 3.10.0
1904
+ */
1905
+ <To extends Schema.Any, From extends Schema.Any>(from: From, to: To, options: {
1906
+ readonly decode: (fromA: Schema.Type<From>, fromI: Schema.Encoded<From>) => Schema.Encoded<To>;
1907
+ readonly encode: (toI: Schema.Encoded<To>, toA: Schema.Type<To>) => Schema.Type<From>;
1908
+ readonly strict?: true;
1909
+ } | {
1910
+ readonly decode: (fromA: Schema.Type<From>, fromI: Schema.Encoded<From>) => unknown;
1911
+ readonly encode: (toI: Schema.Encoded<To>, toA: Schema.Type<To>) => unknown;
1912
+ readonly strict: false;
1913
+ }): transform<From, To>;
1914
+ };
1915
+ /**
1916
+ * @category api interface
1917
+ * @since 3.10.0
1918
+ */
1919
+ export interface transformLiteral<Type, Encoded> extends Annotable<transformLiteral<Type, Encoded>, Type, Encoded> {
1920
+ }
1921
+ /**
1922
+ * Creates a new `Schema` which transforms literal values.
1923
+ *
1924
+ * @example
1925
+ * import * as S from "effect/Schema"
1926
+ *
1927
+ * const schema = S.transformLiteral(0, "a")
1928
+ *
1929
+ * assert.deepStrictEqual(S.decodeSync(schema)(0), "a")
1930
+ *
1931
+ * @category constructors
1932
+ * @since 3.10.0
1933
+ */
1934
+ export declare const transformLiteral: <Encoded extends AST.LiteralValue, Type extends AST.LiteralValue>(from: Encoded, to: Type) => transformLiteral<Type, Encoded>;
1935
+ /**
1936
+ * Creates a new `Schema` which maps between corresponding literal values.
1937
+ *
1938
+ * @example
1939
+ * import * as S from "effect/Schema"
1940
+ *
1941
+ * const Animal = S.transformLiterals(
1942
+ * [0, "cat"],
1943
+ * [1, "dog"],
1944
+ * [2, "cow"]
1945
+ * )
1946
+ *
1947
+ * assert.deepStrictEqual(S.decodeSync(Animal)(1), "dog")
1948
+ *
1949
+ * @category constructors
1950
+ * @since 3.10.0
1951
+ */
1952
+ export declare function transformLiterals<const A extends AST.Members<readonly [from: AST.LiteralValue, to: AST.LiteralValue]>>(...pairs: A): Union<{
1953
+ -readonly [I in keyof A]: transformLiteral<A[I][1], A[I][0]>;
1954
+ }>;
1955
+ export declare function transformLiterals<Encoded extends AST.LiteralValue, Type extends AST.LiteralValue>(pairs: [Encoded, Type]): transformLiteral<Type, Encoded>;
1956
+ export declare function transformLiterals<const A extends ReadonlyArray<readonly [from: AST.LiteralValue, to: AST.LiteralValue]>>(...pairs: A): Schema<A[number][1], A[number][0]>;
1957
+ /**
1958
+ * Attaches a property signature with the specified key and value to the schema.
1959
+ * This API is useful when you want to add a property to your schema which doesn't describe the shape of the input,
1960
+ * but rather maps to another schema, for example when you want to add a discriminant to a simple union.
1961
+ *
1962
+ * @param self - The input schema.
1963
+ * @param key - The name of the property to add to the schema.
1964
+ * @param value - The value of the property to add to the schema.
1965
+ *
1966
+ * @example
1967
+ * import * as S from "effect/Schema"
1968
+ * import { pipe } from "effect/Function"
1969
+ *
1970
+ * const Circle = S.Struct({ radius: S.Number })
1971
+ * const Square = S.Struct({ sideLength: S.Number })
1972
+ * const Shape = S.Union(
1973
+ * Circle.pipe(S.attachPropertySignature("kind", "circle")),
1974
+ * Square.pipe(S.attachPropertySignature("kind", "square"))
1975
+ * )
1976
+ *
1977
+ * assert.deepStrictEqual(S.decodeSync(Shape)({ radius: 10 }), {
1978
+ * kind: "circle",
1979
+ * radius: 10
1980
+ * })
1981
+ *
1982
+ * @category combinators
1983
+ * @since 3.10.0
1984
+ */
1985
+ export declare const attachPropertySignature: {
1986
+ /**
1987
+ * Attaches a property signature with the specified key and value to the schema.
1988
+ * This API is useful when you want to add a property to your schema which doesn't describe the shape of the input,
1989
+ * but rather maps to another schema, for example when you want to add a discriminant to a simple union.
1990
+ *
1991
+ * @param self - The input schema.
1992
+ * @param key - The name of the property to add to the schema.
1993
+ * @param value - The value of the property to add to the schema.
1994
+ *
1995
+ * @example
1996
+ * import * as S from "effect/Schema"
1997
+ * import { pipe } from "effect/Function"
1998
+ *
1999
+ * const Circle = S.Struct({ radius: S.Number })
2000
+ * const Square = S.Struct({ sideLength: S.Number })
2001
+ * const Shape = S.Union(
2002
+ * Circle.pipe(S.attachPropertySignature("kind", "circle")),
2003
+ * Square.pipe(S.attachPropertySignature("kind", "square"))
2004
+ * )
2005
+ *
2006
+ * assert.deepStrictEqual(S.decodeSync(Shape)({ radius: 10 }), {
2007
+ * kind: "circle",
2008
+ * radius: 10
2009
+ * })
2010
+ *
2011
+ * @category combinators
2012
+ * @since 3.10.0
2013
+ */
2014
+ <K extends PropertyKey, V extends AST.LiteralValue | symbol, A>(key: K, value: V, annotations?: Annotations.Schema<Simplify<A & {
2015
+ readonly [k in K]: V;
2016
+ }>>): <I, R>(schema: SchemaClass<A, I, R>) => SchemaClass<Simplify<A & {
2017
+ readonly [k in K]: V;
2018
+ }>, I, R>;
2019
+ /**
2020
+ * Attaches a property signature with the specified key and value to the schema.
2021
+ * This API is useful when you want to add a property to your schema which doesn't describe the shape of the input,
2022
+ * but rather maps to another schema, for example when you want to add a discriminant to a simple union.
2023
+ *
2024
+ * @param self - The input schema.
2025
+ * @param key - The name of the property to add to the schema.
2026
+ * @param value - The value of the property to add to the schema.
2027
+ *
2028
+ * @example
2029
+ * import * as S from "effect/Schema"
2030
+ * import { pipe } from "effect/Function"
2031
+ *
2032
+ * const Circle = S.Struct({ radius: S.Number })
2033
+ * const Square = S.Struct({ sideLength: S.Number })
2034
+ * const Shape = S.Union(
2035
+ * Circle.pipe(S.attachPropertySignature("kind", "circle")),
2036
+ * Square.pipe(S.attachPropertySignature("kind", "square"))
2037
+ * )
2038
+ *
2039
+ * assert.deepStrictEqual(S.decodeSync(Shape)({ radius: 10 }), {
2040
+ * kind: "circle",
2041
+ * radius: 10
2042
+ * })
2043
+ *
2044
+ * @category combinators
2045
+ * @since 3.10.0
2046
+ */
2047
+ <A, I, R, K extends PropertyKey, V extends AST.LiteralValue | symbol>(schema: Schema<A, I, R>, key: K, value: V, annotations?: Annotations.Schema<Simplify<A & {
2048
+ readonly [k in K]: V;
2049
+ }>>): SchemaClass<Simplify<A & {
2050
+ readonly [k in K]: V;
2051
+ }>, I, R>;
2052
+ };
2053
+ /**
2054
+ * @category annotations
2055
+ * @since 3.10.0
2056
+ */
2057
+ export declare namespace Annotations {
2058
+ /**
2059
+ * @category annotations
2060
+ * @since 3.10.0
2061
+ */
2062
+ interface Doc<A> extends AST.Annotations {
2063
+ readonly title?: AST.TitleAnnotation;
2064
+ readonly description?: AST.DescriptionAnnotation;
2065
+ readonly documentation?: AST.DocumentationAnnotation;
2066
+ readonly examples?: AST.ExamplesAnnotation<A>;
2067
+ readonly default?: AST.DefaultAnnotation<A>;
2068
+ }
2069
+ /**
2070
+ * @since 3.10.0
2071
+ */
2072
+ interface Schema<A, TypeParameters extends ReadonlyArray<any> = readonly []> extends Doc<A> {
2073
+ readonly identifier?: AST.IdentifierAnnotation;
2074
+ readonly message?: AST.MessageAnnotation;
2075
+ readonly schemaId?: AST.SchemaIdAnnotation;
2076
+ readonly jsonSchema?: AST.JSONSchemaAnnotation;
2077
+ readonly arbitrary?: ArbitraryAnnotation<A, TypeParameters>;
2078
+ readonly pretty?: pretty_.PrettyAnnotation<A, TypeParameters>;
2079
+ readonly equivalence?: AST.EquivalenceAnnotation<A, TypeParameters>;
2080
+ readonly concurrency?: AST.ConcurrencyAnnotation;
2081
+ readonly batching?: AST.BatchingAnnotation;
2082
+ readonly parseIssueTitle?: AST.ParseIssueTitleAnnotation;
2083
+ readonly parseOptions?: AST.ParseOptions;
2084
+ readonly decodingFallback?: AST.DecodingFallbackAnnotation<A>;
2085
+ }
2086
+ /**
2087
+ * @since 3.10.0
2088
+ */
2089
+ interface Filter<A, P = A> extends Schema<A, readonly [P]> {
2090
+ }
2091
+ }
2092
+ /**
2093
+ * Merges a set of new annotations with existing ones, potentially overwriting
2094
+ * any duplicates.
2095
+ *
2096
+ * @category annotations
2097
+ * @since 3.10.0
2098
+ */
2099
+ export declare const annotations: {
2100
+ /**
2101
+ * Merges a set of new annotations with existing ones, potentially overwriting
2102
+ * any duplicates.
2103
+ *
2104
+ * @category annotations
2105
+ * @since 3.10.0
2106
+ */
2107
+ <S extends Annotable.All>(annotations: Annotations.Schema<Schema.Type<S>>): (self: S) => Annotable.Self<S>;
2108
+ /**
2109
+ * Merges a set of new annotations with existing ones, potentially overwriting
2110
+ * any duplicates.
2111
+ *
2112
+ * @category annotations
2113
+ * @since 3.10.0
2114
+ */
2115
+ <S extends Annotable.All>(self: S, annotations: Annotations.Schema<Schema.Type<S>>): Annotable.Self<S>;
2116
+ };
2117
+ type Rename<A, M> = {
2118
+ [K in keyof A as K extends keyof M ? M[K] extends PropertyKey ? M[K] : never : K]: A[K];
2119
+ };
2120
+ /**
2121
+ * @category renaming
2122
+ * @since 3.10.0
2123
+ */
2124
+ export declare const rename: {
2125
+ /**
2126
+ * @category renaming
2127
+ * @since 3.10.0
2128
+ */
2129
+ <A, const M extends {
2130
+ readonly [K in keyof A]?: PropertyKey;
2131
+ } & {
2132
+ readonly [K in Exclude<keyof M, keyof A>]: never;
2133
+ }>(mapping: M): <I, R>(self: Schema<A, I, R>) => SchemaClass<Simplify<Rename<A, M>>, I, R>;
2134
+ /**
2135
+ * @category renaming
2136
+ * @since 3.10.0
2137
+ */
2138
+ <A, I, R, const M extends {
2139
+ readonly [K in keyof A]?: PropertyKey;
2140
+ } & {
2141
+ readonly [K in Exclude<keyof M, keyof A>]: never;
2142
+ }>(self: Schema<A, I, R>, mapping: M): SchemaClass<Simplify<Rename<A, M>>, I, R>;
2143
+ };
2144
+ /**
2145
+ * @category schema id
2146
+ * @since 3.10.0
2147
+ */
2148
+ export declare const TrimmedSchemaId: unique symbol;
2149
+ /**
2150
+ * Verifies that a string contains no leading or trailing whitespaces.
2151
+ *
2152
+ * Note. This combinator does not make any transformations, it only validates.
2153
+ * If what you were looking for was a combinator to trim strings, then check out the `trim` combinator.
2154
+ *
2155
+ * @category string filters
2156
+ * @since 3.10.0
2157
+ */
2158
+ export declare const trimmed: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2159
+ /**
2160
+ * @category schema id
2161
+ * @since 3.10.0
2162
+ */
2163
+ export declare const MaxLengthSchemaId: unique symbol;
2164
+ /**
2165
+ * @category schema id
2166
+ * @since 3.10.0
2167
+ */
2168
+ export type MaxLengthSchemaId = typeof MaxLengthSchemaId;
2169
+ /**
2170
+ * @category string filters
2171
+ * @since 3.10.0
2172
+ */
2173
+ export declare const maxLength: <A extends string>(maxLength: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2174
+ /**
2175
+ * @category schema id
2176
+ * @since 3.10.0
2177
+ */
2178
+ export declare const MinLengthSchemaId: unique symbol;
2179
+ /**
2180
+ * @category schema id
2181
+ * @since 3.10.0
2182
+ */
2183
+ export type MinLengthSchemaId = typeof MinLengthSchemaId;
2184
+ /**
2185
+ * @category string filters
2186
+ * @since 3.10.0
2187
+ */
2188
+ export declare const minLength: <A extends string>(minLength: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2189
+ /**
2190
+ * @category schema id
2191
+ * @since 3.10.0
2192
+ */
2193
+ export declare const PatternSchemaId: unique symbol;
2194
+ /**
2195
+ * @category string filters
2196
+ * @since 3.10.0
2197
+ */
2198
+ export declare const pattern: <A extends string>(regex: RegExp, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2199
+ /**
2200
+ * @category schema id
2201
+ * @since 3.10.0
2202
+ */
2203
+ export declare const StartsWithSchemaId: unique symbol;
2204
+ /**
2205
+ * @category string filters
2206
+ * @since 3.10.0
2207
+ */
2208
+ export declare const startsWith: <A extends string>(startsWith: string, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2209
+ /**
2210
+ * @category schema id
2211
+ * @since 3.10.0
2212
+ */
2213
+ export declare const EndsWithSchemaId: unique symbol;
2214
+ /**
2215
+ * @category string filters
2216
+ * @since 3.10.0
2217
+ */
2218
+ export declare const endsWith: <A extends string>(endsWith: string, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2219
+ /**
2220
+ * @category schema id
2221
+ * @since 3.10.0
2222
+ */
2223
+ export declare const IncludesSchemaId: unique symbol;
2224
+ /**
2225
+ * @category string filters
2226
+ * @since 3.10.0
2227
+ */
2228
+ export declare const includes: <A extends string>(searchString: string, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2229
+ /**
2230
+ * @category schema id
2231
+ * @since 3.10.0
2232
+ */
2233
+ export declare const LowercasedSchemaId: unique symbol;
2234
+ /**
2235
+ * Verifies that a string is lowercased.
2236
+ *
2237
+ * @category string filters
2238
+ * @since 3.10.0
2239
+ */
2240
+ export declare const lowercased: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2241
+ declare const Lowercased_base: filter<Schema<string, string, never>>;
2242
+ /**
2243
+ * @category string constructors
2244
+ * @since 3.10.0
2245
+ */
2246
+ export declare class Lowercased extends Lowercased_base {
2247
+ }
2248
+ /**
2249
+ * @category schema id
2250
+ * @since 3.10.0
2251
+ */
2252
+ export declare const CapitalizedSchemaId: unique symbol;
2253
+ /**
2254
+ * Verifies that a string is capitalized.
2255
+ *
2256
+ * @category string filters
2257
+ * @since 3.10.0
2258
+ */
2259
+ export declare const capitalized: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2260
+ declare const Capitalized_base: filter<Schema<string, string, never>>;
2261
+ /**
2262
+ * @category string constructors
2263
+ * @since 3.10.0
2264
+ */
2265
+ export declare class Capitalized extends Capitalized_base {
2266
+ }
2267
+ /**
2268
+ * @category schema id
2269
+ * @since 3.10.0
2270
+ */
2271
+ export declare const UncapitalizedSchemaId: unique symbol;
2272
+ /**
2273
+ * Verifies that a string is uncapitalized.
2274
+ *
2275
+ * @category string filters
2276
+ * @since 3.10.0
2277
+ */
2278
+ export declare const uncapitalized: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2279
+ declare const Uncapitalized_base: filter<Schema<string, string, never>>;
2280
+ /**
2281
+ * @category string constructors
2282
+ * @since 3.10.0
2283
+ */
2284
+ export declare class Uncapitalized extends Uncapitalized_base {
2285
+ }
2286
+ /**
2287
+ * @category schema id
2288
+ * @since 3.10.0
2289
+ */
2290
+ export declare const UppercasedSchemaId: unique symbol;
2291
+ /**
2292
+ * Verifies that a string is uppercased.
2293
+ *
2294
+ * @category string filters
2295
+ * @since 3.10.0
2296
+ */
2297
+ export declare const uppercased: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2298
+ declare const Uppercased_base: filter<Schema<string, string, never>>;
2299
+ /**
2300
+ * @category string constructors
2301
+ * @since 3.10.0
2302
+ */
2303
+ export declare class Uppercased extends Uppercased_base {
2304
+ }
2305
+ /**
2306
+ * @category schema id
2307
+ * @since 3.10.0
2308
+ */
2309
+ export declare const LengthSchemaId: unique symbol;
2310
+ /**
2311
+ * @category schema id
2312
+ * @since 3.10.0
2313
+ */
2314
+ export type LengthSchemaId = typeof LengthSchemaId;
2315
+ /**
2316
+ * @category string filters
2317
+ * @since 3.10.0
2318
+ */
2319
+ export declare const length: <A extends string>(length: number | {
2320
+ readonly min: number;
2321
+ readonly max: number;
2322
+ }, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2323
+ declare const Char_base: filter<Schema<string, string, never>>;
2324
+ /**
2325
+ * A schema representing a single character.
2326
+ *
2327
+ * @category string constructors
2328
+ * @since 3.10.0
2329
+ */
2330
+ export declare class Char extends Char_base {
2331
+ }
2332
+ /**
2333
+ * @category string filters
2334
+ * @since 3.10.0
2335
+ */
2336
+ export declare const nonEmptyString: <A extends string>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2337
+ declare const Lowercase_base: transform<SchemaClass<string, string, never>, typeof Lowercased>;
2338
+ /**
2339
+ * This schema converts a string to lowercase.
2340
+ *
2341
+ * @category string transformations
2342
+ * @since 3.10.0
2343
+ */
2344
+ export declare class Lowercase extends Lowercase_base {
2345
+ }
2346
+ declare const Uppercase_base: transform<SchemaClass<string, string, never>, typeof Uppercased>;
2347
+ /**
2348
+ * This schema converts a string to uppercase.
2349
+ *
2350
+ * @category string transformations
2351
+ * @since 3.10.0
2352
+ */
2353
+ export declare class Uppercase extends Uppercase_base {
2354
+ }
2355
+ declare const Capitalize_base: transform<SchemaClass<string, string, never>, typeof Capitalized>;
2356
+ /**
2357
+ * This schema converts a string to capitalized one.
2358
+ *
2359
+ * @category string transformations
2360
+ * @since 3.10.0
2361
+ */
2362
+ export declare class Capitalize extends Capitalize_base {
2363
+ }
2364
+ declare const Uncapitalize_base: transform<SchemaClass<string, string, never>, typeof Uncapitalized>;
2365
+ /**
2366
+ * This schema converts a string to uncapitalized one.
2367
+ *
2368
+ * @category string transformations
2369
+ * @since 3.10.0
2370
+ */
2371
+ export declare class Uncapitalize extends Uncapitalize_base {
2372
+ }
2373
+ declare const Trimmed_base: filter<Schema<string, string, never>>;
2374
+ /**
2375
+ * @category string constructors
2376
+ * @since 3.10.0
2377
+ */
2378
+ export declare class Trimmed extends Trimmed_base {
2379
+ }
2380
+ declare const NonEmptyTrimmedString_base: filter<Schema<string, string, never>>;
2381
+ /**
2382
+ * Useful for validating strings that must contain meaningful characters without
2383
+ * leading or trailing whitespace.
2384
+ *
2385
+ * @example
2386
+ * import { Schema } from "effect"
2387
+ *
2388
+ * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("")) // Option.none()
2389
+ * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)(" a ")) // Option.none()
2390
+ * console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("a")) // Option.some("a")
2391
+ *
2392
+ * @category string constructors
2393
+ * @since 3.10.0
2394
+ */
2395
+ export declare class NonEmptyTrimmedString extends NonEmptyTrimmedString_base {
2396
+ }
2397
+ declare const Trim_base: transform<SchemaClass<string, string, never>, typeof Trimmed>;
2398
+ /**
2399
+ * This schema allows removing whitespaces from the beginning and end of a string.
2400
+ *
2401
+ * @category string transformations
2402
+ * @since 3.10.0
2403
+ */
2404
+ export declare class Trim extends Trim_base {
2405
+ }
2406
+ /**
2407
+ * Returns a schema that allows splitting a string into an array of strings.
2408
+ *
2409
+ * @category string transformations
2410
+ * @since 3.10.0
2411
+ */
2412
+ export declare const split: (separator: string) => transform<typeof String$, Array$<typeof String$>>;
2413
+ /**
2414
+ * @since 3.10.0
2415
+ */
2416
+ export type ParseJsonOptions = {
2417
+ readonly reviver?: Parameters<typeof JSON.parse>[1];
2418
+ readonly replacer?: Parameters<typeof JSON.stringify>[1];
2419
+ readonly space?: Parameters<typeof JSON.stringify>[2];
2420
+ };
2421
+ /**
2422
+ * The `ParseJson` combinator provides a method to convert JSON strings into the `unknown` type using the underlying
2423
+ * functionality of `JSON.parse`. It also utilizes `JSON.stringify` for encoding.
2424
+ *
2425
+ * You can optionally provide a `ParseJsonOptions` to configure both `JSON.parse` and `JSON.stringify` executions.
2426
+ *
2427
+ * Optionally, you can pass a schema `Schema<A, I, R>` to obtain an `A` type instead of `unknown`.
2428
+ *
2429
+ * @example
2430
+ * import * as Schema from "effect/Schema"
2431
+ *
2432
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson())(`{"a":"1"}`), { a: "1" })
2433
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson(Schema.Struct({ a: Schema.NumberFromString })))(`{"a":"1"}`), { a: 1 })
2434
+ *
2435
+ * @category string transformations
2436
+ * @since 3.10.0
2437
+ */
2438
+ export declare const parseJson: {
2439
+ /**
2440
+ * The `ParseJson` combinator provides a method to convert JSON strings into the `unknown` type using the underlying
2441
+ * functionality of `JSON.parse`. It also utilizes `JSON.stringify` for encoding.
2442
+ *
2443
+ * You can optionally provide a `ParseJsonOptions` to configure both `JSON.parse` and `JSON.stringify` executions.
2444
+ *
2445
+ * Optionally, you can pass a schema `Schema<A, I, R>` to obtain an `A` type instead of `unknown`.
2446
+ *
2447
+ * @example
2448
+ * import * as Schema from "effect/Schema"
2449
+ *
2450
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson())(`{"a":"1"}`), { a: "1" })
2451
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson(Schema.Struct({ a: Schema.NumberFromString })))(`{"a":"1"}`), { a: 1 })
2452
+ *
2453
+ * @category string transformations
2454
+ * @since 3.10.0
2455
+ */
2456
+ <A, I, R>(schema: Schema<A, I, R>, options?: ParseJsonOptions): SchemaClass<A, string, R>;
2457
+ /**
2458
+ * The `ParseJson` combinator provides a method to convert JSON strings into the `unknown` type using the underlying
2459
+ * functionality of `JSON.parse`. It also utilizes `JSON.stringify` for encoding.
2460
+ *
2461
+ * You can optionally provide a `ParseJsonOptions` to configure both `JSON.parse` and `JSON.stringify` executions.
2462
+ *
2463
+ * Optionally, you can pass a schema `Schema<A, I, R>` to obtain an `A` type instead of `unknown`.
2464
+ *
2465
+ * @example
2466
+ * import * as Schema from "effect/Schema"
2467
+ *
2468
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson())(`{"a":"1"}`), { a: "1" })
2469
+ * assert.deepStrictEqual(Schema.decodeUnknownSync(Schema.parseJson(Schema.Struct({ a: Schema.NumberFromString })))(`{"a":"1"}`), { a: 1 })
2470
+ *
2471
+ * @category string transformations
2472
+ * @since 3.10.0
2473
+ */
2474
+ (options?: ParseJsonOptions): SchemaClass<unknown, string>;
2475
+ };
2476
+ declare const NonEmptyString_base: filter<Schema<string, string, never>>;
2477
+ /**
2478
+ * @category string constructors
2479
+ * @since 3.10.0
2480
+ */
2481
+ export declare class NonEmptyString extends NonEmptyString_base {
2482
+ }
2483
+ /**
2484
+ * @category schema id
2485
+ * @since 3.10.0
2486
+ */
2487
+ export declare const UUIDSchemaId: unique symbol;
2488
+ declare const UUID_base: filter<Schema<string, string, never>>;
2489
+ /**
2490
+ * Represents a Universally Unique Identifier (UUID).
2491
+ *
2492
+ * This schema ensures that the provided string adheres to the standard UUID format.
2493
+ *
2494
+ * @category string constructors
2495
+ * @since 3.10.0
2496
+ */
2497
+ export declare class UUID extends UUID_base {
2498
+ }
2499
+ /**
2500
+ * @category schema id
2501
+ * @since 3.10.0
2502
+ */
2503
+ export declare const ULIDSchemaId: unique symbol;
2504
+ declare const ULID_base: filter<Schema<string, string, never>>;
2505
+ /**
2506
+ * Represents a Universally Unique Lexicographically Sortable Identifier (ULID).
2507
+ *
2508
+ * ULIDs are designed to be compact, URL-safe, and ordered, making them suitable for use as identifiers.
2509
+ * This schema ensures that the provided string adheres to the standard ULID format.
2510
+ *
2511
+ * @category string constructors
2512
+ * @since 3.10.0
2513
+ */
2514
+ export declare class ULID extends ULID_base {
2515
+ }
2516
+ /**
2517
+ * @category schema id
2518
+ * @since 3.10.0
2519
+ */
2520
+ export declare const FiniteSchemaId: unique symbol;
2521
+ /**
2522
+ * Ensures that the provided value is a finite number.
2523
+ *
2524
+ * This schema filters out non-finite numeric values, allowing only finite numbers to pass through.
2525
+ *
2526
+ * @category number filters
2527
+ * @since 3.10.0
2528
+ */
2529
+ export declare const finite: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2530
+ /**
2531
+ * @category schema id
2532
+ * @since 3.10.0
2533
+ */
2534
+ export declare const GreaterThanSchemaId: unique symbol;
2535
+ /**
2536
+ * @category schema id
2537
+ * @since 3.10.0
2538
+ */
2539
+ export type GreaterThanSchemaId = typeof GreaterThanSchemaId;
2540
+ /**
2541
+ * This filter checks whether the provided number is greater than the specified minimum.
2542
+ *
2543
+ * @category number filters
2544
+ * @since 3.10.0
2545
+ */
2546
+ export declare const greaterThan: <A extends number>(min: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2547
+ /**
2548
+ * @category schema id
2549
+ * @since 3.10.0
2550
+ */
2551
+ export declare const GreaterThanOrEqualToSchemaId: unique symbol;
2552
+ /**
2553
+ * @category schema id
2554
+ * @since 3.10.0
2555
+ */
2556
+ export type GreaterThanOrEqualToSchemaId = typeof GreaterThanOrEqualToSchemaId;
2557
+ /**
2558
+ * This filter checks whether the provided number is greater than or equal to the specified minimum.
2559
+ *
2560
+ * @category number filters
2561
+ * @since 3.10.0
2562
+ */
2563
+ export declare const greaterThanOrEqualTo: <A extends number>(min: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2564
+ /**
2565
+ * @category schema id
2566
+ * @since 3.10.0
2567
+ */
2568
+ export declare const MultipleOfSchemaId: unique symbol;
2569
+ /**
2570
+ * @category number filters
2571
+ * @since 3.10.0
2572
+ */
2573
+ export declare const multipleOf: <A extends number>(divisor: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2574
+ /**
2575
+ * @category schema id
2576
+ * @since 3.10.0
2577
+ */
2578
+ export declare const IntSchemaId: unique symbol;
2579
+ /**
2580
+ * @category schema id
2581
+ * @since 3.10.0
2582
+ */
2583
+ export type IntSchemaId = typeof IntSchemaId;
2584
+ /**
2585
+ * @category number filters
2586
+ * @since 3.10.0
2587
+ */
2588
+ export declare const int: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2589
+ /**
2590
+ * @category schema id
2591
+ * @since 3.10.0
2592
+ */
2593
+ export declare const LessThanSchemaId: unique symbol;
2594
+ /**
2595
+ * @category schema id
2596
+ * @since 3.10.0
2597
+ */
2598
+ export type LessThanSchemaId = typeof LessThanSchemaId;
2599
+ /**
2600
+ * This filter checks whether the provided number is less than the specified maximum.
2601
+ *
2602
+ * @category number filters
2603
+ * @since 3.10.0
2604
+ */
2605
+ export declare const lessThan: <A extends number>(max: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2606
+ /**
2607
+ * @category schema id
2608
+ * @since 3.10.0
2609
+ */
2610
+ export declare const LessThanOrEqualToSchemaId: unique symbol;
2611
+ /**
2612
+ * @category schema id
2613
+ * @since 3.10.0
2614
+ */
2615
+ export type LessThanOrEqualToSchemaId = typeof LessThanOrEqualToSchemaId;
2616
+ /**
2617
+ * This schema checks whether the provided number is less than or equal to the specified maximum.
2618
+ *
2619
+ * @category number filters
2620
+ * @since 3.10.0
2621
+ */
2622
+ export declare const lessThanOrEqualTo: <A extends number>(max: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2623
+ /**
2624
+ * @category schema id
2625
+ * @since 3.10.0
2626
+ */
2627
+ export declare const BetweenSchemaId: unique symbol;
2628
+ /**
2629
+ * @category schema id
2630
+ * @since 3.10.0
2631
+ */
2632
+ export type BetweenSchemaId = typeof BetweenSchemaId;
2633
+ /**
2634
+ * This filter checks whether the provided number falls within the specified minimum and maximum values.
2635
+ *
2636
+ * @category number filters
2637
+ * @since 3.10.0
2638
+ */
2639
+ export declare const between: <A extends number>(min: number, max: number, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2640
+ /**
2641
+ * @category schema id
2642
+ * @since 3.10.0
2643
+ */
2644
+ export declare const NonNaNSchemaId: unique symbol;
2645
+ /**
2646
+ * @category number filters
2647
+ * @since 3.10.0
2648
+ */
2649
+ export declare const nonNaN: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2650
+ /**
2651
+ * @category number filters
2652
+ * @since 3.10.0
2653
+ */
2654
+ export declare const positive: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2655
+ /**
2656
+ * @category number filters
2657
+ * @since 3.10.0
2658
+ */
2659
+ export declare const negative: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2660
+ /**
2661
+ * @category number filters
2662
+ * @since 3.10.0
2663
+ */
2664
+ export declare const nonPositive: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2665
+ /**
2666
+ * @category number filters
2667
+ * @since 3.10.0
2668
+ */
2669
+ export declare const nonNegative: <A extends number>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2670
+ /**
2671
+ * Clamps a number between a minimum and a maximum value.
2672
+ *
2673
+ * @category number transformations
2674
+ * @since 3.10.0
2675
+ */
2676
+ export declare const clamp: (minimum: number, maximum: number) => <A extends number, I, R>(self: Schema<A, I, R>) => transform<Schema<A, I, R>, filter<Schema<A>>>;
2677
+ /**
2678
+ * Transforms a `string` into a `number` by parsing the string using the `parse` function of the `effect/Number` module.
2679
+ *
2680
+ * It returns an error if the value can't be converted (for example when non-numeric characters are provided).
2681
+ *
2682
+ * The following special string values are supported: "NaN", "Infinity", "-Infinity".
2683
+ *
2684
+ * @category number transformations
2685
+ * @since 3.10.0
2686
+ */
2687
+ export declare const parseNumber: <A extends string, I, R>(self: Schema<A, I, R>) => transformOrFail<Schema<A, I, R>, typeof Number$>;
2688
+ declare const NumberFromString_base: transformOrFail<Schema<string, string, never>, typeof Number$, never>;
2689
+ /**
2690
+ * This schema transforms a `string` into a `number` by parsing the string using the `parse` function of the `effect/Number` module.
2691
+ *
2692
+ * It returns an error if the value can't be converted (for example when non-numeric characters are provided).
2693
+ *
2694
+ * The following special string values are supported: "NaN", "Infinity", "-Infinity".
2695
+ *
2696
+ * @category number constructors
2697
+ * @since 3.10.0
2698
+ */
2699
+ export declare class NumberFromString extends NumberFromString_base {
2700
+ }
2701
+ declare const Finite_base: filter<Schema<number, number, never>>;
2702
+ /**
2703
+ * @category number constructors
2704
+ * @since 3.10.0
2705
+ */
2706
+ export declare class Finite extends Finite_base {
2707
+ }
2708
+ declare const Int_base: filter<Schema<number, number, never>>;
2709
+ /**
2710
+ * @category number constructors
2711
+ * @since 3.10.0
2712
+ */
2713
+ export declare class Int extends Int_base {
2714
+ }
2715
+ declare const NonNaN_base: filter<Schema<number, number, never>>;
2716
+ /**
2717
+ * @category number constructors
2718
+ * @since 3.10.0
2719
+ */
2720
+ export declare class NonNaN extends NonNaN_base {
2721
+ }
2722
+ declare const Positive_base: filter<Schema<number, number, never>>;
2723
+ /**
2724
+ * @category number constructors
2725
+ * @since 3.10.0
2726
+ */
2727
+ export declare class Positive extends Positive_base {
2728
+ }
2729
+ declare const Negative_base: filter<Schema<number, number, never>>;
2730
+ /**
2731
+ * @category number constructors
2732
+ * @since 3.10.0
2733
+ */
2734
+ export declare class Negative extends Negative_base {
2735
+ }
2736
+ declare const NonPositive_base: filter<Schema<number, number, never>>;
2737
+ /**
2738
+ * @category number constructors
2739
+ * @since 3.10.0
2740
+ */
2741
+ export declare class NonPositive extends NonPositive_base {
2742
+ }
2743
+ declare const NonNegative_base: filter<Schema<number, number, never>>;
2744
+ /**
2745
+ * @category number constructors
2746
+ * @since 3.10.0
2747
+ */
2748
+ export declare class NonNegative extends NonNegative_base {
2749
+ }
2750
+ /**
2751
+ * @category schema id
2752
+ * @since 3.10.0
2753
+ */
2754
+ export declare const JsonNumberSchemaId: unique symbol;
2755
+ declare const JsonNumber_base: filter<typeof Number$>;
2756
+ /**
2757
+ * The `JsonNumber` is a schema for representing JSON numbers. It ensures that the provided value is a valid
2758
+ * number by filtering out `NaN` and `(+/-) Infinity`. This is useful when you want to validate and represent numbers in JSON
2759
+ * format.
2760
+ *
2761
+ * @example
2762
+ * import * as Schema from "effect/Schema"
2763
+ *
2764
+ * const is = Schema.is(S.JsonNumber)
2765
+ *
2766
+ * assert.deepStrictEqual(is(42), true)
2767
+ * assert.deepStrictEqual(is(Number.NaN), false)
2768
+ * assert.deepStrictEqual(is(Number.POSITIVE_INFINITY), false)
2769
+ * assert.deepStrictEqual(is(Number.NEGATIVE_INFINITY), false)
2770
+ *
2771
+ * @category number constructors
2772
+ * @since 3.10.0
2773
+ */
2774
+ export declare class JsonNumber extends JsonNumber_base {
2775
+ }
2776
+ declare const Not_base: transform<SchemaClass<boolean, boolean, never>, typeof Boolean$>;
2777
+ /**
2778
+ * @category boolean transformations
2779
+ * @since 3.10.0
2780
+ */
2781
+ export declare class Not extends Not_base {
2782
+ }
2783
+ declare const Symbol$_base: transform<SchemaClass<string, string, never>, typeof SymbolFromSelf>;
2784
+ /** @ignore */
2785
+ declare class Symbol$ extends Symbol$_base {
2786
+ }
2787
+ export {
2788
+ /**
2789
+ * This schema transforms a `string` into a `symbol`.
2790
+ *
2791
+ * @category symbol transformations
2792
+ * @since 3.10.0
2793
+ */
2794
+ Symbol$ as Symbol };
2795
+ /**
2796
+ * @category schema id
2797
+ * @since 3.10.0
2798
+ */
2799
+ export declare const GreaterThanBigIntSchemaId: unique symbol;
2800
+ /**
2801
+ * @category schema id
2802
+ * @since 3.10.0
2803
+ */
2804
+ export type GreaterThanBigIntSchemaId = typeof GreaterThanBigIntSchemaId;
2805
+ /**
2806
+ * @category bigint filters
2807
+ * @since 3.10.0
2808
+ */
2809
+ export declare const greaterThanBigInt: <A extends bigint>(min: bigint, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2810
+ /**
2811
+ * @category schema id
2812
+ * @since 3.10.0
2813
+ */
2814
+ export declare const GreaterThanOrEqualToBigIntSchemaId: unique symbol;
2815
+ /**
2816
+ * @category schema id
2817
+ * @since 3.10.0
2818
+ */
2819
+ export type GreaterThanOrEqualToBigIntSchemaId = typeof GreaterThanOrEqualToBigIntSchemaId;
2820
+ /**
2821
+ * @category bigint filters
2822
+ * @since 3.10.0
2823
+ */
2824
+ export declare const greaterThanOrEqualToBigInt: <A extends bigint>(min: bigint, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2825
+ /**
2826
+ * @category schema id
2827
+ * @since 3.10.0
2828
+ */
2829
+ export declare const LessThanBigIntSchemaId: unique symbol;
2830
+ /**
2831
+ * @category schema id
2832
+ * @since 3.10.0
2833
+ */
2834
+ export type LessThanBigIntSchemaId = typeof LessThanBigIntSchemaId;
2835
+ /**
2836
+ * @category bigint filters
2837
+ * @since 3.10.0
2838
+ */
2839
+ export declare const lessThanBigInt: <A extends bigint>(max: bigint, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2840
+ /**
2841
+ * @category schema id
2842
+ * @since 3.10.0
2843
+ */
2844
+ export declare const LessThanOrEqualToBigIntSchemaId: unique symbol;
2845
+ /**
2846
+ * @category schema id
2847
+ * @since 3.10.0
2848
+ */
2849
+ export type LessThanOrEqualToBigIntSchemaId = typeof LessThanOrEqualToBigIntSchemaId;
2850
+ /**
2851
+ * @category bigint filters
2852
+ * @since 3.10.0
2853
+ */
2854
+ export declare const lessThanOrEqualToBigInt: <A extends bigint>(max: bigint, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2855
+ /**
2856
+ * @category schema id
2857
+ * @since 3.10.0
2858
+ */
2859
+ export declare const BetweenBigIntSchemaId: unique symbol;
2860
+ /**
2861
+ * @category schema id
2862
+ * @since 3.10.0
2863
+ */
2864
+ export type BetweenBigIntSchemaId = typeof BetweenBigIntSchemaId;
2865
+ /**
2866
+ * @category bigint filters
2867
+ * @since 3.10.0
2868
+ */
2869
+ export declare const betweenBigInt: <A extends bigint>(min: bigint, max: bigint, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2870
+ /**
2871
+ * @category bigint filters
2872
+ * @since 3.10.0
2873
+ */
2874
+ export declare const positiveBigInt: <A extends bigint>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2875
+ /**
2876
+ * @category bigint filters
2877
+ * @since 3.10.0
2878
+ */
2879
+ export declare const negativeBigInt: <A extends bigint>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2880
+ /**
2881
+ * @category bigint filters
2882
+ * @since 3.10.0
2883
+ */
2884
+ export declare const nonNegativeBigInt: <A extends bigint>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2885
+ /**
2886
+ * @category bigint filters
2887
+ * @since 3.10.0
2888
+ */
2889
+ export declare const nonPositiveBigInt: <A extends bigint>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
2890
+ /**
2891
+ * Clamps a bigint between a minimum and a maximum value.
2892
+ *
2893
+ * @category bigint transformations
2894
+ * @since 3.10.0
2895
+ */
2896
+ export declare const clampBigInt: (minimum: bigint, maximum: bigint) => <A extends bigint, I, R>(self: Schema<A, I, R>) => transform<Schema<A, I, R>, filter<Schema<A>>>;
2897
+ declare const BigInt$_base: transformOrFail<SchemaClass<string, string, never>, typeof BigIntFromSelf, never>;
2898
+ /** @ignore */
2899
+ declare class BigInt$ extends BigInt$_base {
2900
+ }
2901
+ export {
2902
+ /**
2903
+ * This schema transforms a `string` into a `bigint` by parsing the string using the `BigInt` function.
2904
+ *
2905
+ * It returns an error if the value can't be converted (for example when non-numeric characters are provided).
2906
+ *
2907
+ * @category bigint transformations
2908
+ * @since 3.10.0
2909
+ */
2910
+ BigInt$ as BigInt };
2911
+ /**
2912
+ * @category bigint constructors
2913
+ * @since 3.10.0
2914
+ */
2915
+ export declare const PositiveBigIntFromSelf: filter<Schema<bigint>>;
2916
+ /**
2917
+ * @category bigint constructors
2918
+ * @since 3.10.0
2919
+ */
2920
+ export declare const PositiveBigInt: filter<Schema<bigint, string>>;
2921
+ /**
2922
+ * @category bigint constructors
2923
+ * @since 3.10.0
2924
+ */
2925
+ export declare const NegativeBigIntFromSelf: filter<Schema<bigint>>;
2926
+ /**
2927
+ * @category bigint constructors
2928
+ * @since 3.10.0
2929
+ */
2930
+ export declare const NegativeBigInt: filter<Schema<bigint, string>>;
2931
+ /**
2932
+ * @category bigint constructors
2933
+ * @since 3.10.0
2934
+ */
2935
+ export declare const NonPositiveBigIntFromSelf: filter<Schema<bigint>>;
2936
+ /**
2937
+ * @category bigint constructors
2938
+ * @since 3.10.0
2939
+ */
2940
+ export declare const NonPositiveBigInt: filter<Schema<bigint, string>>;
2941
+ /**
2942
+ * @category bigint constructors
2943
+ * @since 3.10.0
2944
+ */
2945
+ export declare const NonNegativeBigIntFromSelf: filter<Schema<bigint>>;
2946
+ /**
2947
+ * @category bigint constructors
2948
+ * @since 3.10.0
2949
+ */
2950
+ export declare const NonNegativeBigInt: filter<Schema<bigint, string>>;
2951
+ declare const BigIntFromNumber_base: transformOrFail<SchemaClass<number, number, never>, typeof BigIntFromSelf, never>;
2952
+ /**
2953
+ * This schema transforms a `number` into a `bigint` by parsing the number using the `BigInt` function.
2954
+ *
2955
+ * It returns an error if the value can't be safely encoded as a `number` due to being out of range.
2956
+ *
2957
+ * @category bigint transformations
2958
+ * @since 3.10.0
2959
+ */
2960
+ export declare class BigIntFromNumber extends BigIntFromNumber_base {
2961
+ }
2962
+ /**
2963
+ * @category api interface
2964
+ * @since 3.10.0
2965
+ */
2966
+ export interface RedactedFromSelf<Value extends Schema.Any> extends AnnotableClass<RedactedFromSelf<Value>, redacted_.Redacted<Schema.Type<Value>>, redacted_.Redacted<Schema.Encoded<Value>>, Schema.Context<Value>> {
2967
+ }
2968
+ /**
2969
+ * @category Redacted constructors
2970
+ * @since 3.10.0
2971
+ */
2972
+ export declare const RedactedFromSelf: <Value extends Schema.Any>(value: Value) => RedactedFromSelf<Value>;
2973
+ /**
2974
+ * @category api interface
2975
+ * @since 3.10.0
2976
+ */
2977
+ export interface Redacted<Value extends Schema.Any> extends AnnotableClass<Redacted<Value>, redacted_.Redacted<Schema.Type<Value>>, Schema.Encoded<Value>, Schema.Context<Value>> {
2978
+ }
2979
+ /**
2980
+ * A schema that transforms any type `A` into a `Redacted<A>`.
2981
+ *
2982
+ * @category Redacted transformations
2983
+ * @since 3.10.0
2984
+ */
2985
+ export declare const Redacted: <Value extends Schema.Any>(value: Value) => Redacted<Value>;
2986
+ declare const DurationFromSelf_base: SchemaClass<duration_.Duration, duration_.Duration, never>;
2987
+ /**
2988
+ * @category Duration constructors
2989
+ * @since 3.10.0
2990
+ */
2991
+ export declare class DurationFromSelf extends DurationFromSelf_base {
2992
+ }
2993
+ declare const DurationFromNanos_base: transformOrFail<SchemaClass<bigint, bigint, never>, typeof DurationFromSelf, never>;
2994
+ /**
2995
+ * A schema that transforms a `bigint` tuple into a `Duration`.
2996
+ * Treats the value as the number of nanoseconds.
2997
+ *
2998
+ * @category Duration transformations
2999
+ * @since 3.10.0
3000
+ */
3001
+ export declare class DurationFromNanos extends DurationFromNanos_base {
3002
+ }
3003
+ declare const DurationFromMillis_base: transform<SchemaClass<number, number, never>, typeof DurationFromSelf>;
3004
+ /**
3005
+ * A schema that transforms a `number` tuple into a `Duration`.
3006
+ * Treats the value as the number of milliseconds.
3007
+ *
3008
+ * @category Duration transformations
3009
+ * @since 3.10.0
3010
+ */
3011
+ export declare class DurationFromMillis extends DurationFromMillis_base {
3012
+ }
3013
+ declare const Duration_base: transform<Schema<readonly [seconds: number, nanos: number], readonly [seconds: number, nanos: number], never>, typeof DurationFromSelf>;
3014
+ /**
3015
+ * A schema that transforms a `[number, number]` tuple into a `Duration`.
3016
+ *
3017
+ * @category Duration transformations
3018
+ * @since 3.10.0
3019
+ */
3020
+ export declare class Duration extends Duration_base {
3021
+ }
3022
+ /**
3023
+ * Clamps a `Duration` between a minimum and a maximum value.
3024
+ *
3025
+ * @category Duration transformations
3026
+ * @since 3.10.0
3027
+ */
3028
+ export declare const clampDuration: (minimum: duration_.DurationInput, maximum: duration_.DurationInput) => <A extends duration_.Duration, I, R>(self: Schema<A, I, R>) => transform<Schema<A, I, R>, filter<Schema<A>>>;
3029
+ /**
3030
+ * @category schema id
3031
+ * @since 3.10.0
3032
+ */
3033
+ export declare const LessThanDurationSchemaId: unique symbol;
3034
+ /**
3035
+ * @category Duration filters
3036
+ * @since 3.10.0
3037
+ */
3038
+ export declare const lessThanDuration: <A extends duration_.Duration>(max: duration_.DurationInput, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3039
+ /**
3040
+ * @category schema id
3041
+ * @since 3.10.0
3042
+ */
3043
+ export declare const LessThanOrEqualToDurationSchemaId: unique symbol;
3044
+ /**
3045
+ * @category Duration filters
3046
+ * @since 3.10.0
3047
+ */
3048
+ export declare const lessThanOrEqualToDuration: <A extends duration_.Duration>(max: duration_.DurationInput, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3049
+ /**
3050
+ * @category schema id
3051
+ * @since 3.10.0
3052
+ */
3053
+ export declare const GreaterThanDurationSchemaId: unique symbol;
3054
+ /**
3055
+ * @category Duration filters
3056
+ * @since 3.10.0
3057
+ */
3058
+ export declare const greaterThanDuration: <A extends duration_.Duration>(min: duration_.DurationInput, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3059
+ /**
3060
+ * @category schema id
3061
+ * @since 3.10.0
3062
+ */
3063
+ export declare const GreaterThanOrEqualToDurationSchemaId: unique symbol;
3064
+ /**
3065
+ * @category Duration filters
3066
+ * @since 3.10.0
3067
+ */
3068
+ export declare const greaterThanOrEqualToDuration: <A extends duration_.Duration>(min: duration_.DurationInput, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3069
+ /**
3070
+ * @category schema id
3071
+ * @since 3.10.0
3072
+ */
3073
+ export declare const BetweenDurationSchemaId: unique symbol;
3074
+ /**
3075
+ * @category Duration filters
3076
+ * @since 3.10.0
3077
+ */
3078
+ export declare const betweenDuration: <A extends duration_.Duration>(minimum: duration_.DurationInput, maximum: duration_.DurationInput, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3079
+ /**
3080
+ * @category Uint8Array constructors
3081
+ * @since 3.10.0
3082
+ */
3083
+ export declare const Uint8ArrayFromSelf: Schema<Uint8Array>;
3084
+ declare const Uint8Array$: Schema<Uint8Array, ReadonlyArray<number>>;
3085
+ export {
3086
+ /**
3087
+ * A schema that transforms an array of numbers into a `Uint8Array`.
3088
+ *
3089
+ * @category Uint8Array transformations
3090
+ * @since 3.10.0
3091
+ */
3092
+ Uint8Array$ as Uint8Array };
3093
+ /**
3094
+ * Decodes a base64 (RFC4648) encoded string into a `Uint8Array`.
3095
+ *
3096
+ * @category Uint8Array transformations
3097
+ * @since 3.10.0
3098
+ */
3099
+ export declare const Uint8ArrayFromBase64: Schema<Uint8Array, string>;
3100
+ /**
3101
+ * Decodes a base64 (URL) encoded string into a `Uint8Array`.
3102
+ *
3103
+ * @category Uint8Array transformations
3104
+ * @since 3.10.0
3105
+ */
3106
+ export declare const Uint8ArrayFromBase64Url: Schema<Uint8Array, string>;
3107
+ /**
3108
+ * Decodes a hex encoded string into a `Uint8Array`.
3109
+ *
3110
+ * @category Uint8Array transformations
3111
+ * @since 3.10.0
3112
+ */
3113
+ export declare const Uint8ArrayFromHex: Schema<Uint8Array, string>;
3114
+ /**
3115
+ * Decodes a base64 (RFC4648) encoded string into a UTF-8 string.
3116
+ *
3117
+ * @category string transformations
3118
+ * @since 3.10.0
3119
+ */
3120
+ export declare const StringFromBase64: Schema<string>;
3121
+ /**
3122
+ * Decodes a base64 (URL) encoded string into a UTF-8 string.
3123
+ *
3124
+ * @category string transformations
3125
+ * @since 3.10.0
3126
+ */
3127
+ export declare const StringFromBase64Url: Schema<string>;
3128
+ /**
3129
+ * Decodes a hex encoded string into a UTF-8 string.
3130
+ *
3131
+ * @category string transformations
3132
+ * @since 3.10.0
3133
+ */
3134
+ export declare const StringFromHex: Schema<string>;
3135
+ /**
3136
+ * @category schema id
3137
+ * @since 3.10.0
3138
+ */
3139
+ export declare const MinItemsSchemaId: unique symbol;
3140
+ /**
3141
+ * @category schema id
3142
+ * @since 3.10.0
3143
+ */
3144
+ export type MinItemsSchemaId = typeof MinItemsSchemaId;
3145
+ /**
3146
+ * @category ReadonlyArray filters
3147
+ * @since 3.10.0
3148
+ */
3149
+ export declare const minItems: <A>(n: number, annotations?: Annotations.Filter<ReadonlyArray<A>>) => <I, R>(self: Schema<ReadonlyArray<A>, I, R>) => filter<Schema<ReadonlyArray<A>, I, R>>;
3150
+ /**
3151
+ * @category schema id
3152
+ * @since 3.10.0
3153
+ */
3154
+ export declare const MaxItemsSchemaId: unique symbol;
3155
+ /**
3156
+ * @category schema id
3157
+ * @since 3.10.0
3158
+ */
3159
+ export type MaxItemsSchemaId = typeof MaxItemsSchemaId;
3160
+ /**
3161
+ * @category ReadonlyArray filters
3162
+ * @since 3.10.0
3163
+ */
3164
+ export declare const maxItems: <A>(n: number, annotations?: Annotations.Filter<ReadonlyArray<A>>) => <I, R>(self: Schema<ReadonlyArray<A>, I, R>) => filter<Schema<ReadonlyArray<A>, I, R>>;
3165
+ /**
3166
+ * @category schema id
3167
+ * @since 3.10.0
3168
+ */
3169
+ export declare const ItemsCountSchemaId: unique symbol;
3170
+ /**
3171
+ * @category schema id
3172
+ * @since 3.10.0
3173
+ */
3174
+ export type ItemsCountSchemaId = typeof ItemsCountSchemaId;
3175
+ /**
3176
+ * @category ReadonlyArray filters
3177
+ * @since 3.10.0
3178
+ */
3179
+ export declare const itemsCount: <A>(n: number, annotations?: Annotations.Filter<ReadonlyArray<A>>) => <I, R>(self: Schema<ReadonlyArray<A>, I, R>) => filter<Schema<ReadonlyArray<A>, I, R>>;
3180
+ /**
3181
+ * @category ReadonlyArray transformations
3182
+ * @since 3.10.0
3183
+ */
3184
+ export declare const getNumberIndexedAccess: <A extends ReadonlyArray<any>, I extends ReadonlyArray<any>, R>(self: Schema<A, I, R>) => SchemaClass<A[number], I[number], R>;
3185
+ /**
3186
+ * Get the first element of a `ReadonlyArray`, or `None` if the array is empty.
3187
+ *
3188
+ * @category ReadonlyArray transformations
3189
+ * @since 3.10.0
3190
+ */
3191
+ export declare const head: <A, I, R>(self: Schema<ReadonlyArray<A>, I, R>) => SchemaClass<option_.Option<A>, I, R>;
3192
+ /**
3193
+ * Retrieves the first element of a `ReadonlyArray`.
3194
+ *
3195
+ * If the array is empty, it returns the `fallback` argument if provided; otherwise, it fails.
3196
+ *
3197
+ * @category ReadonlyArray transformations
3198
+ * @since 3.10.0
3199
+ */
3200
+ export declare const headOrElse: {
3201
+ /**
3202
+ * Retrieves the first element of a `ReadonlyArray`.
3203
+ *
3204
+ * If the array is empty, it returns the `fallback` argument if provided; otherwise, it fails.
3205
+ *
3206
+ * @category ReadonlyArray transformations
3207
+ * @since 3.10.0
3208
+ */
3209
+ <A>(fallback?: LazyArg<A>): <I, R>(self: Schema<ReadonlyArray<A>, I, R>) => SchemaClass<A, I, R>;
3210
+ /**
3211
+ * Retrieves the first element of a `ReadonlyArray`.
3212
+ *
3213
+ * If the array is empty, it returns the `fallback` argument if provided; otherwise, it fails.
3214
+ *
3215
+ * @category ReadonlyArray transformations
3216
+ * @since 3.10.0
3217
+ */
3218
+ <A, I, R>(self: Schema<ReadonlyArray<A>, I, R>, fallback?: LazyArg<A>): SchemaClass<A, I, R>;
3219
+ };
3220
+ /**
3221
+ * @category schema id
3222
+ * @since 3.10.0
3223
+ */
3224
+ export declare const ValidDateSchemaId: unique symbol;
3225
+ /**
3226
+ * Defines a filter that specifically rejects invalid dates, such as `new
3227
+ * Date("Invalid Date")`. This filter ensures that only properly formatted and
3228
+ * valid date objects are accepted, enhancing data integrity by preventing
3229
+ * erroneous date values from being processed.
3230
+ *
3231
+ * @category Date filters
3232
+ * @since 3.10.0
3233
+ */
3234
+ export declare const validDate: (annotations?: Annotations.Filter<Date>) => <I, R>(self: Schema<Date, I, R>) => filter<Schema<Date, I, R>>;
3235
+ /**
3236
+ * @category schema id
3237
+ * @since 3.10.0
3238
+ */
3239
+ export declare const LessThanDateSchemaId: unique symbol;
3240
+ /**
3241
+ * @category Date filters
3242
+ * @since 3.10.0
3243
+ */
3244
+ export declare const lessThanDate: <A extends Date>(max: Date, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3245
+ /**
3246
+ * @category schema id
3247
+ * @since 3.10.0
3248
+ */
3249
+ export declare const LessThanOrEqualToDateSchemaId: unique symbol;
3250
+ /**
3251
+ * @category Date filters
3252
+ * @since 3.10.0
3253
+ */
3254
+ export declare const lessThanOrEqualToDate: <A extends Date>(max: Date, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3255
+ /**
3256
+ * @category schema id
3257
+ * @since 3.10.0
3258
+ */
3259
+ export declare const GreaterThanDateSchemaId: unique symbol;
3260
+ /**
3261
+ * @category Date filters
3262
+ * @since 3.10.0
3263
+ */
3264
+ export declare const greaterThanDate: <A extends Date>(min: Date, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3265
+ /**
3266
+ * @category schema id
3267
+ * @since 3.10.0
3268
+ */
3269
+ export declare const GreaterThanOrEqualToDateSchemaId: unique symbol;
3270
+ /**
3271
+ * @category Date filters
3272
+ * @since 3.10.0
3273
+ */
3274
+ export declare const greaterThanOrEqualToDate: <A extends Date>(min: Date, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3275
+ /**
3276
+ * @category schema id
3277
+ * @since 3.10.0
3278
+ */
3279
+ export declare const BetweenDateSchemaId: unique symbol;
3280
+ /**
3281
+ * @category Date filters
3282
+ * @since 3.10.0
3283
+ */
3284
+ export declare const betweenDate: <A extends Date>(minimum: Date, maximum: Date, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3285
+ declare const DateFromSelf_base: SchemaClass<Date, Date, never>;
3286
+ /**
3287
+ * Describes a schema that accommodates potentially invalid `Date` instances,
3288
+ * such as `new Date("Invalid Date")`, without rejection.
3289
+ *
3290
+ * @category Date constructors
3291
+ * @since 3.10.0
3292
+ */
3293
+ export declare class DateFromSelf extends DateFromSelf_base {
3294
+ }
3295
+ declare const ValidDateFromSelf_base: filter<Schema<Date, Date, never>>;
3296
+ /**
3297
+ * Defines a schema that ensures only valid dates are accepted. This schema
3298
+ * rejects values like `new Date("Invalid Date")`, which, despite being a `Date`
3299
+ * instance, represents an invalid date. Such stringent validation ensures that
3300
+ * all date objects processed through this schema are properly formed and
3301
+ * represent real dates.
3302
+ *
3303
+ * @category Date constructors
3304
+ * @since 3.10.0
3305
+ */
3306
+ export declare class ValidDateFromSelf extends ValidDateFromSelf_base {
3307
+ }
3308
+ declare const DateFromString_base: transform<SchemaClass<string, string, never>, typeof DateFromSelf>;
3309
+ /**
3310
+ * Defines a schema that attempts to convert a `string` to a `Date` object using
3311
+ * the `new Date` constructor. This conversion is lenient, meaning it does not
3312
+ * reject strings that do not form valid dates (e.g., using `new Date("Invalid
3313
+ * Date")` results in a `Date` object, despite being invalid).
3314
+ *
3315
+ * @category Date transformations
3316
+ * @since 3.10.0
3317
+ */
3318
+ export declare class DateFromString extends DateFromString_base {
3319
+ }
3320
+ declare const Date$_base: filter<Schema<Date, string, never>>;
3321
+ /** @ignore */
3322
+ declare class Date$ extends Date$_base {
3323
+ }
3324
+ export {
3325
+ /**
3326
+ * This schema converts a `string` into a `Date` object using the `new Date`
3327
+ * constructor. It ensures that only valid date strings are accepted,
3328
+ * rejecting any strings that would result in an invalid date, such as `new
3329
+ * Date("Invalid Date")`.
3330
+ *
3331
+ * @category Date transformations
3332
+ * @since 3.10.0
3333
+ */
3334
+ Date$ as Date };
3335
+ declare const DateFromNumber_base: transform<SchemaClass<number, number, never>, typeof DateFromSelf>;
3336
+ /**
3337
+ * Defines a schema that converts a `number` into a `Date` object using the `new
3338
+ * Date` constructor. This schema does not validate the numerical input,
3339
+ * allowing potentially invalid values such as `NaN`, `Infinity`, and
3340
+ * `-Infinity` to be converted into `Date` objects. During the encoding process,
3341
+ * any invalid `Date` object will be encoded to `NaN`.
3342
+ *
3343
+ * @category Date transformations
3344
+ * @since 3.10.0
3345
+ */
3346
+ export declare class DateFromNumber extends DateFromNumber_base {
3347
+ }
3348
+ declare const DateTimeUtcFromSelf_base: SchemaClass<dateTime.Utc, dateTime.Utc, never>;
3349
+ /**
3350
+ * Describes a schema that represents a `DateTime.Utc` instance.
3351
+ *
3352
+ * @category DateTime.Utc constructors
3353
+ * @since 3.10.0
3354
+ */
3355
+ export declare class DateTimeUtcFromSelf extends DateTimeUtcFromSelf_base {
3356
+ }
3357
+ declare const DateTimeUtcFromNumber_base: transformOrFail<SchemaClass<number, number, never>, typeof DateTimeUtcFromSelf, never>;
3358
+ /**
3359
+ * Defines a schema that attempts to convert a `number` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor.
3360
+ *
3361
+ * @category DateTime.Utc transformations
3362
+ * @since 3.10.0
3363
+ */
3364
+ export declare class DateTimeUtcFromNumber extends DateTimeUtcFromNumber_base {
3365
+ }
3366
+ declare const DateTimeUtc_base: transformOrFail<SchemaClass<string, string, never>, typeof DateTimeUtcFromSelf, never>;
3367
+ /**
3368
+ * Defines a schema that attempts to convert a `string` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor.
3369
+ *
3370
+ * @category DateTime.Utc transformations
3371
+ * @since 3.10.0
3372
+ */
3373
+ export declare class DateTimeUtc extends DateTimeUtc_base {
3374
+ }
3375
+ declare const TimeZoneOffsetFromSelf_base: SchemaClass<dateTime.TimeZone.Offset, dateTime.TimeZone.Offset, never>;
3376
+ /**
3377
+ * Describes a schema that represents a `TimeZone.Offset` instance.
3378
+ *
3379
+ * @category TimeZone constructors
3380
+ * @since 3.10.0
3381
+ */
3382
+ export declare class TimeZoneOffsetFromSelf extends TimeZoneOffsetFromSelf_base {
3383
+ }
3384
+ declare const TimeZoneOffset_base: transform<SchemaClass<number, number, never>, typeof TimeZoneOffsetFromSelf>;
3385
+ /**
3386
+ * Defines a schema that converts a `number` to a `TimeZone.Offset` instance using the `DateTime.zoneMakeOffset` constructor.
3387
+ *
3388
+ * @category TimeZone transformations
3389
+ * @since 3.10.0
3390
+ */
3391
+ export declare class TimeZoneOffset extends TimeZoneOffset_base {
3392
+ }
3393
+ declare const TimeZoneNamedFromSelf_base: SchemaClass<dateTime.TimeZone.Named, dateTime.TimeZone.Named, never>;
3394
+ /**
3395
+ * Describes a schema that represents a `TimeZone.Named` instance.
3396
+ *
3397
+ * @category TimeZone constructors
3398
+ * @since 3.10.0
3399
+ */
3400
+ export declare class TimeZoneNamedFromSelf extends TimeZoneNamedFromSelf_base {
3401
+ }
3402
+ declare const TimeZoneNamed_base: transformOrFail<SchemaClass<string, string, never>, typeof TimeZoneNamedFromSelf, never>;
3403
+ /**
3404
+ * Defines a schema that attempts to convert a `string` to a `TimeZone.Named` instance using the `DateTime.zoneUnsafeMakeNamed` constructor.
3405
+ *
3406
+ * @category TimeZone transformations
3407
+ * @since 3.10.0
3408
+ */
3409
+ export declare class TimeZoneNamed extends TimeZoneNamed_base {
3410
+ }
3411
+ /**
3412
+ * @category api interface
3413
+ * @since 3.10.0
3414
+ */
3415
+ export interface TimeZoneFromSelf extends Union<[typeof TimeZoneOffsetFromSelf, typeof TimeZoneNamedFromSelf]> {
3416
+ annotations(annotations: Annotations.Schema<dateTime.TimeZone>): TimeZoneFromSelf;
3417
+ }
3418
+ /**
3419
+ * @category TimeZone constructors
3420
+ * @since 3.10.0
3421
+ */
3422
+ export declare const TimeZoneFromSelf: TimeZoneFromSelf;
3423
+ declare const TimeZone_base: transformOrFail<SchemaClass<string, string, never>, TimeZoneFromSelf, never>;
3424
+ /**
3425
+ * Defines a schema that attempts to convert a `string` to a `TimeZone` using the `DateTime.zoneFromString` constructor.
3426
+ *
3427
+ * @category TimeZone transformations
3428
+ * @since 3.10.0
3429
+ */
3430
+ export declare class TimeZone extends TimeZone_base {
3431
+ }
3432
+ declare const DateTimeZonedFromSelf_base: SchemaClass<dateTime.Zoned, dateTime.Zoned, never>;
3433
+ /**
3434
+ * Describes a schema that represents a `DateTime.Zoned` instance.
3435
+ *
3436
+ * @category DateTime.Zoned constructors
3437
+ * @since 3.10.0
3438
+ */
3439
+ export declare class DateTimeZonedFromSelf extends DateTimeZonedFromSelf_base {
3440
+ }
3441
+ declare const DateTimeZoned_base: transformOrFail<SchemaClass<string, string, never>, typeof DateTimeZonedFromSelf, never>;
3442
+ /**
3443
+ * Defines a schema that attempts to convert a `string` to a `DateTime.Zoned` instance.
3444
+ *
3445
+ * @category DateTime.Zoned transformations
3446
+ * @since 3.10.0
3447
+ */
3448
+ export declare class DateTimeZoned extends DateTimeZoned_base {
3449
+ }
3450
+ /**
3451
+ * @category Option utils
3452
+ * @since 3.10.0
3453
+ */
3454
+ export type OptionEncoded<I> = {
3455
+ readonly _tag: "None";
3456
+ } | {
3457
+ readonly _tag: "Some";
3458
+ readonly value: I;
3459
+ };
3460
+ /**
3461
+ * @category api interface
3462
+ * @since 3.10.0
3463
+ */
3464
+ export interface OptionFromSelf<Value extends Schema.Any> extends AnnotableClass<OptionFromSelf<Value>, option_.Option<Schema.Type<Value>>, option_.Option<Schema.Encoded<Value>>, Schema.Context<Value>> {
3465
+ }
3466
+ /**
3467
+ * @category Option transformations
3468
+ * @since 3.10.0
3469
+ */
3470
+ export declare const OptionFromSelf: <Value extends Schema.Any>(value: Value) => OptionFromSelf<Value>;
3471
+ /**
3472
+ * @category api interface
3473
+ * @since 3.10.0
3474
+ */
3475
+ export interface Option<Value extends Schema.Any> extends AnnotableClass<Option<Value>, option_.Option<Schema.Type<Value>>, OptionEncoded<Schema.Encoded<Value>>, Schema.Context<Value>> {
3476
+ }
3477
+ /**
3478
+ * @category Option transformations
3479
+ * @since 3.10.0
3480
+ */
3481
+ export declare const Option: <Value extends Schema.Any>(value: Value) => Option<Value>;
3482
+ /**
3483
+ * @category api interface
3484
+ * @since 3.10.0
3485
+ */
3486
+ export interface OptionFromNullOr<Value extends Schema.Any> extends AnnotableClass<OptionFromNullOr<Value>, option_.Option<Schema.Type<Value>>, Schema.Encoded<Value> | null, Schema.Context<Value>> {
3487
+ }
3488
+ /**
3489
+ * @category Option transformations
3490
+ * @since 3.10.0
3491
+ */
3492
+ export declare const OptionFromNullOr: <Value extends Schema.Any>(value: Value) => OptionFromNullOr<Value>;
3493
+ /**
3494
+ * @category api interface
3495
+ * @since 3.10.0
3496
+ */
3497
+ export interface OptionFromNullishOr<Value extends Schema.Any> extends AnnotableClass<OptionFromNullishOr<Value>, option_.Option<Schema.Type<Value>>, Schema.Encoded<Value> | null | undefined, Schema.Context<Value>> {
3498
+ }
3499
+ /**
3500
+ * @category Option transformations
3501
+ * @since 3.10.0
3502
+ */
3503
+ export declare const OptionFromNullishOr: <Value extends Schema.Any>(value: Value, onNoneEncoding: null | undefined) => OptionFromNullishOr<Value>;
3504
+ /**
3505
+ * @category api interface
3506
+ * @since 3.10.0
3507
+ */
3508
+ export interface OptionFromUndefinedOr<Value extends Schema.Any> extends AnnotableClass<OptionFromUndefinedOr<Value>, option_.Option<Schema.Type<Value>>, Schema.Encoded<Value> | undefined, Schema.Context<Value>> {
3509
+ }
3510
+ /**
3511
+ * @category Option transformations
3512
+ * @since 3.10.0
3513
+ */
3514
+ export declare const OptionFromUndefinedOr: <Value extends Schema.Any>(value: Value) => OptionFromUndefinedOr<Value>;
3515
+ /**
3516
+ * Transforms strings into an Option type, effectively filtering out empty or
3517
+ * whitespace-only strings by trimming them and checking their length. Returns
3518
+ * `none` for invalid inputs and `some` for valid non-empty strings.
3519
+ *
3520
+ * @example
3521
+ * import { Schema } from "effect"
3522
+ *
3523
+ * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("")) // Option.none()
3524
+ * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)(" a ")) // Option.some("a")
3525
+ * console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("a")) // Option.some("a")
3526
+ *
3527
+ * @category Option transformations
3528
+ * @since 3.10.0
3529
+ */
3530
+ export declare const OptionFromNonEmptyTrimmedString: transform<typeof String$, OptionFromSelf<typeof NonEmptyTrimmedString>>;
3531
+ /**
3532
+ * @category Either utils
3533
+ * @since 3.10.0
3534
+ */
3535
+ export type RightEncoded<IA> = {
3536
+ readonly _tag: "Right";
3537
+ readonly right: IA;
3538
+ };
3539
+ /**
3540
+ * @category Either utils
3541
+ * @since 3.10.0
3542
+ */
3543
+ export type LeftEncoded<IE> = {
3544
+ readonly _tag: "Left";
3545
+ readonly left: IE;
3546
+ };
3547
+ /**
3548
+ * @category Either utils
3549
+ * @since 3.10.0
3550
+ */
3551
+ export type EitherEncoded<IR, IL> = RightEncoded<IR> | LeftEncoded<IL>;
3552
+ /**
3553
+ * @category api interface
3554
+ * @since 3.10.0
3555
+ */
3556
+ export interface EitherFromSelf<R extends Schema.All, L extends Schema.All> extends AnnotableClass<EitherFromSelf<R, L>, either_.Either<Schema.Type<R>, Schema.Type<L>>, either_.Either<Schema.Encoded<R>, Schema.Encoded<L>>, Schema.Context<R> | Schema.Context<L>> {
3557
+ }
3558
+ /**
3559
+ * @category Either transformations
3560
+ * @since 3.10.0
3561
+ */
3562
+ export declare const EitherFromSelf: <R extends Schema.All, L extends Schema.All>({ left, right }: {
3563
+ readonly left: L;
3564
+ readonly right: R;
3565
+ }) => EitherFromSelf<R, L>;
3566
+ /**
3567
+ * @category api interface
3568
+ * @since 3.10.0
3569
+ */
3570
+ export interface Either<R extends Schema.All, L extends Schema.All> extends AnnotableClass<Either<R, L>, either_.Either<Schema.Type<R>, Schema.Type<L>>, EitherEncoded<Schema.Encoded<R>, Schema.Encoded<L>>, Schema.Context<R> | Schema.Context<L>> {
3571
+ }
3572
+ /**
3573
+ * @category Either transformations
3574
+ * @since 3.10.0
3575
+ */
3576
+ export declare const Either: <R extends Schema.All, L extends Schema.All>({ left, right }: {
3577
+ readonly left: L;
3578
+ readonly right: R;
3579
+ }) => Either<R, L>;
3580
+ /**
3581
+ * @category api interface
3582
+ * @since 3.10.0
3583
+ */
3584
+ export interface EitherFromUnion<R extends Schema.All, L extends Schema.All> extends AnnotableClass<EitherFromUnion<R, L>, either_.Either<Schema.Type<R>, Schema.Type<L>>, Schema.Encoded<R> | Schema.Encoded<L>, Schema.Context<R> | Schema.Context<L>> {
3585
+ }
3586
+ /**
3587
+ * @example
3588
+ * import * as Schema from "effect/Schema"
3589
+ *
3590
+ * // Schema<string | number, Either<string, number>>
3591
+ * Schema.EitherFromUnion({ left: Schema.String, right: Schema.Number })
3592
+ *
3593
+ * @category Either transformations
3594
+ * @since 3.10.0
3595
+ */
3596
+ export declare const EitherFromUnion: <R extends Schema.All, L extends Schema.All>({ left, right }: {
3597
+ readonly left: L;
3598
+ readonly right: R;
3599
+ }) => EitherFromUnion<R, L>;
3600
+ /**
3601
+ * @category api interface
3602
+ * @since 3.10.0
3603
+ */
3604
+ export interface ReadonlyMapFromSelf<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<ReadonlyMapFromSelf<K, V>, ReadonlyMap<Schema.Type<K>, Schema.Type<V>>, ReadonlyMap<Schema.Encoded<K>, Schema.Encoded<V>>, Schema.Context<K> | Schema.Context<V>> {
3605
+ }
3606
+ /**
3607
+ * @category ReadonlyMap
3608
+ * @since 3.10.0
3609
+ */
3610
+ export declare const ReadonlyMapFromSelf: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
3611
+ readonly key: K;
3612
+ readonly value: V;
3613
+ }) => ReadonlyMapFromSelf<K, V>;
3614
+ /**
3615
+ * @category api interface
3616
+ * @since 3.10.0
3617
+ */
3618
+ export interface MapFromSelf<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<MapFromSelf<K, V>, Map<Schema.Type<K>, Schema.Type<V>>, ReadonlyMap<Schema.Encoded<K>, Schema.Encoded<V>>, Schema.Context<K> | Schema.Context<V>> {
3619
+ }
3620
+ /**
3621
+ * @category Map
3622
+ * @since 3.10.0
3623
+ */
3624
+ export declare const MapFromSelf: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
3625
+ readonly key: K;
3626
+ readonly value: V;
3627
+ }) => MapFromSelf<K, V>;
3628
+ /**
3629
+ * @category api interface
3630
+ * @since 3.10.0
3631
+ */
3632
+ export interface ReadonlyMap$<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<ReadonlyMap$<K, V>, ReadonlyMap<Schema.Type<K>, Schema.Type<V>>, ReadonlyArray<readonly [Schema.Encoded<K>, Schema.Encoded<V>]>, Schema.Context<K> | Schema.Context<V>> {
3633
+ }
3634
+ /**
3635
+ * @category ReadonlyMap transformations
3636
+ * @since 3.10.0
3637
+ */
3638
+ export declare const ReadonlyMap: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
3639
+ readonly key: K;
3640
+ readonly value: V;
3641
+ }) => ReadonlyMap$<K, V>;
3642
+ /**
3643
+ * @category api interface
3644
+ * @since 3.10.0
3645
+ */
3646
+ export interface Map$<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<Map$<K, V>, Map<Schema.Type<K>, Schema.Type<V>>, ReadonlyArray<readonly [Schema.Encoded<K>, Schema.Encoded<V>]>, Schema.Context<K> | Schema.Context<V>> {
3647
+ }
3648
+ declare const map: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
3649
+ readonly key: K;
3650
+ readonly value: V;
3651
+ }) => Map$<K, V>;
3652
+ export {
3653
+ /**
3654
+ * @category Map transformations
3655
+ * @since 3.10.0
3656
+ */
3657
+ map as Map };
3658
+ /**
3659
+ * @category ReadonlyMap transformations
3660
+ * @since 3.10.0
3661
+ */
3662
+ export declare const ReadonlyMapFromRecord: <KA, KR, VA, VI, VR>({ key, value }: {
3663
+ key: Schema<KA, string, KR>;
3664
+ value: Schema<VA, VI, VR>;
3665
+ }) => Schema<ReadonlyMap<KA, VA>, {
3666
+ readonly [x: string]: VI;
3667
+ }, KR | VR>;
3668
+ /**
3669
+ * @category Map transformations
3670
+ * @since 3.10.0
3671
+ */
3672
+ export declare const MapFromRecord: <KA, KR, VA, VI, VR>({ key, value }: {
3673
+ key: Schema<KA, string, KR>;
3674
+ value: Schema<VA, VI, VR>;
3675
+ }) => Schema<Map<KA, VA>, {
3676
+ readonly [x: string]: VI;
3677
+ }, KR | VR>;
3678
+ /**
3679
+ * @category api interface
3680
+ * @since 3.10.0
3681
+ */
3682
+ export interface ReadonlySetFromSelf<Value extends Schema.Any> extends AnnotableClass<ReadonlySetFromSelf<Value>, ReadonlySet<Schema.Type<Value>>, ReadonlySet<Schema.Encoded<Value>>, Schema.Context<Value>> {
3683
+ }
3684
+ /**
3685
+ * @category ReadonlySet
3686
+ * @since 3.10.0
3687
+ */
3688
+ export declare const ReadonlySetFromSelf: <Value extends Schema.Any>(value: Value) => ReadonlySetFromSelf<Value>;
3689
+ /**
3690
+ * @category api interface
3691
+ * @since 3.10.0
3692
+ */
3693
+ export interface SetFromSelf<Value extends Schema.Any> extends AnnotableClass<SetFromSelf<Value>, Set<Schema.Type<Value>>, ReadonlySet<Schema.Encoded<Value>>, Schema.Context<Value>> {
3694
+ }
3695
+ /**
3696
+ * @category Set
3697
+ * @since 3.10.0
3698
+ */
3699
+ export declare const SetFromSelf: <Value extends Schema.Any>(value: Value) => SetFromSelf<Value>;
3700
+ /**
3701
+ * @category api interface
3702
+ * @since 3.10.0
3703
+ */
3704
+ export interface ReadonlySet$<Value extends Schema.Any> extends AnnotableClass<ReadonlySet$<Value>, ReadonlySet<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
3705
+ }
3706
+ /**
3707
+ * @category ReadonlySet transformations
3708
+ * @since 3.10.0
3709
+ */
3710
+ export declare const ReadonlySet: <Value extends Schema.Any>(value: Value) => ReadonlySet$<Value>;
3711
+ /**
3712
+ * @category api interface
3713
+ * @since 3.10.0
3714
+ */
3715
+ export interface Set$<Value extends Schema.Any> extends AnnotableClass<Set$<Value>, Set<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
3716
+ }
3717
+ declare const set: <Value extends Schema.Any>(value: Value) => Set$<Value>;
3718
+ export {
3719
+ /**
3720
+ * @category Set transformations
3721
+ * @since 3.10.0
3722
+ */
3723
+ set as Set };
3724
+ declare const BigDecimalFromSelf_base: SchemaClass<bigDecimal_.BigDecimal, bigDecimal_.BigDecimal, never>;
3725
+ /**
3726
+ * @category BigDecimal constructors
3727
+ * @since 3.10.0
3728
+ */
3729
+ export declare class BigDecimalFromSelf extends BigDecimalFromSelf_base {
3730
+ }
3731
+ declare const BigDecimal_base: transformOrFail<SchemaClass<string, string, never>, typeof BigDecimalFromSelf, never>;
3732
+ /**
3733
+ * @category BigDecimal transformations
3734
+ * @since 3.10.0
3735
+ */
3736
+ export declare class BigDecimal extends BigDecimal_base {
3737
+ }
3738
+ declare const BigDecimalFromNumber_base: transformOrFail<SchemaClass<number, number, never>, typeof BigDecimalFromSelf, never>;
3739
+ /**
3740
+ * A schema that transforms a `number` into a `BigDecimal`.
3741
+ * When encoding, this Schema will produce incorrect results if the BigDecimal exceeds the 64-bit range of a number.
3742
+ *
3743
+ * @category BigDecimal transformations
3744
+ * @since 3.10.0
3745
+ */
3746
+ export declare class BigDecimalFromNumber extends BigDecimalFromNumber_base {
3747
+ }
3748
+ /**
3749
+ * @category schema id
3750
+ * @since 3.10.0
3751
+ */
3752
+ export declare const GreaterThanBigDecimalSchemaId: unique symbol;
3753
+ /**
3754
+ * @category BigDecimal filters
3755
+ * @since 3.10.0
3756
+ */
3757
+ export declare const greaterThanBigDecimal: <A extends bigDecimal_.BigDecimal>(min: bigDecimal_.BigDecimal, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3758
+ /**
3759
+ * @category schema id
3760
+ * @since 3.10.0
3761
+ */
3762
+ export declare const GreaterThanOrEqualToBigDecimalSchemaId: unique symbol;
3763
+ /**
3764
+ * @category BigDecimal filters
3765
+ * @since 3.10.0
3766
+ */
3767
+ export declare const greaterThanOrEqualToBigDecimal: <A extends bigDecimal_.BigDecimal>(min: bigDecimal_.BigDecimal, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3768
+ /**
3769
+ * @category schema id
3770
+ * @since 3.10.0
3771
+ */
3772
+ export declare const LessThanBigDecimalSchemaId: unique symbol;
3773
+ /**
3774
+ * @category BigDecimal filters
3775
+ * @since 3.10.0
3776
+ */
3777
+ export declare const lessThanBigDecimal: <A extends bigDecimal_.BigDecimal>(max: bigDecimal_.BigDecimal, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3778
+ /**
3779
+ * @category schema id
3780
+ * @since 3.10.0
3781
+ */
3782
+ export declare const LessThanOrEqualToBigDecimalSchemaId: unique symbol;
3783
+ /**
3784
+ * @category BigDecimal filters
3785
+ * @since 3.10.0
3786
+ */
3787
+ export declare const lessThanOrEqualToBigDecimal: <A extends bigDecimal_.BigDecimal>(max: bigDecimal_.BigDecimal, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3788
+ /**
3789
+ * @category schema id
3790
+ * @since 3.10.0
3791
+ */
3792
+ export declare const PositiveBigDecimalSchemaId: unique symbol;
3793
+ /**
3794
+ * @category BigDecimal filters
3795
+ * @since 3.10.0
3796
+ */
3797
+ export declare const positiveBigDecimal: <A extends bigDecimal_.BigDecimal>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3798
+ /**
3799
+ * @category BigDecimal constructors
3800
+ * @since 3.10.0
3801
+ */
3802
+ export declare const PositiveBigDecimalFromSelf: filter<Schema<bigDecimal_.BigDecimal>>;
3803
+ /**
3804
+ * @category schema id
3805
+ * @since 3.10.0
3806
+ */
3807
+ export declare const NonNegativeBigDecimalSchemaId: unique symbol;
3808
+ /**
3809
+ * @category BigDecimal filters
3810
+ * @since 3.10.0
3811
+ */
3812
+ export declare const nonNegativeBigDecimal: <A extends bigDecimal_.BigDecimal>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3813
+ /**
3814
+ * @category BigDecimal constructors
3815
+ * @since 3.10.0
3816
+ */
3817
+ export declare const NonNegativeBigDecimalFromSelf: filter<Schema<bigDecimal_.BigDecimal>>;
3818
+ /**
3819
+ * @category schema id
3820
+ * @since 3.10.0
3821
+ */
3822
+ export declare const NegativeBigDecimalSchemaId: unique symbol;
3823
+ /**
3824
+ * @category BigDecimal filters
3825
+ * @since 3.10.0
3826
+ */
3827
+ export declare const negativeBigDecimal: <A extends bigDecimal_.BigDecimal>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3828
+ /**
3829
+ * @category BigDecimal constructors
3830
+ * @since 3.10.0
3831
+ */
3832
+ export declare const NegativeBigDecimalFromSelf: filter<Schema<bigDecimal_.BigDecimal>>;
3833
+ /**
3834
+ * @category schema id
3835
+ * @since 3.10.0
3836
+ */
3837
+ export declare const NonPositiveBigDecimalSchemaId: unique symbol;
3838
+ /**
3839
+ * @category BigDecimal filters
3840
+ * @since 3.10.0
3841
+ */
3842
+ export declare const nonPositiveBigDecimal: <A extends bigDecimal_.BigDecimal>(annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3843
+ /**
3844
+ * @category BigDecimal constructors
3845
+ * @since 3.10.0
3846
+ */
3847
+ export declare const NonPositiveBigDecimalFromSelf: filter<Schema<bigDecimal_.BigDecimal>>;
3848
+ /**
3849
+ * @category schema id
3850
+ * @since 3.10.0
3851
+ */
3852
+ export declare const BetweenBigDecimalSchemaId: unique symbol;
3853
+ /**
3854
+ * @category BigDecimal filters
3855
+ * @since 3.10.0
3856
+ */
3857
+ export declare const betweenBigDecimal: <A extends bigDecimal_.BigDecimal>(minimum: bigDecimal_.BigDecimal, maximum: bigDecimal_.BigDecimal, annotations?: Annotations.Filter<A>) => <I, R>(self: Schema<A, I, R>) => filter<Schema<A, I, R>>;
3858
+ /**
3859
+ * Clamps a `BigDecimal` between a minimum and a maximum value.
3860
+ *
3861
+ * @category BigDecimal transformations
3862
+ * @since 3.10.0
3863
+ */
3864
+ export declare const clampBigDecimal: (minimum: bigDecimal_.BigDecimal, maximum: bigDecimal_.BigDecimal) => <A extends bigDecimal_.BigDecimal, I, R>(self: Schema<A, I, R>) => transform<Schema<A, I, R>, filter<Schema<A>>>;
3865
+ /**
3866
+ * @category api interface
3867
+ * @since 3.10.0
3868
+ */
3869
+ export interface ChunkFromSelf<Value extends Schema.Any> extends AnnotableClass<ChunkFromSelf<Value>, chunk_.Chunk<Schema.Type<Value>>, chunk_.Chunk<Schema.Encoded<Value>>, Schema.Context<Value>> {
3870
+ }
3871
+ /**
3872
+ * @category Chunk
3873
+ * @since 3.10.0
3874
+ */
3875
+ export declare const ChunkFromSelf: <Value extends Schema.Any>(value: Value) => ChunkFromSelf<Value>;
3876
+ /**
3877
+ * @category api interface
3878
+ * @since 3.10.0
3879
+ */
3880
+ export interface Chunk<Value extends Schema.Any> extends AnnotableClass<Chunk<Value>, chunk_.Chunk<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
3881
+ }
3882
+ /**
3883
+ * @category Chunk transformations
3884
+ * @since 3.10.0
3885
+ */
3886
+ export declare const Chunk: <Value extends Schema.Any>(value: Value) => Chunk<Value>;
3887
+ /**
3888
+ * @category api interface
3889
+ * @since 3.10.0
3890
+ */
3891
+ export interface NonEmptyChunkFromSelf<Value extends Schema.Any> extends AnnotableClass<NonEmptyChunkFromSelf<Value>, chunk_.NonEmptyChunk<Schema.Type<Value>>, chunk_.NonEmptyChunk<Schema.Encoded<Value>>, Schema.Context<Value>> {
3892
+ }
3893
+ /**
3894
+ * @category Chunk
3895
+ * @since 3.10.0
3896
+ */
3897
+ export declare const NonEmptyChunkFromSelf: <Value extends Schema.Any>(value: Value) => NonEmptyChunkFromSelf<Value>;
3898
+ /**
3899
+ * @category api interface
3900
+ * @since 3.10.0
3901
+ */
3902
+ export interface NonEmptyChunk<Value extends Schema.Any> extends AnnotableClass<NonEmptyChunk<Value>, chunk_.NonEmptyChunk<Schema.Type<Value>>, array_.NonEmptyReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
3903
+ }
3904
+ /**
3905
+ * @category Chunk transformations
3906
+ * @since 3.10.0
3907
+ */
3908
+ export declare const NonEmptyChunk: <Value extends Schema.Any>(value: Value) => NonEmptyChunk<Value>;
3909
+ /**
3910
+ * @category Data transformations
3911
+ * @since 3.10.0
3912
+ */
3913
+ export declare const DataFromSelf: <R, I extends Readonly<Record<string, any>> | ReadonlyArray<any>, A extends Readonly<Record<string, any>> | ReadonlyArray<any>>(item: Schema<A, I, R>) => SchemaClass<A, I, R>;
3914
+ /**
3915
+ * @category Data transformations
3916
+ * @since 3.10.0
3917
+ */
3918
+ export declare const Data: <R, I extends Readonly<Record<string, any>> | ReadonlyArray<any>, A extends Readonly<Record<string, any>> | ReadonlyArray<any>>(item: Schema<A, I, R>) => SchemaClass<A, I, R>;
3919
+ type MissingSelfGeneric<Usage extends string, Params extends string = ""> = `Missing \`Self\` generic - use \`class Self extends ${Usage}<Self>()(${Params}{ ... })\``;
3920
+ type RequiredKeys<T> = {
3921
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
3922
+ }[keyof T];
3923
+ /**
3924
+ * @category api interface
3925
+ * @since 3.10.0
3926
+ */
3927
+ export interface Class<Self, Fields extends Struct.Fields, I, R, C, Inherited, Proto> extends Schema<Self, Simplify<I>, R> {
3928
+ new (props: RequiredKeys<C> extends never ? void | Simplify<C> : Simplify<C>, options?: MakeOptions): Struct.Type<Fields> & Omit<Inherited, keyof Fields> & Proto;
3929
+ /** @since 3.10.0 */
3930
+ readonly ast: AST.Transformation;
3931
+ make<Args extends Array<any>, X>(this: {
3932
+ new (...args: Args): X;
3933
+ }, ...args: Args): X;
3934
+ annotations(annotations: Annotations.Schema<Self>): SchemaClass<Self, Simplify<I>, R>;
3935
+ readonly fields: {
3936
+ readonly [K in keyof Fields]: Fields[K];
3937
+ };
3938
+ readonly identifier: string;
3939
+ extend<Extended = never>(identifier: string): <newFields extends Struct.Fields>(fields: newFields | HasFields<newFields>, annotations?: Annotations.Schema<Extended>) => [Extended] extends [never] ? MissingSelfGeneric<"Base.extend"> : Class<Extended, Fields & newFields, I & Struct.Encoded<newFields>, R | Struct.Context<newFields>, C & Struct.Constructor<newFields>, Self, Proto>;
3940
+ transformOrFail<Transformed = never>(identifier: string): <newFields extends Struct.Fields, R2, R3>(fields: newFields, options: {
3941
+ readonly decode: (input: Simplify<Struct.Type<Fields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Simplify<Struct.Type<Fields & newFields>>, ParseResult.ParseIssue, R2>;
3942
+ readonly encode: (input: Simplify<Struct.Type<Fields & newFields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Struct.Type<Fields>, ParseResult.ParseIssue, R3>;
3943
+ }, annotations?: Annotations.Schema<Transformed>) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformOrFail"> : Class<Transformed, Fields & newFields, I, R | Struct.Context<newFields> | R2 | R3, C & Struct.Constructor<newFields>, Self, Proto>;
3944
+ transformOrFailFrom<Transformed = never>(identifier: string): <newFields extends Struct.Fields, R2, R3>(fields: newFields, options: {
3945
+ readonly decode: (input: Simplify<I>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Simplify<I & Struct.Encoded<newFields>>, ParseResult.ParseIssue, R2>;
3946
+ readonly encode: (input: Simplify<I & Struct.Encoded<newFields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<I, ParseResult.ParseIssue, R3>;
3947
+ }, annotations?: Annotations.Schema<Transformed>) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformOrFailFrom"> : Class<Transformed, Fields & newFields, I, R | Struct.Context<newFields> | R2 | R3, C & Struct.Constructor<newFields>, Self, Proto>;
3948
+ }
3949
+ type HasFields<Fields extends Struct.Fields> = Struct<Fields> | {
3950
+ readonly [RefineSchemaId]: HasFields<Fields>;
3951
+ };
3952
+ /**
3953
+ * @category classes
3954
+ * @since 3.10.0
3955
+ */
3956
+ export declare const Class: <Self = never>(identifier: string) => <Fields extends Struct.Fields>(fieldsOr: Fields | HasFields<Fields>, annotations?: Annotations.Schema<Self>) => [Self] extends [never] ? MissingSelfGeneric<"Class"> : Class<Self, Fields, Struct.Encoded<Fields>, Struct.Context<Fields>, Struct.Constructor<Fields>, {}, {}>;
3957
+ /**
3958
+ * @category api interface
3959
+ * @since 3.10.0
3960
+ */
3961
+ export interface TaggedClass<Self, Tag extends string, Fields extends Struct.Fields> extends Class<Self, Fields, Struct.Encoded<Fields>, Struct.Context<Fields>, Struct.Constructor<Omit<Fields, "_tag">>, {}, {}> {
3962
+ readonly _tag: Tag;
3963
+ }
3964
+ /**
3965
+ * @category classes
3966
+ * @since 3.10.0
3967
+ */
3968
+ export declare const TaggedClass: <Self = never>(identifier?: string) => <Tag extends string, Fields extends Struct.Fields>(tag: Tag, fieldsOr: Fields | HasFields<Fields>, annotations?: Annotations.Schema<Self>) => [Self] extends [never] ? MissingSelfGeneric<"TaggedClass", `"Tag", `> : TaggedClass<Self, Tag, {
3969
+ readonly _tag: tag<Tag>;
3970
+ } & Fields>;
3971
+ /**
3972
+ * @category api interface
3973
+ * @since 3.10.0
3974
+ */
3975
+ export interface TaggedErrorClass<Self, Tag extends string, Fields extends Struct.Fields> extends Class<Self, Fields, Struct.Encoded<Fields>, Struct.Context<Fields>, Struct.Constructor<Omit<Fields, "_tag">>, {}, cause_.YieldableError> {
3976
+ readonly _tag: Tag;
3977
+ }
3978
+ /**
3979
+ * @category classes
3980
+ * @since 3.10.0
3981
+ */
3982
+ export declare const TaggedError: <Self = never>(identifier?: string) => <Tag extends string, Fields extends Struct.Fields>(tag: Tag, fieldsOr: Fields | HasFields<Fields>, annotations?: Annotations.Schema<Self>) => [Self] extends [never] ? MissingSelfGeneric<"TaggedError", `"Tag", `> : TaggedErrorClass<Self, Tag, {
3983
+ readonly _tag: tag<Tag>;
3984
+ } & Fields>;
3985
+ type MakeOptions = boolean | {
3986
+ readonly disableValidation?: boolean;
3987
+ };
3988
+ /**
3989
+ * @category FiberId
3990
+ * @since 3.10.0
3991
+ */
3992
+ export type FiberIdEncoded = {
3993
+ readonly _tag: "Composite";
3994
+ readonly left: FiberIdEncoded;
3995
+ readonly right: FiberIdEncoded;
3996
+ } | {
3997
+ readonly _tag: "None";
3998
+ } | {
3999
+ readonly _tag: "Runtime";
4000
+ readonly id: number;
4001
+ readonly startTimeMillis: number;
4002
+ };
4003
+ declare const FiberIdFromSelf_base: SchemaClass<fiberId_.FiberId, fiberId_.FiberId, never>;
4004
+ /**
4005
+ * @category FiberId constructors
4006
+ * @since 3.10.0
4007
+ */
4008
+ export declare class FiberIdFromSelf extends FiberIdFromSelf_base {
4009
+ }
4010
+ declare const FiberId_base: transform<Schema<FiberIdEncoded, FiberIdEncoded, never>, typeof FiberIdFromSelf>;
4011
+ /**
4012
+ * @category FiberId transformations
4013
+ * @since 3.10.0
4014
+ */
4015
+ export declare class FiberId extends FiberId_base {
4016
+ }
4017
+ /**
4018
+ * @category Cause utils
4019
+ * @since 3.10.0
4020
+ */
4021
+ export type CauseEncoded<E, D> = {
4022
+ readonly _tag: "Empty";
4023
+ } | {
4024
+ readonly _tag: "Fail";
4025
+ readonly error: E;
4026
+ } | {
4027
+ readonly _tag: "Die";
4028
+ readonly defect: D;
4029
+ } | {
4030
+ readonly _tag: "Interrupt";
4031
+ readonly fiberId: FiberIdEncoded;
4032
+ } | {
4033
+ readonly _tag: "Sequential";
4034
+ readonly left: CauseEncoded<E, D>;
4035
+ readonly right: CauseEncoded<E, D>;
4036
+ } | {
4037
+ readonly _tag: "Parallel";
4038
+ readonly left: CauseEncoded<E, D>;
4039
+ readonly right: CauseEncoded<E, D>;
4040
+ };
4041
+ /**
4042
+ * @category api interface
4043
+ * @since 3.10.0
4044
+ */
4045
+ export interface CauseFromSelf<E extends Schema.All, D extends Schema.All> extends AnnotableClass<CauseFromSelf<E, D>, cause_.Cause<Schema.Type<E>>, cause_.Cause<Schema.Encoded<E>>, Schema.Context<E> | Schema.Context<D>> {
4046
+ }
4047
+ /**
4048
+ * @category Cause transformations
4049
+ * @since 3.10.0
4050
+ */
4051
+ export declare const CauseFromSelf: <E extends Schema.All, D extends Schema.All>({ defect, error }: {
4052
+ readonly error: E;
4053
+ readonly defect: D;
4054
+ }) => CauseFromSelf<E, D>;
4055
+ /**
4056
+ * @category api interface
4057
+ * @since 3.10.0
4058
+ */
4059
+ export interface Cause<E extends Schema.All, D extends Schema.All> extends AnnotableClass<Cause<E, D>, cause_.Cause<Schema.Type<E>>, CauseEncoded<Schema.Encoded<E>, Schema.Encoded<D>>, Schema.Context<E> | Schema.Context<D>> {
4060
+ }
4061
+ /**
4062
+ * @category Cause transformations
4063
+ * @since 3.10.0
4064
+ */
4065
+ export declare const Cause: <E extends Schema.All, D extends Schema.All>({ defect, error }: {
4066
+ readonly error: E;
4067
+ readonly defect: D;
4068
+ }) => Cause<E, D>;
4069
+ /**
4070
+ * @category api interface
4071
+ * @since 3.10.0
4072
+ */
4073
+ export interface Defect extends transform<typeof Unknown, typeof Unknown> {
4074
+ }
4075
+ /**
4076
+ * Defines a schema for handling JavaScript errors (`Error` instances) and other types of defects.
4077
+ * It decodes objects into Error instances if they match the expected structure (i.e., have a `message` and optionally a `name` and `stack`),
4078
+ * or converts other values to their string representations.
4079
+ *
4080
+ * When encoding, it converts `Error` instances back into plain objects containing only the error's name and message,
4081
+ * or other values into their string forms.
4082
+ *
4083
+ * This is useful for serializing and deserializing errors across network boundaries where error objects do not natively serialize.
4084
+ *
4085
+ * @category defect
4086
+ * @since 3.10.0
4087
+ */
4088
+ export declare const Defect: Defect;
4089
+ /**
4090
+ * @category Exit utils
4091
+ * @since 3.10.0
4092
+ */
4093
+ export type ExitEncoded<A, E, D> = {
4094
+ readonly _tag: "Failure";
4095
+ readonly cause: CauseEncoded<E, D>;
4096
+ } | {
4097
+ readonly _tag: "Success";
4098
+ readonly value: A;
4099
+ };
4100
+ /**
4101
+ * @category api interface
4102
+ * @since 3.10.0
4103
+ */
4104
+ export interface ExitFromSelf<A extends Schema.All, E extends Schema.All, D extends Schema.All> extends AnnotableClass<ExitFromSelf<A, E, D>, exit_.Exit<Schema.Type<A>, Schema.Type<E>>, exit_.Exit<Schema.Encoded<A>, Schema.Encoded<E>>, Schema.Context<A> | Schema.Context<E> | Schema.Context<D>> {
4105
+ }
4106
+ /**
4107
+ * @category Exit transformations
4108
+ * @since 3.10.0
4109
+ */
4110
+ export declare const ExitFromSelf: <A extends Schema.All, E extends Schema.All, D extends Schema.All>({ defect, failure, success }: {
4111
+ readonly failure: E;
4112
+ readonly success: A;
4113
+ readonly defect: D;
4114
+ }) => ExitFromSelf<A, E, D>;
4115
+ /**
4116
+ * @category api interface
4117
+ * @since 3.10.0
4118
+ */
4119
+ export interface Exit<A extends Schema.All, E extends Schema.All, D extends Schema.All> extends AnnotableClass<Exit<A, E, D>, exit_.Exit<Schema.Type<A>, Schema.Type<E>>, ExitEncoded<Schema.Encoded<A>, Schema.Encoded<E>, Schema.Encoded<D>>, Schema.Context<A> | Schema.Context<E> | Schema.Context<D>> {
4120
+ }
4121
+ /**
4122
+ * @category Exit transformations
4123
+ * @since 3.10.0
4124
+ */
4125
+ export declare const Exit: <A extends Schema.All, E extends Schema.All, D extends Schema.All>({ defect, failure, success }: {
4126
+ readonly failure: E;
4127
+ readonly success: A;
4128
+ readonly defect: D;
4129
+ }) => Exit<A, E, D>;
4130
+ /**
4131
+ * @category api interface
4132
+ * @since 3.10.0
4133
+ */
4134
+ export interface HashSetFromSelf<Value extends Schema.Any> extends AnnotableClass<HashSetFromSelf<Value>, hashSet_.HashSet<Schema.Type<Value>>, hashSet_.HashSet<Schema.Encoded<Value>>, Schema.Context<Value>> {
4135
+ }
4136
+ /**
4137
+ * @category HashSet transformations
4138
+ * @since 3.10.0
4139
+ */
4140
+ export declare const HashSetFromSelf: <Value extends Schema.Any>(value: Value) => HashSetFromSelf<Value>;
4141
+ /**
4142
+ * @category api interface
4143
+ * @since 3.10.0
4144
+ */
4145
+ export interface HashSet<Value extends Schema.Any> extends AnnotableClass<HashSet<Value>, hashSet_.HashSet<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
4146
+ }
4147
+ /**
4148
+ * @category HashSet transformations
4149
+ * @since 3.10.0
4150
+ */
4151
+ export declare const HashSet: <Value extends Schema.Any>(value: Value) => HashSet<Value>;
4152
+ /**
4153
+ * @category api interface
4154
+ * @since 3.10.0
4155
+ */
4156
+ export interface HashMapFromSelf<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<HashMapFromSelf<K, V>, hashMap_.HashMap<Schema.Type<K>, Schema.Type<V>>, hashMap_.HashMap<Schema.Encoded<K>, Schema.Encoded<V>>, Schema.Context<K> | Schema.Context<V>> {
4157
+ }
4158
+ /**
4159
+ * @category HashMap transformations
4160
+ * @since 3.10.0
4161
+ */
4162
+ export declare const HashMapFromSelf: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
4163
+ readonly key: K;
4164
+ readonly value: V;
4165
+ }) => HashMapFromSelf<K, V>;
4166
+ /**
4167
+ * @category api interface
4168
+ * @since 3.10.0
4169
+ */
4170
+ export interface HashMap<K extends Schema.Any, V extends Schema.Any> extends AnnotableClass<HashMap<K, V>, hashMap_.HashMap<Schema.Type<K>, Schema.Type<V>>, ReadonlyArray<readonly [Schema.Encoded<K>, Schema.Encoded<V>]>, Schema.Context<K> | Schema.Context<V>> {
4171
+ }
4172
+ /**
4173
+ * @category HashMap transformations
4174
+ * @since 3.10.0
4175
+ */
4176
+ export declare const HashMap: <K extends Schema.Any, V extends Schema.Any>({ key, value }: {
4177
+ readonly key: K;
4178
+ readonly value: V;
4179
+ }) => HashMap<K, V>;
4180
+ /**
4181
+ * @category api interface
4182
+ * @since 3.10.0
4183
+ */
4184
+ export interface ListFromSelf<Value extends Schema.Any> extends AnnotableClass<ListFromSelf<Value>, list_.List<Schema.Type<Value>>, list_.List<Schema.Encoded<Value>>, Schema.Context<Value>> {
4185
+ }
4186
+ /**
4187
+ * @category List transformations
4188
+ * @since 3.10.0
4189
+ */
4190
+ export declare const ListFromSelf: <Value extends Schema.Any>(value: Value) => ListFromSelf<Value>;
4191
+ /**
4192
+ * @category api interface
4193
+ * @since 3.10.0
4194
+ */
4195
+ export interface List<Value extends Schema.Any> extends AnnotableClass<List<Value>, list_.List<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
4196
+ }
4197
+ /**
4198
+ * @category List transformations
4199
+ * @since 3.10.0
4200
+ */
4201
+ export declare const List: <Value extends Schema.Any>(value: Value) => List<Value>;
4202
+ /**
4203
+ * @category api interface
4204
+ * @since 3.10.0
4205
+ */
4206
+ export interface SortedSetFromSelf<Value extends Schema.Any> extends AnnotableClass<SortedSetFromSelf<Value>, sortedSet_.SortedSet<Schema.Type<Value>>, sortedSet_.SortedSet<Schema.Encoded<Value>>, Schema.Context<Value>> {
4207
+ }
4208
+ /**
4209
+ * @category SortedSet transformations
4210
+ * @since 3.10.0
4211
+ */
4212
+ export declare const SortedSetFromSelf: <Value extends Schema.Any>(value: Value, ordA: Order.Order<Schema.Type<Value>>, ordI: Order.Order<Schema.Encoded<Value>>) => SortedSetFromSelf<Value>;
4213
+ /**
4214
+ * @category api interface
4215
+ * @since 3.10.0
4216
+ */
4217
+ export interface SortedSet<Value extends Schema.Any> extends AnnotableClass<SortedSet<Value>, sortedSet_.SortedSet<Schema.Type<Value>>, ReadonlyArray<Schema.Encoded<Value>>, Schema.Context<Value>> {
4218
+ }
4219
+ /**
4220
+ * @category SortedSet transformations
4221
+ * @since 3.10.0
4222
+ */
4223
+ export declare const SortedSet: <Value extends Schema.Any>(value: Value, ordA: Order.Order<Schema.Type<Value>>) => SortedSet<Value>;
4224
+ declare const BooleanFromUnknown_base: transform<typeof Unknown, typeof Boolean$>;
4225
+ /**
4226
+ * Converts an arbitrary value to a `boolean` by testing whether it is truthy.
4227
+ * Uses `!!val` to coerce the value to a `boolean`.
4228
+ *
4229
+ * @see https://developer.mozilla.org/docs/Glossary/Truthy
4230
+ * @category boolean constructors
4231
+ * @since 3.10.0
4232
+ */
4233
+ export declare class BooleanFromUnknown extends BooleanFromUnknown_base {
4234
+ }
4235
+ /**
4236
+ * @category Config validations
4237
+ * @since 3.10.0
4238
+ */
4239
+ export declare const Config: <A>(name: string, schema: Schema<A, string>) => config_.Config<A>;
4240
+ /**
4241
+ * @since 3.10.0
4242
+ * @category symbol
4243
+ */
4244
+ export declare const symbolSerializable: unique symbol;
4245
+ /**
4246
+ * The `Serializable` trait allows objects to define their own schema for
4247
+ * serialization.
4248
+ *
4249
+ * @since 3.10.0
4250
+ * @category model
4251
+ */
4252
+ export interface Serializable<A, I, R> {
4253
+ readonly [symbolSerializable]: Schema<A, I, R>;
4254
+ }
4255
+ /**
4256
+ * @since 3.10.0
4257
+ * @category model
4258
+ */
4259
+ export declare namespace Serializable {
4260
+ /**
4261
+ * @since 3.10.0
4262
+ */
4263
+ type Type<T> = T extends Serializable<infer A, infer _I, infer _R> ? A : never;
4264
+ /**
4265
+ * @since 3.10.0
4266
+ */
4267
+ type Encoded<T> = T extends Serializable<infer _A, infer I, infer _R> ? I : never;
4268
+ /**
4269
+ * @since 3.10.0
4270
+ */
4271
+ type Context<T> = T extends Serializable<infer _A, infer _I, infer R> ? R : never;
4272
+ /**
4273
+ * @since 3.10.0
4274
+ */
4275
+ type Any = Serializable<any, any, unknown>;
4276
+ /**
4277
+ * @since 3.10.0
4278
+ */
4279
+ type All = Any | Serializable<any, never, unknown> | Serializable<never, any, unknown> | Serializable<never, never, unknown>;
4280
+ }
4281
+ /**
4282
+ * @since 3.10.0
4283
+ */
4284
+ export declare const asSerializable: <S extends Serializable.All>(serializable: S) => Serializable<Serializable.Type<S>, Serializable.Encoded<S>, Serializable.Context<S>>;
4285
+ /**
4286
+ * @since 3.10.0
4287
+ * @category accessor
4288
+ */
4289
+ export declare const serializableSchema: <A, I, R>(self: Serializable<A, I, R>) => Schema<A, I, R>;
4290
+ /**
4291
+ * @since 3.10.0
4292
+ * @category encoding
4293
+ */
4294
+ export declare const serialize: <A, I, R>(self: Serializable<A, I, R>) => Effect.Effect<I, ParseResult.ParseError, R>;
4295
+ /**
4296
+ * @since 3.10.0
4297
+ * @category decoding
4298
+ */
4299
+ export declare const deserialize: {
4300
+ /**
4301
+ * @since 3.10.0
4302
+ * @category decoding
4303
+ */
4304
+ (value: unknown): <A, I, R>(self: Serializable<A, I, R>) => Effect.Effect<A, ParseResult.ParseError, R>;
4305
+ /**
4306
+ * @since 3.10.0
4307
+ * @category decoding
4308
+ */
4309
+ <A, I, R>(self: Serializable<A, I, R>, value: unknown): Effect.Effect<A, ParseResult.ParseError, R>;
4310
+ };
4311
+ /**
4312
+ * @since 3.10.0
4313
+ * @category symbol
4314
+ */
4315
+ export declare const symbolWithResult: unique symbol;
4316
+ /**
4317
+ * The `WithResult` trait is designed to encapsulate the outcome of an
4318
+ * operation, distinguishing between success and failure cases. Each case is
4319
+ * associated with a schema that defines the structure and types of the success
4320
+ * or failure data.
4321
+ *
4322
+ * @since 3.10.0
4323
+ * @category model
4324
+ */
4325
+ export interface WithResult<Success, SuccessEncoded, Failure, FailureEncoded, ResultR> {
4326
+ readonly [symbolWithResult]: {
4327
+ readonly success: Schema<Success, SuccessEncoded, ResultR>;
4328
+ readonly failure: Schema<Failure, FailureEncoded, ResultR>;
4329
+ };
4330
+ }
4331
+ /**
4332
+ * @since 3.10.0
4333
+ * @category model
4334
+ */
4335
+ export declare namespace WithResult {
4336
+ /**
4337
+ * @since 3.10.0
4338
+ */
4339
+ type Success<T> = T extends WithResult<infer _A, infer _I, infer _E, infer _EI, infer _R> ? _A : never;
4340
+ /**
4341
+ * @since 3.10.0
4342
+ */
4343
+ type SuccessEncoded<T> = T extends WithResult<infer _A, infer _I, infer _E, infer _EI, infer _R> ? _I : never;
4344
+ /**
4345
+ * @since 3.10.0
4346
+ */
4347
+ type Failure<T> = T extends WithResult<infer _A, infer _I, infer _E, infer _EI, infer _R> ? _E : never;
4348
+ /**
4349
+ * @since 3.10.0
4350
+ */
4351
+ type FailureEncoded<T> = T extends WithResult<infer _A, infer _I, infer _E, infer _EI, infer _R> ? _EI : never;
4352
+ /**
4353
+ * @since 3.10.0
4354
+ */
4355
+ type Context<T> = T extends WithResult<infer _SA, infer _SI, infer _FA, infer _FI, infer R> ? R : never;
4356
+ /**
4357
+ * @since 3.10.0
4358
+ */
4359
+ type Any = WithResult<any, any, any, any, unknown>;
4360
+ /**
4361
+ * @since 3.10.0
4362
+ */
4363
+ type All = Any | WithResult<any, any, never, never, unknown>;
4364
+ }
4365
+ /**
4366
+ * @since 3.10.0
4367
+ */
4368
+ export declare const asWithResult: <WR extends WithResult.All>(withExit: WR) => WithResult<WithResult.Success<WR>, WithResult.SuccessEncoded<WR>, WithResult.Failure<WR>, WithResult.FailureEncoded<WR>, WithResult.Context<WR>>;
4369
+ /**
4370
+ * @since 3.10.0
4371
+ * @category accessor
4372
+ */
4373
+ export declare const failureSchema: <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Schema<FA, FI, R>;
4374
+ /**
4375
+ * @since 3.10.0
4376
+ * @category accessor
4377
+ */
4378
+ export declare const successSchema: <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Schema<SA, SI, R>;
4379
+ /**
4380
+ * @since 3.10.0
4381
+ * @category accessor
4382
+ */
4383
+ export declare const exitSchema: <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Schema<exit_.Exit<SA, FA>, ExitEncoded<SI, FI, unknown>, R>;
4384
+ /**
4385
+ * @since 3.10.0
4386
+ * @category encoding
4387
+ */
4388
+ export declare const serializeFailure: {
4389
+ /**
4390
+ * @since 3.10.0
4391
+ * @category encoding
4392
+ */
4393
+ <FA>(value: FA): <SA, SI, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<FI, ParseResult.ParseError, R>;
4394
+ /**
4395
+ * @since 3.10.0
4396
+ * @category encoding
4397
+ */
4398
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: FA): Effect.Effect<FI, ParseResult.ParseError, R>;
4399
+ };
4400
+ /**
4401
+ * @since 3.10.0
4402
+ * @category decoding
4403
+ */
4404
+ export declare const deserializeFailure: {
4405
+ /**
4406
+ * @since 3.10.0
4407
+ * @category decoding
4408
+ */
4409
+ (value: unknown): <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<FA, ParseResult.ParseError, R>;
4410
+ /**
4411
+ * @since 3.10.0
4412
+ * @category decoding
4413
+ */
4414
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: unknown): Effect.Effect<FA, ParseResult.ParseError, R>;
4415
+ };
4416
+ /**
4417
+ * @since 3.10.0
4418
+ * @category encoding
4419
+ */
4420
+ export declare const serializeSuccess: {
4421
+ /**
4422
+ * @since 3.10.0
4423
+ * @category encoding
4424
+ */
4425
+ <SA>(value: SA): <SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<SI, ParseResult.ParseError, R>;
4426
+ /**
4427
+ * @since 3.10.0
4428
+ * @category encoding
4429
+ */
4430
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: SA): Effect.Effect<SI, ParseResult.ParseError, R>;
4431
+ };
4432
+ /**
4433
+ * @since 3.10.0
4434
+ * @category decoding
4435
+ */
4436
+ export declare const deserializeSuccess: {
4437
+ /**
4438
+ * @since 3.10.0
4439
+ * @category decoding
4440
+ */
4441
+ (value: unknown): <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<SA, ParseResult.ParseError, R>;
4442
+ /**
4443
+ * @since 3.10.0
4444
+ * @category decoding
4445
+ */
4446
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: unknown): Effect.Effect<SA, ParseResult.ParseError, R>;
4447
+ };
4448
+ /**
4449
+ * @since 3.10.0
4450
+ * @category encoding
4451
+ */
4452
+ export declare const serializeExit: {
4453
+ /**
4454
+ * @since 3.10.0
4455
+ * @category encoding
4456
+ */
4457
+ <SA, FA>(value: exit_.Exit<SA, FA>): <SI, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<ExitEncoded<SI, FI, unknown>, ParseResult.ParseError, R>;
4458
+ /**
4459
+ * @since 3.10.0
4460
+ * @category encoding
4461
+ */
4462
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: exit_.Exit<SA, FA>): Effect.Effect<ExitEncoded<SI, FI, unknown>, ParseResult.ParseError, R>;
4463
+ };
4464
+ /**
4465
+ * @since 3.10.0
4466
+ * @category decoding
4467
+ */
4468
+ export declare const deserializeExit: {
4469
+ /**
4470
+ * @since 3.10.0
4471
+ * @category decoding
4472
+ */
4473
+ (value: unknown): <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>) => Effect.Effect<exit_.Exit<SA, FA>, ParseResult.ParseError, R>;
4474
+ /**
4475
+ * @since 3.10.0
4476
+ * @category decoding
4477
+ */
4478
+ <SA, SI, FA, FI, R>(self: WithResult<SA, SI, FA, FI, R>, value: unknown): Effect.Effect<exit_.Exit<SA, FA>, ParseResult.ParseError, R>;
4479
+ };
4480
+ /**
4481
+ * The `SerializableWithResult` trait is specifically designed to model remote
4482
+ * procedures that require serialization of their input and output, managing
4483
+ * both successful and failed outcomes.
4484
+ *
4485
+ * This trait combines functionality from both the `Serializable` and `WithResult`
4486
+ * traits to handle data serialization and the bifurcation of operation results
4487
+ * into success or failure categories.
4488
+ *
4489
+ * @since 3.10.0
4490
+ * @category model
4491
+ */
4492
+ export interface SerializableWithResult<A, I, R, Success, SuccessEncoded, Failure, FailureEncoded, ResultR> extends Serializable<A, I, R>, WithResult<Success, SuccessEncoded, Failure, FailureEncoded, ResultR> {
4493
+ }
4494
+ /**
4495
+ * @since 3.10.0
4496
+ * @category model
4497
+ */
4498
+ export declare namespace SerializableWithResult {
4499
+ /**
4500
+ * @since 3.10.0
4501
+ */
4502
+ type Context<P> = P extends SerializableWithResult<infer _S, infer _SI, infer SR, infer _A, infer _AI, infer _E, infer _EI, infer RR> ? SR | RR : never;
4503
+ /**
4504
+ * @since 3.10.0
4505
+ */
4506
+ type Any = SerializableWithResult<any, any, any, any, any, any, any, unknown>;
4507
+ /**
4508
+ * @since 3.10.0
4509
+ */
4510
+ type All = Any | SerializableWithResult<any, any, any, any, any, never, never, unknown>;
4511
+ }
4512
+ /**
4513
+ * @since 3.10.0
4514
+ */
4515
+ export declare const asSerializableWithResult: <SWR extends SerializableWithResult.All>(procedure: SWR) => SerializableWithResult<Serializable.Type<SWR>, Serializable.Encoded<SWR>, Serializable.Context<SWR>, WithResult.Success<SWR>, WithResult.SuccessEncoded<SWR>, WithResult.Failure<SWR>, WithResult.FailureEncoded<SWR>, WithResult.Context<SWR>>;
4516
+ /**
4517
+ * @since 3.10.0
4518
+ */
4519
+ export interface TaggedRequest<Tag extends string, A, I, R, SuccessType, SuccessEncoded, FailureType, FailureEncoded, ResultR> extends Request.Request<SuccessType, FailureType>, SerializableWithResult<A, I, R, SuccessType, SuccessEncoded, FailureType, FailureEncoded, ResultR> {
4520
+ readonly _tag: Tag;
4521
+ }
4522
+ /**
4523
+ * @since 3.10.0
4524
+ */
4525
+ export declare namespace TaggedRequest {
4526
+ /**
4527
+ * @since 3.10.0
4528
+ */
4529
+ type Any = TaggedRequest<string, any, any, any, any, any, any, any, unknown>;
4530
+ /**
4531
+ * @since 3.10.0
4532
+ */
4533
+ type All = Any | TaggedRequest<string, any, any, any, any, any, never, never, unknown>;
4534
+ }
4535
+ /**
4536
+ * @category api interface
4537
+ * @since 3.10.0
4538
+ */
4539
+ export interface TaggedRequestClass<Self, Tag extends string, Payload extends Struct.Fields, Success extends Schema.All, Failure extends Schema.All> extends Class<Self, Payload, Struct.Encoded<Payload>, Struct.Context<Payload>, Struct.Constructor<Omit<Payload, "_tag">>, TaggedRequest<Tag, Self, Struct.Encoded<Payload>, Struct.Context<Payload>, Schema.Type<Success>, Schema.Encoded<Success>, Schema.Type<Failure>, Schema.Encoded<Failure>, Schema.Context<Success> | Schema.Context<Failure>>, {}> {
4540
+ readonly _tag: Tag;
4541
+ readonly success: Success;
4542
+ readonly failure: Failure;
4543
+ }
4544
+ /**
4545
+ * @category classes
4546
+ * @since 3.10.0
4547
+ */
4548
+ export declare const TaggedRequest: <Self = never>(identifier?: string) => <Tag extends string, Payload extends Struct.Fields, Success extends Schema.All, Failure extends Schema.All>(tag: Tag, options: {
4549
+ failure: Failure;
4550
+ success: Success;
4551
+ payload: Payload;
4552
+ }, annotations?: Annotations.Schema<Self>) => [Self] extends [never] ? MissingSelfGeneric<"TaggedRequest", `"Tag", SuccessSchema, FailureSchema, `> : TaggedRequestClass<Self, Tag, {
4553
+ readonly _tag: tag<Tag>;
4554
+ } & Payload, Success, Failure>;
4555
+ /**
4556
+ * Given a schema `Schema<A, I, R>`, returns an `Equivalence` instance for `A`.
4557
+ *
4558
+ * @category Equivalence
4559
+ * @since 3.10.0
4560
+ */
4561
+ export declare const equivalence: <A, I, R>(schema: Schema<A, I, R>) => Equivalence.Equivalence<A>;
4562
+ //# sourceMappingURL=Schema.d.ts.map