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

@solgt/supertokens-sync

v0.1.1

Published

Sync your Supertokens roles and permissions to a local file

Downloads

365

Readme

npm latest package

supertokens-sync 📡

         App 1          App 2          App 3          App 4
           |              |              |              |
   supertokens-sync  supertokens-sync  supertokens-sync  supertokens-sync
           |              |              |              |
           \______________|______________|______________/
                           |
                    ----------------
                   |                |
                   |   Supertokens  |
                   |      Core      |
                   |________________|

Sync your Supertokens roles and permissions to a local file. If you have many apps that need to be in sync with what roles and permissions actually exist in your Supertokens core instance while you develop or as a safety check during build, you can use supertokens-sync to maintain a central auth config file that includes roles, permissions and roles with permissions..

The script will retrieve roles and permissions from both Supertokens development and production cores, and perform a comparison. If there is a mismatch between the cores in terms of roles and permissions, the script will prioritize one set and generate a config file based on it (in the config you can select which to prioritize).

Prerequisites

Expected .env and .env.production populated with the required keys for operation.

If you have a local .prettierrc, the script will pick it up and format the output according it, otherwise prettier defaults will be used.

Usage

  • Navigate to your project root.
  • Install with npm i @solgt/supertokens-sync.
  • Run with npx supertokens-sync.
  • ⚠️ First run will create a local supertokens-sync-config.json (and will likely need to be set up).
  • Make use of the generated auth config file. The .ts version also exports types.

From here you can put npx supertokens-sync in front of your development command, during pre-build or just as an isolated command.

Caveats

Keys generated out of roles and permissions are capitalized, and any characters not a letter or a number will be replaced with an underscore. For example: if a permission is the string "read:feature:lists", the generated key will be READ_FEATURE_LISTS.

Configuration

The configuration file supertokens-sync-config.json is automaticaly generated with defaults when no config file is detected.

| Key | Possible Values | Default | | --------------------------- | ---------------------------- | ------------------------------ | | logLevel | "debug", "info" | "info" | | mode | "verify", "sync" | "sync" | | outputExtension | ".json", ".ts" | ".ts" | | outputPath | any valid path string | "./" | | outputFileName | any valid file name string | "supertokensAuthConfig" | | priority | "dev", "prod" | "prod" | | authConfigObjectName | string | "supertokensAuthConfig" | | envKeyNames | EnvKeyNames object | (required) | | envKeyNames.connectionUri | string | "SUPERTOKENS_CONNECTION_URI" | | envKeyNames.apiKey | string | "SUPERTOKENS_API_KEY" |

License

MIT