@mesob/auth-hono 0.2.5 → 0.3.1
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-ULpI-i0z.d.ts → index-Bh3bDnP5.d.ts} +539 -496
- package/dist/{index-DCxsFKQ2.d.ts → index-BvdbhtRX.d.ts} +8 -12
- package/dist/index.d.ts +5 -4
- package/dist/index.js +423 -268
- package/dist/index.js.map +1 -1
- package/dist/lib/cleanup.d.ts +1 -1
- package/dist/lib/cleanup.js +121 -103
- package/dist/lib/cleanup.js.map +1 -1
- package/dist/lib/cookie.d.ts +2 -2
- package/dist/lib/has-role-permission.d.ts +18 -0
- package/dist/lib/has-role-permission.js +40 -0
- package/dist/lib/has-role-permission.js.map +1 -0
- package/dist/lib/normalize-user.d.ts +5 -9
- package/dist/lib/normalize-user.js +5 -10
- package/dist/lib/normalize-user.js.map +1 -1
- package/dist/lib/openapi-config.d.ts +2 -2
- package/dist/lib/phone-validation.d.ts +2 -2
- package/dist/lib/session.d.ts +2 -2
- package/dist/lib/tenant.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as hono from 'hono';
|
|
2
2
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
|
-
import { D as Database } from './index-
|
|
3
|
+
import { D as Database } from './index-Bh3bDnP5.js';
|
|
4
4
|
|
|
5
5
|
type SessionStatus = 'valid' | 'no_cookie' | 'invalid_session' | 'user_not_found' | 'error';
|
|
6
6
|
|
|
@@ -18,13 +18,6 @@ type AuthEnv = {
|
|
|
18
18
|
|
|
19
19
|
declare const createAuthRoutes: ({ config, database, }: CreateAuthRoutesOptions) => OpenAPIHono<AuthEnv, {}, "/">;
|
|
20
20
|
|
|
21
|
-
type UserRole = {
|
|
22
|
-
id: string;
|
|
23
|
-
roleId: string;
|
|
24
|
-
code: string;
|
|
25
|
-
name: unknown;
|
|
26
|
-
description: unknown;
|
|
27
|
-
};
|
|
28
21
|
type User = {
|
|
29
22
|
id: string;
|
|
30
23
|
tenantId: string;
|
|
@@ -38,7 +31,12 @@ type User = {
|
|
|
38
31
|
lastSignInAt: string | null;
|
|
39
32
|
bannedUntil?: string | null;
|
|
40
33
|
loginAttempt?: number;
|
|
41
|
-
|
|
34
|
+
/** Role IDs */
|
|
35
|
+
roles?: string[] | null;
|
|
36
|
+
/** Role codes for hasRole() checks (e.g. 'owner', 'tenant-admin') */
|
|
37
|
+
roleCodes?: string[] | null;
|
|
38
|
+
/** Permission IDs for hasPermission() checks */
|
|
39
|
+
permissions?: string[] | null;
|
|
42
40
|
};
|
|
43
41
|
type SessionMeta = {
|
|
44
42
|
action?: string;
|
|
@@ -50,9 +48,6 @@ type Session = {
|
|
|
50
48
|
userId: string;
|
|
51
49
|
expiresAt: string;
|
|
52
50
|
createdAt: string;
|
|
53
|
-
updatedAt?: string;
|
|
54
|
-
userAgent: string | null;
|
|
55
|
-
ip: string | null;
|
|
56
51
|
meta?: SessionMeta | null;
|
|
57
52
|
};
|
|
58
53
|
type SendVerificationOTPParams = {
|
|
@@ -113,6 +108,7 @@ type CookieConfig = {
|
|
|
113
108
|
};
|
|
114
109
|
type AuthConfig = {
|
|
115
110
|
connectionString: string;
|
|
111
|
+
userType: string;
|
|
116
112
|
secret: string;
|
|
117
113
|
basePath?: string;
|
|
118
114
|
tenant?: TenantConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { A as AuthConfig, M as MesobAuth } from './index-
|
|
2
|
-
export { a as SendVerificationOTPParams, b as Session, S as SessionStatus, U as User } from './index-
|
|
3
|
-
import { D as Database } from './index-
|
|
4
|
-
export { c as createDatabase } from './index-
|
|
1
|
+
import { A as AuthConfig, M as MesobAuth } from './index-BvdbhtRX.js';
|
|
2
|
+
export { a as SendVerificationOTPParams, b as Session, S as SessionStatus, U as User } from './index-BvdbhtRX.js';
|
|
3
|
+
import { D as Database } from './index-Bh3bDnP5.js';
|
|
4
|
+
export { c as createDatabase } from './index-Bh3bDnP5.js';
|
|
5
5
|
export { cleanupExpiredData, cleanupExpiredSessions, cleanupExpiredVerifications } from './lib/cleanup.js';
|
|
6
|
+
export { hasPermission, hasPermissionThrow, hasRole, hasRoleThrow } from './lib/has-role-permission.js';
|
|
6
7
|
import * as hono from 'hono';
|
|
7
8
|
import '@hono/zod-openapi';
|
|
8
9
|
import 'drizzle-orm/node-postgres';
|