@veloxts/router 0.8.1 → 0.8.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @veloxts/router
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - merge URL params into POST input for flat .rest() paths
8
+ - Updated dependencies
9
+ - @veloxts/core@0.8.2
10
+ - @veloxts/validation@0.8.2
11
+
3
12
  ## 0.8.1
4
13
 
5
14
  ### Patch Changes
@@ -218,25 +218,20 @@ function gatherInput(request, route) {
218
218
  const params = isPlainObject(request.params) ? request.params : {};
219
219
  const query = isPlainObject(request.query) ? request.query : {};
220
220
  const body = isPlainObject(request.body) ? request.body : {};
221
- // Check if this is a nested route (has single parent or multiple parents)
222
- const hasParentResource = route.procedure.parentResource !== undefined ||
223
- (route.procedure.parentResources !== undefined && route.procedure.parentResources.length > 0);
224
221
  switch (route.method) {
225
222
  case 'GET':
226
223
  case 'DELETE':
227
224
  // GET/DELETE: params (for :id and all parent params) + query (for filters/pagination/options)
228
225
  return { ...params, ...query };
226
+ case 'POST':
229
227
  case 'PUT':
230
228
  case 'PATCH':
231
- // PUT/PATCH: params (for :id and all parent params) + body (for data)
229
+ // POST/PUT/PATCH: params (for :id and all parent params) + body (for data).
230
+ // POST must merge params unconditionally — flat conventional creates have
231
+ // empty params (no-op spread), but RPC-style .rest() overrides such as
232
+ // POST /retro/phase/:sessionId/next rely on this merge to surface path
233
+ // params to the input schema.
232
234
  return { ...params, ...body };
233
- case 'POST':
234
- // POST: For nested routes, merge params (for all parent IDs) with body
235
- // For flat routes, use body only (no ID in params for creates)
236
- if (hasParentResource) {
237
- return { ...params, ...body };
238
- }
239
- return request.body;
240
235
  default:
241
236
  return request.body;
242
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/router",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Procedure definitions with tRPC and REST routing for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "@trpc/server": "11.12.0",
41
41
  "fastify": "5.8.2",
42
- "@veloxts/core": "0.8.1",
43
- "@veloxts/validation": "0.8.1"
42
+ "@veloxts/core": "0.8.2",
43
+ "@veloxts/validation": "0.8.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@vitest/coverage-v8": "4.1.0",