Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

@sms/plugin-automation

Interfaces

AutomationOptions

Defined in: packages/plugins/automation/src/types.ts:33

Properties

scheduleLimit?
optional scheduleLimit?: number;

Defined in: packages/plugins/automation/src/types.ts:37

Max records one scheduled run considers. Default 500.

tickEveryMs?
optional tickEveryMs?: number;

Defined in: packages/plugins/automation/src/types.ts:35

How often the host-driven scheduler checks for due scheduled automations. Default 60 000.


AutomationSpec

Defined in: packages/plugins/automation/src/types.ts:20

Runs after records of model are created/written/unlinked, or on a schedule. watch narrows write triggers to those fields; filter must match the record after the op (ignored on unlink). Actions run with a sudo context.

Properties

action
action: AutomationAction;

Defined in: packages/plugins/automation/src/types.ts:29

active?
optional active?: boolean;

Defined in: packages/plugins/automation/src/types.ts:30

everyMinutes?
optional everyMinutes?: number;

Defined in: packages/plugins/automation/src/types.ts:28

For trigger schedule: interval in minutes.

filter?
optional filter?: Domain;

Defined in: packages/plugins/automation/src/types.ts:26

id
id: string;

Defined in: packages/plugins/automation/src/types.ts:21

label
label: string;

Defined in: packages/plugins/automation/src/types.ts:22

model
model: string;

Defined in: packages/plugins/automation/src/types.ts:23

trigger
trigger: AutomationTrigger;

Defined in: packages/plugins/automation/src/types.ts:24

watch?
optional watch?: string[];

Defined in: packages/plugins/automation/src/types.ts:25

Type Aliases

AutomationAction

type AutomationAction = 
  | {
  args?: Values;
  kind: "method";
  method: string;
}
  | {
  kind: "update";
  values: Values;
}
  | {
  body: string;
  kind: "message";
}
  | {
  handler: (env, ids) => unknown | Promise<unknown>;
  kind: "handler";
};

Defined in: packages/plugins/automation/src/types.ts:8

Union Members

Type Literal
{
  args?: Values;
  kind: "method";
  method: string;
}

Type Literal
{
  kind: "update";
  values: Values;
}

Type Literal
{
  body: string;
  kind: "message";
}

Posts a note on every matching record through the audit key (no-op when audit is absent).


Type Literal
{
  handler: (env, ids) => unknown | Promise<unknown>;
  kind: "handler";
}

AutomationTrigger

type AutomationTrigger = "create" | "write" | "create_or_write" | "unlink" | "schedule";

Defined in: packages/plugins/automation/src/types.ts:6

Variables

AUTOMATION_POINT

const AUTOMATION_POINT: "automation" = 'automation';

Defined in: packages/plugins/automation/src/types.ts:4

@sms/plugin-automation/contract — the automation point, its item types and validator, and the table the scheduled runs live in. No manifest, no plugin body (createAutomationPlugin lives in index.ts).


AUTOMATION_RUN_TABLE

const AUTOMATION_RUN_TABLE: "au_automation_run" = 'au_automation_run';

Defined in: packages/plugins/automation/src/schedule.ts:10


automationPlugin

const automationPlugin: SystemPlugin;

Defined in: packages/plugins/automation/src/index.ts:83

Functions

createAutomationPlugin()

function createAutomationPlugin(opts?): SystemPlugin;

Defined in: packages/plugins/automation/src/index.ts:42

Parameters

ParameterType
optsAutomationOptions

Returns

SystemPlugin


validateAutomation()

function validateAutomation(item): void;

Defined in: packages/plugins/automation/src/types.ts:57

@sms/plugin-automation/contract — the automation point, its item types and validator, and the table the scheduled runs live in. No manifest, no plugin body (createAutomationPlugin lives in index.ts).

Parameters

ParameterType
itemunknown

Returns

void