@octaviaflow/flow-rules 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Cloud Storage Action Configuration (the unified action users add)
3
+ *
4
+ * This contract is DERIVED from `storageCapabilities.ts` — the same table
5
+ * StorageConfigPanel renders from — so the panel and the contract cannot
6
+ * disagree about which keys exist. Three groups:
7
+ *
8
+ * 1. Fixed keys every operation shares (`connector`, `operation`, …) and the
9
+ * Transfer / Sync keys (`destConnector`, `destPath`, `cursor`, …).
10
+ * 2. One `string` per path / destination key any provider uses (`key`, `blob`,
11
+ * `remotePath`, `path`, `prefix`, `fileId`, `folderId`, `destKey`, …) and
12
+ * its `<key>Name` companion — the picked item's display name, written by
13
+ * the FilePicker and never read by the Engine.
14
+ * 3. Every extra field any operation declares (`maxKeys`, `expiresIn`,
15
+ * `contentType`, `mode`, `query`, `pageSize`, `fileName`, `mimeType`,
16
+ * `shareEmail`, `shareRole`, `ifExists`, `onError`), typed from its spec.
17
+ *
18
+ * Plus the three keys the Engine reads from config ahead of the connector's
19
+ * credentials: `bucket`, `container`, `region`.
20
+ *
21
+ * Which keys an OPERATION needs is per provider × operation and lives in the
22
+ * capability table; `validate()` checks only what blocks execution for
23
+ * every provider.
24
+ */
25
+ import { type StorageOperation } from '../storageCapabilities';
26
+ type StorageSchemaField = {
27
+ type: string;
28
+ required?: boolean;
29
+ options?: ReadonlyArray<string | number>;
30
+ description?: string;
31
+ min?: number;
32
+ };
33
+ export interface StorageActionConfigType {
34
+ /** The storage connector instance (a connection id); its provider decides the operations. */
35
+ connector: string;
36
+ operation: StorageOperation;
37
+ /** Name of this step's output in the run's data bag. */
38
+ outputAs?: string;
39
+ /** upload: the body. */
40
+ content?: string;
41
+ /** transfer / sync: the destination connector instance. */
42
+ destConnector?: string;
43
+ /** transfer / sync: destination path (a folder when empty or ending in `/`). */
44
+ destPath?: string;
45
+ /** transfer: copy a folder recursively. */
46
+ sourceIsDirectory?: boolean;
47
+ /** sync: the walk cursor threaded by a cursor ForEach — `{{$item.cursor}}` in the editor. */
48
+ cursor?: unknown;
49
+ /** sync: files per pass (200 by default). */
50
+ fileBudget?: number;
51
+ /** sync: milliseconds per pass (120000 by default). */
52
+ timeBudgetMs?: number;
53
+ /** list: keep only these extensions. */
54
+ fileTypes?: string[];
55
+ /** list: keep only names matching this glob. */
56
+ filePattern?: string;
57
+ /** S3 / GCS: overrides the connector's bucket. */
58
+ bucket?: string;
59
+ /** Azure: overrides the connector's container. */
60
+ container?: string;
61
+ /** S3: overrides the connector's region. */
62
+ region?: string;
63
+ /** Path, destination, companion-name and extra keys — see the capability table. */
64
+ [key: string]: unknown;
65
+ }
66
+ /** Every operation value any provider offers, in first-seen order. */
67
+ export declare function storageOperations(): StorageOperation[];
68
+ export declare const StorageActionConfig: {
69
+ defaults: StorageActionConfigType;
70
+ schema: Record<string, StorageSchemaField>;
71
+ validate: (config: Partial<StorageActionConfigType>) => {
72
+ valid: boolean;
73
+ errors: string[];
74
+ };
75
+ merge: (userConfig: Partial<StorageActionConfigType>) => StorageActionConfigType;
76
+ getLabel: (config: StorageActionConfigType) => string;
77
+ };
78
+ export {};
@@ -0,0 +1,123 @@
1
+ /**
2
+ * XML Action Configuration
3
+ *
4
+ * What XmlConfigPanel writes and the Engine's xml_action case reads.
5
+ */
6
+ import { type FileEditConfigType, type FileFormatOperation } from '../fileEditContract';
7
+ export interface XmlActionConfigType extends FileEditConfigType {
8
+ /** `parse` (default when absent) | `generate` | `edit`. */
9
+ operation: FileFormatOperation;
10
+ /** Legacy alias for `operation`. */
11
+ mode?: string;
12
+ /** XML text, or an FX token from an upstream step. */
13
+ content?: string;
14
+ /** Legacy alias for `content`. */
15
+ inlineContent?: string;
16
+ /** `generate`: the document's root element (`data` by default). */
17
+ rootElement?: string;
18
+ /** The element that holds one record (`row` by default on generate; detected on parse). */
19
+ rowElement?: string;
20
+ /** `generate`: name of the produced file. */
21
+ fileName?: string;
22
+ }
23
+ export declare const XmlActionConfig: {
24
+ defaults: XmlActionConfigType;
25
+ schema: {
26
+ editOperation: {
27
+ readonly type: "select";
28
+ readonly required: false;
29
+ readonly options: readonly import("../fileEditContract").FileEditOperation[];
30
+ readonly description: "How the file is edited: append rows, update rows by key, upsert, or set fields on matching rows";
31
+ };
32
+ keyField: {
33
+ readonly type: "string";
34
+ readonly required: false;
35
+ readonly description: "Match key column for update / upsert";
36
+ };
37
+ mergeUpdate: {
38
+ readonly type: "boolean";
39
+ readonly required: false;
40
+ readonly description: "false replaces the whole matched row; default merges";
41
+ };
42
+ matchField: {
43
+ readonly type: "string";
44
+ readonly required: false;
45
+ readonly description: "set_fields: column the row filter reads";
46
+ };
47
+ matchOp: {
48
+ readonly type: "select";
49
+ readonly required: false;
50
+ readonly options: readonly import("../fileEditContract").FileEditMatchOp[];
51
+ readonly description: "set_fields: comparison; \"=\" by default";
52
+ };
53
+ matchValue: {
54
+ readonly type: "string";
55
+ readonly required: false;
56
+ readonly description: "set_fields: value compared against";
57
+ };
58
+ setFields: {
59
+ readonly type: "object";
60
+ readonly required: false;
61
+ readonly description: "set_fields: { column: newValue } applied to matching rows";
62
+ };
63
+ destination: {
64
+ readonly type: "select";
65
+ readonly required: false;
66
+ readonly options: readonly import("../fileEditContract").FileEditDestination[];
67
+ readonly description: "\"new\" writes an edited copy (default); \"in_place\" overwrites an S3 source";
68
+ };
69
+ outputFileName: {
70
+ readonly type: "string";
71
+ readonly required: false;
72
+ readonly description: "Name of the edited copy when destination is \"new\"";
73
+ };
74
+ source: {
75
+ readonly type: "select";
76
+ readonly required: false;
77
+ readonly options: readonly import("../fileEditContract").FileEditSource[];
78
+ readonly description: "Where the file to edit comes from; inferred from content when absent";
79
+ };
80
+ s3Key: {
81
+ readonly type: "string";
82
+ readonly required: false;
83
+ readonly description: "source \"s3\": platform-bucket key of the file to edit";
84
+ };
85
+ url: {
86
+ readonly type: "url";
87
+ readonly required: false;
88
+ readonly description: "source \"url\": the file to edit is fetched from here";
89
+ };
90
+ operation: {
91
+ type: string;
92
+ required: boolean;
93
+ options: readonly FileFormatOperation[];
94
+ description: string;
95
+ };
96
+ content: {
97
+ type: string;
98
+ required: boolean;
99
+ description: string;
100
+ };
101
+ rootElement: {
102
+ type: string;
103
+ required: boolean;
104
+ description: string;
105
+ };
106
+ rowElement: {
107
+ type: string;
108
+ required: boolean;
109
+ description: string;
110
+ };
111
+ fileName: {
112
+ type: string;
113
+ required: boolean;
114
+ description: string;
115
+ };
116
+ };
117
+ validate: (config: Partial<XmlActionConfigType>) => {
118
+ valid: boolean;
119
+ errors: string[];
120
+ };
121
+ merge: (userConfig: Partial<XmlActionConfigType>) => XmlActionConfigType;
122
+ getLabel: (config: XmlActionConfigType) => string;
123
+ };
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Connector Trigger Configuration
3
+ *
4
+ * What ConnectorTriggerPanel writes, what the Backend derives the
5
+ * registration from (`connectorInstanceId` + `events`, see
6
+ * connectorTriggerSync), and the one key the Engine reads (`description`).
7
+ *
8
+ * `connectorId`, `connectorName`, `subscribed`, `eventCount` and `summary` are
9
+ * written by the panel (and by the Backend on an agent's behalf) so the canvas
10
+ * and `check_flow` can read the registration without a second lookup. The
11
+ * Google Sheets keys apply only when `connectorId` is `google_sheets`.
12
+ */
13
+ import { type ConnectorTriggerEvent } from './events';
14
+ export interface ConnectorTriggerConfigType {
15
+ /** The connected app instance (a connection id). */
16
+ connectorInstanceId: string;
17
+ /** `[{ entity, operations: [...] }]` — exact names from the connector's vocabulary. Registers the trigger. */
18
+ events?: ConnectorTriggerEvent[];
19
+ /** Connector TYPE of the instance (`hubspot`, `google_sheets`, …), not an id. */
20
+ connectorId?: string;
21
+ /** Display name of the instance. */
22
+ connectorName?: string;
23
+ /** Registration snapshot: a subscription exists. */
24
+ subscribed?: boolean;
25
+ /** Registration snapshot: entity × operation pairs subscribed. */
26
+ eventCount?: number;
27
+ /** Registration snapshot: `Hubspot · 2 events`. */
28
+ summary?: string;
29
+ /** Google Sheets: the spreadsheet watched. */
30
+ sheetFileId?: string;
31
+ /** Google Sheets: the spreadsheet's name, for display. */
32
+ sheetFileLabel?: string;
33
+ /** Google Sheets: the tab watched. */
34
+ sheetName?: string;
35
+ /** Google Sheets: the column that identifies a row, for change detection. */
36
+ sheetKeyColumn?: string;
37
+ /** Free text the Engine adds to the trigger's output when set. */
38
+ description?: string;
39
+ }
40
+ export declare const ConnectorTriggerConfig: {
41
+ defaults: ConnectorTriggerConfigType;
42
+ schema: {
43
+ connectorInstanceId: {
44
+ type: string;
45
+ required: boolean;
46
+ description: string;
47
+ };
48
+ events: {
49
+ type: string;
50
+ required: boolean;
51
+ description: string;
52
+ };
53
+ connectorId: {
54
+ type: string;
55
+ required: boolean;
56
+ description: string;
57
+ };
58
+ connectorName: {
59
+ type: string;
60
+ required: boolean;
61
+ description: string;
62
+ };
63
+ subscribed: {
64
+ type: string;
65
+ required: boolean;
66
+ description: string;
67
+ };
68
+ eventCount: {
69
+ type: string;
70
+ required: boolean;
71
+ description: string;
72
+ };
73
+ summary: {
74
+ type: string;
75
+ required: boolean;
76
+ description: string;
77
+ };
78
+ sheetFileId: {
79
+ type: string;
80
+ required: boolean;
81
+ description: string;
82
+ };
83
+ sheetFileLabel: {
84
+ type: string;
85
+ required: boolean;
86
+ description: string;
87
+ };
88
+ sheetName: {
89
+ type: string;
90
+ required: boolean;
91
+ description: string;
92
+ };
93
+ sheetKeyColumn: {
94
+ type: string;
95
+ required: boolean;
96
+ description: string;
97
+ };
98
+ description: {
99
+ type: string;
100
+ required: boolean;
101
+ description: string;
102
+ };
103
+ };
104
+ validate: (config: Partial<ConnectorTriggerConfigType>) => {
105
+ valid: boolean;
106
+ errors: string[];
107
+ };
108
+ merge: (userConfig: Partial<ConnectorTriggerConfigType>) => ConnectorTriggerConfigType;
109
+ getLabel: (config: ConnectorTriggerConfigType) => string;
110
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * What a Connector Trigger can subscribe to, per connector.
3
+ *
4
+ * ONE vocabulary for the editor's panel and for an agent authoring over MCP.
5
+ * The trigger's `events` — `[{ entity, operations }]` — is what registers the
6
+ * flow's connector subscription, the record every inbound provider event is
7
+ * matched against: an entity name outside this list (or in the wrong case —
8
+ * HubSpot is lowercase, Salesforce is capitalised) registers a subscription
9
+ * that never fires, with no error anywhere. An agent wrote `lead` for a
10
+ * HubSpot contact trigger on 2026-09-26 and spent an hour on it.
11
+ *
12
+ * Copied as-is from octaviaflow-ui's ConnectorTriggerPanel (the panel's tables
13
+ * were the only copy); the panel is to import from here in its next flow-rules
14
+ * upgrade.
15
+ */
16
+ export interface ConnectorEventEntity {
17
+ entity: string;
18
+ supportedOperations: string[];
19
+ }
20
+ /** One subscribed pair, as stored in a trigger step's `events`. */
21
+ export interface ConnectorTriggerEvent {
22
+ entity: string;
23
+ operations: string[];
24
+ }
25
+ /**
26
+ * Connector ids that emit events a flow trigger can subscribe to. Database /
27
+ * http / openapi / ftp / etc. connectors are intentionally excluded: they
28
+ * cannot push events.
29
+ */
30
+ export declare const EVENT_CAPABLE_CONNECTOR_IDS: ReadonlySet<string>;
31
+ /** Every subscribable entity, by connector id. */
32
+ export declare const CONNECTOR_EVENT_ENTITIES: Readonly<Record<string, ConnectorEventEntity[]>>;
33
+ export declare function getEntitiesForConnector(connectorId: string): ConnectorEventEntity[];
34
+ /** True when this connector type can drive an event trigger. */
35
+ export declare function isEventCapableConnector(connectorId: string): boolean;
36
+ /**
37
+ * The one-line summary the canvas shows under a Connector Trigger
38
+ * (`Hubspot · 4 events`) — the same string the panel writes.
39
+ */
40
+ export declare function summarizeConnectorTriggerEvents(connectorName: string, events: ConnectorTriggerEvent[]): string;
41
+ /**
42
+ * Why `events` cannot register a trigger on this connector — or `null` when
43
+ * it can. Names are matched EXACTLY, because the inbound matcher matches them
44
+ * exactly; a case-only miss says what was meant.
45
+ */
46
+ export declare function validateConnectorTriggerEvents(connectorId: string, events: unknown): string | null;