larsw / accumulo-access-ts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ts-accumulo-security

An parser generating evaluating functions for Accumulo security expressions.

Usage

import { parse } from 'ts-accumulo-security';

const expression = parse('(A && B) | C');

const result = expression.evaluate({
  labels: new Set(['A', 'B']
)});

API

parse(expression: string): EvalFn

Parses the given expression and returns an Evalfn object. Throws an error if the expression is invalid.

EvaluationContext

An object containing a field labels of type Set<string> with the authorized labels.

EvalFn: (ctx: EvaluationContext) => boolean

A function that evaluates the expression against the given context.

Development

Setup

bun install

Test

bun test

Build

bun build

Publish

npm publish

License

MIT (c) 2023 - Lars Wilhelmsen. See LICENSE for details.

About

License:MIT License


Languages

Language:TypeScript 100.0%