Files
effect/packages/schema/CHANGELOG.md
T
github-actions[bot]andgithub-actions[bot] d46550c105 Version Packages (#2358)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-19 13:57:16 +13:00

136 KiB

@effect/schema

0.64.7

Patch Changes

  • Updated dependencies [71fd528]:
    • effect@2.4.9

0.64.6

Patch Changes

  • #2347 595140a Thanks @gcanti! - add back BrandSchema and introduce asBrandSchema utility

  • #2353 5f5fcd9 Thanks @tim-smart! - make optional dual:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.struct({
      a: S.string.pipe(S.optional()),
    });
    
    // same as:
    const schema2 = S.struct({
      a: S.optional(S.string),
    });
    
  • #2356 7a45ad0 Thanks @gcanti! - make partial dual:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.struct({ a: S.string }).pipe(S.partial());
    
    // same as:
    const schema2 = S.partial(S.struct({ a: S.string }));
    
  • #2339 5c3b1cc Thanks @gcanti! - use Simplify from effect/Types in TaggedClass, TaggedError and TaggedRequest to avoid errors in Schema.d.ts, closes #1841

  • #2343 6f7dfc9 Thanks @gcanti! - improve pick/omit and add support for Class

  • #2337 88b8583 Thanks @gcanti! - JSONSchema: allow overrides through annotations, closes #1823

  • #2348 cb20824 Thanks @gcanti! - feedback: expose Class API identifiers

  • #2350 a45a525 Thanks @gcanti! - refactor unions: remove sorting, flattening, and unification

  • Updated dependencies [bb0b69e, 6b20bad, 4e64e9b, 3851a02, 5f5fcd9, 814e5b8]:

    • effect@2.4.8

0.64.5

Patch Changes

  • #2332 d0f56c6 Thanks @gcanti! - add missing Date api interfaces:

    • DateFromSelf
    • ValidDateFromSelf
    • DateFromString
    • $Date

0.64.4

Patch Changes

  • Updated dependencies [eb93283]:
    • effect@2.4.7

0.64.3

Patch Changes

  • #2320 cfef6ec Thanks @gcanti! - feedback: remove array overload to restore pipeability to the API

0.64.2

Patch Changes

  • #2310 89748c9 Thanks @gcanti! - merge Parser module into ParseResult:

    • remove Parser module
    • remove internal/parseResult internal module
  • Updated dependencies [4f35a7e, 9971186]:

    • effect@2.4.6

0.64.1

Patch Changes

0.64.0

Minor Changes

Breaking Changes

  • The Format module has been removed

AST module

  • Tuple has been refactored to TupleType, and its _tag has consequently been renamed. The type of its rest property has changed from Option.Option<ReadonlyArray.NonEmptyReadonlyArray<AST>> to ReadonlyArray<AST>.

  • Transform has been refactored to Transformation, and its _tag property has consequently been renamed. Its property transformation has now the type TransformationKind = FinalTransformation | ComposeTransformation | TypeLiteralTransformation.

  • createRecord has been removed

  • AST.to has been renamed to AST.typeAST

  • AST.from has been renamed to AST.encodedAST

  • ExamplesAnnotation and DefaultAnnotation now accept a type parameter

  • format has been removed: Before

    AST.format(ast, verbose?)
    

    Now

    ast.toString(verbose?)
    
  • setAnnotation has been removed (use annotations instead)

  • mergeAnnotations has been renamed to annotations

  • move defaultParseOption from Parser.ts to AST.ts

ParseResult module

  • The ParseResult module now uses classes and custom constructors have been removed: Before

    import * as ParseResult from "@effect/schema/ParseResult";
    
    ParseResult.type(ast, actual);
    

    Now

    import * as ParseResult from "@effect/schema/ParseResult";
    
    new ParseResult.Type(ast, actual);
    
  • Transform has been refactored to Transformation, and its kind property now accepts "Encoded", "Transformation", or "Type" as values

Schema module

  • uniqueSymbol has been renamed to uniqueSymbolFromSelf

  • Schema.Schema.To has been renamed to Schema.Schema.Type, and Schema.to to Schema.typeSchema

  • Schema.Schema.From has been renamed to Schema.Schema.Encoded, and Schema.from to Schema.encodedSchema

  • The type parameters of TaggedRequest have been swapped

  • The signature of PropertySignature has been changed from PropertySignature<From, FromOptional, To, ToOptional> to PropertySignature<ToToken extends Token, To, Key extends PropertyKey, FromToken extends Token, From, R>

  • Class APIs

    • Class APIs now expose fields and require an identifier
      -class A extends S.Class<A>()({ a: S.string }) {}
      +class A extends S.Class<A>("A")({ a: S.string }) {}
      
  • element and rest have been removed in favor of tuple:

    Before

    import * as S from "@effect/schema/Schema";
    
    const schema1 = S.tuple().pipe(S.rest(S.number), S.element(S.boolean));
    
    const schema2 = S.tuple(S.string).pipe(
      S.rest(S.number),
      S.element(S.boolean),
    );
    

    Now

    import * as S from "@effect/schema/Schema";
    
    const schema1 = S.tuple([], S.number, S.boolean);
    
    const schema2 = S.tuple([S.string], S.number, S.boolean);
    
  • optionalElement has been refactored:

    Before

    import * as S from "@effect/schema/Schema";
    
    const schema = S.tuple(S.string).pipe(S.optionalElement(S.number));
    

    Now

    import * as S from "@effect/schema/Schema";
    
    const schema = S.tuple(S.string, S.optionalElement(S.number));
    
  • use TreeFormatter in BrandSchemas

  • Schema annotations interfaces have been refactored into a namespace Annotations

  • the annotations option of the optional constructor has been replaced by the annotations method Before

    S.optional(S.string, {
      exact: true,
      annotations: { description: "description" },
    });
    

    Now

    S.optional(S.string, { exact: true }).annotations({
      description: "description",
    });
    
  • Updated the pluck function to return Schema<A[K], { readonly [key]: I[K] }> instead of Schema<A[K], I>. Removed the { transformation: false } option in favor of selecting the specific field from the fields exposed by a struct.

  • Removed propertySignatureAnnotations, use propertySignature(schema).annotations().

  • Updated the function name headOr to headOrElse to align with the standard naming convention.

Serializable module

  • The type parameters of SerializableWithResult and WithResult have been swapped

Patch Changes

  • #2172 5d47ee0 Thanks @gcanti! - ## AST module

    • expose the getTemplateLiteralRegExp API

    Schema module

    • enhance the struct API to allow records:

      const schema1 = S.struct(
        { a: S.number },
        { key: S.string, value: S.number },
      );
      // or
      const schema2 = S.struct({ a: S.number }, S.record(S.string, S.number));
      
    • enhance the extend API to allow nested (non-overlapping) fields:

      const A = S.struct({ a: S.struct({ b: S.string }) });
      const B = S.struct({ a: S.struct({ c: S.number }) });
      const schema = S.extend(A, B);
      /*
      same as:
      const schema = S.struct({
        a: S.struct({
          b: S.string,
          c: S.number
        })
      })
      */
      
    • add Annotable interface

    • add asSchema

    • add add Schema.Any, Schema.All, Schema.AnyNoContext helpers

    • refactor annotations API to be a method within the Schema interface

    • add support for AST.keyof, AST.getPropertySignatures, Parser.getSearchTree to Classes

    • fix BrandAnnotation type and add getBrandAnnotation

    • add annotations? parameter to Class constructors:

      import * as AST from "@effect/schema/AST";
      import * as S from "@effect/schema/Schema";
      
      class A extends S.Class<A>("A")(
        {
          a: S.string,
        },
        { description: "some description..." }, // <= annotations
      ) {}
      
  • Updated dependencies [5d47ee0, 817a04c, d90a99d, dd05faa, dd05faa, 802674b]:

    • effect@2.4.4

0.63.4

Patch Changes

0.63.3

Patch Changes

0.63.2

Patch Changes

  • #2222 39f583e Thanks @gcanti! - TaggedClass: ensure constructor parameters don't overwrite the tag

  • #2227 f428198 Thanks @gcanti! - add ConcurrencyAnnotation, default value: undefined (sequential)

    Example:

    const schema = S.struct({
      a: S.string,
      b: S.number,
    }).pipe(S.concurrency(1 /* number | "unbounded" | "inherit" | undefined */));
    
  • #2221 c035972 Thanks @tim-smart! - ensure Schema.Class is compatible without strictNullCheck

  • Updated dependencies [a4a0006, 0a37676, 6f503b7]:

    • effect@2.4.1

0.63.1

Patch Changes

  • #2209 5d30853 Thanks @steffanek! - Add pickLiteral to Schema so that we can pick values from a Schema literal as follows:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.literal("a", "b", "c").pipe(S.pickLiteral("a", "b")); // same as S.literal("a", "b")
    
    S.decodeUnknownSync(schema)("a"); // ok
    S.decodeUnknownSync(schema)("b"); // ok
    S.decodeUnknownSync(schema)("c");
    /*
    Error: "a" | "b"
    ├─ Union member
    │  └─ Expected "a", actual "c"
    └─ Union member
       └─ Expected "b", actual "c"
    */
    
  • #2217 6e350ed Thanks @gcanti! - JSONSchema: prune UndefinedKeyword if the property signature is marked as optional and contains a union that includes UndefinedKeyword, closes #2068

0.63.0

Minor Changes

  • #2101 54ddbb7 Thanks @github-actions! - Updated the MessageAnnotation type to accept a ParseIssue; it's now (issue: ParseResult.ParseIssue) => string to support custom error messages, which can be triggered under any circumstances.

    You can retrieve the actual value by accessing the actual property of the issue object:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.string.pipe(
      S.filter((s): s is string => s.length === 1, {
    -    message: (actual) => `invalid value ${actual}`,
    +    message: (issue) => `invalid value ${issue.actual}`,
      })
    );
    
  • #2101 a025b12 Thanks @github-actions! - Swap type params of Either from Either<E, A> to Either<R, L = never>.

    Along the same line of the other changes this allows to shorten the most common types such as:

    import { Either } from "effect";
    
    const right: Either.Either<string> = Either.right("ok");
    

Patch Changes

0.62.9

Patch Changes

0.62.8

Patch Changes

0.62.7

Patch Changes

  • #2141 dbff62c Thanks @gcanti! - add { exact: true } optional argument to the partial API, mirroring the implementation in the optional API, closes #2140

    The partial operation allows you to make all properties within a schema optional.

    By default, the partial operation adds a union with undefined to the types. If you wish to avoid this, you can opt-out by passing a { exact: true } argument to the partial operation.

    Example

    import * as S from "@effect/schema/Schema";
    
    /*
    const schema: S.Schema<{
        readonly a?: string | undefined;
    }, {
        readonly a?: string | undefined;
    }, never>
    */
    const schema = S.partial(S.struct({ a: S.string }));
    
    S.decodeUnknownSync(schema)({ a: "a" }); // ok
    S.decodeUnknownSync(schema)({ a: undefined }); // ok
    
    /*
    const exact: S.Schema<{
        readonly a?: string;
    }, {
        readonly a?: string;
    }, never>
    */
    const exactSchema = S.partial(S.struct({ a: S.string }), { exact: true });
    
    S.decodeUnknownSync(exactSchema)({ a: "a" }); // ok
    S.decodeUnknownSync(exactSchema)({ a: undefined });
    /*
    throws:
    Error: { a?: string }
    └─ ["a"]
       └─ Expected a string, actual undefined
    */
    
  • #2128 e572b07 Thanks @tim-smart! - allow passing structs when encoding schema classes

    The following will no longer throw an error:

    import * as S from "@effect/schema/Schema";
    
    class C extends S.Class<C>()({
      n: S.NumberFromString,
    }) {
      get b() {
        return 1;
      }
    }
    class D extends S.Class<D>()({
      n: S.NumberFromString,
      b: S.number,
    }) {}
    
    console.log(S.encodeSync(D)(new C({ n: 1 })));
    // Output: { b: 1, n: '1' }
    
  • #2123 e787a57 Thanks @gcanti! - Refactor the declare signature to ensure that the decoding and encoding functions do not utilize context.

    As a result, we can relax the signature of the following functions to accept R !== never:

    • Parser.validateSync
    • Parser.validateOption
    • Parser.validateEither
    • Parser.is
    • Parser.asserts
    • Schema.validateSync
    • Schema.validateOption
    • Schema.validateEither
    • Schema.is
    • Schema.asserts

    Additionally, the Class API no longer requires the optional argument disableValidation to be true when R !== never.

  • Updated dependencies [b1163b2, b46b869, de1b226, a663390, ff88f80, 11be07b, c568645, 88835e5, b415577, ff8046f]:

    • effect@2.3.6

0.62.6

Patch Changes

  • #2121 aef2b8b Thanks @gcanti! - Use the identity function in the transformation defining a schema class

  • #2124 7eecb1c Thanks @gcanti! - ParseResult: add missing decode / encode exports

  • Updated dependencies [b881365]:

    • effect@2.3.5

0.62.5

Patch Changes

  • Updated dependencies [17bda66]:
    • effect@2.3.4

0.62.4

Patch Changes

  • #2108 1c6d18b Thanks @gcanti! - Schema: add transformation: false option to pluck.

    Given a schema Schema<A, I, R> and a key K, this function extracts a specific field from the A type, producing a new schema that represents a transformation from the I type to A[K].

    If the option { transformation: false } is provided, the returned schema Schema<A[K], I[K], R> only represents the value of the field without any transformation.

    Example

    import * as S from "@effect/schema/Schema";
    
    // ---------------------------------------------
    // use case: pull out a single field from a
    // struct through a transformation
    // ---------------------------------------------
    
    const mytable = S.struct({
      column1: S.NumberFromString,
      column2: S.number,
    });
    
    // const pullOutColumn1: S.Schema<number, {
    //     readonly column1: string;
    //     readonly column2: number;
    // }, never>
    const pullOutColumn1 = mytable.pipe(S.pluck("column1"));
    
    console.log(
      S.decode(S.array(pullOutColumn1))([
        { column1: "1", column2: 100 },
        { column1: "2", column2: 300 },
      ]),
    );
    // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] }
    
    // ---------------------------------------------
    // use case: pull out a single field from a
    // struct (no transformation)
    // ---------------------------------------------
    
    // const pullOutColumn1Value: S.Schema<number, string, never>
    const pullOutColumn1Value = mytable.pipe(
      S.pluck("column1", { transformation: false }),
    );
    
    console.log(S.decode(S.array(pullOutColumn1Value))(["1", "2"]));
    // Output: { _id: 'Either', _tag: 'Right', right: [ 1, 2 ] }
    
  • #2110 13d3266 Thanks @gcanti! - make headOr dual

  • #2111 a344b42 Thanks @gcanti! - add support for unions to keyof

0.62.3

Patch Changes

0.62.2

Patch Changes

0.62.1

Patch Changes

  • Updated dependencies [b5a8215]:
    • effect@2.3.1

0.62.0

Minor Changes

  • #2006 9a2d1c1 Thanks @github-actions! - With this change we now require a string key to be provided for all tags and renames the dear old Tag to GenericTag, so when previously you could do:

    import { Effect, Context } from "effect";
    interface Service {
      readonly _: unique symbol;
    }
    const Service = Context.Tag<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >();
    

    you are now mandated to do:

    import { Effect, Context } from "effect";
    interface Service {
      readonly _: unique symbol;
    }
    const Service = Context.GenericTag<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >("Service");
    

    This makes by default all tags globals and ensures better debuggaility when unexpected errors arise.

    Furthermore we introduce a new way of constructing tags that should be considered the new default:

    import { Effect, Context } from "effect";
    class Service extends Context.Tag("Service")<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >() {}
    
    const program = Effect.flatMap(Service, ({ number }) => number).pipe(
      Effect.flatMap((_) => Effect.log(`number: ${_}`)),
    );
    

    this will use "Service" as the key and will create automatically an opaque identifier (the class) to be used at the type level, it does something similar to the above in a single shot.

  • #2006 1a77f72 Thanks @github-actions! - change Effect type parameters order from Effect<R, E, A> to Effect<A, E = never, R = never>

  • #2006 d3f9f4d Thanks @github-actions! - Schema: switch readonlyMapFromSelf, readonlyMap from positional arguments to a single options argument:

    Before:

    import * as S from "@effect/schema/Schema";
    
    S.readonlyMapFromSelf(S.string, S.number);
    S.readonlyMap(S.string, S.number);
    

    Now:

    import * as S from "@effect/schema/Schema";
    
    S.readonlyMapFromSelf({ key: S.string, value: S.number });
    S.readonlyMap({ key: S.string, value: S.number });
    
  • #2006 d3f9f4d Thanks @github-actions! - Schema: switch hashMapFromSelf, hashMap from positional arguments to a single options argument:

    Before:

    import * as S from "@effect/schema/Schema";
    
    S.hashMapFromSelf(S.string, S.number);
    S.hashMap(S.string, S.number);
    

    Now:

    import * as S from "@effect/schema/Schema";
    
    S.hashMapFromSelf({ key: S.string, value: S.number });
    S.hashMap({ key: S.string, value: S.number });
    
  • #2006 d3f9f4d Thanks @github-actions! - Schema: switch causeFromSelf, cause from positional arguments to a single options argument:

    Before:

    import * as S from "@effect/schema/Schema";
    
    S.causeFromSelf(S.string);
    S.causeFromSelf(S.string, S.unknown);
    S.cause(S.string);
    S.cause(S.string, S.unknown);
    

    Now:

    import * as S from "@effect/schema/Schema";
    
    S.causeFromSelf({ error: S.string });
    S.causeFromSelf({ error: S.string, defect: S.unknown });
    S.cause({ error: S.string });
    S.cause({ error: S.string, defect: S.unknown });
    
  • #2006 d3f9f4d Thanks @github-actions! - Schema: switch exitFromSelf, exit from positional arguments to a single options argument:

    Before:

    import * as S from "@effect/schema/Schema";
    
    S.exitFromSelf(S.string, S.number);
    S.exit(S.string, S.number);
    

    Now:

    import * as S from "@effect/schema/Schema";
    
    S.exitFromSelf({ failure: S.string, success: S.number });
    S.exit({ failure: S.string, success: S.number });
    
  • #2006 a34dbdc Thanks @github-actions! - - Schema: change type parameters order from Schema<R, I, A> to Schema<A, I = A, R = never>

    • Serializable: change type parameters order from Serializable<R, I, A> to Serializable<A, I, R>
    • Class: change type parameters order from Class<R, I, A, C, Self, Inherited> to Class<A, I, R, C, Self, Inherited>
    • PropertySignature: change type parameters order from PropertySignature<R, From, FromIsOptional, To, ToIsOptional> to PropertySignature<From, FromIsOptional, To, ToIsOptional, R = never>
  • #2006 d3f9f4d Thanks @github-actions! - Schema: switch eitherFromSelf, either, eitherFromUnion from positional arguments to a single options argument:

    Before:

    import * as S from "@effect/schema/Schema";
    
    S.eitherFromSelf(S.string, S.number);
    S.either(S.string, S.number);
    S.eitherFromUnion(S.string, S.number);
    

    Now:

    import * as S from "@effect/schema/Schema";
    
    S.eitherFromSelf({ left: S.string, right: S.number });
    S.either({ left: S.string, right: S.number });
    S.eitherFromUnion({ left: S.string, right: S.number });
    
  • #2006 02c3461 Thanks @github-actions! - With this change we remove the Data.Data type and we make Equal.Equal & Hash.Hash implicit traits.

    The main reason is that Data.Data<A> was structurally equivalent to A & Equal.Equal but extending Equal.Equal doesn't mean that the equality is implemented by-value, so the type was simply adding noise without gaining any level of safety.

    The module Data remains unchanged at the value level, all the functions previously available are supposed to work in exactly the same manner.

    At the type level instead the functions return Readonly variants, so for example we have:

    import { Data } from "effect";
    
    const obj = Data.struct({
      a: 0,
      b: 1,
    });
    

    will have the obj typed as:

    declare const obj: {
      readonly a: number;
      readonly b: number;
    };
    
  • #2006 9a2d1c1 Thanks @github-actions! - This change enables Effect.serviceConstants and Effect.serviceMembers to access any constant in the service, not only the effects, namely it is now possible to do:

    import { Effect, Context } from "effect";
    
    class NumberRepo extends Context.TagClass("NumberRepo")<
      NumberRepo,
      {
        readonly numbers: Array<number>;
      }
    >() {
      static numbers = Effect.serviceConstants(NumberRepo).numbers;
    }
    
  • #2006 56b8691 Thanks @github-actions! - Fix usage of Schema.TaggedError in combination with Unify.

    When used with Unify we previously had:

    import { Schema } from "@effect/schema";
    import type { Unify } from "effect";
    
    class Err extends Schema.TaggedError<Err>()("Err", {}) {}
    
    // $ExpectType Effect<unknown, unknown, unknown>
    export type IdErr = Unify.Unify<Err>;
    

    With this fix we now have:

    import { Schema } from "@effect/schema";
    import type { Unify } from "effect";
    
    class Err extends Schema.TaggedError<Err>()("Err", {}) {}
    
    // $ExpectType Err
    export type IdErr = Unify.Unify<Err>;
    

Patch Changes

0.61.7

Patch Changes

0.61.6

Patch Changes

0.61.5

Patch Changes

0.61.4

Patch Changes

0.61.3

Patch Changes

0.61.2

Patch Changes

  • #1988 64f710a Thanks @gcanti! - Class constructor: avoid overwriting props with additionalProps, closes #1987

0.61.1

Patch Changes

0.61.0

Minor Changes

  • #1922 62b40e8 Thanks @gcanti! - Refactoring:

    • Schema:
      • refactor Schema.declare API to make it safe
      • add Schema.declare overloads
      • add encodeUnknown* APIs
      • rename parse* APIs to decodeUnknown*
      • symplify brand implementation
      • rename params to annotation in typeId annotation
      • add optional { strict: false } parameter to compose
      • Class
        • rename transform to transformOrFail
        • rename transformFrom to transformOrFailFrom
      • add hashSet and hashSetFromSelf
      • add hashMap and hashMapFromSelf
      • add list and listFromSelf
    • AST:
      • return ParseResult.ParseIssue instead of ParseResult.ParseError in all APIs
      • Declaration
        • split decode into decodeUnknown / encodeUnknown
        • remove type field
    • ParseResult
      • align mapBoth with Effect (i.e. onFailure, onSuccess handlers)
      • add missing Declaration node in ParseIssue
  • #1922 62b40e8 Thanks @gcanti! - add context tracking to Schema, closes #1873

Patch Changes

0.60.7

Patch Changes

0.60.6

Patch Changes

  • Updated dependencies [21b9edd]:
    • effect@2.1.2

0.60.5

Patch Changes

0.60.4

Patch Changes

0.60.3

Patch Changes

0.60.2

Patch Changes

0.60.1

Patch Changes

  • Updated dependencies [f7f19f6]:
    • effect@2.0.5

0.60.0

Minor Changes

  • #1913 b557a10 Thanks @gcanti! - ParseResult refactoring:

    • remove ParseResult type
    • rename mapLeft to mapError
    • rename bimap to mapBoth

Patch Changes

0.59.1

Patch Changes

0.59.0

Minor Changes

  • #1878 c4b84f7 Thanks @gcanti! - Schema: remove from/to API in favour of make in:

    • Equivalence
    • JSONSchema
    • Pretty

Patch Changes

0.58.0

Minor Changes

  • #1877 a904a73 Thanks @gcanti! - Schema: Arbitrary remove from/to API in favour of make

  • #1842 7b2f874 Thanks @fubhy! - Schema: simplify AST.createRefinement return type

  • #1842 7b2f874 Thanks @fubhy! - Schema: refactor ParseResult module:

    • add Union issue, and replace UnionMember with Union
    • add Tuple issue, and replace Index with Tuple
    • add TypeLiteral issue
    • add Transform issue
    • add Refinement issue
    • add ast field to Member
    • rename UnionMember to Member
    • Type: rename expected to ast
    • ParseError replace errors field with error field and refactor parseError constructor accordingly
    • Index replace errors field with error field
    • Key replace errors field with error field
    • Member replace errors field with error field
    • ParseError replace errors field with error field
    • make ParseError a Data.TaggedError
    • Forbidden: add actual field

Patch Changes

0.57.2

Patch Changes

  • Updated dependencies [d5a1949]:
    • effect@2.0.2

0.57.1

Patch Changes

  • Updated dependencies [16bd87d]:
    • effect@2.0.1

0.57.0

Minor Changes

Patch Changes

0.56.1

Patch Changes

  • #684 6b9585b Thanks @patroza! - improve: Actually use Arbitrary interface in to/from/unsafe signature

  • #679 0f8a8f1 Thanks @gcanti! - Schema: add annotations argument to attachPropertySignature

0.56.0

Minor Changes

0.55.0

Minor Changes

  • #649 d80b933 Thanks @gcanti! - Arbitrary: should throw on declarations without annotations

  • #669 294dfad Thanks @gcanti! - Schema: refactor parseJson to replace ParseJson and fromJson

  • #649 d80b933 Thanks @gcanti! - Schema: refactor S.optional API.

    Upgrade Guide:

    • S.optional(schema, { exact: true }) replaces the old S.optional(schema)
    • S.optional(schema, { exact: true, default: () => A }) replaces the old S.optional(schema).withDefault(() => A)
    • S.optional(schema, { exact: true, as: "Option" }) replaces the old S.optional(schema).toOption()
  • #649 d80b933 Thanks @gcanti! - Schema: replace propertySignature constructor with propertySignatureAnnotations combinator

  • #669 294dfad Thanks @gcanti! - Schema: simplify split parameters to only accept separator

  • #669 294dfad Thanks @gcanti! - Schema: remove useless combinators

    • lowercase
    • uppercase
    • trim
    • numberFromString
    • symbolFromString
    • bigintFromString
    • bigintFromNumber
    • secret
    • durationFromHrTime
    • durationFromMillis
    • durationFromNanos
    • uint8ArrayFromNumbers
    • base64
    • base64url
    • hex
    • dateFromString
    • bigDecimalFromNumber
    • bigDecimalFromString
    • not

Patch Changes

0.54.1

Patch Changes

0.54.0

Minor Changes

0.53.3

Patch Changes

0.53.2

Patch Changes

0.53.1

Patch Changes

0.53.0

Minor Changes

Patch Changes

  • #645 ece6128 Thanks @gcanti! - ensure that JSON Schema annotations can be exclusively applied to refinements

0.52.0

Minor Changes

Patch Changes

0.51.5

Patch Changes

  • #629 f690ebe Thanks @gcanti! - Schema: add filter overloading returning Option

    For more complex scenarios, you can return an Option<ParseError> type instead of a boolean. In this context, None indicates success, and Some(error) rejects the input with a specific error

0.51.4

Patch Changes

0.51.3

Patch Changes

0.51.2

Patch Changes

0.51.1

Patch Changes

0.51.0

Minor Changes

Patch Changes

0.50.0

Minor Changes

  • #593 cbc2e3f Thanks @gcanti! - ParseResult: merge failure APIs into fail

  • #607 e85aefb Thanks @gcanti! - Bug Fix: align index signature behaviour to TypeScript

  • #589 3b99569 Thanks @gcanti! - - remove ValidDate (which is just an alias of Date)

    • add DateFromString (decodes from string, output: possibly invalid Date)
  • #593 cbc2e3f Thanks @gcanti! - ParseResult: rename success to succeed (standard naming)

Patch Changes

  • #597 caeed29 Thanks @jessekelly881! - added BigDecimal

  • #585 5b27f03 Thanks @gcanti! - improve JSON Schema output:

    • rename dependencies to $defs
    • remove "type" from const schemas
    • use "oneOf" for enums and add "title"s
    • add support for record(pattern, number)
    • add "$id" and "$comment" properties
    • literals should be converted to enum instead of anyOf, closes #579
  • #603 8e21d7e Thanks @gcanti! - TreeFormatter: enhance formatActual for data types with a custom toString implementation, closes #600

0.49.4

Patch Changes

0.49.3

Patch Changes

0.49.2

Patch Changes

  • #587 64fe91f Thanks @gcanti! - DateFromSelf: its arbitrary should also generate "Invalid Date"s

0.49.1

Patch Changes

0.49.0

Minor Changes

Patch Changes

0.48.4

Patch Changes

0.48.3

Patch Changes

0.48.2

Patch Changes

0.48.1

Patch Changes

0.48.0

Minor Changes

0.47.7

Patch Changes

0.47.6

Patch Changes

0.47.5

Patch Changes

  • #553 522161a Thanks @gcanti! - Fix bug in property signature transformations when used for renaming (old key/value pair was not removed)

0.47.4

Patch Changes

  • #550 5167e2d Thanks @gcanti! - attachPropertySignature: add support for symbols as values

0.47.3

Patch Changes

0.47.2

Patch Changes

0.47.1

Patch Changes

0.47.0

Minor Changes

0.46.4

Patch Changes

0.46.3

Patch Changes

0.46.2

Patch Changes

0.46.1

Patch Changes

0.46.0

Minor Changes

0.45.8

Patch Changes

0.45.7

Patch Changes

0.45.6

Patch Changes

0.45.5

Patch Changes

0.45.4

Patch Changes

0.45.3

Patch Changes

  • #500 e9ff876 Thanks @gcanti! - Arbitrary: remove NaN while generating numeric template literals

0.45.2

Patch Changes

0.45.1

Patch Changes

  • #496 ff360c6 Thanks @gcanti! - Arbitrary: fix issue with generating optional tuple elements

0.45.0

Minor Changes

Patch Changes

0.44.0

Minor Changes

0.43.2

Patch Changes

  • #485 0a20788 Thanks @gcanti! - Arbitrary: use Math.fround when creating number constraints, closes #484

0.43.1

Patch Changes

0.43.0

Minor Changes

0.42.0

Minor Changes

0.41.1

Patch Changes

0.41.0

Minor Changes

0.40.2

Patch Changes

0.40.1

Patch Changes

0.40.0

Minor Changes

0.39.2

Patch Changes

0.39.1

Patch Changes

0.39.0

Minor Changes

0.38.0

Minor Changes

  • #439 2197496 Thanks @gcanti! - Schema: remove *Result APIs

    • decodeResult (use decode instead)
    • encodeResult (use encode instead)
    • parseResult (use parse instead)
    • validateResult (use validate instead)

Patch Changes

  • #447 0252143 Thanks @gcanti! - int filter: use Number.isSafeInteger instead of Number.isInteger

0.37.2

Patch Changes

0.37.1

Patch Changes

0.37.0

Minor Changes

0.36.5

Patch Changes

0.36.4

Patch Changes

  • #434 994a37e Thanks @gcanti! - Exclude property signatures from index signatures validations, fix #433

0.36.3

Patch Changes

0.36.2

Patch Changes

0.36.1

Patch Changes

0.36.0

Minor Changes

0.35.1

Patch Changes

0.35.0

Minor Changes

  • #401 8b1ae6b Thanks @gcanti! - backport AST changes from POC:

    • change decode in Declaration- change decode in Refinement (to filter)
    • remove isReversed from Refinement
    • add transformation to Transform (and remove decode, encode, propertySignatureTransformations)
    • refactor PropertySignature
  • #401 8b1ae6b Thanks @gcanti! - refactor annotations: keys must be symbols

  • #411 2f6c4d1 Thanks @gcanti! - rename symbol to symbolFromSelf and add symbol which decodes/encodes from/to string

  • #401 8b1ae6b Thanks @gcanti! - remove Spread in favour of /data/Types#Simplify

  • #413 20ef377 Thanks @tim-smart! - update /io

  • #401 8b1ae6b Thanks @gcanti! - fix fromBrand definition (self is a Schema<I, A> now instead of Schema)

  • #401 8b1ae6b Thanks @gcanti! - rename bigint to bigintFromSelf and BigintFromString to bigint

  • #401 8b1ae6b Thanks @gcanti! - change transformation display in error messages (from A -> B to A <-> B)

  • #401 8b1ae6b Thanks @gcanti! - move From, To to Schema namespace (conforming to the ecosystem standard)

  • #401 8b1ae6b Thanks @gcanti! - rename transformResult to transformOrFail and change signature (add additional ast parameter to transformations)

Patch Changes

0.34.0

Minor Changes

Patch Changes

0.33.2

Patch Changes

0.33.1

Patch Changes

0.33.0

Minor Changes

Patch Changes

0.32.0

Minor Changes

0.31.0

Minor Changes

0.30.4

Patch Changes

0.30.3

Patch Changes

0.30.2

Patch Changes

0.30.1

Patch Changes

0.30.0

Minor Changes

0.29.1

Patch Changes

0.29.0

Minor Changes

0.28.0

Minor Changes

0.27.0

Minor Changes

0.26.1

Patch Changes

0.26.0

Minor Changes

0.25.0

Minor Changes

0.24.0

Minor Changes

Patch Changes

0.23.0

Minor Changes

0.22.0

Minor Changes

0.21.1

Patch Changes

0.21.0

Minor Changes

0.20.3

Patch Changes

0.20.2

Patch Changes

0.20.1

Patch Changes

0.20.0

Minor Changes

0.19.3

Patch Changes

  • #285 39d3c55 Thanks @gcanti! - AST: memoize createLazy

  • #285 39d3c55 Thanks @gcanti! - Arbitrary: fix maximum call stack size exceeded when producing nested arrays and records that are too deep

0.19.2

Patch Changes

0.19.1

Patch Changes

0.19.0

Minor Changes

0.18.0

Minor Changes

0.17.5

Patch Changes

  • #272 d91a7a7 Thanks @gcanti! - pick / omit: add support for structs with property signature transformations

0.17.4

Patch Changes

0.17.3

Patch Changes

0.17.2

Patch Changes

0.17.1

Patch Changes

  • #256 162e099 Thanks @gcanti! - leverage annotations (e.g. maxLength, int, between) to improve fast-check performance

0.17.0

Minor Changes

0.16.0

Minor Changes

0.15.0

Minor Changes

0.14.1

Patch Changes

0.14.0

Minor Changes

Patch Changes

0.13.1

Patch Changes

  • #234 9ed0ee2 Thanks @gcanti! - attachPropertySignature as PropertySignatureTransformation

0.13.0

Minor Changes

0.12.1

Patch Changes

0.12.0

Minor Changes

0.11.1

Patch Changes

0.11.0

Minor Changes

Patch Changes

0.10.0

Minor Changes

0.9.1

Patch Changes

0.9.0

Minor Changes

0.8.3

Patch Changes

0.8.2

Patch Changes

0.8.1

Patch Changes

0.8.0

Minor Changes

Patch Changes

0.7.1

Patch Changes

0.7.0

Minor Changes

0.6.0

Minor Changes

Patch Changes

0.5.0

Minor Changes

  • #178 f60341f Thanks @gcanti! - merge transformEither and transformEffect into transformResult

0.4.0

Minor Changes

Patch Changes

0.3.1

Patch Changes

0.3.0

Minor Changes

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

Patch Changes

0.1.0

Minor Changes

Patch Changes

0.0.5

Patch Changes

0.0.4

Patch Changes

  • #115 1555a81 Thanks @gcanti! - Optimize decoding of unions using a heuristic based on literals

0.0.3

Patch Changes

0.0.2

Patch Changes

0.0.1

Patch Changes