@effect-app/infra 2.85.0 → 2.87.0
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 +17 -0
- package/dist/api/layerUtils.d.ts +4 -8
- package/dist/api/layerUtils.d.ts.map +1 -1
- package/dist/api/layerUtils.js +3 -11
- package/dist/api/routing/middleware/ContextProvider.d.ts +2 -2
- package/dist/api/routing/middleware/ContextProvider.d.ts.map +1 -1
- package/dist/api/routing/middleware/RouterMiddleware.d.ts +33 -0
- package/dist/api/routing/middleware/RouterMiddleware.d.ts.map +1 -0
- package/dist/api/routing/middleware/RouterMiddleware.js +5 -0
- package/dist/api/routing/middleware/RpcMiddleware.d.ts +199 -0
- package/dist/api/routing/middleware/RpcMiddleware.d.ts.map +1 -0
- package/dist/api/routing/middleware/RpcMiddleware.js +14 -0
- package/dist/api/routing/middleware/dynamic-middleware.d.ts +3 -13
- package/dist/api/routing/middleware/dynamic-middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware/dynamic-middleware.js +2 -18
- package/dist/api/routing/middleware/generic-middleware.d.ts +15 -22
- package/dist/api/routing/middleware/generic-middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware/generic-middleware.js +13 -9
- package/dist/api/routing/middleware/middleware-api.d.ts +55 -8
- package/dist/api/routing/middleware/middleware-api.d.ts.map +1 -1
- package/dist/api/routing/middleware/middleware-api.js +50 -14
- package/dist/api/routing/middleware/middleware.d.ts +8 -7
- package/dist/api/routing/middleware/middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware/middleware.js +6 -5
- package/dist/api/routing/middleware.d.ts +2 -1
- package/dist/api/routing/middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware.js +3 -2
- package/dist/api/routing/tsort.d.ts +2 -2
- package/dist/api/routing/tsort.d.ts.map +1 -1
- package/dist/api/routing/tsort.js +1 -1
- package/dist/api/routing.d.ts +0 -1
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +2 -3
- package/package.json +9 -5
- package/src/api/layerUtils.ts +7 -21
- package/src/api/routing/middleware/ContextProvider.ts +5 -5
- package/src/api/routing/middleware/RouterMiddleware.ts +149 -0
- package/src/api/routing/middleware/RpcMiddleware.ts +287 -0
- package/src/api/routing/middleware/dynamic-middleware.ts +9 -54
- package/src/api/routing/middleware/generic-middleware.ts +33 -33
- package/src/api/routing/middleware/middleware-api.ts +202 -32
- package/src/api/routing/middleware/middleware.ts +13 -5
- package/src/api/routing/middleware.ts +2 -1
- package/src/api/routing/tsort.ts +2 -2
- package/src/api/routing.ts +1 -9
- package/test/contextProvider.test.ts +1 -2
- package/test/controller.test.ts +35 -155
- package/test/dist/contextProvider.test.d.ts.map +1 -1
- package/test/dist/controller.test.d.ts.map +1 -1
- package/test/dist/fixtures.d.ts +146 -0
- package/test/dist/fixtures.d.ts.map +1 -0
- package/test/dist/fixtures.js +82 -0
- package/test/dist/layerUtils.test.d.ts.map +1 -0
- package/test/dist/query.test.d.ts.map +1 -1
- package/test/dist/requires.d.ts +21 -0
- package/test/dist/requires.d.ts.map +1 -0
- package/test/dist/requires.js +27 -0
- package/test/dist/requires.test.d.ts.map +1 -0
- package/test/fixtures.ts +102 -0
- package/test/layerUtils.test.ts +19 -0
- package/test/query.test.ts +2 -4
- package/test/requires.test.ts +156 -0
- package/dist/api/routing/middleware/DynamicMiddleware.d.ts +0 -215
- package/dist/api/routing/middleware/DynamicMiddleware.d.ts.map +0 -1
- package/dist/api/routing/middleware/DynamicMiddleware.js +0 -168
- package/src/api/routing/middleware/DynamicMiddleware.ts +0 -693
package/test/fixtures.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Context, Effect, Option, S, Scope } from "effect-app"
|
|
2
|
+
import { NotLoggedInError, type RPCContextMap, UnauthorizedError } from "effect-app/client"
|
|
3
|
+
import { TaggedError } from "effect-app/Schema"
|
|
4
|
+
import { contextMap, Middleware } from "../src/api/routing.js"
|
|
5
|
+
|
|
6
|
+
export class UserProfile extends Context.assignTag<UserProfile, UserProfile>("UserProfile")(
|
|
7
|
+
S.Class<UserProfile>("UserProfile")({
|
|
8
|
+
id: S.String,
|
|
9
|
+
roles: S.Array(S.String)
|
|
10
|
+
})
|
|
11
|
+
) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class Some extends Context.TagMakeId("Some", Effect.succeed({ a: 1 }))<Some>() {}
|
|
15
|
+
export class SomeElse extends Context.TagMakeId("SomeElse", Effect.succeed({ b: 2 }))<SomeElse>() {}
|
|
16
|
+
|
|
17
|
+
export type RequestContextMap = {
|
|
18
|
+
allowAnonymous: RPCContextMap.Inverted<[typeof UserProfile], typeof NotLoggedInError>
|
|
19
|
+
requireRoles: RPCContextMap.Custom<never, typeof UnauthorizedError, Array<string>>
|
|
20
|
+
test: RPCContextMap<never, typeof S.Never>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class AllowAnonymous extends Middleware.Tag<AllowAnonymous>()("AllowAnonymous", {
|
|
24
|
+
dynamic: contextMap<RequestContextMap>()("allowAnonymous", [UserProfile]),
|
|
25
|
+
requires: SomeElse
|
|
26
|
+
})({
|
|
27
|
+
effect: Effect.gen(function*() {
|
|
28
|
+
return Effect.fnUntraced(
|
|
29
|
+
function*({ config, headers }) {
|
|
30
|
+
yield* SomeElse
|
|
31
|
+
yield* Scope.Scope // provided by HttpRouter.HttpRouter.Provided
|
|
32
|
+
const isLoggedIn = !!headers["x-user"]
|
|
33
|
+
if (!isLoggedIn) {
|
|
34
|
+
if (!config.allowAnonymous) {
|
|
35
|
+
return yield* new NotLoggedInError({ message: "Not logged in" })
|
|
36
|
+
}
|
|
37
|
+
return Option.none()
|
|
38
|
+
}
|
|
39
|
+
return Option.some(
|
|
40
|
+
Context.make(
|
|
41
|
+
UserProfile,
|
|
42
|
+
new UserProfile({
|
|
43
|
+
id: "whatever",
|
|
44
|
+
roles: ["user", ...headers["x-is-manager"] === "true" ? ["manager"] : []]
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
})
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// @effect-diagnostics-next-line missingEffectServiceDependency:off
|
|
55
|
+
export class RequireRoles extends Middleware.Tag<RequireRoles>()("RequireRoles", {
|
|
56
|
+
dynamic: contextMap<RequestContextMap>()("requireRoles", null as never), // TODO
|
|
57
|
+
wrap: true,
|
|
58
|
+
// wrap: true,
|
|
59
|
+
// had to move this in here, because once you put it manually as a readonly static property on the class,
|
|
60
|
+
// there's a weird issue where the fluent api stops behaving properly after adding this middleware via `addDynamicMiddleware`
|
|
61
|
+
dependsOn: [AllowAnonymous]
|
|
62
|
+
})({
|
|
63
|
+
effect: Effect.gen(function*() {
|
|
64
|
+
yield* Some
|
|
65
|
+
return Effect.fnUntraced(
|
|
66
|
+
function*({ config, next }) {
|
|
67
|
+
// we don't know if the service will be provided or not, so we use option..
|
|
68
|
+
const userProfile = yield* Effect.serviceOption(UserProfile)
|
|
69
|
+
const { requireRoles } = config
|
|
70
|
+
console.dir(
|
|
71
|
+
{
|
|
72
|
+
userProfile,
|
|
73
|
+
requireRoles
|
|
74
|
+
},
|
|
75
|
+
{ depth: 5 }
|
|
76
|
+
)
|
|
77
|
+
if (requireRoles && !userProfile.value?.roles?.some((role) => requireRoles.includes(role))) {
|
|
78
|
+
return yield* new UnauthorizedError({ message: "don't have the right roles" })
|
|
79
|
+
}
|
|
80
|
+
return yield* next
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
})
|
|
84
|
+
}) {
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export class Test extends Middleware.Tag<Test>()("Test", {
|
|
88
|
+
wrap: true,
|
|
89
|
+
dynamic: contextMap<RequestContextMap>()("test", null as never) // TODO
|
|
90
|
+
})({
|
|
91
|
+
effect: Effect.gen(function*() {
|
|
92
|
+
return Effect.fn(function*({ next }) {
|
|
93
|
+
return yield* next
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}) {}
|
|
97
|
+
|
|
98
|
+
export class CustomError1 extends TaggedError<NotLoggedInError>()("CustomError1", {}) {}
|
|
99
|
+
export class CustomError2 extends TaggedError<NotLoggedInError>()("CustomError1", {}) {}
|
|
100
|
+
|
|
101
|
+
const MakeSomeService = Effect.succeed({ a: 1 })
|
|
102
|
+
export class SomeService extends Context.TagMakeId("SomeService", MakeSomeService)<SomeService>() {}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { it } from "@effect/vitest"
|
|
2
|
+
import { type Layer } from "effect"
|
|
3
|
+
import { expectTypeOf } from "vitest/index.cjs"
|
|
4
|
+
import { type LayerUtils } from "../src/api/layerUtils.js"
|
|
5
|
+
|
|
6
|
+
it("works", () => {
|
|
7
|
+
type B = (Layer.Layer<void, "error-a", "a"> | Layer.Layer<void, "error-b", "b">)[]
|
|
8
|
+
type C = LayerUtils.GetLayersContext<B>
|
|
9
|
+
type CE = LayerUtils.GetLayersError<B>
|
|
10
|
+
|
|
11
|
+
expectTypeOf({} as C).toEqualTypeOf<"a" | "b">()
|
|
12
|
+
expectTypeOf({} as CE).toEqualTypeOf<"error-a" | "error-b">()
|
|
13
|
+
|
|
14
|
+
type B2 = [Layer.Layer<void, "error-a", "a">, Layer.Layer<void, "error-b", "b"> | Layer.Layer<void, "error-c", "c">]
|
|
15
|
+
type C2 = LayerUtils.GetLayersContext<B2>
|
|
16
|
+
type CE2 = LayerUtils.GetLayersError<B2>
|
|
17
|
+
expectTypeOf({} as C2).toEqualTypeOf<"a" | "b" | "c">()
|
|
18
|
+
expectTypeOf({} as CE2).toEqualTypeOf<"error-a" | "error-b" | "error-c">()
|
|
19
|
+
})
|
package/test/query.test.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import {
|
|
4
|
+
import { Effect, flow, Layer, Option, pipe, S, Struct } from "effect-app"
|
|
5
5
|
import { inspect } from "util"
|
|
6
6
|
import { expect, expectTypeOf, it } from "vitest"
|
|
7
7
|
import { setupRequestContextFromCurrent } from "../src/api/setupRequest.js"
|
|
8
8
|
import { and, count, make, one, or, order, page, project, type QueryEnd, type QueryProjection, type QueryWhere, toFilter, where } from "../src/Model/query.js"
|
|
9
9
|
import { makeRepo } from "../src/Model/Repository.js"
|
|
10
10
|
import { memFilter, MemoryStoreLive } from "../src/Store/Memory.js"
|
|
11
|
+
import { SomeService } from "./fixtures.js"
|
|
11
12
|
|
|
12
13
|
const str = S.Struct({ _tag: S.Literal("string"), value: S.String })
|
|
13
14
|
const num = S.Struct({ _tag: S.Literal("number"), value: S.Number })
|
|
@@ -25,9 +26,6 @@ export declare namespace Something {
|
|
|
25
26
|
export interface Encoded extends S.Schema.Encoded<typeof Something> {}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const MakeSomeService = Effect.succeed({ a: 1 })
|
|
29
|
-
export class SomeService extends Context.TagMakeId("SomeService", MakeSomeService)<SomeService>() {}
|
|
30
|
-
|
|
31
29
|
const q = make<Something.Encoded>()
|
|
32
30
|
.pipe( // provided automatically inside Repo.q2()
|
|
33
31
|
where("displayName", "Verona"),
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { expect, expectTypeOf, it } from "@effect/vitest"
|
|
2
|
+
import { Effect, Either, Layer, S } from "effect-app"
|
|
3
|
+
import { NotLoggedInError, UnauthorizedError } from "effect-app/client"
|
|
4
|
+
import { makeMiddleware, Middleware } from "../src/api/routing.js"
|
|
5
|
+
import { AllowAnonymous, type RequestContextMap, RequireRoles, Some, SomeElse, Test } from "./fixtures.js"
|
|
6
|
+
|
|
7
|
+
export class SomeMiddleware extends Middleware.Tag<SomeMiddleware>()("SomeMiddleware", {
|
|
8
|
+
provides: Some
|
|
9
|
+
})({
|
|
10
|
+
effect: Effect.gen(function*() {
|
|
11
|
+
// yield* Effect.context<"test-dep">()
|
|
12
|
+
return () =>
|
|
13
|
+
Effect.gen(function*() {
|
|
14
|
+
return new Some({ a: 1 })
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class SomeElseMiddleware extends Middleware.Tag<SomeElseMiddleware>()("SomeElseMiddleware", {
|
|
21
|
+
provides: SomeElse,
|
|
22
|
+
wrap: true
|
|
23
|
+
})({
|
|
24
|
+
effect: Effect.gen(function*() {
|
|
25
|
+
// yield* Effect.context<"test-dep">()
|
|
26
|
+
return ({ next }) =>
|
|
27
|
+
Effect.gen(function*() {
|
|
28
|
+
// yield* Effect.context<"test-dep2">()
|
|
29
|
+
return yield* next.pipe(Effect.provideService(SomeElse, new SomeElse({ b: 2 })))
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
}) {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class RequiresSomeMiddleware extends Middleware.Tag<RequiresSomeMiddleware>()("RequiresSomeMiddleware", {
|
|
36
|
+
requires: [Some],
|
|
37
|
+
wrap: true
|
|
38
|
+
})({
|
|
39
|
+
effect: Effect.gen(function*() {
|
|
40
|
+
// yield* Effect.context<"test-dep">()
|
|
41
|
+
return ({ next }) =>
|
|
42
|
+
Effect.gen(function*() {
|
|
43
|
+
yield* Some
|
|
44
|
+
// yield* Effect.context<"test-dep2">()
|
|
45
|
+
return yield* next
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
}) {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
it("requires gets enforced", async () => {
|
|
52
|
+
const middleware3 = makeMiddleware<RequestContextMap>()
|
|
53
|
+
.middleware(RequiresSomeMiddleware)
|
|
54
|
+
.middleware(SomeMiddleware)
|
|
55
|
+
.middleware(RequireRoles)
|
|
56
|
+
.middleware(AllowAnonymous, Test)
|
|
57
|
+
.middleware(SomeElseMiddleware)
|
|
58
|
+
|
|
59
|
+
const layer = middleware3.Default.pipe(Layer.provide(Layer.succeed(Some, new Some({ a: 1 }))))
|
|
60
|
+
|
|
61
|
+
type Default = typeof middleware3["Default"]
|
|
62
|
+
type LayerContext = Layer.Layer.Context<Default>
|
|
63
|
+
expectTypeOf({} as LayerContext).toEqualTypeOf<Some>()
|
|
64
|
+
|
|
65
|
+
await Effect
|
|
66
|
+
.gen(function*() {
|
|
67
|
+
const mw = yield* middleware3
|
|
68
|
+
const mwM = mw.effect(
|
|
69
|
+
Object.assign({}, S.Any, { config: { requireRoles: ["manager"] } }),
|
|
70
|
+
(_req) => Effect.void,
|
|
71
|
+
"some-module"
|
|
72
|
+
)
|
|
73
|
+
yield* mwM({}, { "x-user": "test-user", "x-is-manager": "true" })
|
|
74
|
+
})
|
|
75
|
+
.pipe(
|
|
76
|
+
Effect.scoped,
|
|
77
|
+
Effect.provide(layer),
|
|
78
|
+
Effect.runPromise
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
await Effect
|
|
82
|
+
.gen(function*() {
|
|
83
|
+
const mw = yield* middleware3
|
|
84
|
+
const mwM = mw.effect(
|
|
85
|
+
Object.assign({}, S.Any, { config: { allowAnonymous: true } }),
|
|
86
|
+
(_req) => Effect.void,
|
|
87
|
+
"some-module"
|
|
88
|
+
)
|
|
89
|
+
yield* mwM({}, {})
|
|
90
|
+
})
|
|
91
|
+
.pipe(
|
|
92
|
+
Effect.scoped,
|
|
93
|
+
Effect.provide(layer),
|
|
94
|
+
Effect.runPromise
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
expect(
|
|
98
|
+
await Effect
|
|
99
|
+
.gen(function*() {
|
|
100
|
+
const mw = yield* middleware3
|
|
101
|
+
const mwM = mw.effect(
|
|
102
|
+
Object.assign({}, S.Any, { config: {} }),
|
|
103
|
+
(_req) => Effect.void,
|
|
104
|
+
"some-module"
|
|
105
|
+
)
|
|
106
|
+
yield* mwM({}, {})
|
|
107
|
+
})
|
|
108
|
+
.pipe(
|
|
109
|
+
Effect.scoped,
|
|
110
|
+
Effect.provide(layer),
|
|
111
|
+
Effect.either,
|
|
112
|
+
Effect.runPromise
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
.toEqual(Either.left(new NotLoggedInError()))
|
|
116
|
+
|
|
117
|
+
expect(
|
|
118
|
+
await Effect
|
|
119
|
+
.gen(function*() {
|
|
120
|
+
const mw = yield* middleware3
|
|
121
|
+
const mwM = mw.effect(
|
|
122
|
+
Object.assign({}, S.Any, { config: { requireRoles: ["manager"] } }),
|
|
123
|
+
(_req) => Effect.void,
|
|
124
|
+
"some-module"
|
|
125
|
+
)
|
|
126
|
+
yield* mwM({}, {})
|
|
127
|
+
})
|
|
128
|
+
.pipe(
|
|
129
|
+
Effect.scoped,
|
|
130
|
+
Effect.provide(layer),
|
|
131
|
+
Effect.either,
|
|
132
|
+
Effect.runPromise
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
.toEqual(Either.left(new NotLoggedInError()))
|
|
136
|
+
|
|
137
|
+
expect(
|
|
138
|
+
await Effect
|
|
139
|
+
.gen(function*() {
|
|
140
|
+
const mw = yield* middleware3
|
|
141
|
+
const mwM = mw.effect(
|
|
142
|
+
Object.assign({}, S.Any, { config: { requireRoles: ["manager"] } }),
|
|
143
|
+
(_req) => Effect.void,
|
|
144
|
+
"some-module"
|
|
145
|
+
)
|
|
146
|
+
yield* mwM({}, { "x-user": "test-user" })
|
|
147
|
+
})
|
|
148
|
+
.pipe(
|
|
149
|
+
Effect.scoped,
|
|
150
|
+
Effect.provide(layer),
|
|
151
|
+
Effect.either,
|
|
152
|
+
Effect.runPromise
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
.toEqual(Either.left(new UnauthorizedError({ message: "don't have the right roles" })))
|
|
156
|
+
})
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { Rpc, RpcMiddleware } from "@effect/rpc";
|
|
2
|
-
import { type SuccessValue, type TypeId } from "@effect/rpc/RpcMiddleware";
|
|
3
|
-
import { Context, Effect, Layer, type NonEmptyReadonlyArray, type Option, type Request, type S, type Schema, type Scope } from "effect-app";
|
|
4
|
-
import type { GetEffectContext, RPCContextMap } from "effect-app/client/req";
|
|
5
|
-
import { type HttpHeaders } from "effect-app/http";
|
|
6
|
-
import type * as EffectRequest from "effect/Request";
|
|
7
|
-
import { type ContextTagWithDefault, type LayerUtils } from "../../layerUtils.js";
|
|
8
|
-
import { type ContextWithLayer } from "./dynamic-middleware.js";
|
|
9
|
-
import { type ContextRepr, type GenericMiddlewareMaker } from "./generic-middleware.js";
|
|
10
|
-
export type MakeRPCHandlerFactory<RequestContextMap extends Record<string, RPCContextMap.Any>, MiddlewareR> = <T extends {
|
|
11
|
-
config?: Partial<Record<keyof RequestContextMap, any>>;
|
|
12
|
-
}, Req extends S.TaggedRequest.All, HandlerR>(schema: T & S.Schema<Req, any, never>, next: (request: Req, headers: any) => Effect.Effect<EffectRequest.Request.Success<Req>, EffectRequest.Request.Error<Req>, Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>>, moduleName: string) => (req: Req, headers: any) => Effect.Effect<Request.Request.Success<Req>, Request.Request.Error<Req> | RequestContextMapErrors<RequestContextMap>, MiddlewareR | Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>>;
|
|
13
|
-
export type RPCHandlerFactory<RequestContextMap extends Record<string, RPCContextMap.Any>, ContextProviderA> = <T extends {
|
|
14
|
-
config?: Partial<Record<keyof RequestContextMap, any>>;
|
|
15
|
-
}, Req extends S.TaggedRequest.All, HandlerR>(schema: T & S.Schema<Req, any, never>, next: (request: Req, headers: any) => Effect.Effect<EffectRequest.Request.Success<Req>, EffectRequest.Request.Error<Req>, HandlerR>, moduleName: string) => (req: Req, headers: any) => Effect.Effect<Request.Request.Success<Req>, Request.Request.Error<Req> | RequestContextMapErrors<RequestContextMap>, Scope.Scope | Exclude<Exclude<HandlerR, GetEffectContext<RequestContextMap, (T & S.Schema<Req, any, never>)["config"]>>, ContextProviderA>>;
|
|
16
|
-
export type RequestContextMapProvider<RequestContextMap extends Record<string, RPCContextMap.Any>> = {
|
|
17
|
-
[K in keyof RequestContextMap]: ContextWithLayer.Base<{
|
|
18
|
-
[K in keyof RequestContextMap]?: RequestContextMap[K]["contextActivation"];
|
|
19
|
-
}, RequestContextMap[K]["service"], S.Schema.Type<RequestContextMap[K]["error"]>>;
|
|
20
|
-
};
|
|
21
|
-
export interface MiddlewareMake<RequestContextMap extends Record<string, RPCContextMap.Any>, // what services will the middleware provide dynamically to the next, or raise errors.
|
|
22
|
-
DynamicMiddlewareProviders extends RequestContextMapProvider<RequestContextMap>, // how to resolve the dynamic middleware
|
|
23
|
-
GenericMiddlewareProviders extends NonEmptyReadonlyArray<GenericMiddlewareMaker>, MakeMiddlewareE, // what the middleware construction can fail with
|
|
24
|
-
MakeMiddlewareR, // what the middleware requires to be constructed
|
|
25
|
-
MiddlewareDependencies extends NonEmptyReadonlyArray<Layer.Layer.Any>> {
|
|
26
|
-
dynamicMiddlewares: DynamicMiddlewareProviders;
|
|
27
|
-
/** generic middlewares are those which follow the (next) => (input, headers) => pattern */
|
|
28
|
-
genericMiddlewares: GenericMiddlewareProviders;
|
|
29
|
-
dependencies?: MiddlewareDependencies;
|
|
30
|
-
execute?: (maker: (cb: MakeRPCHandlerFactory<RequestContextMap, GenericMiddlewareMaker.Provided<GenericMiddlewareProviders[number]> | Scope.Scope>) => MakeRPCHandlerFactory<RequestContextMap, GenericMiddlewareMaker.Provided<GenericMiddlewareProviders[number]> | Scope.Scope>) => Effect<MakeRPCHandlerFactory<RequestContextMap, GenericMiddlewareMaker.Provided<GenericMiddlewareProviders[number]> | Scope.Scope>, MakeMiddlewareE, MakeMiddlewareR | Scope>;
|
|
31
|
-
}
|
|
32
|
-
export interface MiddlewareMakerId {
|
|
33
|
-
_tag: "MiddlewareMaker";
|
|
34
|
-
}
|
|
35
|
-
export type RouterMiddleware<RequestContextMap extends Record<string, RPCContextMap.Any>, // what services will the middlware provide dynamically to the next, or raise errors.
|
|
36
|
-
MakeMiddlewareE, // what the middleware construction can fail with
|
|
37
|
-
MakeMiddlewareR, // what the middlware requires to be constructed
|
|
38
|
-
ContextProviderA> = ContextTagWithDefault<MiddlewareMakerId, {
|
|
39
|
-
_tag: "MiddlewareMaker";
|
|
40
|
-
effect: RPCHandlerFactory<RequestContextMap, ContextProviderA>;
|
|
41
|
-
}, MakeMiddlewareE, MakeMiddlewareR>;
|
|
42
|
-
export type RequestContextMapErrors<RequestContextMap extends Record<string, RPCContextMap.Any>> = S.Schema.Type<RequestContextMap[keyof RequestContextMap]["error"]>;
|
|
43
|
-
export declare const makeMiddleware: <RequestContextMap extends Record<string, RPCContextMap.Any>>() => <RequestContextProviders extends RequestContextMapProvider<RequestContextMap>, // how to resolve the dynamic middleware
|
|
44
|
-
GenericMiddlewareProviders extends NonEmptyReadonlyArray<GenericMiddlewareMaker>, MiddlewareDependencies extends NonEmptyReadonlyArray<Layer.Layer.Any>, // layers provided for the middlware to be constructed
|
|
45
|
-
MakeMiddlewareE = never, // what the middleware construction can fail with
|
|
46
|
-
MakeMiddlewareR = never>(make: MiddlewareMake<RequestContextMap, RequestContextProviders, GenericMiddlewareProviders, MakeMiddlewareE, MakeMiddlewareR, MiddlewareDependencies>) => Context.Tag<MiddlewareMakerId, {
|
|
47
|
-
effect: RPCHandlerFactory<RequestContextMap, GenericMiddlewareMaker.Provided<GenericMiddlewareProviders[number]>>;
|
|
48
|
-
_tag: "MiddlewareMaker";
|
|
49
|
-
}> & {
|
|
50
|
-
Default: Layer.Layer<MiddlewareMakerId, MakeMiddlewareE | LayerUtils.GetLayersError<[...{ [K in keyof GenericMiddlewareProviders]: GenericMiddlewareProviders[K]["Default"]; }]>, LayerUtils.GetLayersContext<MiddlewareDependencies> | LayerUtils.GetLayersContext<[...{ [K in keyof GenericMiddlewareProviders]: GenericMiddlewareProviders[K]["Default"]; }]> | Exclude<MakeMiddlewareR, LayerUtils.GetLayersSuccess<MiddlewareDependencies>>>;
|
|
51
|
-
};
|
|
52
|
-
export declare const makeMiddlewareBasic: <RequestContextMap extends Record<string, RPCContextMap.Any>, RequestContextProviders extends RequestContextMapProvider<RequestContextMap>, // how to resolve the dynamic middleware
|
|
53
|
-
GenericMiddlewareProviders extends NonEmptyReadonlyArray<GenericMiddlewareMaker>>(make: MiddlewareMake<RequestContextMap, RequestContextProviders, GenericMiddlewareProviders, never, never, never>) => Context.Tag<MiddlewareMakerId, {
|
|
54
|
-
effect: RPCHandlerFactory<RequestContextMap, GenericMiddlewareMaker.Provided<GenericMiddlewareProviders[number]>>;
|
|
55
|
-
_tag: "MiddlewareMaker";
|
|
56
|
-
}> & {
|
|
57
|
-
Default: Layer.Layer<MiddlewareMakerId, LayerUtils.GetLayersError<[...{ [K in keyof GenericMiddlewareProviders]: GenericMiddlewareProviders[K]["Default"]; }]>, LayerUtils.GetLayersContext<[...{ [K in keyof GenericMiddlewareProviders]: GenericMiddlewareProviders[K]["Default"]; }]>>;
|
|
58
|
-
};
|
|
59
|
-
export interface RpcMiddleware<Provides, E> {
|
|
60
|
-
(options: {
|
|
61
|
-
readonly clientId: number;
|
|
62
|
-
readonly rpc: Rpc.AnyWithProps;
|
|
63
|
-
readonly payload: unknown;
|
|
64
|
-
readonly headers: HttpHeaders.Headers;
|
|
65
|
-
}): Effect.Effect<Provides, E, Scope.Scope>;
|
|
66
|
-
}
|
|
67
|
-
export interface RpcMiddlewareWrap<Provides, E> {
|
|
68
|
-
(options: {
|
|
69
|
-
readonly clientId: number;
|
|
70
|
-
readonly rpc: Rpc.AnyWithProps;
|
|
71
|
-
readonly payload: unknown;
|
|
72
|
-
readonly headers: HttpHeaders.Headers;
|
|
73
|
-
readonly next: Effect.Effect<SuccessValue, E, Provides | Scope.Scope>;
|
|
74
|
-
}): Effect.Effect<SuccessValue, E, Scope.Scope>;
|
|
75
|
-
}
|
|
76
|
-
type RpcOptionsOriginal = {
|
|
77
|
-
readonly wrap?: boolean;
|
|
78
|
-
readonly optional?: boolean;
|
|
79
|
-
readonly failure?: Schema.Schema.All;
|
|
80
|
-
readonly provides?: Context.Tag<any, any> | ContextRepr;
|
|
81
|
-
readonly requiredForClient?: boolean;
|
|
82
|
-
};
|
|
83
|
-
type RpcDynamic<Key extends string, A extends RPCContextMap.Any> = {
|
|
84
|
-
key: Key;
|
|
85
|
-
settings: A;
|
|
86
|
-
};
|
|
87
|
-
type RpcOptionsDynamic<Key extends string, A extends RPCContextMap.Any> = RpcOptionsOriginal & {
|
|
88
|
-
readonly dynamic: RpcDynamic<Key, A>;
|
|
89
|
-
readonly dependsOn?: NonEmptyReadonlyArray<TagClassDynamicAny<any>>;
|
|
90
|
-
};
|
|
91
|
-
export type Dynamic<Options> = Options extends RpcOptionsDynamic<any, any> ? true : false;
|
|
92
|
-
export interface RpcMiddlewareDynamic<A, E, Config> {
|
|
93
|
-
(options: {
|
|
94
|
-
readonly config: Config;
|
|
95
|
-
readonly clientId: number;
|
|
96
|
-
readonly rpc: Rpc.AnyWithProps;
|
|
97
|
-
readonly payload: unknown;
|
|
98
|
-
readonly headers: HttpHeaders.Headers;
|
|
99
|
-
}): Effect.Effect<Option.Option<Context.Context<A>>, E, Scope.Scope>;
|
|
100
|
-
}
|
|
101
|
-
export interface TagClassDynamicAny<RequestContext extends Record<string, RPCContextMap.Any>> extends Context.Tag<any, any> {
|
|
102
|
-
readonly [RpcMiddleware.TypeId]: RpcMiddleware.TypeId;
|
|
103
|
-
readonly optional: boolean;
|
|
104
|
-
readonly provides?: Context.Tag<any, any> | undefined;
|
|
105
|
-
readonly failure: Schema.Schema.All;
|
|
106
|
-
readonly requiredForClient: boolean;
|
|
107
|
-
readonly dynamic: RpcDynamic<any, RequestContext[keyof RequestContext]>;
|
|
108
|
-
readonly wrap: boolean;
|
|
109
|
-
readonly dependsOn?: any;
|
|
110
|
-
}
|
|
111
|
-
export declare namespace TagClass {
|
|
112
|
-
/**
|
|
113
|
-
* @since 1.0.0
|
|
114
|
-
* @category models
|
|
115
|
-
*/
|
|
116
|
-
type Provides<Options> = Options extends {
|
|
117
|
-
readonly provides: Context.Tag<any, any>;
|
|
118
|
-
readonly optional?: false;
|
|
119
|
-
} ? Context.Tag.Identifier<Options["provides"]> : Options extends {
|
|
120
|
-
readonly provides: ContextRepr;
|
|
121
|
-
readonly optional?: false;
|
|
122
|
-
} ? ContextRepr.Identifier<Options["provides"]> : never;
|
|
123
|
-
/**
|
|
124
|
-
* @since 1.0.0
|
|
125
|
-
* @category models
|
|
126
|
-
*/
|
|
127
|
-
type Service<Options> = Options extends {
|
|
128
|
-
readonly provides: Context.Tag<any, any>;
|
|
129
|
-
} ? Context.Tag.Service<Options["provides"]> : Options extends {
|
|
130
|
-
readonly dynamic: RpcDynamic<any, infer A>;
|
|
131
|
-
} ? A["service"] : Options extends {
|
|
132
|
-
readonly provides: ContextRepr;
|
|
133
|
-
} ? Context.Context<ContextRepr.Identifier<Options["provides"]>> : void;
|
|
134
|
-
/**
|
|
135
|
-
* @since 1.0.0
|
|
136
|
-
* @category models
|
|
137
|
-
*/
|
|
138
|
-
type FailureSchema<Options> = Options extends {
|
|
139
|
-
readonly failure: Schema.Schema.All;
|
|
140
|
-
readonly optional?: false;
|
|
141
|
-
} ? Options["failure"] : Options extends {
|
|
142
|
-
readonly dynamic: RpcDynamic<any, infer A>;
|
|
143
|
-
} ? A["error"] : typeof Schema.Never;
|
|
144
|
-
/**
|
|
145
|
-
* @since 1.0.0
|
|
146
|
-
* @category models
|
|
147
|
-
*/
|
|
148
|
-
type Failure<Options> = Options extends {
|
|
149
|
-
readonly failure: Schema.Schema<infer _A, infer _I, infer _R>;
|
|
150
|
-
readonly optional?: false;
|
|
151
|
-
} ? _A : Options extends {
|
|
152
|
-
readonly dynamic: RpcDynamic<any, infer A>;
|
|
153
|
-
} ? S.Schema.Type<A["error"]> : never;
|
|
154
|
-
/**
|
|
155
|
-
* @since 1.0.0
|
|
156
|
-
* @category models
|
|
157
|
-
*/
|
|
158
|
-
type FailureContext<Options> = Schema.Schema.Context<FailureSchema<Options>>;
|
|
159
|
-
/**
|
|
160
|
-
* @since 1.0.0
|
|
161
|
-
* @category models
|
|
162
|
-
*/
|
|
163
|
-
type FailureService<Options> = Optional<Options> extends true ? unknown : Failure<Options>;
|
|
164
|
-
/**
|
|
165
|
-
* @since 1.0.0
|
|
166
|
-
* @category models
|
|
167
|
-
*/
|
|
168
|
-
type Optional<Options> = Options extends {
|
|
169
|
-
readonly optional: true;
|
|
170
|
-
} ? true : false;
|
|
171
|
-
/**
|
|
172
|
-
* @since 1.0.0
|
|
173
|
-
* @category models
|
|
174
|
-
*/
|
|
175
|
-
type RequiredForClient<Options> = Options extends {
|
|
176
|
-
readonly requiredForClient: true;
|
|
177
|
-
} ? true : false;
|
|
178
|
-
/**
|
|
179
|
-
* @since 1.0.0
|
|
180
|
-
* @category models
|
|
181
|
-
*/
|
|
182
|
-
type Wrap<Options> = Options extends {
|
|
183
|
-
readonly wrap: true;
|
|
184
|
-
} ? true : false;
|
|
185
|
-
/**
|
|
186
|
-
* @since 1.0.0
|
|
187
|
-
* @category models
|
|
188
|
-
*/
|
|
189
|
-
interface Base<Self, Name extends string, Options, Service> extends Context.Tag<Self, Service> {
|
|
190
|
-
new (_: never): Context.TagClassShape<Name, Service>;
|
|
191
|
-
readonly [TypeId]: TypeId;
|
|
192
|
-
readonly optional: Optional<Options>;
|
|
193
|
-
readonly failure: FailureSchema<Options>;
|
|
194
|
-
readonly provides: Options extends {
|
|
195
|
-
readonly provides: Context.Tag<any, any>;
|
|
196
|
-
} ? Options["provides"] : Options extends {
|
|
197
|
-
readonly provides: ContextRepr;
|
|
198
|
-
} ? Options["provides"] : undefined;
|
|
199
|
-
readonly dynamic: Options extends RpcOptionsDynamic<any, any> ? Options["dynamic"] : undefined;
|
|
200
|
-
readonly requiredForClient: RequiredForClient<Options>;
|
|
201
|
-
readonly wrap: Wrap<Options>;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
export interface TagClass<Self, Name extends string, Options> extends TagClass.Base<Self, Name, Options, TagClass.Wrap<Options> extends true ? RpcMiddlewareWrap<TagClass.Provides<Options>, TagClass.Failure<Options>> : Options extends RpcOptionsDynamic<any, any> ? RpcMiddlewareDynamic<TagClass.Service<Options>, TagClass.FailureService<Options>, {
|
|
205
|
-
[K in Options["dynamic"]["key"]]?: Options["dynamic"]["settings"]["contextActivation"];
|
|
206
|
-
}> : RpcMiddleware<TagClass.Service<Options>, TagClass.FailureService<Options>>> {
|
|
207
|
-
}
|
|
208
|
-
export declare const Tag: <Self>() => <const Name extends string, const Options extends RpcOptionsOriginal | RpcOptionsDynamic<any, any>>(id: Name, options?: Options | undefined) => <E, R, L extends NonEmptyReadonlyArray<Layer.Layer.Any>>(opts: {
|
|
209
|
-
effect: Effect.Effect<TagClass.Wrap<Options> extends true ? RpcMiddlewareWrap<TagClass.Provides<Options>, TagClass.Failure<Options>> : Options extends RpcOptionsDynamic<any, any> ? RpcMiddlewareDynamic<TagClass.Service<Options>, TagClass.FailureService<Options>, { [K in Options["dynamic"]["key"]]?: Options["dynamic"]["settings"]["contextActivation"]; }> : RpcMiddleware<TagClass.Service<Options>, TagClass.FailureService<Options>>, E, R>;
|
|
210
|
-
dependencies?: L;
|
|
211
|
-
}) => TagClass<Self, Name, Options> & {
|
|
212
|
-
Default: Layer.Layer<Self, E | LayerUtils.GetLayersError<L>, Exclude<R, LayerUtils.GetLayersSuccess<L>>>;
|
|
213
|
-
};
|
|
214
|
-
export {};
|
|
215
|
-
//# sourceMappingURL=DynamicMiddleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/api/routing/middleware/DynamicMiddleware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,KAAK,Y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