@veap/auth 0.1.0 → 0.1.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/README.md +3 -2
- package/dist/actions/auth.actions.d.ts +2 -2
- package/dist/actions/auth.actions.js +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +1 -1
- package/dist/client/auth.context.d.ts +2 -2
- package/dist/client/auth.context.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/common/augment.d.ts +2 -2
- package/dist/common/augment.js +1 -1
- package/dist/common/context.d.ts +6 -5
- package/dist/common/context.js +7 -5
- package/dist/common/index.d.ts +7 -6
- package/dist/common/index.js +7 -6
- package/dist/common/logic.d.ts +3 -3
- package/dist/common/logic.js +3 -3
- package/dist/common/routes.d.ts +3 -2
- package/dist/common/routes.js +2 -1
- package/dist/common/tokens.d.ts +10 -0
- package/dist/common/tokens.js +8 -0
- package/dist/crypto/aes-cipher.d.ts +1 -1
- package/dist/crypto/aes-cipher.js +1 -1
- package/dist/crypto/bcrypt-hasher.d.ts +1 -1
- package/dist/crypto/index.d.ts +6 -6
- package/dist/crypto/index.js +6 -6
- package/dist/crypto/token-generator.d.ts +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.js +1 -1
- package/dist/models/EmailVerification.d.ts +1 -1
- package/dist/models/EmailVerification.js +1 -1
- package/dist/models/PasswordResetSession.d.ts +1 -1
- package/dist/models/PasswordResetSession.js +1 -1
- package/dist/models/Permission.d.ts +2 -2
- package/dist/models/Permission.js +2 -2
- package/dist/models/Role.d.ts +2 -2
- package/dist/models/Role.js +2 -2
- package/dist/models/Session.d.ts +1 -1
- package/dist/models/Session.js +1 -1
- package/dist/models/User.d.ts +3 -3
- package/dist/models/User.js +3 -3
- package/dist/models/index.d.ts +6 -6
- package/dist/models/index.js +6 -6
- package/dist/models.d.ts +1 -1
- package/dist/models.js +1 -1
- package/dist/passwords/contracts.d.ts +1 -1
- package/dist/passwords/index.d.ts +4 -4
- package/dist/passwords/index.js +4 -4
- package/dist/passwords/password-reset.facade.d.ts +1 -1
- package/dist/passwords/password-reset.facade.js +9 -2
- package/dist/passwords/password-reset.repository.d.ts +2 -2
- package/dist/passwords/password-reset.repository.js +1 -1
- package/dist/passwords/password-reset.service.d.ts +3 -3
- package/dist/passwords/password-reset.service.js +4 -4
- package/dist/providers/auth.provider.d.ts +1 -1
- package/dist/providers/auth.provider.js +32 -29
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +2 -2
- package/dist/providers/setup.js +1 -1
- package/dist/rbac/contracts.d.ts +1 -1
- package/dist/rbac/index.d.ts +4 -4
- package/dist/rbac/index.js +4 -4
- package/dist/rbac/rbac.facade.d.ts +9 -9
- package/dist/rbac/rbac.facade.js +9 -2
- package/dist/rbac/rbac.repository.d.ts +1 -1
- package/dist/rbac/rbac.repository.js +3 -3
- package/dist/rbac/rbac.service.d.ts +2 -2
- package/dist/rbac/rbac.service.js +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.js +3 -3
- package/dist/session/auth.service.d.ts +6 -6
- package/dist/session/auth.service.js +7 -8
- package/dist/session/contracts.d.ts +1 -1
- package/dist/session/index.d.ts +5 -5
- package/dist/session/index.js +5 -5
- package/dist/session/session.facade.d.ts +1 -1
- package/dist/session/session.facade.js +2 -2
- package/dist/session/session.repository.d.ts +2 -2
- package/dist/session/session.repository.js +1 -1
- package/dist/session/session.service.d.ts +3 -3
- package/dist/session/session.service.js +7 -5
- package/dist/users/contracts.d.ts +2 -1
- package/dist/users/index.d.ts +4 -4
- package/dist/users/index.js +4 -4
- package/dist/users/user.facade.d.ts +15 -1
- package/dist/users/user.facade.js +36 -6
- package/dist/users/user.repository.d.ts +3 -2
- package/dist/users/user.repository.js +6 -1
- package/dist/users/user.service.d.ts +17 -5
- package/dist/users/user.service.js +24 -6
- package/dist/validation/index.d.ts +0 -5
- package/dist/validation/index.js +0 -9
- package/dist/verification/index.d.ts +4 -4
- package/dist/verification/index.js +4 -4
- package/dist/verification/verification.facade.d.ts +4 -4
- package/dist/verification/verification.facade.js +9 -2
- package/dist/verification/verification.repository.d.ts +1 -1
- package/dist/verification/verification.repository.js +1 -1
- package/dist/verification/verification.service.d.ts +3 -3
- package/dist/verification/verification.service.js +7 -5
- package/package.json +5 -9
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
[](https://github.com/veapjs/veap-auth/actions/workflows/CI.yml)
|
|
2
|
+
[](https://github.com/veapjs/veap-auth/actions/workflows/RELEASE.yml)
|
|
3
|
+
[](https://www.npmjs.com/package/@veap/auth)
|
|
3
4
|
|
|
4
5
|
# @veap/auth
|
|
5
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Result } from "@veap/kernel";
|
|
2
|
-
import type { AuthResponse, SessionFlags } from "../common";
|
|
3
|
-
import type { LoginInput, RegisterInput } from "../validation";
|
|
2
|
+
import type { AuthResponse, SessionFlags } from "../common/index.js";
|
|
3
|
+
import type { LoginInput, RegisterInput } from "../validation/index.js";
|
|
4
4
|
export declare function signIn(data: LoginInput): Promise<Result<AuthResponse>>;
|
|
5
5
|
export declare function signUp(data: RegisterInput): Promise<{
|
|
6
6
|
success: false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { app, handleActionError, ok } from "@veap/kernel";
|
|
3
|
-
import { AuthService } from "../session/auth.service";
|
|
3
|
+
import { AuthService } from "../session/auth.service.js";
|
|
4
4
|
export async function signIn(data) {
|
|
5
5
|
try {
|
|
6
6
|
const authService = await app(AuthService);
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./auth.actions";
|
|
1
|
+
export * from "./auth.actions.js";
|
package/dist/actions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./auth.actions";
|
|
1
|
+
export * from "./auth.actions.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type AuthRoutesConfig } from "../common/routes";
|
|
3
|
-
import type { AuthSession } from "../common/types";
|
|
2
|
+
import { type AuthRoutesConfig } from "../common/routes.js";
|
|
3
|
+
import type { AuthSession } from "../common/types.js";
|
|
4
4
|
export interface AuthContextValue {
|
|
5
5
|
user: AuthSession["user"] | null | undefined;
|
|
6
6
|
session: AuthSession["session"] | null | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useEffect, useState, } from "react";
|
|
4
|
-
import { DEFAULT_AUTH_ROUTES } from "../common/routes";
|
|
4
|
+
import { DEFAULT_AUTH_ROUTES, } from "../common/routes.js";
|
|
5
5
|
export const AuthContext = createContext(undefined);
|
|
6
6
|
export const PathPrefixContext = createContext("/app");
|
|
7
7
|
export function AuthProvider({ children, initialSession, prefix = "/app", routes = DEFAULT_AUTH_ROUTES, }) {
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./auth.context";
|
|
1
|
+
export * from "./auth.context.js";
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./auth.context";
|
|
1
|
+
export * from "./auth.context.js";
|
package/dist/common/augment.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthCallbackRegistry } from "./registry";
|
|
2
|
-
import type { FullUser, PasswordResetSession, Session, User } from "./types";
|
|
1
|
+
import { AuthCallbackRegistry } from "./registry.js";
|
|
2
|
+
import type { FullUser, PasswordResetSession, Session, User } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* REGISTRIES FOR MODULAR EXTENSIONS
|
|
5
5
|
*/
|
package/dist/common/augment.js
CHANGED
package/dist/common/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AuthRoutesConfig } from "./routes";
|
|
1
|
+
import { type AuthRoutesConfig } from "./routes.js";
|
|
2
2
|
export interface AuthContext {
|
|
3
3
|
user: any;
|
|
4
4
|
session: any;
|
|
@@ -6,7 +6,7 @@ export interface AuthContext {
|
|
|
6
6
|
passwordReset: any;
|
|
7
7
|
emailVerification: any;
|
|
8
8
|
auth: any;
|
|
9
|
-
routes
|
|
9
|
+
routes?: AuthRoutesConfig;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Binds the resolved auth services. Called once by the composition root.
|
|
@@ -21,9 +21,10 @@ export declare function isAuthContextBound(): boolean;
|
|
|
21
21
|
*
|
|
22
22
|
* @throws If the auth service provider has not booted yet.
|
|
23
23
|
*/
|
|
24
|
-
export declare function authContext(): AuthContext
|
|
24
|
+
export declare function authContext(): AuthContext & {
|
|
25
|
+
routes: AuthRoutesConfig;
|
|
26
|
+
};
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
27
|
-
* If the Auth context is not bound yet, returns DEFAULT_AUTH_ROUTES.
|
|
28
|
+
* Resolves currently configured auth routes, falling back to defaults.
|
|
28
29
|
*/
|
|
29
30
|
export declare function getAuthRoutes(): AuthRoutesConfig;
|
package/dist/common/context.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DEFAULT_AUTH_ROUTES } from "./routes";
|
|
1
|
+
import { DEFAULT_AUTH_ROUTES } from "./routes.js";
|
|
2
2
|
const globalForAuthContext = globalThis;
|
|
3
3
|
/**
|
|
4
4
|
* Binds the resolved auth services. Called once by the composition root.
|
|
5
5
|
*/
|
|
6
6
|
export function bindAuthContext(context) {
|
|
7
|
-
globalForAuthContext.__VEAP_AUTH_CONTEXT__ =
|
|
7
|
+
globalForAuthContext.__VEAP_AUTH_CONTEXT__ = {
|
|
8
|
+
...context,
|
|
9
|
+
routes: context.routes || DEFAULT_AUTH_ROUTES,
|
|
10
|
+
};
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Check whether auth context is currently bound.
|
|
@@ -25,10 +28,9 @@ export function authContext() {
|
|
|
25
28
|
return context;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
29
|
-
* If the Auth context is not bound yet, returns DEFAULT_AUTH_ROUTES.
|
|
31
|
+
* Resolves currently configured auth routes, falling back to defaults.
|
|
30
32
|
*/
|
|
31
33
|
export function getAuthRoutes() {
|
|
32
34
|
const context = globalForAuthContext.__VEAP_AUTH_CONTEXT__;
|
|
33
|
-
return context?.routes
|
|
35
|
+
return context?.routes || DEFAULT_AUTH_ROUTES;
|
|
34
36
|
}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from "./augment";
|
|
2
|
-
export * from "./context";
|
|
3
|
-
export * from "./logic";
|
|
4
|
-
export * from "./registry";
|
|
5
|
-
export * from "./routes";
|
|
6
|
-
export * from "./
|
|
1
|
+
export * from "./augment.js";
|
|
2
|
+
export * from "./context.js";
|
|
3
|
+
export * from "./logic.js";
|
|
4
|
+
export * from "./registry.js";
|
|
5
|
+
export * from "./routes.js";
|
|
6
|
+
export * from "./tokens.js";
|
|
7
|
+
export * from "./types.js";
|
package/dist/common/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from "./augment";
|
|
2
|
-
export * from "./context";
|
|
3
|
-
export * from "./logic";
|
|
4
|
-
export * from "./registry";
|
|
5
|
-
export * from "./routes";
|
|
6
|
-
export * from "./
|
|
1
|
+
export * from "./augment.js";
|
|
2
|
+
export * from "./context.js";
|
|
3
|
+
export * from "./logic.js";
|
|
4
|
+
export * from "./registry.js";
|
|
5
|
+
export * from "./routes.js";
|
|
6
|
+
export * from "./tokens.js";
|
|
7
|
+
export * from "./types.js";
|
package/dist/common/logic.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { augmentSession, augmentUser, registerIdentityAugmenter, registerPasswordResetSessionAugmenter, registerSessionAugmenter, unregisterIdentityAugmenter, unregisterPasswordResetSessionAugmenter, unregisterSessionAugmenter } from "./augment";
|
|
2
|
-
import { AuthCallbackRegistry } from "./registry";
|
|
3
|
-
import type { AuthResponse, FullUser, Session, User, UserPermission, UserRole } from "./types";
|
|
1
|
+
import { augmentSession, augmentUser, registerIdentityAugmenter, registerPasswordResetSessionAugmenter, registerSessionAugmenter, unregisterIdentityAugmenter, unregisterPasswordResetSessionAugmenter, unregisterSessionAugmenter } from "./augment.js";
|
|
2
|
+
import { AuthCallbackRegistry } from "./registry.js";
|
|
3
|
+
import type { AuthResponse, FullUser, Session, User, UserPermission, UserRole } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Registry for login validators (e.g. 2FA module)
|
|
6
6
|
*/
|
package/dist/common/logic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { augmentSession, augmentUser, registerIdentityAugmenter, registerPasswordResetSessionAugmenter, registerSessionAugmenter, unregisterIdentityAugmenter, unregisterPasswordResetSessionAugmenter, unregisterSessionAugmenter, } from "./augment";
|
|
2
|
-
import { authContext, isAuthContextBound } from "./context";
|
|
3
|
-
import { AuthCallbackRegistry } from "./registry";
|
|
1
|
+
import { augmentSession, augmentUser, registerIdentityAugmenter, registerPasswordResetSessionAugmenter, registerSessionAugmenter, unregisterIdentityAugmenter, unregisterPasswordResetSessionAugmenter, unregisterSessionAugmenter, } from "./augment.js";
|
|
2
|
+
import { authContext, isAuthContextBound } from "./context.js";
|
|
3
|
+
import { AuthCallbackRegistry } from "./registry.js";
|
|
4
4
|
const globalForAuth = globalThis;
|
|
5
5
|
export const authValidators = globalForAuth.__VEAP_AUTH_VALIDATORS__ ??
|
|
6
6
|
new AuthCallbackRegistry();
|
package/dist/common/routes.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
export { AUTH_ROUTES, ROUTER_SERVICE } from "./tokens.js";
|
|
2
|
+
export type { AuthConfig, AuthRoutesConfig } from "./types.js";
|
|
3
|
+
export { DEFAULT_AUTH_ROUTES } from "./types.js";
|
package/dist/common/routes.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AUTH_ROUTES, ROUTER_SERVICE } from "./tokens.js";
|
|
2
|
+
export { DEFAULT_AUTH_ROUTES } from "./types.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Token } from "@veap/kernel";
|
|
2
|
+
import type { AuthRoutesConfig } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* IoC Token for application authentication routes configuration.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AUTH_ROUTES: Token<AuthRoutesConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* IoC Token for application router service (used for route rewrites).
|
|
9
|
+
*/
|
|
10
|
+
export declare const ROUTER_SERVICE: Token<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IoC Token for application authentication routes configuration.
|
|
3
|
+
*/
|
|
4
|
+
export const AUTH_ROUTES = Symbol.for("veap:auth:routes");
|
|
5
|
+
/**
|
|
6
|
+
* IoC Token for application router service (used for route rewrites).
|
|
7
|
+
*/
|
|
8
|
+
export const ROUTER_SERVICE = Symbol.for("veap:router:service");
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./aes-cipher";
|
|
2
|
-
export * from "./bcrypt-hasher";
|
|
3
|
-
export * from "./contracts";
|
|
4
|
-
export * from "./encryption";
|
|
5
|
-
export * from "./password";
|
|
6
|
-
export * from "./token-generator";
|
|
1
|
+
export * from "./aes-cipher.js";
|
|
2
|
+
export * from "./bcrypt-hasher.js";
|
|
3
|
+
export * from "./contracts.js";
|
|
4
|
+
export * from "./encryption.js";
|
|
5
|
+
export * from "./password.js";
|
|
6
|
+
export * from "./token-generator.js";
|
package/dist/crypto/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./aes-cipher";
|
|
2
|
-
export * from "./bcrypt-hasher";
|
|
3
|
-
export * from "./contracts";
|
|
4
|
-
export * from "./encryption";
|
|
5
|
-
export * from "./password";
|
|
6
|
-
export * from "./token-generator";
|
|
1
|
+
export * from "./aes-cipher.js";
|
|
2
|
+
export * from "./bcrypt-hasher.js";
|
|
3
|
+
export * from "./contracts.js";
|
|
4
|
+
export * from "./encryption.js";
|
|
5
|
+
export * from "./password.js";
|
|
6
|
+
export * from "./token-generator.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./actions";
|
|
2
|
-
export { AuthProvider, useAuthRoutes, useUser } from "./client";
|
|
3
|
-
export * from "./common";
|
|
4
|
-
export * from "./crypto";
|
|
5
|
-
export * from "./passwords";
|
|
6
|
-
export * from "./providers";
|
|
7
|
-
export * from "./rbac";
|
|
8
|
-
export * from "./session";
|
|
9
|
-
export * from "./users";
|
|
10
|
-
export * from "./validation";
|
|
11
|
-
export * from "./verification";
|
|
1
|
+
export * from "./actions/index.js";
|
|
2
|
+
export { AuthProvider, useAuthRoutes, useUser } from "./client/index.js";
|
|
3
|
+
export * from "./common/index.js";
|
|
4
|
+
export * from "./crypto/index.js";
|
|
5
|
+
export * from "./passwords/index.js";
|
|
6
|
+
export * from "./providers/index.js";
|
|
7
|
+
export * from "./rbac/index.js";
|
|
8
|
+
export * from "./session/index.js";
|
|
9
|
+
export * from "./users/index.js";
|
|
10
|
+
export * from "./validation/index.js";
|
|
11
|
+
export * from "./verification/index.js";
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./actions";
|
|
2
|
-
export { AuthProvider, useAuthRoutes, useUser } from "./client";
|
|
3
|
-
export * from "./common";
|
|
4
|
-
export * from "./crypto";
|
|
5
|
-
export * from "./passwords";
|
|
6
|
-
export * from "./providers";
|
|
7
|
-
export * from "./rbac";
|
|
8
|
-
export * from "./session";
|
|
9
|
-
export * from "./users";
|
|
10
|
-
export * from "./validation";
|
|
11
|
-
export * from "./verification";
|
|
1
|
+
export * from "./actions/index.js";
|
|
2
|
+
export { AuthProvider, useAuthRoutes, useUser } from "./client/index.js";
|
|
3
|
+
export * from "./common/index.js";
|
|
4
|
+
export * from "./crypto/index.js";
|
|
5
|
+
export * from "./passwords/index.js";
|
|
6
|
+
export * from "./providers/index.js";
|
|
7
|
+
export * from "./rbac/index.js";
|
|
8
|
+
export * from "./session/index.js";
|
|
9
|
+
export * from "./users/index.js";
|
|
10
|
+
export * from "./validation/index.js";
|
|
11
|
+
export * from "./verification/index.js";
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runMigrations } from "@veap/database";
|
|
2
|
-
import * as m0001 from "./0001_create_auth_tables";
|
|
2
|
+
import * as m0001 from "./0001_create_auth_tables.js";
|
|
3
3
|
export const authMigrations = [m0001];
|
|
4
4
|
export async function runAuthMigrations() {
|
|
5
5
|
await runMigrations("auth", authMigrations);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Model } from "@veap/database";
|
|
2
|
-
import { Role } from "./Role";
|
|
3
|
-
import { User } from "./User";
|
|
2
|
+
import { Role } from "./Role.js";
|
|
3
|
+
import { User } from "./User.js";
|
|
4
4
|
export class Permission extends Model {
|
|
5
5
|
static table = "permissions";
|
|
6
6
|
static timestamps = false;
|
package/dist/models/Role.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Model } from "@veap/database";
|
|
2
|
-
import { Permission } from "./Permission";
|
|
3
|
-
import { User } from "./User";
|
|
2
|
+
import { Permission } from "./Permission.js";
|
|
3
|
+
import { User } from "./User.js";
|
|
4
4
|
export interface RoleAttributes {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
package/dist/models/Role.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Model } from "@veap/database";
|
|
2
|
-
import { Permission } from "./Permission";
|
|
3
|
-
import { User } from "./User";
|
|
2
|
+
import { Permission } from "./Permission.js";
|
|
3
|
+
import { User } from "./User.js";
|
|
4
4
|
export class Role extends Model {
|
|
5
5
|
static table = "roles";
|
|
6
6
|
static timestamps = false;
|
package/dist/models/Session.d.ts
CHANGED
package/dist/models/Session.js
CHANGED
package/dist/models/User.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CastType, Model } from "@veap/database";
|
|
2
|
-
import { Permission } from "./Permission";
|
|
3
|
-
import { Role } from "./Role";
|
|
4
|
-
import { Session } from "./Session";
|
|
2
|
+
import { Permission } from "./Permission.js";
|
|
3
|
+
import { Role } from "./Role.js";
|
|
4
|
+
import { Session } from "./Session.js";
|
|
5
5
|
export interface UserAttributes {
|
|
6
6
|
id: string;
|
|
7
7
|
email: string;
|
package/dist/models/User.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Model } from "@veap/database";
|
|
2
|
-
import { Permission } from "./Permission";
|
|
3
|
-
import { Role } from "./Role";
|
|
4
|
-
import { Session } from "./Session";
|
|
2
|
+
import { Permission } from "./Permission.js";
|
|
3
|
+
import { Role } from "./Role.js";
|
|
4
|
+
import { Session } from "./Session.js";
|
|
5
5
|
export class User extends Model {
|
|
6
6
|
static table = "users";
|
|
7
7
|
static hidden = ["password", "recovery_code"];
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./EmailVerification";
|
|
2
|
-
export * from "./PasswordResetSession";
|
|
3
|
-
export * from "./Permission";
|
|
4
|
-
export * from "./Role";
|
|
5
|
-
export * from "./Session";
|
|
6
|
-
export * from "./User";
|
|
1
|
+
export * from "./EmailVerification.js";
|
|
2
|
+
export * from "./PasswordResetSession.js";
|
|
3
|
+
export * from "./Permission.js";
|
|
4
|
+
export * from "./Role.js";
|
|
5
|
+
export * from "./Session.js";
|
|
6
|
+
export * from "./User.js";
|
package/dist/models/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./EmailVerification";
|
|
2
|
-
export * from "./PasswordResetSession";
|
|
3
|
-
export * from "./Permission";
|
|
4
|
-
export * from "./Role";
|
|
5
|
-
export * from "./Session";
|
|
6
|
-
export * from "./User";
|
|
1
|
+
export * from "./EmailVerification.js";
|
|
2
|
+
export * from "./PasswordResetSession.js";
|
|
3
|
+
export * from "./Permission.js";
|
|
4
|
+
export * from "./Role.js";
|
|
5
|
+
export * from "./Session.js";
|
|
6
|
+
export * from "./User.js";
|
package/dist/models.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./models/index";
|
|
1
|
+
export * from "./models/index.js";
|
package/dist/models.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./models/index";
|
|
1
|
+
export * from "./models/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PasswordResetAuthSession, PasswordResetSession } from "../common";
|
|
1
|
+
import type { PasswordResetAuthSession, PasswordResetSession } from "../common/index.js";
|
|
2
2
|
export type { PasswordResetAuthSession, PasswordResetSession };
|
|
3
3
|
/** A password reset session together with its owner. */
|
|
4
4
|
export interface PasswordResetWithUser {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./contracts";
|
|
2
|
-
export * from "./password-reset.facade";
|
|
3
|
-
export * from "./password-reset.repository";
|
|
4
|
-
export * from "./password-reset.service";
|
|
1
|
+
export * from "./contracts.js";
|
|
2
|
+
export * from "./password-reset.facade.js";
|
|
3
|
+
export * from "./password-reset.repository.js";
|
|
4
|
+
export * from "./password-reset.service.js";
|
package/dist/passwords/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./contracts";
|
|
2
|
-
export * from "./password-reset.facade";
|
|
3
|
-
export * from "./password-reset.repository";
|
|
4
|
-
export * from "./password-reset.service";
|
|
1
|
+
export * from "./contracts.js";
|
|
2
|
+
export * from "./password-reset.facade.js";
|
|
3
|
+
export * from "./password-reset.repository.js";
|
|
4
|
+
export * from "./password-reset.service.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PasswordResetAuthSession, PasswordResetSession as PasswordResetSessionType } from "../common";
|
|
1
|
+
import type { PasswordResetAuthSession, PasswordResetSession as PasswordResetSessionType } from "../common/index.js";
|
|
2
2
|
export declare function createPasswordResetSession(token: string, userId: string, email: string): Promise<PasswordResetSessionType>;
|
|
3
3
|
export declare function validatePasswordResetSessionToken(token: string): Promise<PasswordResetAuthSession>;
|
|
4
4
|
export declare function setPasswordResetSessionAsEmailVerified(sessionId: string): Promise<void>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { app } from "@veap/kernel";
|
|
3
|
-
import { authContext, isAuthContextBound } from "../common/context";
|
|
4
|
-
import { PasswordResetService } from "./password-reset.service";
|
|
3
|
+
import { authContext, isAuthContextBound } from "../common/context.js";
|
|
4
|
+
import { PasswordResetService } from "./password-reset.service.js";
|
|
5
5
|
async function resolvePasswordResetService() {
|
|
6
|
+
const g = globalThis;
|
|
7
|
+
if (g.__VEAP_BOOTSTRAPPING_PROMISE__) {
|
|
8
|
+
try {
|
|
9
|
+
await g.__VEAP_BOOTSTRAPPING_PROMISE__;
|
|
10
|
+
}
|
|
11
|
+
catch { }
|
|
12
|
+
}
|
|
6
13
|
if (isAuthContextBound()) {
|
|
7
14
|
return authContext().passwordReset;
|
|
8
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PasswordResetSession as PasswordResetSessionEntity } from "../common";
|
|
2
|
-
import type { CreatePasswordResetRecord, IPasswordResetRepository, PasswordResetWithUser } from "./contracts";
|
|
1
|
+
import type { PasswordResetSession as PasswordResetSessionEntity } from "../common/index.js";
|
|
2
|
+
import type { CreatePasswordResetRecord, IPasswordResetRepository, PasswordResetWithUser } from "./contracts.js";
|
|
3
3
|
/** `IPasswordResetRepository` adapter backed by `PasswordResetSession`. */
|
|
4
4
|
export declare class ActiveRecordPasswordResetRepository implements IPasswordResetRepository {
|
|
5
5
|
create(record: CreatePasswordResetRecord): Promise<PasswordResetSessionEntity>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PasswordResetSession } from "../models/PasswordResetSession";
|
|
1
|
+
import { PasswordResetSession } from "../models/PasswordResetSession.js";
|
|
2
2
|
/** `IPasswordResetRepository` adapter backed by `PasswordResetSession`. */
|
|
3
3
|
export class ActiveRecordPasswordResetRepository {
|
|
4
4
|
async create(record) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ICacheProvider, type ICookieStore } from "@veap/kernel";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { type IPasswordResetRepository } from "./contracts";
|
|
2
|
+
import type { PasswordResetAuthSession, PasswordResetSession as PasswordResetSessionType } from "../common/index.js";
|
|
3
|
+
import { type ITokenGenerator } from "../crypto/contracts.js";
|
|
4
|
+
import { type IPasswordResetRepository } from "./contracts.js";
|
|
5
5
|
export declare class PasswordResetService {
|
|
6
6
|
private readonly sessions;
|
|
7
7
|
private readonly tokens;
|
|
@@ -13,10 +13,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { CACHE_PROVIDER, COOKIE_STORE, Inject, Injectable, } from "@veap/kernel";
|
|
14
14
|
import { sendResetPassword } from "@veap/mail";
|
|
15
15
|
import { addMinutes } from "date-fns";
|
|
16
|
-
import { augmentPasswordResetSession } from "../common/augment";
|
|
17
|
-
import { performFullUserAugmentation } from "../common/logic";
|
|
18
|
-
import { TOKEN_GENERATOR } from "../crypto/contracts";
|
|
19
|
-
import { PASSWORD_RESET_REPOSITORY, } from "./contracts";
|
|
16
|
+
import { augmentPasswordResetSession } from "../common/augment.js";
|
|
17
|
+
import { performFullUserAugmentation } from "../common/logic.js";
|
|
18
|
+
import { TOKEN_GENERATOR } from "../crypto/contracts.js";
|
|
19
|
+
import { PASSWORD_RESET_REPOSITORY, } from "./contracts.js";
|
|
20
20
|
const dummySessions = new Map();
|
|
21
21
|
let PasswordResetService = class PasswordResetService {
|
|
22
22
|
sessions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Container, ServiceProvider } from "@veap/kernel";
|
|
2
|
-
import { type AuthConfig } from "../common/routes";
|
|
2
|
+
import { type AuthConfig } from "../common/routes.js";
|
|
3
3
|
export declare class AuthServiceProvider extends ServiceProvider {
|
|
4
4
|
private config?;
|
|
5
5
|
constructor(container?: Container, config?: AuthConfig);
|