@veloxts/client 0.6.103 → 0.6.105
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 +12 -0
- package/dist/client.js +12 -12
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @veloxts/client
|
|
2
2
|
|
|
3
|
+
## 0.6.105
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(create): resolve JSX conditional marker artifacts and add auth route guard & some socumentation updates
|
|
8
|
+
|
|
9
|
+
## 0.6.104
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- feat(client): smart convention-based route inference, eliminate routes.ts
|
|
14
|
+
|
|
3
15
|
## 0.6.103
|
|
4
16
|
|
|
5
17
|
### 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
|
|
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
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
//
|
|
114
|
+
// 3. Convention inference — single-resource endpoints (with :id)
|
|
114
115
|
if (procedureName.startsWith('get') ||
|
|
115
116
|
procedureName.startsWith('update') ||
|
|
116
|
-
procedureName.startsWith('
|
|
117
|
+
procedureName.startsWith('edit') ||
|
|
118
|
+
procedureName.startsWith('patch') ||
|
|
119
|
+
procedureName.startsWith('delete') ||
|
|
120
|
+
procedureName.startsWith('remove')) {
|
|
117
121
|
return `/${namespace}/:id`;
|
|
118
122
|
}
|
|
119
|
-
//
|
|
120
|
-
if (method === 'POST') {
|
|
121
|
-
return `/${namespace}`;
|
|
122
|
-
}
|
|
123
|
-
// Default: /namespace
|
|
123
|
+
// 4. Fallback: /{namespace}
|
|
124
124
|
return `/${namespace}`;
|
|
125
125
|
}
|
|
126
126
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -148,6 +148,8 @@ export type ClientFromTRPCNamespace<TNamespace> = {
|
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
150
|
* Checks if a type looks like a tRPC procedure
|
|
151
|
+
*
|
|
152
|
+
* @undocumented
|
|
151
153
|
*/
|
|
152
154
|
export type IsTRPCProcedure<T> = T extends {
|
|
153
155
|
_def: {
|
|
@@ -159,6 +161,8 @@ export type IsTRPCProcedure<T> = T extends {
|
|
|
159
161
|
} ? true : false;
|
|
160
162
|
/**
|
|
161
163
|
* Checks if a type looks like a tRPC namespace (object containing tRPC procedures)
|
|
164
|
+
*
|
|
165
|
+
* @undocumented
|
|
162
166
|
*/
|
|
163
167
|
export type IsTRPCNamespace<T> = T extends Record<string, {
|
|
164
168
|
_def: {
|