@mesob/auth-hono 0.4.1 → 0.4.2
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-CKOeabpa.d.ts → index-BNJj_z2x.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/lib/cleanup.d.ts +1 -1
- package/dist/lib/cookie.d.ts +2 -2
- package/dist/lib/has-role-permission.d.ts +2 -2
- package/dist/lib/iam-seed.d.ts +3 -3
- package/dist/lib/normalize-auth-response.d.ts +2 -2
- package/dist/lib/normalize-user.d.ts +2 -2
- package/dist/lib/openapi-config.d.ts +2 -2
- package/dist/lib/permission-catalog.d.ts +1 -1
- 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
- package/dist/{index-zShda6U3.d.ts → index-Cb7JZobZ.d.ts} +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as hono from 'hono';
|
|
2
2
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
import { PermissionTree } from '@mesob/common';
|
|
4
|
-
import { D as Database } from './index-
|
|
4
|
+
import { D as Database } from './index-Cb7JZobZ.js';
|
|
5
5
|
|
|
6
6
|
type SessionStatus = 'valid' | 'no_cookie' | 'invalid_session' | 'user_not_found' | 'error';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AuthConfig, M as MesobAuth } from './index-
|
|
2
|
-
export { a as SendInvitationParams, b as SendVerificationOTPParams, c 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-BNJj_z2x.js';
|
|
2
|
+
export { a as SendInvitationParams, b as SendVerificationOTPParams, c as Session, S as SessionStatus, U as User } from './index-BNJj_z2x.js';
|
|
3
|
+
import { D as Database } from './index-Cb7JZobZ.js';
|
|
4
|
+
export { c as createDatabase } from './index-Cb7JZobZ.js';
|
|
5
5
|
export { cleanupExpiredData, cleanupExpiredSessions, cleanupExpiredVerifications } from './lib/cleanup.js';
|
|
6
6
|
export { hasPermission, hasPermissionThrow, hasRole, hasRoleThrow } from './lib/has-role-permission.js';
|
|
7
7
|
import * as hono from 'hono';
|
package/dist/index.js
CHANGED
|
@@ -1056,17 +1056,17 @@ var checkAccountHandler = async (c) => {
|
|
|
1056
1056
|
email: usersInIam.email,
|
|
1057
1057
|
phone: usersInIam.phone,
|
|
1058
1058
|
verified: isEmail ? usersInIam.emailVerified : usersInIam.phoneVerified,
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
).where(whereClause).limit(1);
|
|
1059
|
+
hasPassword: sql4`exists(
|
|
1060
|
+
select 1
|
|
1061
|
+
from ${accountsInIam}
|
|
1062
|
+
where ${accountsInIam.tenantId} = ${resolvedTenantId}
|
|
1063
|
+
and ${accountsInIam.userId} = ${usersInIam.id}
|
|
1064
|
+
and ${accountsInIam.provider} = 'credentials'
|
|
1065
|
+
and ${accountsInIam.password} is not null
|
|
1066
|
+
)`
|
|
1067
|
+
}).from(usersInIam).where(whereClause).limit(1);
|
|
1068
1068
|
const verified = result?.verified ?? false;
|
|
1069
|
-
const hasPassword =
|
|
1069
|
+
const hasPassword = result?.hasPassword ?? false;
|
|
1070
1070
|
return c.json(
|
|
1071
1071
|
{
|
|
1072
1072
|
exists: !!result,
|
|
@@ -1416,15 +1416,15 @@ var fetchUserForLogin = async ({
|
|
|
1416
1416
|
lastSignInAt: usersInIam.lastSignInAt,
|
|
1417
1417
|
bannedUntil: usersInIam.bannedUntil,
|
|
1418
1418
|
loginAttempt: usersInIam.loginAttempt,
|
|
1419
|
-
hasPassword: sql6`
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
).where(whereClause).limit(1);
|
|
1419
|
+
hasPassword: sql6`exists(
|
|
1420
|
+
select 1
|
|
1421
|
+
from ${accountsInIam}
|
|
1422
|
+
where ${accountsInIam.tenantId} = ${tenantId}
|
|
1423
|
+
and ${accountsInIam.userId} = ${usersInIam.id}
|
|
1424
|
+
and ${accountsInIam.provider} = 'credentials'
|
|
1425
|
+
and ${accountsInIam.password} is not null
|
|
1426
|
+
)`
|
|
1427
|
+
}).from(usersInIam).where(whereClause).limit(1);
|
|
1428
1428
|
return row || null;
|
|
1429
1429
|
};
|
|
1430
1430
|
var fetchUserByIdWithRoles = async ({
|