Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update versions
Browse files Browse the repository at this point in the history
patroza committed Nov 15, 2023
1 parent 7538640 commit d8b8fba
Showing 5 changed files with 44 additions and 16 deletions.
6 changes: 6 additions & 0 deletions packages/infra-adapters/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @effect-app/infra-adapters

## 0.60.3

### Patch Changes

- fix

## 0.60.2

### Patch Changes
43 changes: 29 additions & 14 deletions packages/infra-adapters/_src/express.ts
Original file line number Diff line number Diff line change
@@ -153,24 +153,39 @@ export const makeExpressApp = Effect.gen(function*(_) {
>
return Effect.runtime<Env>().map((r) =>
handlers.map(
(handler): RequestHandler => (req, res, next) => {
(handler, i): RequestHandler => (req, res, next) => {
r.runCallback(
open
.get
.flatMap((open) =>
(req.headers["x-b3-traceid"] || req.headers["b3"]
? (req as any as IncomingMessage<unknown>)
.schemaExternalSpan
.orElseSucceed(() => undefined)
: Effect.succeed(undefined))
.flatMap(
(parent) =>
Effect.withSpan(
open ? handler(req, res, next) : Effect.interrupt,
`http ${req.method}`,
{ attributes: { "http.method": req.method, "http.url": req.url }, parent }
)
)
// only the last handler is the actual request handler
// which we will give a span, so we ignore middlewares atm
// we do this because it's hard to share the span due to the current design
// we will solve it instead by switching to @effect/platform Http Server
(i === handlers.length - 1
? (req.headers["x-b3-traceid"] || req.headers["b3"]
? (req as any as IncomingMessage<unknown>)
.schemaExternalSpan
.orElseSucceed(() => undefined)
: Effect.succeed(undefined))
.flatMap(
(parent) =>
(
open
? handler(req, res, next)
.exit
.flatMap((_) => Effect.annotateCurrentSpan("http.status", res.statusCode) > _)
: Effect.interrupt
)
.withSpan(
`http ${req.method}`,
{ attributes: { "http.method": req.method, "http.url": req.url }, parent }
)
)
: open
? handler(req, res, next)
: Effect
.interrupt)
.onError(exitHandler(req, res, next))
.supervised(supervisor)
)
2 changes: 1 addition & 1 deletion packages/infra-adapters/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect-app/infra-adapters",
"version": "0.60.2",
"version": "0.60.3",
"license": "MIT",
"type": "module",
"dependencies": {
7 changes: 7 additions & 0 deletions packages/infra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @effect-app/infra

## 0.94.3

### Patch Changes

- Updated dependencies
- @effect-app/infra-adapters@0.60.3

## 0.94.2

### Patch Changes
2 changes: 1 addition & 1 deletion packages/infra/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect-app/infra",
"version": "0.94.2",
"version": "0.94.3",
"license": "MIT",
"type": "module",
"dependencies": {

0 comments on commit d8b8fba

Please sign in to comment.