@ganju/utils 0.0.17 → 0.0.20
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.
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +21 -4
- package/dist/crypto.d.ts +2 -2
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +1 -0
- package/dist/customCodeToken.d.ts +4 -0
- package/dist/customCodeToken.d.ts.map +1 -1
- package/dist/customCodeToken.js +9 -1
- package/dist/data.d.ts +2 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +28 -1
- package/dist/dataApi.d.ts +133 -1
- package/dist/dataApi.d.ts.map +1 -1
- package/dist/dataApi.js +62 -1
- package/dist/dataDdl.d.ts.map +1 -1
- package/dist/dataDdl.js +3 -1
- package/dist/dataEngine.d.ts.map +1 -1
- package/dist/dataEngine.js +62 -0
- package/dist/dataRpc.d.ts +25 -0
- package/dist/dataRpc.d.ts.map +1 -1
- package/dist/dataTriggers.d.ts +203 -0
- package/dist/dataTriggers.d.ts.map +1 -0
- package/dist/dataTriggers.js +760 -0
- package/dist/dataTypes.d.ts +1 -0
- package/dist/dataTypes.d.ts.map +1 -1
- package/dist/index.d.ts +198 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -0
- package/dist/localizeDataError.d.ts +18 -0
- package/dist/localizeDataError.d.ts.map +1 -0
- package/dist/localizeDataError.js +359 -0
- package/dist/schema.d.ts +161 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +146 -1
- package/dist/sdkConstants.d.ts +3 -0
- package/dist/sdkConstants.d.ts.map +1 -1
- package/dist/sdkConstants.js +4 -1
- package/dist/whatsappTemplates.d.ts +77 -0
- package/dist/whatsappTemplates.d.ts.map +1 -0
- package/dist/whatsappTemplates.js +402 -0
- package/package.json +1 -1
- package/src/constants.ts +28 -4
- package/src/crypto.ts +3 -2
- package/src/customCodeToken.ts +14 -1
- package/src/data.ts +40 -0
- package/src/dataApi.ts +78 -2
- package/src/dataDdl.ts +3 -1
- package/src/dataEngine.ts +70 -0
- package/src/dataRpc.ts +15 -0
- package/src/dataTriggers.ts +1134 -0
- package/src/dataTypes.ts +3 -0
- package/src/index.ts +65 -1
- package/src/localizeDataError.ts +593 -0
- package/src/schema.ts +170 -1
- package/src/sdkConstants.ts +3 -0
- package/src/whatsappTemplates.ts +465 -0
package/dist/dataEngine.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.exportRows = exports.dropColumn = exports.updateColumn = exports.copyTab
|
|
|
6
6
|
// the tests and the tool-design eval. The runner executes; everything about
|
|
7
7
|
// which SQL is allowed and how results look is decided here.
|
|
8
8
|
const dataIdentifiers_1 = require("./dataIdentifiers");
|
|
9
|
+
const dataTriggers_1 = require("./dataTriggers");
|
|
9
10
|
const dataDdl_1 = require("./dataDdl");
|
|
10
11
|
const dataCompiler_1 = require("./dataCompiler");
|
|
11
12
|
const dataTypes_1 = require("./dataTypes");
|
|
@@ -91,6 +92,44 @@ exports.INTERNAL_MIGRATIONS = [
|
|
|
91
92
|
updated_at TEXT NOT NULL DEFAULT (${dataDdl_1.DATA_NOW_SQL}),
|
|
92
93
|
updated_by TEXT
|
|
93
94
|
) WITHOUT ROWID`
|
|
95
|
+
],
|
|
96
|
+
// Triggers: the owner's rules, the rows a write changed while one listens
|
|
97
|
+
// (emptied before the write commits), and the events waiting for the queue.
|
|
98
|
+
[
|
|
99
|
+
`CREATE TABLE IF NOT EXISTS _ganju_triggers (
|
|
100
|
+
id TEXT PRIMARY KEY,
|
|
101
|
+
name TEXT NOT NULL UNIQUE,
|
|
102
|
+
description TEXT,
|
|
103
|
+
table_id INTEGER NOT NULL,
|
|
104
|
+
event TEXT NOT NULL,
|
|
105
|
+
condition TEXT,
|
|
106
|
+
action TEXT NOT NULL,
|
|
107
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
108
|
+
disabled_reason TEXT,
|
|
109
|
+
managed TEXT,
|
|
110
|
+
rate_limit INTEGER NOT NULL DEFAULT 60,
|
|
111
|
+
secret TEXT,
|
|
112
|
+
created_at TEXT NOT NULL DEFAULT (${dataDdl_1.DATA_NOW_SQL}),
|
|
113
|
+
updated_at TEXT NOT NULL DEFAULT (${dataDdl_1.DATA_NOW_SQL}),
|
|
114
|
+
updated_by TEXT
|
|
115
|
+
) WITHOUT ROWID`,
|
|
116
|
+
'CREATE INDEX IF NOT EXISTS _ganju_triggers_table ON _ganju_triggers(table_id, event)',
|
|
117
|
+
`CREATE TABLE IF NOT EXISTS _ganju_changes (
|
|
118
|
+
id INTEGER PRIMARY KEY,
|
|
119
|
+
table_id INTEGER NOT NULL,
|
|
120
|
+
event TEXT NOT NULL,
|
|
121
|
+
row_id INTEGER NOT NULL,
|
|
122
|
+
actor TEXT,
|
|
123
|
+
old TEXT,
|
|
124
|
+
new TEXT
|
|
125
|
+
)`,
|
|
126
|
+
`CREATE TABLE IF NOT EXISTS _ganju_outbox (
|
|
127
|
+
seq INTEGER PRIMARY KEY,
|
|
128
|
+
id TEXT NOT NULL UNIQUE,
|
|
129
|
+
trigger_id TEXT NOT NULL,
|
|
130
|
+
message TEXT NOT NULL,
|
|
131
|
+
created_at TEXT NOT NULL DEFAULT (${dataDdl_1.DATA_NOW_SQL})
|
|
132
|
+
)`
|
|
94
133
|
]
|
|
95
134
|
];
|
|
96
135
|
exports.INTERNAL_SCHEMA_VERSION = exports.INTERNAL_MIGRATIONS.length;
|
|
@@ -1309,6 +1348,8 @@ const write = (runner, schema, caller, rawArgs) => {
|
|
|
1309
1348
|
(0, exports.assertWritable)(runner, caller, addsData);
|
|
1310
1349
|
return runner.transaction(() => {
|
|
1311
1350
|
setContextActor(runner, caller.actor);
|
|
1351
|
+
// Rows left by a change that wasn't a write (a schema change) fire nothing.
|
|
1352
|
+
runner.all('DELETE FROM _ganju_changes');
|
|
1312
1353
|
const results = [];
|
|
1313
1354
|
operations.forEach((op, index) => {
|
|
1314
1355
|
try {
|
|
@@ -1322,6 +1363,7 @@ const write = (runner, schema, caller, rawArgs) => {
|
|
|
1322
1363
|
throw error;
|
|
1323
1364
|
}
|
|
1324
1365
|
});
|
|
1366
|
+
(0, dataTriggers_1.collectTriggerEvents)(runner, schema, caller);
|
|
1325
1367
|
return { ok: true, results };
|
|
1326
1368
|
});
|
|
1327
1369
|
};
|
|
@@ -1674,6 +1716,8 @@ const dropTable = (runner, schema, caller, name) => {
|
|
|
1674
1716
|
dropTriggers(runner, table);
|
|
1675
1717
|
runner.all(`DROP TABLE IF EXISTS ${(0, dataIdentifiers_1.quoteIdentifier)((0, dataDdl_1.ftsTableName)(table))}`);
|
|
1676
1718
|
runner.all(`DROP TABLE ${(0, dataIdentifiers_1.quoteIdentifier)(table.name)}`);
|
|
1719
|
+
// Its triggers go with it; a later table of the same name starts with none.
|
|
1720
|
+
runner.all('DELETE FROM _ganju_triggers WHERE table_id = ?', [table.id]);
|
|
1677
1721
|
runner.all('UPDATE _ganju_tables SET display_column_id = NULL WHERE id = ?', [table.id]);
|
|
1678
1722
|
runner.all('DELETE FROM _ganju_columns WHERE table_id = ?', [table.id]);
|
|
1679
1723
|
runner.all('DELETE FROM _ganju_tables WHERE id = ?', [table.id]);
|
|
@@ -1964,6 +2008,16 @@ const copyTableStep = (runner, schema) => {
|
|
|
1964
2008
|
}
|
|
1965
2009
|
};
|
|
1966
2010
|
exports.copyTableStep = copyTableStep;
|
|
2011
|
+
// Triggers name columns in their conditions and texts, checked only when
|
|
2012
|
+
// saved: a column one of them uses can't be dropped under it.
|
|
2013
|
+
const assertNoTriggerUses = (runner, table, column) => {
|
|
2014
|
+
const triggers = (0, dataTriggers_1.triggersUsingColumn)(runner, table.id, column);
|
|
2015
|
+
if (triggers.length === 0)
|
|
2016
|
+
return;
|
|
2017
|
+
throw new dataTypes_1.DataError(triggers.length === 1
|
|
2018
|
+
? `${table.name}.${column} can't be dropped while the trigger ${triggers[0]} uses it; change or delete that trigger first.`
|
|
2019
|
+
: `${table.name}.${column} can't be dropped while the triggers ${triggers.join(', ')} use it; change or delete those triggers first.`, 'constraint', { triggers });
|
|
2020
|
+
};
|
|
1967
2021
|
const updateColumn = (runner, schema, caller, tableName, columnName, patch) => {
|
|
1968
2022
|
assertDdlAllowed(caller);
|
|
1969
2023
|
const table = tableNamed(schema, tableName);
|
|
@@ -1988,6 +2042,12 @@ const updateColumn = (runner, schema, caller, tableName, columnName, patch) => {
|
|
|
1988
2042
|
throw new dataTypes_1.DataError(`${table.name} already has a column "${draft.name}".`, 'conflict');
|
|
1989
2043
|
}
|
|
1990
2044
|
if ((0, exports.columnChangeNeedsRebuild)(schema, table.name, column.name, patch)) {
|
|
2045
|
+
// A rename renames the column in its triggers too; a copy can't, so the
|
|
2046
|
+
// two go one after the other.
|
|
2047
|
+
const triggers = draft.name !== column.name ? (0, dataTriggers_1.triggersUsingColumn)(runner, table.id, column.name) : [];
|
|
2048
|
+
if (triggers.length) {
|
|
2049
|
+
throw new dataTypes_1.DataError(`${table.name}.${column.name} is used by triggers (${triggers.join(', ')}): rename it on its own, then make the other changes.`, 'constraint', { triggers });
|
|
2050
|
+
}
|
|
1991
2051
|
return rebuildTable(runner, schema, caller, table, table.columns.map(c => ({ draft: c.id === column.id ? draft : c, id: c.id })), { column: column.name, kind: 'change' });
|
|
1992
2052
|
}
|
|
1993
2053
|
return runner.transaction(() => {
|
|
@@ -1995,6 +2055,7 @@ const updateColumn = (runner, schema, caller, tableName, columnName, patch) => {
|
|
|
1995
2055
|
dropTriggers(runner, table);
|
|
1996
2056
|
runner.all(`DROP TABLE IF EXISTS ${(0, dataIdentifiers_1.quoteIdentifier)((0, dataDdl_1.ftsTableName)(table))}`);
|
|
1997
2057
|
runner.all(`ALTER TABLE ${(0, dataIdentifiers_1.quoteIdentifier)(table.name)} RENAME COLUMN ${(0, dataIdentifiers_1.quoteIdentifier)(column.name)} TO ${(0, dataIdentifiers_1.quoteIdentifier)(draft.name)}`);
|
|
2058
|
+
(0, dataTriggers_1.renameColumnInTriggers)(runner, table.id, column.name, draft.name);
|
|
1998
2059
|
}
|
|
1999
2060
|
updateColumnMeta(runner, schema, table, column.id, draft);
|
|
2000
2061
|
touchTable(runner, table.id);
|
|
@@ -2011,6 +2072,7 @@ const dropColumn = (runner, schema, caller, tableName, columnName) => {
|
|
|
2011
2072
|
if (table.columns.length === 1) {
|
|
2012
2073
|
throw new dataTypes_1.DataError(`${table.name} needs at least one column; drop the table instead.`);
|
|
2013
2074
|
}
|
|
2075
|
+
assertNoTriggerUses(runner, table, column.name);
|
|
2014
2076
|
if ((0, exports.dropColumnNeedsRebuild)(schema, table.name, column.name)) {
|
|
2015
2077
|
return rebuildTable(runner, schema, caller, table, table.columns.filter(c => c.id !== column.id).map(c => ({ draft: c, id: c.id })), { column: column.name, kind: 'drop' }, column.id);
|
|
2016
2078
|
}
|
package/dist/dataRpc.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DataCaller, DataDeleteImpact, DataResult, DataSchema, DataTable, DataTableCopy } from './dataTypes';
|
|
2
2
|
import type { DataQuery } from './dataQueries';
|
|
3
|
+
import type { DataTrigger, DataTriggerWithSecret, SavedTrigger } from './dataTriggers';
|
|
3
4
|
export type ExportFormat = 'jsonl' | 'csv';
|
|
4
5
|
export interface ExportFile {
|
|
5
6
|
table: string | null;
|
|
@@ -136,6 +137,30 @@ export interface ProjectDatabaseRpc {
|
|
|
136
137
|
rows: Record<string, unknown>[];
|
|
137
138
|
truncated?: string;
|
|
138
139
|
}>;
|
|
140
|
+
listTriggers(caller: DataCaller): R<{
|
|
141
|
+
triggers: DataTrigger[];
|
|
142
|
+
pending: number;
|
|
143
|
+
}>;
|
|
144
|
+
getTrigger(nameOrId: string): R<DataTriggerWithSecret>;
|
|
145
|
+
saveTrigger(caller: DataCaller, input: unknown): R<SavedTrigger>;
|
|
146
|
+
dropTrigger(caller: DataCaller, name: string): R<{
|
|
147
|
+
dropped: string;
|
|
148
|
+
}>;
|
|
149
|
+
setTriggerEnabled(caller: DataCaller, args: {
|
|
150
|
+
name: string;
|
|
151
|
+
enabled: boolean;
|
|
152
|
+
reason?: string | null;
|
|
153
|
+
}): R<DataTrigger>;
|
|
154
|
+
replaceManagedTriggers(caller: DataCaller, inputs: unknown): R<{
|
|
155
|
+
triggers: DataTrigger[];
|
|
156
|
+
removed: string[];
|
|
157
|
+
secrets: Record<string, string>;
|
|
158
|
+
}>;
|
|
159
|
+
clearOutbox(args: {
|
|
160
|
+
before: number;
|
|
161
|
+
}): R<{
|
|
162
|
+
cleared: number;
|
|
163
|
+
}>;
|
|
139
164
|
exportStart(caller: DataCaller, args?: {
|
|
140
165
|
format?: ExportFormat;
|
|
141
166
|
}): R<{
|
package/dist/dataRpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataRpc.d.ts","sourceRoot":"","sources":["../src/dataRpc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"dataRpc.d.ts","sourceRoot":"","sources":["../src/dataRpc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEvF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAE3C,MAAM,WAAW,UAAU;IAEzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM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AAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,WAAW,CACT,MAAM,EAAE,UAAU,EAClB,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,YAAY,CAAA;KAAE,GAC/B,CAAC,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC,CAAC;IAC1D,YAAY,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { DataCaller, DataSchema, DataTable } from './dataTypes';
|
|
2
|
+
import type { SqlRunner } from './dataEngine';
|
|
3
|
+
export declare const DATA_TRIGGER_EVENTS: readonly ["insert", "update", "delete"];
|
|
4
|
+
export type DataTriggerEvent = (typeof DATA_TRIGGER_EVENTS)[number];
|
|
5
|
+
export declare const DATA_TRIGGER_ACTIONS: readonly ["function", "webhook", "chat", "email", "customer"];
|
|
6
|
+
export type DataTriggerActionType = (typeof DATA_TRIGGER_ACTIONS)[number];
|
|
7
|
+
export declare const DATA_MAX_TRIGGERS = 50;
|
|
8
|
+
export declare const DATA_TRIGGER_MAX_DEPTH = 3;
|
|
9
|
+
export declare const DATA_TRIGGER_DEFAULT_RATE = 60;
|
|
10
|
+
export declare const DATA_TRIGGER_MAX_RATE = 600;
|
|
11
|
+
export declare const DATA_TRIGGER_MAX_TEXT = 2000;
|
|
12
|
+
export declare const DATA_TRIGGER_MAX_EMAILS = 10;
|
|
13
|
+
export declare const DATA_OUTBOX_BATCH = 100;
|
|
14
|
+
export declare const DATA_TRIGGER_MAX_ROW_BYTES = 48000;
|
|
15
|
+
export declare const DATA_TRIGGER_MAX_MESSAGE_BYTES = 120000;
|
|
16
|
+
export declare const utf8Bytes: (value: unknown) => number;
|
|
17
|
+
type Scalar = string | number | boolean | null;
|
|
18
|
+
export interface DataTriggerTest {
|
|
19
|
+
changedTo?: Scalar;
|
|
20
|
+
changedFrom?: Scalar;
|
|
21
|
+
changed?: true;
|
|
22
|
+
equals?: Scalar;
|
|
23
|
+
}
|
|
24
|
+
export type DataTriggerCondition = {
|
|
25
|
+
all: DataTriggerCondition[];
|
|
26
|
+
} | {
|
|
27
|
+
any: DataTriggerCondition[];
|
|
28
|
+
} | {
|
|
29
|
+
[column: string]: DataTriggerTest;
|
|
30
|
+
};
|
|
31
|
+
export interface DataTriggerTemplate {
|
|
32
|
+
name: string;
|
|
33
|
+
language: string;
|
|
34
|
+
params?: string[];
|
|
35
|
+
}
|
|
36
|
+
export type DataTriggerAction = {
|
|
37
|
+
type: 'function';
|
|
38
|
+
function: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'webhook';
|
|
41
|
+
url: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'chat';
|
|
44
|
+
channelId: string;
|
|
45
|
+
chatId: string;
|
|
46
|
+
text: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'email';
|
|
49
|
+
to: string[];
|
|
50
|
+
subject: string;
|
|
51
|
+
text: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'customer';
|
|
54
|
+
text: string;
|
|
55
|
+
template?: DataTriggerTemplate;
|
|
56
|
+
};
|
|
57
|
+
export interface DataTriggerInput {
|
|
58
|
+
name?: string;
|
|
59
|
+
description?: string | null;
|
|
60
|
+
table: string;
|
|
61
|
+
on: DataTriggerEvent;
|
|
62
|
+
when?: DataTriggerCondition | null;
|
|
63
|
+
enabled?: boolean;
|
|
64
|
+
replace?: boolean;
|
|
65
|
+
rateLimit?: number;
|
|
66
|
+
function?: string;
|
|
67
|
+
webhook?: string;
|
|
68
|
+
chat?: {
|
|
69
|
+
channelId: string;
|
|
70
|
+
chatId: string;
|
|
71
|
+
text: string;
|
|
72
|
+
};
|
|
73
|
+
email?: {
|
|
74
|
+
to: string[] | string;
|
|
75
|
+
subject?: string;
|
|
76
|
+
text: string;
|
|
77
|
+
};
|
|
78
|
+
customer?: {
|
|
79
|
+
text: string;
|
|
80
|
+
template?: DataTriggerTemplate;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface DataTrigger {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
description: string | null;
|
|
87
|
+
table: string;
|
|
88
|
+
on: DataTriggerEvent;
|
|
89
|
+
when: DataTriggerCondition | null;
|
|
90
|
+
action: DataTriggerAction;
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
disabledReason: string | null;
|
|
93
|
+
managed: 'cli' | null;
|
|
94
|
+
rateLimit: number;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
updatedBy: string | null;
|
|
98
|
+
}
|
|
99
|
+
export interface DataTriggerWithSecret extends DataTrigger {
|
|
100
|
+
secret: string | null;
|
|
101
|
+
}
|
|
102
|
+
export interface DataTriggerEventMessage {
|
|
103
|
+
eventId: string;
|
|
104
|
+
artifactId: string;
|
|
105
|
+
triggerId: string;
|
|
106
|
+
triggerName: string;
|
|
107
|
+
table: string;
|
|
108
|
+
event: DataTriggerEvent;
|
|
109
|
+
rowId: number;
|
|
110
|
+
row: Record<string, unknown> | null;
|
|
111
|
+
previous: Record<string, unknown> | null;
|
|
112
|
+
actor: string | null;
|
|
113
|
+
depth: number;
|
|
114
|
+
at: string;
|
|
115
|
+
truncated?: true;
|
|
116
|
+
error?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether a change matches a condition. A missing side counts as all null:
|
|
120
|
+
* an insert "changed to" the values it was created with, and a delete
|
|
121
|
+
* "changed from" the values it had. `equals` tests the row after the change,
|
|
122
|
+
* or the deleted row.
|
|
123
|
+
*/
|
|
124
|
+
export declare const conditionMatches: (when: DataTriggerCondition | null | undefined, row: Record<string, unknown> | null, previous: Record<string, unknown> | null) => boolean;
|
|
125
|
+
/**
|
|
126
|
+
* A message built from a row: each {{field}} becomes that field's value as
|
|
127
|
+
* plain text. Never markup: the row is customer-written content, and the
|
|
128
|
+
* senders send it as text.
|
|
129
|
+
*/
|
|
130
|
+
export declare const renderTriggerText: (text: string, row: Record<string, unknown> | null) => string;
|
|
131
|
+
interface NormalisedTrigger {
|
|
132
|
+
name: string;
|
|
133
|
+
defaultName: boolean;
|
|
134
|
+
description: string | null;
|
|
135
|
+
table: DataTable;
|
|
136
|
+
on: DataTriggerEvent;
|
|
137
|
+
when: DataTriggerCondition | null;
|
|
138
|
+
action: DataTriggerAction;
|
|
139
|
+
enabled: boolean | null;
|
|
140
|
+
replace: boolean;
|
|
141
|
+
rateLimit: number;
|
|
142
|
+
}
|
|
143
|
+
export declare const normaliseTrigger: (schema: DataSchema, input: unknown) => NormalisedTrigger;
|
|
144
|
+
export declare const listTriggers: (runner: SqlRunner, schema: DataSchema) => DataTrigger[];
|
|
145
|
+
export declare const getTrigger: (runner: SqlRunner, schema: DataSchema, nameOrId: unknown) => DataTriggerWithSecret;
|
|
146
|
+
export interface SavedTrigger {
|
|
147
|
+
trigger: DataTrigger;
|
|
148
|
+
secret?: string;
|
|
149
|
+
}
|
|
150
|
+
export declare const saveTrigger: (runner: SqlRunner, schema: DataSchema, caller: DataCaller, input: unknown) => SavedTrigger;
|
|
151
|
+
export declare const dropTrigger: (runner: SqlRunner, nameOrId: unknown) => {
|
|
152
|
+
dropped: string;
|
|
153
|
+
};
|
|
154
|
+
export declare const setTriggerEnabled: (runner: SqlRunner, schema: DataSchema, caller: DataCaller, nameOrId: unknown, enabled: boolean, reason?: string | null) => DataTrigger;
|
|
155
|
+
/**
|
|
156
|
+
* The triggers ganju.json deploys: each one saved, and every other trigger
|
|
157
|
+
* the CLI deployed before removed. Those made in the dashboard stay. One
|
|
158
|
+
* transaction, so a bad entry changes nothing.
|
|
159
|
+
*/
|
|
160
|
+
export declare const replaceManagedTriggers: (runner: SqlRunner, schema: DataSchema, caller: DataCaller, inputs: unknown) => {
|
|
161
|
+
triggers: DataTrigger[];
|
|
162
|
+
removed: string[];
|
|
163
|
+
secrets: Record<string, string>;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* The SQLite triggers that copy a table's changed rows into _ganju_changes.
|
|
167
|
+
* Each runs only while an enabled trigger of the owner's listens for that
|
|
168
|
+
* event on the table. Named like the table's other triggers, so they are
|
|
169
|
+
* dropped and remade with them when its columns change.
|
|
170
|
+
*/
|
|
171
|
+
export declare const changeCaptureTriggers: (table: Pick<DataTable, "id" | "name" | "columns">) => {
|
|
172
|
+
name: string;
|
|
173
|
+
sql: string;
|
|
174
|
+
}[];
|
|
175
|
+
export declare const ensureChangeCapture: (runner: SqlRunner, table: DataTable) => void;
|
|
176
|
+
/**
|
|
177
|
+
* Turns the changes a write captured into events, inside the write's
|
|
178
|
+
* transaction. A trigger never matches the writes of a run it started
|
|
179
|
+
* (actor `trigger:<id>`), and a chain stops at DATA_TRIGGER_MAX_DEPTH with
|
|
180
|
+
* an event that only records why. Returns how many events were stored.
|
|
181
|
+
*/
|
|
182
|
+
export declare const collectTriggerEvents: (runner: SqlRunner, schema: DataSchema, caller: DataCaller) => number;
|
|
183
|
+
export declare const readOutbox: (runner: SqlRunner, limit?: number) => {
|
|
184
|
+
seq: number;
|
|
185
|
+
message: DataTriggerEventMessage;
|
|
186
|
+
}[];
|
|
187
|
+
export declare const deleteOutbox: (runner: SqlRunner, throughSeq: number) => void;
|
|
188
|
+
export declare const outboxSize: (runner: SqlRunner) => number;
|
|
189
|
+
export declare const clearOutbox: (runner: SqlRunner, before: string) => number;
|
|
190
|
+
/**
|
|
191
|
+
* The triggers whose condition or {{field}} texts name a column. Dropping it
|
|
192
|
+
* is refused while any does, since they are only checked when saved and
|
|
193
|
+
* would quietly stop matching.
|
|
194
|
+
*/
|
|
195
|
+
export declare const triggersUsingColumn: (runner: SqlRunner, tableId: number, column: string) => string[];
|
|
196
|
+
/**
|
|
197
|
+
* A renamed column, renamed in the triggers that use it too, inside the
|
|
198
|
+
* rename's transaction. Those deployed from ganju.json then differ from the
|
|
199
|
+
* file until it is changed to match. Returns the triggers changed.
|
|
200
|
+
*/
|
|
201
|
+
export declare const renameColumnInTriggers: (runner: SqlRunner, tableId: number, from: string, to: string) => string[];
|
|
202
|
+
export {};
|
|
203
|
+
//# sourceMappingURL=dataTriggers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTriggers.d.ts","sourceRoot":"","sources":["../src/dataTriggers.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtD,eAAO,MAAM,mBAAmB,yCAA0C,CAAC;AAC3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB,+DAMvB,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAGpC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAO1C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,8BAA8B,SAAU,CAAC;AAGtD,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,MAEhC,CAAC;AAEZ,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAG/C,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EA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