@temporary-name/server 1.9.3-alpha.5537ef74244620c125352bc9356d8c0ae804f10d → 1.9.3-alpha.59a0ffc2afa5d7ac78321380832e510591ebe734

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.
Files changed (46) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +5 -7
  2. package/dist/adapters/aws-lambda/index.d.ts +5 -7
  3. package/dist/adapters/aws-lambda/index.mjs +5 -6
  4. package/dist/adapters/fetch/index.d.mts +8 -86
  5. package/dist/adapters/fetch/index.d.ts +8 -86
  6. package/dist/adapters/fetch/index.mjs +17 -157
  7. package/dist/adapters/node/index.d.mts +9 -64
  8. package/dist/adapters/node/index.d.ts +9 -64
  9. package/dist/adapters/node/index.mjs +15 -122
  10. package/dist/handler/index.d.mts +28 -0
  11. package/dist/handler/index.d.ts +28 -0
  12. package/dist/handler/index.mjs +8 -0
  13. package/dist/helpers/index.mjs +3 -29
  14. package/dist/index.d.mts +364 -304
  15. package/dist/index.d.ts +364 -304
  16. package/dist/index.mjs +501 -425
  17. package/dist/openapi/index.d.mts +18 -53
  18. package/dist/openapi/index.d.ts +18 -53
  19. package/dist/openapi/index.mjs +384 -378
  20. package/dist/shared/server.B9A3AnYU.mjs +523 -0
  21. package/dist/shared/server.Bh0-Oy3H.mjs +156 -0
  22. package/dist/shared/server.Bmxjwleq.d.ts +39 -0
  23. package/dist/shared/server.BnAospUv.mjs +334 -0
  24. package/dist/shared/server.Bx9JTGMu.mjs +433 -0
  25. package/dist/shared/server.C1RJffw4.mjs +30 -0
  26. package/dist/shared/server.CjPiuQYH.d.mts +51 -0
  27. package/dist/shared/server.CjPiuQYH.d.ts +51 -0
  28. package/dist/shared/server.DLyn62VH.d.mts +39 -0
  29. package/dist/shared/server.DpIhEnBO.d.mts +515 -0
  30. package/dist/shared/server.DpIhEnBO.d.ts +515 -0
  31. package/package.json +13 -31
  32. package/dist/adapters/standard/index.d.mts +0 -42
  33. package/dist/adapters/standard/index.d.ts +0 -42
  34. package/dist/adapters/standard/index.mjs +0 -9
  35. package/dist/plugins/index.d.mts +0 -160
  36. package/dist/plugins/index.d.ts +0 -160
  37. package/dist/plugins/index.mjs +0 -288
  38. package/dist/shared/server.B9VxPdeK.mjs +0 -293
  39. package/dist/shared/server.B9i6p26R.d.ts +0 -57
  40. package/dist/shared/server.BEHw7Eyx.mjs +0 -247
  41. package/dist/shared/server.Bzrdopnd.d.mts +0 -192
  42. package/dist/shared/server.Bzrdopnd.d.ts +0 -192
  43. package/dist/shared/server.C-j2WKJz.d.mts +0 -57
  44. package/dist/shared/server.CYRDznXq.d.ts +0 -23
  45. package/dist/shared/server.Cp__uvkw.d.mts +0 -23
  46. package/dist/shared/server.DcfsPloY.mjs +0 -202
@@ -0,0 +1,433 @@
1
+ import * as z from '@temporary-name/zod';
2
+ import { HTTPMethods } from '@temporary-name/shared';
3
+
4
+ class ValidationError extends Error {
5
+ issues;
6
+ data;
7
+ constructor(options) {
8
+ super("Validation error");
9
+ this.issues = options.issues;
10
+ this.data = options.data;
11
+ }
12
+ }
13
+ class APIError extends Error {
14
+ extra;
15
+ constructor(...args) {
16
+ const { message, cause, ...extra } = args[0] ?? {};
17
+ super(message, { cause });
18
+ this.message = message ?? this.constructor.defaultMessage;
19
+ this.extra = extra;
20
+ }
21
+ static get defaultMessage() {
22
+ return this.type.split("_").map((word) => word[0]?.toUpperCase() + word.slice(1)).join(" ");
23
+ }
24
+ toJSON() {
25
+ return {
26
+ type: this.constructor.type,
27
+ message: this.message,
28
+ ...this.extra
29
+ };
30
+ }
31
+ }
32
+ class BadRequestError extends APIError {
33
+ static status = 400;
34
+ static type = "bad_request";
35
+ static extraSchema = { code: z.string() };
36
+ }
37
+ class UnauthorizedError extends APIError {
38
+ static status = 401;
39
+ static type = "unauthorized";
40
+ }
41
+ class ForbiddenError extends APIError {
42
+ static status = 403;
43
+ static type = "forbidden";
44
+ }
45
+ class NotFoundError extends APIError {
46
+ static status = 404;
47
+ static type = "not_found";
48
+ }
49
+ class MethodNotAllowedError extends APIError {
50
+ static status = 405;
51
+ static type = "method_not_allowed";
52
+ }
53
+ class NotAcceptableError extends APIError {
54
+ static status = 406;
55
+ static type = "not_acceptable";
56
+ }
57
+ class RequestTimeoutError extends APIError {
58
+ static status = 408;
59
+ static type = "request_timeout";
60
+ }
61
+ class ConflictError extends APIError {
62
+ static status = 409;
63
+ static type = "conflict";
64
+ }
65
+ class PreconditionFailedError extends APIError {
66
+ static status = 412;
67
+ static type = "precondition_failed";
68
+ }
69
+ class ContentTooLargeError extends APIError {
70
+ static status = 413;
71
+ static type = "content_too_large";
72
+ }
73
+ class UnsupportedMediaTypeError extends APIError {
74
+ static status = 415;
75
+ static type = "unsupported_media_type";
76
+ }
77
+ class UnprocessableContentError extends APIError {
78
+ static status = 422;
79
+ static type = "unprocessable_content";
80
+ }
81
+ class TooManyRequestsError extends APIError {
82
+ static status = 429;
83
+ static type = "too_many_requests";
84
+ }
85
+ class InternalServerError extends APIError {
86
+ static status = 500;
87
+ static type = "internal_server_error";
88
+ }
89
+ class NotImplementedError extends APIError {
90
+ static status = 501;
91
+ static type = "not_implemented";
92
+ }
93
+ class BadGatewayError extends APIError {
94
+ static status = 502;
95
+ static type = "bad_gateway";
96
+ }
97
+ class ServiceUnavailableError extends APIError {
98
+ static status = 503;
99
+ static type = "service_unavailable";
100
+ }
101
+ class GatewayTimeoutError extends APIError {
102
+ static status = 504;
103
+ static type = "gateway_timeout";
104
+ }
105
+ function isAPIErrorStatus(status) {
106
+ return status < 200 || status >= 400;
107
+ }
108
+ function toAPIError(error) {
109
+ if (error instanceof APIError) {
110
+ return error;
111
+ }
112
+ return new InternalServerError({
113
+ message: error instanceof Error ? error.message : void 0,
114
+ cause: error
115
+ });
116
+ }
117
+ function encodeError(error) {
118
+ return {
119
+ status: error.constructor.status,
120
+ headers: new Headers(),
121
+ body: error.toJSON()
122
+ };
123
+ }
124
+
125
+ function isStartWithMiddlewares(middlewares, compare) {
126
+ if (compare.length > middlewares.length) {
127
+ return false;
128
+ }
129
+ for (let i = 0; i < middlewares.length; i++) {
130
+ if (compare[i] === void 0) {
131
+ return true;
132
+ }
133
+ if (middlewares[i] !== compare[i]) {
134
+ return false;
135
+ }
136
+ }
137
+ return true;
138
+ }
139
+ function mergeMiddlewares(first, second, options) {
140
+ if (options.dedupeLeading && isStartWithMiddlewares(second, first)) {
141
+ return second;
142
+ }
143
+ return [...first, ...second];
144
+ }
145
+ function addMiddleware(middlewares, addition) {
146
+ return [...middlewares, addition];
147
+ }
148
+
149
+ class Contract {
150
+ /**
151
+ * This property holds the defined options.
152
+ */
153
+ "~orpc";
154
+ constructor(def) {
155
+ this["~orpc"] = def;
156
+ }
157
+ }
158
+ class Procedure extends Contract {
159
+ }
160
+ function isProcedure(item) {
161
+ return item instanceof Procedure || // This is so we'll return true for Proxy-wrapped Procedures e.g. as returned by `callable`
162
+ (typeof item === "object" || typeof item === "function") && item !== null && "~orpc" in item && typeof item["~orpc"] === "object" && item["~orpc"] !== null && "route" in item["~orpc"] && "meta" in item["~orpc"] && "middlewares" in item["~orpc"] && "inputValidationIndex" in item["~orpc"] && "outputValidationIndex" in item["~orpc"] && "handler" in item["~orpc"];
163
+ }
164
+
165
+ function mergeRoute(a, b) {
166
+ return { ...a, ...b };
167
+ }
168
+ function prefixRoute(route, prefix) {
169
+ if (!route.path) {
170
+ return route;
171
+ }
172
+ return {
173
+ ...route,
174
+ path: `${prefix}${route.path}`
175
+ };
176
+ }
177
+ function unshiftTagRoute(route, tags) {
178
+ return {
179
+ ...route,
180
+ tags: [...tags, ...route.tags ?? []]
181
+ };
182
+ }
183
+ function mergePrefix(a, b) {
184
+ return a ? `${a}${b}` : b;
185
+ }
186
+ function mergeTags(a, b) {
187
+ return a ? [...a, ...b] : b;
188
+ }
189
+ function enhanceRoute(route, options) {
190
+ let router = route;
191
+ if (options.prefix) {
192
+ router = prefixRoute(router, options.prefix);
193
+ }
194
+ if (options.tags?.length) {
195
+ router = unshiftTagRoute(router, options.tags);
196
+ }
197
+ return router;
198
+ }
199
+
200
+ function getRouter(router, path) {
201
+ let current = router;
202
+ for (let i = 0; i < path.length; i++) {
203
+ const segment = path[i];
204
+ if (!current) {
205
+ return void 0;
206
+ }
207
+ if (isProcedure(current)) {
208
+ return void 0;
209
+ }
210
+ if (!isLazy(current)) {
211
+ current = current[segment];
212
+ continue;
213
+ }
214
+ const lazied = current;
215
+ const rest = path.slice(i);
216
+ return lazyInternal(async () => {
217
+ const unwrapped = await unlazy(lazied);
218
+ const next = getRouter(unwrapped.default, rest);
219
+ return unlazy(next);
220
+ }, getLazyMeta(lazied));
221
+ }
222
+ return current;
223
+ }
224
+ function createAccessibleLazyRouter(lazied) {
225
+ const recursive = new Proxy(lazied, {
226
+ get(target, key) {
227
+ if (typeof key !== "string") {
228
+ return Reflect.get(target, key);
229
+ }
230
+ const next = getRouter(lazied, [key]);
231
+ return createAccessibleLazyRouter(next);
232
+ }
233
+ });
234
+ return recursive;
235
+ }
236
+ function enhanceRouter(router, options) {
237
+ if (isLazy(router)) {
238
+ const laziedMeta = getLazyMeta(router);
239
+ const enhancedPrefix = laziedMeta?.prefix ? mergePrefix(options.prefix, laziedMeta?.prefix) : options.prefix;
240
+ const enhanced2 = lazyInternal(
241
+ async () => {
242
+ const { default: unlaziedRouter } = await unlazy(router);
243
+ const enhanced3 = enhanceRouter(unlaziedRouter, options);
244
+ return unlazy(enhanced3);
245
+ },
246
+ {
247
+ ...laziedMeta,
248
+ prefix: enhancedPrefix
249
+ }
250
+ );
251
+ const accessible = createAccessibleLazyRouter(enhanced2);
252
+ return accessible;
253
+ }
254
+ if (isProcedure(router)) {
255
+ const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares, {
256
+ dedupeLeading: options.dedupeLeadingMiddlewares
257
+ });
258
+ const newMiddlewareAdded = newMiddlewares.length - router["~orpc"].middlewares.length;
259
+ const enhanced2 = new Procedure({
260
+ ...router["~orpc"],
261
+ route: enhanceRoute(router["~orpc"].route, options),
262
+ middlewares: newMiddlewares,
263
+ inputValidationIndex: router["~orpc"].inputValidationIndex + newMiddlewareAdded,
264
+ outputValidationIndex: router["~orpc"].outputValidationIndex + newMiddlewareAdded
265
+ });
266
+ return enhanced2;
267
+ }
268
+ const enhanced = {};
269
+ for (const key in router) {
270
+ enhanced[key] = enhanceRouter(router[key], options);
271
+ }
272
+ return enhanced;
273
+ }
274
+ function traverseContractProcedures(options, callback, lazyOptions = []) {
275
+ const currentRouter = options.router;
276
+ if (isLazy(currentRouter)) {
277
+ lazyOptions.push({
278
+ router: currentRouter,
279
+ path: options.path
280
+ });
281
+ } else if (currentRouter instanceof Contract) {
282
+ callback({
283
+ contract: currentRouter,
284
+ path: options.path
285
+ });
286
+ } else if (typeof currentRouter === "string") {
287
+ throw new Error("Unexpected: got string instead of router");
288
+ } else {
289
+ for (const key in currentRouter) {
290
+ traverseContractProcedures(
291
+ {
292
+ router: currentRouter[key],
293
+ path: [...options.path, key]
294
+ },
295
+ callback,
296
+ lazyOptions
297
+ );
298
+ }
299
+ }
300
+ return lazyOptions;
301
+ }
302
+ async function resolveContractProcedures(options, callback) {
303
+ const pending = [options];
304
+ for (const options2 of pending) {
305
+ const lazyOptions = traverseContractProcedures(options2, callback);
306
+ for (const options3 of lazyOptions) {
307
+ const { default: router } = await unlazy(options3.router);
308
+ pending.push({
309
+ router,
310
+ path: options3.path
311
+ });
312
+ }
313
+ }
314
+ }
315
+ async function unlazyRouter(router) {
316
+ if (isProcedure(router)) {
317
+ return router;
318
+ }
319
+ const unlazied = {};
320
+ for (const key in router) {
321
+ const item = router[key];
322
+ const { default: unlaziedRouter } = await unlazy(item);
323
+ unlazied[key] = await unlazyRouter(unlaziedRouter);
324
+ }
325
+ return unlazied;
326
+ }
327
+
328
+ const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
329
+ function lazyInternal(loader, meta = {}) {
330
+ return {
331
+ [LAZY_SYMBOL]: {
332
+ loader,
333
+ meta
334
+ }
335
+ };
336
+ }
337
+ function lazy(prefix, loader) {
338
+ return enhanceRouter(lazyInternal(loader), {
339
+ middlewares: [],
340
+ dedupeLeadingMiddlewares: true,
341
+ prefix
342
+ });
343
+ }
344
+ function isLazy(item) {
345
+ return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_SYMBOL in item;
346
+ }
347
+ function getLazyMeta(lazied) {
348
+ return lazied[LAZY_SYMBOL].meta;
349
+ }
350
+ function unlazy(lazied) {
351
+ return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
352
+ }
353
+
354
+ const endpointRegex = new RegExp(`^(${HTTPMethods.join("|")})`);
355
+ function isDevelopment() {
356
+ return process.env.NODE_ENV === "development";
357
+ }
358
+ function standardizeHTTPPath(path) {
359
+ return `/${path.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
360
+ }
361
+ function getDynamicParams(path) {
362
+ return path ? standardizeHTTPPath(path).match(/\/\{[^}]+\}/g)?.map((v) => ({
363
+ raw: v,
364
+ name: v.match(/\{\+?([^}]+)\}/)[1]
365
+ })) : void 0;
366
+ }
367
+ function parseEndpointDefinition(stringsOrEndpoint, values) {
368
+ let method, path, pathSchema;
369
+ if (stringsOrEndpoint instanceof Array) {
370
+ let endpoint = stringsOrEndpoint[0];
371
+ if (endpoint === void 0 || !endpointRegex.test(endpoint)) {
372
+ throw new Error(".endpoint() must start with a valid HTTP endpoint string.");
373
+ }
374
+ const shape = {};
375
+ for (let i = 1; i < stringsOrEndpoint.length; i++) {
376
+ const str = stringsOrEndpoint[i];
377
+ const value = values[i - 1];
378
+ if (typeof value !== "object" || value instanceof z.core.$ZodType) {
379
+ throw new Error(
380
+ `Each template value for .endpoint must be an object with a single key, whose value is a ZodType.`
381
+ );
382
+ }
383
+ const valueEntries = Object.entries(value);
384
+ if (valueEntries.length !== 1) {
385
+ throw new Error(
386
+ `Each template value for .endpoint must be an object with a single key, whose value is a ZodType.`
387
+ );
388
+ }
389
+ const [key, schema] = valueEntries[0];
390
+ endpoint += `{${key}}${str}`;
391
+ if (key in schema) {
392
+ throw new Error(`Duplicate path parameter name "${key}" in endpoint.`);
393
+ }
394
+ shape[key] = schema;
395
+ }
396
+ [method, path] = endpoint.split(" ", 2);
397
+ pathSchema = z.object(shape);
398
+ } else if (values.length <= 1) {
399
+ const endpoint = stringsOrEndpoint;
400
+ const schema = values[0];
401
+ [method, path] = endpoint.split(" ", 2);
402
+ const pathParamNames = getDynamicParams(path)?.map((p) => p.name) ?? [];
403
+ let schemaKeys;
404
+ if (schema instanceof z.core.$ZodType) {
405
+ if (schema instanceof z.core.$ZodObject) {
406
+ schemaKeys = Object.keys(schema._zod.def.shape);
407
+ pathSchema = schema;
408
+ } else {
409
+ throw new Error(
410
+ `Path schema for endpoint "${endpoint}" must be a ZodObject schema (or object where each value is a ZodType).`
411
+ );
412
+ }
413
+ } else if (typeof schema === "object") {
414
+ schemaKeys = Object.keys(schema);
415
+ pathSchema = z.object(schema);
416
+ } else if (schema !== void 0) {
417
+ throw new Error(
418
+ `Path schema for endpoint "${endpoint}" must be a ZodObject schema (or object where each value is a ZodType).`
419
+ );
420
+ } else {
421
+ schemaKeys = [];
422
+ pathSchema = z.object({});
423
+ }
424
+ if (pathParamNames.length !== schemaKeys.length || !pathParamNames.every((name) => schemaKeys.includes(name))) {
425
+ throw new Error(`Path schema keys do not match dynamic parameters in endpoint "${endpoint}".`);
426
+ }
427
+ } else {
428
+ throw new Error("Invalid arguments for .endpoint() method.");
429
+ }
430
+ return { method, path, pathSchema };
431
+ }
432
+
433
+ export { APIError as A, BadRequestError as B, Contract as C, isLazy as D, isStartWithMiddlewares as E, ForbiddenError as F, GatewayTimeoutError as G, mergeMiddlewares as H, InternalServerError as I, getRouter as J, createAccessibleLazyRouter as K, LAZY_SYMBOL as L, MethodNotAllowedError as M, NotFoundError as N, traverseContractProcedures as O, Procedure as P, unlazyRouter as Q, RequestTimeoutError as R, ServiceUnavailableError as S, TooManyRequestsError as T, UnauthorizedError as U, ValidationError as V, endpointRegex as W, isDevelopment as X, mergeTags as a, enhanceRouter as b, mergeRoute as c, prefixRoute as d, encodeError as e, addMiddleware as f, getDynamicParams as g, getLazyMeta as h, isAPIErrorStatus as i, isProcedure as j, NotAcceptableError as k, lazyInternal as l, mergePrefix as m, ConflictError as n, PreconditionFailedError as o, parseEndpointDefinition as p, ContentTooLargeError as q, resolveContractProcedures as r, standardizeHTTPPath as s, toAPIError as t, unlazy as u, UnsupportedMediaTypeError as v, UnprocessableContentError as w, NotImplementedError as x, BadGatewayError as y, lazy as z };
@@ -0,0 +1,30 @@
1
+ import { parse, serialize } from 'cookie';
2
+
3
+ function setCookie(headers, name, value, options = {}) {
4
+ if (headers === void 0) {
5
+ return;
6
+ }
7
+ const cookieString = serialize(name, value, {
8
+ path: "/",
9
+ ...options
10
+ });
11
+ headers.append("Set-Cookie", cookieString);
12
+ }
13
+ function getCookie(headers, name, options = {}) {
14
+ if (headers === void 0) {
15
+ return void 0;
16
+ }
17
+ const cookieHeader = headers.get("cookie");
18
+ if (cookieHeader === null) {
19
+ return void 0;
20
+ }
21
+ return parse(cookieHeader, options)[name];
22
+ }
23
+ function deleteCookie(headers, name, options = {}) {
24
+ return setCookie(headers, name, "", {
25
+ ...options,
26
+ maxAge: 0
27
+ });
28
+ }
29
+
30
+ export { deleteCookie as d, getCookie as g, setCookie as s };
@@ -0,0 +1,51 @@
1
+ import { JSONSchema, SchemaConverter } from '@temporary-name/server/openapi';
2
+
3
+ interface ZodToJsonSchemaConverterOptions {
4
+ /**
5
+ * Max depth of lazy type.
6
+ *
7
+ * Used anyJsonSchema (`{}`) when exceed max depth
8
+ *
9
+ * @default 2
10
+ */
11
+ maxLazyDepth?: number;
12
+ /**
13
+ * Max depth of nested types.
14
+ *
15
+ * Used anyJsonSchema (`{}`) when exceed max depth
16
+ *
17
+ * @default 10
18
+ */
19
+ maxStructureDepth?: number;
20
+ /**
21
+ * The schema to be used to represent the any | unknown type.
22
+ *
23
+ * @default { }
24
+ */
25
+ anyJsonSchema?: Exclude<JSONSchema, boolean>;
26
+ /**
27
+ * The schema to be used when the Zod schema is unsupported.
28
+ *
29
+ * @default { not: {} }
30
+ */
31
+ unsupportedJsonSchema?: Exclude<JSONSchema, boolean>;
32
+ /**
33
+ * The schema to be used to represent the undefined type.
34
+ *
35
+ * @default { not: {} }
36
+ */
37
+ undefinedJsonSchema?: Exclude<JSONSchema, boolean>;
38
+ }
39
+ declare class ZodToJsonSchemaConverter {
40
+ #private;
41
+ private readonly maxLazyDepth;
42
+ private readonly maxStructureDepth;
43
+ private readonly anyJsonSchema;
44
+ private readonly unsupportedJsonSchema;
45
+ private readonly undefinedJsonSchema;
46
+ constructor(options?: ZodToJsonSchemaConverterOptions);
47
+ convert: SchemaConverter;
48
+ }
49
+
50
+ export { ZodToJsonSchemaConverter as a };
51
+ export type { ZodToJsonSchemaConverterOptions as Z };
@@ -0,0 +1,51 @@
1
+ import { JSONSchema, SchemaConverter } from '@temporary-name/server/openapi';
2
+
3
+ interface ZodToJsonSchemaConverterOptions {
4
+ /**
5
+ * Max depth of lazy type.
6
+ *
7
+ * Used anyJsonSchema (`{}`) when exceed max depth
8
+ *
9
+ * @default 2
10
+ */
11
+ maxLazyDepth?: number;
12
+ /**
13
+ * Max depth of nested types.
14
+ *
15
+ * Used anyJsonSchema (`{}`) when exceed max depth
16
+ *
17
+ * @default 10
18
+ */
19
+ maxStructureDepth?: number;
20
+ /**
21
+ * The schema to be used to represent the any | unknown type.
22
+ *
23
+ * @default { }
24
+ */
25
+ anyJsonSchema?: Exclude<JSONSchema, boolean>;
26
+ /**
27
+ * The schema to be used when the Zod schema is unsupported.
28
+ *
29
+ * @default { not: {} }
30
+ */
31
+ unsupportedJsonSchema?: Exclude<JSONSchema, boolean>;
32
+ /**
33
+ * The schema to be used to represent the undefined type.
34
+ *
35
+ * @default { not: {} }
36
+ */
37
+ undefinedJsonSchema?: Exclude<JSONSchema, boolean>;
38
+ }
39
+ declare class ZodToJsonSchemaConverter {
40
+ #private;
41
+ private readonly maxLazyDepth;
42
+ private readonly maxStructureDepth;
43
+ private readonly anyJsonSchema;
44
+ private readonly unsupportedJsonSchema;
45
+ private readonly undefinedJsonSchema;
46
+ constructor(options?: ZodToJsonSchemaConverterOptions);
47
+ convert: SchemaConverter;
48
+ }
49
+
50
+ export { ZodToJsonSchemaConverter as a };
51
+ export type { ZodToJsonSchemaConverterOptions as Z };
@@ -0,0 +1,39 @@
1
+ import { HTTPPath, StandardResponse, StandardLazyRequest } from '@temporary-name/shared';
2
+ import { C as Context, m as Router } from './server.DpIhEnBO.mjs';
3
+
4
+ interface StandardHandleOptions<T extends Context> {
5
+ prefix?: HTTPPath;
6
+ context: T;
7
+ }
8
+ type StandardHandleResult = {
9
+ matched: true;
10
+ response: StandardResponse;
11
+ } | {
12
+ matched: false;
13
+ response: undefined;
14
+ };
15
+ declare class StandardHandler<T extends Context> {
16
+ private readonly matcher;
17
+ constructor(router: Router<T>);
18
+ handle(request: StandardLazyRequest, options: StandardHandleOptions<T>): Promise<StandardHandleResult>;
19
+ }
20
+
21
+ type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (object extends T ? {
22
+ context?: T;
23
+ } : {
24
+ context: T;
25
+ });
26
+ declare function resolveFriendlyStandardHandleOptions<T extends Context>(options: FriendlyStandardHandleOptions<T>): StandardHandleOptions<T>;
27
+ /**
28
+ * {@link https://github.com/unjs/rou3}
29
+ *
30
+ * @internal
31
+ */
32
+ declare function toRou3Pattern(path: HTTPPath): string;
33
+ /**
34
+ * @internal
35
+ */
36
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
37
+
38
+ export { StandardHandler as b, decodeParams as d, resolveFriendlyStandardHandleOptions as r, toRou3Pattern as t };
39
+ export type { FriendlyStandardHandleOptions as F, StandardHandleOptions as S, StandardHandleResult as a };