Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency effect to v3.11.10 #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 13, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
effect (source) 3.11.5 -> 3.11.10 age adoption passing confidence

Release Notes

Effect-TS/effect (effect)

v3.11.10

Compare Source

Patch Changes
  • #​4176 39457d4 Thanks @​mikearnaldi! - Fix Stream.scoped example

  • #​4181 a475cc2 Thanks @​gcanti! - Schema: Fix withDecodingDefault implementation to align with its signature (now removes undefined from the AST).

    Additionally, a new constraint has been added to the signature to prevent calling withDecodingDefault after withConstructorDefault, which previously led to the following issue:

    import { Schema } from "effect"
    
    const schema = Schema.Struct({
      a: Schema.optional(Schema.String).pipe(
        Schema.withConstructorDefault(() => undefined), // this is invalidated by the following call to `withDecodingDefault`
        Schema.withDecodingDefault(() => "")
      )
    })
  • #​4175 199214e Thanks @​gcanti! - Schema: refactor annotations:

    • Export internal Uint8 schema

    • Export internal NonNegativeInt schema

    • Remove title annotations that are identical to identifiers

    • Avoid setting a title annotation when applying branding

    • Add more title annotations to refinements

    • Improve toString output and provide more precise error messages for refinements:

      Before

      import { Schema } from "effect"
      
      const schema = Schema.Number.pipe(
        Schema.int({ identifier: "MyInt" }),
        Schema.positive()
      )
      
      console.log(String(schema))
      // Output: a positive number
      
      Schema.decodeUnknownSync(schema)(1.1)
      /*
      throws:
      ParseError: a positive number
      └─ From side refinement failure
        └─ MyInt
            └─ Predicate refinement failure
              └─ Expected MyInt, actual 1.1
      */

      After

      • toString now combines all refinements with " & " instead of showing only the last one.
      • The last message ("Expected ...") now uses the extended description to make the error message clearer.
      import { Schema } from "effect"
      
      const schema = Schema.Number.pipe(
        Schema.int({ identifier: "MyInt" }),
        Schema.positive()
      )
      
      console.log(String(schema))
      // Output: MyInt & positive // <= all the refinements
      
      Schema.decodeUnknownSync(schema)(1.1)
      /*
      throws:
      ParseError: MyInt & positive
      └─ From side refinement failure
        └─ MyInt
            └─ Predicate refinement failure
              └─ Expected an integer, actual 1.1 // <= extended description
      */
  • #​4182 b3c160d Thanks @​mikearnaldi! - Replace absolute imports with relative ones

v3.11.9

Compare Source

Patch Changes
  • #​4113 1c08a0b Thanks @​thewilkybarkid! - Schema: Support template literals in Schema.Config.

    Example

    import { Schema } from "effect"
    
    // const config: Config<`a${string}`>
    const config = Schema.Config(
      "A",
      Schema.TemplateLiteral(Schema.Literal("a"), Schema.String)
    )
  • #​4174 1ce703b Thanks @​gcanti! - Schema: Add support for TemplateLiteral parameters in TemplateLiteral, closes #​4166.

    This update also adds support for TemplateLiteral and TemplateLiteralParser parameters in TemplateLiteralParser.

    Before

    import { Schema } from "effect"
    
    const schema = Schema.TemplateLiteralParser(
      "<",
      Schema.TemplateLiteralParser("h", Schema.Literal(1, 2)),
      ">"
    )
    /*
    throws:
    Error: Unsupported template literal span
    schema (TemplateLiteral): `h${"1" | "2"}`
    */

    After

    import { Schema } from "effect"
    
    // Schema<readonly ["<", readonly ["h", 2 | 1], ">"], "<h2>" | "<h1>", never>
    const schema = Schema.TemplateLiteralParser(
      "<",
      Schema.TemplateLiteralParser("h", Schema.Literal(1, 2)),
      ">"
    )
    
    console.log(Schema.decodeUnknownSync(schema)("<h1>"))
    // Output: [ '<', [ 'h', 1 ], '>' ]
  • #​4174 1ce703b Thanks @​gcanti! - Schema: Fix bug in TemplateLiteralParser where unions of numeric literals were not coerced correctly.

    Before

    import { Schema } from "effect"
    
    const schema = Schema.TemplateLiteralParser("a", Schema.Literal(1, 2))
    
    console.log(Schema.decodeUnknownSync(schema)("a1"))
    /*
    throws:
    ParseError: (`a${"1" | "2"}` <-> readonly ["a", 1 | 2])
    └─ Type side transformation failure
       └─ readonly ["a", 1 | 2]
          └─ [1]
             └─ 1 | 2
                ├─ Expected 1, actual "1"
                └─ Expected 2, actual "1"
    */

    After

    import { Schema } from "effect"
    
    const schema = Schema.TemplateLiteralParser("a", Schema.Literal(1, 2))
    
    console.log(Schema.decodeUnknownSync(schema)("a1"))
    // Output: [ 'a', 1 ]
    
    console.log(Schema.decodeUnknownSync(schema)("a2"))
    // Output: [ 'a', 2 ]
    
    console.log(Schema.decodeUnknownSync(schema)("a3"))
    /*
    throws:
    ParseError: (`a${"1" | "2"}` <-> readonly ["a", 1 | 2])
    └─ Encoded side transformation failure
       └─ Expected `a${"1" | "2"}`, actual "a3"
    */

v3.11.8

Compare Source

Patch Changes

v3.11.7

Compare Source

Patch Changes
  • #​4137 2408616 Thanks @​gcanti! - Arbitrary: fix bug where refinements in declarations raised an incorrect missing annotation error, closes #​4136

  • #​4138 cec0b4d Thanks @​gcanti! - JSONSchema: ignore never members in unions.

    Before

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Union(Schema.String, Schema.Never)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$id": "/schemas/never",
          "not": {},
          "title": "never"
        }
      ]
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Union(Schema.String, Schema.Never)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string"
    }
    */
  • #​4138 cec0b4d Thanks @​gcanti! - JSONSchema: handle the nullable keyword for OpenAPI target, closes #​4075.

    Before

    import { OpenApiJsonSchema } from "@&#8203;effect/platform"
    import { Schema } from "effect"
    
    const schema = Schema.NullOr(Schema.String)
    
    console.log(JSON.stringify(OpenApiJsonSchema.make(schema), null, 2))
    /*
    {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "enum": [
            null
          ]
        }
      ]
    }
    */

    After

    import { OpenApiJsonSchema } from "@&#8203;effect/platform"
    import { Schema } from "effect"
    
    const schema = Schema.NullOr(Schema.String)
    
    console.log(JSON.stringify(OpenApiJsonSchema.make(schema), null, 2))
    /*
    {
      "type": "string",
      "nullable": true
    }
    */
  • #​4128 8d978c5 Thanks @​gcanti! - JSONSchema: add type for homogeneous enum schemas, closes #​4127

    Before

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Literal("a", "b")
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "enum": [
        "a",
        "b"
      ]
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Literal("a", "b")
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "enum": [
        "a",
        "b"
      ]
    }
    */
  • #​4138 cec0b4d Thanks @​gcanti! - JSONSchema: use { "type": "null" } to represent the null literal

    Before

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.NullOr(Schema.String)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "enum": [
            null
          ]
        }
      ]
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.NullOr(Schema.String)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
    */
  • #​4138 cec0b4d Thanks @​gcanti! - JSONSchema: handle empty native enums.

    Before

    import { JSONSchema, Schema } from "effect"
    
    enum Empty {}
    
    const schema = Schema.Enums(Empty)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "$comment": "/schemas/enums",
      "anyOf": [] // <= invalid schema!
    }
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    enum Empty {}
    
    const schema = Schema.Enums(Empty)
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "$id": "/schemas/never",
      "not": {}
    }
    */

v3.11.6

Compare Source

Patch Changes
  • #​4118 662d1ce Thanks @​gcanti! - Allow the transformation created by the Class API to be annotated on all its components: the type side, the transformation itself, and the encoded side.

    Example

    import { Schema, SchemaAST } from "effect"
    
    class A extends Schema.Class<A>("A")(
      {
        a: Schema.NonEmptyString
      },
      [
        { identifier: "TypeID" }, // annotations for the type side
        { identifier: "TransformationID" }, // annotations for the the transformation itself
        { identifier: "EncodedID" } // annotations for the the encoded side
      ]
    ) {}
    
    console.log(SchemaAST.getIdentifierAnnotation(A.ast.to)) // Some("TypeID")
    console.log(SchemaAST.getIdentifierAnnotation(A.ast)) // Some("TransformationID")
    console.log(SchemaAST.getIdentifierAnnotation(A.ast.from)) // Some("EncodedID")
    
    A.make({ a: "" })
    /*
    ParseError: TypeID
    └─ ["a"]
       └─ NonEmptyString
          └─ Predicate refinement failure
             └─ Expected NonEmptyString, actual ""
    */
    
    Schema.encodeSync(A)({ a: "" })
    /*
    ParseError: TransformationID
    └─ Type side transformation failure
       └─ TypeID
          └─ ["a"]
             └─ NonEmptyString
                └─ Predicate refinement failure
                   └─ Expected NonEmptyString, actual ""
    */
  • #​4126 31c62d8 Thanks @​gcanti! - Rewrite the Arbitrary compiler from scratch, closes #​2312


Configuration

📅 Schedule: Branch creation - "* 0-3 * * 1" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

changeset-bot bot commented Dec 13, 2024

⚠️ No Changeset found

Latest commit: 0ae60bc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@renovate renovate bot force-pushed the renovate/effect-packages branch from 18e25fe to cf95c0a Compare December 13, 2024 15:02
@renovate renovate bot changed the title chore(deps): update dependency effect to v3.11.6 chore(deps): update dependency effect to v3.11.7 Dec 13, 2024
@renovate renovate bot force-pushed the renovate/effect-packages branch from cf95c0a to 85e16db Compare December 13, 2024 20:14
@renovate renovate bot changed the title chore(deps): update dependency effect to v3.11.7 chore(deps): update dependency effect to v3.11.8 Dec 17, 2024
@renovate renovate bot force-pushed the renovate/effect-packages branch 2 times, most recently from 96317d9 to 7b1b5a5 Compare December 19, 2024 20:48
@renovate renovate bot changed the title chore(deps): update dependency effect to v3.11.8 chore(deps): update dependency effect to v3.11.9 Dec 19, 2024
@renovate renovate bot force-pushed the renovate/effect-packages branch from 7b1b5a5 to 0ae60bc Compare December 22, 2024 22:40
@renovate renovate bot changed the title chore(deps): update dependency effect to v3.11.9 chore(deps): update dependency effect to v3.11.10 Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants