@accounts/server
Advanced tools
Comparing version 1.0.0-alpha-20231121011122-60a60524 to 1.0.0-alpha-20231122105229-8edd073f
import * as jwt from 'jsonwebtoken'; | ||
import Emittery from 'emittery'; | ||
import { User, LoginResult, Tokens, Session, ImpersonationUserIdentity, ImpersonationResult, HookListener, DatabaseInterface, ConnectionInformations, DatabaseInterfaceUser, DatabaseInterfaceSessions } from '@accounts/types'; | ||
import { User, LoginResult, Tokens, Session, ImpersonationUserIdentity, ImpersonationResult, HookListener, DatabaseInterface, ConnectionInformations, DatabaseInterfaceUser, DatabaseInterfaceSessions, AuthenticationService } from '@accounts/types'; | ||
import { AccountsServerOptions } from './types/accounts-server-options'; | ||
@@ -33,3 +33,3 @@ import { EmailTemplateType } from './types/email-template-type'; | ||
export declare class AccountsServer<CustomUser extends User = User> { | ||
services: AuthenticationServices<CustomUser>; | ||
services: AuthenticationServices<CustomUser> | Record<string, new (args: any) => AuthenticationService<CustomUser>>; | ||
private db; | ||
@@ -41,3 +41,3 @@ context: ExecutionContext; | ||
private dbSessions; | ||
constructor(options: AccountsServerOptions<CustomUser>, services: AuthenticationServices<CustomUser>, db: DatabaseInterface<CustomUser> | DatabaseInterfaceUser<CustomUser>, dbSessions?: DatabaseInterfaceSessions); | ||
constructor(options: AccountsServerOptions<CustomUser>, services: AuthenticationServices<CustomUser> | Record<string, new (args: any) => AuthenticationService<CustomUser>>, db: DatabaseInterface<CustomUser> | DatabaseInterfaceUser<CustomUser>, dbSessions?: DatabaseInterfaceSessions); | ||
private getService; | ||
@@ -44,0 +44,0 @@ getServices(): AuthenticationServices<CustomUser>; |
@@ -85,3 +85,9 @@ "use strict"; | ||
getServices() { | ||
return this.services; | ||
return Object.entries(this.services).reduce((acc, [name, instanceOrCtor]) => { | ||
acc[name] = | ||
typeof instanceOrCtor === 'function' | ||
? this.context.injector.get(instanceOrCtor) | ||
: instanceOrCtor; | ||
return acc; | ||
}, {}); | ||
} | ||
@@ -88,0 +94,0 @@ getOptions() { |
{ | ||
"name": "@accounts/server", | ||
"version": "1.0.0-alpha-20231121011122-60a60524", | ||
"version": "1.0.0-alpha-20231122105229-8edd073f", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -51,3 +51,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@accounts/types": "1.0.0-alpha-20231121011122-60a60524", | ||
"@accounts/types": "1.0.0-alpha-20231122105229-8edd073f", | ||
"@types/jsonwebtoken": "9.0.5", | ||
@@ -54,0 +54,0 @@ "emittery": "0.13.1", |
@@ -16,2 +16,3 @@ import merge from 'lodash.merge'; | ||
DatabaseInterfaceSessions, | ||
AuthenticationService, | ||
} from '@accounts/types'; | ||
@@ -85,3 +86,6 @@ | ||
@Inject(AccountsCoreConfigToken) options: AccountsServerOptions<CustomUser>, | ||
@Inject(AuthenticationServicesToken) public services: AuthenticationServices<CustomUser>, | ||
@Inject(AuthenticationServicesToken) | ||
public services: | ||
| AuthenticationServices<CustomUser> | ||
| Record<string, new (args: any) => AuthenticationService<CustomUser>>, | ||
@Inject(DatabaseInterfaceUserToken) | ||
@@ -134,3 +138,12 @@ private db: DatabaseInterface<CustomUser> | DatabaseInterfaceUser<CustomUser>, | ||
public getServices(): AuthenticationServices<CustomUser> { | ||
return this.services; | ||
return Object.entries(this.services).reduce<AuthenticationServices<CustomUser>>( | ||
(acc, [name, instanceOrCtor]) => { | ||
acc[name] = | ||
typeof instanceOrCtor === 'function' | ||
? this.context.injector.get(instanceOrCtor) | ||
: instanceOrCtor; | ||
return acc; | ||
}, | ||
{} | ||
); | ||
} | ||
@@ -137,0 +150,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121071
2385
+ Added@accounts/types@1.0.0-alpha-20231122105229-8edd073f(transitive)
- Removed@accounts/types@1.0.0-alpha-20231121011122-60a60524(transitive)