@orpc/nest 2.0.0-beta.25 → 2.0.0-beta.26

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 (2) hide show
  1. package/dist/index.mjs +18 -13
  2. package/package.json +7 -6
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { getOpenAPIMeta, DEFAULT_OPENAPI_METHOD, getDynamicPathParams } from '@o
6
6
  import { OpenAPIHandlerCodecCore } from '@orpc/openapi/standard';
7
7
  import { unlazy, Procedure, DEFAULT_SUCCESS_STATUS, getRouter } from '@orpc/server';
8
8
  import { StandardHandler } from '@orpc/server/standard';
9
- import { value, isAsyncIteratorObject, stringifyJSON, mergeHttpPath } from '@orpc/shared';
9
+ import { value, isAsyncIteratorObject, stringifyJSON, mergeHttpPath, NullProtoObj } from '@orpc/shared';
10
10
  import { flattenStandardHeader, generateContentDisposition } from '@standardserver/core';
11
11
  import { toStandardLazyRequest, toEventStream } from '@standardserver/node';
12
12
  import { mergeMap } from 'rxjs';
@@ -260,21 +260,26 @@ function flattenParamValue(value2) {
260
260
  }
261
261
  function toORPCOpenAPIParams(contract, params) {
262
262
  const meta = getOpenAPIMeta(contract);
263
- if (!params || meta?.path === void 0) {
263
+ if (!params || meta?.path === void 0 || Object.keys(params).length === 0) {
264
264
  return void 0;
265
265
  }
266
- const dynamicParams = getDynamicPathParams(meta.prefix ? mergeHttpPath(meta.prefix, meta.path) : meta.path);
267
- if (!dynamicParams) {
268
- return void 0;
269
- }
270
- return dynamicParams.reduce((acc, config) => {
271
- const value2 = config.allowsSlash ? flattenParamValue(params?.["*"] ?? params?.path) : flattenParamValue(params?.[config.parameterName]);
272
- if (value2 === void 0) {
273
- return acc;
266
+ const orpcParams = new NullProtoObj();
267
+ const restKey = Object.hasOwn(params, "*") ? "*" : "path";
268
+ for (const [key, value2] of Object.entries(params)) {
269
+ if (key === restKey) {
270
+ const restParams = getDynamicPathParams(
271
+ meta.prefix ? mergeHttpPath(meta.prefix, meta.path) : meta.path
272
+ )?.filter((c) => c.allowsSlash);
273
+ if (restParams?.length) {
274
+ for (const c of restParams) {
275
+ orpcParams[c.parameterName] = flattenParamValue(value2);
276
+ }
277
+ continue;
278
+ }
274
279
  }
275
- acc[config.parameterName] = value2;
276
- return acc;
277
- }, {});
280
+ orpcParams[key] = flattenParamValue(value2);
281
+ }
282
+ return orpcParams;
278
283
  }
279
284
  function toNestPattern(path) {
280
285
  const params = getDynamicPathParams(path);
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@orpc/nest",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.25",
4
+ "version": "2.0.0-beta.26",
5
5
  "license": "MIT",
6
+ "funding": "https://github.com/sponsors/dinwwwh",
6
7
  "homepage": "https://orpc.dev",
7
8
  "repository": {
8
9
  "type": "git",
@@ -39,11 +40,11 @@
39
40
  "dependencies": {
40
41
  "@standardserver/core": "^0.7.1",
41
42
  "@standardserver/node": "^0.7.1",
42
- "@orpc/client": "2.0.0-beta.25",
43
- "@orpc/contract": "2.0.0-beta.25",
44
- "@orpc/openapi": "2.0.0-beta.25",
45
- "@orpc/server": "2.0.0-beta.25",
46
- "@orpc/shared": "2.0.0-beta.25"
43
+ "@orpc/client": "2.0.0-beta.26",
44
+ "@orpc/contract": "2.0.0-beta.26",
45
+ "@orpc/openapi": "2.0.0-beta.26",
46
+ "@orpc/server": "2.0.0-beta.26",
47
+ "@orpc/shared": "2.0.0-beta.26"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@fastify/cookie": "^11.0.2",