@effect/platform
Advanced tools
Comparing version 0.13.14 to 0.13.15
@@ -7,3 +7,6 @@ /** | ||
import type * as ClientRequest from "@effect/platform/Http/ClientRequest"; | ||
import type * as Headers from "@effect/platform/Http/Headers"; | ||
import type * as IncomingMessage from "@effect/platform/Http/IncomingMessage"; | ||
import type * as ParseResult from "@effect/schema/ParseResult"; | ||
import type * as Schema from "@effect/schema/Schema"; | ||
export { | ||
@@ -49,2 +52,11 @@ /** | ||
export declare const fromWeb: (request: ClientRequest.ClientRequest, source: Response) => ClientResponse; | ||
/** | ||
* @since 1.0.0 | ||
* @category schema | ||
*/ | ||
export declare const schemaJson: <I extends { | ||
readonly status?: number; | ||
readonly headers?: Headers.Headers; | ||
readonly body?: unknown; | ||
}, A>(schema: Schema.Schema<I, A>) => (self: ClientResponse) => Effect.Effect<never, Error.ResponseError | ParseResult.ParseError, A>; | ||
//# sourceMappingURL=ClientResponse.d.ts.map |
@@ -25,2 +25,3 @@ "use strict"; | ||
}); | ||
exports.schemaJson = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/internal/http/clientResponse")); | ||
@@ -41,3 +42,9 @@ var _IncomingMessage = /*#__PURE__*/require("@effect/platform/Http/IncomingMessage"); | ||
const fromWeb = internal.fromWeb; | ||
/** | ||
* @since 1.0.0 | ||
* @category schema | ||
*/ | ||
exports.fromWeb = fromWeb; | ||
const schemaJson = internal.schemaJson; | ||
exports.schemaJson = schemaJson; | ||
//# sourceMappingURL=ClientResponse.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.fromWeb = exports.TypeId = void 0; | ||
exports.schemaJson = exports.fromWeb = exports.TypeId = void 0; | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect")); | ||
@@ -13,2 +13,3 @@ var Headers = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/Headers")); | ||
var internalError = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/internal/http/clientError")); | ||
var Schema = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/schema/Schema")); | ||
var Stream = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/Stream")); | ||
@@ -106,2 +107,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
IncomingMessage.TypeId; | ||
/** @internal */ | ||
const schemaJson = schema => { | ||
const parse = Schema.parse(schema); | ||
return self => Effect.flatMap(self.json, body => parse({ | ||
status: self.status, | ||
headers: self.headers, | ||
body | ||
})); | ||
}; | ||
exports.schemaJson = schemaJson; | ||
//# sourceMappingURL=clientResponse.js.map |
{ | ||
"name": "@effect/platform", | ||
"version": "0.13.14", | ||
"version": "0.13.15", | ||
"description": "Unified interfaces for common platform-specific services", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,4 +7,7 @@ /** | ||
import type * as ClientRequest from "@effect/platform/Http/ClientRequest" | ||
import type * as Headers from "@effect/platform/Http/Headers" | ||
import type * as IncomingMessage from "@effect/platform/Http/IncomingMessage" | ||
import * as internal from "@effect/platform/internal/http/clientResponse" | ||
import type * as ParseResult from "@effect/schema/ParseResult" | ||
import type * as Schema from "@effect/schema/Schema" | ||
@@ -56,1 +59,17 @@ export { | ||
export const fromWeb: (request: ClientRequest.ClientRequest, source: Response) => ClientResponse = internal.fromWeb | ||
/** | ||
* @since 1.0.0 | ||
* @category schema | ||
*/ | ||
export const schemaJson: < | ||
I extends { | ||
readonly status?: number | ||
readonly headers?: Headers.Headers | ||
readonly body?: unknown | ||
}, | ||
A | ||
>( | ||
schema: Schema.Schema<I, A> | ||
) => (self: ClientResponse) => Effect.Effect<never, Error.ResponseError | ParseResult.ParseError, A> = | ||
internal.schemaJson |
@@ -9,2 +9,4 @@ import * as Effect from "@effect/io/Effect" | ||
import * as internalError from "@effect/platform/internal/http/clientError" | ||
import type * as ParseResult from "@effect/schema/ParseResult" | ||
import * as Schema from "@effect/schema/Schema" | ||
import * as Stream from "@effect/stream/Stream" | ||
@@ -124,1 +126,23 @@ | ||
} | ||
/** @internal */ | ||
export const schemaJson = < | ||
I extends { | ||
readonly status?: number | ||
readonly headers?: Headers.Headers | ||
readonly body?: unknown | ||
}, | ||
A | ||
>(schema: Schema.Schema<I, A>) => { | ||
const parse = Schema.parse(schema) | ||
return (self: ClientResponse.ClientResponse): Effect.Effect<never, Error.ResponseError | ParseResult.ParseError, A> => | ||
Effect.flatMap( | ||
self.json, | ||
(body) => | ||
parse({ | ||
status: self.status, | ||
headers: self.headers, | ||
body | ||
}) | ||
) | ||
} |
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
1012279
17484