@veloxts/client 0.6.103 → 0.6.104

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,11 @@
1
1
  # @veloxts/client
2
2
 
3
+ ## 0.6.104
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(client): smart convention-based route inference, eliminate routes.ts
8
+
3
9
  ## 0.6.103
4
10
 
5
11
  ### Patch Changes
package/dist/client.js CHANGED
@@ -98,29 +98,29 @@ function resolveRouteOverride(override, procedureName) {
98
98
  * @internal
99
99
  */
100
100
  function buildRestPath(namespace, procedureName, routes) {
101
- // Check for explicit route mapping first
101
+ // 1. Check for explicit route override first
102
102
  const override = routes?.[namespace]?.[procedureName];
103
103
  if (override) {
104
104
  const resolved = resolveRouteOverride(override, procedureName);
105
105
  return resolved.path;
106
106
  }
107
- // Fall back to naming convention
108
- const method = inferMethodFromName(procedureName);
109
- // List operations: /namespace
110
- if (procedureName.startsWith('list')) {
107
+ // 2. Convention inference collection endpoints (no :id)
108
+ if (procedureName.startsWith('list') ||
109
+ procedureName.startsWith('find') ||
110
+ procedureName.startsWith('create') ||
111
+ procedureName.startsWith('add')) {
111
112
  return `/${namespace}`;
112
113
  }
113
- // Single resource operations (get, update, delete): /namespace/:id
114
+ // 3. Convention inference — single-resource endpoints (with :id)
114
115
  if (procedureName.startsWith('get') ||
115
116
  procedureName.startsWith('update') ||
116
- procedureName.startsWith('delete')) {
117
+ procedureName.startsWith('edit') ||
118
+ procedureName.startsWith('patch') ||
119
+ procedureName.startsWith('delete') ||
120
+ procedureName.startsWith('remove')) {
117
121
  return `/${namespace}/:id`;
118
122
  }
119
- // Create operations: /namespace
120
- if (method === 'POST') {
121
- return `/${namespace}`;
122
- }
123
- // Default: /namespace
123
+ // 4. Fallback: /{namespace}
124
124
  return `/${namespace}`;
125
125
  }
126
126
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/client",
3
- "version": "0.6.103",
3
+ "version": "0.6.104",
4
4
  "description": "Type-safe frontend API client for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",