@veap/auth 0.1.0 → 0.1.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.
Files changed (103) hide show
  1. package/README.md +3 -2
  2. package/dist/actions/auth.actions.d.ts +2 -2
  3. package/dist/actions/auth.actions.js +1 -1
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.js +1 -1
  6. package/dist/client/auth.context.d.ts +2 -2
  7. package/dist/client/auth.context.js +1 -1
  8. package/dist/client/index.d.ts +1 -1
  9. package/dist/client/index.js +1 -1
  10. package/dist/common/augment.d.ts +2 -2
  11. package/dist/common/augment.js +1 -1
  12. package/dist/common/context.d.ts +6 -5
  13. package/dist/common/context.js +7 -5
  14. package/dist/common/index.d.ts +7 -6
  15. package/dist/common/index.js +7 -6
  16. package/dist/common/logic.d.ts +3 -3
  17. package/dist/common/logic.js +3 -3
  18. package/dist/common/routes.d.ts +3 -2
  19. package/dist/common/routes.js +2 -1
  20. package/dist/common/tokens.d.ts +10 -0
  21. package/dist/common/tokens.js +8 -0
  22. package/dist/crypto/aes-cipher.d.ts +1 -1
  23. package/dist/crypto/aes-cipher.js +1 -1
  24. package/dist/crypto/bcrypt-hasher.d.ts +1 -1
  25. package/dist/crypto/index.d.ts +6 -6
  26. package/dist/crypto/index.js +6 -6
  27. package/dist/crypto/token-generator.d.ts +1 -1
  28. package/dist/index.d.ts +11 -11
  29. package/dist/index.js +11 -11
  30. package/dist/migrations/index.d.ts +1 -1
  31. package/dist/migrations/index.js +1 -1
  32. package/dist/models/EmailVerification.d.ts +1 -1
  33. package/dist/models/EmailVerification.js +1 -1
  34. package/dist/models/PasswordResetSession.d.ts +1 -1
  35. package/dist/models/PasswordResetSession.js +1 -1
  36. package/dist/models/Permission.d.ts +2 -2
  37. package/dist/models/Permission.js +2 -2
  38. package/dist/models/Role.d.ts +2 -2
  39. package/dist/models/Role.js +2 -2
  40. package/dist/models/Session.d.ts +1 -1
  41. package/dist/models/Session.js +1 -1
  42. package/dist/models/User.d.ts +3 -3
  43. package/dist/models/User.js +3 -3
  44. package/dist/models/index.d.ts +6 -6
  45. package/dist/models/index.js +6 -6
  46. package/dist/models.d.ts +1 -1
  47. package/dist/models.js +1 -1
  48. package/dist/passwords/contracts.d.ts +1 -1
  49. package/dist/passwords/index.d.ts +4 -4
  50. package/dist/passwords/index.js +4 -4
  51. package/dist/passwords/password-reset.facade.d.ts +1 -1
  52. package/dist/passwords/password-reset.facade.js +9 -2
  53. package/dist/passwords/password-reset.repository.d.ts +2 -2
  54. package/dist/passwords/password-reset.repository.js +1 -1
  55. package/dist/passwords/password-reset.service.d.ts +3 -3
  56. package/dist/passwords/password-reset.service.js +4 -4
  57. package/dist/providers/auth.provider.d.ts +1 -1
  58. package/dist/providers/auth.provider.js +32 -29
  59. package/dist/providers/index.d.ts +2 -2
  60. package/dist/providers/index.js +2 -2
  61. package/dist/providers/setup.js +1 -1
  62. package/dist/rbac/contracts.d.ts +1 -1
  63. package/dist/rbac/index.d.ts +4 -4
  64. package/dist/rbac/index.js +4 -4
  65. package/dist/rbac/rbac.facade.d.ts +9 -9
  66. package/dist/rbac/rbac.facade.js +9 -2
  67. package/dist/rbac/rbac.repository.d.ts +1 -1
  68. package/dist/rbac/rbac.repository.js +3 -3
  69. package/dist/rbac/rbac.service.d.ts +2 -2
  70. package/dist/rbac/rbac.service.js +1 -1
  71. package/dist/server.d.ts +3 -3
  72. package/dist/server.js +3 -3
  73. package/dist/session/auth.service.d.ts +6 -6
  74. package/dist/session/auth.service.js +7 -8
  75. package/dist/session/contracts.d.ts +1 -1
  76. package/dist/session/index.d.ts +5 -5
  77. package/dist/session/index.js +5 -5
  78. package/dist/session/session.facade.d.ts +1 -1
  79. package/dist/session/session.facade.js +2 -2
  80. package/dist/session/session.repository.d.ts +2 -2
  81. package/dist/session/session.repository.js +1 -1
  82. package/dist/session/session.service.d.ts +3 -3
  83. package/dist/session/session.service.js +7 -5
  84. package/dist/users/contracts.d.ts +2 -1
  85. package/dist/users/index.d.ts +4 -4
  86. package/dist/users/index.js +4 -4
  87. package/dist/users/user.facade.d.ts +15 -1
  88. package/dist/users/user.facade.js +36 -6
  89. package/dist/users/user.repository.d.ts +3 -2
  90. package/dist/users/user.repository.js +6 -1
  91. package/dist/users/user.service.d.ts +17 -5
  92. package/dist/users/user.service.js +24 -6
  93. package/dist/validation/index.d.ts +0 -5
  94. package/dist/validation/index.js +0 -9
  95. package/dist/verification/index.d.ts +4 -4
  96. package/dist/verification/index.js +4 -4
  97. package/dist/verification/verification.facade.d.ts +4 -4
  98. package/dist/verification/verification.facade.js +9 -2
  99. package/dist/verification/verification.repository.d.ts +1 -1
  100. package/dist/verification/verification.repository.js +1 -1
  101. package/dist/verification/verification.service.d.ts +3 -3
  102. package/dist/verification/verification.service.js +7 -5
  103. package/package.json +9 -9
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
- [![CI](https://github.com/veapjs/veap-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/veapjs/veap-auth/actions/workflows/ci.yml)
2
- [![Release](https://github.com/veapjs/veap-auth/actions/workflows/release.yml/badge.svg)](https://github.com/veapjs/veap-auth/actions/workflows/release.yml)
1
+ [![CI](https://github.com/veapjs/veap-auth/actions/workflows/CI.yml/badge.svg)](https://github.com/veapjs/veap-auth/actions/workflows/CI.yml)
2
+ [![Release](https://github.com/veapjs/veap-auth/actions/workflows/RELEASE.yml/badge.svg)](https://github.com/veapjs/veap-auth/actions/workflows/RELEASE.yml)
3
+ [![Version](https://img.shields.io/npm/v/@veap/auth?style=flat&colorA=000000&colorB=000000)](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);
@@ -1 +1 @@
1
- export * from "./auth.actions";
1
+ export * from "./auth.actions.js";
@@ -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, }) {
@@ -1 +1 @@
1
- export * from "./auth.context";
1
+ export * from "./auth.context.js";
@@ -1 +1 @@
1
- export * from "./auth.context";
1
+ export * from "./auth.context.js";
@@ -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
  */
@@ -1,4 +1,4 @@
1
- import { AuthCallbackRegistry } from "./registry";
1
+ import { AuthCallbackRegistry } from "./registry.js";
2
2
  const globalForAugment = globalThis;
3
3
  export const identityAugmenters = globalForAugment.__VEAP_IDENTITY_AUGMENTERS__ ??
4
4
  new AuthCallbackRegistry();
@@ -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: AuthRoutesConfig;
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
- * Returns the currently configured authentication routes.
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;
@@ -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__ = 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
- * Returns the currently configured authentication routes.
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 ?? DEFAULT_AUTH_ROUTES;
35
+ return context?.routes || DEFAULT_AUTH_ROUTES;
34
36
  }
@@ -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 "./types";
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";
@@ -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 "./types";
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";
@@ -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
  */
@@ -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();
@@ -1,2 +1,3 @@
1
- export type { AuthConfig, AuthRoutesConfig } from "./types";
2
- export { DEFAULT_AUTH_ROUTES } from "./types";
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";
@@ -1 +1,2 @@
1
- export { DEFAULT_AUTH_ROUTES } from "./types";
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");
@@ -1,4 +1,4 @@
1
- import type { ISecretCipher } from "./contracts";
1
+ import type { ISecretCipher } from "./contracts.js";
2
2
  /**
3
3
  * AES-GCM adapter for the ISecretCipher port.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { decryptToString, encryptString } from "./encryption";
1
+ import { decryptToString, encryptString } from "./encryption.js";
2
2
  /**
3
3
  * AES-GCM adapter for the ISecretCipher port.
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { IPasswordHasher } from "./contracts";
1
+ import type { IPasswordHasher } from "./contracts.js";
2
2
  /**
3
3
  * Bcrypt adapter for the IPasswordHasher port.
4
4
  */
@@ -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";
@@ -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";
@@ -1,4 +1,4 @@
1
- import type { ITokenGenerator } from "./contracts";
1
+ import type { ITokenGenerator } from "./contracts.js";
2
2
  /**
3
3
  * Oslo-based adapter for the ITokenGenerator port.
4
4
  */
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";
@@ -1,4 +1,4 @@
1
- import * as m0001 from "./0001_create_auth_tables";
1
+ import * as m0001 from "./0001_create_auth_tables.js";
2
2
  export declare const authMigrations: (typeof m0001)[];
3
3
  export declare function runAuthMigrations(): Promise<void>;
4
4
  export default authMigrations;
@@ -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,5 +1,5 @@
1
1
  import { type CastType, Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export interface EmailVerificationAttributes {
4
4
  id: string;
5
5
  email: string;
@@ -1,5 +1,5 @@
1
1
  import { Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export class EmailVerification extends Model {
4
4
  static table = "verification_requests";
5
5
  static casts = {
@@ -1,5 +1,5 @@
1
1
  import { type CastType, Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export interface PasswordResetSessionAttributes {
4
4
  id: string;
5
5
  email: string;
@@ -1,5 +1,5 @@
1
1
  import { Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export class PasswordResetSession extends Model {
4
4
  static table = "reset_sessions";
5
5
  static casts = {
@@ -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 interface PermissionAttributes {
5
5
  id: string;
6
6
  name: string;
@@ -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;
@@ -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;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { type CastType, Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export interface SessionAttributes {
4
4
  id: string;
5
5
  userId?: string;
@@ -1,5 +1,5 @@
1
1
  import { Model } from "@veap/database";
2
- import { User } from "./User";
2
+ import { User } from "./User.js";
3
3
  export class Session extends Model {
4
4
  static table = "sessions";
5
5
  static casts = {
@@ -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;
@@ -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"];
@@ -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";
@@ -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";
@@ -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 { type ITokenGenerator } from "../crypto/contracts";
3
- import type { PasswordResetAuthSession, PasswordResetSession as PasswordResetSessionType } from "../common";
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);