Skip to content

Instantly share code, notes, and snippets.

@devonzuegel
Created June 18, 2017 00:30
Show Gist options
  • Select an option

  • Save devonzuegel/f7cd0870e11bdff1ae9151544ae05641 to your computer and use it in GitHub Desktop.

Select an option

Save devonzuegel/f7cd0870e11bdff1ae9151544ae05641 to your computer and use it in GitHub Desktop.
interface BaseRule {
enforce?: 'pre' | 'post';
test?: Condition | Condition[]; /** A condition that must be met */
exclude?: Condition | Condition[]; /** A condition that must not be met */
include?: Condition | Condition[]; /** A condition that must be met */
resource?: Condition | Condition[]; /** A Condition matched with the resource. */
issuer?: Condition | Condition[]; /** A condition matched with the issuer */
parser?: { [optName: string]: any };
rules?: Rule[]; /** An array of Rules that is also used when the Rule matches. */
oneOf?: Rule[]; /** An array of Rules from which only the first matching Rule is used when the Rule matches. */
}
// Direct Rules
interface NewUseRule extends BaseDirectRule {
test: Condition | Condition[]; /** A condition that must be met */
use: Loader | Loader[]; /** A loader or array of loaders */
}
// Delegate Rules
interface RulesRule extends BaseRule {
rules: Rule[]; /** An array of Rules that is also used when the Rule matches. */
}
interface OneOfRule extends BaseRule {
oneOf: Rule[];
}
type Rule = NewUseRule | RulesRule | OneOfRule;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment