Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@accounts/server

Package Overview
Dependencies
Maintainers
3
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accounts/server - npm Package Compare versions

Comparing version 1.0.0-alpha-20231121011122-60a60524 to 1.0.0-alpha-20231122105229-8edd073f

6

lib/accounts-server.d.ts
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc