/** * Representation of a constructed OADA rule for rules engine * @example * ```json * { * "type": "application/json", * "enabled": true, * "path": "/bookmarks/foo", * "on": "new", * "services": [ * "test-service" * ], * "actions": { * "test-action": { * "action": { * "_id": "resources/foo", * "_rev": 1 * }, * "options": { * "foo": 1, * "bar": "a" * } * } * }, * "conditions": {} * } * ``` * * * File automatically generated using json-schema-to-typescript. * ! DO NOT MODIFY IT BY HAND ! * Instead, modify the source file ./trellis/rules/configured.schema.json of @oada/formats * and run `$ yarn build` to regenerate this file. * * @packageDocumentation */ /** * `$id` of the source schema * @see {@link https://formats.openag.io/trellis/rules/configured.schema.json} */ export declare const $id = "https://formats.openag.io/trellis/rules/configured.schema.json"; /** * JSON Schema used to generate this type * @see {@link https://formats.openag.io/trellis/rules/configured.schema.json} */ export declare const schema: { readonly $id: "https://formats.openag.io/trellis/rules/configured.schema.json"; readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly description: "Representation of a constructed OADA rule for rules engine"; readonly properties: { readonly enabled: { readonly description: "Wether this rule should be active"; readonly type: "boolean"; readonly default: true; }; readonly services: { readonly description: "Array of the names of the services involved in this rule"; readonly $comment: "Should this be here?"; readonly type: "array"; readonly items: { readonly type: "string"; }; readonly uniqueItems: true; }; readonly type: { readonly description: "Content-type this rule applies to"; readonly type: "string"; }; readonly on: { readonly $comment: "Where should this definiton live?"; readonly description: "Whether to trigger on new item, changed item, etc."; readonly oneOf: readonly [{ readonly description: "Trigger on a new item being added"; readonly enum: readonly ["new"]; }, { readonly description: "Trigger on any change to an item"; readonly enum: readonly ["change"]; }]; readonly default: "new"; }; readonly path: { readonly description: "The path to an OADA list to which to apply this rule"; readonly $ref: "../../oada.schema.json#/definitions/path"; }; readonly conditions: { readonly description: "List of conditions involved in this rule"; readonly additionalProperties: { readonly description: "Particular condition involved in this rule"; readonly type: "object"; readonly properties: { readonly condition: { readonly description: "A link to the condition document"; readonly $ref: "../../oada/link/v1.schema.json#/definitions/versioned"; }; readonly options: { readonly description: "Parameter values for this condition"; readonly type: "object"; }; }; readonly required: readonly ["condition"]; }; }; readonly actions: { readonly description: "List of actions involved in this rule"; readonly additionalProperties: { readonly description: "Particular action involved in this rule"; readonly type: "object"; readonly properties: { readonly action: { readonly description: "A link to the action document"; readonly $ref: "../../oada/link/v1.schema.json#/definitions/versioned"; }; readonly options: { readonly description: "Parameter values for this action"; readonly type: "object"; }; }; readonly required: readonly ["action"]; }; }; }; readonly required: readonly ["type", "path", "conditions", "actions"]; readonly examples: readonly [{ readonly type: "application/json"; readonly enabled: true; readonly path: "/bookmarks/foo"; readonly on: "new"; readonly services: readonly ["test-service"]; readonly actions: { readonly 'test-action': { readonly action: { readonly _id: "resources/foo"; readonly _rev: 1; }; readonly options: { readonly foo: 1; readonly bar: "a"; }; }; }; readonly conditions: {}; }]; }; /** * Returns true if `val` is a @type `ConfiguredSchema`, false otherwise */ export declare function is(val: unknown): val is ConfiguredSchema; /** * Asserts that `val` is a @type `ConfiguredSchema` */ export declare function assert(val: unknown): asserts val is ConfiguredSchema; /** * Representation of a constructed OADA rule for rules engine * @example * ```json * { * "type": "application/json", * "enabled": true, * "path": "/bookmarks/foo", * "on": "new", * "services": [ * "test-service" * ], * "actions": { * "test-action": { * "action": { * "_id": "resources/foo", * "_rev": 1 * }, * "options": { * "foo": 1, * "bar": "a" * } * } * }, * "conditions": {} * } * ``` * */ export default ConfiguredSchema; /** * Representation of a constructed OADA rule for rules engine */ export interface ConfiguredSchema { /** * Wether this rule should be active */ enabled?: boolean; /** * Array of the names of the services involved in this rule */ services?: string[]; /** * Content-type this rule applies to */ type: string; /** * Whether to trigger on new item, changed item, etc. */ on?: 'new' | 'change'; /** * The path to an OADA list to which to apply this rule */ path: string; /** * List of conditions involved in this rule */ conditions: { /** * Particular condition involved in this rule */ [k: string]: { condition: Versioned; /** * Parameter values for this condition */ options?: { [k: string]: unknown; }; [k: string]: unknown; }; }; /** * List of actions involved in this rule */ actions: { /** * Particular action involved in this rule */ [k: string]: { action: Versioned1; /** * Parameter values for this action */ options?: { [k: string]: unknown; }; [k: string]: unknown; }; }; [k: string]: unknown; } /** * A link to the condition document */ export interface Versioned { _id: string; /** * _rev is the revision for a resource in the OADA API. */ _rev: number; [k: string]: unknown; } /** * A link to the action document */ export interface Versioned1 { _id: string; /** * _rev is the revision for a resource in the OADA API. */ _rev: number; [k: string]: unknown; }