UNPKG

@openfga/syntax-transformer

Version:

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

44 lines (43 loc) 1.16 kB
/** * Represents a property contained in the `fga.mod` file, includes the value as well as line an * column information to allow improved error reporting. */ export interface ModFileProperty<T> { /** * The value of the property. */ value: T; /** * The start and end line number of the property. */ line: { start: number; end: number; }; /** * The start and end column number of the property. */ column: { start: number; end: number; }; } /** * An `fga.mod` file represented as JSON */ export interface ModFile { /** * The schema version. This currently will only be 1.2 */ schema: ModFileProperty<string>; /** * The individual files that make up the modular model. */ contents: ModFileProperty<ModFileProperty<string>[]>; } /** * Transforms an `fga.mod` file into the JSON representation and validate the fields are correct. * @param {string} modFile - The `fga.mod` file * @returns {ModFile} The jSON representation of the `fga.mod` file. */ export declare const transformModFileToJSON: (modFile: string) => ModFile;