@effect/platform
Advanced tools
Comparing version 0.58.10 to 0.58.11
@@ -13,3 +13,3 @@ "use strict"; | ||
}); | ||
exports.upgradeChannel = exports.upgrade = exports.searchParamsFromURL = exports.schemaSearchParams = exports.schemaHeaders = exports.schemaCookies = exports.schemaBodyUrlParams = exports.schemaBodyMultipart = exports.schemaBodyJson = exports.schemaBodyFormJson = exports.schemaBodyForm = exports.persistedMultipart = void 0; | ||
exports.upgradeChannel = exports.upgrade = exports.toURL = exports.searchParamsFromURL = exports.schemaSearchParams = exports.schemaHeaders = exports.schemaCookies = exports.schemaBodyUrlParams = exports.schemaBodyMultipart = exports.schemaBodyJson = exports.schemaBodyFormJson = exports.schemaBodyForm = exports.persistedMultipart = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/httpServerRequest.js")); | ||
@@ -122,2 +122,7 @@ var _HttpIncomingMessage = /*#__PURE__*/require("./HttpIncomingMessage.js"); | ||
const fromWeb = exports.fromWeb = internal.fromWeb; | ||
/** | ||
* @since 1.0.0 | ||
* @category conversions | ||
*/ | ||
const toURL = exports.toURL = internal.toURL; | ||
//# sourceMappingURL=HttpServerRequest.js.map |
@@ -93,13 +93,6 @@ "use strict"; | ||
} | ||
const host = request.headers["host"] ?? "localhost"; | ||
const protocol = request.headers["x-forwarded-proto"] === "https" ? "https" : "http"; | ||
let url = undefined; | ||
try { | ||
url = new URL(request.url, `${protocol}://${host}`); | ||
if (url.username !== "" || url.password !== "") { | ||
url.username = "REDACTED"; | ||
url.password = "REDACTED"; | ||
} | ||
} catch (_) { | ||
// | ||
const url = Option.getOrUndefined(ServerRequest.toURL(request)); | ||
if (url !== undefined && (url.username !== "" || url.password !== "")) { | ||
url.username = "REDACTED"; | ||
url.password = "REDACTED"; | ||
} | ||
@@ -106,0 +99,0 @@ const redactedHeaderNames = fiber.getFiberRef(Headers.currentRedactedNames); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.upgradeChannel = exports.upgrade = exports.serverRequestTag = exports.searchParamsFromURL = exports.schemaSearchParams = exports.schemaHeaders = exports.schemaCookies = exports.schemaBodyUrlParams = exports.schemaBodyMultipart = exports.schemaBodyJson = exports.schemaBodyFormJson = exports.schemaBodyForm = exports.parsedSearchParamsTag = exports.multipartPersisted = exports.fromWeb = exports.TypeId = void 0; | ||
exports.upgradeChannel = exports.upgrade = exports.toURL = exports.serverRequestTag = exports.searchParamsFromURL = exports.schemaSearchParams = exports.schemaHeaders = exports.schemaCookies = exports.schemaBodyUrlParams = exports.schemaBodyMultipart = exports.schemaBodyJson = exports.schemaBodyFormJson = exports.schemaBodyForm = exports.parsedSearchParamsTag = exports.multipartPersisted = exports.fromWeb = exports.TypeId = void 0; | ||
var Schema = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/schema/Schema")); | ||
@@ -275,2 +275,13 @@ var Channel = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Channel")); | ||
} | ||
/** @internal */ | ||
const toURL = self => { | ||
const host = self.headers.host ?? "localhost"; | ||
const protocol = self.headers["x-forwarded-proto"] === "https" ? "https" : "http"; | ||
try { | ||
return Option.some(new URL(self.url, `${protocol}://${host}`)); | ||
} catch (_) { | ||
return Option.none(); | ||
} | ||
}; | ||
exports.toURL = toURL; | ||
//# sourceMappingURL=httpServerRequest.js.map |
@@ -15,7 +15,11 @@ /** | ||
import type * as Scope from "effect/Scope"; | ||
import type * as Etag from "./Etag.js"; | ||
import type { FileSystem } from "./FileSystem.js"; | ||
import type * as App from "./HttpApp.js"; | ||
import type * as Method from "./HttpMethod.js"; | ||
import type * as Platform from "./HttpPlatform.js"; | ||
import type * as Error from "./HttpServerError.js"; | ||
import type * as ServerRequest from "./HttpServerRequest.js"; | ||
import type * as Respondable from "./HttpServerRespondable.js"; | ||
import type { Path } from "./Path.js"; | ||
/** | ||
@@ -468,3 +472,3 @@ * @since 1.0.0 | ||
export declare const Tag: <const Name extends string>(id: Name) => <Self, R = never, E = unknown>() => HttpRouter.TagClass<Self, Name, E, R>; | ||
declare const Default_base: HttpRouter.TagClass<Default, "@effect/platform/HttpRouter/Default", unknown, never>; | ||
declare const Default_base: HttpRouter.TagClass<Default, "@effect/platform/HttpRouter/Default", unknown, FileSystem | Etag.Generator | Platform.HttpPlatform | Path>; | ||
/** | ||
@@ -471,0 +475,0 @@ * @since 1.0.0 |
@@ -11,2 +11,3 @@ /** | ||
import type * as Effect from "effect/Effect"; | ||
import type { Option } from "effect/Option"; | ||
import type { ReadonlyRecord } from "effect/Record"; | ||
@@ -141,2 +142,7 @@ import type * as Scope from "effect/Scope"; | ||
export declare const fromWeb: (request: Request) => HttpServerRequest; | ||
/** | ||
* @since 1.0.0 | ||
* @category conversions | ||
*/ | ||
export declare const toURL: (self: HttpServerRequest) => Option<URL>; | ||
//# sourceMappingURL=HttpServerRequest.d.ts.map |
@@ -88,2 +88,7 @@ import * as internal from "./internal/httpServerRequest.js"; | ||
export const fromWeb = internal.fromWeb; | ||
/** | ||
* @since 1.0.0 | ||
* @category conversions | ||
*/ | ||
export const toURL = internal.toURL; | ||
//# sourceMappingURL=HttpServerRequest.js.map |
@@ -60,13 +60,6 @@ import * as Context from "effect/Context"; | ||
} | ||
const host = request.headers["host"] ?? "localhost"; | ||
const protocol = request.headers["x-forwarded-proto"] === "https" ? "https" : "http"; | ||
let url = undefined; | ||
try { | ||
url = new URL(request.url, `${protocol}://${host}`); | ||
if (url.username !== "" || url.password !== "") { | ||
url.username = "REDACTED"; | ||
url.password = "REDACTED"; | ||
} | ||
} catch (_) { | ||
// | ||
const url = Option.getOrUndefined(ServerRequest.toURL(request)); | ||
if (url !== undefined && (url.username !== "" || url.password !== "")) { | ||
url.username = "REDACTED"; | ||
url.password = "REDACTED"; | ||
} | ||
@@ -73,0 +66,0 @@ const redactedHeaderNames = fiber.getFiberRef(Headers.currentRedactedNames); |
@@ -232,2 +232,12 @@ import * as Schema from "@effect/schema/Schema"; | ||
} | ||
/** @internal */ | ||
export const toURL = self => { | ||
const host = self.headers.host ?? "localhost"; | ||
const protocol = self.headers["x-forwarded-proto"] === "https" ? "https" : "http"; | ||
try { | ||
return Option.some(new URL(self.url, `${protocol}://${host}`)); | ||
} catch (_) { | ||
return Option.none(); | ||
} | ||
}; | ||
//# sourceMappingURL=httpServerRequest.js.map |
{ | ||
"name": "@effect/platform", | ||
"version": "0.58.10", | ||
"version": "0.58.11", | ||
"description": "Unified interfaces for common platform-specific services", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -15,4 +15,7 @@ /** | ||
import type * as Scope from "effect/Scope" | ||
import type * as Etag from "./Etag.js" | ||
import type { FileSystem } from "./FileSystem.js" | ||
import type * as App from "./HttpApp.js" | ||
import type * as Method from "./HttpMethod.js" | ||
import type * as Platform from "./HttpPlatform.js" | ||
import type * as Error from "./HttpServerError.js" | ||
@@ -22,2 +25,3 @@ import type * as ServerRequest from "./HttpServerRequest.js" | ||
import * as internal from "./internal/httpRouter.js" | ||
import type { Path } from "./Path.js" | ||
@@ -745,2 +749,5 @@ /** | ||
*/ | ||
export class Default extends Tag("@effect/platform/HttpRouter/Default")<Default>() {} | ||
export class Default extends Tag("@effect/platform/HttpRouter/Default")< | ||
Default, | ||
Platform.HttpPlatform | Etag.Generator | FileSystem | Path | ||
>() {} |
@@ -11,2 +11,3 @@ /** | ||
import type * as Effect from "effect/Effect" | ||
import type { Option } from "effect/Option" | ||
import type { ReadonlyRecord } from "effect/Record" | ||
@@ -224,1 +225,7 @@ import type * as Scope from "effect/Scope" | ||
export const fromWeb: (request: Request) => HttpServerRequest = internal.fromWeb | ||
/** | ||
* @since 1.0.0 | ||
* @category conversions | ||
*/ | ||
export const toURL: (self: HttpServerRequest) => Option<URL> = internal.toURL |
@@ -119,13 +119,6 @@ import type { HttpApp } from "@effect/platform" | ||
} | ||
const host = request.headers["host"] ?? "localhost" | ||
const protocol = request.headers["x-forwarded-proto"] === "https" ? "https" : "http" | ||
let url: URL | undefined = undefined | ||
try { | ||
url = new URL(request.url, `${protocol}://${host}`) | ||
if (url.username !== "" || url.password !== "") { | ||
url.username = "REDACTED" | ||
url.password = "REDACTED" | ||
} | ||
} catch (_) { | ||
// | ||
const url = Option.getOrUndefined(ServerRequest.toURL(request)) | ||
if (url !== undefined && (url.username !== "" || url.password !== "")) { | ||
url.username = "REDACTED" | ||
url.password = "REDACTED" | ||
} | ||
@@ -132,0 +125,0 @@ const redactedHeaderNames = fiber.getFiberRef(Headers.currentRedactedNames) |
@@ -346,1 +346,12 @@ import type { ParseOptions } from "@effect/schema/AST" | ||
} | ||
/** @internal */ | ||
export const toURL = (self: ServerRequest.HttpServerRequest): Option.Option<URL> => { | ||
const host = self.headers.host ?? "localhost" | ||
const protocol = self.headers["x-forwarded-proto"] === "https" ? "https" : "http" | ||
try { | ||
return Option.some(new URL(self.url, `${protocol}://${host}`)) | ||
} catch (_) { | ||
return Option.none() | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2207651
37805