Skip to content

Commit

Permalink
chore(deps): update dependency effect to v3.11.3 (#126)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [effect](https://redirect.github.com/Effect-TS/effect)
([source](https://redirect.github.com/Effect-TS/effect/tree/HEAD/packages/effect))
| [`3.10.15` ->
`3.11.3`](https://renovatebot.com/diffs/npm/effect/3.10.15/3.11.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/effect/3.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/effect/3.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/effect/3.10.15/3.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/effect/3.10.15/3.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Effect-TS/effect (effect)</summary>

###
[`v3.11.3`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#3113)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.11.3)

##### Patch Changes

- [#&#8203;4080](https://redirect.github.com/Effect-TS/effect/pull/4080)
[`90906f7`](https://redirect.github.com/Effect-TS/effect/commit/90906f7f154b12c7182e8f39e3c55ef3937db857)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Fix the
`Schema.TemplateLiteral` output type when the arguments include a
branded type.

    Before

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteral(
      "a ",
      Schema.String.pipe(Schema.brand("MyBrand"))
    )

// type Type = `a ${Schema.brand<typeof Schema.String, "MyBrand"> &
string}`
    // | `a ${Schema.brand<typeof Schema.String, "MyBrand"> & number}`
    // | `a ${Schema.brand<typeof Schema.String, "MyBrand"> & bigint}`
    // | `a ${Schema.brand<...> & false}`
    // | `a ${Schema.brand<...> & true}`
    type Type = typeof schema.Type
    ```

    After

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteral(
      "a ",
      Schema.String.pipe(Schema.brand("MyBrand"))
    )

    // type Type = `a ${string & Brand<"MyBrand">}`
    type Type = typeof schema.Type
    ```

- [#&#8203;4076](https://redirect.github.com/Effect-TS/effect/pull/4076)
[`3862cd3`](https://redirect.github.com/Effect-TS/effect/commit/3862cd3c7f6a542ed65fb81255b3bd696ce2f567)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Schema:
fix bug in `Schema.TemplateLiteralParser` resulting in a runtime error.

    Before

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteralParser("a", "b")
// throws TypeError: Cannot read properties of undefined (reading
'replace')
    ```

    After

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteralParser("a", "b")

    console.log(Schema.decodeUnknownSync(schema)("ab"))
    // Output: [ 'a', 'b' ]
    ```

- [#&#8203;4076](https://redirect.github.com/Effect-TS/effect/pull/4076)
[`3862cd3`](https://redirect.github.com/Effect-TS/effect/commit/3862cd3c7f6a542ed65fb81255b3bd696ce2f567)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! -
SchemaAST: fix `TemplateLiteral` model.

    Added `Literal` and `Union` as valid types.

- [#&#8203;4083](https://redirect.github.com/Effect-TS/effect/pull/4083)
[`343b6aa`](https://redirect.github.com/Effect-TS/effect/commit/343b6aa6ac4a74276bfc7c63ccbf4a1d72bc1bed)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Preserve
`MissingMessageAnnotation`s on property signature declarations when
another field is a property signature transformation.

    Before

    ```ts
    import { Console, Effect, ParseResult, Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.propertySignature(Schema.String).annotations({
        missingMessage: () => "message1"
      }),
      b: Schema.propertySignature(Schema.String)
        .annotations({ missingMessage: () => "message2" })
        .pipe(Schema.fromKey("c")), // <= transformation
      d: Schema.propertySignature(Schema.String).annotations({
        missingMessage: () => "message3"
      })
    })

    Effect.runPromiseExit(
      Schema.decodeUnknown(schema, { errors: "all" })({}).pipe(
        Effect.tapError((error) =>
          Console.log(ParseResult.ArrayFormatter.formatErrorSync(error))
        )
      )
    )
    /*
    Output:
    [
{ _tag: 'Missing', path: [ 'a' ], message: 'is missing' }, // <= wrong
      { _tag: 'Missing', path: [ 'c' ], message: 'message2' },
{ _tag: 'Missing', path: [ 'd' ], message: 'is missing' } // <= wrong
    ]
    */
    ```

    After

    ```ts
    import { Console, Effect, ParseResult, Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.propertySignature(Schema.String).annotations({
        missingMessage: () => "message1"
      }),
      b: Schema.propertySignature(Schema.String)
        .annotations({ missingMessage: () => "message2" })
        .pipe(Schema.fromKey("c")), // <= transformation
      d: Schema.propertySignature(Schema.String).annotations({
        missingMessage: () => "message3"
      })
    })

    Effect.runPromiseExit(
      Schema.decodeUnknown(schema, { errors: "all" })({}).pipe(
        Effect.tapError((error) =>
          Console.log(ParseResult.ArrayFormatter.formatErrorSync(error))
        )
      )
    )
    /*
    Output:
    [
      { _tag: 'Missing', path: [ 'a' ], message: 'message1' },
      { _tag: 'Missing', path: [ 'c' ], message: 'message2' },
      { _tag: 'Missing', path: [ 'd' ], message: 'message3' }
    ]
    */
    ```

- [#&#8203;4081](https://redirect.github.com/Effect-TS/effect/pull/4081)
[`afba339`](https://redirect.github.com/Effect-TS/effect/commit/afba339adc11dad56b5a3b7ca94487e58f34d613)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Fix the
behavior of `Schema.TemplateLiteralParser` when the arguments include
literals other than string literals.

    Before

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteralParser(Schema.String, 1)

    console.log(Schema.decodeUnknownSync(schema)("a1"))
    /*
    throws
    ParseError: (`${string}1` <-> readonly [string, 1])
    └─ Type side transformation failure
       └─ readonly [string, 1]
          └─ [1]
             └─ Expected 1, actual "1"
    */
    ```

    After

    ```ts
    import { Schema } from "effect"

    const schema = Schema.TemplateLiteralParser(Schema.String, 1)

    console.log(Schema.decodeUnknownSync(schema)("a1"))
    // Output: [ 'a', 1 ]
    ```

###
[`v3.11.2`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#3112)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.11.2)

##### Patch Changes

- [#&#8203;4063](https://redirect.github.com/Effect-TS/effect/pull/4063)
[`01cee56`](https://redirect.github.com/Effect-TS/effect/commit/01cee560b58d94b24cc20e98083251b73e658b41)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! -
Micro adjustments

    -   rename Fiber to MicroFiber
    -   add Micro.fiberJoin api
    -   adjust output when inspecting Micro data types

###
[`v3.11.1`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#3111)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.11.1)

##### Patch Changes

- [#&#8203;4052](https://redirect.github.com/Effect-TS/effect/pull/4052)
[`dd8a2d8`](https://redirect.github.com/Effect-TS/effect/commit/dd8a2d8e80d33b16719fc69361eaedf0b59d4620)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! -
ensure pool.get is interrupted on shutdown

- [#&#8203;4059](https://redirect.github.com/Effect-TS/effect/pull/4059)
[`a71bfef`](https://redirect.github.com/Effect-TS/effect/commit/a71bfef46f5061bb2502a61a333638a987b62273)
Thanks [@&#8203;IMax153](https://redirect.github.com/IMax153)! - Ensure
that the current time zone context tag type is properly exported

###
[`v3.11.0`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#3110)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.11.0)

##### Minor Changes

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`147434b`](https://redirect.github.com/Effect-TS/effect/commit/147434b03d5e1fd692dd9f126e5ab0910f3b76d3)
Thanks [@&#8203;IMax153](https://redirect.github.com/IMax153)! - Ensure
scopes are preserved by stream / sink / channel operations

**NOTE**: This change does modify the public signature of several
`Stream` / `Sink` / `Channel` methods. Namely, certain run methods that
previously removed a `Scope` from the environment will no longer do so.
This was a bug with the previous implementation of how scopes were
propagated, and is why this change is being made in a minor release.

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`6e69493`](https://redirect.github.com/Effect-TS/effect/commit/6e694930048bbaf98110f35f41566aeb9752d471)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! - add
Context.Reference - a Tag with a default value

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`147434b`](https://redirect.github.com/Effect-TS/effect/commit/147434b03d5e1fd692dd9f126e5ab0910f3b76d3)
Thanks [@&#8203;IMax153](https://redirect.github.com/IMax153)! - Add
`Effect.scopedWith` to run an effect that depends on a `Scope`, and then
closes the `Scope` after the effect has completed

    ```ts
    import { Effect, Scope } from "effect"

    const program: Effect.Effect<void> = Effect.scopedWith((scope) =>
      Effect.acquireRelease(Effect.log("Acquiring..."), () =>
        Effect.log("Releasing...")
      ).pipe(Scope.extend(scope))
    )

    Effect.runPromise(program)
    // Output:
// timestamp=2024-11-26T16:44:54.158Z level=INFO fiber=#&#8203;0
message=Acquiring...
// timestamp=2024-11-26T16:44:54.165Z level=INFO fiber=#&#8203;0
message=Releasing...
    ```

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`d9fe79b`](https://redirect.github.com/Effect-TS/effect/commit/d9fe79bb5a3fe105d8e7a3bc2922a8ad936a5d10)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! -
remove Env, EnvRef & FiberFlags from Micro

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`251d189`](https://redirect.github.com/Effect-TS/effect/commit/251d189420bbba71990574e91098c499065f9a9b)
Thanks
[@&#8203;KhraksMamtsov](https://redirect.github.com/KhraksMamtsov)! -
`Config.url` constructor has been added, which parses a string using
`new URL()`

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`5a259f3`](https://redirect.github.com/Effect-TS/effect/commit/5a259f3711b4369f55d885b568bdb21136155261)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! - use
fiber based runtime for Micro module

    -   Improved performance
    -   Improved interruption model
    -   Consistency with the Effect data type

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`b4ce4ea`](https://redirect.github.com/Effect-TS/effect/commit/b4ce4ea7fd514a7e572f2dcd879c98f334981b0e)
Thanks
[@&#8203;SandroMaglione](https://redirect.github.com/SandroMaglione)! -
New methods `extractAll` and `extractSchema` to `UrlParams` (added
`Schema.BooleanFromString`).

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`15fcc5a`](https://redirect.github.com/Effect-TS/effect/commit/15fcc5a0ea4bbf40ab48fa6a04fdda74f76f4c07)
Thanks [@&#8203;fubhy](https://redirect.github.com/fubhy)! - Integrated
`DateTime` with `Cron` to add timezone support for cron expressions.

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`9bc9a47`](https://redirect.github.com/Effect-TS/effect/commit/9bc9a476800dc645903c888a68bb1d3baa3383c6)
Thanks
[@&#8203;KhraksMamtsov](https://redirect.github.com/KhraksMamtsov)! -
`URL` and `URLFromSelf` schemas have been added

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`aadb8a4`](https://redirect.github.com/Effect-TS/effect/commit/aadb8a48d2cba197c06ec9996505510e48e4e5cb)
Thanks [@&#8203;fubhy](https://redirect.github.com/fubhy)! - Added
`BigDecimal.toExponential` for scientific notation formatting of
`BigDecimal` values.

The implementation of `BigDecimal.format` now uses scientific notation
for values with
at least 16 decimal places or trailing zeroes. Previously, extremely
large or small values
    could cause `OutOfMemory` errors when formatting.

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`1e2747c`](https://redirect.github.com/Effect-TS/effect/commit/1e2747c63a4820d1459cbbc88c71212983bd68bd)
Thanks
[@&#8203;KhraksMamtsov](https://redirect.github.com/KhraksMamtsov)! - -
JSONSchema module

- add `format?: string` optional field to `JsonSchema7String` interface
    -   Schema module
- add custom json schema annotation to `UUID` schema including `format:
"uuid"`
    -   OpenApiJsonSchema module
- add `format?: string` optional field to `String` and ` Numeric `
interfaces

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`e0b9b09`](https://redirect.github.com/Effect-TS/effect/commit/e0b9b09e70c386b2da17d1f0a15b0511861c89e8)
Thanks [@&#8203;mikearnaldi](https://redirect.github.com/mikearnaldi)! -
Implement Effect.fn to define traced functions.

    ```ts
    import { Effect } from "effect"

const logExample = Effect.fn("example")(function* <N extends number>(n:
N) {
      yield* Effect.annotateCurrentSpan("n", n)
      yield* Effect.logInfo(`got: ${n}`)
      yield* Effect.fail(new Error())
    }, Effect.delay("1 second"))


Effect.runFork(logExample(100).pipe(Effect.catchAllCause(Effect.logError)))
    ```

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`c36f3b9`](https://redirect.github.com/Effect-TS/effect/commit/c36f3b95df5ce9d71b66f22f26ce12eda8d3e848)
Thanks
[@&#8203;KhraksMamtsov](https://redirect.github.com/KhraksMamtsov)! -
`Config.redacted` has been made more flexible and can now wrap any other
config. This allows to transform or validate config values before it’s
hidden.

    ```ts
    import { Config } from "effect"

    Effect.gen(function* () {
      // can be any string including empty
      const pass1 = yield* Config.redacted("PASSWORD")
      //    ^? Redacted<string>

      // can't be empty string
const pass2 = yield* Config.redacted(Config.nonEmptyString("PASSWORD"))
      //    ^? Redacted<string>

const pass2 = yield* Config.redacted(Config.number("SECRET_NUMBER"))
      //    ^? Redacted<number>
    })
    ```

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`aadb8a4`](https://redirect.github.com/Effect-TS/effect/commit/aadb8a48d2cba197c06ec9996505510e48e4e5cb)
Thanks [@&#8203;fubhy](https://redirect.github.com/fubhy)! - Added
`BigDecimal.unsafeFromNumber` and `BigDecimal.safeFromNumber`.

Deprecated `BigDecimal.fromNumber` in favour of
`BigDecimal.unsafeFromNumber`.

The current implementation of `BigDecimal.fromNumber` and
`BigDecimal.unsafeFromNumber` now throws
a `RangeError` for numbers that are not finite such as `NaN`,
`+Infinity` or `-Infinity`.

##### Patch Changes

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`5eff3f6`](https://redirect.github.com/Effect-TS/effect/commit/5eff3f6fa3aae7e86948a62cbfd63b8d6c3bdf92)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! - fix
multipart support for bun http server

- [#&#8203;3835](https://redirect.github.com/Effect-TS/effect/pull/3835)
[`9264162`](https://redirect.github.com/Effect-TS/effect/commit/9264162a82783a651776fb7b87604564a63e7070)
Thanks [@&#8203;IMax153](https://redirect.github.com/IMax153)! - inherit
child fibers created by merged streams

###
[`v3.10.19`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#31019)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.10.19)

##### Patch Changes

- [#&#8203;4007](https://redirect.github.com/Effect-TS/effect/pull/4007)
[`944025b`](https://redirect.github.com/Effect-TS/effect/commit/944025bc5ce139f4a85846aa689bf30ec06a8ec1)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Wrap
JSDoc [@&#8203;example](https://redirect.github.com/example) tags with a
TypeScript fence, closes
[#&#8203;4002](https://redirect.github.com/Effect-TS/effect/issues/4002)

- [#&#8203;4013](https://redirect.github.com/Effect-TS/effect/pull/4013)
[`54addee`](https://redirect.github.com/Effect-TS/effect/commit/54addee438a644bf010646c52042c7b89c5fc0a7)
Thanks
[@&#8203;thewilkybarkid](https://redirect.github.com/thewilkybarkid)! -
Remove reference to non-existent function

###
[`v3.10.18`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#31018)

[Compare
Source](https://redirect.github.com/Effect-TS/effect/compare/[email protected]@3.10.18)

##### Patch Changes

- [#&#8203;4004](https://redirect.github.com/Effect-TS/effect/pull/4004)
[`af409cf`](https://redirect.github.com/Effect-TS/effect/commit/af409cf1d2ff973be11cc079ea373eaeedca25de)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! - fix
behavour of Stream.partition to match the types

###
[`v3.10.17`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#31017)

##### Patch Changes

- [#&#8203;3998](https://redirect.github.com/Effect-TS/effect/pull/3998)
[`42c4ce6`](https://redirect.github.com/Effect-TS/effect/commit/42c4ce6f8d8c7d847e97757650a8ad9419a829d7)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! -
ensure fiber observers are cleared after exit to prevent memory leaks

###
[`v3.10.16`](https://redirect.github.com/Effect-TS/effect/blob/HEAD/packages/effect/CHANGELOG.md#31016)

##### Patch Changes

- [#&#8203;3918](https://redirect.github.com/Effect-TS/effect/pull/3918)
[`4dca30c`](https://redirect.github.com/Effect-TS/effect/commit/4dca30cfcdafe4542e236489f71d6f171a5b4e38)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Use a
specific annotation (`AutoTitleAnnotationId`) to add automatic titles
(added by `Struct` and `Class` APIs), instead of `TitleAnnotationId`, to
avoid interfering with user-defined titles.

- [#&#8203;3981](https://redirect.github.com/Effect-TS/effect/pull/3981)
[`1d99867`](https://redirect.github.com/Effect-TS/effect/commit/1d998671be3cd11043f232822e91dd8c98fccfa9)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Stable
filters such as `minItems`, `maxItems`, and `itemsCount` should be
applied only if the from part fails with a `Composite` issue, closes
[#&#8203;3980](https://redirect.github.com/Effect-TS/effect/issues/3980)

    Before

    ```ts
    import { Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.Array(Schema.String).pipe(Schema.minItems(1))
    })

    Schema.decodeUnknownSync(schema)({}, { errors: "all" })
// throws: TypeError: Cannot read properties of undefined (reading
'length')
    ```

    After

    ```ts
    import { Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.Array(Schema.String).pipe(Schema.minItems(1))
    })

    Schema.decodeUnknownSync(schema)({}, { errors: "all" })
    /*
    throws:
    ParseError: { readonly a: an array of at least 1 items }
    └─ ["a"]
       └─ is missing
    */
    ```

- [#&#8203;3972](https://redirect.github.com/Effect-TS/effect/pull/3972)
[`6dae414`](https://redirect.github.com/Effect-TS/effect/commit/6dae4147991a97ec14a99289bd25fadae7541e8d)
Thanks [@&#8203;tim-smart](https://redirect.github.com/tim-smart)! - add
support for 0 capacity to Mailbox

- [#&#8203;3959](https://redirect.github.com/Effect-TS/effect/pull/3959)
[`6b0d737`](https://redirect.github.com/Effect-TS/effect/commit/6b0d737078bf63b97891e6bc47affc04b28f9cf7)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Remove
`Omit` from the `Class` interface definition to align type signatures
with runtime behavior. This fix addresses the issue of being unable to
override base class methods in extended classes without encountering
type errors, closes
[#&#8203;3958](https://redirect.github.com/Effect-TS/effect/issues/3958)

    Before

    ```ts
    import { Schema } from "effect"

    class Base extends Schema.Class<Base>("Base")({
      a: Schema.String
    }) {
      f() {
        console.log("base")
      }
    }

    class Extended extends Base.extend<Extended>("Extended")({}) {
// Class '{ readonly a: string; } & Omit<Base, "a">' defines instance
member property 'f',
// but extended class 'Extended' defines it as instance member
function.ts(2425)
      // @&#8203;ts-expect-error
      override f() {
        console.log("extended")
      }
    }
    ```

    After

    ```ts
    import { Schema } from "effect"

    class Base extends Schema.Class<Base>("Base")({
      a: Schema.String
    }) {
      f() {
        console.log("base")
      }
    }

    class Extended extends Base.extend<Extended>("Extended")({}) {
      // ok
      override f() {
        console.log("extended")
      }
    }
    ```

- [#&#8203;3971](https://redirect.github.com/Effect-TS/effect/pull/3971)
[`d8356aa`](https://redirect.github.com/Effect-TS/effect/commit/d8356aad428a0c2290db52380220f81d9ec94232)
Thanks [@&#8203;gcanti](https://redirect.github.com/gcanti)! - Refactor
JSON Schema Generation to Include Transformation Annotations, closes
[#&#8203;3016](https://redirect.github.com/Effect-TS/effect/issues/3016)

When generating a JSON Schema, treat `TypeLiteralTransformations` (such
as when `Schema.optionalWith` is used) as a special case. Annotations
from the transformation itself will now be applied, unless there are
user-defined annotations on the form side. This change ensures that the
user's intended annotations are properly included in the schema.

    **Before**

Annotations set on the transformation are ignored. However while using
`Schema.optionalWith` internally generates a transformation schema, this
is considered a technical detail. The user's intention is to add
annotations to the "struct" schema, not to the transformation.

    ```ts
    import { JSONSchema, Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.optionalWith(Schema.String, { default: () => "" })
    }).annotations({
      identifier: "MyID",
      description: "My description",
      title: "My title"
    })

    console.log(JSONSchema.make(schema))
    /*
    Output:
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      type: 'object',
      required: [],
      properties: { a: { type: 'string' } },
      additionalProperties: false
    }
    */
    ```

    **After**

Annotations set on the transformation are now considered during JSON
Schema generation:

    ```ts
    import { JSONSchema, Schema } from "effect"

    const schema = Schema.Struct({
      a: Schema.optionalWith(Schema.String, { default: () => "" })
    }).annotations({
      identifier: "MyID",
      description: "My description",
      title: "My title"
    })

    console.log(JSONSchema.make(schema))
    /*
    Output:
    {
      '$schema': 'http://json-schema.org/draft-07/schema#',
      '$ref': '#/$defs/MyID',
      '$defs': {
        MyID: {
          type: 'object',
          required: [],
          properties: [Object],
          additionalProperties: false,
          description: 'My description',
          title: 'My title'
        }
      }
    }
    */
    ```

</details>

---

### 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.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/suddenlyGiovanni/resume).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuNDIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
renovate[bot] authored Dec 8, 2024
1 parent a9900c3 commit 2be109b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-books-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@suddenlygiovanni/resume": minor
---

chore(package): bump `effect` dependency to 3.11.3
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"license": "UNLICENSED",
"peerDependencieqs": {
"effect": "~3.10.15"
"effect": "~3.11.3"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Expand All @@ -50,7 +50,7 @@
"@types/node": "22.10.1",
"@vitest/coverage-v8": "2.1.8",
"@vitest/ui": "2.1.8",
"effect": "3.10.15",
"effect": "3.11.3",
"typescript": "5.7.2",
"vite-tsconfig-paths": "5.1.4",
"vitest": "2.1.8"
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2be109b

Please sign in to comment.