@orpc/server 0.0.0-next.924a598 → 0.0.0-next.9257f5d

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 (71) hide show
  1. package/README.md +29 -23
  2. package/dist/adapters/aws-lambda/index.d.mts +46 -0
  3. package/dist/adapters/aws-lambda/index.d.ts +46 -0
  4. package/dist/adapters/aws-lambda/index.mjs +42 -0
  5. package/dist/adapters/bun-ws/index.d.mts +36 -0
  6. package/dist/adapters/bun-ws/index.d.ts +36 -0
  7. package/dist/adapters/bun-ws/index.mjs +47 -0
  8. package/dist/adapters/crossws/index.d.mts +33 -0
  9. package/dist/adapters/crossws/index.d.ts +33 -0
  10. package/dist/adapters/crossws/index.mjs +47 -0
  11. package/dist/adapters/fetch/index.d.mts +62 -11
  12. package/dist/adapters/fetch/index.d.ts +62 -11
  13. package/dist/adapters/fetch/index.mjs +109 -8
  14. package/dist/adapters/message-port/index.d.mts +31 -0
  15. package/dist/adapters/message-port/index.d.ts +31 -0
  16. package/dist/adapters/message-port/index.mjs +41 -0
  17. package/dist/adapters/node/index.d.mts +64 -22
  18. package/dist/adapters/node/index.d.ts +64 -22
  19. package/dist/adapters/node/index.mjs +88 -24
  20. package/dist/adapters/standard/index.d.mts +8 -13
  21. package/dist/adapters/standard/index.d.ts +8 -13
  22. package/dist/adapters/standard/index.mjs +5 -3
  23. package/dist/adapters/standard-peer/index.d.mts +14 -0
  24. package/dist/adapters/standard-peer/index.d.ts +14 -0
  25. package/dist/adapters/standard-peer/index.mjs +7 -0
  26. package/dist/adapters/websocket/index.d.mts +54 -0
  27. package/dist/adapters/websocket/index.d.ts +54 -0
  28. package/dist/adapters/websocket/index.mjs +69 -0
  29. package/dist/adapters/ws/index.d.mts +31 -0
  30. package/dist/adapters/ws/index.d.ts +31 -0
  31. package/dist/adapters/ws/index.mjs +39 -0
  32. package/dist/helpers/index.d.mts +134 -0
  33. package/dist/helpers/index.d.ts +134 -0
  34. package/dist/helpers/index.mjs +188 -0
  35. package/dist/hibernation/index.d.mts +44 -0
  36. package/dist/hibernation/index.d.ts +44 -0
  37. package/dist/hibernation/index.mjs +65 -0
  38. package/dist/index.d.mts +613 -88
  39. package/dist/index.d.ts +613 -88
  40. package/dist/index.mjs +162 -19
  41. package/dist/plugins/index.d.mts +154 -16
  42. package/dist/plugins/index.d.ts +154 -16
  43. package/dist/plugins/index.mjs +189 -16
  44. package/dist/shared/server.B7b2w3_i.d.ts +12 -0
  45. package/dist/shared/server.BEFBl-Cb.d.mts +12 -0
  46. package/dist/shared/server.BU4WI18A.d.mts +32 -0
  47. package/dist/shared/server.BW-nUGgA.mjs +36 -0
  48. package/dist/shared/server.Bmh5xd4n.d.ts +74 -0
  49. package/dist/shared/server.C6Q5sqYw.mjs +20 -0
  50. package/dist/shared/{server.DisswUB5.mjs → server.CIL9uKTN.mjs} +66 -30
  51. package/dist/shared/{server.DnmJuN02.d.mts → server.CYNGeoCm.d.mts} +66 -16
  52. package/dist/shared/{server.DnmJuN02.d.ts → server.CYNGeoCm.d.ts} +66 -16
  53. package/dist/shared/server.D0H-iaY3.d.ts +32 -0
  54. package/dist/shared/server.DZ5BIITo.mjs +9 -0
  55. package/dist/shared/server.DhJj-1X9.d.mts +42 -0
  56. package/dist/shared/{server.B_5ZADvP.mjs → server.NeumLVdS.mjs} +38 -31
  57. package/dist/shared/server.gqRxT-yN.d.mts +74 -0
  58. package/dist/shared/server.jMTkVNIb.d.ts +42 -0
  59. package/package.json +70 -20
  60. package/dist/adapters/hono/index.d.mts +0 -21
  61. package/dist/adapters/hono/index.d.ts +0 -21
  62. package/dist/adapters/hono/index.mjs +0 -32
  63. package/dist/adapters/next/index.d.mts +0 -28
  64. package/dist/adapters/next/index.d.ts +0 -28
  65. package/dist/adapters/next/index.mjs +0 -29
  66. package/dist/shared/server.BXfgvxK8.d.ts +0 -8
  67. package/dist/shared/server.D1vPuPwc.mjs +0 -29
  68. package/dist/shared/server.DKCNBSd-.d.mts +0 -8
  69. package/dist/shared/server.Dj89-yLZ.d.ts +0 -75
  70. package/dist/shared/server.DpIMjOfC.d.mts +0 -75
  71. package/dist/shared/server.Q6ZmnTgO.mjs +0 -12
@@ -1,75 +0,0 @@
1
- import { HTTPPath, AnySchema, Meta, InferSchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
2
- import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
3
- import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
4
- import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.DnmJuN02.js';
5
- import { ORPCError } from '@orpc/client';
6
-
7
- type StandardParams = Record<string, string>;
8
- type StandardMatchResult = {
9
- path: readonly string[];
10
- procedure: AnyProcedure;
11
- params?: StandardParams;
12
- } | undefined;
13
- interface StandardMatcher {
14
- init(router: AnyRouter): void;
15
- match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
16
- }
17
- interface StandardCodec {
18
- encode(output: unknown, procedure: AnyProcedure): StandardResponse;
19
- encodeError(error: ORPCError<any, any>): StandardResponse;
20
- decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
21
- }
22
-
23
- type StandardHandleOptions<T extends Context> = {
24
- prefix?: HTTPPath;
25
- } & (Record<never, never> extends T ? {
26
- context?: T;
27
- } : {
28
- context: T;
29
- });
30
- type StandardHandleResult = {
31
- matched: true;
32
- response: StandardResponse;
33
- } | {
34
- matched: false;
35
- response: undefined;
36
- };
37
- type StandardHandlerInterceptorOptions<T extends Context> = StandardHandleOptions<T> & {
38
- context: T;
39
- request: StandardLazyRequest;
40
- };
41
- interface StandardHandlerOptions<TContext extends Context> {
42
- plugins?: HandlerPlugin<TContext>[];
43
- /**
44
- * Interceptors at the request level, helpful when you want catch errors
45
- */
46
- interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
47
- /**
48
- * Interceptors at the root level, helpful when you want override the request/response
49
- */
50
- rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
51
- /**
52
- *
53
- * Interceptors for procedure client.
54
- */
55
- clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, AnySchema, Record<never, never>, Meta>, InferSchemaOutput<AnySchema>, ErrorFromErrorMap<Record<never, never>>>[];
56
- }
57
- declare class StandardHandler<T extends Context> {
58
- private readonly matcher;
59
- private readonly codec;
60
- private readonly options;
61
- private readonly plugin;
62
- constructor(router: Router<any, T>, matcher: StandardMatcher, codec: StandardCodec, options: NoInfer<StandardHandlerOptions<T>>);
63
- handle(request: StandardLazyRequest, ...[options]: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<StandardHandleResult>;
64
- }
65
-
66
- interface HandlerPlugin<TContext extends Context> {
67
- init?(options: StandardHandlerOptions<TContext>): void;
68
- }
69
- declare class CompositePlugin<TContext extends Context> implements HandlerPlugin<TContext> {
70
- private readonly plugins;
71
- constructor(plugins?: HandlerPlugin<TContext>[]);
72
- init(options: StandardHandlerOptions<TContext>): void;
73
- }
74
-
75
- export { CompositePlugin as C, type HandlerPlugin as H, type StandardHandleOptions as S, type StandardHandlerOptions as a, type StandardHandlerInterceptorOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
@@ -1,75 +0,0 @@
1
- import { HTTPPath, AnySchema, Meta, InferSchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
2
- import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
3
- import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
4
- import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.DnmJuN02.mjs';
5
- import { ORPCError } from '@orpc/client';
6
-
7
- type StandardParams = Record<string, string>;
8
- type StandardMatchResult = {
9
- path: readonly string[];
10
- procedure: AnyProcedure;
11
- params?: StandardParams;
12
- } | undefined;
13
- interface StandardMatcher {
14
- init(router: AnyRouter): void;
15
- match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
16
- }
17
- interface StandardCodec {
18
- encode(output: unknown, procedure: AnyProcedure): StandardResponse;
19
- encodeError(error: ORPCError<any, any>): StandardResponse;
20
- decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
21
- }
22
-
23
- type StandardHandleOptions<T extends Context> = {
24
- prefix?: HTTPPath;
25
- } & (Record<never, never> extends T ? {
26
- context?: T;
27
- } : {
28
- context: T;
29
- });
30
- type StandardHandleResult = {
31
- matched: true;
32
- response: StandardResponse;
33
- } | {
34
- matched: false;
35
- response: undefined;
36
- };
37
- type StandardHandlerInterceptorOptions<T extends Context> = StandardHandleOptions<T> & {
38
- context: T;
39
- request: StandardLazyRequest;
40
- };
41
- interface StandardHandlerOptions<TContext extends Context> {
42
- plugins?: HandlerPlugin<TContext>[];
43
- /**
44
- * Interceptors at the request level, helpful when you want catch errors
45
- */
46
- interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
47
- /**
48
- * Interceptors at the root level, helpful when you want override the request/response
49
- */
50
- rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
51
- /**
52
- *
53
- * Interceptors for procedure client.
54
- */
55
- clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, AnySchema, Record<never, never>, Meta>, InferSchemaOutput<AnySchema>, ErrorFromErrorMap<Record<never, never>>>[];
56
- }
57
- declare class StandardHandler<T extends Context> {
58
- private readonly matcher;
59
- private readonly codec;
60
- private readonly options;
61
- private readonly plugin;
62
- constructor(router: Router<any, T>, matcher: StandardMatcher, codec: StandardCodec, options: NoInfer<StandardHandlerOptions<T>>);
63
- handle(request: StandardLazyRequest, ...[options]: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<StandardHandleResult>;
64
- }
65
-
66
- interface HandlerPlugin<TContext extends Context> {
67
- init?(options: StandardHandlerOptions<TContext>): void;
68
- }
69
- declare class CompositePlugin<TContext extends Context> implements HandlerPlugin<TContext> {
70
- private readonly plugins;
71
- constructor(plugins?: HandlerPlugin<TContext>[]);
72
- init(options: StandardHandlerOptions<TContext>): void;
73
- }
74
-
75
- export { CompositePlugin as C, type HandlerPlugin as H, type StandardHandleOptions as S, type StandardHandlerOptions as a, type StandardHandlerInterceptorOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
@@ -1,12 +0,0 @@
1
- class CompositePlugin {
2
- constructor(plugins = []) {
3
- this.plugins = plugins;
4
- }
5
- init(options) {
6
- for (const plugin of this.plugins) {
7
- plugin.init?.(options);
8
- }
9
- }
10
- }
11
-
12
- export { CompositePlugin as C };