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.
- package/CHANGELOG.md +23 -0
- package/_cjs/client/clientFor.cjs +147 -96
- package/_cjs/client/clientFor.cjs.map +1 -1
- package/_cjs/client.cjs +0 -11
- package/_cjs/client.cjs.map +1 -1
- package/dist/client/clientFor.d.ts +38 -28
- package/dist/client/clientFor.d.ts.map +1 -1
- package/dist/client/clientFor.js +115 -97
- package/dist/client.d.ts +0 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -2
- package/package.json +9 -39
- package/src/client/clientFor.ts +241 -158
- package/src/client.ts +0 -1
- package/_cjs/client/clientFor2.cjs +0 -197
- package/_cjs/client/clientFor2.cjs.map +0 -1
- package/_cjs/client/fetch.cjs +0 -176
- package/_cjs/client/fetch.cjs.map +0 -1
- package/_cjs/client/router.cjs +0 -31
- package/_cjs/client/router.cjs.map +0 -1
- package/dist/client/clientFor2.d.ts +0 -49
- package/dist/client/clientFor2.d.ts.map +0 -1
- package/dist/client/clientFor2.js +0 -165
- package/dist/client/fetch.d.ts +0 -56
- package/dist/client/fetch.d.ts.map +0 -1
- package/dist/client/fetch.js +0 -158
- package/dist/client/router.d.ts +0 -32
- package/dist/client/router.d.ts.map +0 -1
- package/dist/client/router.js +0 -17
- package/src/client/clientFor2.ts +0 -339
- package/src/client/fetch.ts +0 -299
- package/src/client/router.ts +0 -87
package/src/client/router.ts
DELETED
|
@@ -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
|
-
}
|