@trpc/server 9.26.0 → 9.26.1

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.
@@ -73,10 +73,30 @@ function getHTTPMethod(event) {
73
73
 
74
74
  function getPath(event) {
75
75
  if (isPayloadV1(event)) {
76
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
77
+
78
+ for (const match of matches) {
79
+ const group = match[1];
80
+
81
+ if (group.includes('+') && event.pathParameters) {
82
+ return event.pathParameters[group.replace('+', '')] || '';
83
+ }
84
+ }
85
+
76
86
  return event.path.slice(1);
77
87
  }
78
88
 
79
89
  if (isPayloadV2(event)) {
90
+ const matches = event.routeKey.matchAll(/\{(.*?)\}/g);
91
+
92
+ for (const match of matches) {
93
+ const group = match[1];
94
+
95
+ if (group.includes('+') && event.pathParameters) {
96
+ return event.pathParameters[group.replace('+', '')] || '';
97
+ }
98
+ }
99
+
80
100
  return event.rawPath.slice(1);
81
101
  }
82
102
 
@@ -73,10 +73,30 @@ function getHTTPMethod(event) {
73
73
 
74
74
  function getPath(event) {
75
75
  if (isPayloadV1(event)) {
76
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
77
+
78
+ for (const match of matches) {
79
+ const group = match[1];
80
+
81
+ if (group.includes('+') && event.pathParameters) {
82
+ return event.pathParameters[group.replace('+', '')] || '';
83
+ }
84
+ }
85
+
76
86
  return event.path.slice(1);
77
87
  }
78
88
 
79
89
  if (isPayloadV2(event)) {
90
+ const matches = event.routeKey.matchAll(/\{(.*?)\}/g);
91
+
92
+ for (const match of matches) {
93
+ const group = match[1];
94
+
95
+ if (group.includes('+') && event.pathParameters) {
96
+ return event.pathParameters[group.replace('+', '')] || '';
97
+ }
98
+ }
99
+
80
100
  return event.rawPath.slice(1);
81
101
  }
82
102
 
@@ -69,10 +69,30 @@ function getHTTPMethod(event) {
69
69
 
70
70
  function getPath(event) {
71
71
  if (isPayloadV1(event)) {
72
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
73
+
74
+ for (const match of matches) {
75
+ const group = match[1];
76
+
77
+ if (group.includes('+') && event.pathParameters) {
78
+ return event.pathParameters[group.replace('+', '')] || '';
79
+ }
80
+ }
81
+
72
82
  return event.path.slice(1);
73
83
  }
74
84
 
75
85
  if (isPayloadV2(event)) {
86
+ const matches = event.routeKey.matchAll(/\{(.*?)\}/g);
87
+
88
+ for (const match of matches) {
89
+ const group = match[1];
90
+
91
+ if (group.includes('+') && event.pathParameters) {
92
+ return event.pathParameters[group.replace('+', '')] || '';
93
+ }
94
+ }
95
+
76
96
  return event.rawPath.slice(1);
77
97
  }
78
98
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"../../../../../src/adapters/aws-lambda","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,IAAI,YAAY,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,eAAe,EAEf,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAiF/E;;IAEI;AACJ,aAAK,eAAe,CAClB,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,IAC5B,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,eAAe,CAAC,SAAS,WAAW,CACxE,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,eAAe,CAAC,CACnD,GACG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAC1E,eAAe,CAAC;AAEpB;;IAEI;AACJ,aAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,GACrD,qBAA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C,GACjC,KAAK,CAAC;AACV,wBAAgB,uBAAuB,CACrC,OAAO,SAAS,SAAS,EACzB,MAAM,SAAS,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,EAC/C,OAAO,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAExC,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,GACtC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CA4B5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "9.26.0",
3
+ "version": "9.26.1",
4
4
  "description": "tRPC Server",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -70,5 +70,5 @@
70
70
  "yup": "^0.32.8",
71
71
  "zod": "^3.0.0"
72
72
  },
73
- "gitHead": "7dfd3f551808c3e0caf89fca4e9426d34a37992f"
73
+ "gitHead": "c6f6aa6ef043b3e0e1da810bdb0cf2880a2fb26c"
74
74
  }
@@ -50,11 +50,26 @@ function getHTTPMethod(event: APIGatewayEvent) {
50
50
  message: UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE,
51
51
  });
52
52
  }
53
+
53
54
  function getPath(event: APIGatewayEvent) {
54
55
  if (isPayloadV1(event)) {
56
+ const matches = event.resource.matchAll(/\{(.*?)\}/g);
57
+ for (const match of matches) {
58
+ const group = match[1];
59
+ if (group.includes('+') && event.pathParameters) {
60
+ return event.pathParameters[group.replace('+', '')] || '';
61
+ }
62
+ }
55
63
  return event.path.slice(1);
56
64
  }
57
65
  if (isPayloadV2(event)) {
66
+ const matches = event.routeKey.matchAll(/\{(.*?)\}/g);
67
+ for (const match of matches) {
68
+ const group = match[1];
69
+ if (group.includes('+') && event.pathParameters) {
70
+ return event.pathParameters[group.replace('+', '')] || '';
71
+ }
72
+ }
58
73
  return event.rawPath.slice(1);
59
74
  }
60
75
  throw new TRPCError({