Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

update effect #373

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/tasty-shoes-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@effect/platform-browser": minor
"@effect/platform-node": minor
"@effect/platform-bun": minor
"@effect/platform": minor
---

update effect
6 changes: 3 additions & 3 deletions packages/platform-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 3 additions & 3 deletions packages/platform-bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 1 addition & 5 deletions packages/platform-bun/src/internal/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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()))
)
))

Expand Down
6 changes: 3 additions & 3 deletions packages/platform-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 1 addition & 5 deletions packages/platform-node/src/internal/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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<Worker.BackingWorker.Message<O>>())
Expand Down
3 changes: 2 additions & 1 deletion packages/platform-node/test/Http/NodeClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-node/test/HttpServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ describe("HttpServer", () => {
Http.router.get(
"/",
Effect.flatMap(
Effect.flatten(Effect.currentSpan),
Effect.currentSpan,
(_) => Http.response.json({ spanId: _.spanId, parent: _.parent })
)
),
Expand Down
8 changes: 4 additions & 4 deletions packages/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"path-browserify": "^1.0.1"
},
"peerDependencies": {
"@effect/schema": "^0.55.0",
"effect": "2.0.0-next.61"
"@effect/schema": "^0.56.0",
"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"
}
}
26 changes: 11 additions & 15 deletions packages/platform/src/internal/http/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -53,20 +52,17 @@ export const make = <R, E, A, R2, E2>(
}

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 = (
Expand Down
44 changes: 22 additions & 22 deletions pnpm-lock.yaml

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