@veloxts/router 0.6.83 → 0.6.84
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 +9 -0
- package/dist/procedure/builder.js +12 -0
- package/dist/procedure/types.d.ts +27 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @veloxts/router
|
|
2
2
|
|
|
3
|
+
## 0.6.84
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- - auth: add simplified guard() function with overloads + fluent builder
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @veloxts/core@0.6.84
|
|
10
|
+
- @veloxts/validation@0.6.84
|
|
11
|
+
|
|
3
12
|
## 0.6.83
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -187,6 +187,18 @@ function createBuilder(state) {
|
|
|
187
187
|
guards: [...state.guards, guardDef],
|
|
188
188
|
});
|
|
189
189
|
},
|
|
190
|
+
/**
|
|
191
|
+
* Adds multiple authorization guards at once
|
|
192
|
+
*
|
|
193
|
+
* Convenience method equivalent to chaining multiple `.guard()` calls.
|
|
194
|
+
* Guards execute left-to-right. All must pass for the procedure to execute.
|
|
195
|
+
*/
|
|
196
|
+
guards(...guardDefs) {
|
|
197
|
+
return createBuilder({
|
|
198
|
+
...state,
|
|
199
|
+
guards: [...state.guards, ...guardDefs],
|
|
200
|
+
});
|
|
201
|
+
},
|
|
190
202
|
/**
|
|
191
203
|
* Sets REST route override
|
|
192
204
|
*/
|
|
@@ -205,6 +205,33 @@ export interface ProcedureBuilder<TInput = unknown, TOutput = unknown, TContext
|
|
|
205
205
|
guardNarrow<TNarrowedContext>(guard: GuardLike<Partial<TContext>> & {
|
|
206
206
|
readonly _narrows: TNarrowedContext;
|
|
207
207
|
}): ProcedureBuilder<TInput, TOutput, TContext & TNarrowedContext>;
|
|
208
|
+
/**
|
|
209
|
+
* Adds multiple authorization guards at once
|
|
210
|
+
*
|
|
211
|
+
* This is a convenience method equivalent to chaining multiple `.guard()` calls.
|
|
212
|
+
* Guards execute left-to-right. All must pass for the procedure to execute.
|
|
213
|
+
*
|
|
214
|
+
* @param guards - Guard definitions to apply (spread)
|
|
215
|
+
* @returns Same builder (no type changes)
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* import { authenticated, hasRole, emailVerified } from '@veloxts/auth';
|
|
220
|
+
*
|
|
221
|
+
* // Multiple guards in one call
|
|
222
|
+
* procedure()
|
|
223
|
+
* .guards(authenticated, hasRole('admin'), emailVerified)
|
|
224
|
+
* .mutation(async ({ input, ctx }) => { ... });
|
|
225
|
+
*
|
|
226
|
+
* // Equivalent to:
|
|
227
|
+
* procedure()
|
|
228
|
+
* .guard(authenticated)
|
|
229
|
+
* .guard(hasRole('admin'))
|
|
230
|
+
* .guard(emailVerified)
|
|
231
|
+
* .mutation(async ({ input, ctx }) => { ... });
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
guards<TGuards extends GuardLike<Partial<TContext>>[]>(...guards: TGuards): ProcedureBuilder<TInput, TOutput, TContext>;
|
|
208
235
|
/**
|
|
209
236
|
* Configures REST route override
|
|
210
237
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/router",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.84",
|
|
4
4
|
"description": "Procedure definitions with tRPC and REST routing for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@trpc/server": "11.8.0",
|
|
41
41
|
"fastify": "5.6.2",
|
|
42
42
|
"zod-to-json-schema": "3.24.5",
|
|
43
|
-
"@veloxts/core": "0.6.
|
|
44
|
-
"@veloxts/validation": "0.6.
|
|
43
|
+
"@veloxts/core": "0.6.84",
|
|
44
|
+
"@veloxts/validation": "0.6.84"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@vitest/coverage-v8": "4.0.16",
|