@effect/platform 0.37.7 → 0.37.8
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/App.js +20 -4
- package/dist/cjs/Http/App.js.map +1 -1
- package/dist/cjs/Http/ClientResponse.js.map +1 -1
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/cjs/Http/Server.js.map +1 -1
- package/dist/cjs/Http/ServerError.js +14 -1
- package/dist/cjs/Http/ServerError.js.map +1 -1
- package/dist/cjs/Http/ServerRequest.js.map +1 -1
- package/dist/cjs/internal/http/middleware.js +5 -4
- package/dist/cjs/internal/http/middleware.js.map +1 -1
- package/dist/cjs/internal/http/router.js.map +1 -1
- package/dist/cjs/internal/http/serverError.js +14 -1
- package/dist/cjs/internal/http/serverError.js.map +1 -1
- package/dist/dts/Http/App.d.ts +5 -7
- package/dist/dts/Http/App.d.ts.map +1 -1
- package/dist/dts/Http/ClientResponse.d.ts +2 -3
- package/dist/dts/Http/ClientResponse.d.ts.map +1 -1
- package/dist/dts/Http/Router.d.ts +45 -40
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/Server.d.ts +4 -4
- package/dist/dts/Http/Server.d.ts.map +1 -1
- package/dist/dts/Http/ServerError.d.ts +15 -0
- package/dist/dts/Http/ServerError.d.ts.map +1 -1
- package/dist/dts/Http/ServerRequest.d.ts +1 -0
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
- package/dist/dts/internal/http/router.d.ts +1 -1
- package/dist/dts/internal/http/router.d.ts.map +1 -1
- package/dist/esm/Http/App.js +20 -4
- package/dist/esm/Http/App.js.map +1 -1
- package/dist/esm/Http/ClientResponse.js.map +1 -1
- package/dist/esm/Http/Router.js.map +1 -1
- package/dist/esm/Http/Server.js.map +1 -1
- package/dist/esm/Http/ServerError.js +13 -0
- package/dist/esm/Http/ServerError.js.map +1 -1
- package/dist/esm/Http/ServerRequest.js.map +1 -1
- package/dist/esm/internal/http/middleware.js +5 -4
- package/dist/esm/internal/http/middleware.js.map +1 -1
- package/dist/esm/internal/http/router.js.map +1 -1
- package/dist/esm/internal/http/serverError.js +11 -0
- package/dist/esm/internal/http/serverError.js.map +1 -1
- package/package.json +1 -1
- package/src/Http/App.ts +26 -12
- package/src/Http/ClientResponse.ts +1 -2
- package/src/Http/Router.ts +79 -43
- package/src/Http/Server.ts +12 -4
- package/src/Http/ServerError.ts +18 -0
- package/src/Http/ServerRequest.ts +1 -0
- package/src/internal/http/middleware.ts +9 -4
- package/src/internal/http/router.ts +1 -1
- package/src/internal/http/server.ts +5 -5
- package/src/internal/http/serverError.ts +22 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerRequest.js","names":["internal","maxBodySize","TypeId","ServerRequest","serverRequestTag","persistedFormData","schemaHeaders","schemaBodyJson","schemaBodyUrlParams","schemaFormData","schemaFormDataJson","fromWeb"],"sources":["../../../src/Http/ServerRequest.ts"],"sourcesContent":[null],"mappings":"AAUA,OAAO,KAAKA,QAAQ,MAAM,mCAAmC;AAQ7D;AACE;;;;AAIAC,WAAW,QACN,sBAAsB;AAE7B;;;;AAIA,OAAO,MAAMC,MAAM,GAAkBF,QAAQ,CAACE,MAAM;
|
|
1
|
+
{"version":3,"file":"ServerRequest.js","names":["internal","maxBodySize","TypeId","ServerRequest","serverRequestTag","persistedFormData","schemaHeaders","schemaBodyJson","schemaBodyUrlParams","schemaFormData","schemaFormDataJson","fromWeb"],"sources":["../../../src/Http/ServerRequest.ts"],"sourcesContent":[null],"mappings":"AAUA,OAAO,KAAKA,QAAQ,MAAM,mCAAmC;AAQ7D;AACE;;;;AAIAC,WAAW,QACN,sBAAsB;AAE7B;;;;AAIA,OAAO,MAAMC,MAAM,GAAkBF,QAAQ,CAACE,MAAM;AAmCpD;;;;AAIA,OAAO,MAAMC,aAAa,GAA8CH,QAAQ,CAACI,gBAAgB;AAEjG;;;;AAIA,OAAO,MAAMC,iBAAiB,GAI1BL,QAAQ,CAACK,iBAAiB;AAE9B;;;;AAIA,OAAO,MAAMC,aAAa,GAEqCN,QAAQ,CAACM,aAAa;AAErF;;;;AAIA,OAAO,MAAMC,cAAc,GAEyDP,QAAQ,CAACO,cAAc;AAE3G;;;;AAIA,OAAO,MAAMC,mBAAmB,GAEoDR,QAAQ,CAACQ,mBAAmB;AAEhH;;;;AAIA,OAAO,MAAMC,cAAc,GAMvBT,QAAQ,CAACS,cAAc;AAE3B;;;;AAIA,OAAO,MAAMC,kBAAkB,GAQ3BV,QAAQ,CAACU,kBAAkB;AAE/B;;;;AAIA,OAAO,MAAMC,OAAO,GAAwCX,QAAQ,CAACW,OAAO"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as Cause from "effect/Cause";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as FiberRef from "effect/FiberRef";
|
|
4
|
-
import
|
|
4
|
+
import { constFalse, dual } from "effect/Function";
|
|
5
5
|
import { globalValue } from "effect/GlobalValue";
|
|
6
6
|
import * as Headers from "../../Http/Headers.js";
|
|
7
7
|
import * as IncomingMessage from "../../Http/IncomingMessage.js";
|
|
8
|
+
import * as ServerError from "../../Http/ServerError.js";
|
|
8
9
|
import * as ServerRequest from "../../Http/ServerRequest.js";
|
|
9
10
|
/** @internal */
|
|
10
11
|
export const make = middleware => middleware;
|
|
@@ -13,9 +14,9 @@ export const loggerDisabled = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for(
|
|
|
13
14
|
/** @internal */
|
|
14
15
|
export const withLoggerDisabled = self => Effect.zipRight(FiberRef.set(loggerDisabled, true), self);
|
|
15
16
|
/** @internal */
|
|
16
|
-
export const currentTracerDisabledWhen = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("@effect/platform/Http/Middleware/tracerDisabledWhen"), () => FiberRef.unsafeMake(
|
|
17
|
+
export const currentTracerDisabledWhen = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("@effect/platform/Http/Middleware/tracerDisabledWhen"), () => FiberRef.unsafeMake(constFalse));
|
|
17
18
|
/** @internal */
|
|
18
|
-
export const withTracerDisabledWhen = /*#__PURE__*/
|
|
19
|
+
export const withTracerDisabledWhen = /*#__PURE__*/dual(2, (self, pred) => Effect.locally(self, currentTracerDisabledWhen, pred));
|
|
19
20
|
/** @internal */
|
|
20
21
|
export const logger = /*#__PURE__*/make(httpApp => {
|
|
21
22
|
let counter = 0;
|
|
@@ -26,7 +27,7 @@ export const logger = /*#__PURE__*/make(httpApp => {
|
|
|
26
27
|
return exit._tag === "Failure" ? Effect.annotateLogs(Effect.log(exit.cause), {
|
|
27
28
|
"http.method": request.method,
|
|
28
29
|
"http.url": request.url,
|
|
29
|
-
"http.status": Cause.isInterruptedOnly(exit.cause) ? 499 : 500
|
|
30
|
+
"http.status": Cause.isInterruptedOnly(exit.cause) ? ServerError.isClientAbortCause(exit.cause) ? 499 : 503 : 500
|
|
30
31
|
}) : Effect.annotateLogs(Effect.log(""), {
|
|
31
32
|
"http.method": request.method,
|
|
32
33
|
"http.url": request.url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","names":["Cause","Effect","FiberRef","
|
|
1
|
+
{"version":3,"file":"middleware.js","names":["Cause","Effect","FiberRef","constFalse","dual","globalValue","Headers","IncomingMessage","ServerError","ServerRequest","make","middleware","loggerDisabled","Symbol","for","unsafeMake","withLoggerDisabled","self","zipRight","set","currentTracerDisabledWhen","withTracerDisabledWhen","pred","locally","logger","httpApp","counter","flatMap","request","withLogSpan","onExit","exit","get","disabled","unit","_tag","annotateLogs","log","cause","method","url","isInterruptedOnly","isClientAbortCause","value","status","tracer","appWithStatus","tap","response","annotateCurrentSpan","zip","disabledWhen","headers","orElseSucceed","schemaExternalSpan","undefined","succeed","parent","withSpan","attributes","xForwardedHeaders","updateService","modify","remoteAddress","split","trim"],"sources":["../../../../src/internal/http/middleware.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,c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C,CAAC,EAChF,CAAC,CAACQ,OAAO,EAAEuB,YAAY,CAAC,KACtBlD,MAAM,CAAC0B,OAAO,CACZC,OAAO,CAACwB,OAAO,CAAC,cAAc,CAAC,IAAIxB,OAAO,CAACwB,OAAO,CAAC,IAAI,CAAC,GACtDnD,MAAM,CAACoD,aAAa,CAAC9C,eAAe,CAAC+C,kBAAkB,CAAC1B,OAAO,CAAC,EAAE,MAAM2B,SAAS,CAAC,GAClFtD,MAAM,CAACuD,OAAO,CAACD,SAAS,CAAC,EAC1BE,MAAM,IACLN,YAAY,CAACvB,OAAO,CAAC,GACnBH,OAAO,GACPxB,MAAM,CAACyD,QAAQ,CACbZ,aAAa,EACb,QAAQlB,OAAO,CAACW,MAAM,EAAE,EACxB;IAAEoB,UAAU,EAAE;MAAE,aAAa,EAAE/B,OAAO,CAACW,MAAM;MAAE,UAAU,EAAEX,OAAO,CAACY;IAAG,CAAE;IAAEiB;EAAM,CAAE,CACnF,CACN,CACJ;AACH,CAAC,CAAC;AAEF;AACA,OAAO,MAAMG,iBAAiB,gBAAGlD,IAAI,CAAEe,OAAO,IAC5CxB,MAAM,CAAC4D,aAAa,CAACpC,OAAO,EAAEhB,aAAa,CAACA,aAAa,EAAGmB,OAAO,IACjEA,OAAO,CAACwB,OAAO,CAAC,kBAAkB,CAAC,GAC/BxB,OAAO,CAACkC,MAAM,CAAC;EACfV,OAAO,EAAE9C,OAAO,CAACa,GAAG,CAClBS,OAAO,CAACwB,OAAO,EACf,MAAM,EACNxB,OAAO,CAACwB,OAAO,CAAC,kBAAkB,CAAC,CACpC;EACDW,aAAa,EAAEnC,OAAO,CAACwB,OAAO,CAAC,iBAAiB,CAAC,EAAEY,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI;CACtE,CAAC,GACArC,OAAO,CAAC,CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","names":["Schema","Chunk","Context","Effect","Effectable","dual","Inspectable","Option","FindMyWay","Error","ServerRequest","TypeId","Symbol","for","RouteTypeId","RouteContextTypeId","RouteContext","Tag","params","map","_","searchParams","schemaParams","schema","parse","flatMap","schemaPathParams","schemaSearchParams","RouterImpl","StructuralClass","routes","mounts","constructor","httpApp","commit","undefined","toHttpApp","toJSON","_id","toString","format","NodeInspectSymbol","self","router","make","toReadonlyArray","mountsLen","length","forEach","route","method","all","path","on","request","i","app","url","startsWith","provideService","sliceRequestUrl","result","find","fail","RouteNotFound","handler","prefix","_tag","value","mapInputContext","context","add","RouteContextImpl","prefexLen","modify","slice","RouteImpl","none","empty","fromIterable","makeRoute","concat","that","appendAll","removeTrailingSlash","endsWith","prefixAll","orElse","some","mount","mountApp","append","get","post","put","patch","del","head","options","use","f","catchAll","catchAllCause","catchTag","k","catchTags","cases","tag","service","provideServiceEffect","effect"],"sources":["../../../../src/internal/http/router.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,uBAAuB;AAE/C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,WAAW,MAAM,oBAAoB;AACjD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAI3C,OAAO,KAAKC,KAAK,MAAM,2BAA2B;AAClD,OAAO,KAAKC,aAAa,MAAM,6BAA6B;AAG5D;AACA,OAAO,MAAMC,MAAM,gBAAkBC,MAAM,CAACC,GAAG,CAAC,8BAA8B,CAAkB;AAEhG;AACA,OAAO,MAAMC,WAAW,gBAAuBF,MAAM,CAACC,GAAG,CAAC,oCAAoC,CAAuB;AAErH;AACA,OAAO,MAAME,kBAAkB,gBAA8BH,MAAM,CAACC,GAAG,CACrE,2CAA2C,CACf;AA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ErD;AACA,OAAO,MAAMG,QAAQ,gBAAGlG,IAAI,CAY1B,CAAC,EAAE,CAACqC,IAAI,EAAE8D,CAAC,EAAEJ,CAAC,KAAKD,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAACoG,QAAQ,CAACC,CAAC,EAAEJ,CAAC,CAAC,CAAC,CAAC;AAEtD;AACA,OAAO,MAAMK,SAAS,gBA2ClBpG,IAAI,CAAC,CAAC,EAAE,CAACqC,IAA6B,EAAEgE,KAAS,KAAKP,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAACsG,SAAS,CAACC,KAAK,CAAC,CAAC,CAAC;AAE7F,OAAO,MAAM/C,cAAc,gBAAGtD,IAAI,CAYhC,CAAC,EAAE,CACHqC,IAAyB,EACzBiE,GAAM,EACNC,OAA+B,KAE/BT,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAACwD,cAAc,CAACgD,GAAG,EAAEC,OAAO,CAAC,CAAC,CAAC;AAEjD;AACA,OAAO,MAAMC,oBAAoB,gBAAGxG,IAAI,CAkBtC,CAAC,EAAE,CACHqC,IAAyB,EACzBiE,GAAM,EACNG,MAAqD,KAClDX,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAAC0G,oBAAoB,CAACF,GAAG,EAAEG,MAAM,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"router.js","names":["Schema","Chunk","Context","Effect","Effectable","dual","Inspectable","Option","FindMyWay","Error","ServerRequest","TypeId","Symbol","for","RouteTypeId","RouteContextTypeId","RouteContext","Tag","params","map","_","searchParams","schemaParams","schema","parse","flatMap","schemaPathParams","schemaSearchParams","RouterImpl","StructuralClass","routes","mounts","constructor","httpApp","commit","undefined","toHttpApp","toJSON","_id","toString","format","NodeInspectSymbol","self","router","make","toReadonlyArray","mountsLen","length","forEach","route","method","all","path","on","request","i","app","url","startsWith","provideService","sliceRequestUrl","result","find","fail","RouteNotFound","handler","prefix","_tag","value","mapInputContext","context","add","RouteContextImpl","prefexLen","modify","slice","RouteImpl","none","empty","fromIterable","makeRoute","concat","that","appendAll","removeTrailingSlash","endsWith","prefixAll","orElse","some","mount","mountApp","append","get","post","put","patch","del","head","options","use","f","catchAll","catchAllCause","catchTag","k","catchTags","cases","tag","service","provideServiceEffect","effect"],"sources":["../../../../src/internal/http/router.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,uBAAuB;AAE/C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,WAAW,MAAM,oBAAoB;AACjD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAI3C,OAAO,KAAKC,KAAK,MAAM,2BAA2B;AAClD,OAAO,KAAKC,aAAa,MAAM,6BAA6B;AAG5D;AACA,OAAO,MAAMC,MAAM,gBAAkBC,MAAM,CAACC,GAAG,CAAC,8BAA8B,CAAkB;AAEhG;AACA,OAAO,MAAMC,WAAW,gBAAuBF,MAAM,CAACC,GAAG,CAAC,oCAAoC,CAAuB;AAErH;AACA,OAAO,MAAME,kBAAkB,gBAA8BH,MAAM,CAACC,GAAG,CACrE,2CAA2C,CACf;AAE9B;AACA,OAAO,MAAMG,YAAY,gBAAGd,OAAO,CAACe,GAAG,CAAsB,2CAA2C,CAAC;AAEzG;AACA,OAAO,MAAMC,MAAM,gBAAGf,MAAM,CAACgB,GAAG,CAACH,YAAY,EAAGI,CAAC,IAAKA,CAAC,CAACF,MAAM,CAAC;AAE/D;AACA,OAAO,MAAMG,YAAY,gBAAGlB,MAAM,CAACgB,GAAG,CAACH,YAAY,EAAGI,CAAC,IAAKA,CAAC,CAACC,YAAY,CAAC;AAE3E;AACA,OAAO,MAAMC,YAAY,GAAmDC,MAA2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AS,CAACC,KAAK,CAAC,CAAC,CAAC;AAE7F,OAAO,MAAM/C,cAAc,gBAAGtD,IAAI,CAYhC,CAAC,EAAE,CACHqC,IAAyB,EACzBiE,GAAM,EACNC,OAA+B,KAE/BT,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAACwD,cAAc,CAACgD,GAAG,EAAEC,OAAO,CAAC,CAAC,CAAC;AAEjD;AACA,OAAO,MAAMC,oBAAoB,gBAAGxG,IAAI,CAkBtC,CAAC,EAAE,CACHqC,IAAyB,EACzBiE,GAAM,EACNG,MAAqD,KAClDX,GAAG,CAACzD,IAAI,EAAEvC,MAAM,CAAC0G,oBAAoB,CAACF,GAAG,EAAEG,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
1
2
|
import * as Data from "effect/Data";
|
|
3
|
+
import * as FiberId from "effect/FiberId";
|
|
4
|
+
import { globalValue } from "effect/GlobalValue";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Predicate from "effect/Predicate";
|
|
2
7
|
/** @internal */
|
|
3
8
|
export const TypeId = /*#__PURE__*/Symbol.for("@effect/platform/Http/Error");
|
|
4
9
|
const make = tag => props => Data.struct({
|
|
@@ -7,6 +12,8 @@ const make = tag => props => Data.struct({
|
|
|
7
12
|
...props
|
|
8
13
|
});
|
|
9
14
|
/** @internal */
|
|
15
|
+
export const isServerError = u => Predicate.hasProperty(u, TypeId);
|
|
16
|
+
/** @internal */
|
|
10
17
|
export const requestError = /*#__PURE__*/make("RequestError");
|
|
11
18
|
/** @internal */
|
|
12
19
|
export const responseError = /*#__PURE__*/make("ResponseError");
|
|
@@ -14,4 +21,8 @@ export const responseError = /*#__PURE__*/make("ResponseError");
|
|
|
14
21
|
export const routeNotFound = /*#__PURE__*/make("RouteNotFound");
|
|
15
22
|
/** @internal */
|
|
16
23
|
export const serveError = /*#__PURE__*/make("ServeError");
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const clientAbortFiberId = /*#__PURE__*/globalValue("@effect/platform/Http/ServerError/clientAbortFiberId", () => FiberId.runtime(-499, 0));
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const isClientAbortCause = cause => Cause.reduce(cause, false, (_, cause) => cause._tag === "Interrupt" && cause.fiberId === clientAbortFiberId ? Option.some(true) : Option.none());
|
|
17
28
|
//# sourceMappingURL=serverError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverError.js","names":["Data","TypeId","Symbol","for","make","tag","props","struct","_tag","requestError","responseError","routeNotFound","serveError"],"sources":["../../../../src/internal/http/serverError.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,aAAa;
|
|
1
|
+
{"version":3,"file":"serverError.js","names":["Cause","Data","FiberId","globalValue","Option","Predicate","TypeId","Symbol","for","make","tag","props","struct","_tag","isServerError","u","hasProperty","requestError","responseError","routeNotFound","serveError","clientAbortFiberId","runtime","isClientAbortCause","cause","reduce","_","fiberId","some","none"],"sources":["../../../../src/internal/http/serverError.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAG7C;AACA,OAAO,MAAMC,MAAM,gBAAiBC,MAAM,CAACC,GAAG,CAC5C,6BAA6B,CACd;AAEjB,MAAMC,IAAI,GAAqCC,GAAc,IAAMC,KAA8C,IAC/GV,IAAI,CAACW,MAAM,CAAC;EACV,CAACN,MAAM,GAAGA,MAAM;EAChBO,IAAI,EAAEH,GAAG;EACT,GAAGC;CACC,CAAC;AAET;AACA,OAAO,MAAMG,aAAa,GAAIC,CAAU,IAAiCV,SAAS,CAACW,WAAW,CAACD,CAAC,EAAET,MAAM,CAAC;AAEzG;AACA,OAAO,MAAMW,YAAY,gBAAGR,IAAI,CAAqB,cAAc,CAAC;AAEpE;AACA,OAAO,MAAMS,aAAa,gBAAGT,IAAI,CAAsB,eAAe,CAAC;AAEvE;AACA,OAAO,MAAMU,aAAa,gBAAGV,IAAI,CAAsB,eAAe,CAAC;AAEvE;AACA,OAAO,MAAMW,UAAU,gBAAGX,IAAI,CAAmB,YAAY,CAAC;AAE9D;AACA,OAAO,MAAMY,kBAAkB,gBAAGlB,WAAW,CAC3C,sDAAsD,EACtD,MAAMD,OAAO,CAACoB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAC/B;AAED;AACA,OAAO,MAAMC,kBAAkB,GAAOC,KAAqB,IACzDxB,KAAK,CAACyB,MAAM,CACVD,KAAK,EACL,KAAK,EACL,CAACE,CAAC,EAAEF,KAAK,KAAKA,KAAK,CAACX,IAAI,KAAK,WAAW,IAAIW,KAAK,CAACG,OAAO,KAAKN,kBAAkB,GAAGjB,MAAM,CAACwB,IAAI,CAAC,IAAI,CAAC,GAAGxB,MAAM,CAACyB,IAAI,EAAE,CACrH"}
|
package/package.json
CHANGED
package/src/Http/App.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
|
+
import * as Cause from "effect/Cause"
|
|
4
5
|
import * as Effect from "effect/Effect"
|
|
5
6
|
import * as Exit from "effect/Exit"
|
|
6
7
|
import * as FiberRef from "effect/FiberRef"
|
|
@@ -11,7 +12,7 @@ import * as ReadonlyArray from "effect/ReadonlyArray"
|
|
|
11
12
|
import * as Runtime from "effect/Runtime"
|
|
12
13
|
import * as Scope from "effect/Scope"
|
|
13
14
|
import * as internalMiddleware from "../internal/http/middleware.js"
|
|
14
|
-
import
|
|
15
|
+
import * as ServerError from "./ServerError.js"
|
|
15
16
|
import * as ServerRequest from "./ServerRequest.js"
|
|
16
17
|
import * as ServerResponse from "./ServerResponse.js"
|
|
17
18
|
|
|
@@ -107,16 +108,29 @@ export const withPreResponseHandler = dual<
|
|
|
107
108
|
* @category conversions
|
|
108
109
|
*/
|
|
109
110
|
export const toWebHandlerRuntime = <R>(runtime: Runtime.Runtime<R>) => {
|
|
110
|
-
const run = Runtime.
|
|
111
|
-
return <E>(self: Default<R, E>) => {
|
|
111
|
+
const run = Runtime.runFork(runtime)
|
|
112
|
+
return <E>(self: Default<R | Scope.Scope, E>) => {
|
|
112
113
|
self = withDefaultMiddleware(self)
|
|
113
|
-
return (request: Request): Promise<Response> =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Effect.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
return (request: Request): Promise<Response> =>
|
|
115
|
+
new Promise((resolve, reject) => {
|
|
116
|
+
const req = ServerRequest.fromWeb(request)
|
|
117
|
+
const fiber = run(Effect.scoped(Effect.map(
|
|
118
|
+
Effect.provideService(self, ServerRequest.ServerRequest, req),
|
|
119
|
+
(res) => ServerResponse.toWeb(res, req.method === "HEAD")
|
|
120
|
+
)))
|
|
121
|
+
request.signal.addEventListener("abort", () => {
|
|
122
|
+
Effect.runFork(fiber.interruptAsFork(ServerError.clientAbortFiberId))
|
|
123
|
+
})
|
|
124
|
+
fiber.addObserver((exit) => {
|
|
125
|
+
if (Exit.isSuccess(exit)) {
|
|
126
|
+
resolve(exit.value)
|
|
127
|
+
} else if (Cause.isInterruptedOnly(exit.cause)) {
|
|
128
|
+
resolve(new Response(null, { status: request.signal.aborted ? 499 : 503 }))
|
|
129
|
+
} else {
|
|
130
|
+
reject(Cause.pretty(exit.cause))
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})
|
|
120
134
|
}
|
|
121
135
|
}
|
|
122
136
|
|
|
@@ -124,7 +138,7 @@ export const toWebHandlerRuntime = <R>(runtime: Runtime.Runtime<R>) => {
|
|
|
124
138
|
* @since 1.0.0
|
|
125
139
|
* @category conversions
|
|
126
140
|
*/
|
|
127
|
-
export const toWebHandler: <E>(self: Default<
|
|
141
|
+
export const toWebHandler: <E>(self: Default<Scope.Scope, E>) => (request: Request) => Promise<Response> =
|
|
128
142
|
toWebHandlerRuntime(Runtime.defaultRuntime)
|
|
129
143
|
|
|
130
144
|
/**
|
|
@@ -132,7 +146,7 @@ export const toWebHandler: <E>(self: Default<never, E>) => (request: Request) =>
|
|
|
132
146
|
* @category conversions
|
|
133
147
|
*/
|
|
134
148
|
export const toWebHandlerLayer = <R, E, RE>(
|
|
135
|
-
self: Default<R, E>,
|
|
149
|
+
self: Default<R | Scope.Scope, E>,
|
|
136
150
|
layer: Layer.Layer<never, RE, R>
|
|
137
151
|
): {
|
|
138
152
|
readonly close: () => Promise<void>
|
|
@@ -7,7 +7,6 @@ import type * as Effect from "effect/Effect"
|
|
|
7
7
|
import * as internal from "../internal/http/clientResponse.js"
|
|
8
8
|
import type * as Error from "./ClientError.js"
|
|
9
9
|
import type * as ClientRequest from "./ClientRequest.js"
|
|
10
|
-
import type * as Headers from "./Headers.js"
|
|
11
10
|
import type * as IncomingMessage from "./IncomingMessage.js"
|
|
12
11
|
|
|
13
12
|
export {
|
|
@@ -77,7 +76,7 @@ export const schemaJson: <
|
|
|
77
76
|
* @category schema
|
|
78
77
|
*/
|
|
79
78
|
export const schemaNoBody: <
|
|
80
|
-
I extends { readonly status?: number; readonly headers?:
|
|
79
|
+
I extends { readonly status?: number | undefined; readonly headers?: Readonly<Record<string, string>> | undefined },
|
|
81
80
|
A
|
|
82
81
|
>(schema: Schema.Schema<I, A>) => (self: ClientResponse) => Effect.Effect<never, ParseResult.ParseError, A> =
|
|
83
82
|
internal.schemaNoBody
|
package/src/Http/Router.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type * as Chunk from "effect/Chunk"
|
|
|
8
8
|
import type * as Context from "effect/Context"
|
|
9
9
|
import type * as Effect from "effect/Effect"
|
|
10
10
|
import type * as Option from "effect/Option"
|
|
11
|
+
import type * as Scope from "effect/Scope"
|
|
11
12
|
import * as internal from "../internal/http/router.js"
|
|
12
13
|
import type * as App from "./App.js"
|
|
13
14
|
import type * as Method from "./Method.js"
|
|
@@ -44,7 +45,7 @@ export declare namespace Router {
|
|
|
44
45
|
/**
|
|
45
46
|
* @since 1.0.0
|
|
46
47
|
*/
|
|
47
|
-
export type ExcludeProvided<A> = Exclude<A, RouteContext | ServerRequest.ServerRequest>
|
|
48
|
+
export type ExcludeProvided<A> = Exclude<A, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
@@ -186,7 +187,7 @@ export const makeRoute: <R, E>(
|
|
|
186
187
|
path: PathInput,
|
|
187
188
|
handler: Route.Handler<R, E>,
|
|
188
189
|
prefix?: Option.Option<string>
|
|
189
|
-
) => Route<R, E> = internal.makeRoute
|
|
190
|
+
) => Route<Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>, E> = internal.makeRoute
|
|
190
191
|
|
|
191
192
|
/**
|
|
192
193
|
* @since 1.0.0
|
|
@@ -231,7 +232,8 @@ export const mountApp: {
|
|
|
231
232
|
): <R, E>(
|
|
232
233
|
self: Router<R, E>
|
|
233
234
|
) => Router<
|
|
234
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
235
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
236
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
235
237
|
E1 | E
|
|
236
238
|
>
|
|
237
239
|
<R, E, R1, E1>(
|
|
@@ -239,7 +241,8 @@ export const mountApp: {
|
|
|
239
241
|
path: `/${string}`,
|
|
240
242
|
that: App.Default<R1, E1>
|
|
241
243
|
): Router<
|
|
242
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
244
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
245
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
243
246
|
E | E1
|
|
244
247
|
>
|
|
245
248
|
} = internal.mountApp
|
|
@@ -257,7 +260,8 @@ export const route: (
|
|
|
257
260
|
): <R, E>(
|
|
258
261
|
self: Router<R, E>
|
|
259
262
|
) => Router<
|
|
260
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
263
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
264
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
261
265
|
E1 | E
|
|
262
266
|
>
|
|
263
267
|
<R, E, R1, E1>(
|
|
@@ -265,7 +269,8 @@ export const route: (
|
|
|
265
269
|
path: PathInput,
|
|
266
270
|
handler: Route.Handler<R1, E1>
|
|
267
271
|
): Router<
|
|
268
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
272
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
273
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
269
274
|
E | E1
|
|
270
275
|
>
|
|
271
276
|
} = internal.route
|
|
@@ -281,7 +286,8 @@ export const all: {
|
|
|
281
286
|
): <R, E>(
|
|
282
287
|
self: Router<R, E>
|
|
283
288
|
) => Router<
|
|
284
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
289
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
290
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
285
291
|
E1 | E
|
|
286
292
|
>
|
|
287
293
|
<R, E, R1, E1>(
|
|
@@ -289,7 +295,8 @@ export const all: {
|
|
|
289
295
|
path: PathInput,
|
|
290
296
|
handler: Route.Handler<R1, E1>
|
|
291
297
|
): Router<
|
|
292
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
298
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
299
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
293
300
|
E | E1
|
|
294
301
|
>
|
|
295
302
|
} = internal.all
|
|
@@ -305,7 +312,8 @@ export const get: {
|
|
|
305
312
|
): <R, E>(
|
|
306
313
|
self: Router<R, E>
|
|
307
314
|
) => Router<
|
|
308
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
315
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
316
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
309
317
|
E1 | E
|
|
310
318
|
>
|
|
311
319
|
<R, E, R1, E1>(
|
|
@@ -313,7 +321,8 @@ export const get: {
|
|
|
313
321
|
path: PathInput,
|
|
314
322
|
handler: Route.Handler<R1, E1>
|
|
315
323
|
): Router<
|
|
316
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
324
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
325
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
317
326
|
E | E1
|
|
318
327
|
>
|
|
319
328
|
} = internal.get
|
|
@@ -329,7 +338,8 @@ export const post: {
|
|
|
329
338
|
): <R, E>(
|
|
330
339
|
self: Router<R, E>
|
|
331
340
|
) => Router<
|
|
332
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
341
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
342
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
333
343
|
E1 | E
|
|
334
344
|
>
|
|
335
345
|
<R, E, R1, E1>(
|
|
@@ -337,7 +347,8 @@ export const post: {
|
|
|
337
347
|
path: PathInput,
|
|
338
348
|
handler: Route.Handler<R1, E1>
|
|
339
349
|
): Router<
|
|
340
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
350
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
351
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
341
352
|
E | E1
|
|
342
353
|
>
|
|
343
354
|
} = internal.post
|
|
@@ -353,7 +364,8 @@ export const patch: {
|
|
|
353
364
|
): <R, E>(
|
|
354
365
|
self: Router<R, E>
|
|
355
366
|
) => Router<
|
|
356
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
367
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
368
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
357
369
|
E1 | E
|
|
358
370
|
>
|
|
359
371
|
<R, E, R1, E1>(
|
|
@@ -361,7 +373,8 @@ export const patch: {
|
|
|
361
373
|
path: PathInput,
|
|
362
374
|
handler: Route.Handler<R1, E1>
|
|
363
375
|
): Router<
|
|
364
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
376
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
377
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
365
378
|
E | E1
|
|
366
379
|
>
|
|
367
380
|
} = internal.patch
|
|
@@ -377,7 +390,8 @@ export const put: {
|
|
|
377
390
|
): <R, E>(
|
|
378
391
|
self: Router<R, E>
|
|
379
392
|
) => Router<
|
|
380
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
393
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
394
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
381
395
|
E1 | E
|
|
382
396
|
>
|
|
383
397
|
<R, E, R1, E1>(
|
|
@@ -385,7 +399,8 @@ export const put: {
|
|
|
385
399
|
path: PathInput,
|
|
386
400
|
handler: Route.Handler<R1, E1>
|
|
387
401
|
): Router<
|
|
388
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
402
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
403
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
389
404
|
E | E1
|
|
390
405
|
>
|
|
391
406
|
} = internal.put
|
|
@@ -401,7 +416,8 @@ export const del: {
|
|
|
401
416
|
): <R, E>(
|
|
402
417
|
self: Router<R, E>
|
|
403
418
|
) => Router<
|
|
404
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
419
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
420
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
405
421
|
E1 | E
|
|
406
422
|
>
|
|
407
423
|
<R, E, R1, E1>(
|
|
@@ -409,7 +425,8 @@ export const del: {
|
|
|
409
425
|
path: PathInput,
|
|
410
426
|
handler: Route.Handler<R1, E1>
|
|
411
427
|
): Router<
|
|
412
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
428
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
429
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
413
430
|
E | E1
|
|
414
431
|
>
|
|
415
432
|
} = internal.del
|
|
@@ -425,7 +442,8 @@ export const head: {
|
|
|
425
442
|
): <R, E>(
|
|
426
443
|
self: Router<R, E>
|
|
427
444
|
) => Router<
|
|
428
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
445
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
446
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
429
447
|
E1 | E
|
|
430
448
|
>
|
|
431
449
|
<R, E, R1, E1>(
|
|
@@ -433,7 +451,8 @@ export const head: {
|
|
|
433
451
|
path: PathInput,
|
|
434
452
|
handler: Route.Handler<R1, E1>
|
|
435
453
|
): Router<
|
|
436
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
454
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
455
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
437
456
|
E | E1
|
|
438
457
|
>
|
|
439
458
|
} = internal.head
|
|
@@ -449,7 +468,8 @@ export const options: {
|
|
|
449
468
|
): <R, E>(
|
|
450
469
|
self: Router<R, E>
|
|
451
470
|
) => Router<
|
|
452
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
471
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
472
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
453
473
|
E1 | E
|
|
454
474
|
>
|
|
455
475
|
<R, E, R1, E1>(
|
|
@@ -457,7 +477,8 @@ export const options: {
|
|
|
457
477
|
path: PathInput,
|
|
458
478
|
handler: Route.Handler<R1, E1>
|
|
459
479
|
): Router<
|
|
460
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
480
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
481
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
461
482
|
E | E1
|
|
462
483
|
>
|
|
463
484
|
} = internal.options
|
|
@@ -469,11 +490,11 @@ export const options: {
|
|
|
469
490
|
export const use: {
|
|
470
491
|
<R, E, R1, E1>(
|
|
471
492
|
f: (self: Route.Handler<R, E>) => App.Default<R1, E1>
|
|
472
|
-
): (self: Router<R, E>) => Router<Exclude<R1, RouteContext | ServerRequest.ServerRequest>, E1>
|
|
493
|
+
): (self: Router<R, E>) => Router<Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>, E1>
|
|
473
494
|
<R, E, R1, E1>(
|
|
474
495
|
self: Router<R, E>,
|
|
475
496
|
f: (self: Route.Handler<R, E>) => App.Default<R1, E1>
|
|
476
|
-
): Router<Exclude<R1, RouteContext | ServerRequest.ServerRequest>, E1>
|
|
497
|
+
): Router<Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>, E1>
|
|
477
498
|
} = internal.use
|
|
478
499
|
|
|
479
500
|
/**
|
|
@@ -486,14 +507,16 @@ export const catchAll: {
|
|
|
486
507
|
): <R>(
|
|
487
508
|
self: Router<R, E>
|
|
488
509
|
) => Router<
|
|
489
|
-
Exclude<R2, RouteContext | ServerRequest.ServerRequest
|
|
510
|
+
| Exclude<R2, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
511
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
490
512
|
E2
|
|
491
513
|
>
|
|
492
514
|
<R, E, R2, E2>(
|
|
493
515
|
self: Router<R, E>,
|
|
494
516
|
f: (e: E) => Route.Handler<R2, E2>
|
|
495
517
|
): Router<
|
|
496
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
518
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
519
|
+
| Exclude<R2, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
497
520
|
E2
|
|
498
521
|
>
|
|
499
522
|
} = internal.catchAll
|
|
@@ -508,14 +531,16 @@ export const catchAllCause: {
|
|
|
508
531
|
): <R>(
|
|
509
532
|
self: Router<R, E>
|
|
510
533
|
) => Router<
|
|
511
|
-
Exclude<R2, RouteContext | ServerRequest.ServerRequest
|
|
534
|
+
| Exclude<R2, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
535
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
512
536
|
E2
|
|
513
537
|
>
|
|
514
538
|
<R, E, R2, E2>(
|
|
515
539
|
self: Router<R, E>,
|
|
516
540
|
f: (e: Cause.Cause<E>) => Route.Handler<R2, E2>
|
|
517
541
|
): Router<
|
|
518
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
542
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
543
|
+
| Exclude<R2, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
519
544
|
E2
|
|
520
545
|
>
|
|
521
546
|
} = internal.catchAllCause
|
|
@@ -531,7 +556,8 @@ export const catchTag: {
|
|
|
531
556
|
): <R>(
|
|
532
557
|
self: Router<R, E>
|
|
533
558
|
) => Router<
|
|
534
|
-
Exclude<R1, RouteContext | ServerRequest.ServerRequest
|
|
559
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
560
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
535
561
|
E1 | Exclude<E, { _tag: K }>
|
|
536
562
|
>
|
|
537
563
|
<R, E, K extends E extends { _tag: string } ? E["_tag"] : never, R1, E1>(
|
|
@@ -539,7 +565,8 @@ export const catchTag: {
|
|
|
539
565
|
k: K,
|
|
540
566
|
f: (e: Extract<E, { _tag: K }>) => Route.Handler<R1, E1>
|
|
541
567
|
): Router<
|
|
542
|
-
Exclude<R, RouteContext | ServerRequest.ServerRequest
|
|
568
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
569
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
543
570
|
E1 | Exclude<E, { _tag: K }>
|
|
544
571
|
>
|
|
545
572
|
} = internal.catchTag
|
|
@@ -552,21 +579,27 @@ export const catchTags: {
|
|
|
552
579
|
<
|
|
553
580
|
E,
|
|
554
581
|
Cases extends E extends { _tag: string }
|
|
555
|
-
? { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Route.Handler<any, any>) }
|
|
582
|
+
? { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Route.Handler<any, any>) | undefined }
|
|
556
583
|
: {}
|
|
557
584
|
>(
|
|
558
585
|
cases: Cases
|
|
559
586
|
): <R>(
|
|
560
587
|
self: Router<R, E>
|
|
561
588
|
) => Router<
|
|
562
|
-
| Exclude<R, RouteContext | ServerRequest.ServerRequest>
|
|
589
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
563
590
|
| Exclude<
|
|
564
591
|
{
|
|
565
592
|
[K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
|
|
566
593
|
}[keyof Cases],
|
|
567
|
-
RouteContext | ServerRequest.ServerRequest
|
|
594
|
+
RouteContext | ServerRequest.ServerRequest | Scope.Scope
|
|
568
595
|
>,
|
|
569
|
-
| Exclude<E, {
|
|
596
|
+
| Exclude<E, {
|
|
597
|
+
/**
|
|
598
|
+
* @since 1.0.0
|
|
599
|
+
* @category combinators
|
|
600
|
+
*/
|
|
601
|
+
_tag: keyof Cases
|
|
602
|
+
}>
|
|
570
603
|
| {
|
|
571
604
|
[K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, infer E, any> ? E : never
|
|
572
605
|
}[keyof Cases]
|
|
@@ -575,18 +608,18 @@ export const catchTags: {
|
|
|
575
608
|
R,
|
|
576
609
|
E,
|
|
577
610
|
Cases extends E extends { _tag: string }
|
|
578
|
-
? { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Route.Handler<any, any>) } :
|
|
611
|
+
? { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Route.Handler<any, any>) | undefined } :
|
|
579
612
|
{}
|
|
580
613
|
>(
|
|
581
614
|
self: Router<R, E>,
|
|
582
615
|
cases: Cases
|
|
583
616
|
): Router<
|
|
584
|
-
| Exclude<R, RouteContext | ServerRequest.ServerRequest>
|
|
617
|
+
| Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
585
618
|
| Exclude<
|
|
586
619
|
{
|
|
587
620
|
[K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
|
|
588
621
|
}[keyof Cases],
|
|
589
|
-
RouteContext | ServerRequest.ServerRequest
|
|
622
|
+
RouteContext | ServerRequest.ServerRequest | Scope.Scope
|
|
590
623
|
>,
|
|
591
624
|
| Exclude<E, { _tag: keyof Cases }>
|
|
592
625
|
| {
|
|
@@ -605,12 +638,15 @@ export const provideService: {
|
|
|
605
638
|
service: Context.Tag.Service<T>
|
|
606
639
|
): <R, E>(
|
|
607
640
|
self: Router<R, E>
|
|
608
|
-
) => Router<
|
|
641
|
+
) => Router<
|
|
642
|
+
Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
643
|
+
E
|
|
644
|
+
>
|
|
609
645
|
<R, E, T extends Context.Tag<any, any>>(
|
|
610
646
|
self: Router<R, E>,
|
|
611
647
|
tag: T,
|
|
612
648
|
service: Context.Tag.Service<T>
|
|
613
|
-
): Router<Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest>, E>
|
|
649
|
+
): Router<Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest | Scope.Scope>, E>
|
|
614
650
|
} = internal.provideService
|
|
615
651
|
|
|
616
652
|
/**
|
|
@@ -624,8 +660,8 @@ export const provideServiceEffect: {
|
|
|
624
660
|
): <R, E>(
|
|
625
661
|
self: Router<R, E>
|
|
626
662
|
) => Router<
|
|
627
|
-
| Exclude<R1, RouteContext | ServerRequest.ServerRequest>
|
|
628
|
-
| Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest>,
|
|
663
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
664
|
+
| Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
629
665
|
E1 | E
|
|
630
666
|
>
|
|
631
667
|
<R, E, T extends Context.Tag<any, any>, R1, E1>(
|
|
@@ -633,8 +669,8 @@ export const provideServiceEffect: {
|
|
|
633
669
|
tag: T,
|
|
634
670
|
effect: Effect.Effect<R1, E1, Context.Tag.Service<T>>
|
|
635
671
|
): Router<
|
|
636
|
-
| Exclude<R1, RouteContext | ServerRequest.ServerRequest>
|
|
637
|
-
| Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest>,
|
|
672
|
+
| Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
|
|
673
|
+
| Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
|
|
638
674
|
E | E1
|
|
639
675
|
>
|
|
640
676
|
} = internal.provideServiceEffect
|