effect 3.11.7 → 3.11.8

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.
@@ -1,4 +1,6 @@
1
1
  /** @internal */
2
+ export const DateFromSelfSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/DateFromSelf");
3
+ /** @internal */
2
4
  export const GreaterThanSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/GreaterThan");
3
5
  /** @internal */
4
6
  export const GreaterThanOrEqualToSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/GreaterThanOrEqualTo");
@@ -38,4 +40,4 @@ export const MinItemsSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/MinItem
38
40
  export const MaxItemsSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/MaxItems");
39
41
  /** @internal */
40
42
  export const ItemsCountSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/ItemsCount");
41
- //# sourceMappingURL=filters.js.map
43
+ //# sourceMappingURL=schemaId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaId.js","names":["DateFromSelfSchemaId","Symbol","for","GreaterThanSchemaId","GreaterThanOrEqualToSchemaId","LessThanSchemaId","LessThanOrEqualToSchemaId","IntSchemaId","NonNaNSchemaId","FiniteSchemaId","JsonNumberSchemaId","BetweenSchemaId","GreaterThanBigintSchemaId","GreaterThanOrEqualToBigIntSchemaId","LessThanBigIntSchemaId","LessThanOrEqualToBigIntSchemaId","BetweenBigintSchemaId","MinLengthSchemaId","MaxLengthSchemaId","LengthSchemaId","MinItemsSchemaId","MaxItemsSchemaId","ItemsCountSchemaId"],"sources":["../../../../src/internal/schema/schemaId.ts"],"sourcesContent":[null],"mappings":"AAEA;AACA,OAAO,MAAMA,oBAAoB,gBAAgCC,MAAM,CAACC,GAAG,CACzE,8BAA8B,CACA;AAEhC;AACA,OAAO,MAAMC,mBAAmB,gBAA+BF,MAAM,CAACC,GAAG,CACvE,6BAA6B,CACA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MiB,cAAc,gBAA0BlB,MAAM,CAACC,GAAG,CAC7D,wBAAwB,CACA;AAE1B;AACA,OAAO,MAAMkB,gBAAgB,gBAA4BnB,MAAM,CAACC,GAAG,CACjE,0BAA0B,CACA;AAE5B;AACA,OAAO,MAAMmB,gBAAgB,gBAA4BpB,MAAM,CAACC,GAAG,CACjE,0BAA0B,CACA;AAE5B;AACA,OAAO,MAAMoB,kBAAkB,gBAA8BrB,MAAM,CAACC,GAAG,CACrE,4BAA4B,CACA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.11.7";
1
+ let moduleVersion = "3.11.8";
2
2
  export const getCurrentVersion = () => moduleVersion;
3
3
  export const setCurrentVersion = version => {
4
4
  moduleVersion = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect",
3
- "version": "3.11.7",
3
+ "version": "3.11.8",
4
4
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/Arbitrary.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import * as Arr from "./Array.js"
6
6
  import * as FastCheck from "./FastCheck.js"
7
7
  import * as errors_ from "./internal/schema/errors.js"
8
- import * as filters_ from "./internal/schema/filters.js"
8
+ import * as schemaId_ from "./internal/schema/schemaId.js"
9
9
  import * as util_ from "./internal/schema/util.js"
10
10
  import * as Option from "./Option.js"
11
11
  import * as Predicate from "./Predicate.js"
@@ -28,7 +28,7 @@ export interface LazyArbitrary<A> {
28
28
  export interface ArbitraryGenerationContext {
29
29
  readonly maxDepth: number
30
30
  readonly depthIdentifier?: string
31
- readonly constraints?: StringConstraints | NumberConstraints | BigIntConstraints | ArrayConstraints
31
+ readonly constraints?: StringConstraints | NumberConstraints | BigIntConstraints | DateConstraints | ArrayConstraints
32
32
  }
33
33
 
34
34
  /**
@@ -110,6 +110,8 @@ class Deferred {
110
110
  }
111
111
  case "BigIntConstraints":
112
112
  return (fc) => fc.bigInt(config.constraints)
113
+ case "DateConstraints":
114
+ return (fc) => fc.date(config.constraints)
113
115
  case "ArrayConstraints":
114
116
  return goTupleType(config.ast, ctx, path, config.constraints)
115
117
  }
@@ -232,6 +234,32 @@ export const makeArrayConstraints = (options: {
232
234
  return out
233
235
  }
234
236
 
237
+ interface DateConstraints {
238
+ readonly _tag: "DateConstraints"
239
+ readonly constraints: FastCheck.DateConstraints
240
+ }
241
+
242
+ /** @internal */
243
+ export const makeDateConstraints = (options: {
244
+ readonly min?: Date | undefined
245
+ readonly max?: Date | undefined
246
+ readonly noInvalidDate?: boolean | undefined
247
+ }): DateConstraints => {
248
+ const out: Types.Mutable<DateConstraints> = {
249
+ _tag: "DateConstraints",
250
+ constraints: {
251
+ noInvalidDate: options.noInvalidDate ?? false
252
+ }
253
+ }
254
+ if (Predicate.isDate(options.min)) {
255
+ out.constraints.min = options.min
256
+ }
257
+ if (Predicate.isDate(options.max)) {
258
+ out.constraints.max = options.max
259
+ }
260
+ return out
261
+ }
262
+
235
263
  interface ArrayConfig extends ArrayConstraints {
236
264
  readonly ast: AST.TupleType
237
265
  }
@@ -246,7 +274,7 @@ const makeArrayConfig = (options: {
246
274
  }
247
275
  }
248
276
 
249
- type Config = StringConstraints | NumberConstraints | BigIntConstraints | ArrayConfig
277
+ type Config = StringConstraints | NumberConstraints | BigIntConstraints | DateConstraints | ArrayConfig
250
278
 
251
279
  const go = (
252
280
  ast: AST.AST,
@@ -291,8 +319,14 @@ export const toOp = (
291
319
  path: ReadonlyArray<PropertyKey>
292
320
  ): Op => {
293
321
  switch (ast._tag) {
294
- case "Declaration":
322
+ case "Declaration": {
323
+ const TypeAnnotationId: any = ast.annotations[AST.SchemaIdAnnotationId]
324
+ switch (TypeAnnotationId) {
325
+ case schemaId_.DateFromSelfSchemaId:
326
+ return new Deferred(makeDateConstraints(ast.annotations[TypeAnnotationId] as any))
327
+ }
295
328
  return new Succeed(go(ast, ctx, path))
329
+ }
296
330
  case "Literal":
297
331
  return new Succeed((fc) => fc.constant(ast.literal))
298
332
  case "UniqueSymbol":
@@ -482,7 +516,7 @@ const goTupleType = (
482
516
  }
483
517
  }
484
518
 
485
- type Constraints = StringConstraints | NumberConstraints | BigIntConstraints | ArrayConstraints
519
+ type Constraints = StringConstraints | NumberConstraints | BigIntConstraints | DateConstraints | ArrayConstraints
486
520
 
487
521
  const getConstraints = (_tag: Constraints["_tag"], ast: AST.Refinement): Constraints | undefined => {
488
522
  const TypeAnnotationId: any = ast.annotations[AST.SchemaIdAnnotationId]
@@ -493,7 +527,7 @@ const getConstraints = (_tag: Constraints["_tag"], ast: AST.Refinement): Constra
493
527
  return makeStringConstraints(jsonSchema)
494
528
  case "NumberConstraints": {
495
529
  switch (TypeAnnotationId) {
496
- case filters_.NonNaNSchemaId:
530
+ case schemaId_.NonNaNSchemaId:
497
531
  return makeNumberConstraints({ noNaN: true })
498
532
  default:
499
533
  return makeNumberConstraints({
@@ -509,6 +543,8 @@ const getConstraints = (_tag: Constraints["_tag"], ast: AST.Refinement): Constra
509
543
  }
510
544
  case "BigIntConstraints":
511
545
  return makeBigIntConstraints(ast.annotations[TypeAnnotationId] as any)
546
+ case "DateConstraints":
547
+ return makeDateConstraints(ast.annotations[TypeAnnotationId] as any)
512
548
  case "ArrayConstraints":
513
549
  return makeArrayConstraints({
514
550
  minLength: jsonSchema.minItems,
@@ -517,21 +553,23 @@ const getConstraints = (_tag: Constraints["_tag"], ast: AST.Refinement): Constra
517
553
  }
518
554
  }
519
555
 
556
+ function getMax(n1: Date | undefined, n2: Date | undefined): Date | undefined
520
557
  function getMax(n1: bigint | undefined, n2: bigint | undefined): bigint | undefined
521
558
  function getMax(n1: number | undefined, n2: number | undefined): number | undefined
522
559
  function getMax(
523
- n1: bigint | number | undefined,
524
- n2: bigint | number | undefined
525
- ): bigint | number | undefined {
560
+ n1: bigint | number | Date | undefined,
561
+ n2: bigint | number | Date | undefined
562
+ ): bigint | number | Date | undefined {
526
563
  return n1 === undefined ? n2 : n2 === undefined ? n1 : n1 <= n2 ? n2 : n1
527
564
  }
528
565
 
566
+ function getMin(n1: Date | undefined, n2: Date | undefined): Date | undefined
529
567
  function getMin(n1: bigint | undefined, n2: bigint | undefined): bigint | undefined
530
568
  function getMin(n1: number | undefined, n2: number | undefined): number | undefined
531
569
  function getMin(
532
- n1: bigint | number | undefined,
533
- n2: bigint | number | undefined
534
- ): bigint | number | undefined {
570
+ n1: bigint | number | Date | undefined,
571
+ n2: bigint | number | Date | undefined
572
+ ): bigint | number | Date | undefined {
535
573
  return n1 === undefined ? n2 : n2 === undefined ? n1 : n1 <= n2 ? n1 : n2
536
574
  }
537
575
 
@@ -575,6 +613,16 @@ const merge = (c1: Config, c2: Constraints | undefined): Config => {
575
613
  }
576
614
  break
577
615
  }
616
+ case "DateConstraints": {
617
+ if (c2._tag === "DateConstraints") {
618
+ return makeDateConstraints({
619
+ min: getMax(c1.constraints.min, c2.constraints.min),
620
+ max: getMin(c1.constraints.max, c2.constraints.max),
621
+ noInvalidDate: getOr(c1.constraints.noInvalidDate, c2.constraints.noInvalidDate)
622
+ })
623
+ }
624
+ break
625
+ }
578
626
  case "ArrayConstraints": {
579
627
  if (c2._tag === "ArrayConstraints") {
580
628
  return makeArrayConfig({
package/src/Schema.ts CHANGED
@@ -29,7 +29,7 @@ import { globalValue } from "./GlobalValue.js"
29
29
  import * as hashMap_ from "./HashMap.js"
30
30
  import * as hashSet_ from "./HashSet.js"
31
31
  import * as errors_ from "./internal/schema/errors.js"
32
- import * as filters_ from "./internal/schema/filters.js"
32
+ import * as schemaId_ from "./internal/schema/schemaId.js"
33
33
  import * as util_ from "./internal/schema/util.js"
34
34
  import * as list_ from "./List.js"
35
35
  import * as number_ from "./Number.js"
@@ -4482,7 +4482,7 @@ export const trimmed =
4482
4482
  * @category schema id
4483
4483
  * @since 3.10.0
4484
4484
  */
4485
- export const MaxLengthSchemaId: unique symbol = filters_.MaxLengthSchemaId
4485
+ export const MaxLengthSchemaId: unique symbol = schemaId_.MaxLengthSchemaId
4486
4486
 
4487
4487
  /**
4488
4488
  * @category schema id
@@ -4515,7 +4515,7 @@ export const maxLength = <A extends string>(
4515
4515
  * @category schema id
4516
4516
  * @since 3.10.0
4517
4517
  */
4518
- export const MinLengthSchemaId: unique symbol = filters_.MinLengthSchemaId
4518
+ export const MinLengthSchemaId: unique symbol = schemaId_.MinLengthSchemaId
4519
4519
 
4520
4520
  /**
4521
4521
  * @category schema id
@@ -4790,7 +4790,7 @@ export class Uppercased extends String$.pipe(
4790
4790
  * @category schema id
4791
4791
  * @since 3.10.0
4792
4792
  */
4793
- export const LengthSchemaId: unique symbol = filters_.LengthSchemaId
4793
+ export const LengthSchemaId: unique symbol = schemaId_.LengthSchemaId
4794
4794
 
4795
4795
  /**
4796
4796
  * @category schema id
@@ -5161,7 +5161,7 @@ export {
5161
5161
  * @category schema id
5162
5162
  * @since 3.10.0
5163
5163
  */
5164
- export const FiniteSchemaId: unique symbol = filters_.FiniteSchemaId
5164
+ export const FiniteSchemaId: unique symbol = schemaId_.FiniteSchemaId
5165
5165
 
5166
5166
  /**
5167
5167
  * @category schema id
@@ -5192,7 +5192,7 @@ export const finite =
5192
5192
  * @category schema id
5193
5193
  * @since 3.10.0
5194
5194
  */
5195
- export const GreaterThanSchemaId: unique symbol = filters_.GreaterThanSchemaId
5195
+ export const GreaterThanSchemaId: unique symbol = schemaId_.GreaterThanSchemaId
5196
5196
 
5197
5197
  /**
5198
5198
  * @category schema id
@@ -5207,15 +5207,15 @@ export type GreaterThanSchemaId = typeof GreaterThanSchemaId
5207
5207
  * @since 3.10.0
5208
5208
  */
5209
5209
  export const greaterThan = <A extends number>(
5210
- min: number,
5210
+ exclusiveMinimum: number,
5211
5211
  annotations?: Annotations.Filter<A>
5212
5212
  ) =>
5213
5213
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
5214
5214
  self.pipe(
5215
- filter((a) => a > min, {
5215
+ filter((a) => a > exclusiveMinimum, {
5216
5216
  schemaId: GreaterThanSchemaId,
5217
- description: min === 0 ? "a positive number" : `a number greater than ${min}`,
5218
- jsonSchema: { exclusiveMinimum: min },
5217
+ description: exclusiveMinimum === 0 ? "a positive number" : `a number greater than ${exclusiveMinimum}`,
5218
+ jsonSchema: { exclusiveMinimum },
5219
5219
  ...annotations
5220
5220
  })
5221
5221
  )
@@ -5224,7 +5224,7 @@ export const greaterThan = <A extends number>(
5224
5224
  * @category schema id
5225
5225
  * @since 3.10.0
5226
5226
  */
5227
- export const GreaterThanOrEqualToSchemaId: unique symbol = filters_.GreaterThanOrEqualToSchemaId
5227
+ export const GreaterThanOrEqualToSchemaId: unique symbol = schemaId_.GreaterThanOrEqualToSchemaId
5228
5228
 
5229
5229
  /**
5230
5230
  * @category schema id
@@ -5239,15 +5239,15 @@ export type GreaterThanOrEqualToSchemaId = typeof GreaterThanOrEqualToSchemaId
5239
5239
  * @since 3.10.0
5240
5240
  */
5241
5241
  export const greaterThanOrEqualTo = <A extends number>(
5242
- min: number,
5242
+ minimum: number,
5243
5243
  annotations?: Annotations.Filter<A>
5244
5244
  ) =>
5245
5245
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
5246
5246
  self.pipe(
5247
- filter((a) => a >= min, {
5247
+ filter((a) => a >= minimum, {
5248
5248
  schemaId: GreaterThanOrEqualToSchemaId,
5249
- description: min === 0 ? "a non-negative number" : `a number greater than or equal to ${min}`,
5250
- jsonSchema: { minimum: min },
5249
+ description: minimum === 0 ? "a non-negative number" : `a number greater than or equal to ${minimum}`,
5250
+ jsonSchema: { minimum },
5251
5251
  ...annotations
5252
5252
  })
5253
5253
  )
@@ -5280,7 +5280,7 @@ export const multipleOf = <A extends number>(
5280
5280
  * @category schema id
5281
5281
  * @since 3.10.0
5282
5282
  */
5283
- export const IntSchemaId: unique symbol = filters_.IntSchemaId
5283
+ export const IntSchemaId: unique symbol = schemaId_.IntSchemaId
5284
5284
 
5285
5285
  /**
5286
5286
  * @category schema id
@@ -5308,7 +5308,7 @@ export const int =
5308
5308
  * @category schema id
5309
5309
  * @since 3.10.0
5310
5310
  */
5311
- export const LessThanSchemaId: unique symbol = filters_.LessThanSchemaId
5311
+ export const LessThanSchemaId: unique symbol = schemaId_.LessThanSchemaId
5312
5312
 
5313
5313
  /**
5314
5314
  * @category schema id
@@ -5323,13 +5323,13 @@ export type LessThanSchemaId = typeof LessThanSchemaId
5323
5323
  * @since 3.10.0
5324
5324
  */
5325
5325
  export const lessThan =
5326
- <A extends number>(max: number, annotations?: Annotations.Filter<A>) =>
5326
+ <A extends number>(exclusiveMaximum: number, annotations?: Annotations.Filter<A>) =>
5327
5327
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
5328
5328
  self.pipe(
5329
- filter((a) => a < max, {
5329
+ filter((a) => a < exclusiveMaximum, {
5330
5330
  schemaId: LessThanSchemaId,
5331
- description: max === 0 ? "a negative number" : `a number less than ${max}`,
5332
- jsonSchema: { exclusiveMaximum: max },
5331
+ description: exclusiveMaximum === 0 ? "a negative number" : `a number less than ${exclusiveMaximum}`,
5332
+ jsonSchema: { exclusiveMaximum },
5333
5333
  ...annotations
5334
5334
  })
5335
5335
  )
@@ -5338,7 +5338,7 @@ export const lessThan =
5338
5338
  * @category schema id
5339
5339
  * @since 3.10.0
5340
5340
  */
5341
- export const LessThanOrEqualToSchemaId: unique symbol = filters_.LessThanOrEqualToSchemaId
5341
+ export const LessThanOrEqualToSchemaId: unique symbol = schemaId_.LessThanOrEqualToSchemaId
5342
5342
 
5343
5343
  /**
5344
5344
  * @category schema id
@@ -5353,15 +5353,15 @@ export type LessThanOrEqualToSchemaId = typeof LessThanOrEqualToSchemaId
5353
5353
  * @since 3.10.0
5354
5354
  */
5355
5355
  export const lessThanOrEqualTo = <A extends number>(
5356
- max: number,
5356
+ maximum: number,
5357
5357
  annotations?: Annotations.Filter<A>
5358
5358
  ) =>
5359
5359
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
5360
5360
  self.pipe(
5361
- filter((a) => a <= max, {
5361
+ filter((a) => a <= maximum, {
5362
5362
  schemaId: LessThanOrEqualToSchemaId,
5363
- description: max === 0 ? "a non-positive number" : `a number less than or equal to ${max}`,
5364
- jsonSchema: { maximum: max },
5363
+ description: maximum === 0 ? "a non-positive number" : `a number less than or equal to ${maximum}`,
5364
+ jsonSchema: { maximum },
5365
5365
  ...annotations
5366
5366
  })
5367
5367
  )
@@ -5370,7 +5370,7 @@ export const lessThanOrEqualTo = <A extends number>(
5370
5370
  * @category schema id
5371
5371
  * @since 3.10.0
5372
5372
  */
5373
- export const BetweenSchemaId: unique symbol = filters_.BetweenSchemaId
5373
+ export const BetweenSchemaId: unique symbol = schemaId_.BetweenSchemaId
5374
5374
 
5375
5375
  /**
5376
5376
  * @category schema id
@@ -5385,16 +5385,16 @@ export type BetweenSchemaId = typeof BetweenSchemaId
5385
5385
  * @since 3.10.0
5386
5386
  */
5387
5387
  export const between = <A extends number>(
5388
- min: number,
5389
- max: number,
5388
+ minimum: number,
5389
+ maximum: number,
5390
5390
  annotations?: Annotations.Filter<A>
5391
5391
  ) =>
5392
5392
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
5393
5393
  self.pipe(
5394
- filter((a) => a >= min && a <= max, {
5394
+ filter((a) => a >= minimum && a <= maximum, {
5395
5395
  schemaId: BetweenSchemaId,
5396
- description: `a number between ${min} and ${max}`,
5397
- jsonSchema: { maximum: max, minimum: min },
5396
+ description: `a number between ${minimum} and ${maximum}`,
5397
+ jsonSchema: { minimum, maximum },
5398
5398
  ...annotations
5399
5399
  })
5400
5400
  )
@@ -5403,7 +5403,7 @@ export const between = <A extends number>(
5403
5403
  * @category schema id
5404
5404
  * @since 3.10.0
5405
5405
  */
5406
- export const NonNaNSchemaId: unique symbol = filters_.NonNaNSchemaId
5406
+ export const NonNaNSchemaId: unique symbol = schemaId_.NonNaNSchemaId
5407
5407
 
5408
5408
  /**
5409
5409
  * @category schema id
@@ -5563,7 +5563,7 @@ export class NonNegative extends Number$.pipe(
5563
5563
  * @category schema id
5564
5564
  * @since 3.10.0
5565
5565
  */
5566
- export const JsonNumberSchemaId: unique symbol = filters_.JsonNumberSchemaId
5566
+ export const JsonNumberSchemaId: unique symbol = schemaId_.JsonNumberSchemaId
5567
5567
 
5568
5568
  /**
5569
5569
  * @category schema id
@@ -5631,7 +5631,7 @@ export {
5631
5631
  * @category schema id
5632
5632
  * @since 3.10.0
5633
5633
  */
5634
- export const GreaterThanBigIntSchemaId: unique symbol = filters_.GreaterThanBigintSchemaId
5634
+ export const GreaterThanBigIntSchemaId: unique symbol = schemaId_.GreaterThanBigintSchemaId
5635
5635
 
5636
5636
  /**
5637
5637
  * @category schema id
@@ -5661,7 +5661,7 @@ export const greaterThanBigInt = <A extends bigint>(
5661
5661
  * @category schema id
5662
5662
  * @since 3.10.0
5663
5663
  */
5664
- export const GreaterThanOrEqualToBigIntSchemaId: unique symbol = filters_.GreaterThanOrEqualToBigIntSchemaId
5664
+ export const GreaterThanOrEqualToBigIntSchemaId: unique symbol = schemaId_.GreaterThanOrEqualToBigIntSchemaId
5665
5665
 
5666
5666
  /**
5667
5667
  * @category schema id
@@ -5693,7 +5693,7 @@ export const greaterThanOrEqualToBigInt = <A extends bigint>(
5693
5693
  * @category schema id
5694
5694
  * @since 3.10.0
5695
5695
  */
5696
- export const LessThanBigIntSchemaId: unique symbol = filters_.LessThanBigIntSchemaId
5696
+ export const LessThanBigIntSchemaId: unique symbol = schemaId_.LessThanBigIntSchemaId
5697
5697
 
5698
5698
  /**
5699
5699
  * @category schema id
@@ -5723,7 +5723,7 @@ export const lessThanBigInt = <A extends bigint>(
5723
5723
  * @category schema id
5724
5724
  * @since 3.10.0
5725
5725
  */
5726
- export const LessThanOrEqualToBigIntSchemaId: unique symbol = filters_.LessThanOrEqualToBigIntSchemaId
5726
+ export const LessThanOrEqualToBigIntSchemaId: unique symbol = schemaId_.LessThanOrEqualToBigIntSchemaId
5727
5727
 
5728
5728
  /**
5729
5729
  * @category schema id
@@ -5753,7 +5753,7 @@ export const lessThanOrEqualToBigInt = <A extends bigint>(
5753
5753
  * @category schema id
5754
5754
  * @since 3.10.0
5755
5755
  */
5756
- export const BetweenBigIntSchemaId: unique symbol = filters_.BetweenBigintSchemaId
5756
+ export const BetweenBigIntSchemaId: unique symbol = schemaId_.BetweenBigintSchemaId
5757
5757
 
5758
5758
  /**
5759
5759
  * @category schema id
@@ -5774,7 +5774,7 @@ export const betweenBigInt = <A extends bigint>(
5774
5774
  self.pipe(
5775
5775
  filter((a) => a >= min && a <= max, {
5776
5776
  schemaId: BetweenBigIntSchemaId,
5777
- [BetweenBigIntSchemaId]: { max, min },
5777
+ [BetweenBigIntSchemaId]: { min, max },
5778
5778
  description: `a bigint between ${min}n and ${max}n`,
5779
5779
  ...annotations
5780
5780
  })
@@ -6406,7 +6406,7 @@ export const StringFromHex: Schema<string> = makeEncodingTransformation(
6406
6406
  * @category schema id
6407
6407
  * @since 3.10.0
6408
6408
  */
6409
- export const MinItemsSchemaId: unique symbol = filters_.MinItemsSchemaId
6409
+ export const MinItemsSchemaId: unique symbol = schemaId_.MinItemsSchemaId
6410
6410
 
6411
6411
  /**
6412
6412
  * @category schema id
@@ -6447,7 +6447,7 @@ export const minItems = <A>(
6447
6447
  * @category schema id
6448
6448
  * @since 3.10.0
6449
6449
  */
6450
- export const MaxItemsSchemaId: unique symbol = filters_.MaxItemsSchemaId
6450
+ export const MaxItemsSchemaId: unique symbol = schemaId_.MaxItemsSchemaId
6451
6451
 
6452
6452
  /**
6453
6453
  * @category schema id
@@ -6478,7 +6478,7 @@ export const maxItems = <A>(
6478
6478
  * @category schema id
6479
6479
  * @since 3.10.0
6480
6480
  */
6481
- export const ItemsCountSchemaId: unique symbol = filters_.ItemsCountSchemaId
6481
+ export const ItemsCountSchemaId: unique symbol = schemaId_.ItemsCountSchemaId
6482
6482
 
6483
6483
  /**
6484
6484
  * @category schema id
@@ -6592,6 +6592,7 @@ export const validDate =
6592
6592
  self.pipe(
6593
6593
  filter((a) => !Number.isNaN(a.getTime()), {
6594
6594
  schemaId: ValidDateSchemaId,
6595
+ [ValidDateSchemaId]: { noInvalidDate: true },
6595
6596
  description: "a valid Date",
6596
6597
  ...annotations
6597
6598
  })
@@ -6708,20 +6709,32 @@ export const BetweenDateSchemaId: unique symbol = Symbol.for("effect/SchemaId/Be
6708
6709
  * @since 3.10.0
6709
6710
  */
6710
6711
  export const betweenDate = <A extends Date>(
6711
- minimum: Date,
6712
- maximum: Date,
6712
+ min: Date,
6713
+ max: Date,
6713
6714
  annotations?: Annotations.Filter<A>
6714
6715
  ) =>
6715
6716
  <I, R>(self: Schema<A, I, R>): filter<Schema<A, I, R>> =>
6716
6717
  self.pipe(
6717
- filter((a) => a <= maximum && a >= minimum, {
6718
+ filter((a) => a <= max && a >= min, {
6718
6719
  schemaId: BetweenDateSchemaId,
6719
- [BetweenDateSchemaId]: { maximum, minimum },
6720
- description: `a date between ${util_.formatDate(minimum)} and ${util_.formatDate(maximum)}`,
6720
+ [BetweenDateSchemaId]: { max, min },
6721
+ description: `a date between ${util_.formatDate(min)} and ${util_.formatDate(max)}`,
6721
6722
  ...annotations
6722
6723
  })
6723
6724
  )
6724
6725
 
6726
+ /**
6727
+ * @category schema id
6728
+ * @since 3.11.8
6729
+ */
6730
+ export const DateFromSelfSchemaId: unique symbol = schemaId_.DateFromSelfSchemaId
6731
+
6732
+ /**
6733
+ * @category schema id
6734
+ * @since 3.11.8
6735
+ */
6736
+ export type DateFromSelfSchemaId = typeof DateFromSelfSchemaId
6737
+
6725
6738
  /**
6726
6739
  * Describes a schema that accommodates potentially invalid `Date` instances,
6727
6740
  * such as `new Date("Invalid Date")`, without rejection.
@@ -6733,6 +6746,8 @@ export class DateFromSelf extends declare(
6733
6746
  Predicate.isDate,
6734
6747
  {
6735
6748
  identifier: "DateFromSelf",
6749
+ schemaId: DateFromSelfSchemaId,
6750
+ [DateFromSelfSchemaId]: { noInvalidDate: false },
6736
6751
  description: "a potentially invalid Date instance",
6737
6752
  pretty: () => (date) => `new Date(${JSON.stringify(date)})`,
6738
6753
  arbitrary: () => (fc) => fc.date({ noInvalidDate: false }),
@@ -1,5 +1,10 @@
1
1
  import type * as Schema from "../../Schema.js"
2
2
 
3
+ /** @internal */
4
+ export const DateFromSelfSchemaId: Schema.DateFromSelfSchemaId = Symbol.for(
5
+ "effect/SchemaId/DateFromSelf"
6
+ ) as Schema.DateFromSelfSchemaId
7
+
3
8
  /** @internal */
4
9
  export const GreaterThanSchemaId: Schema.GreaterThanSchemaId = Symbol.for(
5
10
  "effect/SchemaId/GreaterThan"
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.11.7"
1
+ let moduleVersion = "3.11.8"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.js","names":["GreaterThanSchemaId","exports","Symbol","for","GreaterThanOrEqualToSchemaId","LessThanSchemaId","LessThanOrEqualToSchemaId","IntSchemaId","NonNaNSchemaId","FiniteSchemaId","JsonNumberSchemaId","BetweenSchemaId","GreaterThanBigintSchemaId","GreaterThanOrEqualToBigIntSchemaId","LessThanBigIntSchemaId","LessThanOrEqualToBigIntSchemaId","BetweenBigintSchemaId","MinLengthSchemaId","MaxLengthSchemaId","LengthSchemaId","MinItemsSchemaId","MaxItemsSchemaId","ItemsCountSchemaId"],"sources":["../../../../src/internal/schema/filters.ts"],"sourcesContent":[null],"mappings":";;;;;;AAEA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAA+BE,MAAM,CAACC,GAAG,CACvE,6BAA6B,CACA;AAE/B;AACO,MAAMC,4BAA4B,GAAAH,OAAA,CAAAG,4BAAA,gBAAwCF,MAAM,CAACC,GAAG,CACzF,sCAAsC,CACA;AAExC;AACO,MAAME,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,gBAA4BH,MAAM,CAACC,GAAG,CACjE,0BAA0B,CACA;AAE5B;AACO,MAAMG,yBAAyB,GAAAL,OAAA,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AiB,iBAAA,gBAA6BhB,MAAM,CAACC,GAAG,CACnE,2BAA2B,CACA;AAE7B;AACO,MAAMgB,cAAc,GAAAlB,OAAA,CAAAkB,cAAA,gBAA0BjB,MAAM,CAACC,GAAG,CAC7D,wBAAwB,CACA;AAE1B;AACO,MAAMiB,gBAAgB,GAAAnB,OAAA,CAAAmB,gBAAA,gBAA4BlB,MAAM,CAACC,GAAG,CACjE,0BAA0B,CACA;AAE5B;AACO,MAAMkB,gBAAgB,GAAApB,OAAA,CAAAoB,gBAAA,gBAA4BnB,MAAM,CAACC,GAAG,CACjE,0BAA0B,CACA;AAE5B;AACO,MAAMmB,kBAAkB,GAAArB,OAAA,CAAAqB,kBAAA,gBAA8BpB,MAAM,CAACC,GAAG,CACrE,4BAA4B,CACA","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=filters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/internal/schema/filters.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.js","names":["GreaterThanSchemaId","Symbol","for","GreaterThanOrEqualToSchemaId","LessThanSchemaId","LessThanOrEqualToSchemaId","IntSchemaId","NonNaNSchemaId","FiniteSchemaId","JsonNumberSchemaId","BetweenSchemaId","GreaterThanBigintSchemaId","GreaterThanOrEqualToBigIntSchemaId","LessThanBigIntSchemaId","LessThanOrEqualToBigIntSchemaId","BetweenBigintSchemaId","MinLengthSchemaId","MaxLengthSchemaId","LengthSchemaId","MinItemsSchemaId","MaxItemsSchemaId","ItemsCountSchemaId"],"sources":["../../../../src/internal/schema/filters.ts"],"sourcesContent":[null],"mappings":"AAEA;AACA,OAAO,MAAMA,mBAAmB,gBAA+BC,MAAM,CAACC,GAAG,CACvE,6BAA6B,CACA;AAE/B;AACA,OAAO,MAAMC,4BAA4B,gBAAwCF,MAAM,CAACC,GAAG,CACzF,sCAAsC,CACA;AAExC;AACA,O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