npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sheetbase/auth

v3.0.1

Published

User management system for Sheetbase app.

Downloads

3

Readme

@sheetbase/auth

User management system for Sheetbase app.

  • Install: npm install --save @sheetbase/auth

  • Usage:

// 1. import module
import { AuthModule } from "@sheetbase/auth";

// 2. create an instance
export class App {
  // the object
  authModule: AuthModule;

  // initiate the instance
  constructor() {
    this.authModule = new AuthModule(/* options */);
  }
}

| Name | Type | Description | | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ----------- | | encryptionSecret | string | | | oobBody? | OobBody | | | oobSubject? | OobSubject | | | oobUrl? | string | OobUrl | |

The Lib class.

| Name | Type | Description | | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------- | | authActionRoute | AuthActionRoute | | | authOauthRoute | AuthOauthRoute | | | authOobRoute | AuthOobRoute | | | authPublicRoute | AuthPublicRoute | | | authRoute | AuthRoute | | | authService | AuthService | | | authTokenRoute | AuthTokenRoute | | | authUserRoute | AuthUserRoute | | | helperService | HelperService | | | idTokenMiddleware | IdTokenMiddleware | | | oauthService | OauthService | | | oobService | OobService | | | optionService | OptionService | | | tokenService | TokenService | | | userMiddleware | UserMiddleware | |

| Function | Returns type | Description | | --------------------------------------------------------------------- | ---------------------------- | ------------------------ | | registerRoutes(routeEnabling?, middlewares?) | RouterService<> | Expose the module routes | | useUserMiddleware() | RoutingHandler | | | userIdTokenMiddleware() | RoutingHandler | |

Expose the module routes

Parameters

| Param | Type | Description | | ------------- | -------------------------------------------- | ----------- | | routeEnabling | true | DisabledRoutes | | | middlewares | Middlewares | RouteMiddlewares | |

Returns

RouterService<>


The useUserMiddleware call signature.

Returns

RoutingHandler


The userIdTokenMiddleware call signature.

Returns

RoutingHandler


AuthModule provides REST API endpoints allowing clients to access server resources. Theses enpoints are not exposed by default, to expose the endpoints:

AuthModule.registerRoutes(routeEnabling?);

AuthModule returns these routing errors, you may use the error code to customize the message:

  • auth/invalid-email: Invalid email.
  • auth/invalid-input: Invalid input.
  • auth/invalid-password: Invalid password.
  • auth/invalid-token: Invalid token.
  • auth/user-exists: User already exists.
  • auth/user-not-exists: No user.

| Route | Method | Disabled | Description | | ---------------------------------- | -------- | -------- | --------------------------------------------- | | /auth/action | GET | true | Default oob ui | | /auth/action | POST | true | Handle for oob action | | /auth/oauth | GET | true | Get oauth user profile | | /auth/oob | GET | true | Check an oob code | | /auth/oob | POST | true | Handle oob actions | | /auth/oob | PUT | true | Send oob emails | | /auth/public | GET | true | Get user public profiles | | /auth | DELETE | true | Logout or delete account | | /auth | POST | true | Log a user in | | /auth | PUT | true | Create new account | | /auth/token | GET | true | exchange the refresh token for a new id token | | /auth/user | GET | true | Get auth user profile | | /auth/user | PATCH | true | Update auth user data |

DISABLED Default oob ui

Request query

| Name | Type | Description | | ----------- | ---------- | ----------- | | mode | string | | | oobCode | string | |

Response

string


DISABLED Handle for oob action

Request body

| Name | Type | Description | | ------------ | ---------- | ----------- | | mode | string | | | oobCode | string | | | newPassword? | string | |

Response

object


DISABLED Get oauth user profile

Request query

| Name | Type | Description | | --------------- | ------------------ | ----------- | | providerId | UserProviderId | | | accessToken | string | |

Response

object


DISABLED Check an oob code

Request query

| Name | Type | Description | | ----------- | ---------- | ----------- | | oobCode | string | | | mode | string | |

Response

object


DISABLED Handle oob actions

Request body

| Name | Type | Description | | ------------ | ---------- | ----------- | | oobCode | string | | | mode | string | | | newPassword? | string | |

Response

void


DISABLED Send oob emails

Request body

| Name | Type | Description | | --------- | ---------- | ----------- | | mode | string | | | email | string | |

Response

void


DISABLED Get user public profiles

Request query

| Name | Type | Description | | ----- | ---------- | ----------- | | uid? | string | | | uids? | string | |

Response

UserProfile | object


DISABLED Logout or delete account

Request body

| Name | Type | Description | | -------------- | ----------- | ----------- | | cancelAccount? | boolean | | | refreshToken? | string | |

Middleware data

| Name | Type | Description | | -------- | -------------- | ----------- | | user | UserObject | |

Response

void


DISABLED Log a user in

Request body

| Name | Type | Description | | -------------- | ----------- | ----------- | | email? | string | | | password? | string | | | customToken? | string | | | offlineAccess? | boolean | |

Response

Record<string, unknown>


DISABLED Create new account

Request body

| Name | Type | Description | | --------- | ---------- | ----------- | | email? | string | | | password? | string | |

Response

object


DISABLED exchange the refresh token for a new id token

Request query

| Name | Type | Description | | ---------------- | ---------- | ----------- | | refreshToken | string | |

Response

object


DISABLED Get auth user profile

Middleware data

| Name | Type | Description | | -------- | -------------- | ----------- | | user | UserObject | |

Response

UserInfo


DISABLED Update auth user data

Request body

| Name | Type | Description | | ---------------- | --------------------------- | ----------- | | profile? | UserEditableProfile | | | additionalData? | Record<string, unknown> | | | settings? | Record<string, unknown> | | | publicly? | string[ ] | | | privately? | string[ ] | | | username? | string | | | currentPassword? | string | | | newPassword? | string | |

Middleware data

| Name | Type | Description | | -------- | -------------- | ----------- | | user | UserObject | |

Response

UserInfo


License

@sheetbase/auth is released under the MIT license.