@fncts/http 0.0.4 → 0.0.5
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/BodyError.d.ts +3 -3
- package/IncomingMessage/api.d.ts +4 -4
- package/Route/api.d.ts +4 -4
- package/_cjs/BodyError.cjs.map +1 -1
- package/_cjs/IncomingMessage/api.cjs +2 -2
- package/_cjs/IncomingMessage/api.cjs.map +1 -1
- package/_mjs/BodyError.mjs.map +1 -1
- package/_mjs/IncomingMessage/api.mjs +2 -2
- package/_mjs/IncomingMessage/api.mjs.map +1 -1
- package/_src/BodyError.ts +1 -1
- package/_src/IncomingMessage/api.ts +3 -3
- package/_src/Route/api.ts +3 -3
- package/package.json +4 -4
package/BodyError.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParseError } from "@fncts/schema/ParseError";
|
|
2
2
|
export declare const BodyErrorTypeId: unique symbol;
|
|
3
3
|
export type BodyErrorTypeId = typeof BodyErrorTypeId;
|
|
4
4
|
export declare const enum BodyErrorTag {
|
|
@@ -18,9 +18,9 @@ export declare class JsonError extends BodyError {
|
|
|
18
18
|
constructor(error: unknown);
|
|
19
19
|
}
|
|
20
20
|
export declare class SchemaError extends BodyError {
|
|
21
|
-
readonly error:
|
|
21
|
+
readonly error: ParseError;
|
|
22
22
|
readonly _tag = BodyErrorTag.SchemaError;
|
|
23
|
-
constructor(error:
|
|
23
|
+
constructor(error: ParseError);
|
|
24
24
|
}
|
|
25
25
|
export type Concrete = JsonError | SchemaError;
|
|
26
26
|
/**
|
package/IncomingMessage/api.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Schema } from "@fncts/schema/Schema/definition";
|
|
2
2
|
import { IO } from "@fncts/io/IO";
|
|
3
|
-
import {
|
|
3
|
+
import { ParseError } from "@fncts/schema/ParseError";
|
|
4
4
|
import type { IncomingMessage } from "./definition.js";
|
|
5
5
|
/**
|
|
6
6
|
* @tsplus pipeable fncts.http.IncomingMessage schemaBodyJson
|
|
7
7
|
* @tsplus location "@fncts/http/IncomingMessage/api"
|
|
8
8
|
*/
|
|
9
|
-
export declare function schemaBodyJson<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E |
|
|
9
|
+
export declare function schemaBodyJson<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E | ParseError, A>;
|
|
10
10
|
/**
|
|
11
11
|
* @tsplus pipeable fncts.http.IncomingMessage schemaBodyUrlParams
|
|
12
12
|
* @tsplus location "@fncts/http/IncomingMessage/api"
|
|
13
13
|
*/
|
|
14
|
-
export declare function schemaBodyUrlParams<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E |
|
|
14
|
+
export declare function schemaBodyUrlParams<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E | ParseError, A>;
|
|
15
15
|
/**
|
|
16
16
|
* @tsplus pipeable fncts.http.IncomingMessage schemaHeaders
|
|
17
17
|
* @tsplus location "@fncts/http/IncomingMessage/api"
|
|
18
18
|
*/
|
|
19
|
-
export declare function schemaHeaders<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E |
|
|
19
|
+
export declare function schemaHeaders<A>(schema: Schema<A>): <E>(self: IncomingMessage<E>) => IO<never, E | ParseError, A>;
|
package/Route/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "@fncts/schema/Schema/definition";
|
|
2
2
|
import { IO } from "@fncts/io/IO";
|
|
3
|
-
import {
|
|
3
|
+
import { ParseError } from "@fncts/schema/ParseError";
|
|
4
4
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
5
|
import type { Method } from "../Method.js";
|
|
6
6
|
import type { PathInput } from "./definition.js";
|
|
@@ -19,17 +19,17 @@ export declare const searchParams: import("@fncts/io/IO.js").IO<RouteContext, ne
|
|
|
19
19
|
* @tsplus static fncts.http.RouteContextOps schemaParams
|
|
20
20
|
* @tsplus location "@fncts/http/Route/api"
|
|
21
21
|
*/
|
|
22
|
-
export declare function schemaParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
22
|
+
export declare function schemaParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A>;
|
|
23
23
|
/**
|
|
24
24
|
* @tsplus static fncts.http.RouteContextOps schemaPathParams
|
|
25
25
|
* @tsplus location "@fncts/http/Route/api"
|
|
26
26
|
*/
|
|
27
|
-
export declare function schemaPathParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
27
|
+
export declare function schemaPathParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A>;
|
|
28
28
|
/**
|
|
29
29
|
* @tsplus static fncts.http.RouteContextOps schemaSearchParams
|
|
30
30
|
* @tsplus location "@fncts/http/Route/api"
|
|
31
31
|
*/
|
|
32
|
-
export declare function schemaSearchParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
32
|
+
export declare function schemaSearchParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A>;
|
|
33
33
|
/**
|
|
34
34
|
* @tsplus static fncts.http.RouteOps __call
|
|
35
35
|
* @tsplus location "@fncts/http/Route/api"
|
package/_cjs/BodyError.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyError.cjs","names":["BodyErrorTypeId","exports","Symbol","for","BodyError","constructor","_a","JsonError","error","_tag","SchemaError","concrete","self"],"sources":["../_src/BodyError.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAAO,MAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,sBAAsB,CAAC;AAQjE;;;;AAIM,MAAgBC,SAAS;EAA/BC,YAAA;IACW,KAAAC,EAAA,CAAiB,GAAoBN,eAAe;EAC/D;;AAACC,OAAA,CAAAG,SAAA,GAAAA,SAAA;KADWJ,eAAe;AAGrB,MAAOO,SAAU,SAAQH,SAAS;EAEtCC,YAAqBG,KAAc;IACjC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AACDR,OAAA,CAAAM,SAAA,GAAAA,SAAA;AAEK,MAAOG,WAAY,SAAQN,SAAS;EAExCC,YAAqBG,
|
|
1
|
+
{"version":3,"file":"BodyError.cjs","names":["BodyErrorTypeId","exports","Symbol","for","BodyError","constructor","_a","JsonError","error","_tag","SchemaError","concrete","self"],"sources":["../_src/BodyError.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAAO,MAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,sBAAsB,CAAC;AAQjE;;;;AAIM,MAAgBC,SAAS;EAA/BC,YAAA;IACW,KAAAC,EAAA,CAAiB,GAAoBN,eAAe;EAC/D;;AAACC,OAAA,CAAAG,SAAA,GAAAA,SAAA;KADWJ,eAAe;AAGrB,MAAOO,SAAU,SAAQH,SAAS;EAEtCC,YAAqBG,KAAc;IACjC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AACDR,OAAA,CAAAM,SAAA,GAAAA,SAAA;AAEK,MAAOG,WAAY,SAAQN,SAAS;EAExCC,YAAqBG,KAAiB;IACpC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AAKF;;;AAAAR,OAAA,CAAAS,WAAA,GAAAA,WAAA;AAGM,SAAUC,QAAQA,CAACC,IAAe;EACtC;AAAA"}
|
|
@@ -16,14 +16,14 @@ const fileName_1 = "(@fncts/http) src/IncomingMessage/api.ts";
|
|
|
16
16
|
*/
|
|
17
17
|
function schemaBodyJson(schema) {
|
|
18
18
|
const decode = tsplus_module_1.decode(schema);
|
|
19
|
-
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":8:
|
|
19
|
+
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":8:90")(self.json);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* @tsplus pipeable fncts.http.IncomingMessage schemaBodyUrlParams
|
|
23
23
|
*/
|
|
24
24
|
function schemaBodyUrlParams(schema) {
|
|
25
25
|
const decode = tsplus_module_1.decode(schema);
|
|
26
|
-
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":16:
|
|
26
|
+
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":16:99")(self.urlParamsBody);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* @tsplus pipeable fncts.http.IncomingMessage schemaHeaders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":["schemaBodyJson","schema","decode","tsplus_module_1","self","tsplus_module_2","flatMap","fileName_1","json","schemaBodyUrlParams","urlParamsBody","schemaHeaders","headers"],"sources":["../../_src/IncomingMessage/api.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAEA;;;AAGM,SAAUA,cAAcA,CAAIC,MAAiB;EACjD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,
|
|
1
|
+
{"version":3,"file":"api.cjs","names":["schemaBodyJson","schema","decode","tsplus_module_1","self","tsplus_module_2","flatMap","fileName_1","json","schemaBodyUrlParams","urlParamsBody","schemaHeaders","headers"],"sources":["../../_src/IncomingMessage/api.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAEA;;;AAGM,SAAUA,cAAcA,CAAIC,MAAiB;EACjD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCC,eAAA,CAAAC,OAAA,CAAkBJ,MAAM,EAAAK,UAAA,YAAxBH,IAAI,CAACI,IAAI,CAAgB;AACjG;AAEA;;;AAGM,SAAUC,mBAAmBA,CAAIR,MAAiB;EACtD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCC,eAAA,CAAAC,OAAA,CAA2BJ,MAAM,EAAAK,UAAA,aAAjCH,IAAI,CAACM,aAAa,CAAgB;AAC1G;AAEA;;;AAGM,SAAUC,aAAaA,CAAIV,MAAiB;EAChD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCF,MAAM,CAACE,IAAI,CAACQ,OAAO,CAAC;AAC5F"}
|
package/_mjs/BodyError.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyError.mjs","names":["BodyErrorTypeId","Symbol","for","BodyError","constructor","_a","JsonError","error","_tag","SchemaError","concrete","self"],"sources":["../_src/BodyError.ts"],"sourcesContent":[null],"mappings":";AAAA,OAAO,MAAMA,eAAe,gBAAGC,MAAM,CAACC,GAAG,CAAC,sBAAsB,CAAC;AAQjE;;;;AAIA,OAAM,MAAgBC,SAAS;EAA/BC,YAAA;IACW,KAAAC,EAAA,CAAiB,GAAoBL,eAAe;EAC/D;;KADYA,eAAe;AAG3B,OAAM,MAAOM,SAAU,SAAQH,SAAS;EAEtCC,YAAqBG,KAAc;IACjC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AAGF,OAAM,MAAOC,WAAY,SAAQN,SAAS;EAExCC,YAAqBG,
|
|
1
|
+
{"version":3,"file":"BodyError.mjs","names":["BodyErrorTypeId","Symbol","for","BodyError","constructor","_a","JsonError","error","_tag","SchemaError","concrete","self"],"sources":["../_src/BodyError.ts"],"sourcesContent":[null],"mappings":";AAAA,OAAO,MAAMA,eAAe,gBAAGC,MAAM,CAACC,GAAG,CAAC,sBAAsB,CAAC;AAQjE;;;;AAIA,OAAM,MAAgBC,SAAS;EAA/BC,YAAA;IACW,KAAAC,EAAA,CAAiB,GAAoBL,eAAe;EAC/D;;KADYA,eAAe;AAG3B,OAAM,MAAOM,SAAU,SAAQH,SAAS;EAEtCC,YAAqBG,KAAc;IACjC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AAGF,OAAM,MAAOC,WAAY,SAAQN,SAAS;EAExCC,YAAqBG,KAAiB;IACpC,KAAK,EAAE;IADY,KAAAA,KAAK,GAALA,KAAK;IADjB,KAAAC,IAAI;EAGb;;AAKF;;;AAGA,OAAM,SAAUE,QAAQA,CAACC,IAAe;EACtC;AAAA"}
|
|
@@ -6,14 +6,14 @@ import * as tsplus_module_2 from "@fncts/io/IO/api";
|
|
|
6
6
|
*/
|
|
7
7
|
export function schemaBodyJson(schema) {
|
|
8
8
|
const decode = tsplus_module_1.decode(schema);
|
|
9
|
-
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":8:
|
|
9
|
+
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":8:90")(self.json);
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* @tsplus pipeable fncts.http.IncomingMessage schemaBodyUrlParams
|
|
13
13
|
*/
|
|
14
14
|
export function schemaBodyUrlParams(schema) {
|
|
15
15
|
const decode = tsplus_module_1.decode(schema);
|
|
16
|
-
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":16:
|
|
16
|
+
return self => tsplus_module_2.flatMap(decode, fileName_1 + ":16:99")(self.urlParamsBody);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @tsplus pipeable fncts.http.IncomingMessage schemaHeaders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","names":["schemaBodyJson","schema","decode","tsplus_module_1","self","tsplus_module_2","flatMap","fileName_1","json","schemaBodyUrlParams","urlParamsBody","schemaHeaders","headers"],"sources":["../../_src/IncomingMessage/api.ts"],"sourcesContent":[null],"mappings":";;;AAEA;;;AAGA,OAAM,SAAUA,cAAcA,CAAIC,MAAiB;EACjD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,
|
|
1
|
+
{"version":3,"file":"api.mjs","names":["schemaBodyJson","schema","decode","tsplus_module_1","self","tsplus_module_2","flatMap","fileName_1","json","schemaBodyUrlParams","urlParamsBody","schemaHeaders","headers"],"sources":["../../_src/IncomingMessage/api.ts"],"sourcesContent":[null],"mappings":";;;AAEA;;;AAGA,OAAM,SAAUA,cAAcA,CAAIC,MAAiB;EACjD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCC,eAAA,CAAAC,OAAA,CAAkBJ,MAAM,EAAAK,UAAA,YAAxBH,IAAI,CAACI,IAAI,CAAgB;AACjG;AAEA;;;AAGA,OAAM,SAAUC,mBAAmBA,CAAIR,MAAiB;EACtD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCC,eAAA,CAAAC,OAAA,CAA2BJ,MAAM,EAAAK,UAAA,aAAjCH,IAAI,CAACM,aAAa,CAAgB;AAC1G;AAEA;;;AAGA,OAAM,SAAUC,aAAaA,CAAIV,MAAiB;EAChD,MAAMC,MAAM,GAAAC,eAAA,CAAAD,MAAA,CAAGD,MAAM,CAAO;EAC5B,OAAWG,IAAwB,IAAmCF,MAAM,CAACE,IAAI,CAACQ,OAAO,CAAC;AAC5F"}
|
package/_src/BodyError.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { IncomingMessage } from "./definition.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export function schemaBodyJson<A>(schema: Schema<A>) {
|
|
7
7
|
const decode = schema.decode;
|
|
8
|
-
return <E>(self: IncomingMessage<E>): IO<never, E |
|
|
8
|
+
return <E>(self: IncomingMessage<E>): IO<never, E | ParseError, A> => self.json.flatMap(decode);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -13,7 +13,7 @@ export function schemaBodyJson<A>(schema: Schema<A>) {
|
|
|
13
13
|
*/
|
|
14
14
|
export function schemaBodyUrlParams<A>(schema: Schema<A>) {
|
|
15
15
|
const decode = schema.decode;
|
|
16
|
-
return <E>(self: IncomingMessage<E>): IO<never, E |
|
|
16
|
+
return <E>(self: IncomingMessage<E>): IO<never, E | ParseError, A> => self.urlParamsBody.flatMap(decode);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -21,5 +21,5 @@ export function schemaBodyUrlParams<A>(schema: Schema<A>) {
|
|
|
21
21
|
*/
|
|
22
22
|
export function schemaHeaders<A>(schema: Schema<A>) {
|
|
23
23
|
const decode = schema.decode;
|
|
24
|
-
return <E>(self: IncomingMessage<E>): IO<never, E |
|
|
24
|
+
return <E>(self: IncomingMessage<E>): IO<never, E | ParseError, A> => decode(self.headers);
|
|
25
25
|
}
|
package/_src/Route/api.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const searchParams = IO.service(RouteContext.Tag).map((routeContext) => r
|
|
|
17
17
|
/**
|
|
18
18
|
* @tsplus static fncts.http.RouteContextOps schemaParams
|
|
19
19
|
*/
|
|
20
|
-
export function schemaParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
20
|
+
export function schemaParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A> {
|
|
21
21
|
const decode = schema.decode;
|
|
22
22
|
return IO.service(RouteContext.Tag).flatMap((routeContext) =>
|
|
23
23
|
decode({ ...routeContext.params, ...routeContext.searchParams }),
|
|
@@ -27,7 +27,7 @@ export function schemaParams<A>(schema: Schema<A>): IO<RouteContext, ParseFailur
|
|
|
27
27
|
/**
|
|
28
28
|
* @tsplus static fncts.http.RouteContextOps schemaPathParams
|
|
29
29
|
*/
|
|
30
|
-
export function schemaPathParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
30
|
+
export function schemaPathParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A> {
|
|
31
31
|
const decode = schema.decode;
|
|
32
32
|
return params.flatMap(decode);
|
|
33
33
|
}
|
|
@@ -35,7 +35,7 @@ export function schemaPathParams<A>(schema: Schema<A>): IO<RouteContext, ParseFa
|
|
|
35
35
|
/**
|
|
36
36
|
* @tsplus static fncts.http.RouteContextOps schemaSearchParams
|
|
37
37
|
*/
|
|
38
|
-
export function schemaSearchParams<A>(schema: Schema<A>): IO<RouteContext,
|
|
38
|
+
export function schemaSearchParams<A>(schema: Schema<A>): IO<RouteContext, ParseError, A> {
|
|
39
39
|
const decode = schema.decode;
|
|
40
40
|
return searchParams.flatMap(decode);
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fncts/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@fncts/base": "0.0.
|
|
6
|
-
"@fncts/io": "0.0.
|
|
7
|
-
"@fncts/schema": "0.0.
|
|
5
|
+
"@fncts/base": "0.0.36",
|
|
6
|
+
"@fncts/io": "0.0.44",
|
|
7
|
+
"@fncts/schema": "0.0.17",
|
|
8
8
|
"@fncts/typelevel": "0.0.18",
|
|
9
9
|
"find-my-way": "^8.1.0",
|
|
10
10
|
"find-my-way-ts": "^0.1.1",
|