@temporary-name/server 1.9.3-alpha.afd18ec2afa743b08cf1b5c2eb6252ded18a1f43 → 1.9.3-alpha.d751d322a9d105467b863db2bab6037dd277fd56

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 (31) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +3 -3
  2. package/dist/adapters/aws-lambda/index.d.ts +3 -3
  3. package/dist/adapters/aws-lambda/index.mjs +5 -7
  4. package/dist/adapters/fetch/index.d.mts +3 -3
  5. package/dist/adapters/fetch/index.d.ts +3 -3
  6. package/dist/adapters/fetch/index.mjs +5 -7
  7. package/dist/adapters/node/index.d.mts +3 -3
  8. package/dist/adapters/node/index.d.ts +3 -3
  9. package/dist/adapters/node/index.mjs +5 -7
  10. package/dist/adapters/standard/index.d.mts +5 -51
  11. package/dist/adapters/standard/index.d.ts +5 -51
  12. package/dist/adapters/standard/index.mjs +4 -6
  13. package/dist/index.d.mts +42 -264
  14. package/dist/index.d.ts +42 -264
  15. package/dist/index.mjs +108 -151
  16. package/dist/openapi/index.d.mts +0 -1
  17. package/dist/openapi/index.d.ts +0 -1
  18. package/dist/openapi/index.mjs +4 -12
  19. package/dist/plugins/index.d.mts +2 -2
  20. package/dist/plugins/index.d.ts +2 -2
  21. package/dist/shared/{server.SLLuK6_v.d.ts → server.8gkXYsTZ.d.ts} +2 -2
  22. package/dist/shared/{server.CQyYNJ1H.d.ts → server.B15EEOr0.d.ts} +1 -1
  23. package/dist/shared/{server._YqJjI50.mjs → server.B9VxPdeK.mjs} +10 -14
  24. package/dist/shared/server.BEHw7Eyx.mjs +247 -0
  25. package/dist/shared/{server.BKSOrA6h.d.mts → server.CZNLCQBm.d.mts} +2 -2
  26. package/dist/shared/{server.BKSOrA6h.d.ts → server.CZNLCQBm.d.ts} +2 -2
  27. package/dist/shared/{server.BeuTpcmO.d.mts → server.ChraIVaQ.d.mts} +2 -2
  28. package/dist/shared/{server.BKh8I1Ny.mjs → server.DcfsPloY.mjs} +17 -54
  29. package/dist/shared/{server.C1fnTLq0.d.mts → server.YXplw8TW.d.mts} +1 -1
  30. package/package.json +10 -9
  31. package/dist/shared/server.DhdDYN-Z.mjs +0 -261
package/dist/index.mjs CHANGED
@@ -1,49 +1,11 @@
1
- import { isContractProcedure, mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, enhanceRoute, mergeTags, getContractRouter } from '@temporary-name/contract';
2
- export { ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
3
1
  import { onError, resolveMaybeOptionalOptions } from '@temporary-name/shared';
4
2
  export { AsyncIteratorClass, EventPublisher, ORPCError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
5
- import { c as createProcedureClient, i as isLazy, g as getLazyMeta, l as lazy, u as unlazy, a as gatingContext } from './shared/server.BKh8I1Ny.mjs';
6
- export { L as LAZY_SYMBOL, b as createORPCErrorConstructorMap, m as mergeCurrentContext, d as middlewareOutputFn } from './shared/server.BKh8I1Ny.mjs';
3
+ import { isContractProcedure, mergePrefix, mergeErrorMap, enhanceRoute, mergeTags, ContractProcedure, mergeMeta, mergeRoute, prefixRoute, getContractRouter } from '@temporary-name/contract';
4
+ export { ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
5
+ import { SchemaClass, gatingContext } from '@temporary-name/zod';
6
+ import { c as createProcedureClient, i as isLazy, g as getLazyMeta, l as lazy, u as unlazy } from './shared/server.DcfsPloY.mjs';
7
+ export { L as LAZY_SYMBOL, a as createORPCErrorConstructorMap, m as mergeCurrentContext, b as middlewareOutputFn } from './shared/server.DcfsPloY.mjs';
7
8
  export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
8
- import 'node:async_hooks';
9
- import 'zod';
10
- import 'zod/v4/core';
11
-
12
- function decorateMiddleware(middleware) {
13
- const decorated = ((...args) => middleware(...args));
14
- decorated.mapInput = (mapInput) => {
15
- const mapped = decorateMiddleware(
16
- (options, input, ...rest) => middleware(options, mapInput(input), ...rest)
17
- );
18
- return mapped;
19
- };
20
- decorated.concat = (concatMiddleware, mapInput) => {
21
- const mapped = mapInput ? decorateMiddleware(concatMiddleware).mapInput(mapInput) : concatMiddleware;
22
- const concatted = decorateMiddleware((options, input, output, ...rest) => {
23
- const merged = middleware(
24
- {
25
- ...options,
26
- next: (...[nextOptions1]) => mapped(
27
- {
28
- ...options,
29
- context: { ...options.context, ...nextOptions1?.context },
30
- next: (...[nextOptions2]) => options.next({ context: { ...nextOptions1?.context, ...nextOptions2?.context } })
31
- },
32
- input,
33
- output,
34
- ...rest
35
- )
36
- },
37
- input,
38
- output,
39
- ...rest
40
- );
41
- return merged;
42
- });
43
- return concatted;
44
- };
45
- return decorated;
46
- }
47
9
 
48
10
  function isStartWithMiddlewares(middlewares, compare) {
49
11
  if (compare.length > middlewares.length) {
@@ -82,55 +44,10 @@ function isProcedure(item) {
82
44
  if (item instanceof Procedure) {
83
45
  return true;
84
46
  }
85
- return isContractProcedure(item) && "middlewares" in item["~orpc"] && "inputValidationIndex" in item["~orpc"] && "outputValidationIndex" in item["~orpc"] && "handler" in item["~orpc"];
47
+ return isContractProcedure(item) && "middlewares" in item["~orpc"] && "handler" in item["~orpc"];
86
48
  }
87
49
 
88
50
  class DecoratedProcedure extends Procedure {
89
- /**
90
- * Adds type-safe custom errors.
91
- * The provided errors are spared-merged with any existing errors.
92
- *
93
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
94
- */
95
- errors(errors) {
96
- return new DecoratedProcedure({
97
- ...this["~orpc"],
98
- errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
99
- });
100
- }
101
- /**
102
- * Sets or updates the metadata.
103
- * The provided metadata is spared-merged with any existing metadata.
104
- *
105
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
106
- */
107
- meta(meta) {
108
- return new DecoratedProcedure({
109
- ...this["~orpc"],
110
- meta: mergeMeta(this["~orpc"].meta, meta)
111
- });
112
- }
113
- /**
114
- * Sets or updates the route definition.
115
- * The provided route is spared-merged with any existing route.
116
- * This option is typically relevant when integrating with OpenAPI.
117
- *
118
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
119
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
120
- */
121
- route(route) {
122
- return new DecoratedProcedure({
123
- ...this["~orpc"],
124
- route: mergeRoute(this["~orpc"].route, route)
125
- });
126
- }
127
- use(middleware, mapInput) {
128
- const mapped = mapInput ? decorateMiddleware(middleware).mapInput(mapInput) : middleware;
129
- return new DecoratedProcedure({
130
- ...this["~orpc"],
131
- middlewares: addMiddleware(this["~orpc"].middlewares, mapped)
132
- });
133
- }
134
51
  /**
135
52
  * Make this procedure callable (works like a function while still being a procedure).
136
53
  *
@@ -295,87 +212,49 @@ async function unlazyRouter(router) {
295
212
  return unlazied;
296
213
  }
297
214
 
298
- class Builder {
299
- /**
300
- * This property holds the defined options.
301
- */
302
- "~orpc";
215
+ class ProcedureBuilder extends ContractProcedure {
216
+ z;
303
217
  constructor(def) {
304
- this["~orpc"] = def;
218
+ super(def);
219
+ this.z = new SchemaClass();
305
220
  }
306
221
  /**
307
- * Set or override the initial context.
308
- *
309
- * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
310
- */
311
- $context() {
312
- return this;
313
- }
314
- /**
315
- * Creates a middleware.
316
- *
317
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
318
- */
319
- middleware(middleware) {
320
- return decorateMiddleware(middleware);
321
- }
322
- /**
323
- * Adds type-safe custom errors.
324
- * The provided errors are spared-merged with any existing errors.
222
+ * Adds type-safe custom errors to the contract.
223
+ * The provided errors are spared-merged with any existing errors in the contract.
325
224
  *
326
225
  * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
327
226
  */
328
227
  errors(errors) {
329
- return new Builder({
228
+ return new ProcedureBuilder({
330
229
  ...this["~orpc"],
331
230
  errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
332
231
  });
333
232
  }
334
233
  /**
335
- * Uses a middleware to modify the context or improve the pipeline.
336
- *
337
- * @info Supports both normal middleware and inline middleware implementations.
338
- * @note The current context must be satisfy middleware dependent-context
339
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
340
- */
341
- use(middleware) {
342
- return new Builder({
343
- ...this["~orpc"],
344
- middlewares: addMiddleware(this["~orpc"].middlewares, middleware)
345
- });
346
- }
347
- useGating(gates, isGateEnabled) {
348
- return this.use(({ next, context }) => {
349
- return gatingContext.run(
350
- (gate) => isGateEnabled(gate, context),
351
- () => next({ context: { isGateEnabled } })
352
- );
353
- });
354
- }
355
- /**
356
- * Sets or updates the metadata.
357
- * The provided metadata is spared-merged with any existing metadata.
234
+ * Sets or updates the metadata for the contract.
235
+ * The provided metadata is spared-merged with any existing metadata in the contract.
358
236
  *
359
237
  * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
360
238
  */
361
239
  meta(meta) {
362
- return new Builder({
240
+ return new ProcedureBuilder({
363
241
  ...this["~orpc"],
364
242
  meta: mergeMeta(this["~orpc"].meta, meta)
365
243
  });
366
244
  }
367
245
  /**
368
- * Sets or updates the route definition.
369
- * The provided route is spared-merged with any existing route.
246
+ * Sets or updates the route definition for the contract.
247
+ * The provided route is spared-merged with any existing route in the contract.
370
248
  * This option is typically relevant when integrating with OpenAPI.
371
249
  *
372
250
  * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
373
251
  * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
374
252
  */
375
253
  route(route) {
376
- return new Builder({
254
+ const { prefix } = this["~orpc"];
255
+ return new ProcedureBuilder({
377
256
  ...this["~orpc"],
378
- route: mergeRoute(this["~orpc"].route, route)
257
+ route: mergeRoute(this["~orpc"].route, prefix ? prefixRoute(route, prefix) : route)
379
258
  });
380
259
  }
381
260
  /**
@@ -384,7 +263,7 @@ class Builder {
384
263
  * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
385
264
  */
386
265
  input(schema) {
387
- return new Builder({
266
+ return new ProcedureBuilder({
388
267
  ...this["~orpc"],
389
268
  inputSchema: schema,
390
269
  inputValidationIndex: this["~orpc"].middlewares.length
@@ -396,12 +275,33 @@ class Builder {
396
275
  * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
397
276
  */
398
277
  output(schema) {
399
- return new Builder({
278
+ return new ProcedureBuilder({
400
279
  ...this["~orpc"],
401
280
  outputSchema: schema,
402
281
  outputValidationIndex: this["~orpc"].middlewares.length
403
282
  });
404
283
  }
284
+ /**
285
+ * Uses a middleware to modify the context or improve the pipeline.
286
+ *
287
+ * @info Supports both normal middleware and inline middleware implementations.
288
+ * @note The current context must be satisfy middleware dependent-context
289
+ * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
290
+ */
291
+ use(middleware) {
292
+ return new this.constructor({
293
+ ...this["~orpc"],
294
+ middlewares: addMiddleware(this["~orpc"].middlewares, middleware)
295
+ });
296
+ }
297
+ useGating(gates, isGateEnabled) {
298
+ return this.use(({ next, context }) => {
299
+ return gatingContext.run(
300
+ (gate) => isGateEnabled(gate, context),
301
+ () => next({ context: { isGateEnabled } })
302
+ );
303
+ });
304
+ }
405
305
  /**
406
306
  * Defines the handler of the procedure.
407
307
  *
@@ -413,6 +313,8 @@ class Builder {
413
313
  handler
414
314
  });
415
315
  }
316
+ }
317
+ class BuilderWithMiddlewares extends ProcedureBuilder {
416
318
  /**
417
319
  * Prefixes all procedures in the router.
418
320
  * The provided prefix is post-appended to any existing router prefix.
@@ -422,7 +324,7 @@ class Builder {
422
324
  * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
423
325
  */
424
326
  prefix(prefix) {
425
- return new Builder({
327
+ return new this.constructor({
426
328
  ...this["~orpc"],
427
329
  prefix: mergePrefix(this["~orpc"].prefix, prefix)
428
330
  });
@@ -434,7 +336,7 @@ class Builder {
434
336
  * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
435
337
  */
436
338
  tag(...tags) {
437
- return new Builder({
339
+ return new this.constructor({
438
340
  ...this["~orpc"],
439
341
  tags: mergeTags(this["~orpc"].tags, tags)
440
342
  });
@@ -454,18 +356,74 @@ class Builder {
454
356
  * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
455
357
  */
456
358
  lazyRoute(loader) {
457
- return enhanceRouter(lazy(loader), this["~orpc"]);
359
+ const lazied = lazy(loader);
360
+ return enhanceRouter(lazied, this["~orpc"]);
361
+ }
362
+ }
363
+
364
+ function decorateMiddleware(middleware) {
365
+ const decorated = ((...args) => middleware(...args));
366
+ decorated.mapInput = (mapInput) => {
367
+ const mapped = decorateMiddleware(
368
+ (options, input, ...rest) => middleware(options, mapInput(input), ...rest)
369
+ );
370
+ return mapped;
371
+ };
372
+ decorated.concat = (concatMiddleware, mapInput) => {
373
+ const mapped = mapInput ? decorateMiddleware(concatMiddleware).mapInput(mapInput) : concatMiddleware;
374
+ const concatted = decorateMiddleware((options, input, output, ...rest) => {
375
+ const merged = middleware(
376
+ {
377
+ ...options,
378
+ next: (...[nextOptions1]) => mapped(
379
+ {
380
+ ...options,
381
+ context: { ...options.context, ...nextOptions1?.context },
382
+ next: (...[nextOptions2]) => options.next({ context: { ...nextOptions1?.context, ...nextOptions2?.context } })
383
+ },
384
+ input,
385
+ output,
386
+ ...rest
387
+ )
388
+ },
389
+ input,
390
+ output,
391
+ ...rest
392
+ );
393
+ return merged;
394
+ });
395
+ return concatted;
396
+ };
397
+ return decorated;
398
+ }
399
+
400
+ class Builder extends BuilderWithMiddlewares {
401
+ /**
402
+ * Set or override the initial context.
403
+ *
404
+ * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
405
+ */
406
+ $context() {
407
+ return this;
408
+ }
409
+ /**
410
+ * Creates a middleware.
411
+ *
412
+ * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
413
+ */
414
+ middleware(middleware) {
415
+ return decorateMiddleware(middleware);
458
416
  }
459
417
  }
460
418
  function createApiBuilder(opts = {}) {
461
- const base = new Builder({
419
+ return new Builder({
462
420
  route: {},
463
421
  meta: opts.meta ?? {},
464
422
  errorMap: {},
465
423
  inputValidationIndex: 0,
466
424
  outputValidationIndex: 0,
467
425
  middlewares: [
468
- onError((error, options) => {
426
+ onError((error, _options) => {
469
427
  console.dir(error, { depth: null });
470
428
  })
471
429
  ],
@@ -473,7 +431,6 @@ function createApiBuilder(opts = {}) {
473
431
  // the best solution). For now I've removed the interface to configure it externally.
474
432
  dedupeLeadingMiddlewares: true
475
433
  });
476
- return base;
477
434
  }
478
435
  const os = createApiBuilder();
479
436
 
@@ -614,4 +571,4 @@ function createRouterClient(router, ...rest) {
614
571
  return recursive;
615
572
  }
616
573
 
617
- export { Builder, DecoratedProcedure, Procedure, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createProcedureClient, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getLazyMeta, getRouter, implement, implementerInternal, isLazy, isProcedure, isStartWithMiddlewares, lazy, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazy, unlazyRouter };
574
+ export { Builder, BuilderWithMiddlewares, DecoratedProcedure, Procedure, ProcedureBuilder, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createProcedureClient, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getLazyMeta, getRouter, implement, implementerInternal, isLazy, isProcedure, isStartWithMiddlewares, lazy, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazy, unlazyRouter };
@@ -122,7 +122,6 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
122
122
  */
123
123
  declare class OpenAPIGenerator {
124
124
  #private;
125
- private readonly serializer;
126
125
  private readonly converter;
127
126
  constructor(options?: OpenAPIGeneratorOptions);
128
127
  /**
@@ -122,7 +122,6 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
122
122
  */
123
123
  declare class OpenAPIGenerator {
124
124
  #private;
125
- private readonly serializer;
126
125
  private readonly converter;
127
126
  constructor(options?: OpenAPIGeneratorOptions);
128
127
  /**
@@ -1,7 +1,7 @@
1
1
  import { isProcedure, resolveContractProcedures, ORPCError, createRouterClient } from '@temporary-name/server';
2
2
  import { fallbackContractConfig, getEventIteratorSchemaDetails } from '@temporary-name/contract';
3
3
  import { isObject, stringifyJSON, findDeepMatches, toArray, clone, value, toHttpPath, isORPCErrorStatus, fallbackORPCErrorStatus, fallbackORPCErrorMessage, resolveMaybeOptionalOptions, createORPCErrorFromJson } from '@temporary-name/shared';
4
- import { s as standardizeHTTPPath, b as StandardOpenAPIJsonSerializer, g as getDynamicParams, a as StandardOpenAPISerializer, S as StandardBracketNotationSerializer } from '../shared/server.DhdDYN-Z.mjs';
4
+ import { a as standardizeHTTPPath, j as jsonSerialize, g as getDynamicParams, d as deserialize, s as serialize } from '../shared/server.BEHw7Eyx.mjs';
5
5
  import '@temporary-name/standard-server';
6
6
  import { TypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
7
7
  export { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
@@ -380,10 +380,8 @@ class CompositeSchemaConverter {
380
380
  class OpenAPIGeneratorError extends Error {
381
381
  }
382
382
  class OpenAPIGenerator {
383
- serializer;
384
383
  converter;
385
384
  constructor(options = {}) {
386
- this.serializer = new StandardOpenAPIJsonSerializer();
387
385
  this.converter = new CompositeSchemaConverter(toArray(options.schemaConverters));
388
386
  }
389
387
  /**
@@ -464,7 +462,7 @@ ${e.message}`
464
462
  ${errors.join("\n\n")}`
465
463
  );
466
464
  }
467
- return this.serializer.serialize(doc)[0];
465
+ return jsonSerialize(doc)[0];
468
466
  }
469
467
  async #resolveCommonSchemas(doc, commonSchemas) {
470
468
  let undefinedErrorJsonSchema = {
@@ -757,19 +755,13 @@ ${errors.join("\n\n")}`
757
755
 
758
756
  function createJsonifiedRouterClient(router, ...rest) {
759
757
  const options = resolveMaybeOptionalOptions(rest);
760
- const serializer = new StandardOpenAPISerializer(
761
- new StandardOpenAPIJsonSerializer(),
762
- new StandardBracketNotationSerializer()
763
- );
764
758
  options.interceptors ??= [];
765
759
  options.interceptors.unshift(async (options2) => {
766
760
  try {
767
- return serializer.deserialize(serializer.serialize(await options2.next()));
761
+ return deserialize(serialize(await options2.next()));
768
762
  } catch (e) {
769
763
  if (e instanceof ORPCError) {
770
- throw createORPCErrorFromJson(
771
- serializer.deserialize(serializer.serialize(e.toJSON(), { outputFormat: "plain" }))
772
- );
764
+ throw createORPCErrorFromJson(deserialize(serialize(e.toJSON(), { outputFormat: "plain" })));
773
765
  }
774
766
  throw e;
775
767
  }
@@ -1,8 +1,8 @@
1
1
  import { Value, Promisable, ORPCError } from '@temporary-name/shared';
2
2
  import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
3
3
  import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
4
- import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.C1fnTLq0.mjs';
5
- import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.BKSOrA6h.mjs';
4
+ import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.YXplw8TW.mjs';
5
+ import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.CZNLCQBm.mjs';
6
6
  import { Meta } from '@temporary-name/contract';
7
7
 
8
8
  interface BatchHandlerOptions<T extends Context> {
@@ -1,8 +1,8 @@
1
1
  import { Value, Promisable, ORPCError } from '@temporary-name/shared';
2
2
  import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
3
3
  import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
4
- import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.CQyYNJ1H.js';
5
- import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.BKSOrA6h.js';
4
+ import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.B15EEOr0.js';
5
+ import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.CZNLCQBm.js';
6
6
  import { Meta } from '@temporary-name/contract';
7
7
 
8
8
  interface BatchHandlerOptions<T extends Context> {
@@ -1,6 +1,6 @@
1
1
  import { HTTPPath } from '@temporary-name/shared';
2
- import { C as Context } from './server.BKSOrA6h.js';
3
- import { c as StandardHandleOptions } from './server.CQyYNJ1H.js';
2
+ import { C as Context } from './server.CZNLCQBm.js';
3
+ import { c as StandardHandleOptions } from './server.B15EEOr0.js';
4
4
 
5
5
  type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
6
  context?: T;
@@ -1,7 +1,7 @@
1
1
  import { Meta } from '@temporary-name/contract';
2
2
  import { HTTPPath, Interceptor } from '@temporary-name/shared';
3
3
  import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
4
- import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.BKSOrA6h.js';
4
+ import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.CZNLCQBm.js';
5
5
 
6
6
  interface StandardHandlerPlugin<T extends Context> {
7
7
  order?: number;
@@ -1,14 +1,13 @@
1
1
  import { isObject, stringifyJSON, isORPCErrorStatus, tryDecodeURIComponent, value, toHttpPath, toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, ORPCError, toORPCError } from '@temporary-name/shared';
2
2
  import { flattenHeader } from '@temporary-name/standard-server';
3
- import { c as createProcedureClient } from './server.BKh8I1Ny.mjs';
4
- import { s as standardizeHTTPPath, S as StandardBracketNotationSerializer, a as StandardOpenAPISerializer, b as StandardOpenAPIJsonSerializer } from './server.DhdDYN-Z.mjs';
3
+ import { c as createProcedureClient } from './server.DcfsPloY.mjs';
5
4
  import { fallbackContractConfig } from '@temporary-name/contract';
5
+ import { d as deserialize, s as serialize, a as standardizeHTTPPath } from './server.BEHw7Eyx.mjs';
6
6
  import { traverseContractProcedures, isProcedure, getLazyMeta, unlazy, getRouter, createContractedProcedure } from '@temporary-name/server';
7
7
  import { createRouter, addRoute, findRoute } from 'rou3';
8
8
 
9
9
  class StandardOpenAPICodec {
10
- constructor(serializer) {
11
- this.serializer = serializer;
10
+ constructor() {
12
11
  }
13
12
  async decode(request, params, procedure) {
14
13
  const inputStructure = fallbackContractConfig(
@@ -16,7 +15,7 @@ class StandardOpenAPICodec {
16
15
  procedure["~orpc"].route.inputStructure
17
16
  );
18
17
  if (inputStructure === "compact") {
19
- const data = request.method === "GET" ? this.serializer.deserialize(request.url.searchParams) : this.serializer.deserialize(await request.body());
18
+ const data = request.method === "GET" ? deserialize(request.url.searchParams) : deserialize(await request.body());
20
19
  if (data === void 0) {
21
20
  return params;
22
21
  }
@@ -29,7 +28,7 @@ class StandardOpenAPICodec {
29
28
  return data;
30
29
  }
31
30
  const deserializeSearchParams = () => {
32
- return this.serializer.deserialize(request.url.searchParams);
31
+ return deserialize(request.url.searchParams);
33
32
  };
34
33
  return {
35
34
  params,
@@ -42,7 +41,7 @@ class StandardOpenAPICodec {
42
41
  Object.defineProperty(this, "query", { value, writable: true });
43
42
  },
44
43
  headers: request.headers,
45
- body: this.serializer.deserialize(await request.body())
44
+ body: deserialize(await request.body())
46
45
  };
47
46
  }
48
47
  encode(output, procedure) {
@@ -58,7 +57,7 @@ class StandardOpenAPICodec {
58
57
  return {
59
58
  status: successStatus,
60
59
  headers: {},
61
- body: this.serializer.serialize(output)
60
+ body: serialize(output)
62
61
  };
63
62
  }
64
63
  if (!this.#isDetailedOutput(output)) {
@@ -77,14 +76,14 @@ class StandardOpenAPICodec {
77
76
  return {
78
77
  status: output.status ?? successStatus,
79
78
  headers: output.headers ?? {},
80
- body: this.serializer.serialize(output.body)
79
+ body: serialize(output.body)
81
80
  };
82
81
  }
83
82
  encodeError(error) {
84
83
  return {
85
84
  status: error.status,
86
85
  headers: {},
87
- body: this.serializer.serialize(error.toJSON(), { outputFormat: "plain" })
86
+ body: serialize(error.toJSON(), { outputFormat: "plain" })
88
87
  };
89
88
  }
90
89
  #isDetailedOutput(output) {
@@ -207,11 +206,8 @@ class StandardHandler {
207
206
  matcher;
208
207
  codec;
209
208
  constructor(router, options) {
210
- const jsonSerializer = new StandardOpenAPIJsonSerializer();
211
- const bracketNotationSerializer = new StandardBracketNotationSerializer();
212
- const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
213
209
  this.matcher = new StandardOpenAPIMatcher();
214
- this.codec = new StandardOpenAPICodec(serializer);
210
+ this.codec = new StandardOpenAPICodec();
215
211
  const plugins = new CompositeStandardHandlerPlugin(options.plugins);
216
212
  plugins.init(options, router);
217
213
  this.interceptors = toArray(options.interceptors);