@effect-app/infra 0.133.0-next.50 → 0.133.0-next.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/_cjs/api/http.cjs +42 -0
- package/_cjs/api/http.cjs.map +1 -0
- package/_cjs/api/routing/base.cjs +169 -0
- package/_cjs/api/routing/base.cjs.map +1 -0
- package/_cjs/api/routing/defaultErrorHandler.cjs +50 -0
- package/_cjs/api/routing/defaultErrorHandler.cjs.map +1 -0
- package/_cjs/api/routing/makeRequestHandler.cjs +134 -0
- package/_cjs/api/routing/makeRequestHandler.cjs.map +1 -0
- package/_cjs/api/routing/match.cjs +45 -0
- package/_cjs/api/routing/match.cjs.map +1 -0
- package/_cjs/api/routing.cjs +50 -0
- package/_cjs/api/routing.cjs.map +1 -0
- package/_src/api/http.ts +26 -0
- package/_src/api/routing/base.ts +476 -0
- package/_src/api/routing/defaultErrorHandler.ts +83 -0
- package/_src/api/routing/makeRequestHandler.ts +278 -0
- package/_src/api/routing/match.ts +119 -0
- package/_src/api/routing.ts +11 -0
- package/dist/api/http.d.ts +16 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +12 -0
- package/dist/api/routing/base.d.ts +117 -0
- package/dist/api/routing/base.d.ts.map +1 -0
- package/dist/api/routing/base.js +137 -0
- package/dist/api/routing/defaultErrorHandler.d.ts +16 -0
- package/dist/api/routing/defaultErrorHandler.d.ts.map +1 -0
- package/dist/api/routing/defaultErrorHandler.js +42 -0
- package/dist/api/routing/makeRequestHandler.d.ts +20 -0
- package/dist/api/routing/makeRequestHandler.d.ts.map +1 -0
- package/dist/api/routing/makeRequestHandler.js +121 -0
- package/dist/api/routing/match.d.ts +12 -0
- package/dist/api/routing/match.d.ts.map +1 -0
- package/dist/api/routing/match.js +31 -0
- package/dist/api/routing.d.ts +5 -0
- package/dist/api/routing.d.ts.map +1 -0
- package/dist/api/routing.js +8 -0
- package/dist/services/Repository.d.ts +2 -2
- package/dist/services/Repository.d.ts.map +1 -1
- package/package.json +67 -5
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
+
import type { EnforceNonEmptyRecord } from "@effect-app/core/utils"
|
|
4
|
+
import { pretty } from "@effect-app/core/utils"
|
|
5
|
+
import { snipString } from "@effect-app/infra/api/util"
|
|
6
|
+
import { reportError } from "@effect-app/infra/errorReporter"
|
|
7
|
+
import type { ValidationError } from "@effect-app/infra/errors"
|
|
8
|
+
import type { RequestContextContainer } from "@effect-app/infra/services/RequestContextContainer"
|
|
9
|
+
import type { ContextMapContainer } from "@effect-app/infra/services/Store/ContextMapContainer"
|
|
10
|
+
import type { REST, StructFields } from "@effect-app/schema"
|
|
11
|
+
import { AST } from "@effect-app/schema"
|
|
12
|
+
import type { HttpRequestError } from "../http.js"
|
|
13
|
+
import { HttpBody, HttpRouteContext, HttpServerRequest, HttpServerResponse } from "../http.js"
|
|
14
|
+
import { makeRequestParsers, parseRequestParams } from "./base.js"
|
|
15
|
+
import type { RequestHandler, RequestHandlerBase } from "./base.js"
|
|
16
|
+
|
|
17
|
+
export const RequestSettings = FiberRef.unsafeMake({
|
|
18
|
+
verbose: false
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export type Middleware<
|
|
22
|
+
R,
|
|
23
|
+
M,
|
|
24
|
+
PathA extends StructFields,
|
|
25
|
+
CookieA extends StructFields,
|
|
26
|
+
QueryA extends StructFields,
|
|
27
|
+
BodyA extends StructFields,
|
|
28
|
+
HeaderA extends StructFields,
|
|
29
|
+
ReqA extends PathA & QueryA & BodyA,
|
|
30
|
+
ResA extends StructFields,
|
|
31
|
+
ResE,
|
|
32
|
+
MiddlewareE,
|
|
33
|
+
PPath extends `/${string}`,
|
|
34
|
+
R2,
|
|
35
|
+
PR,
|
|
36
|
+
CTX,
|
|
37
|
+
Context,
|
|
38
|
+
Config
|
|
39
|
+
> = (
|
|
40
|
+
handler: RequestHandler<R, M, PathA, CookieA, QueryA, BodyA, HeaderA, ReqA, ResA, ResE, PPath, CTX, Context, Config>
|
|
41
|
+
) => {
|
|
42
|
+
handler: RequestHandler<
|
|
43
|
+
Exclude<R2, HttpServerRequest> | PR | RequestContextContainer | ContextMapContainer,
|
|
44
|
+
M,
|
|
45
|
+
PathA,
|
|
46
|
+
CookieA,
|
|
47
|
+
QueryA,
|
|
48
|
+
BodyA,
|
|
49
|
+
HeaderA,
|
|
50
|
+
ReqA,
|
|
51
|
+
ResA,
|
|
52
|
+
ResE,
|
|
53
|
+
PPath,
|
|
54
|
+
CTX,
|
|
55
|
+
Context,
|
|
56
|
+
Config
|
|
57
|
+
>
|
|
58
|
+
makeRequestLayer: Layer<R2, MiddlewareE, PR>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function makeRequestHandler<
|
|
62
|
+
R,
|
|
63
|
+
M,
|
|
64
|
+
PathA extends StructFields,
|
|
65
|
+
CookieA extends StructFields,
|
|
66
|
+
QueryA extends StructFields,
|
|
67
|
+
BodyA extends StructFields,
|
|
68
|
+
HeaderA extends StructFields,
|
|
69
|
+
ReqA extends PathA & QueryA & BodyA,
|
|
70
|
+
ResA extends StructFields,
|
|
71
|
+
ResE,
|
|
72
|
+
MiddlewareE,
|
|
73
|
+
R2,
|
|
74
|
+
PR,
|
|
75
|
+
RErr,
|
|
76
|
+
PPath extends `/${string}`,
|
|
77
|
+
Config
|
|
78
|
+
>(
|
|
79
|
+
handler: RequestHandlerBase<
|
|
80
|
+
R,
|
|
81
|
+
M,
|
|
82
|
+
PathA,
|
|
83
|
+
CookieA,
|
|
84
|
+
QueryA,
|
|
85
|
+
BodyA,
|
|
86
|
+
HeaderA,
|
|
87
|
+
ReqA,
|
|
88
|
+
ResA,
|
|
89
|
+
ResE,
|
|
90
|
+
PPath,
|
|
91
|
+
Config
|
|
92
|
+
>,
|
|
93
|
+
errorHandler: <R>(
|
|
94
|
+
req: HttpServerRequest,
|
|
95
|
+
res: HttpServerResponse,
|
|
96
|
+
r2: Effect<R, ValidationError | ResE | MiddlewareE, HttpServerResponse>
|
|
97
|
+
) => Effect<RErr | R, never, HttpServerResponse>,
|
|
98
|
+
middlewareLayer?: Layer<R2, MiddlewareE, PR>
|
|
99
|
+
): Effect<
|
|
100
|
+
| HttpRouteContext
|
|
101
|
+
| HttpServerRequest
|
|
102
|
+
| RequestContextContainer
|
|
103
|
+
| ContextMapContainer
|
|
104
|
+
| RErr
|
|
105
|
+
| Exclude<Exclude<R, EnforceNonEmptyRecord<M>>, PR>
|
|
106
|
+
| R2,
|
|
107
|
+
HttpRequestError,
|
|
108
|
+
HttpServerResponse
|
|
109
|
+
> {
|
|
110
|
+
const { Request, Response, h: handle } = handler
|
|
111
|
+
|
|
112
|
+
const response: REST.ReqRes<any, any> = Response ? Response : Void
|
|
113
|
+
const resp = response as typeof response & { struct?: Schema<any, any> }
|
|
114
|
+
// TODO: consider if the alternative of using the struct schema is perhaps just better.
|
|
115
|
+
const encoder = "struct" in resp && resp.struct
|
|
116
|
+
? resp.struct.encodeSync
|
|
117
|
+
// ? (i: any) => {
|
|
118
|
+
// if (i instanceof (response as any)) return response.encodeSync(i)
|
|
119
|
+
// else return response.encodeSync(new (response as any)(i))
|
|
120
|
+
// }
|
|
121
|
+
: resp.encodeSync
|
|
122
|
+
// const encodeResponse = adaptResponse
|
|
123
|
+
// ? (req: ReqA) => Encoder.for(adaptResponse(req))
|
|
124
|
+
// : () => encoder
|
|
125
|
+
|
|
126
|
+
const requestParsers = makeRequestParsers(Request)
|
|
127
|
+
const parseRequest = parseRequestParams(requestParsers)
|
|
128
|
+
|
|
129
|
+
const getParams = Effect
|
|
130
|
+
.all({
|
|
131
|
+
rcx: HttpRouteContext,
|
|
132
|
+
req: HttpServerRequest.flatMap((req) => req.json.map((body) => ({ body, headers: req.headers })))
|
|
133
|
+
})
|
|
134
|
+
.map((
|
|
135
|
+
{ rcx, req }
|
|
136
|
+
) => ({
|
|
137
|
+
params: rcx.params,
|
|
138
|
+
query: rcx.searchParams,
|
|
139
|
+
body: req.body,
|
|
140
|
+
headers: req.headers,
|
|
141
|
+
cookies: {} // req.cookies
|
|
142
|
+
}))
|
|
143
|
+
|
|
144
|
+
return Effect
|
|
145
|
+
.gen(function*($) {
|
|
146
|
+
const req = yield* $(HttpServerRequest)
|
|
147
|
+
const res = HttpServerResponse
|
|
148
|
+
.empty()
|
|
149
|
+
.pipe((_) => req.method === "GET" ? _.setHeader("Cache-Control", "no-store") : _)
|
|
150
|
+
|
|
151
|
+
const pars = yield* $(getParams)
|
|
152
|
+
|
|
153
|
+
const settings = yield* $(RequestSettings.get)
|
|
154
|
+
|
|
155
|
+
const eff =
|
|
156
|
+
// TODO: we don;t have access to user id here cause context is not yet created
|
|
157
|
+
Effect
|
|
158
|
+
.logInfo("Incoming request")
|
|
159
|
+
.annotateLogs({
|
|
160
|
+
method: req.method,
|
|
161
|
+
path: req.originalUrl,
|
|
162
|
+
...settings.verbose
|
|
163
|
+
? {
|
|
164
|
+
reqPath: pars.params.$$.pretty,
|
|
165
|
+
reqQuery: pars.query.$$.pretty,
|
|
166
|
+
reqBody: pretty(pars.body),
|
|
167
|
+
reqCookies: pretty(pars.cookies),
|
|
168
|
+
reqHeaders: pretty(pars.headers)
|
|
169
|
+
}
|
|
170
|
+
: undefined
|
|
171
|
+
})
|
|
172
|
+
.andThen(
|
|
173
|
+
Effect.suspend(() => {
|
|
174
|
+
const handleRequest = parseRequest(pars)
|
|
175
|
+
.map(({ body, path, query }) => {
|
|
176
|
+
const hn = {
|
|
177
|
+
...body.value as any,
|
|
178
|
+
...query.value as any,
|
|
179
|
+
...path.value as any
|
|
180
|
+
} as unknown as ReqA
|
|
181
|
+
return hn
|
|
182
|
+
})
|
|
183
|
+
.flatMap((parsedReq) =>
|
|
184
|
+
handle(parsedReq as any)
|
|
185
|
+
.provideService(handler.Request.Tag, parsedReq as any)
|
|
186
|
+
.map(encoder)
|
|
187
|
+
.map((r) =>
|
|
188
|
+
res
|
|
189
|
+
.setBody(HttpBody.unsafeJson(r))
|
|
190
|
+
.setStatus(r === undefined ? 204 : 200)
|
|
191
|
+
)
|
|
192
|
+
) as Effect<
|
|
193
|
+
Exclude<R, EnforceNonEmptyRecord<M>>,
|
|
194
|
+
ValidationError | ResE,
|
|
195
|
+
HttpServerResponse
|
|
196
|
+
>
|
|
197
|
+
|
|
198
|
+
// Commands should not be interruptable.
|
|
199
|
+
const r = req.method !== "GET" ? handleRequest.uninterruptible : handleRequest // .instrument("Performance.RequestResponse")
|
|
200
|
+
const r2 = middlewareLayer
|
|
201
|
+
? r.provide(middlewareLayer)
|
|
202
|
+
// PR is not relevant here
|
|
203
|
+
: (r as Effect<
|
|
204
|
+
Exclude<Exclude<R, EnforceNonEmptyRecord<M>>, PR>,
|
|
205
|
+
ResE | MiddlewareE | ValidationError,
|
|
206
|
+
HttpServerResponse
|
|
207
|
+
>)
|
|
208
|
+
return errorHandler(
|
|
209
|
+
req,
|
|
210
|
+
res,
|
|
211
|
+
r2
|
|
212
|
+
)
|
|
213
|
+
})
|
|
214
|
+
)
|
|
215
|
+
.catchAllCause((cause) =>
|
|
216
|
+
Effect
|
|
217
|
+
.sync(() => res.setStatus(500))
|
|
218
|
+
.tap((res) =>
|
|
219
|
+
Effect
|
|
220
|
+
.all([
|
|
221
|
+
reportError("request")(cause, {
|
|
222
|
+
path: req.originalUrl,
|
|
223
|
+
method: req.method
|
|
224
|
+
}),
|
|
225
|
+
Effect.suspend(() => {
|
|
226
|
+
const headers = res.headers
|
|
227
|
+
return Effect
|
|
228
|
+
.logError("Finished request", cause)
|
|
229
|
+
.annotateLogs({
|
|
230
|
+
method: req.method,
|
|
231
|
+
path: req.originalUrl,
|
|
232
|
+
statusCode: res.status.toString(),
|
|
233
|
+
|
|
234
|
+
reqPath: pars.params.$$.pretty,
|
|
235
|
+
reqQuery: pars.query.$$.pretty,
|
|
236
|
+
reqBody: pretty(pars.body),
|
|
237
|
+
reqCookies: pretty(pars.cookies),
|
|
238
|
+
reqHeaders: pretty(pars.headers),
|
|
239
|
+
|
|
240
|
+
resHeaders: Object
|
|
241
|
+
.entries(headers)
|
|
242
|
+
.reduce((prev, [key, value]) => {
|
|
243
|
+
prev[key] = value && typeof value === "string" ? snipString(value) : value
|
|
244
|
+
return prev
|
|
245
|
+
}, {} as Record<string, any>)
|
|
246
|
+
.$$
|
|
247
|
+
.pretty
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
], { concurrency: "inherit" })
|
|
251
|
+
)
|
|
252
|
+
.tapErrorCause((cause) => Effect(console.error("Error occurred while reporting error", cause)))
|
|
253
|
+
)
|
|
254
|
+
.tap(
|
|
255
|
+
Effect
|
|
256
|
+
.logInfo("Finished request")
|
|
257
|
+
.annotateLogs({
|
|
258
|
+
method: req.method,
|
|
259
|
+
path: req.originalUrl,
|
|
260
|
+
statusCode: res.status.toString(),
|
|
261
|
+
...settings.verbose
|
|
262
|
+
? {
|
|
263
|
+
resHeaders: pretty(res.headers)
|
|
264
|
+
}
|
|
265
|
+
: undefined
|
|
266
|
+
})
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
return yield* $(eff)
|
|
270
|
+
})
|
|
271
|
+
.updateRequestContext((_) =>
|
|
272
|
+
_.$$.copy({
|
|
273
|
+
name: NonEmptyString255(
|
|
274
|
+
AST.getTitleAnnotation(Request.ast).value ?? "TODO"
|
|
275
|
+
)
|
|
276
|
+
})
|
|
277
|
+
)
|
|
278
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
+
import { type RouteDescriptorAny } from "@effect-app/infra/api/express/schema/routing"
|
|
4
|
+
import type { ValidationError } from "@effect-app/infra/errors"
|
|
5
|
+
import type { StructFields } from "@effect-app/schema"
|
|
6
|
+
import { HttpRouter, type HttpServerRequest, type HttpServerResponse } from "../http.js"
|
|
7
|
+
import type { RequestHandler } from "./base.js"
|
|
8
|
+
import { makeRequestHandler } from "./makeRequestHandler.js"
|
|
9
|
+
import type { Middleware } from "./makeRequestHandler.js"
|
|
10
|
+
|
|
11
|
+
export const RouteDescriptors = Tag<Ref<RouteDescriptorAny[]>>()
|
|
12
|
+
|
|
13
|
+
export function match<
|
|
14
|
+
R,
|
|
15
|
+
M,
|
|
16
|
+
PathA extends StructFields,
|
|
17
|
+
CookieA extends StructFields,
|
|
18
|
+
QueryA extends StructFields,
|
|
19
|
+
BodyA extends StructFields,
|
|
20
|
+
HeaderA extends StructFields,
|
|
21
|
+
ReqA extends PathA & QueryA & BodyA,
|
|
22
|
+
ResA extends StructFields,
|
|
23
|
+
ResE,
|
|
24
|
+
MiddlewareE,
|
|
25
|
+
PPath extends `/${string}`,
|
|
26
|
+
R2,
|
|
27
|
+
PR,
|
|
28
|
+
RErr,
|
|
29
|
+
CTX,
|
|
30
|
+
Context,
|
|
31
|
+
Config
|
|
32
|
+
>(
|
|
33
|
+
requestHandler: RequestHandler<
|
|
34
|
+
R,
|
|
35
|
+
M,
|
|
36
|
+
PathA,
|
|
37
|
+
CookieA,
|
|
38
|
+
QueryA,
|
|
39
|
+
BodyA,
|
|
40
|
+
HeaderA,
|
|
41
|
+
ReqA,
|
|
42
|
+
ResA,
|
|
43
|
+
ResE,
|
|
44
|
+
PPath,
|
|
45
|
+
CTX,
|
|
46
|
+
Context,
|
|
47
|
+
Config
|
|
48
|
+
>,
|
|
49
|
+
errorHandler: <R>(
|
|
50
|
+
req: HttpServerRequest,
|
|
51
|
+
res: HttpServerResponse,
|
|
52
|
+
r2: Effect<R, ValidationError | MiddlewareE | ResE, HttpServerResponse>
|
|
53
|
+
) => Effect<RErr | R, never, HttpServerResponse>,
|
|
54
|
+
middleware?: Middleware<
|
|
55
|
+
R,
|
|
56
|
+
M,
|
|
57
|
+
PathA,
|
|
58
|
+
CookieA,
|
|
59
|
+
QueryA,
|
|
60
|
+
BodyA,
|
|
61
|
+
HeaderA,
|
|
62
|
+
ReqA,
|
|
63
|
+
ResA,
|
|
64
|
+
ResE,
|
|
65
|
+
MiddlewareE,
|
|
66
|
+
PPath,
|
|
67
|
+
R2,
|
|
68
|
+
PR,
|
|
69
|
+
CTX,
|
|
70
|
+
Context,
|
|
71
|
+
Config
|
|
72
|
+
>
|
|
73
|
+
) {
|
|
74
|
+
let middlewareLayer: Layer<R2, MiddlewareE, PR> | undefined = undefined
|
|
75
|
+
if (middleware) {
|
|
76
|
+
const { handler, makeRequestLayer } = middleware(requestHandler)
|
|
77
|
+
requestHandler = handler as any // todo
|
|
78
|
+
middlewareLayer = makeRequestLayer
|
|
79
|
+
}
|
|
80
|
+
return Effect.gen(function*() {
|
|
81
|
+
// const rdesc = yield* $(RouteDescriptors.flatMap((_) => _.get))
|
|
82
|
+
|
|
83
|
+
const handler = makeRequestHandler<
|
|
84
|
+
R,
|
|
85
|
+
M,
|
|
86
|
+
PathA,
|
|
87
|
+
CookieA,
|
|
88
|
+
QueryA,
|
|
89
|
+
BodyA,
|
|
90
|
+
HeaderA,
|
|
91
|
+
ReqA,
|
|
92
|
+
ResA,
|
|
93
|
+
ResE,
|
|
94
|
+
MiddlewareE,
|
|
95
|
+
R2,
|
|
96
|
+
PR,
|
|
97
|
+
RErr,
|
|
98
|
+
PPath,
|
|
99
|
+
Config
|
|
100
|
+
>(
|
|
101
|
+
requestHandler as any, // one argument if no middleware, 2 if has middleware. TODO: clean this shit up
|
|
102
|
+
errorHandler,
|
|
103
|
+
middlewareLayer
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
const route = HttpRouter.makeRoute(
|
|
107
|
+
requestHandler.Request.method,
|
|
108
|
+
requestHandler.Request.path,
|
|
109
|
+
handler
|
|
110
|
+
)
|
|
111
|
+
// TODO
|
|
112
|
+
// rdesc.push(makeRouteDescriptor(
|
|
113
|
+
// requestHandler.Request.path,
|
|
114
|
+
// requestHandler.Request.method,
|
|
115
|
+
// requestHandler
|
|
116
|
+
// ))
|
|
117
|
+
return route
|
|
118
|
+
})
|
|
119
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
+
|
|
4
|
+
// codegen:start {preset: barrel, include: routing/*.ts }
|
|
5
|
+
export * from "./routing/base.js"
|
|
6
|
+
export * from "./routing/defaultErrorHandler.js"
|
|
7
|
+
export * from "./routing/makeRequestHandler.js"
|
|
8
|
+
export * from "./routing/match.js"
|
|
9
|
+
// codegen:end
|
|
10
|
+
|
|
11
|
+
// export * from "@effect-app/infra/api/routing"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Route as HttpRoute, Router as HttpRouter } from "@effect/platform/Http/Router";
|
|
2
|
+
export type { HttpApp } from "@effect/platform/Http/App";
|
|
3
|
+
export type { Body as HttpBody } from "@effect/platform/Http/Body";
|
|
4
|
+
export * as HttpHeaders from "@effect/platform/Http/Headers";
|
|
5
|
+
export type { Middleware as HttpMiddleware } from "@effect/platform/Http/Middleware";
|
|
6
|
+
export { RouteContext as HttpRouteContext } from "@effect/platform/Http/Router";
|
|
7
|
+
export { RequestError as HttpRequestError } from "@effect/platform/Http/ServerError";
|
|
8
|
+
export { ServerRequest as HttpServerRequest } from "@effect/platform/Http/ServerRequest";
|
|
9
|
+
export type { ServerResponse as HttpServerResponse } from "@effect/platform/Http/ServerResponse";
|
|
10
|
+
export type { HttpRoute, HttpRouter };
|
|
11
|
+
export * as HttpServer from "@effect/platform/Http/Server";
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus unify effect/platform/Http/Router/Route
|
|
14
|
+
*/
|
|
15
|
+
export declare function unifyRoute<X extends HttpRoute<any, any>>(self: X): HttpRoute<X extends HttpRoute<infer EX, any> ? EX : never, X extends HttpRoute<any, infer AX> ? AX : never>;
|
|
16
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../_src/api/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAE5F,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAA;AAC5D,YAAY,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACpF,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACxF,YAAY,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AAChG,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAA;AAE1D;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EACtD,IAAI,EAAE,CAAC,GACN,SAAS,CACV,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,EAC/C,CAAC,SAAS,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,CAChD,CAEA"}
|
package/dist/api/http.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * as HttpHeaders from "@effect/platform/Http/Headers";
|
|
2
|
+
export { RouteContext as HttpRouteContext } from "@effect/platform/Http/Router";
|
|
3
|
+
export { RequestError as HttpRequestError } from "@effect/platform/Http/ServerError";
|
|
4
|
+
export { ServerRequest as HttpServerRequest } from "@effect/platform/Http/ServerRequest";
|
|
5
|
+
export * as HttpServer from "@effect/platform/Http/Server";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus unify effect/platform/Http/Router/Route
|
|
8
|
+
*/
|
|
9
|
+
export function unifyRoute(self) {
|
|
10
|
+
return self;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL19zcmMvYXBpL2h0dHAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBTUEsT0FBTyxLQUFLLFdBQVcsTUFBTSwrQkFBK0IsQ0FBQTtBQUU1RCxPQUFPLEVBQUUsWUFBWSxJQUFJLGdCQUFnQixFQUFFLE1BQU0sOEJBQThCLENBQUE7QUFDL0UsT0FBTyxFQUFFLFlBQVksSUFBSSxnQkFBZ0IsRUFBRSxNQUFNLG1DQUFtQyxDQUFBO0FBQ3BGLE9BQU8sRUFBRSxhQUFhLElBQUksaUJBQWlCLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQTtBQUd4RixPQUFPLEtBQUssVUFBVSxNQUFNLDhCQUE4QixDQUFBO0FBRTFEOztHQUVHO0FBQ0gsTUFBTSxVQUFVLFVBQVUsQ0FDeEIsSUFBTztJQUtQLE9BQU8sSUFBSSxDQUFBO0FBQ2IsQ0FBQyJ9
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Effect } from "effect/Effect";
|
|
2
|
+
import { Schema } from "@effect-app/schema";
|
|
3
|
+
import { Option } from "@effect-app/core/Option";
|
|
4
|
+
import { Tag } from "effect/Context";
|
|
5
|
+
import * as S from "@effect-app/schema";
|
|
6
|
+
import type { EnforceNonEmptyRecord } from "@effect-app/core/utils";
|
|
7
|
+
import { ValidationError } from "@effect-app/infra/errors";
|
|
8
|
+
import type { REST, StructFields } from "@effect-app/schema";
|
|
9
|
+
import type { Simplify } from "effect/Types";
|
|
10
|
+
import type express from "express";
|
|
11
|
+
import type { HttpRequestError, HttpRoute } from "../http.js";
|
|
12
|
+
export type Flatten<T extends object> = object extends T ? object : {
|
|
13
|
+
[K in keyof T]-?: (x: NonNullable<T[K]> extends infer V ? V extends object ? V extends readonly any[] ? Pick<T, K> : FlattenLVL1<V> extends infer FV ? ({
|
|
14
|
+
[P in keyof FV as `${Extract<K, string | number>}.${Extract<P, string | number>}`]: FV[P];
|
|
15
|
+
}) : never : Pick<T, K> : never) => void;
|
|
16
|
+
} extends Record<keyof T, (y: infer O) => void> ? O extends unknown ? {
|
|
17
|
+
[K in keyof O]: O[K];
|
|
18
|
+
} : never : never;
|
|
19
|
+
type FlattenLVL1<T extends object> = object extends T ? object : {
|
|
20
|
+
[K in keyof T]-?: (x: NonNullable<T[K]> extends infer V ? V extends object ? V extends readonly any[] ? Pick<T, K> : Pick<T, K> : never : never) => void;
|
|
21
|
+
} extends Record<keyof T, (y: infer O) => void> ? O extends unknown ? {
|
|
22
|
+
[K in keyof O]: O[K];
|
|
23
|
+
} : never : never;
|
|
24
|
+
export type RouteMatch<R, M, PR = never> = Effect<never, never, HttpRoute<Exclude<Exclude<R, EnforceNonEmptyRecord<M>>, PR>, HttpRequestError>>;
|
|
25
|
+
export interface ReqHandler<Req, R, E, Res, ReqSchema extends S.Schema<any, any>, ResSchema extends S.Schema<any, any>, CTX = any, Context = any> {
|
|
26
|
+
h: (r: Req, ctx: CTX) => Effect<R, E, Res>;
|
|
27
|
+
Request: ReqSchema;
|
|
28
|
+
Response: ResSchema;
|
|
29
|
+
ResponseOpenApi: any;
|
|
30
|
+
CTX: CTX;
|
|
31
|
+
Context: Context;
|
|
32
|
+
}
|
|
33
|
+
export type ReqFromSchema<ReqSchema extends S.Schema<any, any>> = S.Schema.To<ReqSchema>;
|
|
34
|
+
export type Extr<T> = T extends {
|
|
35
|
+
Model: S.Schema<any, any>;
|
|
36
|
+
} ? T["Model"] : T extends S.Schema<any, any> ? T : never;
|
|
37
|
+
export type ResFromSchema<ResSchema> = S.Schema.To<Extr<ResSchema>>;
|
|
38
|
+
export type _R<T extends Effect<any, any, any>> = [T] extends [
|
|
39
|
+
Effect<infer R, any, any>
|
|
40
|
+
] ? R : never;
|
|
41
|
+
export type _E<T extends Effect<any, any, any>> = [T] extends [
|
|
42
|
+
Effect<any, infer E, any>
|
|
43
|
+
] ? E : never;
|
|
44
|
+
export type Request2<Path extends string, Method extends S.REST.Methods.Rest, ReqA extends StructFields> = S.REST.ReqRes<{}, S.ToStruct<ReqA>> & {
|
|
45
|
+
method: Method;
|
|
46
|
+
path: Path;
|
|
47
|
+
};
|
|
48
|
+
export type Encode<A, E> = (a: A) => E;
|
|
49
|
+
export declare function decodeErrors(x: unknown): unknown[];
|
|
50
|
+
export declare function parseRequestParams<PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields>(parsers: RequestParsers<PathA, CookieA, QueryA, BodyA, HeaderA>): ({ body, cookies, headers, params, query }: {
|
|
51
|
+
body: unknown;
|
|
52
|
+
cookies: unknown;
|
|
53
|
+
headers: unknown;
|
|
54
|
+
params: unknown;
|
|
55
|
+
query: unknown;
|
|
56
|
+
}) => import("effect/Effect").Effect<never, ValidationError, {
|
|
57
|
+
body: import("effect/Option").Option<Simplify<S.ToStruct<BodyA>>>;
|
|
58
|
+
cookie: import("effect/Option").Option<Simplify<S.ToStruct<CookieA>>>;
|
|
59
|
+
headers: import("effect/Option").Option<Simplify<S.ToStruct<HeaderA>>>;
|
|
60
|
+
path: import("effect/Option").Option<Simplify<S.ToStruct<PathA>>>;
|
|
61
|
+
query: import("effect/Option").Option<Simplify<S.ToStruct<QueryA>>>;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function respondSuccess<ReqA, A, E>(encodeResponse: (req: ReqA) => Encode<A, E>): (req: ReqA, res: express.Response) => (a: A) => import("effect/Effect").Effect<never, never, void>;
|
|
64
|
+
export interface RequestHandler2<R, Path extends string, Method extends S.REST.Methods.Rest, ReqA extends StructFields, ResA extends StructFields, ResE> {
|
|
65
|
+
h: (i: ReqA) => Effect<R, ResE, ResA>;
|
|
66
|
+
Request: Request2<Path, Method, ReqA>;
|
|
67
|
+
Response: S.REST.ReqRes<any, any>;
|
|
68
|
+
}
|
|
69
|
+
export declare function makeRequestParsers<R, M, PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields, ReqA extends PathA & QueryA & BodyA, ResA extends StructFields, Errors, PPath extends `/${string}`, CTX, Context, Config>(Request: RequestHandler<R, M, PathA, CookieA, QueryA, BodyA, HeaderA, ReqA, ResA, Errors, PPath, CTX, Context, Config>["Request"]): RequestParsers<PathA, CookieA, QueryA, BodyA, HeaderA>;
|
|
70
|
+
type Decode<A> = (u: unknown) => Effect<never, unknown, A>;
|
|
71
|
+
export interface RequestParsers<PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields> {
|
|
72
|
+
parseHeaders: Decode<Option<Simplify<S.ToStruct<HeaderA>>>>;
|
|
73
|
+
parseQuery: Decode<Option<Simplify<S.ToStruct<QueryA>>>>;
|
|
74
|
+
parseBody: Decode<Option<Simplify<S.ToStruct<BodyA>>>>;
|
|
75
|
+
parsePath: Decode<Option<Simplify<S.ToStruct<PathA>>>>;
|
|
76
|
+
parseCookie: Decode<Option<Simplify<S.ToStruct<CookieA>>>>;
|
|
77
|
+
}
|
|
78
|
+
export type EffectDeps<A> = {
|
|
79
|
+
[K in keyof A as A[K] extends Effect<any, any, any> ? K : never]: A[K] extends Effect<any, any, any> ? A[K] : never;
|
|
80
|
+
};
|
|
81
|
+
export type Request<M, PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields, ReqA extends PathA & QueryA & BodyA, PPath extends `/${string}`> = REST.ReqRes<any, any> & {
|
|
82
|
+
method: REST.Methods.Rest;
|
|
83
|
+
path: PPath;
|
|
84
|
+
Cookie?: CookieA;
|
|
85
|
+
Path?: PathA;
|
|
86
|
+
Body?: BodyA;
|
|
87
|
+
Query?: QueryA;
|
|
88
|
+
Headers?: HeaderA;
|
|
89
|
+
Tag: Tag<M, M>;
|
|
90
|
+
ReqA?: ReqA;
|
|
91
|
+
};
|
|
92
|
+
export interface RequestHandlerBase<R, M, PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields, ReqA extends PathA & QueryA & BodyA, ResA extends StructFields, ResE, PPath extends `/${string}`, Config> {
|
|
93
|
+
adaptResponse?: any;
|
|
94
|
+
h: (i: PathA & QueryA & BodyA & {}) => Effect<R, ResE, ResA>;
|
|
95
|
+
Request: Request<M, PathA, CookieA, QueryA, BodyA, HeaderA, ReqA, PPath>;
|
|
96
|
+
Response: REST.ReqRes<any, any>;
|
|
97
|
+
ResponseOpenApi?: any;
|
|
98
|
+
config: Config;
|
|
99
|
+
}
|
|
100
|
+
export interface RequestHandler<R, M, PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields, ReqA extends PathA & QueryA & BodyA, ResA extends StructFields, ResE, PPath extends `/${string}`, CTX, Context, Config> {
|
|
101
|
+
adaptResponse?: any;
|
|
102
|
+
h: (i: PathA & QueryA & BodyA & {}, ctx: any) => Effect<R, ResE, ResA>;
|
|
103
|
+
Request: Request<M, PathA, CookieA, QueryA, BodyA, HeaderA, ReqA, PPath> & Config;
|
|
104
|
+
Response: REST.ReqRes<any, any>;
|
|
105
|
+
ResponseOpenApi?: any;
|
|
106
|
+
CTX: CTX;
|
|
107
|
+
Context: Context;
|
|
108
|
+
}
|
|
109
|
+
export interface RequestHandlerOrig<R, M, PathA extends StructFields, CookieA extends StructFields, QueryA extends StructFields, BodyA extends StructFields, HeaderA extends StructFields, ReqA extends PathA & QueryA & BodyA, ResA extends StructFields, ResE, PPath extends `/${string}`> {
|
|
110
|
+
adaptResponse?: any;
|
|
111
|
+
h: (i: PathA & QueryA & BodyA & {}) => Effect<R, ResE, ResA>;
|
|
112
|
+
Request: Request<M, PathA, CookieA, QueryA, BodyA, HeaderA, ReqA, PPath>;
|
|
113
|
+
Response: REST.ReqRes<any, any>;
|
|
114
|
+
ResponseOpenApi?: any;
|
|
115
|
+
}
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../_src/api/routing/base.ts"],"names":[],"mappings":";;;;AAGA,OAAO,KAAK,CAAC,MAAM,oBAAoB,CAAA;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE7D,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,SAAS,CAAC,GAAG,MAAM,GAAG;KACjE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAChB,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,CAAC,SAAS,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACzF,WAAW,CAAC,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC;SAChC,CAAC,IAAI,MAAM,EAAE,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