diff --git a/.changeset/tasty-shoes-move.md b/.changeset/tasty-shoes-move.md new file mode 100644 index 00000000..dd4c0c17 --- /dev/null +++ b/.changeset/tasty-shoes-move.md @@ -0,0 +1,8 @@ +--- +"@effect/platform-browser": minor +"@effect/platform-node": minor +"@effect/platform-bun": minor +"@effect/platform": minor +--- + +update effect diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json index 0bbd8cae..73ce695c 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -32,12 +32,12 @@ }, "peerDependencies": { "@effect/platform": "workspace:^", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" }, "devDependencies": { "@effect/platform": "workspace:^", - "@effect/schema": "^0.55.0", - "effect": "2.0.0-next.61", + "@effect/schema": "^0.56.0", + "effect": "2.0.0-next.62", "happy-dom": "^12.10.3" } } diff --git a/packages/platform-bun/package.json b/packages/platform-bun/package.json index df1786a6..359a6072 100644 --- a/packages/platform-bun/package.json +++ b/packages/platform-bun/package.json @@ -33,13 +33,13 @@ "peerDependencies": { "@effect/platform": "workspace:^", "@effect/platform-node": "workspace:^", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" }, "devDependencies": { "@effect/platform": "workspace:^", "@effect/platform-node": "workspace:^", - "@effect/schema": "^0.55.0", + "@effect/schema": "^0.56.0", "bun-types": "^1.0.18", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" } } diff --git a/packages/platform-bun/src/internal/worker.ts b/packages/platform-bun/src/internal/worker.ts index c3c2abc0..247cfe4b 100644 --- a/packages/platform-bun/src/internal/worker.ts +++ b/packages/platform-bun/src/internal/worker.ts @@ -3,7 +3,6 @@ import { WorkerError } from "@effect/platform/WorkerError" import * as Effect from "effect/Effect" import { pipe } from "effect/Function" import * as Layer from "effect/Layer" -import * as Option from "effect/Option" import * as Queue from "effect/Queue" const platformWorkerImpl = Worker.PlatformWorker.of({ @@ -21,10 +20,7 @@ const platformWorkerImpl = Worker.PlatformWorker.of({ // TODO: make configurable // sometimes bun doesn't fire the close event Effect.timeout(1000), - Effect.tap(Option.match({ - onNone: () => Effect.sync(() => port.terminate()), - onSome: (_) => Effect.unit - })) + Effect.orElse(() => Effect.sync(() => port.terminate())) ) )) diff --git a/packages/platform-node/package.json b/packages/platform-node/package.json index 0b590cbe..4963fd9e 100644 --- a/packages/platform-node/package.json +++ b/packages/platform-node/package.json @@ -39,15 +39,15 @@ }, "peerDependencies": { "@effect/platform": "workspace:^", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" }, "devDependencies": { "@effect/platform": "workspace:^", - "@effect/schema": "^0.55.0", + "@effect/schema": "^0.56.0", "@types/mime": "^3.0.4", "@types/node": "^20.10.5", "@types/tar": "^6.1.10", - "effect": "2.0.0-next.61", + "effect": "2.0.0-next.62", "tar": "^6.2.0" } } diff --git a/packages/platform-node/src/internal/worker.ts b/packages/platform-node/src/internal/worker.ts index d97741d5..327007f0 100644 --- a/packages/platform-node/src/internal/worker.ts +++ b/packages/platform-node/src/internal/worker.ts @@ -3,7 +3,6 @@ import { WorkerError } from "@effect/platform/WorkerError" import * as Effect from "effect/Effect" import { pipe } from "effect/Function" import * as Layer from "effect/Layer" -import * as Option from "effect/Option" import * as Queue from "effect/Queue" import type * as WorkerThreads from "node:worker_threads" @@ -21,10 +20,7 @@ const platformWorkerImpl = Worker.PlatformWorker.of({ worker.postMessage([1]) }), Effect.timeout(5000), - Effect.tap(Option.match({ - onNone: () => Effect.promise(() => worker.terminate()), - onSome: (_) => Effect.unit - })) + Effect.orElse(() => Effect.sync(() => worker.terminate())) ) )) const queue = yield* _(Queue.unbounded>()) diff --git a/packages/platform-node/test/Http/NodeClient.test.ts b/packages/platform-node/test/Http/NodeClient.test.ts index c03f0c39..3f8cab63 100644 --- a/packages/platform-node/test/Http/NodeClient.test.ts +++ b/packages/platform-node/test/Http/NodeClient.test.ts @@ -100,7 +100,8 @@ describe("HttpClient", () => { Http.request.get("https://www.google.com/"), client, Effect.flatMap((_) => _.text), - Effect.timeout(1) + Effect.timeout(1), + Effect.optionFromOptional ) expect(response._tag).toEqual("None") }).pipe(Effect.provide(NodeClient.layer), Effect.runPromise)) diff --git a/packages/platform-node/test/HttpServer.test.ts b/packages/platform-node/test/HttpServer.test.ts index d6b1dcd9..26bdae27 100644 --- a/packages/platform-node/test/HttpServer.test.ts +++ b/packages/platform-node/test/HttpServer.test.ts @@ -441,7 +441,7 @@ describe("HttpServer", () => { Http.router.get( "/", Effect.flatMap( - Effect.flatten(Effect.currentSpan), + Effect.currentSpan, (_) => Http.response.json({ spanId: _.spanId, parent: _.parent }) ) ), diff --git a/packages/platform/package.json b/packages/platform/package.json index 7d032139..b5d4eb78 100644 --- a/packages/platform/package.json +++ b/packages/platform/package.json @@ -36,11 +36,11 @@ }, "peerDependencies": { "@effect/schema": "^0.55.0", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" }, "devDependencies": { - "@effect/schema": "^0.55.0", + "@effect/schema": "^0.56.0", "@types/path-browserify": "^1.0.2", - "effect": "2.0.0-next.61" + "effect": "2.0.0-next.62" } } diff --git a/packages/platform/src/internal/http/client.ts b/packages/platform/src/internal/http/client.ts index 3ce6d83a..8547ce05 100644 --- a/packages/platform/src/internal/http/client.ts +++ b/packages/platform/src/internal/http/client.ts @@ -4,7 +4,6 @@ import * as Context from "effect/Context" import * as Effect from "effect/Effect" import { dual } from "effect/Function" import * as Layer from "effect/Layer" -import * as Option from "effect/Option" import { pipeArguments } from "effect/Pipeable" import type * as Predicate from "effect/Predicate" import type * as Schedule from "effect/Schedule" @@ -53,20 +52,17 @@ export const make = ( } const addB3Headers = (req: ClientRequest.ClientRequest) => - Effect.map( - Effect.currentSpan, - Option.match({ - onNone: () => req, - onSome: (span) => - internalRequest.setHeader( - req, - "b3", - `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${ - span.parent._tag === "Some" ? `-${span.parent.value.spanId}` : "" - }` - ) - }) - ) + Effect.match(Effect.currentSpan, { + onFailure: () => req, + onSuccess: (span) => + internalRequest.setHeader( + req, + "b3", + `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${ + span.parent._tag === "Some" ? `-${span.parent.value.spanId}` : "" + }` + ) + }) /** @internal */ export const makeDefault = ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0eb721df..083d5e87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,14 +114,14 @@ importers: version: 1.0.1 devDependencies: '@effect/schema': - specifier: ^0.55.0 - version: 0.55.0(effect@2.0.0-next.61)(fast-check@3.15.0) + specifier: ^0.56.0 + version: 0.56.0(effect@2.0.0-next.62)(fast-check@3.15.0) '@types/path-browserify': specifier: ^1.0.2 version: 1.0.2 effect: - specifier: 2.0.0-next.61 - version: 2.0.0-next.61 + specifier: 2.0.0-next.62 + version: 2.0.0-next.62 publishDirectory: dist packages/platform-browser: @@ -130,11 +130,11 @@ importers: specifier: workspace:^ version: link:../platform/dist '@effect/schema': - specifier: ^0.55.0 - version: 0.55.0(effect@2.0.0-next.61)(fast-check@3.15.0) + specifier: ^0.56.0 + version: 0.56.0(effect@2.0.0-next.62)(fast-check@3.15.0) effect: - specifier: 2.0.0-next.61 - version: 2.0.0-next.61 + specifier: 2.0.0-next.62 + version: 2.0.0-next.62 happy-dom: specifier: ^12.10.3 version: 12.10.3 @@ -149,14 +149,14 @@ importers: specifier: workspace:^ version: link:../platform-node/dist '@effect/schema': - specifier: ^0.55.0 - version: 0.55.0(effect@2.0.0-next.61)(fast-check@3.15.0) + specifier: ^0.56.0 + version: 0.56.0(effect@2.0.0-next.62)(fast-check@3.15.0) bun-types: specifier: ^1.0.18 version: 1.0.18 effect: - specifier: 2.0.0-next.61 - version: 2.0.0-next.61 + specifier: 2.0.0-next.62 + version: 2.0.0-next.62 publishDirectory: dist packages/platform-node: @@ -172,8 +172,8 @@ importers: specifier: workspace:^ version: link:../platform/dist '@effect/schema': - specifier: ^0.55.0 - version: 0.55.0(effect@2.0.0-next.61)(fast-check@3.15.0) + specifier: ^0.56.0 + version: 0.56.0(effect@2.0.0-next.62)(fast-check@3.15.0) '@types/mime': specifier: ^3.0.4 version: 3.0.4 @@ -184,8 +184,8 @@ importers: specifier: ^6.1.10 version: 6.1.10 effect: - specifier: 2.0.0-next.61 - version: 2.0.0-next.61 + specifier: 2.0.0-next.62 + version: 2.0.0-next.62 tar: specifier: ^6.2.0 version: 6.2.0 @@ -774,13 +774,13 @@ packages: resolution: {integrity: sha512-BnlM8LlaqCAYgdRfxlbR7gXGh/FD1scL1fPgNVJEPoOM08od1jtJz+iKhwfaud8TPnnhZR+TED2h5ynjanLeCQ==} dev: true - /@effect/schema@0.55.0(effect@2.0.0-next.61)(fast-check@3.15.0): - resolution: {integrity: sha512-CWP/EMrdnwwS1t1dfAo1Z0uBFzSNiUbloRoHZBdtuTVFf03RDUk5yccm8EZilbEnAHzL4SQwyoQYD1yN6RA6dQ==} + /@effect/schema@0.56.0(effect@2.0.0-next.62)(fast-check@3.15.0): + resolution: {integrity: sha512-qVR6T9+Lbv2cAhtIAysYvHpRm8iJuMjhp++q0ZMl3ACyQM4v9mvzEg1hQxF0GpAAHS7MTagVDDXN6WCNPEK4oA==} peerDependencies: - effect: 2.0.0-next.61 + effect: 2.0.0-next.62 fast-check: ^3.13.2 dependencies: - effect: 2.0.0-next.61 + effect: 2.0.0-next.62 fast-check: 3.15.0 dev: true @@ -2810,8 +2810,8 @@ packages: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true - /effect@2.0.0-next.61: - resolution: {integrity: sha512-BuRr9SEwYdMVLQunATRjm3MAkTgWI21Tyn5ooWVZnTeXj0lUqSV0fjaqNFksEymssmwJ1ucogbuYQ/3RLmwxgA==} + /effect@2.0.0-next.62: + resolution: {integrity: sha512-fJhLzf5oouL4WZP314ZJgZz5Bel7OHTY+YFxO06sW1mSvqJz0s28y7jDHr5zhtTNM1YRvzbeLYUYfNaJYKqx1A==} dev: true /electron-to-chromium@1.4.611: