@effect-app/infra 2.35.4 → 2.36.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 +12 -0
- package/dist/api/routing.d.ts +4 -216
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +2 -2
- package/package.json +2 -14
- package/src/api/routing.ts +14 -58
- package/test/controller.test.ts +48 -4
- package/test/dist/controller.test.d.ts.map +1 -1
- package/dist/api/routing.legacy.d.ts +0 -104
- package/dist/api/routing.legacy.d.ts.map +0 -1
- package/dist/api/routing.legacy.js +0 -209
- package/dist/api/routing.legacy2.d.ts +0 -192
- package/dist/api/routing.legacy2.d.ts.map +0 -1
- package/dist/api/routing.legacy2.js +0 -226
- package/dist/api/routing.legacy3.d.ts +0 -263
- package/dist/api/routing.legacy3.d.ts.map +0 -1
- package/dist/api/routing.legacy3.js +0 -233
- package/src/api/routing.legacy.ts +0 -530
- package/src/api/routing.legacy2.ts +0 -802
- package/src/api/routing.legacy3.ts +0 -989
- package/test/controller.legacy2.test.ts +0 -197
- package/test/controller.legacy3.test.ts +0 -195
- 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.d.ts +0 -169
- package/test/dist/controller.test copy.d.ts.map +0 -1
- package/test/dist/controller.test copy.js +0 -152
- 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
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
-
import { makeMiddleware, makeRouter } from "@effect-app/infra/api/routing.legacy2"
|
|
3
|
-
import type { RequestContext } from "@effect-app/infra/RequestContext"
|
|
4
|
-
import { Rpc } from "@effect/rpc"
|
|
5
|
-
import type { Request } from "effect-app"
|
|
6
|
-
import { Context, Effect, FiberRef, Layer, S, Schedule } from "effect-app"
|
|
7
|
-
import { type GetEffectContext, makeRpcClient, type RPCContextMap, UnauthorizedError } from "effect-app/client"
|
|
8
|
-
import { HttpHeaders, HttpServerRequest } from "effect-app/http"
|
|
9
|
-
import type * as EffectRequest from "effect/Request"
|
|
10
|
-
import { it } from "vitest"
|
|
11
|
-
|
|
12
|
-
const optimisticConcurrencySchedule = Schedule.once
|
|
13
|
-
&& Schedule.recurWhile<any>((a) => a?._tag === "OptimisticConcurrencyException")
|
|
14
|
-
|
|
15
|
-
export interface CTX {
|
|
16
|
-
context: RequestContext
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CTXMap = {
|
|
20
|
-
// allowAnonymous: RPCContextMap.Inverted<"userProfile", UserProfile, typeof NotLoggedInError>
|
|
21
|
-
// TODO: not boolean but `string[]`
|
|
22
|
-
requireRoles: RPCContextMap.Custom<"", never, typeof UnauthorizedError, Array<string>>
|
|
23
|
-
}
|
|
24
|
-
const middleware = makeMiddleware({
|
|
25
|
-
contextMap: null as unknown as CTXMap,
|
|
26
|
-
// helper to deal with nested generic lmitations
|
|
27
|
-
context: null as any as HttpServerRequest.HttpServerRequest,
|
|
28
|
-
execute: Effect.gen(function*() {
|
|
29
|
-
return <T extends { config?: { [K in keyof CTXMap]?: any } }, Req extends S.TaggedRequest.All, R>(
|
|
30
|
-
_schema: T & S.Schema<Req, any, never>,
|
|
31
|
-
handler: (request: Req) => Effect.Effect<EffectRequest.Request.Success<Req>, EffectRequest.Request.Error<Req>, R>,
|
|
32
|
-
moduleName?: string
|
|
33
|
-
) =>
|
|
34
|
-
(
|
|
35
|
-
req: Req
|
|
36
|
-
): Effect.Effect<
|
|
37
|
-
Request.Request.Success<Req>,
|
|
38
|
-
Request.Request.Error<Req>,
|
|
39
|
-
| HttpServerRequest.HttpServerRequest
|
|
40
|
-
| Exclude<R, GetEffectContext<CTXMap, T["config"]>>
|
|
41
|
-
> =>
|
|
42
|
-
Effect
|
|
43
|
-
.gen(function*() {
|
|
44
|
-
// const headers = yield* Rpc.currentHeaders
|
|
45
|
-
const ctx = Context.empty()
|
|
46
|
-
|
|
47
|
-
// const config = "config" in schema ? schema.config : undefined
|
|
48
|
-
|
|
49
|
-
// Check JWT
|
|
50
|
-
// TODO
|
|
51
|
-
// if (!fakeLogin && !request.allowAnonymous) {
|
|
52
|
-
// yield* Effect.catchAll(
|
|
53
|
-
// checkJWTI({
|
|
54
|
-
// ...authConfig,
|
|
55
|
-
// issuer: authConfig.issuer + "/",
|
|
56
|
-
// jwksUri: `${authConfig.issuer}/.well-known/jwks.json`
|
|
57
|
-
// }),
|
|
58
|
-
// (err) => Effect.fail(new JWTError({ error: err }))
|
|
59
|
-
// )
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// const fakeLogin = true
|
|
63
|
-
// const r = (fakeLogin
|
|
64
|
-
// ? makeUserProfileFromUserHeader(headers["x-user"])
|
|
65
|
-
// : makeUserProfileFromAuthorizationHeader(
|
|
66
|
-
// headers["authorization"]
|
|
67
|
-
// ))
|
|
68
|
-
// .pipe(Effect.exit, basicRuntime.runSync)
|
|
69
|
-
// if (!Exit.isSuccess(r)) {
|
|
70
|
-
// yield* Effect.logWarning("Parsing userInfo failed").pipe(Effect.annotateLogs("r", r))
|
|
71
|
-
// }
|
|
72
|
-
// const userProfile = Option.fromNullable(Exit.isSuccess(r) ? r.value : undefined)
|
|
73
|
-
// if (Option.isSome(userProfile)) {
|
|
74
|
-
// // yield* rcc.update((_) => ({ ..._, userPorfile: userProfile.value }))
|
|
75
|
-
// ctx = ctx.pipe(Context.add(UserProfile, userProfile.value))
|
|
76
|
-
// } else if (!config?.allowAnonymous) {
|
|
77
|
-
// return yield* new NotLoggedInError({ message: "no auth" })
|
|
78
|
-
// }
|
|
79
|
-
|
|
80
|
-
// if (config?.requireRoles) {
|
|
81
|
-
// // TODO
|
|
82
|
-
// if (
|
|
83
|
-
// !userProfile.value
|
|
84
|
-
// || !config.requireRoles.every((role: any) => userProfile.value!.roles.includes(role))
|
|
85
|
-
// ) {
|
|
86
|
-
// return yield* new UnauthorizedError()
|
|
87
|
-
// }
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
return yield* handler(req).pipe(
|
|
91
|
-
Effect.retry(optimisticConcurrencySchedule),
|
|
92
|
-
Effect.provide(ctx as Context.Context<GetEffectContext<CTXMap, T["config"]>>)
|
|
93
|
-
)
|
|
94
|
-
})
|
|
95
|
-
.pipe(
|
|
96
|
-
Effect.provide(
|
|
97
|
-
Effect
|
|
98
|
-
.gen(function*() {
|
|
99
|
-
yield* Effect.annotateCurrentSpan("request.name", moduleName ? `${moduleName}.${req._tag}` : req._tag)
|
|
100
|
-
// yield* RequestContextContainer.update((_) => ({
|
|
101
|
-
// ..._,
|
|
102
|
-
// name: NonEmptyString255(moduleName ? `${moduleName}.${req._tag}` : req._tag)
|
|
103
|
-
// }))
|
|
104
|
-
const httpReq = yield* HttpServerRequest.HttpServerRequest
|
|
105
|
-
// TODO: only pass Authentication etc, or move headers to actual Rpc Headers
|
|
106
|
-
yield* FiberRef.update(
|
|
107
|
-
Rpc.currentHeaders,
|
|
108
|
-
(headers) =>
|
|
109
|
-
HttpHeaders.merge(
|
|
110
|
-
httpReq.headers,
|
|
111
|
-
headers
|
|
112
|
-
)
|
|
113
|
-
)
|
|
114
|
-
})
|
|
115
|
-
.pipe(Layer.effectDiscard)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
118
|
-
// .pipe(Effect.provide(RequestCacheLayers)) as any
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
export const { matchAll, matchFor } = makeRouter(middleware, true)
|
|
123
|
-
|
|
124
|
-
export type RequestConfig = {
|
|
125
|
-
/** Disable authentication requirement */
|
|
126
|
-
allowAnonymous?: true
|
|
127
|
-
/** Control the roles that are required to access the resource */
|
|
128
|
-
allowRoles?: readonly string[]
|
|
129
|
-
}
|
|
130
|
-
export const { TaggedRequest: Req } = makeRpcClient<RequestConfig, CTXMap>({
|
|
131
|
-
// allowAnonymous: NotLoggedInError,
|
|
132
|
-
requireRoles: UnauthorizedError
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
export class GetSomething extends Req<GetSomething>()("GetSomething", {
|
|
136
|
-
id: S.String
|
|
137
|
-
}, { success: S.Void }) {}
|
|
138
|
-
|
|
139
|
-
export class GetSomethingElse extends Req<GetSomethingElse>()("GetSomethingElse", {
|
|
140
|
-
id: S.String
|
|
141
|
-
}, { success: S.String }) {}
|
|
142
|
-
|
|
143
|
-
const Something = { GetSomething, GetSomethingElse, meta: { moduleName: "Something" as const } }
|
|
144
|
-
|
|
145
|
-
export class SomethingService extends Effect.Service<SomethingService>()("SomethingService", {
|
|
146
|
-
dependencies: [],
|
|
147
|
-
effect: Effect.gen(function*() {
|
|
148
|
-
return {}
|
|
149
|
-
})
|
|
150
|
-
}) {}
|
|
151
|
-
|
|
152
|
-
declare const a: {
|
|
153
|
-
(opt: { a: 1 }): void
|
|
154
|
-
(opt: { a: 2 }): void
|
|
155
|
-
(opt: { b: 3 }): void
|
|
156
|
-
(opt: { b: 3 }): void
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export class SomethingRepo extends Effect.Service<SomethingRepo>()("SomethingRepo", {
|
|
160
|
-
dependencies: [SomethingService.Default],
|
|
161
|
-
effect: Effect.gen(function*() {
|
|
162
|
-
const smth = yield* SomethingService
|
|
163
|
-
console.log({ smth })
|
|
164
|
-
return {}
|
|
165
|
-
})
|
|
166
|
-
}) {}
|
|
167
|
-
|
|
168
|
-
export class SomethingService2 extends Effect.Service<SomethingService2>()("SomethingService2", {
|
|
169
|
-
dependencies: [],
|
|
170
|
-
effect: Effect.gen(function*() {
|
|
171
|
-
return {}
|
|
172
|
-
})
|
|
173
|
-
}) {}
|
|
174
|
-
|
|
175
|
-
it("router.legacy2", () => {
|
|
176
|
-
const routes = matchFor(Something)({
|
|
177
|
-
dependencies: [
|
|
178
|
-
SomethingRepo.Default,
|
|
179
|
-
SomethingService.Default,
|
|
180
|
-
SomethingService2.Default
|
|
181
|
-
],
|
|
182
|
-
effect: Effect.gen(function*() {
|
|
183
|
-
const repo = yield* SomethingRepo
|
|
184
|
-
const smth = yield* SomethingService
|
|
185
|
-
const smth2 = yield* SomethingService2
|
|
186
|
-
|
|
187
|
-
console.log({ repo, smth, smth2 })
|
|
188
|
-
|
|
189
|
-
const { GetSomething, GetSomethingElse } = matchFor(Something)
|
|
190
|
-
return {
|
|
191
|
-
GetSomething: GetSomething(Effect.void),
|
|
192
|
-
GetSomethingElse: GetSomethingElse(Effect.succeed("12"))
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
})
|
|
196
|
-
console.log({ routes })
|
|
197
|
-
})
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
-
import { makeMiddleware, makeRouter } from "@effect-app/infra/api/routing.legacy3"
|
|
3
|
-
import type { RequestContext } from "@effect-app/infra/RequestContext"
|
|
4
|
-
import { Rpc } from "@effect/rpc"
|
|
5
|
-
import type { Request } from "effect-app"
|
|
6
|
-
import { Context, Effect, FiberRef, Layer, S, Schedule } from "effect-app"
|
|
7
|
-
import { type GetEffectContext, makeRpcClient, type RPCContextMap, UnauthorizedError } from "effect-app/client"
|
|
8
|
-
import { HttpHeaders, HttpServerRequest } from "effect-app/http"
|
|
9
|
-
import type * as EffectRequest from "effect/Request"
|
|
10
|
-
import { it } from "vitest"
|
|
11
|
-
|
|
12
|
-
const optimisticConcurrencySchedule = Schedule.once
|
|
13
|
-
&& Schedule.recurWhile<any>((a) => a?._tag === "OptimisticConcurrencyException")
|
|
14
|
-
|
|
15
|
-
export interface CTX {
|
|
16
|
-
context: RequestContext
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CTXMap = {
|
|
20
|
-
// allowAnonymous: RPCContextMap.Inverted<"userProfile", UserProfile, typeof NotLoggedInError>
|
|
21
|
-
// TODO: not boolean but `string[]`
|
|
22
|
-
requireRoles: RPCContextMap.Custom<"", never, typeof UnauthorizedError, Array<string>>
|
|
23
|
-
}
|
|
24
|
-
const middleware = makeMiddleware({
|
|
25
|
-
contextMap: null as unknown as CTXMap,
|
|
26
|
-
// helper to deal with nested generic lmitations
|
|
27
|
-
context: null as any as HttpServerRequest.HttpServerRequest,
|
|
28
|
-
execute: Effect.gen(function*() {
|
|
29
|
-
return <T extends { config?: { [K in keyof CTXMap]?: any } }, Req extends S.TaggedRequest.All, R>(
|
|
30
|
-
_schema: T & S.Schema<Req, any, never>,
|
|
31
|
-
handler: (request: Req) => Effect.Effect<EffectRequest.Request.Success<Req>, EffectRequest.Request.Error<Req>, R>,
|
|
32
|
-
moduleName?: string
|
|
33
|
-
) =>
|
|
34
|
-
(
|
|
35
|
-
req: Req
|
|
36
|
-
): Effect.Effect<
|
|
37
|
-
Request.Request.Success<Req>,
|
|
38
|
-
Request.Request.Error<Req>,
|
|
39
|
-
| HttpServerRequest.HttpServerRequest
|
|
40
|
-
| Exclude<R, GetEffectContext<CTXMap, T["config"]>>
|
|
41
|
-
> =>
|
|
42
|
-
Effect
|
|
43
|
-
.gen(function*() {
|
|
44
|
-
// const headers = yield* Rpc.currentHeaders
|
|
45
|
-
const ctx = Context.empty()
|
|
46
|
-
|
|
47
|
-
// const config = "config" in schema ? schema.config : undefined
|
|
48
|
-
|
|
49
|
-
// Check JWT
|
|
50
|
-
// TODO
|
|
51
|
-
// if (!fakeLogin && !request.allowAnonymous) {
|
|
52
|
-
// yield* Effect.catchAll(
|
|
53
|
-
// checkJWTI({
|
|
54
|
-
// ...authConfig,
|
|
55
|
-
// issuer: authConfig.issuer + "/",
|
|
56
|
-
// jwksUri: `${authConfig.issuer}/.well-known/jwks.json`
|
|
57
|
-
// }),
|
|
58
|
-
// (err) => Effect.fail(new JWTError({ error: err }))
|
|
59
|
-
// )
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// const fakeLogin = true
|
|
63
|
-
// const r = (fakeLogin
|
|
64
|
-
// ? makeUserProfileFromUserHeader(headers["x-user"])
|
|
65
|
-
// : makeUserProfileFromAuthorizationHeader(
|
|
66
|
-
// headers["authorization"]
|
|
67
|
-
// ))
|
|
68
|
-
// .pipe(Effect.exit, basicRuntime.runSync)
|
|
69
|
-
// if (!Exit.isSuccess(r)) {
|
|
70
|
-
// yield* Effect.logWarning("Parsing userInfo failed").pipe(Effect.annotateLogs("r", r))
|
|
71
|
-
// }
|
|
72
|
-
// const userProfile = Option.fromNullable(Exit.isSuccess(r) ? r.value : undefined)
|
|
73
|
-
// if (Option.isSome(userProfile)) {
|
|
74
|
-
// // yield* rcc.update((_) => ({ ..._, userPorfile: userProfile.value }))
|
|
75
|
-
// ctx = ctx.pipe(Context.add(UserProfile, userProfile.value))
|
|
76
|
-
// } else if (!config?.allowAnonymous) {
|
|
77
|
-
// return yield* new NotLoggedInError({ message: "no auth" })
|
|
78
|
-
// }
|
|
79
|
-
|
|
80
|
-
// if (config?.requireRoles) {
|
|
81
|
-
// // TODO
|
|
82
|
-
// if (
|
|
83
|
-
// !userProfile.value
|
|
84
|
-
// || !config.requireRoles.every((role: any) => userProfile.value!.roles.includes(role))
|
|
85
|
-
// ) {
|
|
86
|
-
// return yield* new UnauthorizedError()
|
|
87
|
-
// }
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
return yield* handler(req).pipe(
|
|
91
|
-
Effect.retry(optimisticConcurrencySchedule),
|
|
92
|
-
Effect.provide(ctx as Context.Context<GetEffectContext<CTXMap, T["config"]>>)
|
|
93
|
-
)
|
|
94
|
-
})
|
|
95
|
-
.pipe(
|
|
96
|
-
Effect.provide(
|
|
97
|
-
Effect
|
|
98
|
-
.gen(function*() {
|
|
99
|
-
yield* Effect.annotateCurrentSpan("request.name", moduleName ? `${moduleName}.${req._tag}` : req._tag)
|
|
100
|
-
// yield* RequestContextContainer.update((_) => ({
|
|
101
|
-
// ..._,
|
|
102
|
-
// name: NonEmptyString255(moduleName ? `${moduleName}.${req._tag}` : req._tag)
|
|
103
|
-
// }))
|
|
104
|
-
const httpReq = yield* HttpServerRequest.HttpServerRequest
|
|
105
|
-
// TODO: only pass Authentication etc, or move headers to actual Rpc Headers
|
|
106
|
-
yield* FiberRef.update(
|
|
107
|
-
Rpc.currentHeaders,
|
|
108
|
-
(headers) =>
|
|
109
|
-
HttpHeaders.merge(
|
|
110
|
-
httpReq.headers,
|
|
111
|
-
headers
|
|
112
|
-
)
|
|
113
|
-
)
|
|
114
|
-
})
|
|
115
|
-
.pipe(Layer.effectDiscard)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
118
|
-
// .pipe(Effect.provide(RequestCacheLayers)) as any
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
export const { matchAll, matchFor } = makeRouter(middleware, true)
|
|
123
|
-
|
|
124
|
-
export type RequestConfig = {
|
|
125
|
-
/** Disable authentication requirement */
|
|
126
|
-
allowAnonymous?: true
|
|
127
|
-
/** Control the roles that are required to access the resource */
|
|
128
|
-
allowRoles?: readonly string[]
|
|
129
|
-
}
|
|
130
|
-
export const { TaggedRequest: Req } = makeRpcClient<RequestConfig, CTXMap>({
|
|
131
|
-
// allowAnonymous: NotLoggedInError,
|
|
132
|
-
requireRoles: UnauthorizedError
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
export class GetSomething extends Req<GetSomething>()("GetSomething", {
|
|
136
|
-
id: S.String
|
|
137
|
-
}, { success: S.Void }) {}
|
|
138
|
-
|
|
139
|
-
export class GetSomethingElse extends Req<GetSomethingElse>()("GetSomethingElse", {
|
|
140
|
-
id: S.String
|
|
141
|
-
}, { success: S.String }) {}
|
|
142
|
-
|
|
143
|
-
const Something = { GetSomething, GetSomethingElse, meta: { moduleName: "Something" as const } }
|
|
144
|
-
|
|
145
|
-
export class SomethingService extends Effect.Service<SomethingService>()("SomethingService", {
|
|
146
|
-
dependencies: [],
|
|
147
|
-
effect: Effect.gen(function*() {
|
|
148
|
-
return {}
|
|
149
|
-
})
|
|
150
|
-
}) {}
|
|
151
|
-
|
|
152
|
-
declare const a: {
|
|
153
|
-
(opt: { a: 1 }): void
|
|
154
|
-
(opt: { a: 2 }): void
|
|
155
|
-
(opt: { b: 3 }): void
|
|
156
|
-
(opt: { b: 3 }): void
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export class SomethingRepo extends Effect.Service<SomethingRepo>()("SomethingRepo", {
|
|
160
|
-
dependencies: [SomethingService.Default],
|
|
161
|
-
effect: Effect.gen(function*() {
|
|
162
|
-
const smth = yield* SomethingService
|
|
163
|
-
console.log({ smth })
|
|
164
|
-
return {}
|
|
165
|
-
})
|
|
166
|
-
}) {}
|
|
167
|
-
|
|
168
|
-
export class SomethingService2 extends Effect.Service<SomethingService2>()("SomethingService2", {
|
|
169
|
-
dependencies: [],
|
|
170
|
-
effect: Effect.gen(function*() {
|
|
171
|
-
return {}
|
|
172
|
-
})
|
|
173
|
-
}) {}
|
|
174
|
-
|
|
175
|
-
it("router.legacy3 fluent", () => {
|
|
176
|
-
const routes = matchFor(Something)({
|
|
177
|
-
dependencies: [
|
|
178
|
-
SomethingRepo.Default,
|
|
179
|
-
SomethingService.Default,
|
|
180
|
-
SomethingService2.Default
|
|
181
|
-
],
|
|
182
|
-
effect: Effect.gen(function*() {
|
|
183
|
-
const repo = yield* SomethingRepo
|
|
184
|
-
const smth = yield* SomethingService
|
|
185
|
-
const smth2 = yield* SomethingService2
|
|
186
|
-
|
|
187
|
-
console.log({ repo, smth, smth2 })
|
|
188
|
-
|
|
189
|
-
return matchFor(Something)
|
|
190
|
-
.GetSomething(Effect.void)
|
|
191
|
-
.GetSomethingElse(Effect.succeed("12"))
|
|
192
|
-
})
|
|
193
|
-
})
|
|
194
|
-
console.log({ routes })
|
|
195
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.legacy2.test.d.ts","sourceRoot":"","sources":["../controller.legacy2.test.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,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a,SAAQ,iBAEX;CAAG;;;;;;;;;;AAE1B,qBAAa,gBAAiB,SAAQ,qBAEb;CAAG;;;;;AAI5B,qBAAa,gBAAiB,SAAQ,qBAKpC;CAAG;;;;;AASL,qBAAa,aAAc,SAAQ,kBAOjC;CAAG;;;;;AAEL,qBAAa,iBAAkB,SAAQ,sBAKrC;CAAG"}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import type { RequestContext } from "@effect-app/infra/RequestContext";
|
|
2
|
-
import { Rpc } from "@effect/rpc";
|
|
3
|
-
import { Effect, Layer, S } from "effect-app";
|
|
4
|
-
import { type RPCContextMap, UnauthorizedError } from "effect-app/client";
|
|
5
|
-
import { HttpServerRequest } from "effect-app/http";
|
|
6
|
-
export interface CTX {
|
|
7
|
-
context: RequestContext;
|
|
8
|
-
}
|
|
9
|
-
export type CTXMap = {
|
|
10
|
-
requireRoles: RPCContextMap.Custom<"", never, typeof UnauthorizedError, Array<string>>;
|
|
11
|
-
};
|
|
12
|
-
export declare const matchAll: <T extends {
|
|
13
|
-
[key: string]: {
|
|
14
|
-
Router: {
|
|
15
|
-
router: Effect<import("@effect/platform/HttpRouter").HttpRouter<any, any>, any, any>;
|
|
16
|
-
};
|
|
17
|
-
routes: Layer.Layer<any, any, any>;
|
|
18
|
-
moduleName: string;
|
|
19
|
-
};
|
|
20
|
-
}, A, E, R>(handlers: T, requestLayer: Layer.Layer<A, E, R>) => {
|
|
21
|
-
layer: Layer.Layer<never, Layer.Layer.Error<T[keyof T]["routes"]>, Layer.Layer.Context<T[keyof T]["routes"]>>;
|
|
22
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<"RootRouter", "RootRouter", Effect.Effect.Success<T[keyof T]["Router"]["router"]> extends infer T_1 ? T_1 extends T_1 & Effect.Effect.Success<T[keyof T]["Router"]["router"]> ? T_1 extends import("@effect/platform/HttpRouter").HttpRouter<infer E_1, any> ? E_1 : never : never : never, R | Exclude<Effect.Effect.Success<T[keyof T]["Router"]["router"]> extends infer T_2 ? T_2 extends T_2 & Effect.Effect.Success<T[keyof T]["Router"]["router"]> ? T_2 extends import("@effect/platform/HttpRouter").HttpRouter<any, infer R_1> ? R_1 : never : never : never, A>>;
|
|
23
|
-
}, matchFor: <const ModuleName extends string, const Rsc extends Record<string, any>>(rsc: Rsc & {
|
|
24
|
-
meta: {
|
|
25
|
-
moduleName: ModuleName;
|
|
26
|
-
};
|
|
27
|
-
}) => {
|
|
28
|
-
<const Make extends {
|
|
29
|
-
dependencies: import("effect-app").Array<Layer.Layer.Any>;
|
|
30
|
-
effect: Effect<{ [K_1 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K_1], any, any>; }, any, Make["strict"] extends false ? any : Make["dependencies"] extends infer T ? T extends Make["dependencies"] ? T extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k in keyof T]: Layer.Layer.Success<T[k]>; }[number] : never : never : never>;
|
|
31
|
-
strict?: boolean;
|
|
32
|
-
readonly ಠ_ಠ: never;
|
|
33
|
-
}>(make: Make): {
|
|
34
|
-
moduleName: ModuleName;
|
|
35
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, Exclude<[{ [K_2 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: Rpc.Rpc<Rsc[K_2], import("@effect-app/infra/api/routing")._R<ReturnType<import("@effect-app/infra/api/routing").MakeHandlers<Make, { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }>[K_2]["handler"]>>>; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]] extends [Rpc.Rpc<any, infer R>] ? R : never, import("@effect/platform/HttpRouter").HttpRouter.Provided>>;
|
|
36
|
-
routes: Layer.Layer<import("@effect-app/infra/api/routing").RouterShape<Rsc>, import("@effect-app/infra/api/routing").MakeErrors<Make> | (Make["dependencies"] extends infer T_1 ? T_1 extends Make["dependencies"] ? T_1 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_1 in keyof T_1]: Layer.Layer.Error<T_1[k_1]>; }[number] : never : never : never), (Make["dependencies"] extends infer T_2 ? T_2 extends Make["dependencies"] ? T_2 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_2 in keyof T_2]: Layer.Layer.Context<T_2[k_2]>; }[number] : never : never : never) | Exclude<import("@effect-app/infra/api/routing").MakeContext<Make>, Make["dependencies"] extends infer T_3 ? T_3 extends Make["dependencies"] ? T_3 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_3 in keyof T_3]: Layer.Layer.Success<T_3[k_3]>; }[number] : never : never : never>>;
|
|
37
|
-
};
|
|
38
|
-
<const Make extends {
|
|
39
|
-
dependencies: import("effect-app").Array<Layer.Layer.Any>;
|
|
40
|
-
effect: Effect<{ [K in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K], any, any>; }, any, Make["strict"] extends false ? any : Make["dependencies"] extends infer T ? T extends Make["dependencies"] ? T extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k in keyof T]: Layer.Layer.Success<T[k]>; }[number] : never : never : never>;
|
|
41
|
-
strict?: boolean;
|
|
42
|
-
readonly ಠ_ಠ: never;
|
|
43
|
-
}>(make: Make): {
|
|
44
|
-
moduleName: ModuleName;
|
|
45
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, Exclude<[{ [K_1 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: Rpc.Rpc<Rsc[K_1], import("@effect-app/infra/api/routing")._R<ReturnType<import("@effect-app/infra/api/routing").MakeHandlers<Make, { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }>[K_1]["handler"]>>>; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]] extends [Rpc.Rpc<any, infer R>] ? R : never, import("@effect/platform/HttpRouter").HttpRouter.Provided>>;
|
|
46
|
-
routes: Layer.Layer<import("@effect-app/infra/api/routing").RouterShape<Rsc>, import("@effect-app/infra/api/routing").MakeErrors<Make> | (Make["dependencies"] extends infer T_1 ? T_1 extends Make["dependencies"] ? T_1 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_1 in keyof T_1]: Layer.Layer.Error<T_1[k_1]>; }[number] : never : never : never), (Make["dependencies"] extends infer T_2 ? T_2 extends Make["dependencies"] ? T_2 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_2 in keyof T_2]: Layer.Layer.Context<T_2[k_2]>; }[number] : never : never : never) | Exclude<import("@effect-app/infra/api/routing").MakeContext<Make>, Make["dependencies"] extends infer T_3 ? T_3 extends Make["dependencies"] ? T_3 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_3 in keyof T_3]: Layer.Layer.Success<T_3[k_3]>; }[number] : never : never : never>>;
|
|
47
|
-
};
|
|
48
|
-
<const Make extends {
|
|
49
|
-
dependencies: import("effect-app").Array<Layer.Layer.Any>;
|
|
50
|
-
effect: Effect<{ [K in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K], any, any>; }, any, Make["strict"] extends false ? any : Make["dependencies"] extends infer T ? T extends Make["dependencies"] ? T extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k in keyof T]: Layer.Layer.Success<T[k]>; }[number] : never : never : never>;
|
|
51
|
-
strict?: boolean;
|
|
52
|
-
readonly ಠ_ಠ: never;
|
|
53
|
-
}>(make: Make): {
|
|
54
|
-
moduleName: ModuleName;
|
|
55
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, Exclude<[{ [K_1 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: Rpc.Rpc<Rsc[K_1], import("@effect-app/infra/api/routing")._R<ReturnType<import("@effect-app/infra/api/routing").MakeHandlers<Make, { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }>[K_1]["handler"]>>>; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]] extends [Rpc.Rpc<any, infer R>] ? R : never, import("@effect/platform/HttpRouter").HttpRouter.Provided>>;
|
|
56
|
-
routes: Layer.Layer<import("@effect-app/infra/api/routing").RouterShape<Rsc>, import("@effect-app/infra/api/routing").MakeErrors<Make> | (Make["dependencies"] extends infer T_1 ? T_1 extends Make["dependencies"] ? T_1 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_1 in keyof T_1]: Layer.Layer.Error<T_1[k_1]>; }[number] : never : never : never), (Make["dependencies"] extends infer T_2 ? T_2 extends Make["dependencies"] ? T_2 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_2 in keyof T_2]: Layer.Layer.Context<T_2[k_2]>; }[number] : never : never : never) | Exclude<import("@effect-app/infra/api/routing").MakeContext<Make>, Make["dependencies"] extends infer T_3 ? T_3 extends Make["dependencies"] ? T_3 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_3 in keyof T_3]: Layer.Layer.Success<T_3[k_3]>; }[number] : never : never : never>>;
|
|
57
|
-
};
|
|
58
|
-
<const Make extends {
|
|
59
|
-
dependencies: import("effect-app").Array<Layer.Layer.Any>;
|
|
60
|
-
effect: Effect<{ [K in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K], any, any>; }, any, Make["dependencies"] extends infer T ? T extends Make["dependencies"] ? T extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k in keyof T]: Layer.Layer.Success<T[k]>; }[number] : never : never : never>;
|
|
61
|
-
strict?: boolean;
|
|
62
|
-
readonly ಠ_ಠ: never;
|
|
63
|
-
}>(make: Make): {
|
|
64
|
-
moduleName: ModuleName;
|
|
65
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, Exclude<[{ [K_1 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: Rpc.Rpc<Rsc[K_1], import("@effect-app/infra/api/routing")._R<ReturnType<import("@effect-app/infra/api/routing").MakeHandlers<Make, { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }>[K_1]["handler"]>>>; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]] extends [Rpc.Rpc<any, infer R>] ? R : never, import("@effect/platform/HttpRouter").HttpRouter.Provided>>;
|
|
66
|
-
routes: Layer.Layer<import("@effect-app/infra/api/routing").RouterShape<Rsc>, import("@effect-app/infra/api/routing").MakeErrors<Make> | (Make["dependencies"] extends infer T_1 ? T_1 extends Make["dependencies"] ? T_1 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_1 in keyof T_1]: Layer.Layer.Error<T_1[k_1]>; }[number] : never : never : never), (Make["dependencies"] extends infer T_2 ? T_2 extends Make["dependencies"] ? T_2 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_2 in keyof T_2]: Layer.Layer.Context<T_2[k_2]>; }[number] : never : never : never) | Exclude<import("@effect-app/infra/api/routing").MakeContext<Make>, Make["dependencies"] extends infer T_3 ? T_3 extends Make["dependencies"] ? T_3 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_3 in keyof T_3]: Layer.Layer.Success<T_3[k_3]>; }[number] : never : never : never>>;
|
|
67
|
-
};
|
|
68
|
-
<const Make extends {
|
|
69
|
-
dependencies: import("effect-app").Array<Layer.Layer.Any>;
|
|
70
|
-
effect: Effect<{ [K in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K], any, any>; }, any, Make["dependencies"] extends infer T ? T extends Make["dependencies"] ? T extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k in keyof T]: Layer.Layer.Success<T[k]>; }[number] : never : never : never>;
|
|
71
|
-
strict?: boolean;
|
|
72
|
-
}>(make: Make): {
|
|
73
|
-
moduleName: ModuleName;
|
|
74
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, Exclude<[{ [K_1 in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: Rpc.Rpc<Rsc[K_1], import("@effect-app/infra/api/routing")._R<ReturnType<import("@effect-app/infra/api/routing").MakeHandlers<Make, { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }>[K_1]["handler"]>>>; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]] extends [Rpc.Rpc<any, infer R>] ? R : never, import("@effect/platform/HttpRouter").HttpRouter.Provided>>;
|
|
75
|
-
routes: Layer.Layer<import("@effect-app/infra/api/routing").RouterShape<Rsc>, import("@effect-app/infra/api/routing").MakeErrors<Make> | (Make["dependencies"] extends infer T_1 ? T_1 extends Make["dependencies"] ? T_1 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_1 in keyof T_1]: Layer.Layer.Error<T_1[k_1]>; }[number] : never : never : never), (Make["dependencies"] extends infer T_2 ? T_2 extends Make["dependencies"] ? T_2 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_2 in keyof T_2]: Layer.Layer.Context<T_2[k_2]>; }[number] : never : never : never) | Exclude<import("@effect-app/infra/api/routing").MakeContext<Make>, Make["dependencies"] extends infer T_3 ? T_3 extends Make["dependencies"] ? T_3 extends readonly [Layer.Layer.Any, ...Layer.Layer.Any[]] ? { [k_3 in keyof T_3]: Layer.Layer.Success<T_3[k_3]>; }[number] : never : never : never>>;
|
|
76
|
-
};
|
|
77
|
-
<const Make extends {
|
|
78
|
-
dependencies: [...Make["dependencies"], ...Exclude<Effect.Effect.Context<Make["effect"]>, import("effect/Types").Contravariant.Type<import("@effect-app/infra/api/routing").MakeDeps<Make>[typeof Layer.LayerTypeId]["_ROut"]>> extends never ? [] : [Layer.Layer<Exclude<Effect.Effect.Context<Make["effect"]>, import("effect/Types").Contravariant.Type<import("@effect-app/infra/api/routing").MakeDeps<Make>[typeof Layer.LayerTypeId]["_ROut"]>>, never, never>]];
|
|
79
|
-
effect: Effect<{ [K in keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }]: import("@effect-app/infra/api/routing").Handler<Rsc[K], any, any>; }, any, any>;
|
|
80
|
-
strict?: boolean;
|
|
81
|
-
}>(make: Make): {
|
|
82
|
-
moduleName: ModuleName;
|
|
83
|
-
Router: import("@effect/platform/HttpRouter").HttpRouter.TagClass<import("@effect-app/infra/api/routing").RouterShape<Rsc>, `${ModuleName}Router`, never, never>;
|
|
84
|
-
routes: any;
|
|
85
|
-
};
|
|
86
|
-
} & import("@effect-app/infra/api/routing").RouteMatcher<CTXMap, Rsc, HttpServerRequest.HttpServerRequest> & {
|
|
87
|
-
router: import("@effect-app/infra/api/routing").AddAction<{ [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }[keyof { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }], {}>;
|
|
88
|
-
router2: { [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; } extends infer T extends Record<string, import("@effect-app/infra/api/routing").AnyRequestModule> ? { [K in keyof T]: import("@effect-app/infra/api/routing").Method<{ [K in keyof Rsc as Rsc[K] extends import("@effect-app/infra/api/routing").AnyRequestModule ? K : never]: Rsc[K]; }, K, "d", {}>; } : never;
|
|
89
|
-
};
|
|
90
|
-
export type RequestConfig = {
|
|
91
|
-
/** Disable authentication requirement */
|
|
92
|
-
allowAnonymous?: true;
|
|
93
|
-
/** Control the roles that are required to access the resource */
|
|
94
|
-
allowRoles?: readonly string[];
|
|
95
|
-
};
|
|
96
|
-
export declare const Req: <Self>() => {
|
|
97
|
-
<Tag extends string, Payload extends S.Struct.Fields, C extends {
|
|
98
|
-
success: S.Schema.Any | S.Struct.Fields;
|
|
99
|
-
failure: S.Schema.Any | S.Struct.Fields;
|
|
100
|
-
}>(tag: Tag, fields: Payload, config: RequestConfig & C): S.TaggedRequestClass<Self, Tag, {
|
|
101
|
-
readonly _tag: S.tag<Tag>;
|
|
102
|
-
} & Payload, (RequestConfig & C)["success"] extends infer T ? T extends (RequestConfig & C)["success"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never, ([((RequestConfig & C)["failure"] extends infer T_1 ? T_1 extends (RequestConfig & C)["failure"] ? T_1 extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T_1, []> : T_1 extends S.Schema.Any ? T_1 : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C>] extends [never] ? [] : [((RequestConfig & C)["failure"] extends infer T_1 ? T_1 extends (RequestConfig & C)["failure"] ? T_1 extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T_1, []> : T_1 extends S.Schema.Any ? T_1 : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C>]) extends infer T_2 ? T_2 extends ([((RequestConfig & C)["failure"] extends infer T_1 ? T_1 extends (RequestConfig & C)["failure"] ? T_1 extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T_1, []> : T_1 extends S.Schema.Any ? T_1 : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C>] extends [never] ? [] : [((RequestConfig & C)["failure"] extends infer T_1 ? T_1 extends (RequestConfig & C)["failure"] ? T_1 extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T_1, []> : T_1 extends S.Schema.Any ? T_1 : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C>]) ? T_2 extends readonly S.Schema.All[] ? S.Union<T_2> : typeof S.Never : never : never> & {
|
|
103
|
-
config: Omit<C, "success" | "failure">;
|
|
104
|
-
};
|
|
105
|
-
<Tag extends string, Payload_1 extends S.Struct.Fields, C_1 extends {
|
|
106
|
-
success: S.Schema.Any | S.Struct.Fields;
|
|
107
|
-
}>(tag: Tag, fields: Payload_1, config: RequestConfig & C_1): S.TaggedRequestClass<Self, Tag, {
|
|
108
|
-
readonly _tag: S.tag<Tag>;
|
|
109
|
-
} & Payload_1, (RequestConfig & C_1)["success"] extends infer T ? T extends (RequestConfig & C_1)["success"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never, ([import("effect-app/client").GetEffectError<CTXMap, C_1>] extends [never] ? [] : [import("effect-app/client").GetEffectError<CTXMap, C_1>]) extends infer T_1 ? T_1 extends ([import("effect-app/client").GetEffectError<CTXMap, C_1>] extends [never] ? [] : [import("effect-app/client").GetEffectError<CTXMap, C_1>]) ? T_1 extends readonly S.Schema.All[] ? S.Union<T_1> : typeof S.Never : never : never> & {
|
|
110
|
-
config: Omit<C_1, "success" | "failure">;
|
|
111
|
-
};
|
|
112
|
-
<Tag extends string, Payload_2 extends S.Struct.Fields, C_2 extends {
|
|
113
|
-
failure: S.Schema.Any | S.Struct.Fields;
|
|
114
|
-
}>(tag: Tag, fields: Payload_2, config: RequestConfig & C_2): S.TaggedRequestClass<Self, Tag, {
|
|
115
|
-
readonly _tag: S.tag<Tag>;
|
|
116
|
-
} & Payload_2, typeof S.Void, ([((RequestConfig & C_2)["failure"] extends infer T ? T extends (RequestConfig & C_2)["failure"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C_2>] extends [never] ? [] : [((RequestConfig & C_2)["failure"] extends infer T ? T extends (RequestConfig & C_2)["failure"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C_2>]) extends infer T_1 ? T_1 extends ([((RequestConfig & C_2)["failure"] extends infer T ? T extends (RequestConfig & C_2)["failure"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C_2>] extends [never] ? [] : [((RequestConfig & C_2)["failure"] extends infer T ? T extends (RequestConfig & C_2)["failure"] ? T extends import("effect/Schema").Struct.Fields ? S.TypeLiteral<T, []> : T extends S.Schema.Any ? T : never : never : never) | import("effect-app/client").GetEffectError<CTXMap, C_2>]) ? T_1 extends readonly S.Schema.All[] ? S.Union<T_1> : typeof S.Never : never : never> & {
|
|
117
|
-
config: Omit<C_2, "success" | "failure">;
|
|
118
|
-
};
|
|
119
|
-
<Tag extends string, Payload_3 extends S.Struct.Fields, C_3 extends Record<string, any>>(tag: Tag, fields: Payload_3, config: C_3 & RequestConfig): S.TaggedRequestClass<Self, Tag, {
|
|
120
|
-
readonly _tag: S.tag<Tag>;
|
|
121
|
-
} & Payload_3, typeof S.Void, ([import("effect-app/client").GetEffectError<CTXMap, C_3>] extends [never] ? [] : [import("effect-app/client").GetEffectError<CTXMap, C_3>]) extends infer T ? T extends ([import("effect-app/client").GetEffectError<CTXMap, C_3>] extends [never] ? [] : [import("effect-app/client").GetEffectError<CTXMap, C_3>]) ? T extends readonly S.Schema.All[] ? S.Union<T> : typeof S.Never : never : never> & {
|
|
122
|
-
config: Omit<C_3, "success" | "failure">;
|
|
123
|
-
};
|
|
124
|
-
<Tag extends string, Payload_4 extends S.Struct.Fields>(tag: Tag, fields: Payload_4): S.TaggedRequestClass<Self, Tag, {
|
|
125
|
-
readonly _tag: S.tag<Tag>;
|
|
126
|
-
} & Payload_4, typeof S.Void, never>;
|
|
127
|
-
};
|
|
128
|
-
declare const GetSomething_base: S.TaggedRequestClass<GetSomething, "GetSomething", {
|
|
129
|
-
readonly _tag: S.tag<"GetSomething">;
|
|
130
|
-
} & {
|
|
131
|
-
id: typeof S.String;
|
|
132
|
-
}, typeof S.Void, S.Union<[typeof UnauthorizedError]>> & {
|
|
133
|
-
config: Omit<{
|
|
134
|
-
success: typeof S.Void;
|
|
135
|
-
}, "success" | "failure">;
|
|
136
|
-
};
|
|
137
|
-
export declare class GetSomething extends GetSomething_base {
|
|
138
|
-
}
|
|
139
|
-
declare const GetSomethingElse_base: S.TaggedRequestClass<GetSomethingElse, "GetSomethingElse", {
|
|
140
|
-
readonly _tag: S.tag<"GetSomethingElse">;
|
|
141
|
-
} & {
|
|
142
|
-
id: typeof S.String;
|
|
143
|
-
}, typeof S.String, S.Union<[typeof UnauthorizedError]>> & {
|
|
144
|
-
config: Omit<{
|
|
145
|
-
success: typeof S.String;
|
|
146
|
-
}, "success" | "failure">;
|
|
147
|
-
};
|
|
148
|
-
export declare class GetSomethingElse extends GetSomethingElse_base {
|
|
149
|
-
}
|
|
150
|
-
declare const SomethingService_base: import("effect/Effect").Service.Class<SomethingService, "SomethingService", {
|
|
151
|
-
readonly dependencies: readonly [];
|
|
152
|
-
readonly effect: Effect.Effect<{}, never, never>;
|
|
153
|
-
}>;
|
|
154
|
-
export declare class SomethingService extends SomethingService_base {
|
|
155
|
-
}
|
|
156
|
-
declare const SomethingRepo_base: import("effect/Effect").Service.Class<SomethingRepo, "SomethingRepo", {
|
|
157
|
-
readonly dependencies: readonly [Layer.Layer<SomethingService, never, never>];
|
|
158
|
-
readonly effect: Effect.Effect<{}, never, SomethingService>;
|
|
159
|
-
}>;
|
|
160
|
-
export declare class SomethingRepo extends SomethingRepo_base {
|
|
161
|
-
}
|
|
162
|
-
declare const SomethingService2_base: import("effect/Effect").Service.Class<SomethingService2, "SomethingService2", {
|
|
163
|
-
readonly dependencies: readonly [];
|
|
164
|
-
readonly effect: Effect.Effect<{}, never, never>;
|
|
165
|
-
}>;
|
|
166
|
-
export declare class SomethingService2 extends SomethingService2_base {
|
|
167
|
-
}
|
|
168
|
-
export {};
|
|
169
|
-
//# sourceMappingURL=controller.test%20copy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.test copy.d.ts","sourceRoot":"","sources":["../controller.test copy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,OAAO,EAAW,MAAM,EAAY,KAAK,EAAE,CAAC,EAAY,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAwC,KAAK,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAe,iBAAiB,EAAE,MAAM,iBAAiB,CAA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