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

@openfga/syntax-transformer

v0.1.6

Published

ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax

Downloads

26,547

Readme

OpenFGA Language

ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax

Go Reference Release License FOSSA Status Join our community Twitter

Table of Contents

About

OpenFGA is an open source Fine-Grained Authorization solution inspired by Google's Zanzibar paper. It was created by the FGA team at Auth0 based on Auth0 Fine-Grained Authorization (FGA), available under a permissive license (Apache-2) and welcomes community contributions.

OpenFGA is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. OpenFGA’s design is optimized for reliability and low latency at a high scale.

Resources

About This Repo

This repo contains everything needed to interact with the OpenFGA Authorization Models schema versions 1.1+, in multiple languages (currently, Go and JS are supported).

| Feature | Implemented in ANTLR | |------------|----------------------| | Basic DSL | ✅ | | Nesting | ✅ (partial, see #113) | | Conditions | ✅ |

| Feature | Go | JS | Java | |-------------------------------------------------------|----------------------|--------------|-----------------------| | Transformer from the DSL to JSON and from JSON to DSL | ✅ | ✅ | ✅ | | Syntactic Model Validations | ✅ | ✅ | ✅ | | Semantic Model Validations | ❌ (planned, see #99) | ✅ | ✅ | | Graphing & Utility Methods | ❌ (planned) | ❌ (planned) | ❌ (planned) |

Installation

Go

go get github.com/openfga/language/pkg/go

Node

npm install @openfga/syntax-transformer@beta

Usage

Transformer

Go

import "github.com/openfga/language/pkg/go/transformer"

dslString := `model
  schema 1.1
type user
type folder
  relations
    define viewer: [user]`

// Transform from DSL to a JSON string
generatedJsonString, err := transformer.TransformDSLToJSONString(dslString)

// Transform from a JSON string to DSL
generatedDsl, err := transformer.TransformJSONStringToDSL(generatedJsonString)

Node

import { transformer } from "@openfga/syntax-transformer"

let dslString = `model
  schema 1.1
type user
type folder
  relations
    define viewer: [user]`;

// Transform from DSL to a JSON string
const generatedJsonString = transformer.transformDSLToJSONString(dslString)

// Transform from a JSON string to DSL
const generatedDsl = transformer.transformJSONStringToDSL(generatedJsonString)

Java

import dev.openfga.language.DslToJsonTransformer;
import dev.openfga.language.JsonToDslTransformer;

var dslString = """model
  schema 1.1
type user
type folder
  relations
    define viewer: [user]""";

// Transform from DSL to a JSON string
var generatedJsonString = new DslToJsonTransformer().transform(dslString);

// Transform from a JSON string to DSL
var generatedDsl = new JsonToDslTransformer().transform(generatedJsonString);

CLI

Use the FGA CLI

Community Parsers

| Repo | License | Maintainers | Language | Schema v1.0 | Schema v1.1 | Package Managers | Other Links | |------------------------------------------------------------------------------|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|-------------------------------------------|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | openfga language (syntax-transformer) | Apache-2.0 | @openfga | ANTLR (Go and Typescript implementations) | <0.1.5 | Yes (v0.0.8+) | npm:@openfga/syntax-transformer - GitHub release (latest SemVer) | | | openfga-dsl-parser | Apache-2.0 | @maxmindlin - @dblclik | Rust | Yes | No | crates:openfga-dsl-parserpypi:openfga-dsl-parser-python | WASM - Python | | openfga-rs | Apache-2.0 | @iammathew | Rust | Yes | No | | | | openfga-dsl-parser | Apache-2.0 | @craigpastro | ANTLR & Go | Yes | Partial (requires self). Supports nesting | GitHub release (latest SemVer) | |

Community Wrapper

| Repo | License | Maintainers | Language | Schema v1.0 | Schema v1.1 | Package Managers | Other Links | |-----------------------------------------------------------------------|-------------------------------------------------------------------------|----------------------------------------------------|------------|-------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------| | fga cli | Apache-2.0 | @openfga | Go | No | Yes | GitHub release (latest SemVer) | | | fga-transformer-cli | MIT | @ozee-io | Javascript | Yes | Yes | npm:@openfga/syntax-transformer | |

Contributing

See CONTRIBUTING.

Author

OpenFGA

License

This project is licensed under the Apache-2.0 license. See the LICENSE file for more info.