dcc-decoder
Version:
<img alttext="COVID Green Logo" src="https://raw.githubusercontent.com/lfph/artwork/master/projects/covidgreen/stacked/color/covidgreen-stacked-color.png" width="300" />
56 lines (55 loc) • 1.47 kB
TypeScript
import { CertLogicExpression } from 'certlogic-js';
export declare type RuleDesc = {
lang: string;
desc: string;
};
/**
* Types representing rules and rule sets, as read in from a JSON file.
*/
export declare type Rule = {
Identifier: string;
Country: string;
Logic: CertLogicExpression;
Description: RuleDesc[];
};
export declare type RuleSet = Rule[];
/**
* A type representing the “compressed” value sets.
*/
export declare type ValueSetsComputed = {
[valueSetId: string]: string[];
};
/**
* A type representing the external parameters object.
*/
export declare type ExternalParameters = {
valueSets: ValueSetsComputed;
[key: string]: unknown;
};
/**
* A type representing the data context passed to every rule.
*/
export declare type RuleEvaluationDataContext = {
payload: any;
external: ExternalParameters;
};
/**
* A type representing the evaluation of a single rule.
*/
export declare type RuleEvaluationResult = boolean | Error;
/**
* A type representing the evaluation of all rules (individually) in a rule set.
*/
export declare type RuleEvaluations = {
[ruleId: string]: RuleEvaluationResult;
};
/**
* A type representing the evaluation of all rules in a rule set,
* with derived properties for whether errors occurred,
* and whether all rules passed.
*/
export declare type RuleSetEvaluationResult = {
ruleEvaluations: RuleEvaluations;
hasErrors: boolean;
allSatisfied: boolean;
};