
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
@openfga/syntax-transformer
Advanced tools
Javascript implementation of ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax
Javascript implementation of ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax
npm install @openfga/syntax-transformer
For details on the supported Node.js versions and our support policy, see SUPPORTED_RUNTIMES.md.
Example transform DSL model to JSON, and from JSON to DSL.
import { transformer } from "@openfga/syntax-transformer";
let dslString = `model
schema 1.1
type user
type folder
relations
define viewer: [user]`;
// Transform from DSL model to a JSON object
const generatedJsonObject = transformer.transformDSLToJSONObject(dslString);
// Transform from DSL to a JSON string
const generatedJsonString = transformer.transformDSLToJSONString(dslString);
// Transform from a JSON string to DSL
const generatedDsl = transformer.transformJSONStringToDSL(generatedJsonString);
import { transformer } from "@openfga/syntax-transformer";
...
const modFileContents = `schema: "1.2"
contents:
- core.fga
- board.fga
- wiki.fga`
// Transform from fga.mod to an object
const jsonModFile = transformer.TransformModFile(modFileContents)
import { transformer } from "@openfga/syntax-transformer";
...
const files: transformer.ModuleFile[] = [];
files.push({
name: "core.fga",
contents: `module core
type user`
},
{
name: "board.fga",
contents: `module core
type board`
},
{
name: "wiki.fga",
contents: `module core
type wiki`
}
);
// Compile module files into a complete model
const jsonModel = transformer.transformModuleFilesToModel(files, "1.2");
/*
{
"schema_version": "1.2",
"type_definitions": [
{
"type": "user",
"metadata": {
"module": "core",
"source_info": {
"file": "core.fga"
}
}
},
{
"type": "board",
"metadata": {
"module": "core",
"source_info": {
"file": "board.fga"
}
}
},
{
"type": "wiki",
"metadata": {
"module": "core",
"source_info": {
"file": "wiki.fga"
}
}
}
]
}
*/
import { errors, validator } from "@openfga/syntax-transformer";
...
let dslString = `model
schema 1.2
type user
type folder
relations
define viewer: [user]`;
// Attempt validation of model
try {
validator.validateDSL(dslString);
} catch (err) {
if (err instanceof errors.BaseMultiError) {
// Handle generated errors
} else {
console.error("Unhandled Exception: " + err);
}
}
This project is licensed under the Apache-2.0 license. See the LICENSE file for more info.
FAQs
Javascript implementation of ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax
The npm package @openfga/syntax-transformer receives a total of 42,578 weekly downloads. As such, @openfga/syntax-transformer popularity was classified as popular.
We found that @openfga/syntax-transformer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.