@orpc/server 1.8.8 → 1.9.0

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.
@@ -5,11 +5,11 @@ import '@orpc/standard-server';
5
5
  import '@orpc/standard-server/batch';
6
6
  import '@orpc/standard-server-fetch';
7
7
  import '@orpc/client';
8
- import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
8
+ import { S as StrictGetMethodPlugin } from '../../shared/server.TEVCLCFC.mjs';
9
9
  import '@orpc/contract';
10
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
10
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
11
11
  import '@orpc/client/standard';
12
- import '../../shared/server.CaqDCZX1.mjs';
12
+ import '../../shared/server.Ds4HPpvH.mjs';
13
13
 
14
14
  class AwsLambdaHandler {
15
15
  constructor(standardHandler, options = {}) {
@@ -4,10 +4,10 @@ import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOW
4
4
  import '@orpc/client';
5
5
  import '@orpc/standard-server';
6
6
  import '@orpc/contract';
7
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
7
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
8
8
  import '@orpc/client/standard';
9
9
  import '../../shared/server.DZ5BIITo.mjs';
10
- import '../../shared/server.CaqDCZX1.mjs';
10
+ import '../../shared/server.Ds4HPpvH.mjs';
11
11
 
12
12
  class BunWsHandler {
13
13
  constructor(standardHandler) {
@@ -4,10 +4,10 @@ import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOW
4
4
  import '@orpc/client';
5
5
  import '@orpc/standard-server';
6
6
  import '@orpc/contract';
7
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
7
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
8
8
  import '@orpc/client/standard';
9
9
  import '../../shared/server.DZ5BIITo.mjs';
10
- import '../../shared/server.CaqDCZX1.mjs';
10
+ import '../../shared/server.Ds4HPpvH.mjs';
11
11
 
12
12
  class experimental_CrosswsHandler {
13
13
  constructor(standardHandler) {
@@ -4,11 +4,11 @@ import { toStandardLazyRequest, toFetchResponse } from '@orpc/standard-server-fe
4
4
  import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
5
5
  import '@orpc/standard-server';
6
6
  import '@orpc/contract';
7
- import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
7
+ import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
8
8
  import '@orpc/client/standard';
9
9
  import '@orpc/standard-server/batch';
10
- import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
11
- import '../../shared/server.CaqDCZX1.mjs';
10
+ import { S as StrictGetMethodPlugin } from '../../shared/server.TEVCLCFC.mjs';
11
+ import '../../shared/server.Ds4HPpvH.mjs';
12
12
 
13
13
  class BodyLimitPlugin {
14
14
  maxBodySize;
@@ -5,10 +5,10 @@ import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOW
5
5
  import '@orpc/client';
6
6
  import '@orpc/standard-server';
7
7
  import '@orpc/contract';
8
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
8
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
9
9
  import '@orpc/client/standard';
10
10
  import '../../shared/server.DZ5BIITo.mjs';
11
- import '../../shared/server.CaqDCZX1.mjs';
11
+ import '../../shared/server.Ds4HPpvH.mjs';
12
12
 
13
13
  class MessagePortHandler {
14
14
  constructor(standardHandler) {
@@ -5,12 +5,12 @@ import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-serv
5
5
  import { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
6
6
  import '@orpc/standard-server';
7
7
  import '@orpc/contract';
8
- import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
8
+ import { C as CompositeStandardHandlerPlugin, b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
9
9
  import '@orpc/client/standard';
10
10
  import '@orpc/standard-server/batch';
11
11
  import '@orpc/standard-server-fetch';
12
- import { S as StrictGetMethodPlugin } from '../../shared/server.BW-nUGgA.mjs';
13
- import '../../shared/server.CaqDCZX1.mjs';
12
+ import { S as StrictGetMethodPlugin } from '../../shared/server.TEVCLCFC.mjs';
13
+ import '../../shared/server.Ds4HPpvH.mjs';
14
14
 
15
15
  class BodyLimitPlugin {
16
16
  maxBodySize;
@@ -1,8 +1,8 @@
1
- export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.vzZSq5UM.mjs';
1
+ export { C as CompositeStandardHandlerPlugin, S as StandardHandler, a as StandardRPCCodec, b as StandardRPCHandler, c as StandardRPCMatcher } from '../../shared/server.Bxx6tqNe.mjs';
2
2
  export { r as resolveFriendlyStandardHandleOptions } from '../../shared/server.DZ5BIITo.mjs';
3
3
  import '@orpc/client/standard';
4
4
  import '@orpc/client';
5
5
  import '@orpc/shared';
6
6
  import '@orpc/standard-server';
7
- import '../../shared/server.CaqDCZX1.mjs';
7
+ import '../../shared/server.Ds4HPpvH.mjs';
8
8
  import '@orpc/contract';
@@ -40,6 +40,8 @@ declare class WebsocketHandler<T extends Context> {
40
40
  close(ws: MinimalWebsocket): void;
41
41
  }
42
42
 
43
+ interface RPCHandlerOptions<T extends Context> extends StandardRPCHandlerOptions<T> {
44
+ }
43
45
  /**
44
46
  * RPC Handler for Websocket adapter
45
47
  *
@@ -47,8 +49,8 @@ declare class WebsocketHandler<T extends Context> {
47
49
  * @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
48
50
  */
49
51
  declare class RPCHandler<T extends Context> extends WebsocketHandler<T> {
50
- constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
52
+ constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
51
53
  }
52
54
 
53
55
  export { RPCHandler, WebsocketHandler };
54
- export type { MinimalWebsocket };
56
+ export type { MinimalWebsocket, RPCHandlerOptions };
@@ -40,6 +40,8 @@ declare class WebsocketHandler<T extends Context> {
40
40
  close(ws: MinimalWebsocket): void;
41
41
  }
42
42
 
43
+ interface RPCHandlerOptions<T extends Context> extends StandardRPCHandlerOptions<T> {
44
+ }
43
45
  /**
44
46
  * RPC Handler for Websocket adapter
45
47
  *
@@ -47,8 +49,8 @@ declare class WebsocketHandler<T extends Context> {
47
49
  * @see {@link https://orpc.unnoq.com/docs/adapters/websocket Websocket Adapter Docs}
48
50
  */
49
51
  declare class RPCHandler<T extends Context> extends WebsocketHandler<T> {
50
- constructor(router: Router<any, T>, options?: NoInfer<StandardRPCHandlerOptions<T>>);
52
+ constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>);
51
53
  }
52
54
 
53
55
  export { RPCHandler, WebsocketHandler };
54
- export type { MinimalWebsocket };
56
+ export type { MinimalWebsocket, RPCHandlerOptions };
@@ -4,10 +4,10 @@ import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOW
4
4
  import '@orpc/client';
5
5
  import '@orpc/standard-server';
6
6
  import '@orpc/contract';
7
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
7
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
8
8
  import '@orpc/client/standard';
9
9
  import '../../shared/server.DZ5BIITo.mjs';
10
- import '../../shared/server.CaqDCZX1.mjs';
10
+ import '../../shared/server.Ds4HPpvH.mjs';
11
11
 
12
12
  class WebsocketHandler {
13
13
  #peers = /* @__PURE__ */ new WeakMap();
@@ -4,10 +4,10 @@ import { c as createServerPeerHandleRequestFn } from '../../shared/server.UVMTOW
4
4
  import '@orpc/client';
5
5
  import '@orpc/standard-server';
6
6
  import '@orpc/contract';
7
- import { b as StandardRPCHandler } from '../../shared/server.vzZSq5UM.mjs';
7
+ import { b as StandardRPCHandler } from '../../shared/server.Bxx6tqNe.mjs';
8
8
  import '@orpc/client/standard';
9
9
  import '../../shared/server.DZ5BIITo.mjs';
10
- import '../../shared/server.CaqDCZX1.mjs';
10
+ import '../../shared/server.Ds4HPpvH.mjs';
11
11
 
12
12
  class WsHandler {
13
13
  constructor(standardHandler) {
@@ -129,6 +129,21 @@ declare function sign(value: string, secret: string): Promise<string>;
129
129
  * ```
130
130
  */
131
131
  declare function unsign(signedValue: string | undefined | null, secret: string): Promise<string | undefined>;
132
+ /**
133
+ * Extracts the value part from a signed string without verification.
134
+ *
135
+ * This function simply extracts the original value from a signed string
136
+ * without performing any signature verification. It's useful when you need
137
+ * to access the value quickly without the overhead of cryptographic verification.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const signedValue = "user123.oneQsU0r5dvwQFHFEjjV1uOI_IR3gZfkYHij3TRauVA"
142
+ * const value = getSignedValue(signedValue)
143
+ * expect(value).toEqual("user123")
144
+ * ```
145
+ */
146
+ declare function getSignedValue(signedValue: string | undefined | null): string | undefined;
132
147
 
133
- export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
148
+ export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
134
149
  export type { GetCookieOptions, SetCookieOptions };
@@ -129,6 +129,21 @@ declare function sign(value: string, secret: string): Promise<string>;
129
129
  * ```
130
130
  */
131
131
  declare function unsign(signedValue: string | undefined | null, secret: string): Promise<string | undefined>;
132
+ /**
133
+ * Extracts the value part from a signed string without verification.
134
+ *
135
+ * This function simply extracts the original value from a signed string
136
+ * without performing any signature verification. It's useful when you need
137
+ * to access the value quickly without the overhead of cryptographic verification.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const signedValue = "user123.oneQsU0r5dvwQFHFEjjV1uOI_IR3gZfkYHij3TRauVA"
142
+ * const value = getSignedValue(signedValue)
143
+ * expect(value).toEqual("user123")
144
+ * ```
145
+ */
146
+ declare function getSignedValue(signedValue: string | undefined | null): string | undefined;
132
147
 
133
- export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
148
+ export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
134
149
  export type { GetCookieOptions, SetCookieOptions };
@@ -184,5 +184,15 @@ async function unsign(signedValue, secret) {
184
184
  );
185
185
  return isValid ? value : void 0;
186
186
  }
187
+ function getSignedValue(signedValue) {
188
+ if (typeof signedValue !== "string") {
189
+ return void 0;
190
+ }
191
+ const lastDotIndex = signedValue.lastIndexOf(".");
192
+ if (lastDotIndex === -1) {
193
+ return void 0;
194
+ }
195
+ return signedValue.slice(0, lastDotIndex);
196
+ }
187
197
 
188
- export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, setCookie, sign, unsign };
198
+ export { decodeBase64url, decrypt, deleteCookie, encodeBase64url, encrypt, getCookie, getSignedValue, setCookie, sign, unsign };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
2
2
  export { ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
3
- import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.CaqDCZX1.mjs';
4
- export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, v as resolveContractProcedures, t as traverseContractProcedures, w as unlazyRouter } from './shared/server.CaqDCZX1.mjs';
3
+ import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.Ds4HPpvH.mjs';
4
+ export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, v as resolveContractProcedures, t as traverseContractProcedures, w as unlazyRouter } from './shared/server.Ds4HPpvH.mjs';
5
5
  import { toORPCError } from '@orpc/client';
6
6
  export { ORPCError, isDefinedError, safe } from '@orpc/client';
7
7
  import { resolveMaybeOptionalOptions } from '@orpc/shared';
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
160
160
  */
161
161
  declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
162
162
  private readonly error;
163
+ /**
164
+ * make sure execute before batch plugin to get real method
165
+ */
163
166
  order: number;
164
167
  constructor(options?: StrictGetMethodPluginOptions);
165
168
  init(options: StandardHandlerOptions<T>): void;
@@ -160,6 +160,9 @@ interface StrictGetMethodPluginOptions {
160
160
  */
161
161
  declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
162
162
  private readonly error;
163
+ /**
164
+ * make sure execute before batch plugin to get real method
165
+ */
163
166
  order: number;
164
167
  constructor(options?: StrictGetMethodPluginOptions);
165
168
  init(options: StandardHandlerOptions<T>): void;
@@ -3,7 +3,7 @@ import { flattenHeader } from '@orpc/standard-server';
3
3
  import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
4
4
  import { toFetchHeaders } from '@orpc/standard-server-fetch';
5
5
  import { ORPCError } from '@orpc/client';
6
- export { S as StrictGetMethodPlugin } from '../shared/server.BW-nUGgA.mjs';
6
+ export { S as StrictGetMethodPlugin } from '../shared/server.TEVCLCFC.mjs';
7
7
  import '@orpc/contract';
8
8
 
9
9
  class BatchHandlerPlugin {
@@ -2,7 +2,7 @@ import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@o
2
2
  import { ORPCError, toORPCError } from '@orpc/client';
3
3
  import { toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, parseEmptyableJSON, NullProtoObj, value } from '@orpc/shared';
4
4
  import { flattenHeader } from '@orpc/standard-server';
5
- import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.CaqDCZX1.mjs';
5
+ import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.Ds4HPpvH.mjs';
6
6
 
7
7
  class CompositeStandardHandlerPlugin {
8
8
  plugins;
@@ -1,5 +1,5 @@
1
1
  import { isContractProcedure, validateORPCError, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
2
- import { resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, asyncIteratorWithSpan } from '@orpc/shared';
2
+ import { resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, overlayProxy, asyncIteratorWithSpan } from '@orpc/shared';
3
3
  import { ORPCError, mapEventIterator } from '@orpc/client';
4
4
  import { HibernationEventIterator } from '@orpc/standard-server';
5
5
 
@@ -132,7 +132,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
132
132
  if (output instanceof HibernationEventIterator) {
133
133
  return output;
134
134
  }
135
- return mapEventIterator(
135
+ return overlayProxy(output, mapEventIterator(
136
136
  asyncIteratorWithSpan(
137
137
  { name: "consume_event_iterator_output", signal: callerOptions?.signal },
138
138
  output
@@ -141,7 +141,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
141
141
  value: (v) => v,
142
142
  error: (e) => validateError(e)
143
143
  }
144
- );
144
+ ));
145
145
  }
146
146
  return output;
147
147
  } catch (e) {
@@ -3,6 +3,9 @@ import { ORPCError, fallbackContractConfig } from '@orpc/contract';
3
3
  const STRICT_GET_METHOD_PLUGIN_IS_GET_METHOD_CONTEXT_SYMBOL = Symbol("STRICT_GET_METHOD_PLUGIN_IS_GET_METHOD_CONTEXT");
4
4
  class StrictGetMethodPlugin {
5
5
  error;
6
+ /**
7
+ * make sure execute before batch plugin to get real method
8
+ */
6
9
  order = 7e6;
7
10
  constructor(options = {}) {
8
11
  this.error = options.error ?? new ORPCError("METHOD_NOT_SUPPORTED");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/server",
3
3
  "type": "module",
4
- "version": "1.8.8",
4
+ "version": "1.9.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -102,20 +102,20 @@
102
102
  },
103
103
  "dependencies": {
104
104
  "cookie": "^1.0.2",
105
- "@orpc/contract": "1.8.8",
106
- "@orpc/interop": "1.8.8",
107
- "@orpc/shared": "1.8.8",
108
- "@orpc/client": "1.8.8",
109
- "@orpc/standard-server": "1.8.8",
110
- "@orpc/standard-server-aws-lambda": "1.8.8",
111
- "@orpc/standard-server-fetch": "1.8.8",
112
- "@orpc/standard-server-node": "1.8.8",
113
- "@orpc/standard-server-peer": "1.8.8"
105
+ "@orpc/client": "1.9.0",
106
+ "@orpc/interop": "1.9.0",
107
+ "@orpc/contract": "1.9.0",
108
+ "@orpc/shared": "1.9.0",
109
+ "@orpc/standard-server": "1.9.0",
110
+ "@orpc/standard-server-node": "1.9.0",
111
+ "@orpc/standard-server-fetch": "1.9.0",
112
+ "@orpc/standard-server-aws-lambda": "1.9.0",
113
+ "@orpc/standard-server-peer": "1.9.0"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@types/ws": "^8.18.1",
117
117
  "crossws": "^0.4.1",
118
- "next": "^15.5.2",
118
+ "next": "^15.5.3",
119
119
  "supertest": "^7.1.4",
120
120
  "ws": "^8.18.3"
121
121
  },