| 118 | |
| 119 | /** @internal */ |
| 120 | export const schemaParams = <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, R>( |
| 121 | schema: Schema.Schema<A, I, R>, |
| 122 | options?: ParseOptions | undefined |
| 123 | ) => { |
| 124 | const parse = Schema.decodeUnknown(schema, options) |
| 125 | return Effect.flatMap( |
| 126 | Effect.context<ServerRequest.ParsedSearchParams | Router.RouteContext>(), |
| 127 | (context) => { |
| 128 | const searchParams = Context.get(context, ServerRequest.ParsedSearchParams) |
| 129 | const routeContext = Context.get(context, RouteContext) |
| 130 | return parse({ ...searchParams, ...routeContext.params }) |
| 131 | } |
| 132 | ) |
| 133 | } |
| 134 | |
| 135 | /** @internal */ |
| 136 | export const schemaPathParams = <A, I extends Readonly<Record<string, string | undefined>>, R>( |