@effect/platform 0.42.7 → 0.43.1
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/dist/cjs/Http/Body.js.map +1 -1
- package/dist/cjs/Http/ClientResponse.js.map +1 -1
- package/dist/cjs/Http/IncomingMessage.js +3 -3
- package/dist/cjs/Http/IncomingMessage.js.map +1 -1
- package/dist/cjs/Http/Multipart.js.map +1 -1
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/cjs/Http/ServerRequest.js.map +1 -1
- package/dist/cjs/Http/UrlParams.js +1 -1
- package/dist/cjs/Http/UrlParams.js.map +1 -1
- package/dist/cjs/Transferable.js +13 -16
- package/dist/cjs/Transferable.js.map +1 -1
- package/dist/cjs/WorkerRunner.js.map +1 -1
- package/dist/cjs/internal/http/body.js.map +1 -1
- package/dist/cjs/internal/http/clientRequest.js.map +1 -1
- package/dist/cjs/internal/http/clientResponse.js +2 -2
- package/dist/cjs/internal/http/clientResponse.js.map +1 -1
- package/dist/cjs/internal/http/multipart.js +2 -2
- package/dist/cjs/internal/http/multipart.js.map +1 -1
- package/dist/cjs/internal/http/router.js +3 -3
- package/dist/cjs/internal/http/router.js.map +1 -1
- package/dist/cjs/internal/http/serverRequest.js.map +1 -1
- package/dist/cjs/internal/http/serverResponse.js.map +1 -1
- package/dist/cjs/internal/keyValueStore.js +1 -1
- package/dist/cjs/internal/keyValueStore.js.map +1 -1
- package/dist/cjs/internal/workerRunner.js +1 -1
- package/dist/cjs/internal/workerRunner.js.map +1 -1
- package/dist/dts/Http/Body.d.ts +1 -1
- package/dist/dts/Http/Body.d.ts.map +1 -1
- package/dist/dts/Http/Client.d.ts +2 -2
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/ClientRequest.d.ts +3 -3
- package/dist/dts/Http/ClientRequest.d.ts.map +1 -1
- package/dist/dts/Http/ClientResponse.d.ts +6 -6
- package/dist/dts/Http/ClientResponse.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +3 -3
- package/dist/dts/Http/IncomingMessage.d.ts.map +1 -1
- package/dist/dts/Http/Multipart.d.ts +5 -5
- package/dist/dts/Http/Multipart.d.ts.map +1 -1
- package/dist/dts/Http/Router.d.ts +3 -3
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/ServerRequest.d.ts +6 -6
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
- package/dist/dts/Http/ServerResponse.d.ts +1 -1
- package/dist/dts/Http/ServerResponse.d.ts.map +1 -1
- package/dist/dts/Http/UrlParams.d.ts +3 -3
- package/dist/dts/KeyValueStore.d.ts +9 -9
- package/dist/dts/KeyValueStore.d.ts.map +1 -1
- package/dist/dts/Transferable.d.ts +3 -3
- package/dist/dts/Transferable.d.ts.map +1 -1
- package/dist/dts/Worker.d.ts +5 -5
- package/dist/dts/Worker.d.ts.map +1 -1
- package/dist/dts/WorkerRunner.d.ts +3 -3
- package/dist/dts/WorkerRunner.d.ts.map +1 -1
- package/dist/dts/internal/http/router.d.ts.map +1 -1
- package/dist/esm/Http/Body.js.map +1 -1
- package/dist/esm/Http/ClientResponse.js.map +1 -1
- package/dist/esm/Http/IncomingMessage.js +3 -3
- package/dist/esm/Http/IncomingMessage.js.map +1 -1
- package/dist/esm/Http/Multipart.js.map +1 -1
- package/dist/esm/Http/Router.js.map +1 -1
- package/dist/esm/Http/ServerRequest.js.map +1 -1
- package/dist/esm/Http/UrlParams.js +1 -1
- package/dist/esm/Http/UrlParams.js.map +1 -1
- package/dist/esm/Transferable.js +14 -17
- package/dist/esm/Transferable.js.map +1 -1
- package/dist/esm/WorkerRunner.js.map +1 -1
- package/dist/esm/internal/http/body.js.map +1 -1
- package/dist/esm/internal/http/clientRequest.js.map +1 -1
- package/dist/esm/internal/http/clientResponse.js +2 -2
- package/dist/esm/internal/http/clientResponse.js.map +1 -1
- package/dist/esm/internal/http/multipart.js +2 -2
- package/dist/esm/internal/http/multipart.js.map +1 -1
- package/dist/esm/internal/http/router.js +3 -3
- package/dist/esm/internal/http/router.js.map +1 -1
- package/dist/esm/internal/http/serverRequest.js.map +1 -1
- package/dist/esm/internal/http/serverResponse.js.map +1 -1
- package/dist/esm/internal/keyValueStore.js +1 -1
- package/dist/esm/internal/keyValueStore.js.map +1 -1
- package/dist/esm/internal/workerRunner.js +1 -1
- package/dist/esm/internal/workerRunner.js.map +1 -1
- package/package.json +3 -3
- package/src/Http/Body.ts +3 -3
- package/src/Http/Client.ts +6 -6
- package/src/Http/ClientRequest.ts +4 -4
- package/src/Http/ClientResponse.ts +7 -6
- package/src/Http/IncomingMessage.ts +11 -9
- package/src/Http/Multipart.ts +8 -8
- package/src/Http/Router.ts +9 -9
- package/src/Http/ServerRequest.ts +19 -19
- package/src/Http/ServerResponse.ts +3 -3
- package/src/Http/UrlParams.ts +6 -6
- package/src/KeyValueStore.ts +10 -10
- package/src/Transferable.ts +30 -32
- package/src/Worker.ts +10 -10
- package/src/WorkerRunner.ts +55 -18
- package/src/internal/http/body.ts +2 -2
- package/src/internal/http/client.ts +6 -6
- package/src/internal/http/clientRequest.ts +5 -5
- package/src/internal/http/clientResponse.ts +8 -6
- package/src/internal/http/multipart.ts +11 -10
- package/src/internal/http/router.ts +8 -6
- package/src/internal/http/serverRequest.ts +13 -11
- package/src/internal/http/serverResponse.ts +3 -3
- package/src/internal/keyValueStore.ts +7 -7
- package/src/internal/workerRunner.ts +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerRunner.js","names":["Schema","Serializable","Cause","Chunk","Context","Effect","Either","ExecutionStrategy","Exit","Fiber","identity","pipe","Layer","Option","Queue","Scope","Stream","Transferable","WorkerError","PlatformRunnerTypeId","Symbol","for","PlatformRunner","Tag","make","process","options","gen","_","scope","fork","parallel","fiber","getOrThrow","getCurrentFiber","shutdown","zipRight","close","unit","interruptFork","platform","backing","start","extend","fiberMap","Map","take","queue","decode","flatMap","req","succeed","map","data","tap","id","get","interrupt","stream","effect","isEffect","matchCauseEffect","onFailure","cause","match","failureOrCause","onLeft","error","transfers","undefined","encodeError","payload","send","catchAllCause","squash","onRight","onSuccess","encodeOutput","chunks","toReadonlyArray","forEach","push","orDie","runDrain","traceId","spanId","sampled","withParentSpan","_tag","context","empty","ensuring","sync","delete","set","forever","forkIn","layer","scopedDiscard","makeSerialized","schema","handlers","parseRequest","
|
|
1
|
+
{"version":3,"file":"workerRunner.js","names":["Schema","Serializable","Cause","Chunk","Context","Effect","Either","ExecutionStrategy","Exit","Fiber","identity","pipe","Layer","Option","Queue","Scope","Stream","Transferable","WorkerError","PlatformRunnerTypeId","Symbol","for","PlatformRunner","Tag","make","process","options","gen","_","scope","fork","parallel","fiber","getOrThrow","getCurrentFiber","shutdown","zipRight","close","unit","interruptFork","platform","backing","start","extend","fiberMap","Map","take","queue","decode","flatMap","req","succeed","map","data","tap","id","get","interrupt","stream","effect","isEffect","matchCauseEffect","onFailure","cause","match","failureOrCause","onLeft","error","transfers","undefined","encodeError","payload","send","catchAllCause","squash","onRight","onSuccess","encodeOutput","chunks","toReadonlyArray","forEach","push","orDie","runDrain","traceId","spanId","sampled","withParentSpan","_tag","context","empty","ensuring","sync","delete","set","forever","forkIn","layer","scopedDiscard","makeSerialized","schema","handlers","parseRequest","decodeUnknown","request","result","isLayer","buildWithScope","merge","provide","provideContext","message","mapError","serializeFailure","serializeSuccess","layerSerialized"],"sources":["../../../src/internal/workerRunner.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,uBAAuB;AAC/C,OAAO,KAAKC,YAAY,MAAM,6BAA6B;AAC3D,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,iBAAiB,MAAM,0BAA0B;AAC7D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,CAACA,WAAW,CAAC,QAAQ,EAAEiD,KAAK,CAAC,CACpD;IACH;GACD,CAAC,CAAC;AACL,CAAC,CAAQ;AAEX;AACA,OAAO,MAAMgD,eAAe,GAAGA,CAM7Bf,MAA8B,EAC9BC,QAAkB,KAOfzF,KAAK,CAACsF,aAAa,CAACC,cAAc,CAACC,MAAM,EAAEC,QAAQ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "Unified interfaces for common platform-specific services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"path-browserify": "^1.0.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@effect/schema": "^0.
|
|
18
|
-
"effect": "^2.2.
|
|
17
|
+
"@effect/schema": "^0.61.1",
|
|
18
|
+
"effect": "^2.2.2"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
"./package.json": "./package.json",
|
package/src/Http/Body.ts
CHANGED
|
@@ -164,9 +164,9 @@ export const json: (body: unknown) => Effect.Effect<never, BodyError, Uint8Array
|
|
|
164
164
|
* @since 1.0.0
|
|
165
165
|
* @category constructors
|
|
166
166
|
*/
|
|
167
|
-
export const jsonSchema: <I, A>(
|
|
168
|
-
schema: Schema.Schema<I, A>
|
|
169
|
-
) => (body: A) => Effect.Effect<
|
|
167
|
+
export const jsonSchema: <R, I, A>(
|
|
168
|
+
schema: Schema.Schema<R, I, A>
|
|
169
|
+
) => (body: A) => Effect.Effect<R, BodyError, Uint8Array> = internal.jsonSchema
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* @since 1.0.0
|
package/src/Http/Client.ts
CHANGED
|
@@ -359,19 +359,19 @@ export const retry: {
|
|
|
359
359
|
* @category schema
|
|
360
360
|
*/
|
|
361
361
|
export const schemaFunction: {
|
|
362
|
-
<SI, SA>(
|
|
363
|
-
schema: Schema.Schema<SI, SA>
|
|
362
|
+
<SR, SI, SA>(
|
|
363
|
+
schema: Schema.Schema<SR, SI, SA>
|
|
364
364
|
): <R, E, A>(
|
|
365
365
|
self: Client<R, E, A>
|
|
366
366
|
) => (
|
|
367
367
|
request: ClientRequest.ClientRequest
|
|
368
|
-
) => (a: SA) => Effect.Effect<R,
|
|
369
|
-
<R, E, A, SI, SA>(
|
|
368
|
+
) => (a: SA) => Effect.Effect<SR | R, E | ParseResult.ParseError | Error.RequestError, A>
|
|
369
|
+
<R, E, A, SR, SI, SA>(
|
|
370
370
|
self: Client<R, E, A>,
|
|
371
|
-
schema: Schema.Schema<SI, SA>
|
|
371
|
+
schema: Schema.Schema<SR, SI, SA>
|
|
372
372
|
): (
|
|
373
373
|
request: ClientRequest.ClientRequest
|
|
374
|
-
) => (a: SA) => Effect.Effect<R,
|
|
374
|
+
) => (a: SA) => Effect.Effect<R | SR, ParseResult.ParseError | Error.RequestError | E, A>
|
|
375
375
|
} = internal.schemaFunction
|
|
376
376
|
|
|
377
377
|
/**
|
|
@@ -300,11 +300,11 @@ export const unsafeJsonBody: {
|
|
|
300
300
|
* @since 1.0.0
|
|
301
301
|
* @category combinators
|
|
302
302
|
*/
|
|
303
|
-
export const schemaBody: <I, A>(
|
|
304
|
-
schema: Schema.Schema<I, A>
|
|
303
|
+
export const schemaBody: <R, I, A>(
|
|
304
|
+
schema: Schema.Schema<R, I, A>
|
|
305
305
|
) => {
|
|
306
|
-
(body: A): (self: ClientRequest) => Effect.Effect<
|
|
307
|
-
(self: ClientRequest, body: A): Effect.Effect<
|
|
306
|
+
(body: A): (self: ClientRequest) => Effect.Effect<R, Body.BodyError, ClientRequest>
|
|
307
|
+
(self: ClientRequest, body: A): Effect.Effect<R, Body.BodyError, ClientRequest>
|
|
308
308
|
} = internal.schemaBody
|
|
309
309
|
|
|
310
310
|
/**
|
|
@@ -60,23 +60,24 @@ export const fromWeb: (request: ClientRequest.ClientRequest, source: Response) =
|
|
|
60
60
|
* @category schema
|
|
61
61
|
*/
|
|
62
62
|
export const schemaJson: <
|
|
63
|
+
R,
|
|
63
64
|
I extends {
|
|
64
|
-
readonly status?: number
|
|
65
|
-
readonly headers?: Readonly<Record<string, string>>
|
|
65
|
+
readonly status?: number | undefined
|
|
66
|
+
readonly headers?: Readonly<Record<string, string>> | undefined
|
|
66
67
|
readonly body?: unknown
|
|
67
68
|
},
|
|
68
69
|
A
|
|
69
70
|
>(
|
|
70
|
-
schema: Schema.Schema<I, A>
|
|
71
|
-
) => (self: ClientResponse) => Effect.Effect<
|
|
72
|
-
internal.schemaJson
|
|
71
|
+
schema: Schema.Schema<R, I, A>
|
|
72
|
+
) => (self: ClientResponse) => Effect.Effect<R, Error.ResponseError | ParseResult.ParseError, A> = internal.schemaJson
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @since 1.0.0
|
|
76
76
|
* @category schema
|
|
77
77
|
*/
|
|
78
78
|
export const schemaNoBody: <
|
|
79
|
+
R,
|
|
79
80
|
I extends { readonly status?: number | undefined; readonly headers?: Readonly<Record<string, string>> | undefined },
|
|
80
81
|
A
|
|
81
|
-
>(schema: Schema.Schema<I, A>) => (self: ClientResponse) => Effect.Effect<
|
|
82
|
+
>(schema: Schema.Schema<R, I, A>) => (self: ClientResponse) => Effect.Effect<R, ParseResult.ParseError, A> =
|
|
82
83
|
internal.schemaNoBody
|
|
@@ -46,9 +46,9 @@ export interface IncomingMessage<E> {
|
|
|
46
46
|
* @since 1.0.0
|
|
47
47
|
* @category schema
|
|
48
48
|
*/
|
|
49
|
-
export const schemaBodyJson = <I, A>(schema: Schema.Schema<I, A>) => {
|
|
50
|
-
const parse = Schema.
|
|
51
|
-
return <E>(self: IncomingMessage<E>): Effect.Effect<
|
|
49
|
+
export const schemaBodyJson = <R, I, A>(schema: Schema.Schema<R, I, A>) => {
|
|
50
|
+
const parse = Schema.decodeUnknown(schema)
|
|
51
|
+
return <E>(self: IncomingMessage<E>): Effect.Effect<R, E | ParseResult.ParseError, A> =>
|
|
52
52
|
Effect.flatMap(self.json, parse)
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -56,9 +56,11 @@ export const schemaBodyJson = <I, A>(schema: Schema.Schema<I, A>) => {
|
|
|
56
56
|
* @since 1.0.0
|
|
57
57
|
* @category schema
|
|
58
58
|
*/
|
|
59
|
-
export const schemaBodyUrlParams = <I extends Readonly<Record<string, string>>, A>(
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
export const schemaBodyUrlParams = <R, I extends Readonly<Record<string, string>>, A>(
|
|
60
|
+
schema: Schema.Schema<R, I, A>
|
|
61
|
+
) => {
|
|
62
|
+
const parse = Schema.decodeUnknown(schema)
|
|
63
|
+
return <E>(self: IncomingMessage<E>): Effect.Effect<R, E | ParseResult.ParseError, A> =>
|
|
62
64
|
Effect.flatMap(self.urlParamsBody, (_) => parse(Object.fromEntries(_)))
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -66,9 +68,9 @@ export const schemaBodyUrlParams = <I extends Readonly<Record<string, string>>,
|
|
|
66
68
|
* @since 1.0.0
|
|
67
69
|
* @category schema
|
|
68
70
|
*/
|
|
69
|
-
export const schemaHeaders = <I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<I, A>) => {
|
|
70
|
-
const parse = Schema.
|
|
71
|
-
return <E>(self: IncomingMessage<E>): Effect.Effect<
|
|
71
|
+
export const schemaHeaders = <R, I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<R, I, A>) => {
|
|
72
|
+
const parse = Schema.decodeUnknown(schema)
|
|
73
|
+
return <E>(self: IncomingMessage<E>): Effect.Effect<R, ParseResult.ParseError, A> => parse(self.headers)
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
const SpanSchema = Schema.struct({
|
package/src/Http/Multipart.ts
CHANGED
|
@@ -193,27 +193,27 @@ export const withFieldMimeTypes: {
|
|
|
193
193
|
* @since 1.0.0
|
|
194
194
|
* @category schema
|
|
195
195
|
*/
|
|
196
|
-
export const filesSchema: Schema.Schema<ReadonlyArray<PersistedFile>, ReadonlyArray<PersistedFile>> =
|
|
196
|
+
export const filesSchema: Schema.Schema<never, ReadonlyArray<PersistedFile>, ReadonlyArray<PersistedFile>> =
|
|
197
197
|
internal.filesSchema
|
|
198
198
|
|
|
199
199
|
/**
|
|
200
200
|
* @since 1.0.0
|
|
201
201
|
* @category schema
|
|
202
202
|
*/
|
|
203
|
-
export const schemaJson: <I, A>(
|
|
204
|
-
schema: Schema.Schema<I, A>
|
|
203
|
+
export const schemaJson: <R, I, A>(
|
|
204
|
+
schema: Schema.Schema<R, I, A>
|
|
205
205
|
) => {
|
|
206
|
-
(field: string): (persisted: Persisted) => Effect.Effect<
|
|
207
|
-
(persisted: Persisted, field: string): Effect.Effect<
|
|
206
|
+
(field: string): (persisted: Persisted) => Effect.Effect<R, ParseResult.ParseError, A>
|
|
207
|
+
(persisted: Persisted, field: string): Effect.Effect<R, ParseResult.ParseError, A>
|
|
208
208
|
} = internal.schemaJson
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
211
|
* @since 1.0.0
|
|
212
212
|
* @category schema
|
|
213
213
|
*/
|
|
214
|
-
export const schemaPersisted: <I extends Persisted, A>(
|
|
215
|
-
schema: Schema.Schema<I, A>
|
|
216
|
-
) => (persisted: Persisted) => Effect.Effect<
|
|
214
|
+
export const schemaPersisted: <R, I extends Persisted, A>(
|
|
215
|
+
schema: Schema.Schema<R, I, A>
|
|
216
|
+
) => (persisted: Persisted) => Effect.Effect<R, ParseResult.ParseError, A> = internal.schemaPersisted
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
219
|
* @since 1.0.0
|
package/src/Http/Router.ts
CHANGED
|
@@ -145,25 +145,25 @@ export const searchParams: Effect.Effect<
|
|
|
145
145
|
* @since 1.0.0
|
|
146
146
|
* @category route context
|
|
147
147
|
*/
|
|
148
|
-
export const schemaParams: <I extends Readonly<Record<string, string>>, A>(
|
|
149
|
-
schema: Schema.Schema<I, A>
|
|
150
|
-
) => Effect.Effect<RouteContext, ParseResult.ParseError, A> = internal.schemaParams
|
|
148
|
+
export const schemaParams: <R, I extends Readonly<Record<string, string>>, A>(
|
|
149
|
+
schema: Schema.Schema<R, I, A>
|
|
150
|
+
) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaParams
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* @since 1.0.0
|
|
154
154
|
* @category route context
|
|
155
155
|
*/
|
|
156
|
-
export const schemaPathParams: <I extends Readonly<Record<string, string>>, A>(
|
|
157
|
-
schema: Schema.Schema<I, A>
|
|
158
|
-
) => Effect.Effect<RouteContext, ParseResult.ParseError, A> = internal.schemaPathParams
|
|
156
|
+
export const schemaPathParams: <R, I extends Readonly<Record<string, string>>, A>(
|
|
157
|
+
schema: Schema.Schema<R, I, A>
|
|
158
|
+
) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaPathParams
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* @since 1.0.0
|
|
162
162
|
* @category route context
|
|
163
163
|
*/
|
|
164
|
-
export const schemaSearchParams: <I extends Readonly<Record<string, string>>, A>(
|
|
165
|
-
schema: Schema.Schema<I, A>
|
|
166
|
-
) => Effect.Effect<RouteContext, ParseResult.ParseError, A> = internal.schemaSearchParams
|
|
164
|
+
export const schemaSearchParams: <R, I extends Readonly<Record<string, string>>, A>(
|
|
165
|
+
schema: Schema.Schema<R, I, A>
|
|
166
|
+
) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaSearchParams
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
169
|
* @since 1.0.0
|
|
@@ -83,26 +83,26 @@ export const persistedMultipart: Effect.Effect<
|
|
|
83
83
|
* @since 1.0.0
|
|
84
84
|
* @category schema
|
|
85
85
|
*/
|
|
86
|
-
export const schemaHeaders: <I extends Readonly<Record<string, string>>, A>(
|
|
87
|
-
schema: Schema.Schema<I, A>
|
|
88
|
-
) => Effect.Effect<ServerRequest, ParseResult.ParseError, A> = internal.schemaHeaders
|
|
86
|
+
export const schemaHeaders: <R, I extends Readonly<Record<string, string>>, A>(
|
|
87
|
+
schema: Schema.Schema<R, I, A>
|
|
88
|
+
) => Effect.Effect<ServerRequest | R, ParseResult.ParseError, A> = internal.schemaHeaders
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* @since 1.0.0
|
|
92
92
|
* @category schema
|
|
93
93
|
*/
|
|
94
|
-
export const schemaBodyJson: <I, A>(
|
|
95
|
-
schema: Schema.Schema<I, A>
|
|
96
|
-
) => Effect.Effect<ServerRequest, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyJson
|
|
94
|
+
export const schemaBodyJson: <R, I, A>(
|
|
95
|
+
schema: Schema.Schema<R, I, A>
|
|
96
|
+
) => Effect.Effect<ServerRequest | R, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyJson
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* @since 1.0.0
|
|
100
100
|
* @category schema
|
|
101
101
|
*/
|
|
102
|
-
export const schemaBodyForm: <I extends Multipart.Persisted, A>(
|
|
103
|
-
schema: Schema.Schema<I, A>
|
|
102
|
+
export const schemaBodyForm: <R, I extends Multipart.Persisted, A>(
|
|
103
|
+
schema: Schema.Schema<R, I, A>
|
|
104
104
|
) => Effect.Effect<
|
|
105
|
-
ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path,
|
|
105
|
+
ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path | R,
|
|
106
106
|
Multipart.MultipartError | Error.RequestError | ParseResult.ParseError,
|
|
107
107
|
A
|
|
108
108
|
> = internal.schemaBodyForm
|
|
@@ -111,18 +111,18 @@ export const schemaBodyForm: <I extends Multipart.Persisted, A>(
|
|
|
111
111
|
* @since 1.0.0
|
|
112
112
|
* @category schema
|
|
113
113
|
*/
|
|
114
|
-
export const schemaBodyUrlParams: <I extends Readonly<Record<string, string>>, A>(
|
|
115
|
-
schema: Schema.Schema<I, A>
|
|
116
|
-
) => Effect.Effect<ServerRequest, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyUrlParams
|
|
114
|
+
export const schemaBodyUrlParams: <R, I extends Readonly<Record<string, string>>, A>(
|
|
115
|
+
schema: Schema.Schema<R, I, A>
|
|
116
|
+
) => Effect.Effect<ServerRequest | R, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyUrlParams
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* @since 1.0.0
|
|
120
120
|
* @category schema
|
|
121
121
|
*/
|
|
122
|
-
export const schemaBodyMultipart: <I extends Multipart.Persisted, A>(
|
|
123
|
-
schema: Schema.Schema<I, A>
|
|
122
|
+
export const schemaBodyMultipart: <R, I extends Multipart.Persisted, A>(
|
|
123
|
+
schema: Schema.Schema<R, I, A>
|
|
124
124
|
) => Effect.Effect<
|
|
125
|
-
ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path,
|
|
125
|
+
R | ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path,
|
|
126
126
|
Multipart.MultipartError | ParseResult.ParseError,
|
|
127
127
|
A
|
|
128
128
|
> = internal.schemaBodyMultipart
|
|
@@ -131,13 +131,13 @@ export const schemaBodyMultipart: <I extends Multipart.Persisted, A>(
|
|
|
131
131
|
* @since 1.0.0
|
|
132
132
|
* @category schema
|
|
133
133
|
*/
|
|
134
|
-
export const schemaBodyFormJson: <I, A>(
|
|
135
|
-
schema: Schema.Schema<I, A>
|
|
134
|
+
export const schemaBodyFormJson: <R, I, A>(
|
|
135
|
+
schema: Schema.Schema<R, I, A>
|
|
136
136
|
) => (
|
|
137
137
|
field: string
|
|
138
138
|
) => Effect.Effect<
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
R | ServerRequest | FileSystem.FileSystem | Path.Path | Scope.Scope,
|
|
140
|
+
ParseResult.ParseError | Error.RequestError,
|
|
141
141
|
A
|
|
142
142
|
> = internal.schemaBodyFormJson
|
|
143
143
|
|
|
@@ -101,9 +101,9 @@ export const json: (
|
|
|
101
101
|
* @since 1.0.0
|
|
102
102
|
* @category constructors
|
|
103
103
|
*/
|
|
104
|
-
export const schemaJson: <I, A>(
|
|
105
|
-
schema: Schema.Schema<I, A>
|
|
106
|
-
) => (body: A, options?: Options.WithContent) => Effect.Effect<
|
|
104
|
+
export const schemaJson: <R, I, A>(
|
|
105
|
+
schema: Schema.Schema<R, I, A>
|
|
106
|
+
) => (body: A, options?: Options.WithContent | undefined) => Effect.Effect<R, Body.BodyError, ServerResponse> =
|
|
107
107
|
internal.schemaJson
|
|
108
108
|
|
|
109
109
|
/**
|
package/src/Http/UrlParams.ts
CHANGED
|
@@ -207,18 +207,18 @@ const baseUrl = (): string | undefined => {
|
|
|
207
207
|
* @since 1.0.0
|
|
208
208
|
* @category schema
|
|
209
209
|
*/
|
|
210
|
-
export const schemaJson = <I, A>(schema: Schema.Schema<I, A>): {
|
|
210
|
+
export const schemaJson = <R, I, A>(schema: Schema.Schema<R, I, A>): {
|
|
211
211
|
(
|
|
212
212
|
field: string
|
|
213
|
-
): (self: UrlParams) => Effect.Effect<
|
|
213
|
+
): (self: UrlParams) => Effect.Effect<R, ParseResult.ParseError, A>
|
|
214
214
|
(
|
|
215
215
|
self: UrlParams,
|
|
216
216
|
field: string
|
|
217
|
-
): Effect.Effect<
|
|
217
|
+
): Effect.Effect<R, ParseResult.ParseError, A>
|
|
218
218
|
} => {
|
|
219
|
-
const parse = Schema.
|
|
219
|
+
const parse = Schema.decodeUnknown(Schema.parseJson(schema))
|
|
220
220
|
return dual<
|
|
221
|
-
(field: string) => (self: UrlParams) => Effect.Effect<
|
|
222
|
-
(self: UrlParams, field: string) => Effect.Effect<
|
|
221
|
+
(field: string) => (self: UrlParams) => Effect.Effect<R, ParseResult.ParseError, A>,
|
|
222
|
+
(self: UrlParams, field: string) => Effect.Effect<R, ParseResult.ParseError, A>
|
|
223
223
|
>(2, (self, field) => parse(Option.getOrElse(getLast(self, field), () => "")))
|
|
224
224
|
}
|
package/src/KeyValueStore.ts
CHANGED
|
@@ -76,7 +76,7 @@ export interface KeyValueStore {
|
|
|
76
76
|
/**
|
|
77
77
|
* Create a SchemaStore for the specified schema.
|
|
78
78
|
*/
|
|
79
|
-
readonly forSchema: <I, A>(schema: Schema.Schema<I, A>) => SchemaStore<A>
|
|
79
|
+
readonly forSchema: <R, I, A>(schema: Schema.Schema<R, I, A>) => SchemaStore<R, A>
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -86,7 +86,7 @@ export declare namespace KeyValueStore {
|
|
|
86
86
|
/**
|
|
87
87
|
* @since 1.0.0
|
|
88
88
|
*/
|
|
89
|
-
export type AnyStore = KeyValueStore | SchemaStore<any>
|
|
89
|
+
export type AnyStore = KeyValueStore | SchemaStore<any, any>
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -143,14 +143,14 @@ export type SchemaStoreTypeId = typeof SchemaStoreTypeId
|
|
|
143
143
|
* @since 1.0.0
|
|
144
144
|
* @category models
|
|
145
145
|
*/
|
|
146
|
-
export interface SchemaStore<A> {
|
|
146
|
+
export interface SchemaStore<R, A> {
|
|
147
147
|
readonly [SchemaStoreTypeId]: SchemaStoreTypeId
|
|
148
148
|
/**
|
|
149
149
|
* Returns the value of the specified key if it exists.
|
|
150
150
|
*/
|
|
151
151
|
readonly get: (
|
|
152
152
|
key: string
|
|
153
|
-
) => Effect.Effect<
|
|
153
|
+
) => Effect.Effect<R, PlatformError.PlatformError | ParseResult.ParseError, Option.Option<A>>
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Sets the value of the specified key.
|
|
@@ -158,7 +158,7 @@ export interface SchemaStore<A> {
|
|
|
158
158
|
readonly set: (
|
|
159
159
|
key: string,
|
|
160
160
|
value: A
|
|
161
|
-
) => Effect.Effect<
|
|
161
|
+
) => Effect.Effect<R, PlatformError.PlatformError | ParseResult.ParseError, void>
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Removes the specified key.
|
|
@@ -181,7 +181,7 @@ export interface SchemaStore<A> {
|
|
|
181
181
|
readonly modify: (
|
|
182
182
|
key: string,
|
|
183
183
|
f: (value: A) => A
|
|
184
|
-
) => Effect.Effect<
|
|
184
|
+
) => Effect.Effect<R, PlatformError.PlatformError | ParseResult.ParseError, Option.Option<A>>
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
187
|
* Returns true if the KeyValueStore contains the specified key.
|
|
@@ -198,10 +198,10 @@ export interface SchemaStore<A> {
|
|
|
198
198
|
* @since 1.0.0
|
|
199
199
|
* @category layers
|
|
200
200
|
*/
|
|
201
|
-
export const layerSchema: <I, A>(
|
|
202
|
-
schema: Schema.Schema<I, A>,
|
|
201
|
+
export const layerSchema: <R, I, A>(
|
|
202
|
+
schema: Schema.Schema<R, I, A>,
|
|
203
203
|
tagIdentifier?: unknown
|
|
204
204
|
) => {
|
|
205
|
-
readonly tag: Context.Tag<SchemaStore<A>, SchemaStore<A>>
|
|
206
|
-
readonly layer: Layer.Layer<KeyValueStore, never, SchemaStore<A>>
|
|
205
|
+
readonly tag: Context.Tag<SchemaStore<R, A>, SchemaStore<R, A>>
|
|
206
|
+
readonly layer: Layer.Layer<KeyValueStore, never, SchemaStore<R, A>>
|
|
207
207
|
} = internal.layerSchema
|
package/src/Transferable.ts
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import * as AST from "@effect/schema/AST"
|
|
6
5
|
import * as ParseResult from "@effect/schema/ParseResult"
|
|
7
6
|
import * as Schema from "@effect/schema/Schema"
|
|
8
|
-
import { dual } from "effect/Function"
|
|
7
|
+
import { dual, identity } from "effect/Function"
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @since 1.0.0
|
|
@@ -43,18 +42,20 @@ export const get = (u: unknown): ReadonlyArray<globalThis.Transferable> => {
|
|
|
43
42
|
* @category schema
|
|
44
43
|
*/
|
|
45
44
|
export const schema: {
|
|
46
|
-
<A>(
|
|
47
|
-
|
|
45
|
+
<A>(
|
|
46
|
+
f: (_: A) => ReadonlyArray<globalThis.Transferable>
|
|
47
|
+
): <R, I>(self: Schema.Schema<R, I, A>) => Schema.Schema<R, I, A>
|
|
48
|
+
<R, I, A>(self: Schema.Schema<R, I, A>, f: (_: A) => ReadonlyArray<globalThis.Transferable>): Schema.Schema<R, I, A>
|
|
48
49
|
} = dual<
|
|
49
50
|
<A>(
|
|
50
51
|
f: (_: A) => ReadonlyArray<globalThis.Transferable>
|
|
51
|
-
) => <I>(self: Schema.Schema<I, A>) => Schema.Schema<I, A>,
|
|
52
|
-
<I, A>(
|
|
53
|
-
self: Schema.Schema<I, A>,
|
|
52
|
+
) => <R, I>(self: Schema.Schema<R, I, A>) => Schema.Schema<R, I, A>,
|
|
53
|
+
<R, I, A>(
|
|
54
|
+
self: Schema.Schema<R, I, A>,
|
|
54
55
|
f: (_: A) => ReadonlyArray<globalThis.Transferable>
|
|
55
|
-
) => Schema.Schema<I, A>
|
|
56
|
-
>(2, <I, A>(
|
|
57
|
-
self: Schema.Schema<I, A>,
|
|
56
|
+
) => Schema.Schema<R, I, A>
|
|
57
|
+
>(2, <R, I, A>(
|
|
58
|
+
self: Schema.Schema<R, I, A>,
|
|
58
59
|
f: (_: A) => ReadonlyArray<globalThis.Transferable>
|
|
59
60
|
) =>
|
|
60
61
|
Schema.transform(
|
|
@@ -67,35 +68,32 @@ export const schema: {
|
|
|
67
68
|
return f(this as any)
|
|
68
69
|
}
|
|
69
70
|
}) as A,
|
|
70
|
-
|
|
71
|
+
identity
|
|
71
72
|
))
|
|
72
73
|
|
|
74
|
+
const schemaParse =
|
|
75
|
+
<R, A>(parse: ParseResult.DecodeUnknown<R, A>): ParseResult.DeclarationDecodeUnknown<R, A> => (u, options, ast) => {
|
|
76
|
+
if (!isTransferable(u)) {
|
|
77
|
+
return ParseResult.fail(ParseResult.type(ast, u))
|
|
78
|
+
}
|
|
79
|
+
const proto = {
|
|
80
|
+
__proto__: Object.getPrototypeOf(u),
|
|
81
|
+
[symbol]: u[symbol]
|
|
82
|
+
}
|
|
83
|
+
return ParseResult.map(parse(u, options), (a): A => Object.setPrototypeOf(a, proto))
|
|
84
|
+
}
|
|
85
|
+
|
|
73
86
|
/**
|
|
74
87
|
* @since 1.0.0
|
|
75
88
|
* @category schema
|
|
76
89
|
*/
|
|
77
|
-
export const schemaFromSelf = <I, A>(
|
|
78
|
-
item: Schema.Schema<I, A>
|
|
79
|
-
): Schema.Schema<I, A> => {
|
|
90
|
+
export const schemaFromSelf = <R, I, A>(
|
|
91
|
+
item: Schema.Schema<R, I, A>
|
|
92
|
+
): Schema.Schema<R, I, A> => {
|
|
80
93
|
return Schema.declare(
|
|
81
94
|
[item],
|
|
82
|
-
item,
|
|
83
|
-
(
|
|
84
|
-
|
|
85
|
-
return (u, options, ast) => {
|
|
86
|
-
if (!isTransferable(u)) {
|
|
87
|
-
return ParseResult.fail(ParseResult.type(ast, u))
|
|
88
|
-
}
|
|
89
|
-
const proto = {
|
|
90
|
-
__proto__: Object.getPrototypeOf(u),
|
|
91
|
-
[symbol]: u[symbol]
|
|
92
|
-
}
|
|
93
|
-
return ParseResult.map(
|
|
94
|
-
parse(u, options),
|
|
95
|
-
(a) => Object.setPrototypeOf(a, proto)
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{ [AST.IdentifierAnnotationId]: "Transferable" }
|
|
95
|
+
(item) => schemaParse(ParseResult.decodeUnknown(item)),
|
|
96
|
+
(item) => schemaParse(ParseResult.encodeUnknown(item)),
|
|
97
|
+
{ identifier: "Transferable" }
|
|
100
98
|
)
|
|
101
99
|
}
|
package/src/Worker.ts
CHANGED
|
@@ -233,13 +233,13 @@ export interface SerializedWorker<I extends Schema.TaggedRequest.Any> {
|
|
|
233
233
|
readonly id: number
|
|
234
234
|
readonly execute: <Req extends I>(
|
|
235
235
|
message: Req
|
|
236
|
-
) => Req extends Serializable.WithResult<infer _IE, infer E, infer _IA, infer A>
|
|
237
|
-
? Stream.Stream<
|
|
236
|
+
) => Req extends Serializable.WithResult<infer R, infer _IE, infer E, infer _IA, infer A>
|
|
237
|
+
? Stream.Stream<R, E | WorkerError | ParseResult.ParseError, A>
|
|
238
238
|
: never
|
|
239
239
|
readonly executeEffect: <Req extends I>(
|
|
240
240
|
message: Req
|
|
241
|
-
) => Req extends Serializable.WithResult<infer _IE, infer E, infer _IA, infer A>
|
|
242
|
-
? Effect.Effect<
|
|
241
|
+
) => Req extends Serializable.WithResult<infer R, infer _IE, infer E, infer _IA, infer A>
|
|
242
|
+
? Effect.Effect<R, E | WorkerError | ParseResult.ParseError, A>
|
|
243
243
|
: never
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -279,18 +279,18 @@ export interface SerializedWorkerPool<I extends Schema.TaggedRequest.Any> {
|
|
|
279
279
|
readonly backing: Pool.Pool<WorkerError, SerializedWorker<I>>
|
|
280
280
|
readonly broadcast: <Req extends I>(
|
|
281
281
|
message: Req
|
|
282
|
-
) => Req extends Serializable.WithResult<infer _IE, infer E, infer _IA, infer _A>
|
|
283
|
-
? Effect.Effect<
|
|
282
|
+
) => Req extends Serializable.WithResult<infer R, infer _IE, infer E, infer _IA, infer _A>
|
|
283
|
+
? Effect.Effect<R, E | WorkerError | ParseResult.ParseError, void>
|
|
284
284
|
: never
|
|
285
285
|
readonly execute: <Req extends I>(
|
|
286
286
|
message: Req
|
|
287
|
-
) => Req extends Serializable.WithResult<infer _IE, infer E, infer _IA, infer A>
|
|
288
|
-
? Stream.Stream<
|
|
287
|
+
) => Req extends Serializable.WithResult<infer R, infer _IE, infer E, infer _IA, infer A>
|
|
288
|
+
? Stream.Stream<R, E | WorkerError | ParseResult.ParseError, A>
|
|
289
289
|
: never
|
|
290
290
|
readonly executeEffect: <Req extends I>(
|
|
291
291
|
message: Req
|
|
292
|
-
) => Req extends Serializable.WithResult<infer _IE, infer E, infer _IA, infer A>
|
|
293
|
-
? Effect.Effect<
|
|
292
|
+
) => Req extends Serializable.WithResult<infer R, infer _IE, infer E, infer _IA, infer A>
|
|
293
|
+
? Effect.Effect<R, E | WorkerError | ParseResult.ParseError, A>
|
|
294
294
|
: never
|
|
295
295
|
}
|
|
296
296
|
|