@cauth/core 0.0.2 → 0.0.3
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/dist/index.d.ts +18 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -194,33 +194,37 @@ type AuthGuardDeps = {
|
|
|
194
194
|
tokens: _CAuth<any>['Tokens'];
|
|
195
195
|
roles?: Array<string>;
|
|
196
196
|
};
|
|
197
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Generic RoutesContract
|
|
199
|
+
* THandler is generic, defaults to any function
|
|
200
|
+
*/
|
|
201
|
+
interface RoutesContract<THandler extends (...args: any[]) => any = (...args: any[]) => any> {
|
|
198
202
|
Login({
|
|
199
203
|
...config
|
|
200
|
-
}: RouteDeps):
|
|
204
|
+
}: RouteDeps): THandler;
|
|
201
205
|
Register({
|
|
202
206
|
...config
|
|
203
|
-
}: RouteDeps):
|
|
207
|
+
}: RouteDeps): THandler;
|
|
204
208
|
Logout({
|
|
205
209
|
...config
|
|
206
|
-
}: RouteDeps):
|
|
210
|
+
}: RouteDeps): THandler;
|
|
207
211
|
Guard({
|
|
208
212
|
...config
|
|
209
|
-
}: AuthGuardDeps):
|
|
213
|
+
}: AuthGuardDeps): THandler;
|
|
210
214
|
Refresh({
|
|
211
215
|
...config
|
|
212
|
-
}: AuthGuardDeps):
|
|
216
|
+
}: AuthGuardDeps): THandler;
|
|
213
217
|
ChangePassword({
|
|
214
218
|
...config
|
|
215
219
|
}: RouteDeps & {
|
|
216
220
|
userId: string;
|
|
217
|
-
}):
|
|
221
|
+
}): THandler;
|
|
218
222
|
}
|
|
219
223
|
//#endregion
|
|
220
224
|
//#region src/types/config.t.d.ts
|
|
221
225
|
declare const CAuthOptionsSchema: z$1.ZodObject<{
|
|
222
226
|
dbContractor: z$1.ZodCustom<DatabaseContract, DatabaseContract>;
|
|
223
|
-
routeContractor: z$1.ZodCustom<RoutesContract
|
|
227
|
+
routeContractor: z$1.ZodCustom<RoutesContract<(...args: any[]) => any>, RoutesContract<(...args: any[]) => any>>;
|
|
224
228
|
roles: z$1.ZodArray<z$1.ZodString>;
|
|
225
229
|
jwtConfig: z$1.ZodObject<{
|
|
226
230
|
refreshTokenSecret: z$1.ZodString;
|
|
@@ -282,13 +286,13 @@ declare class _CAuth<T extends string[]> {
|
|
|
282
286
|
*
|
|
283
287
|
* @default undefined
|
|
284
288
|
*/
|
|
285
|
-
Guard: (roles?: Array<T[number]>) => any;
|
|
289
|
+
Guard: (roles?: Array<T[number]>) => (...args: any[]) => any;
|
|
286
290
|
Routes: {
|
|
287
|
-
Register: () => any;
|
|
288
|
-
Login: () => any;
|
|
289
|
-
Logout: () => any;
|
|
290
|
-
Refresh: () => any;
|
|
291
|
-
ChangePassword: (userId: string) => any;
|
|
291
|
+
Register: () => (...args: any[]) => any;
|
|
292
|
+
Login: () => (...args: any[]) => any;
|
|
293
|
+
Logout: () => (...args: any[]) => any;
|
|
294
|
+
Refresh: () => (...args: any[]) => any;
|
|
295
|
+
ChangePassword: (userId: string) => (...args: any[]) => any;
|
|
292
296
|
};
|
|
293
297
|
FN: {
|
|
294
298
|
Login: ({
|