@effect-app/infra 2.73.2 → 2.73.3
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 +6 -0
- package/dist/api/routing/DynamicMiddleware.d.ts +38 -29
- package/dist/api/routing/DynamicMiddleware.d.ts.map +1 -1
- package/dist/api/routing/DynamicMiddleware.js +9 -23
- package/dist/api/routing.d.ts +13 -13
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +1 -1
- package/package.json +1 -1
- package/src/api/routing/DynamicMiddleware.ts +133 -73
- package/src/api/routing.ts +10 -16
- package/test/controller.test.ts +37 -9
- package/test/dist/controller.test.d.ts.map +1 -1
- package/test/dist/controller/test2.test.d.ts.map +0 -1
- package/test/dist/controller.legacy2.test.d.ts.map +0 -1
- package/test/dist/controller.legacy3.test.d.ts.map +0 -1
- package/test/dist/controller.test copy.js +0 -129
- package/test/dist/controller5.test.d.ts.map +0 -1
- package/test/dist/controller6.test.d.ts.map +0 -1
- package/test/dist/controller7.test.d.ts.map +0 -1
- package/test/dist/filterApi.test.d.ts.map +0 -1
- package/vitest.config.ts.timestamp-1711656440838-19c636fe320df.mjs +0 -0
- package/vitest.config.ts.timestamp-1711724061890-6ecedb0a07fdd.mjs +0 -0
- package/vitest.config.ts.timestamp-1711743489537-da8d9e5f66c9f.mjs +0 -0
- package/vitest.config.ts.timestamp-1711744615239-dcf257a844e01.mjs +0 -37
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import { type Array, Context, Effect, Layer, type NonEmptyArray, type Request, type S } from "effect-app"
|
|
4
|
+
import { type Array, Context, Effect, Layer, type NonEmptyArray, pipe, type Request, type S } from "effect-app"
|
|
5
5
|
import type { GetEffectContext, RPCContextMap } from "effect-app/client/req"
|
|
6
6
|
import { type HttpRouter } from "effect-app/http"
|
|
7
7
|
import type * as EffectRequest from "effect/Request"
|
|
8
8
|
import { type LayersUtils } from "../routing.js"
|
|
9
9
|
|
|
10
|
+
// utils:
|
|
11
|
+
//
|
|
12
|
+
type GetContext<T> = T extends Context.Context<infer Y> ? Y : never
|
|
13
|
+
|
|
14
|
+
// module:
|
|
15
|
+
//
|
|
10
16
|
export type MakeRPCHandlerFactory<
|
|
11
17
|
RequestContextMap extends Record<string, RPCContextMap.Any>,
|
|
12
18
|
MiddlewareR
|
|
@@ -33,7 +39,7 @@ export type MakeRPCHandlerFactory<
|
|
|
33
39
|
) => Effect.Effect<
|
|
34
40
|
Request.Request.Success<Req>,
|
|
35
41
|
Request.Request.Error<Req> | RequestContextMapErrors<RequestContextMap>,
|
|
36
|
-
// the middleware will remove from HandlerR the dynamic context, but will also add
|
|
42
|
+
// the middleware will remove from HandlerR the dynamic context, but will also add some requirements
|
|
37
43
|
| MiddlewareR
|
|
38
44
|
// & S.Schema<Req, any, never> is useless here but useful when creating the middleware
|
|
39
45
|
| Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>
|
|
@@ -41,7 +47,6 @@ export type MakeRPCHandlerFactory<
|
|
|
41
47
|
|
|
42
48
|
export type RPCHandlerFactory<
|
|
43
49
|
RequestContextMap extends Record<string, RPCContextMap.Any>,
|
|
44
|
-
MiddlewareR,
|
|
45
50
|
ContextProviderA
|
|
46
51
|
> = <
|
|
47
52
|
T extends {
|
|
@@ -66,32 +71,32 @@ export type RPCHandlerFactory<
|
|
|
66
71
|
) => Effect.Effect<
|
|
67
72
|
Request.Request.Success<Req>,
|
|
68
73
|
Request.Request.Error<Req> | RequestContextMapErrors<RequestContextMap>,
|
|
69
|
-
| HttpRouter.HttpRouter.Provided
|
|
70
|
-
// the middleware will remove from HandlerR the dynamic context, but will also add the MiddlewareR
|
|
74
|
+
| HttpRouter.HttpRouter.Provided // because of the context provider and the middleware (Middleware)
|
|
71
75
|
| Exclude<
|
|
72
|
-
|
|
76
|
+
// the middleware will remove from HandlerR the dynamic context
|
|
73
77
|
// & S.Schema<Req, any, never> is useless here but useful when creating the middleware
|
|
74
|
-
|
|
78
|
+
Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>,
|
|
79
|
+
// the context provider provides additional stuff both to the middleware and the handler
|
|
75
80
|
ContextProviderA
|
|
76
81
|
>
|
|
77
82
|
>
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type ContextProviderShape<ContextProviderA, ContextProviderR> = Effect<
|
|
84
|
+
// the context provider provides additional stuff
|
|
85
|
+
export type ContextProviderShape<ContextProviderA, ContextProviderR extends HttpRouter.HttpRouter.Provided> = Effect<
|
|
84
86
|
Context.Context<ContextProviderA>,
|
|
85
|
-
never,
|
|
87
|
+
never, // no errors are allowed
|
|
86
88
|
ContextProviderR
|
|
87
89
|
>
|
|
88
90
|
|
|
91
|
+
export interface ContextProviderId {
|
|
92
|
+
_tag: "ContextProvider"
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
export interface MiddlewareMake<
|
|
90
|
-
|
|
91
|
-
RequestContextMap extends Record<string, RPCContextMap.Any>, // what services will the middlware provide dynamically to the handler, or raise errors.
|
|
96
|
+
RequestContextMap extends Record<string, RPCContextMap.Any>, // what services will the middleware provide dynamically to the handler, or raise errors.
|
|
92
97
|
MakeMiddlewareE, // what the middleware construction can fail with
|
|
93
|
-
MakeMiddlewareR, // what the
|
|
94
|
-
MiddlewareDependencies extends NonEmptyArray<Layer.Layer.Any>, // layers provided for the
|
|
98
|
+
MakeMiddlewareR, // what the middleware requires to be constructed
|
|
99
|
+
MiddlewareDependencies extends NonEmptyArray<Layer.Layer.Any>, // layers provided for the middleware to be constructed
|
|
95
100
|
//
|
|
96
101
|
// ContextProvider is a service that builds additional context for each request.
|
|
97
102
|
ContextProviderA, // what the context provider provides
|
|
@@ -108,32 +113,29 @@ export interface MiddlewareMake<
|
|
|
108
113
|
& {
|
|
109
114
|
Default: Layer.Layer<ContextProviderId, MakeContextProviderE, MakeContextProviderR>
|
|
110
115
|
}
|
|
116
|
+
// this actually builds "the middleware", i.e. returns the augmented handler factory when yielded...
|
|
111
117
|
execute: (
|
|
112
118
|
maker: (
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
// MiddlewareR is set to ContextProviderA | HttpRouter.HttpRouter.Provided because that's what, at most
|
|
120
|
+
// a middleware can additionally require to get executed
|
|
121
|
+
cb: MakeRPCHandlerFactory<RequestContextMap, ContextProviderA | HttpRouter.HttpRouter.Provided>
|
|
122
|
+
) => MakeRPCHandlerFactory<RequestContextMap, ContextProviderA | HttpRouter.HttpRouter.Provided>
|
|
115
123
|
) => Effect<
|
|
116
|
-
MakeRPCHandlerFactory<RequestContextMap,
|
|
124
|
+
MakeRPCHandlerFactory<RequestContextMap, ContextProviderA | HttpRouter.HttpRouter.Provided>,
|
|
117
125
|
MakeMiddlewareE,
|
|
118
|
-
MakeMiddlewareR
|
|
126
|
+
MakeMiddlewareR // ...that's why MakeMiddlewareR is here
|
|
119
127
|
>
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
|
|
123
|
-
_tag: "MiddlewareMaker"
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface ContextProviderId {
|
|
127
|
-
_tag: "ContextProvider"
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
type GetContext<T> = T extends Context.Context<infer Y> ? Y : never
|
|
131
|
-
|
|
130
|
+
// Note: the type here must be aligned with MergedContextProvider
|
|
132
131
|
export const mergeContextProviders = <
|
|
133
132
|
// TDeps is an array of services whit Default implementation
|
|
134
133
|
// each service is an effect which builds some context for each request
|
|
135
134
|
TDeps extends Array.NonEmptyReadonlyArray<
|
|
136
135
|
& (
|
|
136
|
+
// E = never => the context provided cannot trigger errors
|
|
137
|
+
// can't put HttpRouter.HttpRouter.Provided as R here because of variance
|
|
138
|
+
// (TDeps is an input type parameter so it's contravariant therefore Effect's R becomes contravariant too)
|
|
137
139
|
| Context.Tag<any, Effect<Context.Context<any>, never, any> & { _tag: any }>
|
|
138
140
|
| Context.Tag<any, Effect<Context.Context<any>, never, never> & { _tag: any }>
|
|
139
141
|
)
|
|
@@ -142,15 +144,23 @@ export const mergeContextProviders = <
|
|
|
142
144
|
Default: Layer.Layer<Effect<Context.Context<any>> & { _tag: any }, any, any>
|
|
143
145
|
}
|
|
144
146
|
>
|
|
145
|
-
>(
|
|
147
|
+
>(
|
|
148
|
+
...deps: {
|
|
149
|
+
[K in keyof TDeps]: TDeps[K]["Service"] extends Effect<Context.Context<any>, never, HttpRouter.HttpRouter.Provided>
|
|
150
|
+
? TDeps[K]
|
|
151
|
+
: `HttpRouter.HttpRouter.Provided are the only requirements ${TDeps[K]["Service"][
|
|
152
|
+
"_tag"
|
|
153
|
+
]}'s returned effect can have`
|
|
154
|
+
}
|
|
155
|
+
): {
|
|
146
156
|
dependencies: { [K in keyof TDeps]: TDeps[K]["Default"] }
|
|
147
157
|
effect: Effect.Effect<
|
|
148
158
|
Effect.Effect<
|
|
149
159
|
Context.Context<GetContext<Effect.Success<InstanceType<TDeps[number]>>>>,
|
|
150
|
-
|
|
160
|
+
never,
|
|
151
161
|
Effect.Context<InstanceType<TDeps[number]>>
|
|
152
162
|
>,
|
|
153
|
-
|
|
163
|
+
LayersUtils.GetLayersError<{ [K in keyof TDeps]: TDeps[K]["Default"] }>,
|
|
154
164
|
InstanceType<TDeps[number]>
|
|
155
165
|
>
|
|
156
166
|
} => ({
|
|
@@ -158,34 +168,32 @@ export const mergeContextProviders = <
|
|
|
158
168
|
effect: Effect.gen(function*() {
|
|
159
169
|
const services = yield* Effect.all(deps)
|
|
160
170
|
// services are effects which return some Context.Context<...>
|
|
171
|
+
// @effect-diagnostics effect/returnEffectInGen:off
|
|
161
172
|
return Effect.all(services as any[]).pipe(
|
|
162
173
|
Effect.map((_) => Context.mergeAll(..._ as any))
|
|
163
174
|
)
|
|
164
175
|
}) as any
|
|
165
176
|
})
|
|
166
177
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// // each service is an effect which builds some context for each request
|
|
171
|
-
// TDeps extends Array.NonEmptyReadonlyArray<
|
|
172
|
-
// & (
|
|
173
|
-
// | Context.Tag<any, Effect<Context.Context<any>, never, any> & { _tag: any }>
|
|
174
|
-
// | Context.Tag<any, Effect<Context.Context<any>, never, never> & { _tag: any }>
|
|
175
|
-
// )
|
|
176
|
-
// & {
|
|
177
|
-
// new(...args: any[]): any
|
|
178
|
-
// Default: Layer.Layer<Effect<Context.Context<any>> & { _tag: any }, any, any>
|
|
179
|
-
// }
|
|
180
|
-
// >
|
|
181
|
-
// >(...deps: TDeps) => ContextProvider(mergeContextProviders(...deps))
|
|
178
|
+
export interface MiddlewareMakerId {
|
|
179
|
+
_tag: "MiddlewareMaker"
|
|
180
|
+
}
|
|
182
181
|
|
|
183
|
-
export const ContextProvider = <
|
|
184
|
-
|
|
182
|
+
export const ContextProvider = <
|
|
183
|
+
ContextProviderA,
|
|
184
|
+
MakeContextProviderE,
|
|
185
|
+
MakeContextProviderR,
|
|
186
|
+
ContextProviderR extends HttpRouter.HttpRouter.Provided,
|
|
187
|
+
Dependencies extends NonEmptyArray<Layer.Layer.Any>
|
|
188
|
+
>(
|
|
189
|
+
input: {
|
|
190
|
+
effect: Effect<Effect<ContextProviderA, never, ContextProviderR>, MakeContextProviderE, MakeContextProviderR>
|
|
191
|
+
dependencies?: Dependencies
|
|
192
|
+
}
|
|
185
193
|
) => {
|
|
186
194
|
const ctx = Context.GenericTag<
|
|
187
195
|
ContextProviderId,
|
|
188
|
-
Effect<
|
|
196
|
+
Effect<ContextProviderA, never, ContextProviderR>
|
|
189
197
|
>(
|
|
190
198
|
"ContextProvider"
|
|
191
199
|
)
|
|
@@ -195,16 +203,68 @@ export const ContextProvider = <A, E, R, ContextE, ContextR, Dependencies extend
|
|
|
195
203
|
input.dependencies ? Layer.provide(input.dependencies) as any : (_) => _
|
|
196
204
|
) as Layer.Layer<
|
|
197
205
|
ContextProviderId,
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
| MakeContextProviderE
|
|
207
|
+
| LayersUtils.GetLayersError<Dependencies>,
|
|
208
|
+
| Exclude<MakeContextProviderR, LayersUtils.GetLayersSuccess<Dependencies>>
|
|
209
|
+
| LayersUtils.GetLayersContext<Dependencies>
|
|
200
210
|
>
|
|
201
211
|
})
|
|
202
212
|
}
|
|
203
213
|
|
|
214
|
+
// Note: the type here must be aligned with mergeContextProviders
|
|
215
|
+
export const MergedContextProvider = <
|
|
216
|
+
// TDeps is an array of services whit Default implementation
|
|
217
|
+
// each service is an effect which builds some context for each request
|
|
218
|
+
TDeps extends Array.NonEmptyReadonlyArray<
|
|
219
|
+
& (
|
|
220
|
+
// E = never => the context provided cannot trigger errors
|
|
221
|
+
// can't put HttpRouter.HttpRouter.Provided as R here because of variance
|
|
222
|
+
// (TDeps is an input type parameter so it's contravariant therefore Effect's R becomes contravariant too)
|
|
223
|
+
| Context.Tag<any, Effect<Context.Context<any>, never, any> & { _tag: any }>
|
|
224
|
+
| Context.Tag<any, Effect<Context.Context<any>, never, never> & { _tag: any }>
|
|
225
|
+
)
|
|
226
|
+
& {
|
|
227
|
+
new(...args: any[]): any
|
|
228
|
+
Default: Layer.Layer<Effect<Context.Context<any>> & { _tag: any }, any, any>
|
|
229
|
+
}
|
|
230
|
+
>
|
|
231
|
+
>(
|
|
232
|
+
...deps: {
|
|
233
|
+
[K in keyof TDeps]: TDeps[K]["Service"] extends Effect<Context.Context<any>, never, HttpRouter.HttpRouter.Provided>
|
|
234
|
+
? TDeps[K]
|
|
235
|
+
: `HttpRouter.HttpRouter.Provided are the only requirements ${TDeps[K]["Service"][
|
|
236
|
+
"_tag"
|
|
237
|
+
]}'s returned effect can have`
|
|
238
|
+
}
|
|
239
|
+
) =>
|
|
240
|
+
pipe(
|
|
241
|
+
deps as Parameters<typeof mergeContextProviders>[0],
|
|
242
|
+
mergeContextProviders,
|
|
243
|
+
(_) => ContextProvider(_ as any)
|
|
244
|
+
) as unknown as
|
|
245
|
+
& Context.Tag<
|
|
246
|
+
ContextProviderId,
|
|
247
|
+
Effect.Effect<
|
|
248
|
+
Context.Context<GetContext<Effect.Success<InstanceType<TDeps[number]>>>>,
|
|
249
|
+
never,
|
|
250
|
+
Effect.Context<InstanceType<TDeps[number]>>
|
|
251
|
+
>
|
|
252
|
+
>
|
|
253
|
+
& {
|
|
254
|
+
Default: Layer.Layer<
|
|
255
|
+
ContextProviderId,
|
|
256
|
+
LayersUtils.GetLayersError<{ [K in keyof TDeps]: TDeps[K]["Default"] }>,
|
|
257
|
+
| Exclude<
|
|
258
|
+
InstanceType<TDeps[number]>,
|
|
259
|
+
LayersUtils.GetLayersSuccess<{ [K in keyof TDeps]: TDeps[K]["Default"] }>
|
|
260
|
+
>
|
|
261
|
+
| LayersUtils.GetLayersContext<{ [K in keyof TDeps]: TDeps[K]["Default"] }>
|
|
262
|
+
>
|
|
263
|
+
}
|
|
264
|
+
|
|
204
265
|
export const EmptyContextProvider = ContextProvider({ effect: Effect.succeed(Effect.succeed(Context.empty())) })
|
|
205
266
|
|
|
206
267
|
export type Middleware<
|
|
207
|
-
MiddlewareR, // what the middlware requires to execute
|
|
208
268
|
RequestContextMap extends Record<string, RPCContextMap.Any>, // what services will the middlware provide dynamically to the handler, or raise errors.
|
|
209
269
|
MakeMiddlewareE, // what the middleware construction can fail with
|
|
210
270
|
MakeMiddlewareR, // what the middlware requires to be constructed
|
|
@@ -213,9 +273,7 @@ export type Middleware<
|
|
|
213
273
|
& Context.Tag<
|
|
214
274
|
MiddlewareMakerId,
|
|
215
275
|
MiddlewareMakerId & {
|
|
216
|
-
effect: RPCHandlerFactory<RequestContextMap,
|
|
217
|
-
} & {
|
|
218
|
-
_tag: "MiddlewareMaker"
|
|
276
|
+
effect: RPCHandlerFactory<RequestContextMap, ContextProviderA>
|
|
219
277
|
}
|
|
220
278
|
>
|
|
221
279
|
& {
|
|
@@ -230,10 +288,12 @@ export type RequestContextMapErrors<RequestContextMap extends Record<string, RPC
|
|
|
230
288
|
RequestContextMap[keyof RequestContextMap]["error"]
|
|
231
289
|
>
|
|
232
290
|
|
|
233
|
-
//
|
|
291
|
+
// factory for middlewares
|
|
234
292
|
export const makeMiddleware =
|
|
235
|
-
// by setting
|
|
236
|
-
<
|
|
293
|
+
// by setting RequestContextMap beforehand, execute contextual typing does not fuck up itself to anys
|
|
294
|
+
<
|
|
295
|
+
RequestContextMap extends Record<string, RPCContextMap.Any>
|
|
296
|
+
>() =>
|
|
237
297
|
<
|
|
238
298
|
MakeMiddlewareE, // what the middleware construction can fail with
|
|
239
299
|
MakeMiddlewareR, // what the middlware requires to be constructed
|
|
@@ -246,7 +306,6 @@ export const makeMiddleware =
|
|
|
246
306
|
MakeContextProviderR // what the context provider construction requires
|
|
247
307
|
>(
|
|
248
308
|
make: MiddlewareMake<
|
|
249
|
-
MiddlewareR,
|
|
250
309
|
RequestContextMap,
|
|
251
310
|
MakeMiddlewareE,
|
|
252
311
|
MakeMiddlewareR,
|
|
@@ -261,7 +320,7 @@ export const makeMiddleware =
|
|
|
261
320
|
const MiddlewareMaker = Context.GenericTag<
|
|
262
321
|
MiddlewareMakerId,
|
|
263
322
|
{
|
|
264
|
-
effect: RPCHandlerFactory<RequestContextMap,
|
|
323
|
+
effect: RPCHandlerFactory<RequestContextMap, ContextProviderA>
|
|
265
324
|
_tag: "MiddlewareMaker"
|
|
266
325
|
}
|
|
267
326
|
>(
|
|
@@ -272,13 +331,15 @@ export const makeMiddleware =
|
|
|
272
331
|
MiddlewareMaker,
|
|
273
332
|
Effect
|
|
274
333
|
.all({
|
|
275
|
-
middleware: make.execute(
|
|
334
|
+
middleware: make.execute((
|
|
335
|
+
cb: MakeRPCHandlerFactory<RequestContextMap, HttpRouter.HttpRouter.Provided | ContextProviderA>
|
|
336
|
+
) => cb),
|
|
276
337
|
contextProvider: make.contextProvider // uses the middleware.contextProvider tag to get the context provider service
|
|
277
338
|
})
|
|
278
339
|
.pipe(
|
|
279
340
|
Effect.map(({ contextProvider, middleware }) => ({
|
|
280
341
|
_tag: "MiddlewareMaker" as const,
|
|
281
|
-
effect: makeRpcEffect<RequestContextMap,
|
|
342
|
+
effect: makeRpcEffect<RequestContextMap, ContextProviderA>()(
|
|
282
343
|
(schema, handler, moduleName) => {
|
|
283
344
|
const h = middleware(schema, handler, moduleName)
|
|
284
345
|
return (req, headers) =>
|
|
@@ -304,11 +365,11 @@ export const makeMiddleware =
|
|
|
304
365
|
Layer.provide(make.contextProvider.Default)
|
|
305
366
|
) as Layer.Layer<
|
|
306
367
|
MiddlewareMakerId,
|
|
307
|
-
| MakeMiddlewareE
|
|
308
|
-
| Layer.Error<typeof make.contextProvider.Default>,
|
|
309
|
-
| LayersUtils.GetLayersContext<MiddlewareDependencies>
|
|
310
|
-
| Exclude<MakeMiddlewareR, LayersUtils.GetLayersSuccess<MiddlewareDependencies>>
|
|
311
|
-
| Layer.Context<typeof make.contextProvider.Default>
|
|
368
|
+
| MakeMiddlewareE // what the middleware construction can fail with
|
|
369
|
+
| Layer.Error<typeof make.contextProvider.Default>, // what could go wrong when building the context provider
|
|
370
|
+
| LayersUtils.GetLayersContext<MiddlewareDependencies> // what's needed to build layers
|
|
371
|
+
| Exclude<MakeMiddlewareR, LayersUtils.GetLayersSuccess<MiddlewareDependencies>> // what layers provides
|
|
372
|
+
| Layer.Context<typeof make.contextProvider.Default> // what's needed to build the contextProvider
|
|
312
373
|
>
|
|
313
374
|
|
|
314
375
|
return Object.assign(MiddlewareMaker, { Default: middlewareLayer })
|
|
@@ -317,7 +378,6 @@ export const makeMiddleware =
|
|
|
317
378
|
// it just provides the right types without cluttering the implementation with them
|
|
318
379
|
function makeRpcEffect<
|
|
319
380
|
RequestContextMap extends Record<string, RPCContextMap.Any>,
|
|
320
|
-
MiddlewareR,
|
|
321
381
|
ContextProviderA
|
|
322
382
|
>() {
|
|
323
383
|
return (
|
|
@@ -345,11 +405,11 @@ function makeRpcEffect<
|
|
|
345
405
|
Request.Request.Success<Req>,
|
|
346
406
|
Request.Request.Error<Req> | RequestContextMapErrors<RequestContextMap>,
|
|
347
407
|
| HttpRouter.HttpRouter.Provided // the context provider may require HttpRouter.Provided to run
|
|
348
|
-
| Exclude<MiddlewareR, ContextProviderA> // for sure ContextProviderA is provided, so it can be removed from the MiddlewareR\
|
|
349
408
|
| Exclude<
|
|
409
|
+
// it can also be removed from HandlerR
|
|
350
410
|
Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>,
|
|
351
411
|
ContextProviderA
|
|
352
|
-
>
|
|
412
|
+
>
|
|
353
413
|
>
|
|
354
414
|
) => cb
|
|
355
415
|
}
|
package/src/api/routing.ts
CHANGED
|
@@ -137,8 +137,7 @@ type Match<
|
|
|
137
137
|
Resource extends Record<string, any>,
|
|
138
138
|
RequestContextMap extends Record<string, any>,
|
|
139
139
|
RT extends RequestType,
|
|
140
|
-
Key extends keyof Resource
|
|
141
|
-
MiddlewareR
|
|
140
|
+
Key extends keyof Resource
|
|
142
141
|
> = {
|
|
143
142
|
// note: the defaults of = never prevent the whole router to error (??)
|
|
144
143
|
<A extends GetSuccessShape<Resource[Key], RT>, R2 = never, E = never>(
|
|
@@ -147,7 +146,7 @@ type Match<
|
|
|
147
146
|
Resource[Key],
|
|
148
147
|
RT,
|
|
149
148
|
Exclude<
|
|
150
|
-
|
|
149
|
+
Exclude<R2, GetEffectContext<RequestContextMap, Resource[Key]["config"]>>,
|
|
151
150
|
HttpRouter.HttpRouter.Provided
|
|
152
151
|
>
|
|
153
152
|
>
|
|
@@ -158,7 +157,7 @@ type Match<
|
|
|
158
157
|
Resource[Key],
|
|
159
158
|
RT,
|
|
160
159
|
Exclude<
|
|
161
|
-
|
|
160
|
+
Exclude<R2, GetEffectContext<RequestContextMap, Resource[Key]["config"]>>,
|
|
162
161
|
HttpRouter.HttpRouter.Provided
|
|
163
162
|
>
|
|
164
163
|
>
|
|
@@ -166,15 +165,14 @@ type Match<
|
|
|
166
165
|
|
|
167
166
|
export type RouteMatcher<
|
|
168
167
|
RequestContextMap extends Record<string, any>,
|
|
169
|
-
Resource extends Record<string, any
|
|
170
|
-
MiddlewareR
|
|
168
|
+
Resource extends Record<string, any>
|
|
171
169
|
> = {
|
|
172
170
|
// use Resource as Key over using Keys, so that the Go To on X.Action remain in tact in Controllers files
|
|
173
171
|
/**
|
|
174
172
|
* Requires the Type shape
|
|
175
173
|
*/
|
|
176
174
|
[Key in keyof FilterRequestModules<Resource>]:
|
|
177
|
-
& Match<Resource, RequestContextMap, RequestTypes.DECODED, Key
|
|
175
|
+
& Match<Resource, RequestContextMap, RequestTypes.DECODED, Key>
|
|
178
176
|
& {
|
|
179
177
|
success: Resource[Key]["success"]
|
|
180
178
|
successRaw: S.SchemaClass<S.Schema.Encoded<Resource[Key]["success"]>>
|
|
@@ -182,21 +180,19 @@ export type RouteMatcher<
|
|
|
182
180
|
/**
|
|
183
181
|
* Requires the Encoded shape (e.g directly undecoded from DB, so that we don't do multiple Decode/Encode)
|
|
184
182
|
*/
|
|
185
|
-
raw: Match<Resource, RequestContextMap, RequestTypes.TYPE, Key
|
|
183
|
+
raw: Match<Resource, RequestContextMap, RequestTypes.TYPE, Key>
|
|
186
184
|
}
|
|
187
185
|
}
|
|
188
186
|
|
|
189
187
|
export class Router extends HttpRouter.Tag("@effect-app/Rpc")<Router>() {}
|
|
190
188
|
|
|
191
189
|
export const makeRouter = <
|
|
192
|
-
MiddlewareR,
|
|
193
190
|
RequestContextMap extends Record<string, RPCContextMap.Any>,
|
|
194
191
|
MakeMiddlewareE,
|
|
195
192
|
MakeMiddlewareR,
|
|
196
193
|
ContextProviderA
|
|
197
194
|
>(
|
|
198
195
|
middleware: Middleware<
|
|
199
|
-
MiddlewareR,
|
|
200
196
|
RequestContextMap,
|
|
201
197
|
MakeMiddlewareE,
|
|
202
198
|
MakeMiddlewareR,
|
|
@@ -323,7 +319,7 @@ export const makeRouter = <
|
|
|
323
319
|
})
|
|
324
320
|
return prev
|
|
325
321
|
},
|
|
326
|
-
{} as RouteMatcher<RequestContextMap, Resource
|
|
322
|
+
{} as RouteMatcher<RequestContextMap, Resource>
|
|
327
323
|
)
|
|
328
324
|
|
|
329
325
|
const router: AddAction<RequestModules[keyof RequestModules]> = {
|
|
@@ -347,8 +343,7 @@ export const makeRouter = <
|
|
|
347
343
|
FilterRequestModules<Resource>[K],
|
|
348
344
|
Impl[K] extends { raw: any } ? RequestTypes.TYPE : RequestTypes.DECODED,
|
|
349
345
|
Exclude<
|
|
350
|
-
|
|
351
|
-
| Exclude<
|
|
346
|
+
Exclude<
|
|
352
347
|
// retrieves context R from the actual implementation of the handler
|
|
353
348
|
Impl[K] extends { raw: any } ? Impl[K]["raw"] extends (...args: any[]) => Effect<any, any, infer R> ? R
|
|
354
349
|
: Impl[K]["raw"] extends Effect<any, any, infer R> ? R
|
|
@@ -499,8 +494,7 @@ export const makeRouter = <
|
|
|
499
494
|
Effect.Success<ReturnType<THandlers[K]["handler"]>>,
|
|
500
495
|
| Effect.Error<ReturnType<THandlers[K]["handler"]>>
|
|
501
496
|
| GetEffectError<RequestContextMap, Resource[K]["config"]>,
|
|
502
|
-
|
|
503
|
-
| Exclude<
|
|
497
|
+
Exclude<
|
|
504
498
|
Effect.Context<ReturnType<THandlers[K]["handler"]>>,
|
|
505
499
|
ContextProviderA | GetEffectContext<RequestContextMap, Resource[K]["config"]>
|
|
506
500
|
>
|
|
@@ -823,7 +817,7 @@ export const makeRouter = <
|
|
|
823
817
|
RouterShape<Resource>,
|
|
824
818
|
`${ModuleName}Router`,
|
|
825
819
|
never,
|
|
826
|
-
|
|
820
|
+
never
|
|
827
821
|
> // | Exclude<
|
|
828
822
|
// RPCRouteR<
|
|
829
823
|
// { [K in keyof Filter<Resource>]: Rpc.Rpc<Resource[K], Effect.Context<ReturnType<THandlers[K]["handler"]>>> }[keyof Filter<Resource>]
|
package/test/controller.test.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/api/routing"
|
|
4
4
|
import type { RequestContext } from "@effect-app/infra/RequestContext"
|
|
5
5
|
import { expectTypeOf } from "@effect/vitest"
|
|
6
|
-
import {
|
|
6
|
+
import { Context, Effect, Layer, S } from "effect-app"
|
|
7
7
|
import { type GetEffectContext, InvalidStateError, makeRpcClient, type RPCContextMap, UnauthorizedError } from "effect-app/client"
|
|
8
8
|
import { HttpServerRequest } from "effect-app/http"
|
|
9
9
|
import { Class, TaggedError } from "effect-app/Schema"
|
|
10
|
-
import { ContextProvider, makeMiddleware, mergeContextProviders } from "../src/api/routing/DynamicMiddleware.js"
|
|
10
|
+
import { ContextProvider, makeMiddleware, mergeContextProviders, MergedContextProvider } from "../src/api/routing/DynamicMiddleware.js"
|
|
11
11
|
import { SomeService } from "./query.test.js"
|
|
12
12
|
|
|
13
13
|
class UserProfile extends Context.assignTag<UserProfile, UserProfile>("UserProfile")(
|
|
@@ -21,19 +21,32 @@ class NotLoggedInError extends TaggedError<NotLoggedInError>()("NotLoggedInError
|
|
|
21
21
|
message: S.String
|
|
22
22
|
}) {}
|
|
23
23
|
|
|
24
|
+
export class CustomError1 extends TaggedError<NotLoggedInError>()("CustomError1", {}) {}
|
|
25
|
+
export class CustomError2 extends TaggedError<NotLoggedInError>()("CustomError1", {}) {}
|
|
26
|
+
|
|
24
27
|
export interface CTX {
|
|
25
28
|
context: RequestContext
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export class Some extends Context.TagMakeId("Some", Effect.succeed({ a: 1 }))<Some>() {}
|
|
32
|
+
export class SomeElse extends Context.TagMakeId("SomeElse", Effect.succeed({ b: 2 }))<SomeElse>() {}
|
|
29
33
|
|
|
30
34
|
// @effect-diagnostics-next-line missingEffectServiceDependency:off
|
|
31
35
|
const contextProvider = ContextProvider({
|
|
32
36
|
effect: Effect.gen(function*() {
|
|
33
37
|
yield* SomeService
|
|
38
|
+
if (Math.random() > 0.5) return yield* new CustomError1()
|
|
39
|
+
|
|
34
40
|
return Effect.gen(function*() {
|
|
41
|
+
// the only requirements you can have are the one provided by HttpRouter.HttpRouter.Provided
|
|
35
42
|
yield* HttpServerRequest.HttpServerRequest
|
|
36
|
-
|
|
43
|
+
|
|
44
|
+
// not allowed
|
|
45
|
+
// yield* SomeElse
|
|
46
|
+
|
|
47
|
+
// currently the effectful context provider cannot trigger an error when building the per request context
|
|
48
|
+
// if (Math.random() > 0.5) return yield* new CustomError2()
|
|
49
|
+
|
|
37
50
|
return Context.make(Some, new Some({ a: 1 }))
|
|
38
51
|
})
|
|
39
52
|
})
|
|
@@ -43,9 +56,19 @@ const contextProvider = ContextProvider({
|
|
|
43
56
|
class MyContextProvider extends Effect.Service<MyContextProvider>()("MyContextProvider", {
|
|
44
57
|
effect: Effect.gen(function*() {
|
|
45
58
|
yield* SomeService
|
|
59
|
+
if (Math.random() > 0.5) return yield* new CustomError1()
|
|
60
|
+
|
|
46
61
|
return Effect.gen(function*() {
|
|
62
|
+
// the only requirements you can have are the one provided by HttpRouter.HttpRouter.Provided
|
|
47
63
|
yield* HttpServerRequest.HttpServerRequest
|
|
48
|
-
|
|
64
|
+
|
|
65
|
+
// this is allowed here but mergeContextProviders/MergedContextProvider will trigger an error
|
|
66
|
+
// yield* SomeElse
|
|
67
|
+
|
|
68
|
+
// currently the effectful context provider cannot trigger an error when building the per request context
|
|
69
|
+
// this is allowed here but mergeContextProviders/MergedContextProvider will trigger an error
|
|
70
|
+
// if (Math.random() > 0.5) return yield* new CustomError2()
|
|
71
|
+
|
|
49
72
|
return Context.make(Some, new Some({ a: 1 }))
|
|
50
73
|
})
|
|
51
74
|
})
|
|
@@ -53,6 +76,10 @@ class MyContextProvider extends Effect.Service<MyContextProvider>()("MyContextPr
|
|
|
53
76
|
|
|
54
77
|
const merged = mergeContextProviders(MyContextProvider)
|
|
55
78
|
export const contextProvider2 = ContextProvider(merged)
|
|
79
|
+
export const contextProvider3 = MergedContextProvider(MyContextProvider)
|
|
80
|
+
|
|
81
|
+
expectTypeOf(contextProvider2).toEqualTypeOf<typeof contextProvider>()
|
|
82
|
+
expectTypeOf(contextProvider3).toEqualTypeOf<typeof contextProvider2>()
|
|
56
83
|
|
|
57
84
|
export type RequestContextMap = {
|
|
58
85
|
allowAnonymous: RPCContextMap.Inverted<"userProfile", UserProfile, typeof NotLoggedInError>
|
|
@@ -63,7 +90,7 @@ export type RequestContextMap = {
|
|
|
63
90
|
const Str = Context.GenericTag<"str", "str">("str")
|
|
64
91
|
const Str2 = Context.GenericTag<"str2", "str">("str2")
|
|
65
92
|
|
|
66
|
-
const middleware = makeMiddleware<RequestContextMap
|
|
93
|
+
const middleware = makeMiddleware<RequestContextMap>()({
|
|
67
94
|
dependencies: [Layer.effect(Str2, Str)],
|
|
68
95
|
contextProvider,
|
|
69
96
|
execute: (maker) =>
|
|
@@ -76,11 +103,12 @@ const middleware = makeMiddleware<RequestContextMap, HttpServerRequest.HttpServe
|
|
|
76
103
|
Context.add(UserProfile, { id: "whatever" })
|
|
77
104
|
)
|
|
78
105
|
|
|
79
|
-
// you can use only
|
|
80
|
-
//
|
|
106
|
+
// you can use only HttpRouter.HttpRouter.Provided here as additional context
|
|
107
|
+
// and what ContextMaker provides too
|
|
108
|
+
// const someElse = yield* SomeElse
|
|
81
109
|
|
|
82
|
-
|
|
83
|
-
yield*
|
|
110
|
+
yield* Some // provided by ContextMaker
|
|
111
|
+
yield* HttpServerRequest.HttpServerRequest // provided by HttpRouter.HttpRouter.Provided
|
|
84
112
|
|
|
85
113
|
return yield* handler(req, headers).pipe(
|
|
86
114
|
Effect.provide(ctx as Context.Context<GetEffectContext<RequestContextMap, (typeof _schema)["config"]>>)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../controller.test.ts"],"names":[],"mappings":"AA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