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

@accounts/client

Package Overview
Dependencies
Maintainers
5
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accounts/client - npm Package Compare versions

Comparing version 0.1.0-alpha.b5d6f4ab to 0.1.0-alpha.d1153bd0

16

lib/accounts-client.d.ts
import { Map } from 'immutable';
import { CreateUserType, UserObjectType, TokensType, ImpersonateReturnType } from '@accounts/common';
import { CreateUserType, LoginUserIdentityType, LoginReturnType, UserObjectType, TokensType, ImpersonateReturnType } from '@accounts/common';
import { AccountsClientConfiguration } from './config';

@@ -38,11 +38,11 @@ import { TransportInterface } from './transport-interface';

ui: {};
config(options: any, transport: TransportInterface): Promise<AccountsClient>;
user(): any;
options(): any;
createUser(user: any, callback?: (err?: Error) => void): Promise<void>;
loginWithPassword(user: any, password: string, callback?: (err?: Error, res?: any) => void): Promise<void>;
config(options: AccountsClientConfiguration, transport: TransportInterface): Promise<AccountsClient>;
user(): UserObjectType;
options(): AccountsClientConfiguration;
createUser(user: CreateUserType, callback?: (err?: Error) => void): Promise<void>;
loginWithPassword(user: LoginUserIdentityType, password: string, callback?: (err?: Error, res?: LoginReturnType) => void): Promise<void>;
loggingIn(): boolean;
isLoading(): boolean;
logout(callback: (err?: Error) => void): Promise<void>;
tokens(): any;
tokens(): TokensType;
resumeSession(): Promise<void>;

@@ -55,4 +55,4 @@ refreshSession(): Promise<void>;

isImpersonated(): boolean;
originalTokens(): any;
originalTokens(): TokensType;
};
export default Accounts;

@@ -1,2 +0,2 @@

import { AccountsCommonConfiguration, HookListener } from '@accounts/common';
import { AccountsCommonConfiguration, HookListener, PasswordSignupFields } from '@accounts/common';
import { Store, Middleware } from 'redux';

@@ -38,3 +38,45 @@ export interface TokenStorage {

};
declare const _default: any;
declare const _default: {
store: any;
reduxLogger: any;
reduxStoreKey: string;
tokenStorage: {
getItem(key: string): Promise<string>;
removeItem(key: string): Promise<string>;
setItem(key: string, value: string): Promise<string>;
};
server: string;
tokenStoragePrefix: string;
title: string;
requestPermissions: any[];
requestOfflineToken: {};
forceApprovalPrompt: {};
requireEmailVerification: boolean;
loginPath: string;
signUpPath: any;
resetPasswordPath: any;
profilePath: string;
changePasswordPath: any;
homePath: string;
signOutPath: string;
onEnrollAccountHook: () => number;
onResetPasswordHook: () => number;
onVerifyEmailHook: () => number;
onSignedInHook: () => number;
onSignedOutHook: () => number;
loginOnSignUp: boolean;
persistImpersonation: boolean;
siteUrl?: string;
sendVerificationEmail?: boolean;
sendEnrollmentEmail?: boolean;
sendWelcomeEmail?: boolean;
forbidClientAccountCreation?: boolean;
restrictCreationByEmailDomain?: string;
passwordResetTokenExpirationInDays?: number;
passwordEnrollTokenExpirationInDays?: number;
passwordSignupFields?: PasswordSignupFields;
minimumPasswordLength?: number;
path?: string;
passwordHashAlgorithm?: "sha" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512" | "md5" | "ripemd160";
};
export default _default;

@@ -1,2 +0,2 @@

declare const _default: (path: string) => any;
declare const _default: (path: string) => number;
export default _default;
{
"name": "@accounts/client",
"version": "0.1.0-alpha.b5d6f4ab",
"version": "0.1.0-alpha.d1153bd0",
"description": "Fullstack authentication and accounts-management",

@@ -15,6 +15,7 @@ "main": "lib/index.js",

"compile": "tsc",
"prepublish": "npm run compile",
"prepublishOnly": "npm run compile",
"test": "npm run testonly",
"test-ci": "npm lint && npm coverage",
"testonly": "jest",
"test:watch": "jest --watch",
"coverage": "npm run testonly -- --coverage",

@@ -54,3 +55,2 @@ "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"

"coveralls": "^2.11.14",
"flow-bin": "0.41.0",
"jest": "^20.0.4",

@@ -64,3 +64,3 @@ "jsonwebtoken": "^7.4.1",

"dependencies": {
"@accounts/common": "^0.0.18",
"@accounts/common": "^0.1.0-alpha.d1153bd0",
"crypto-js": "^3.1.9-1",

@@ -67,0 +67,0 @@ "immutable": "^3.8.1",

@@ -38,6 +38,4 @@ import { Map } from 'immutable';

createUser: jest.fn(() => Promise.resolve(loggedInUser.user.id)),
loginWithPassword: jest.fn(() => Promise.resolve(loggedInUser)),
logout: jest.fn(() => Promise.resolve()),
refreshTokens: jest.fn(() => Promise.resolve(loggedInUser)),
resetPassword: jest.fn(() => Promise.resolve()),
sendResetPasswordEmail: jest.fn(() => Promise.resolve()),

@@ -168,2 +166,3 @@ verifyEmail: jest.fn(() => Promise.resolve()),

});
it('calls callback on failure with error message', async () => {

@@ -181,3 +180,2 @@ const transport = {

{
password: '123456',
username: 'user',

@@ -194,20 +192,2 @@ },

it('calls login function with user id and password of created user', async () => {
Accounts.config({ history }, mockTransport);
Accounts.instance.loginWithPassword = jest.fn(
() => Accounts.instance.loginWithPassword
);
await Accounts.createUser({
password: '123456',
username: 'user',
});
expect(Accounts.instance.loginWithPassword).toHaveBeenCalledWith(
{ id: '123' },
'123456'
);
});
it('calls onUserCreated after successful user creation', async () => {

@@ -224,3 +204,2 @@ const onUserCreated = jest.fn();

await Accounts.createUser({
password: '123456',
username: 'user',

@@ -282,3 +261,3 @@ });

const callback = jest.fn();
await Accounts.loginWithPassword('username', 'password', callback);
await Accounts.loginWithPassword({ username: 'username' }, 'password', callback);
expect(callback.mock.calls.length).toEqual(1);

@@ -285,0 +264,0 @@ expect(Accounts.loggingIn()).toBe(false);

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