@temporary-name/server 1.9.3-alpha.6f8b694b2a090fe0182bfd5f16d29ca20f259307 → 1.9.3-alpha.70ac9623e5fa2a8af7954e34ef97cee968e5cad9

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 +6 -9
  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 +18 -160
  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 +16 -125
  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 +373 -493
  15. package/dist/index.d.ts +373 -493
  16. package/dist/index.mjs +547 -469
  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.BGG3eatg.mjs +315 -0
  21. package/dist/shared/server.BJw16psR.d.mts +39 -0
  22. package/dist/shared/server.BM9lK_Yv.mjs +523 -0
  23. package/dist/shared/server.BpMVFPn5.d.ts +39 -0
  24. package/dist/shared/server.C1RJffw4.mjs +30 -0
  25. package/dist/shared/server.CjPiuQYH.d.mts +51 -0
  26. package/dist/shared/server.CjPiuQYH.d.ts +51 -0
  27. package/dist/shared/server.CmNVzZVe.mjs +156 -0
  28. package/dist/shared/server.DX_j7xyF.d.mts +805 -0
  29. package/dist/shared/server.DX_j7xyF.d.ts +805 -0
  30. package/dist/shared/server.X8F6e8eV.mjs +499 -0
  31. package/package.json +13 -30
  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 -11
  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.BEHw7Eyx.mjs +0 -247
  39. package/dist/shared/server.BKSOrA6h.d.mts +0 -192
  40. package/dist/shared/server.BKSOrA6h.d.ts +0 -192
  41. package/dist/shared/server.BKh8I1Ny.mjs +0 -239
  42. package/dist/shared/server.BeuTpcmO.d.mts +0 -23
  43. package/dist/shared/server.C1fnTLq0.d.mts +0 -57
  44. package/dist/shared/server.CQyYNJ1H.d.ts +0 -57
  45. package/dist/shared/server.DLsti1Pv.mjs +0 -293
  46. package/dist/shared/server.SLLuK6_v.d.ts +0 -23
@@ -0,0 +1,523 @@
1
+ import { isAsyncIteratorObject, toArray } from '@temporary-name/shared';
2
+ import { mapEventIterator } from '@temporary-name/standard-server';
3
+ import { custom, safeParseAsync } from '@temporary-name/zod';
4
+ import { V as ValidationError } from './server.X8F6e8eV.mjs';
5
+ import { JSONSchemaFormat, JSONSchemaContentEncoding } from '@temporary-name/server/openapi';
6
+ import { registry, globalRegistry } from 'zod/v4/core';
7
+
8
+ const EVENT_ITERATOR_DETAILS_SYMBOL = Symbol("ORPC_EVENT_ITERATOR_DETAILS");
9
+ function eventIterator(yields, returns) {
10
+ const schema = custom(
11
+ (iterator) => isAsyncIteratorObject(iterator)
12
+ ).transform((iterator) => {
13
+ const mapped = mapEventIterator(iterator, {
14
+ async value(value, done) {
15
+ const schema2 = done ? returns : yields;
16
+ if (!schema2) {
17
+ return value;
18
+ }
19
+ const result = await safeParseAsync(schema2, value);
20
+ if (result.success) {
21
+ return result.data;
22
+ } else {
23
+ throw new Error("Event iterator validation failed", {
24
+ cause: new ValidationError({
25
+ issues: result.error.issues,
26
+ data: value
27
+ })
28
+ });
29
+ }
30
+ },
31
+ error: async (error) => error
32
+ });
33
+ return mapped;
34
+ });
35
+ schema[EVENT_ITERATOR_DETAILS_SYMBOL] = {
36
+ yields,
37
+ returns
38
+ };
39
+ return schema;
40
+ }
41
+ function getEventIteratorSchemaDetails(schema) {
42
+ if (schema === void 0) {
43
+ return void 0;
44
+ }
45
+ return schema[EVENT_ITERATOR_DETAILS_SYMBOL];
46
+ }
47
+
48
+ var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
49
+ JsonSchemaXNativeType2["BigInt"] = "bigint";
50
+ JsonSchemaXNativeType2["RegExp"] = "regexp";
51
+ JsonSchemaXNativeType2["Date"] = "date";
52
+ JsonSchemaXNativeType2["Url"] = "url";
53
+ JsonSchemaXNativeType2["Set"] = "set";
54
+ JsonSchemaXNativeType2["Map"] = "map";
55
+ return JsonSchemaXNativeType2;
56
+ })(JsonSchemaXNativeType || {});
57
+
58
+ const JSON_SCHEMA_REGISTRY = registry();
59
+ const JSON_SCHEMA_INPUT_REGISTRY = registry();
60
+ const JSON_SCHEMA_OUTPUT_REGISTRY = registry();
61
+
62
+ class ZodToJsonSchemaConverter {
63
+ maxLazyDepth;
64
+ maxStructureDepth;
65
+ anyJsonSchema;
66
+ unsupportedJsonSchema;
67
+ undefinedJsonSchema;
68
+ constructor(options = {}) {
69
+ this.maxLazyDepth = options.maxLazyDepth ?? 2;
70
+ this.maxStructureDepth = options.maxStructureDepth ?? 10;
71
+ this.anyJsonSchema = options.anyJsonSchema ?? {};
72
+ this.unsupportedJsonSchema = options.unsupportedJsonSchema ?? { not: {} };
73
+ this.undefinedJsonSchema = options.undefinedJsonSchema ?? { not: {} };
74
+ }
75
+ convert = (schema, options) => {
76
+ return this.#convert(schema, options, 0, 0);
77
+ };
78
+ #convert(schema, options, lazyDepth, structureDepth, isHandledCustomJSONSchema = false) {
79
+ if (structureDepth > this.maxStructureDepth) {
80
+ return [false, this.anyJsonSchema];
81
+ }
82
+ if (!options.minStructureDepthForRef || options.minStructureDepthForRef <= structureDepth) {
83
+ const components = toArray(options.components);
84
+ for (const component of components) {
85
+ if (component.schema === schema && component.allowedStrategies.includes(options.strategy)) {
86
+ return [component.required, { $ref: component.ref }];
87
+ }
88
+ }
89
+ }
90
+ if (!isHandledCustomJSONSchema) {
91
+ const customJSONSchema = this.#getCustomJsonSchema(schema, options);
92
+ if (customJSONSchema) {
93
+ const [required, json] = this.#convert(schema, options, lazyDepth, structureDepth, true);
94
+ return [required, { ...json, ...customJSONSchema }];
95
+ }
96
+ }
97
+ switch (schema._zod.def.type) {
98
+ case "string": {
99
+ const string = schema;
100
+ const json = { type: "string" };
101
+ const { minimum, maximum, format, patterns, contentEncoding } = string._zod.bag;
102
+ if (typeof minimum === "number") {
103
+ json.minLength = minimum;
104
+ }
105
+ if (typeof maximum === "number") {
106
+ json.maxLength = maximum;
107
+ }
108
+ if (typeof contentEncoding === "string") {
109
+ json.contentEncoding = this.#handleContentEncoding(contentEncoding);
110
+ }
111
+ if (typeof format === "string" && format !== "regex" && json.contentEncoding === void 0) {
112
+ json.format = this.#handleStringFormat(format);
113
+ }
114
+ if (patterns instanceof Set && json.contentEncoding === void 0 && json.format === void 0) {
115
+ for (const pattern of patterns) {
116
+ if (json.pattern === void 0) {
117
+ json.pattern = pattern.source;
118
+ } else {
119
+ json.allOf ??= [];
120
+ json.allOf.push({ pattern: pattern.source });
121
+ }
122
+ }
123
+ }
124
+ if (format === "jwt" && json.contentEncoding === void 0 && json.format === void 0 && json.pattern === void 0) {
125
+ json.pattern = /^[\w-]+\.[\w-]+\.[\w-]+$/.source;
126
+ }
127
+ return [true, json];
128
+ }
129
+ case "number": {
130
+ const number = schema;
131
+ const json = { type: "number" };
132
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = number._zod.bag;
133
+ if (typeof format === "string" && format?.includes("int")) {
134
+ json.type = "integer";
135
+ }
136
+ if (typeof minimum === "number") {
137
+ json.minimum = minimum;
138
+ }
139
+ if (typeof maximum === "number") {
140
+ json.maximum = maximum;
141
+ }
142
+ if (typeof exclusiveMinimum === "number") {
143
+ json.exclusiveMinimum = exclusiveMinimum;
144
+ }
145
+ if (typeof exclusiveMaximum === "number") {
146
+ json.exclusiveMaximum = exclusiveMaximum;
147
+ }
148
+ if (typeof multipleOf === "number") {
149
+ json.multipleOf = multipleOf;
150
+ }
151
+ return [true, json];
152
+ }
153
+ case "boolean": {
154
+ return [true, { type: "boolean" }];
155
+ }
156
+ case "bigint": {
157
+ return [
158
+ true,
159
+ {
160
+ type: "string",
161
+ pattern: "^-?[0-9]+$",
162
+ "x-native-type": JsonSchemaXNativeType.BigInt
163
+ }
164
+ ];
165
+ }
166
+ case "date": {
167
+ return [
168
+ true,
169
+ {
170
+ type: "string",
171
+ format: JSONSchemaFormat.DateTime,
172
+ "x-native-type": JsonSchemaXNativeType.Date
173
+ }
174
+ ];
175
+ }
176
+ case "null": {
177
+ return [true, { type: "null" }];
178
+ }
179
+ case "undefined":
180
+ case "void": {
181
+ return [false, this.undefinedJsonSchema];
182
+ }
183
+ case "any": {
184
+ return [false, this.anyJsonSchema];
185
+ }
186
+ case "unknown": {
187
+ return [false, this.anyJsonSchema];
188
+ }
189
+ case "never": {
190
+ return [true, this.unsupportedJsonSchema];
191
+ }
192
+ case "array": {
193
+ const array = schema;
194
+ const json = { type: "array" };
195
+ const { minimum, maximum } = array._zod.bag;
196
+ if (typeof minimum === "number") {
197
+ json.minItems = minimum;
198
+ }
199
+ if (typeof maximum === "number") {
200
+ json.maxItems = maximum;
201
+ }
202
+ json.items = this.#handleArrayItemJsonSchema(
203
+ this.#convert(array._zod.def.element, options, lazyDepth, structureDepth + 1),
204
+ options
205
+ );
206
+ return [true, json];
207
+ }
208
+ case "object": {
209
+ const object = schema;
210
+ const json = { type: "object" };
211
+ for (const [key, value] of Object.entries(object._zod.def.shape)) {
212
+ const [itemRequired, itemJson] = this.#convert(value, options, lazyDepth, structureDepth + 1);
213
+ json.properties ??= {};
214
+ json.properties[key] = itemJson;
215
+ if (itemRequired) {
216
+ json.required ??= [];
217
+ json.required.push(key);
218
+ }
219
+ }
220
+ if (object._zod.def.catchall) {
221
+ if (object._zod.def.catchall._zod.def.type === "never") {
222
+ json.additionalProperties = false;
223
+ } else {
224
+ const [_, addJson] = this.#convert(
225
+ object._zod.def.catchall,
226
+ options,
227
+ lazyDepth,
228
+ structureDepth + 1
229
+ );
230
+ json.additionalProperties = addJson;
231
+ }
232
+ }
233
+ return [true, json];
234
+ }
235
+ case "union": {
236
+ const union = schema;
237
+ const anyOf = [];
238
+ let required = true;
239
+ for (const item of union._zod.def.options) {
240
+ const [itemRequired, itemJson] = this.#convert(item, options, lazyDepth, structureDepth);
241
+ if (!itemRequired) {
242
+ required = false;
243
+ }
244
+ if (options.strategy === "input") {
245
+ if (itemJson !== this.undefinedJsonSchema && itemJson !== this.unsupportedJsonSchema) {
246
+ anyOf.push(itemJson);
247
+ }
248
+ } else {
249
+ if (itemJson !== this.undefinedJsonSchema) {
250
+ anyOf.push(itemJson);
251
+ }
252
+ }
253
+ }
254
+ return [required, anyOf.length === 1 ? anyOf[0] : { anyOf }];
255
+ }
256
+ case "intersection": {
257
+ const intersection = schema;
258
+ const json = { allOf: [] };
259
+ let required = false;
260
+ for (const item of [intersection._zod.def.left, intersection._zod.def.right]) {
261
+ const [itemRequired, itemJson] = this.#convert(item, options, lazyDepth, structureDepth);
262
+ json.allOf.push(itemJson);
263
+ if (itemRequired) {
264
+ required = true;
265
+ }
266
+ }
267
+ return [required, json];
268
+ }
269
+ case "tuple": {
270
+ const tuple = schema;
271
+ const json = { type: "array", prefixItems: [] };
272
+ for (const item of tuple._zod.def.items) {
273
+ json.prefixItems.push(
274
+ this.#handleArrayItemJsonSchema(
275
+ this.#convert(item, options, lazyDepth, structureDepth + 1),
276
+ options
277
+ )
278
+ );
279
+ }
280
+ if (tuple._zod.def.rest) {
281
+ json.items = this.#handleArrayItemJsonSchema(
282
+ this.#convert(tuple._zod.def.rest, options, lazyDepth, structureDepth + 1),
283
+ options
284
+ );
285
+ }
286
+ const { minimum, maximum } = tuple._zod.bag;
287
+ if (typeof minimum === "number") {
288
+ json.minItems = minimum;
289
+ }
290
+ if (typeof maximum === "number") {
291
+ json.maxItems = maximum;
292
+ }
293
+ return [true, json];
294
+ }
295
+ case "record": {
296
+ const record = schema;
297
+ const json = { type: "object" };
298
+ json.propertyNames = this.#convert(
299
+ record._zod.def.keyType,
300
+ options,
301
+ lazyDepth,
302
+ structureDepth + 1
303
+ )[1];
304
+ json.additionalProperties = this.#convert(
305
+ record._zod.def.valueType,
306
+ options,
307
+ lazyDepth,
308
+ structureDepth + 1
309
+ )[1];
310
+ return [true, json];
311
+ }
312
+ case "map": {
313
+ const map = schema;
314
+ return [
315
+ true,
316
+ {
317
+ type: "array",
318
+ items: {
319
+ type: "array",
320
+ prefixItems: [
321
+ this.#handleArrayItemJsonSchema(
322
+ this.#convert(map._zod.def.keyType, options, lazyDepth, structureDepth + 1),
323
+ options
324
+ ),
325
+ this.#handleArrayItemJsonSchema(
326
+ this.#convert(map._zod.def.valueType, options, lazyDepth, structureDepth + 1),
327
+ options
328
+ )
329
+ ],
330
+ maxItems: 2,
331
+ minItems: 2
332
+ },
333
+ "x-native-type": JsonSchemaXNativeType.Map
334
+ }
335
+ ];
336
+ }
337
+ case "set": {
338
+ const set = schema;
339
+ return [
340
+ true,
341
+ {
342
+ type: "array",
343
+ uniqueItems: true,
344
+ items: this.#handleArrayItemJsonSchema(
345
+ this.#convert(set._zod.def.valueType, options, lazyDepth, structureDepth + 1),
346
+ options
347
+ ),
348
+ "x-native-type": JsonSchemaXNativeType.Set
349
+ }
350
+ ];
351
+ }
352
+ case "enum": {
353
+ const enum_ = schema;
354
+ return [true, { enum: Object.values(enum_._zod.def.entries) }];
355
+ }
356
+ case "literal": {
357
+ const literal = schema;
358
+ let required = true;
359
+ const values = /* @__PURE__ */ new Set();
360
+ for (const value of literal._zod.def.values) {
361
+ if (value === void 0) {
362
+ required = false;
363
+ } else {
364
+ values.add(typeof value === "bigint" ? value.toString() : value);
365
+ }
366
+ }
367
+ const json = values.size === 0 ? this.undefinedJsonSchema : values.size === 1 ? { const: values.values().next().value } : { enum: Array.from(values) };
368
+ return [required, json];
369
+ }
370
+ case "file": {
371
+ const file = schema;
372
+ const oneOf = [];
373
+ const { mime } = file._zod.bag;
374
+ if (mime === void 0 || Array.isArray(mime) && mime.every((m) => typeof m === "string")) {
375
+ for (const type of mime ?? ["*/*"]) {
376
+ oneOf.push({
377
+ type: "string",
378
+ contentMediaType: type
379
+ });
380
+ }
381
+ }
382
+ return [true, oneOf.length === 1 ? oneOf[0] : { anyOf: oneOf }];
383
+ }
384
+ case "transform": {
385
+ return [false, this.anyJsonSchema];
386
+ }
387
+ case "nullable": {
388
+ const nullable = schema;
389
+ const [required, json] = this.#convert(
390
+ nullable._zod.def.innerType,
391
+ options,
392
+ lazyDepth,
393
+ structureDepth
394
+ );
395
+ return [required, { anyOf: [json, { type: "null" }] }];
396
+ }
397
+ case "nonoptional": {
398
+ const nonoptional = schema;
399
+ const [, json] = this.#convert(nonoptional._zod.def.innerType, options, lazyDepth, structureDepth);
400
+ return [true, json];
401
+ }
402
+ case "success": {
403
+ return [true, { type: "boolean" }];
404
+ }
405
+ case "default":
406
+ case "prefault": {
407
+ const default_ = schema;
408
+ const [, json] = this.#convert(default_._zod.def.innerType, options, lazyDepth, structureDepth);
409
+ return [
410
+ false,
411
+ {
412
+ ...json,
413
+ default: default_._zod.def.defaultValue
414
+ }
415
+ ];
416
+ }
417
+ case "catch": {
418
+ const catch_ = schema;
419
+ return this.#convert(catch_._zod.def.innerType, options, lazyDepth, structureDepth);
420
+ }
421
+ case "nan": {
422
+ return [true, options.strategy === "input" ? this.unsupportedJsonSchema : { type: "null" }];
423
+ }
424
+ case "pipe": {
425
+ const pipe = schema;
426
+ return this.#convert(
427
+ options.strategy === "input" ? pipe._zod.def.in : pipe._zod.def.out,
428
+ options,
429
+ lazyDepth,
430
+ structureDepth
431
+ );
432
+ }
433
+ case "readonly": {
434
+ const readonly_ = schema;
435
+ const [required, json] = this.#convert(
436
+ readonly_._zod.def.innerType,
437
+ options,
438
+ lazyDepth,
439
+ structureDepth
440
+ );
441
+ return [required, { ...json, readOnly: true }];
442
+ }
443
+ case "template_literal": {
444
+ const templateLiteral = schema;
445
+ return [
446
+ true,
447
+ {
448
+ type: "string",
449
+ pattern: templateLiteral._zod.pattern.source
450
+ }
451
+ ];
452
+ }
453
+ case "optional": {
454
+ const optional = schema;
455
+ const [, json] = this.#convert(optional._zod.def.innerType, options, lazyDepth, structureDepth);
456
+ return [false, json];
457
+ }
458
+ case "lazy": {
459
+ const lazy = schema;
460
+ const currentLazyDepth = lazyDepth + 1;
461
+ if (currentLazyDepth > this.maxLazyDepth) {
462
+ return [false, this.anyJsonSchema];
463
+ }
464
+ return this.#convert(lazy._zod.def.getter(), options, currentLazyDepth, structureDepth);
465
+ }
466
+ default: {
467
+ schema._zod.def.type;
468
+ return [true, this.unsupportedJsonSchema];
469
+ }
470
+ }
471
+ }
472
+ #getCustomJsonSchema(schema, options) {
473
+ if (options.strategy === "input" && JSON_SCHEMA_INPUT_REGISTRY.has(schema)) {
474
+ return JSON_SCHEMA_INPUT_REGISTRY.get(schema);
475
+ }
476
+ if (options.strategy === "output" && JSON_SCHEMA_OUTPUT_REGISTRY.has(schema)) {
477
+ return JSON_SCHEMA_OUTPUT_REGISTRY.get(schema);
478
+ }
479
+ if (JSON_SCHEMA_REGISTRY.has(schema)) {
480
+ return JSON_SCHEMA_REGISTRY.get(schema);
481
+ }
482
+ const global = globalRegistry.get(schema);
483
+ if (global) {
484
+ return {
485
+ title: global.title,
486
+ description: global.description,
487
+ examples: Array.isArray(global.examples) ? global.examples : void 0
488
+ };
489
+ }
490
+ }
491
+ #handleArrayItemJsonSchema([required, schema], options) {
492
+ if (required || options.strategy === "input" || schema.default !== void 0) {
493
+ return schema;
494
+ }
495
+ if (schema === this.undefinedJsonSchema) {
496
+ return { type: "null" };
497
+ }
498
+ return {
499
+ anyOf: [
500
+ // schema can contain { type: 'null' } so we should use anyOf instead of oneOf
501
+ schema,
502
+ { type: "null" }
503
+ ]
504
+ };
505
+ }
506
+ #handleStringFormat(format) {
507
+ if (format === "guid") {
508
+ return JSONSchemaFormat.UUID;
509
+ }
510
+ if (format === "url") {
511
+ return JSONSchemaFormat.URI;
512
+ }
513
+ if (format === "datetime") {
514
+ return JSONSchemaFormat.DateTime;
515
+ }
516
+ return Object.values(JSONSchemaFormat).includes(format) ? format : void 0;
517
+ }
518
+ #handleContentEncoding(contentEncoding) {
519
+ return Object.values(JSONSchemaContentEncoding).includes(contentEncoding) ? contentEncoding : void 0;
520
+ }
521
+ }
522
+
523
+ export { JsonSchemaXNativeType as J, ZodToJsonSchemaConverter as Z, JSON_SCHEMA_REGISTRY as a, JSON_SCHEMA_INPUT_REGISTRY as b, JSON_SCHEMA_OUTPUT_REGISTRY as c, eventIterator as e, getEventIteratorSchemaDetails as g };
@@ -0,0 +1,39 @@
1
+ import { HTTPPath, StandardResponse, StandardLazyRequest } from '@temporary-name/shared';
2
+ import { C as Context, m as Router } from './server.DX_j7xyF.js';
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 };
@@ -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 };