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

Version Packages #2135

Merged
merged 1 commit into from
Feb 15, 2024
Merged

Version Packages #2135

merged 1 commit into from
Feb 15, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 14, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@effect/[email protected]

Patch Changes

[email protected]

Patch Changes

  • #2145 b1163b2 Thanks @tim-smart! - add RequestResolver.aroundRequests api

    This can be used to run side effects that introspect the requests being
    executed.

    Example:

    import { Effect, Request, RequestResolver } from "effect";
    
    interface GetUserById extends Request.Request<unknown> {
      readonly id: number;
    }
    
    declare const resolver: RequestResolver.RequestResolver<GetUserById>;
    
    RequestResolver.aroundRequests(
      resolver,
      (requests) => Effect.log(`got ${requests.length} requests`),
      (requests, _) => Effect.log(`finised running ${requests.length} requests`),
    );
  • #2148 b46b869 Thanks @riordanpawley! - Flipped scheduleForked types to match new <A, E, R> signature

  • #2139 de1b226 Thanks @mikearnaldi! - Introduce FiberId.Single, make FiberId.None behave like FiberId.Runtime, relax FiberRefs to use Single instead of Runtime.

    This change is a precursor to enable easier APIs to modify the Runtime when patching FiberRefs.

  • #2137 a663390 Thanks @mikearnaldi! - Expose Random Tag and functions to use a specific random service implementation

  • #2143 ff88f80 Thanks @mikearnaldi! - Fix Cause.pretty when toString is invalid

    import { Cause } from "effect";
    
    console.log(Cause.pretty(Cause.fail([{ toString: "" }])));

    The code above used to throw now it prints:

    Error: [{"toString":""}]
  • #2080 11be07b Thanks @KhraksMamtsov! - Add functional analogue of satisfies operator.
    This is a convenient operator to use in the pipe chain to localize type errors closer to their source.

    import { satisfies } from "effect/Function";
    
    const test1 = satisfies<number>()(5 as const);
    // ^? const test: 5
    
    // @ts-expect-error
    const test2 = satisfies<string>()(5);
    // ^? Argument of type 'number' is not assignable to parameter of type 'string'
  • #2147 c568645 Thanks @tim-smart! - generate a random span id for the built-in tracer

    This ensures the same span id isn't used between application runs.

  • #2144 88835e5 Thanks @mikearnaldi! - Fix withRandom and withClock types

  • #2138 b415577 Thanks @mikearnaldi! - Fix internals of TestAnnotationsMap making it respect equality

  • #2149 ff8046f Thanks @tim-smart! - add Runtime.updateFiberRefs/setFiberRef/deleteFiberRef

    This change allows you to update fiber ref values inside a Runtime object.

    Example:

    import { Effect, FiberRef, Runtime } from "effect";
    
    const ref = FiberRef.unsafeMake(0);
    
    const updatedRuntime = Runtime.defaultRuntime.pipe(
      Runtime.setFiberRef(ref, 1),
    );
    
    // returns 1
    const result = Runtime.runSync(updatedRuntime)(FiberRef.get(ref));

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

@effect/[email protected]

Patch Changes

  • #2141 dbff62c Thanks @gcanti! - add { exact: true } optional argument to the partial API, mirroring the implementation in the optional API, closes From Discord: Exploring the possibility of making partial behave like optional with exactness #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/[email protected]

Patch Changes

@tim-smart tim-smart merged commit 1b7b2a9 into main Feb 15, 2024
@tim-smart tim-smart deleted the changeset-release/main branch February 15, 2024 00:16
patroza pushed a commit to patroza/effect that referenced this pull request Feb 15, 2024
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

From Discord: Exploring the possibility of making partial behave like optional with exactness
1 participant