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 effect packages #109

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

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Sep 9, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@effect/schema (source) ~0.72.2 -> ~0.72.2 || ~0.75.0 age adoption passing confidence
@effect/schema (source) 0.72.2 -> 0.75.5 age adoption passing confidence
effect (source) 3.7.2 -> 3.9.2 age adoption passing confidence

Release Notes

Effect-TS/effect (@​effect/schema)

v0.75.5

Compare Source

Patch Changes
  • #​3792 382556f Thanks @​gcanti! - resolve parse error when using pick with union of class schemas, closes #​3751

  • #​3790 97cb014 Thanks @​gcanti! - Equivalence: Fixed a bug related to discriminated tuples.

    Example:

    The following equivalence check was incorrectly returning false:

    import * as E from "@​effect/schema/Equivalence"
    import * as S from "@​effect/schema/Schema"
    
    // Union of discriminated tuples
    const schema = S.Union(
      S.Tuple(S.Literal("a"), S.String),
      S.Tuple(S.Literal("b"), S.Number)
    )
    
    const equivalence = E.make(schema)
    
    console.log(equivalence(["a", "x"], ["a", "x"]))
    // false

v0.75.4

Compare Source

Patch Changes

v0.75.3

Compare Source

Patch Changes
  • #​3761 360ec14 Thanks @​gcanti! - Allow Schema.Either to support Schema.Never without type errors, closes #​3755.

    • Updated the type parameters of format to extend Schema.All instead of Schema<A, I, R>.
    • Updated the type parameters of Schema.EitherFromSelf to extend Schema.All instead of Schema.Any.
    • Updated the type parameters of Schema.Either to extend Schema.All instead of Schema.Any.
    • Updated the type parameters of Schema.EitherFromUnion to extend Schema.All instead of Schema.Any.

v0.75.2

Compare Source

Patch Changes
  • #​3753 f02b354 Thanks @​gcanti! - Enhanced Error Reporting for Discriminated Union Tuple Schemas, closes #​3752

    Previously, irrelevant error messages were generated for each member of the union. Now, when a discriminator is present in the input, only the relevant member will trigger an error.

    Before

    import * as Schema from "@&#8203;effect/schema/Schema"
    
    const schema = Schema.Union(
      Schema.Tuple(Schema.Literal("a"), Schema.String),
      Schema.Tuple(Schema.Literal("b"), Schema.Number)
    ).annotations({ identifier: "MyUnion" })
    
    console.log(Schema.decodeUnknownSync(schema)(["a", 0]))
    /*
    throws:
    ParseError: MyUnion
    ├─ readonly ["a", string]
    │  └─ [1]
    │     └─ Expected string, actual 0
    └─ readonly ["b", number]
       └─ [0]
          └─ Expected "b", actual "a"
    */

    After

    import * as Schema from "@&#8203;effect/schema/Schema"
    
    const schema = Schema.Union(
      Schema.Tuple(Schema.Literal("a"), Schema.String),
      Schema.Tuple(Schema.Literal("b"), Schema.Number)
    ).annotations({ identifier: "MyUnion" })
    
    console.log(Schema.decodeUnknownSync(schema)(["a", 0]))
    /*
    throws:
    ParseError: MyUnion
    └─ readonly ["a", string]
       └─ [1]
          └─ Expected string, actual 0
    */

v0.75.1

Compare Source

Patch Changes

v0.75.0

Compare Source

Minor Changes
Patch Changes

v0.74.2

Compare Source

Patch Changes

v0.74.1

Compare Source

Patch Changes
  • #​3669 734eae6 Thanks @​gcanti! - Add description annotation to the encoded part of NumberFromString.

    Before

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.NumberFromString
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string"
    }
    */

    After

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.NumberFromString
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a string that will be parsed into a number"
    }
    */
  • #​3667 fd83d0e Thanks @​gcanti! - Remove default json schema annotations from string, number and boolean.

    Before

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.String.annotations({ examples: ["a", "b"] })
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a string",
      "title": "string",
      "examples": [
        "a",
        "b"
      ]
    }
    */

    After

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.String.annotations({ examples: ["a", "b"] })
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "examples": [
        "a",
        "b"
      ]
    }
    */
  • #​3673 ad7e1de Thanks @​gcanti! - Add more description annotations.

  • #​3672 090e41c Thanks @​gcanti! - JSON Schema: handle refinements where the 'from' part includes a transformation, closes #​3662

    Before

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.Date
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    throws
    Error: Missing annotation
    details: Generating a JSON Schema for this schema requires a "jsonSchema" annotation
    schema (Refinement): Date
    */

    After

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.Date
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a string that will be parsed into a Date"
    }
    */
  • #​3672 090e41c Thanks @​gcanti! - Add description annotation to the encoded part of DateFromString.

    Before

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.DateFromString
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string"
    }
    */

    After

    import { JSONSchema, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.DateFromString
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "string",
      "description": "a string that will be parsed into a Date"
    }
    */
  • Updated dependencies [4509656]:

v0.74.0

Compare Source

Minor Changes

v0.73.4

Compare Source

Patch Changes

v0.73.3

Compare Source

Patch Changes
  • #​3635 e6440a7 Thanks @​gcanti! - Stable filters such as minItems, maxItems, and itemsCount now generate multiple errors when the 'errors' option is set to 'all', closes #​3633

    Example:

    import { ArrayFormatter, Schema } from "@&#8203;effect/schema"
    
    const schema = Schema.Struct({
      tags: Schema.Array(Schema.String.pipe(Schema.minLength(2))).pipe(
        Schema.minItems(3)
      )
    })
    
    const invalidData = { tags: ["AB", "B"] }
    
    const either = Schema.decodeUnknownEither(schema, { errors: "all" })(
      invalidData
    )
    if (either._tag === "Left") {
      console.log(ArrayFormatter.formatErrorSync(either.left))
      /*
      Output:
      [
        {
          _tag: 'Type',
          path: [ 'tags', 1 ],
          message: 'Expected a string at least 2 character(s) long, actual "B"'
        },
        {
          _tag: 'Type',
          path: [ 'tags' ],
          message: 'Expected an array of at least 3 items, actual ["AB","B"]'
        }
      ]
      */
    }

    Previously, only the issue related to the [ 'tags', 1 ] path was reported.

v0.73.2

Compare Source

Patch Changes

v0.73.1

Compare Source

Patch Changes

v0.73.0

Compare Source

Minor Changes
  • #​3589 7fdf9d9 Thanks @​gcanti! - Updates the constraints for members within a union from the more restrictive Schema.Any to the more inclusive Schema.All, closes #​3587.

    Affected APIs include:

    • Schema.Union
    • Schema.UndefinedOr
    • Schema.NullOr
    • Schema.NullishOr
    • Schema.optional
    • AST.Union.make now retains duplicate members and no longer eliminates the neverKeyword.
Patch Changes
Effect-TS/effect (effect)

v3.9.2

Compare Source

Patch Changes

v3.9.1

Compare Source

Patch Changes

v3.9.0

Compare Source

Minor Changes
  • #​3620 ff3d1aa Thanks @​vinassefranche! - Adds HashMap.HashMap.Entry type helper

  • #​3620 0ba66f2 Thanks @​tim-smart! - add deno support to Inspectable

  • #​3620 bf77f51 Thanks @​KhraksMamtsov! - Latch implements Effect<void> with .await semantic

  • #​3620 0779681 Thanks @​KhraksMamtsov! - Effect.mapAccum & Array.mapAccum preserve non-emptiness

  • #​3620 534129f Thanks @​KhraksMamtsov! - Pool is now a subtype of Effect, equivalent to Pool.get

  • #​3620 d75140c Thanks @​mikearnaldi! - Support providing an array of layers via Effect.provide and Layer.provide

  • #​3620 be0451c Thanks @​leonitousconforti! - support ManagedRuntime in Effect.provide

  • #​3620 be0451c Thanks @​leonitousconforti! - ManagedRuntime<R, E> is subtype of Effect<Runtime<R>, E, never>

  • #​3620 5b36494 Thanks @​KhraksMamtsov! - Tuple.map transforms each element of tuple using the given function, treating tuple homomorphically

    import { pipe, Tuple } from "effect"
    
    const result = pipe(
      //  ^? [string, string, string]
      ["a", 1, false] as const,
      T.map((el) => {
        //^? "a" | 1 | false
        return el.toString().toUppercase()
      })
    )
    assert.deepStrictEqual(result, ["A", "1", "FALSE"])
  • #​3620 c716adb Thanks @​AlexGeb! - Add Array.pad function

  • #​3620 4986391 Thanks @​ianbollinger! - Add an isRegExp type guard

  • #​3620 d75140c Thanks @​mikearnaldi! - Implement Effect.Service as a Tag and Layer with Opaque Type.

    Namely the following is now possible:

    class Prefix extends Effect.Service<Prefix>()("Prefix", {
      sync: () => ({
        prefix: "PRE"
      })
    }) {}
    
    class Postfix extends Effect.Service<Postfix>()("Postfix", {
      sync: () => ({
        postfix: "POST"
      })
    }) {}
    
    const messages: Array<string> = []
    
    class Logger extends Effect.Service<Logger>()("Logger", {
      accessors: true,
      effect: Effect.gen(function* () {
        const { prefix } = yield* Prefix
        const { postfix } = yield* Postfix
        return {
          info: (message: string) =>
            Effect.sync(() => {
              messages.push(`[${prefix}][${message}][${postfix}]`)
            })
        }
      }),
      dependencies: [Prefix.Default, Postfix.Default]
    }) {}
    
    describe("Effect", () => {
      it.effect("Service correctly wires dependencies", () =>
        Effect.gen(function* () {
          const { _tag } = yield* Logger
          expect(_tag).toEqual("Logger")
          yield* Logger.info("Ok")
          expect(messages).toEqual(["[PRE][Ok][POST]"])
          const { prefix } = yield* Prefix
          expect(prefix).toEqual("PRE")
          const { postfix } = yield* Postfix
          expect(postfix).toEqual("POST")
        }).pipe(Effect.provide([Logger.Default, Prefix.Default, Postfix.Default]))
      )
    })
  • #​3620 d1387ae Thanks @​KhraksMamtsov! - Resource<A, E> is subtype of Effect<A, E>.
    ScopedRed<A> is subtype of Effect<A>.

Patch Changes

v3.8.5

Compare Source

Patch Changes
  • #​3734 88e85db Thanks @​mikearnaldi! - Ensure random numbers are correctly distributed

  • #​3717 83887ca Thanks @​mikearnaldi! - Consider async operation in runSync as a defect, add span based stack

  • #​3731 5266b6c Thanks @​patroza! - Improve DX of type errors from inside pipe and flow

  • #​3699 cdead5c Thanks @​jessekelly881! - added Stream.mergeWithTag

    Combines a struct of streams into a single stream of tagged values where the tag is the key of the struct.

    import { Stream } from "effect"
    
    // Stream.Stream<{ _tag: "a"; value: number; } | { _tag: "b"; value: string; }>
    const stream = Stream.mergeWithTag(
      {
        a: Stream.make(0),
        b: Stream.make("")
      },
      { concurrency: 1 }
    )
  • #​3706 766a8af Thanks @​fubhy! - Made BigDecimal.scale dual.

v3.8.4

Compare Source

Patch Changes

v3.8.3

Compare Source

Patch Changes

v3.8.2

Compare Source

Patch Changes

v3.8.1

Compare Source

Patch Changes

v3.8.0

Compare Source

Minor Changes
  • #​3541 fcfa6ee Thanks @​Schniz! - add Logger.withLeveledConsole

    In browsers and different platforms, console.error renders differently than console.info. This helps to distinguish between different levels of logging. Logger.withLeveledConsole takes any logger and calls the respective Console method based on the log level. For instance, Effect.logError will call Console.error and Effect.logInfo will call Console.info.

    To use it, you can replace the default logger with a Logger.withLeveledConsole logger:

    import { Logger, Effect } from "effect"
    
    const loggerLayer = Logger.withLeveledConsole(Logger.stringLogger)
    
    Effect.gen(function* () {
      yield* Effect.logError("an error")
      yield* Effect.logInfo("an info")
    }).pipe(Effect.provide(loggerLayer))
  • #​3541 bb9931b Thanks @​KhraksMamtsov! - Made Ref, SynchronizedRed and SubscriptionRef a subtype of Effect

  • #​3541 5798f76 Thanks @​tim-smart! - add Semaphore.withPermitsIfAvailable

    You can now use Semaphore.withPermitsIfAvailable to run an Effect only if the
    Semaphore has enough permits available. This is useful when you want to run an
    Effect only if you can acquire a permit without blocking.

    It will return an Option.Some with the result of the Effect if the permits were
    available, or None if they were not.

    import { Effect } from "effect"
    
    Effect.gen(function* () {
      const semaphore = yield* Effect.makeSemaphore(1)
      semaphore.withPermitsIfAvailable(1)(Effect.void)
    })
  • #​3541 5f0bfa1 Thanks @​KhraksMamtsov! - The Deferred<A> is now a subtype of Effect<A>. This change simplifies handling of deferred values, removing the need for explicit call Deffer.await.

    import { Effect, Deferred } from "effect"
    
    Effect.gen(function* () {
      const deferred = yield* Deferred.make<string>()
    
      const before = yield* Deferred.await(deferred)
      const after = yield* deferred
    })
  • #​3541 812a4e8 Thanks @​tim-smart! - add Logger.prettyLoggerDefault, to prevent duplicate pretty loggers

  • #​3541 273565e Thanks @​tim-smart! - add Effect.makeLatch, for creating a simple async latch

    import { Effect } from "effect"
    
    Effect.gen(function* () {
      // Create a latch, starting in the closed state
      const latch = yield* Effect.makeLatch(false)
    
      // Fork a fiber that logs "open sesame" when the latch is opened
      const fiber = yield* Effect.log("open sesame").pipe(
        latch.whenOpen,
        Effect.fork
      )
    
      // Open the latch
      yield* latch.open
      yield* fiber.await
    })
  • #​3541 569a801 Thanks @​KhraksMamtsov! - Dequeue<A> and Queue<A> is subtype of Effect<A>. This means that now it can be used as an Effect, and when called, it will automatically extract and return an item from the queue, without having to explicitly use the Queue.take function.

    Effect.gen(function* () {
      const queue = yield* Queue.unbounded<number>()
      yield* Queue.offer(queue, 1)
      yield* Queue.offer(queue, 2)
      const oldWay = yield* Queue.take(queue)
      const newWay = yield* queue
    })
  • #​3541 aa1fa53 Thanks @​vinassefranche! - Add Number.round

  • #​3541 02f6b06 Thanks @​fubhy! - Add additional Duration conversion apis

    • Duration.toMinutes
    • Duration.toHours
    • Duration.toDays
    • Duration.toWeeks
  • #​3541 12b893e Thanks @​KhraksMamtsov! - The Fiber<A, E> is now a subtype of Effect<A, E>. This change removes the need for explicit call Fiber.join.

    import { Effect, Fiber } from "effect"
    
    Effect.gen(function*() {
      const fiber = yield* Effect.fork(Effect.succeed(1))
    
      const oldWay = yield* Fiber.join(fiber)
      const now = yield* fiber
    }))
  • #​3541 bbad27e Thanks @​dilame! - add Stream.share api

    The Stream.share api is a ref counted variant of the broadcast apis.

    It allows you to share a stream between multiple consumers, and will close the
    upstream when the last consumer ends.

  • #​3541 adf7d7a Thanks @​tim-smart! - add Mailbox module, a queue which can have done or failure signals

    import { Chunk, Effect, Mailbox } from "effect"
    import * as assert from "node:assert"
    
    Effect.gen(function* () {
      const mailbox = yield* Mailbox.make<number, string>()
    
      // add messages to the mailbox
      yield* mailbox.offer(1)
      yield* mailbox.offer(2)
      yield* mailbox.offerAll([3, 4, 5])
    
      // take messages from the mailbox
      const [messages, done] = yield* mailbox.takeAll
      assert.deepStrictEqual(Chunk.toReadonlyArray(messages), [1, 2, 3, 4, 5])
      assert.strictEqual(done, false)
    
      // signal that the mailbox is done
      yield* mailbox.end
      const [messages2, done2] = yield* mailbox.takeAll
      assert.deepStrictEqual(messages2, Chunk.empty())
      assert.strictEqual(done2, true)
    
      // signal that the mailbox is failed
      yield* mailbox.fail("boom")
    })
  • #​3541 007289a Thanks @​mikearnaldi! - Cache some fiber references in the runtime to optimize reading in hot-paths

  • #​3541 42a8f99 Thanks @​fubhy! - Added RcMap.keys and MutableHashMap.keys.

    These functions allow you to get a list of keys currently stored in the underlying hash map.

    const map = MutableHashMap.make([
      ["a", "a"],
      ["b", "b"],
      ["c", "c"]
    ])
    const keys = MutableHashMap.keys(map) // ["a", "b", "c"]
    Effect.gen(function* () {
      const map = yield* RcMap.make({
        lookup: (key) => Effect.succeed(key)
      })
    
      yield* RcMap.get(map, "a")
      yield* RcMap.get(map, "b")
      yield* RcMap.get(map, "c")
    
      const keys = yield* RcMap.keys(map) // ["a", "b", "c"]
    })
  • #​3541 eebfd29 Thanks @​fubhy! - Add Duration.parts api

    const parts = Duration.parts(Duration.sum("5 minutes", "20 seconds"))
    assert.equal(parts.minutes, 5)
    assert.equal(parts.seconds, 20)
  • #​3541 040703d Thanks @​KhraksMamtsov! - The FiberRef<A> is now a subtype of Effect<A>. This change simplifies handling of deferred values, removing the need for explicit call FiberRef.get.

    import { Effect, FiberRef } from "effect"
    
    Effect.gen(function* () {
      const fiberRef = yield* FiberRef.make("value")
    
      const before = yield* FiberRef.get(fiberRef)
      const after = yield* fiberRef
    })

v3.7.3

Compare Source

Patch Changes

Configuration

📅 Schedule: Branch creation - "before 4am on Monday" (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.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


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

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

@renovate renovate bot added the dependencies label Sep 9, 2024
Copy link

changeset-bot bot commented Sep 9, 2024

⚠️ No Changeset found

Latest commit: 0b06e32

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 changed the title chore(deps): update dependency @effect/schema to v0.72.3 chore(deps): update effect packages Sep 13, 2024
@renovate renovate bot force-pushed the renovate/effect-packages branch 5 times, most recently from afe67a3 to f97d517 Compare September 23, 2024 05:20
@renovate renovate bot force-pushed the renovate/effect-packages branch 8 times, most recently from 829c706 to add4080 Compare October 13, 2024 22:51
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