@effect/platform
Advanced tools
Comparing version 0.33.0 to 0.33.1
@@ -115,2 +115,12 @@ /** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export declare const schemaPathParams: <I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<I, A>) => Effect.Effect<RouteContext, ParseResult.ParseError, A>; | ||
/** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export declare const schemaSearchParams: <I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<I, A>) => Effect.Effect<RouteContext, ParseResult.ParseError, A>; | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
@@ -117,0 +127,0 @@ */ |
@@ -39,2 +39,12 @@ import * as internal from "../internal/http/router.js"; | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export const schemaPathParams = internal.schemaPathParams; | ||
/** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export const schemaSearchParams = internal.schemaSearchParams; | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
@@ -41,0 +51,0 @@ */ |
@@ -32,2 +32,12 @@ import * as Schema from "@effect/schema/Schema"; | ||
}; | ||
/** @internal */ | ||
export const schemaPathParams = schema => { | ||
const parse = Schema.parse(schema); | ||
return Effect.flatMap(RouteContext, _ => parse(_.params)); | ||
}; | ||
/** @internal */ | ||
export const schemaSearchParams = schema => { | ||
const parse = Schema.parse(schema); | ||
return Effect.flatMap(RouteContext, _ => parse(_.searchParams)); | ||
}; | ||
class RouterImpl extends Effectable.StructuralClass { | ||
@@ -34,0 +44,0 @@ routes; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.use = exports.searchParams = exports.schemaParams = exports.route = exports.put = exports.provideServiceEffect = exports.provideService = exports.prefixAll = exports.post = exports.patch = exports.params = exports.options = exports.mountApp = exports.mount = exports.makeRoute = exports.head = exports.get = exports.fromIterable = exports.empty = exports.del = exports.concat = exports.catchTags = exports.catchTag = exports.catchAllCause = exports.catchAll = exports.all = exports.TypeId = exports.RouteTypeId = exports.RouteContextTypeId = exports.RouteContext = void 0; | ||
exports.use = exports.searchParams = exports.schemaSearchParams = exports.schemaPathParams = exports.schemaParams = exports.route = exports.put = exports.provideServiceEffect = exports.provideService = exports.prefixAll = exports.post = exports.patch = exports.params = exports.options = exports.mountApp = exports.mount = exports.makeRoute = exports.head = exports.get = exports.fromIterable = exports.empty = exports.del = exports.concat = exports.catchTags = exports.catchTag = exports.catchAllCause = exports.catchAll = exports.all = exports.TypeId = exports.RouteTypeId = exports.RouteContextTypeId = exports.RouteContext = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("../internal/http/router.js")); | ||
@@ -71,2 +71,12 @@ function _getRequireWildcardCache(e) { | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
const schemaPathParams = exports.schemaPathParams = internal.schemaPathParams; | ||
/** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
const schemaSearchParams = exports.schemaSearchParams = internal.schemaSearchParams; | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
@@ -73,0 +83,0 @@ */ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.use = exports.searchParams = exports.schemaParams = exports.route = exports.put = exports.provideServiceEffect = exports.provideService = exports.prefixAll = exports.post = exports.patch = exports.params = exports.options = exports.mountApp = exports.mount = exports.makeRoute = exports.head = exports.get = exports.fromIterable = exports.empty = exports.del = exports.concat = exports.catchTags = exports.catchTag = exports.catchAllCause = exports.catchAll = exports.all = exports.TypeId = exports.RouteTypeId = exports.RouteContextTypeId = exports.RouteContext = void 0; | ||
exports.use = exports.searchParams = exports.schemaSearchParams = exports.schemaPathParams = exports.schemaParams = exports.route = exports.put = exports.provideServiceEffect = exports.provideService = exports.prefixAll = exports.post = exports.patch = exports.params = exports.options = exports.mountApp = exports.mount = exports.makeRoute = exports.head = exports.get = exports.fromIterable = exports.empty = exports.del = exports.concat = exports.catchTags = exports.catchTag = exports.catchAllCause = exports.catchAll = exports.all = exports.TypeId = exports.RouteTypeId = exports.RouteContextTypeId = exports.RouteContext = void 0; | ||
var Schema = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/schema/Schema")); | ||
@@ -69,3 +69,15 @@ var Chunk = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Chunk")); | ||
}; | ||
/** @internal */ | ||
exports.schemaParams = schemaParams; | ||
const schemaPathParams = schema => { | ||
const parse = Schema.parse(schema); | ||
return Effect.flatMap(RouteContext, _ => parse(_.params)); | ||
}; | ||
/** @internal */ | ||
exports.schemaPathParams = schemaPathParams; | ||
const schemaSearchParams = schema => { | ||
const parse = Schema.parse(schema); | ||
return Effect.flatMap(RouteContext, _ => parse(_.searchParams)); | ||
}; | ||
exports.schemaSearchParams = schemaSearchParams; | ||
class RouterImpl extends Effectable.StructuralClass { | ||
@@ -72,0 +84,0 @@ routes; |
{ | ||
"name": "@effect/platform", | ||
"version": "0.33.0", | ||
"version": "0.33.1", | ||
"description": "Unified interfaces for common platform-specific services", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -146,2 +146,18 @@ /** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export const schemaPathParams: <I extends Readonly<Record<string, string>>, A>( | ||
schema: Schema.Schema<I, A> | ||
) => Effect.Effect<RouteContext, ParseResult.ParseError, A> = internal.schemaPathParams | ||
/** | ||
* @since 1.0.0 | ||
* @category route context | ||
*/ | ||
export const schemaSearchParams: <I extends Readonly<Record<string, string>>, A>( | ||
schema: Schema.Schema<I, A> | ||
) => Effect.Effect<RouteContext, ParseResult.ParseError, A> = internal.schemaSearchParams | ||
/** | ||
* @since 1.0.0 | ||
* @category constructors | ||
@@ -148,0 +164,0 @@ */ |
@@ -42,12 +42,17 @@ import * as Schema from "@effect/schema/Schema" | ||
const parse = Schema.parse(schema) | ||
return Effect.flatMap( | ||
RouteContext, | ||
(_) => | ||
parse({ | ||
..._.searchParams, | ||
..._.params | ||
}) | ||
) | ||
return Effect.flatMap(RouteContext, (_) => parse({ ..._.searchParams, ..._.params })) | ||
} | ||
/** @internal */ | ||
export const schemaPathParams = <I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<I, A>) => { | ||
const parse = Schema.parse(schema) | ||
return Effect.flatMap(RouteContext, (_) => parse(_.params)) | ||
} | ||
/** @internal */ | ||
export const schemaSearchParams = <I extends Readonly<Record<string, string>>, A>(schema: Schema.Schema<I, A>) => { | ||
const parse = Schema.parse(schema) | ||
return Effect.flatMap(RouteContext, (_) => parse(_.searchParams)) | ||
} | ||
class RouterImpl<R, E> extends Effectable.StructuralClass< | ||
@@ -54,0 +59,0 @@ Exclude<R, Router.RouteContext>, |
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
1298703
23227