effect-app 1.19.1 → 1.21.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.
@@ -1,87 +0,0 @@
1
- import type { BuildRequest } from "@effect-app/schema/REST"
2
- import { Req as Req_ } from "@effect-app/schema/REST"
3
- import { S } from "../lib.js"
4
-
5
- // TODO: get rid of Request in Request and Response in C
6
- export const makeClientRouter = <RequestConfig extends object>() => {
7
- // Long way around Context/C extends etc to support actual jsdoc from passed in RequestConfig etc...
8
- type Context = { success: S.Schema.Any }
9
- function Req<M>(): {
10
- <Fields extends S.Struct.Fields, C extends Context>(
11
- fields: Fields,
12
- config: RequestConfig & C
13
- ):
14
- & BuildRequest<
15
- Fields,
16
- "/",
17
- "AUTO",
18
- M,
19
- C & { Response: C["success"] }
20
- >
21
- & {
22
- Request: BuildRequest<
23
- Fields,
24
- "/",
25
- "AUTO",
26
- M,
27
- C & { Response: C["success"] }
28
- >
29
- }
30
- <Fields extends S.Struct.Fields, C extends Record<string, any>>(
31
- fields: Fields,
32
- config: C & RequestConfig
33
- ):
34
- & BuildRequest<
35
- Fields,
36
- "/",
37
- "AUTO",
38
- M,
39
- C & { success: typeof S.Void; Response: typeof S.Void }
40
- >
41
- & {
42
- Request: BuildRequest<
43
- Fields,
44
- "/",
45
- "AUTO",
46
- M,
47
- C & { success: typeof S.Void; Response: typeof S.Void }
48
- >
49
- }
50
- <Fields extends S.Struct.Fields>(
51
- fields: Fields
52
- ):
53
- & BuildRequest<
54
- Fields,
55
- "/",
56
- "AUTO",
57
- M,
58
- {
59
- success: typeof S.Void
60
- Response: typeof S.Void
61
- }
62
- >
63
- & {
64
- Request: BuildRequest<
65
- Fields,
66
- "/",
67
- "AUTO",
68
- M,
69
- { success: typeof S.Void; Response: typeof S.Void }
70
- >
71
- }
72
- } {
73
- return (<Fields extends S.Struct.Fields, C extends Context>(
74
- fields: Fields,
75
- config?: C
76
- ) => {
77
- // TODO: get rid of Response, just use success (only all legacy migrated)
78
- const req = config?.success
79
- ? Req_<C>({ ...config, Response: config.success })<M>()<Fields>(fields)
80
- : Req_({ ...config, success: S.Void, Response: S.Void })<M>()<Fields>(fields)
81
- const req2 = Object.assign(req, { Request: req }) // bwc
82
- return req2
83
- }) as any
84
- }
85
-
86
- return Req
87
- }