@octaviaflow/flow-rules 0.1.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.
- package/README.md +96 -0
- package/dist/catalog/actions/console-log/config.d.ts +58 -0
- package/dist/catalog/actions/console-log/config.js +70 -0
- package/dist/catalog/actions/console-log/index.d.ts +7 -0
- package/dist/catalog/actions/console-log/index.js +89 -0
- package/dist/catalog/actions/delay/config.d.ts +50 -0
- package/dist/catalog/actions/delay/config.js +79 -0
- package/dist/catalog/actions/delay/index.d.ts +7 -0
- package/dist/catalog/actions/delay/index.js +71 -0
- package/dist/catalog/actions/delay/migrate.d.ts +18 -0
- package/dist/catalog/actions/delay/migrate.js +38 -0
- package/dist/catalog/actions/delay/types.d.ts +58 -0
- package/dist/catalog/actions/delay/types.js +17 -0
- package/dist/catalog/actions/http-request/config.d.ts +114 -0
- package/dist/catalog/actions/http-request/config.js +111 -0
- package/dist/catalog/actions/http-request/index.d.ts +7 -0
- package/dist/catalog/actions/http-request/index.js +223 -0
- package/dist/catalog/ai/ai-agent/index.d.ts +12 -0
- package/dist/catalog/ai/ai-agent/index.js +72 -0
- package/dist/catalog/ai/idp-extract/index.d.ts +18 -0
- package/dist/catalog/ai/idp-extract/index.js +90 -0
- package/dist/catalog/api/graphql-query/config.d.ts +36 -0
- package/dist/catalog/api/graphql-query/config.js +31 -0
- package/dist/catalog/api/graphql-query/index.d.ts +7 -0
- package/dist/catalog/api/graphql-query/index.js +75 -0
- package/dist/catalog/communication/email-send/config.d.ts +80 -0
- package/dist/catalog/communication/email-send/config.js +80 -0
- package/dist/catalog/communication/email-send/index.d.ts +11 -0
- package/dist/catalog/communication/email-send/index.js +152 -0
- package/dist/catalog/communication/google-chat/config.d.ts +45 -0
- package/dist/catalog/communication/google-chat/config.js +28 -0
- package/dist/catalog/communication/google-chat/index.d.ts +5 -0
- package/dist/catalog/communication/google-chat/index.js +36 -0
- package/dist/catalog/communication/slack-message/config.d.ts +47 -0
- package/dist/catalog/communication/slack-message/config.js +36 -0
- package/dist/catalog/communication/slack-message/index.d.ts +5 -0
- package/dist/catalog/communication/slack-message/index.js +37 -0
- package/dist/catalog/communication/teams-message/config.d.ts +48 -0
- package/dist/catalog/communication/teams-message/config.js +29 -0
- package/dist/catalog/communication/teams-message/index.d.ts +5 -0
- package/dist/catalog/communication/teams-message/index.js +39 -0
- package/dist/catalog/communication/webhook-call/config.d.ts +36 -0
- package/dist/catalog/communication/webhook-call/config.js +31 -0
- package/dist/catalog/communication/webhook-call/index.d.ts +5 -0
- package/dist/catalog/communication/webhook-call/index.js +43 -0
- package/dist/catalog/communication/whatsapp-send/config.d.ts +23 -0
- package/dist/catalog/communication/whatsapp-send/config.js +36 -0
- package/dist/catalog/communication/whatsapp-send/index.d.ts +15 -0
- package/dist/catalog/communication/whatsapp-send/index.js +57 -0
- package/dist/catalog/general/query/config.d.ts +36 -0
- package/dist/catalog/general/query/config.js +257 -0
- package/dist/catalog/general/query/index.d.ts +11 -0
- package/dist/catalog/general/query/index.js +271 -0
- package/dist/catalog/general/query/types.d.ts +205 -0
- package/dist/catalog/general/query/types.js +82 -0
- package/dist/catalog/general/transform/config.d.ts +117 -0
- package/dist/catalog/general/transform/config.js +95 -0
- package/dist/catalog/general/transform/index.d.ts +8 -0
- package/dist/catalog/general/transform/index.js +63 -0
- package/dist/catalog/index.d.ts +57 -0
- package/dist/catalog/index.js +168 -0
- package/dist/catalog/logic/condition/config.d.ts +54 -0
- package/dist/catalog/logic/condition/config.js +93 -0
- package/dist/catalog/logic/condition/index.d.ts +7 -0
- package/dist/catalog/logic/condition/index.js +64 -0
- package/dist/catalog/logic/for-each/config.d.ts +100 -0
- package/dist/catalog/logic/for-each/config.js +75 -0
- package/dist/catalog/logic/for-each/index.d.ts +7 -0
- package/dist/catalog/logic/for-each/index.js +92 -0
- package/dist/catalog/logic/for-each/pathOptions.d.ts +62 -0
- package/dist/catalog/logic/for-each/pathOptions.js +151 -0
- package/dist/catalog/logic/group/index.d.ts +15 -0
- package/dist/catalog/logic/group/index.js +46 -0
- package/dist/catalog/policies.d.ts +75 -0
- package/dist/catalog/policies.js +62 -0
- package/dist/catalog/storage/csv-action/index.d.ts +2 -0
- package/dist/catalog/storage/csv-action/index.js +38 -0
- package/dist/catalog/storage/dropbox-action/index.d.ts +2 -0
- package/dist/catalog/storage/dropbox-action/index.js +33 -0
- package/dist/catalog/storage/excel-action/index.d.ts +2 -0
- package/dist/catalog/storage/excel-action/index.js +32 -0
- package/dist/catalog/storage/file-action/index.d.ts +2 -0
- package/dist/catalog/storage/file-action/index.js +119 -0
- package/dist/catalog/storage/file-operation/config.d.ts +48 -0
- package/dist/catalog/storage/file-operation/config.js +45 -0
- package/dist/catalog/storage/file-operation/index.d.ts +8 -0
- package/dist/catalog/storage/file-operation/index.js +111 -0
- package/dist/catalog/storage/ftp-action/index.d.ts +2 -0
- package/dist/catalog/storage/ftp-action/index.js +33 -0
- package/dist/catalog/storage/google-drive-action/index.d.ts +2 -0
- package/dist/catalog/storage/google-drive-action/index.js +38 -0
- package/dist/catalog/storage/json-action/index.d.ts +2 -0
- package/dist/catalog/storage/json-action/index.js +31 -0
- package/dist/catalog/storage/onedrive-action/index.d.ts +2 -0
- package/dist/catalog/storage/onedrive-action/index.js +33 -0
- package/dist/catalog/storage/s3-action/index.d.ts +2 -0
- package/dist/catalog/storage/s3-action/index.js +36 -0
- package/dist/catalog/storage/storage-action/index.d.ts +13 -0
- package/dist/catalog/storage/storage-action/index.js +72 -0
- package/dist/catalog/storage/storageCapabilities.d.ts +57 -0
- package/dist/catalog/storage/storageCapabilities.js +207 -0
- package/dist/catalog/storage/xml-action/index.d.ts +2 -0
- package/dist/catalog/storage/xml-action/index.js +31 -0
- package/dist/catalog/transforms/format/config.d.ts +23 -0
- package/dist/catalog/transforms/format/config.js +19 -0
- package/dist/catalog/transforms/format/index.d.ts +5 -0
- package/dist/catalog/transforms/format/index.js +39 -0
- package/dist/catalog/triggers/connector-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/connector-trigger/index.js +72 -0
- package/dist/catalog/triggers/manual-trigger/config.d.ts +40 -0
- package/dist/catalog/triggers/manual-trigger/config.js +60 -0
- package/dist/catalog/triggers/manual-trigger/index.d.ts +10 -0
- package/dist/catalog/triggers/manual-trigger/index.js +74 -0
- package/dist/catalog/triggers/schedule-trigger/config.d.ts +42 -0
- package/dist/catalog/triggers/schedule-trigger/config.js +42 -0
- package/dist/catalog/triggers/schedule-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/schedule-trigger/index.js +102 -0
- package/dist/catalog/triggers/webhook-trigger/config.d.ts +31 -0
- package/dist/catalog/triggers/webhook-trigger/config.js +27 -0
- package/dist/catalog/triggers/webhook-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/webhook-trigger/index.js +89 -0
- package/dist/catalog/types.d.ts +360 -0
- package/dist/catalog/types.js +135 -0
- package/dist/catalog/utility/debug/config.d.ts +72 -0
- package/dist/catalog/utility/debug/config.js +90 -0
- package/dist/catalog/utility/debug/index.d.ts +11 -0
- package/dist/catalog/utility/debug/index.js +38 -0
- package/dist/catalog/utility/error/config.d.ts +26 -0
- package/dist/catalog/utility/error/config.js +25 -0
- package/dist/catalog/utility/error/index.d.ts +7 -0
- package/dist/catalog/utility/error/index.js +46 -0
- package/dist/catalog/utility/variables/config.d.ts +76 -0
- package/dist/catalog/utility/variables/config.js +70 -0
- package/dist/catalog/utility/variables/index.d.ts +13 -0
- package/dist/catalog/utility/variables/index.js +40 -0
- package/dist/catalog/workflow.d.ts +308 -0
- package/dist/catalog/workflow.js +25 -0
- package/dist/ids.d.ts +31 -0
- package/dist/ids.js +53 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -0
- package/dist/rules/nodeConfigStatus.d.ts +33 -0
- package/dist/rules/nodeConfigStatus.js +217 -0
- package/dist/rules/workflowValidator.d.ts +53 -0
- package/dist/rules/workflowValidator.js +358 -0
- package/package.json +41 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Query Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configuration utilities and validation for the Build Query action
|
|
5
|
+
* Supports dual modes: Visual Builder (no-code) and SQL Editor (advanced)
|
|
6
|
+
*/
|
|
7
|
+
import { QueryMode, QueryType, } from './types';
|
|
8
|
+
export const BuildQueryConfigDefaults = {
|
|
9
|
+
mode: QueryMode.Visual,
|
|
10
|
+
queryType: QueryType.Select,
|
|
11
|
+
timeout: 30000,
|
|
12
|
+
maxRows: 1000,
|
|
13
|
+
visualConfig: {
|
|
14
|
+
tables: [],
|
|
15
|
+
fields: [],
|
|
16
|
+
filters: undefined,
|
|
17
|
+
joins: [],
|
|
18
|
+
groupBy: [],
|
|
19
|
+
sort: [],
|
|
20
|
+
limit: 10,
|
|
21
|
+
offset: 0,
|
|
22
|
+
},
|
|
23
|
+
sqlConfig: {
|
|
24
|
+
sql: '',
|
|
25
|
+
parameters: {},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Validate Build Query configuration
|
|
30
|
+
*/
|
|
31
|
+
export const validateBuildQueryConfig = (config) => {
|
|
32
|
+
const errors = [];
|
|
33
|
+
const warnings = [];
|
|
34
|
+
if (!config.connectorId) {
|
|
35
|
+
errors.push({
|
|
36
|
+
field: 'connectorId',
|
|
37
|
+
message: 'Please select a connector',
|
|
38
|
+
severity: 'error',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!config.mode) {
|
|
42
|
+
errors.push({
|
|
43
|
+
field: 'mode',
|
|
44
|
+
message: 'Query mode is required',
|
|
45
|
+
severity: 'error',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!config.queryType) {
|
|
49
|
+
errors.push({
|
|
50
|
+
field: 'queryType',
|
|
51
|
+
message: 'Query type is required',
|
|
52
|
+
severity: 'error',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (config.mode === QueryMode.Visual) {
|
|
56
|
+
const visualErrors = validateVisualQueryConfig(config.visualConfig);
|
|
57
|
+
errors.push(...visualErrors);
|
|
58
|
+
}
|
|
59
|
+
else if (config.mode === QueryMode.SQL) {
|
|
60
|
+
const sqlErrors = validateSQLQueryConfig(config.sqlConfig);
|
|
61
|
+
errors.push(...sqlErrors);
|
|
62
|
+
}
|
|
63
|
+
if (config.timeout !== undefined) {
|
|
64
|
+
if (config.timeout < 1000) {
|
|
65
|
+
errors.push({
|
|
66
|
+
field: 'timeout',
|
|
67
|
+
message: 'Timeout must be at least 1000ms',
|
|
68
|
+
severity: 'error',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else if (config.timeout > 300000) {
|
|
72
|
+
warnings.push({
|
|
73
|
+
field: 'timeout',
|
|
74
|
+
message: 'Timeout is very high (>5 minutes)',
|
|
75
|
+
severity: 'warning',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (config.maxRows !== undefined) {
|
|
80
|
+
if (config.maxRows < 1) {
|
|
81
|
+
errors.push({
|
|
82
|
+
field: 'maxRows',
|
|
83
|
+
message: 'Max rows must be at least 1',
|
|
84
|
+
severity: 'error',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else if (config.maxRows > 10000) {
|
|
88
|
+
warnings.push({
|
|
89
|
+
field: 'maxRows',
|
|
90
|
+
message: 'Max rows is very high (>10,000). This may impact performance.',
|
|
91
|
+
severity: 'warning',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
valid: errors.length === 0,
|
|
97
|
+
errors,
|
|
98
|
+
warnings,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Validate Visual Query configuration
|
|
103
|
+
*/
|
|
104
|
+
const validateVisualQueryConfig = (config) => {
|
|
105
|
+
const errors = [];
|
|
106
|
+
if (!config) {
|
|
107
|
+
errors.push({
|
|
108
|
+
field: 'visualConfig',
|
|
109
|
+
message: 'Visual query configuration is required',
|
|
110
|
+
severity: 'error',
|
|
111
|
+
});
|
|
112
|
+
return errors;
|
|
113
|
+
}
|
|
114
|
+
if (!config.tables || config.tables.length === 0) {
|
|
115
|
+
errors.push({
|
|
116
|
+
field: 'visualConfig.tables',
|
|
117
|
+
message: 'At least one table must be selected',
|
|
118
|
+
severity: 'error',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (!config.fields || config.fields.length === 0) {
|
|
122
|
+
errors.push({
|
|
123
|
+
field: 'visualConfig.fields',
|
|
124
|
+
message: 'At least one field must be selected',
|
|
125
|
+
severity: 'error',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (config.tables && config.tables.length > 1) {
|
|
129
|
+
if (!config.joins || config.joins.length === 0) {
|
|
130
|
+
errors.push({
|
|
131
|
+
field: 'visualConfig.joins',
|
|
132
|
+
message: 'Joins are required when selecting from multiple tables',
|
|
133
|
+
severity: 'error',
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const hasAggregates = config.fields?.some(field => field.aggregate);
|
|
138
|
+
const hasNonAggregates = config.fields?.some(field => !field.aggregate);
|
|
139
|
+
if (hasAggregates && hasNonAggregates) {
|
|
140
|
+
if (!config.groupBy || config.groupBy.length === 0) {
|
|
141
|
+
errors.push({
|
|
142
|
+
field: 'visualConfig.groupBy',
|
|
143
|
+
message: 'Group by is required when mixing aggregate and non-aggregate fields',
|
|
144
|
+
severity: 'error',
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return errors;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Validate SQL Query configuration
|
|
152
|
+
*/
|
|
153
|
+
const validateSQLQueryConfig = (config) => {
|
|
154
|
+
const errors = [];
|
|
155
|
+
if (!config) {
|
|
156
|
+
errors.push({
|
|
157
|
+
field: 'sqlConfig',
|
|
158
|
+
message: 'SQL query configuration is required',
|
|
159
|
+
severity: 'error',
|
|
160
|
+
});
|
|
161
|
+
return errors;
|
|
162
|
+
}
|
|
163
|
+
if (!config.sql || config.sql.trim().length === 0) {
|
|
164
|
+
errors.push({
|
|
165
|
+
field: 'sqlConfig.sql',
|
|
166
|
+
message: 'SQL query is required',
|
|
167
|
+
severity: 'error',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const sql = config.sql.trim().toLowerCase();
|
|
172
|
+
const dangerousKeywords = ['drop', 'truncate', 'alter', 'create', 'grant', 'revoke'];
|
|
173
|
+
const hasDangerousKeyword = dangerousKeywords.some(keyword => sql.includes(keyword + ' '));
|
|
174
|
+
if (hasDangerousKeyword) {
|
|
175
|
+
errors.push({
|
|
176
|
+
field: 'sqlConfig.sql',
|
|
177
|
+
message: 'SQL query contains potentially dangerous operations (DROP, TRUNCATE, ALTER, etc.)',
|
|
178
|
+
severity: 'error',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return errors;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Merge user config with defaults
|
|
186
|
+
*/
|
|
187
|
+
export const mergeBuildQueryConfig = (userConfig) => {
|
|
188
|
+
const merged = {
|
|
189
|
+
connectorId: userConfig.connectorId || '',
|
|
190
|
+
mode: userConfig.mode || BuildQueryConfigDefaults.mode,
|
|
191
|
+
queryType: userConfig.queryType || BuildQueryConfigDefaults.queryType,
|
|
192
|
+
timeout: userConfig.timeout || BuildQueryConfigDefaults.timeout,
|
|
193
|
+
maxRows: userConfig.maxRows || BuildQueryConfigDefaults.maxRows,
|
|
194
|
+
};
|
|
195
|
+
if (merged.mode === QueryMode.Visual) {
|
|
196
|
+
merged.visualConfig = {
|
|
197
|
+
...BuildQueryConfigDefaults.visualConfig,
|
|
198
|
+
...userConfig.visualConfig,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
else if (merged.mode === QueryMode.SQL) {
|
|
202
|
+
merged.sqlConfig = {
|
|
203
|
+
...BuildQueryConfigDefaults.sqlConfig,
|
|
204
|
+
...userConfig.sqlConfig,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return merged;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Get display label for configuration
|
|
211
|
+
*/
|
|
212
|
+
export const getBuildQueryLabel = (config) => {
|
|
213
|
+
if (config.mode === QueryMode.Visual && config.visualConfig) {
|
|
214
|
+
const tables = config.visualConfig.tables.join(', ');
|
|
215
|
+
const fieldCount = config.visualConfig.fields.length;
|
|
216
|
+
return `Query ${tables} (${fieldCount} fields)`;
|
|
217
|
+
}
|
|
218
|
+
else if (config.mode === QueryMode.SQL && config.sqlConfig) {
|
|
219
|
+
const preview = config.sqlConfig.sql.substring(0, 50);
|
|
220
|
+
return preview + (config.sqlConfig.sql.length > 50 ? '...' : '');
|
|
221
|
+
}
|
|
222
|
+
return 'Build Query';
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Check if a connector is queryable (excludes storage-type connectors)
|
|
226
|
+
* Uses the isQueryable flag from connector metadata if available
|
|
227
|
+
*/
|
|
228
|
+
export function isQueryableConnector(connector) {
|
|
229
|
+
// If isQueryable flag is explicitly set, use it
|
|
230
|
+
if (connector.isQueryable !== undefined) {
|
|
231
|
+
return connector.isQueryable;
|
|
232
|
+
}
|
|
233
|
+
// Fallback: Exclude storage category
|
|
234
|
+
if (connector.category === 'storage') {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
// Safety check: If type is undefined or null, default to not queryable
|
|
238
|
+
if (!connector.type) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
// Fallback: Check against known storage types
|
|
242
|
+
const storageTypes = [
|
|
243
|
+
'dropbox',
|
|
244
|
+
'google_drive',
|
|
245
|
+
'google-drive',
|
|
246
|
+
'onedrive',
|
|
247
|
+
'box',
|
|
248
|
+
'ftp',
|
|
249
|
+
'sftp',
|
|
250
|
+
's3',
|
|
251
|
+
'azure_blob',
|
|
252
|
+
'azure-blob',
|
|
253
|
+
'storage',
|
|
254
|
+
];
|
|
255
|
+
return !storageTypes.includes(connector.type.toLowerCase());
|
|
256
|
+
}
|
|
257
|
+
;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Query Action
|
|
3
|
+
*
|
|
4
|
+
* Execute queries against connected databases, APIs, CRMs with dual mode support:
|
|
5
|
+
* - Visual Builder: No-code/low-code query construction
|
|
6
|
+
* - SQL Editor: Advanced SQL query writing with syntax highlighting
|
|
7
|
+
*/
|
|
8
|
+
import { ActionDefinition } from '../../types';
|
|
9
|
+
export declare const queryDefinition: ActionDefinition;
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './config';
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Query Action
|
|
3
|
+
*
|
|
4
|
+
* Execute queries against connected databases, APIs, CRMs with dual mode support:
|
|
5
|
+
* - Visual Builder: No-code/low-code query construction
|
|
6
|
+
* - SQL Editor: Advanced SQL query writing with syntax highlighting
|
|
7
|
+
*/
|
|
8
|
+
import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
|
|
9
|
+
import { QueryMode, QueryType } from './types';
|
|
10
|
+
export const queryDefinition = {
|
|
11
|
+
id: 'query',
|
|
12
|
+
name: 'Query',
|
|
13
|
+
description: 'Execute queries against connected databases, APIs, and CRMs',
|
|
14
|
+
longDescription: 'Create powerful queries using either a visual no-code builder or advanced SQL editor. Supports databases (PostgreSQL, MySQL, MongoDB, etc.), APIs (REST, GraphQL), and CRMs (Salesforce, HubSpot). Query results can be used as input for downstream actions.',
|
|
15
|
+
category: ActionCategory.Database,
|
|
16
|
+
type: ActionType.Query,
|
|
17
|
+
tags: ['query', 'database', 'sql', 'visual-builder', 'no-code', 'api', 'crm', 'built-in'],
|
|
18
|
+
status: ActionStatus.Stable,
|
|
19
|
+
icon: 'QueryQueue',
|
|
20
|
+
color: '#0043ce',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
fields: [
|
|
23
|
+
{
|
|
24
|
+
key: 'connectorId',
|
|
25
|
+
label: 'Select Connector',
|
|
26
|
+
type: FieldType.Connection,
|
|
27
|
+
description: 'Choose a connected database, API, or CRM (storage connectors like Dropbox/Google Drive are not supported)',
|
|
28
|
+
validation: { required: true },
|
|
29
|
+
helpText: 'Only queryable connectors are shown. File storage connectors have separate actions.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'mode',
|
|
33
|
+
label: 'Query Mode',
|
|
34
|
+
type: FieldType.Select,
|
|
35
|
+
description: 'Choose between visual query builder or SQL editor',
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
label: 'Visual Builder (No-Code)',
|
|
39
|
+
value: QueryMode.Visual,
|
|
40
|
+
description: 'Build queries visually without writing code',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'SQL Editor (Advanced)',
|
|
44
|
+
value: QueryMode.SQL,
|
|
45
|
+
description: 'Write raw SQL queries with syntax highlighting',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
defaultValue: QueryMode.Visual,
|
|
49
|
+
validation: { required: true },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'queryType',
|
|
53
|
+
label: 'Query Type',
|
|
54
|
+
type: FieldType.Select,
|
|
55
|
+
// Read-only. The Query action reads; writes go through Transform.
|
|
56
|
+
// INSERT / UPDATE / DELETE / Custom were listed here but the config
|
|
57
|
+
// panel always compiles a SELECT (QueryConfigPanel pins queryType),
|
|
58
|
+
// so the catalogue no longer advertises them (DEV-349).
|
|
59
|
+
description: 'Type of query operation — the Query action reads data; use Transform to write',
|
|
60
|
+
options: [
|
|
61
|
+
{ label: 'SELECT (Read Data)', value: QueryType.Select },
|
|
62
|
+
],
|
|
63
|
+
defaultValue: QueryType.Select,
|
|
64
|
+
validation: { required: true },
|
|
65
|
+
conditional: [
|
|
66
|
+
{
|
|
67
|
+
field: 'mode',
|
|
68
|
+
operator: '==',
|
|
69
|
+
value: QueryMode.Visual,
|
|
70
|
+
action: 'show',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
// Visual Builder Fields
|
|
75
|
+
{
|
|
76
|
+
key: 'visualConfig.tables',
|
|
77
|
+
label: 'Select Tables',
|
|
78
|
+
type: FieldType.MultiSelect,
|
|
79
|
+
description: 'Choose one or more tables to query',
|
|
80
|
+
validation: { required: true },
|
|
81
|
+
conditional: [
|
|
82
|
+
{
|
|
83
|
+
field: 'mode',
|
|
84
|
+
operator: '==',
|
|
85
|
+
value: QueryMode.Visual,
|
|
86
|
+
action: 'show',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
optionsSource: {
|
|
90
|
+
type: 'dynamic',
|
|
91
|
+
dependsOn: ['connectorId'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'visualConfig.fields',
|
|
96
|
+
label: 'Select Fields',
|
|
97
|
+
type: FieldType.Array,
|
|
98
|
+
description: 'Choose fields to include in the query result',
|
|
99
|
+
validation: { required: true },
|
|
100
|
+
conditional: [
|
|
101
|
+
{
|
|
102
|
+
field: 'mode',
|
|
103
|
+
operator: '==',
|
|
104
|
+
value: QueryMode.Visual,
|
|
105
|
+
action: 'show',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: 'visualConfig.limit',
|
|
111
|
+
label: 'Limit',
|
|
112
|
+
type: FieldType.Number,
|
|
113
|
+
description: 'Maximum number of rows to return',
|
|
114
|
+
defaultValue: 10,
|
|
115
|
+
validation: { required: false, min: 1, max: 10000 },
|
|
116
|
+
conditional: [
|
|
117
|
+
{
|
|
118
|
+
field: 'mode',
|
|
119
|
+
operator: '==',
|
|
120
|
+
value: QueryMode.Visual,
|
|
121
|
+
action: 'show',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
// SQL Editor Fields
|
|
126
|
+
{
|
|
127
|
+
key: 'sqlConfig.sql',
|
|
128
|
+
label: 'SQL Query',
|
|
129
|
+
type: FieldType.Code,
|
|
130
|
+
language: 'sql',
|
|
131
|
+
description: 'Write your SQL query here',
|
|
132
|
+
placeholder: 'SELECT * FROM users WHERE status = \'active\' LIMIT 100',
|
|
133
|
+
validation: { required: true },
|
|
134
|
+
conditional: [
|
|
135
|
+
{
|
|
136
|
+
field: 'mode',
|
|
137
|
+
operator: '==',
|
|
138
|
+
value: QueryMode.SQL,
|
|
139
|
+
action: 'show',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: 'sqlConfig.parameters',
|
|
145
|
+
label: 'Query Parameters',
|
|
146
|
+
type: FieldType.JSON,
|
|
147
|
+
description: 'Parameters for parameterized queries (e.g., {"userId": 123})',
|
|
148
|
+
validation: { required: false },
|
|
149
|
+
advanced: true,
|
|
150
|
+
conditional: [
|
|
151
|
+
{
|
|
152
|
+
field: 'mode',
|
|
153
|
+
operator: '==',
|
|
154
|
+
value: QueryMode.SQL,
|
|
155
|
+
action: 'show',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
// Common Settings
|
|
160
|
+
{
|
|
161
|
+
key: 'timeout',
|
|
162
|
+
label: 'Query Timeout (ms)',
|
|
163
|
+
type: FieldType.Number,
|
|
164
|
+
description: 'Maximum time to wait for query execution',
|
|
165
|
+
defaultValue: 30000,
|
|
166
|
+
validation: { required: false, min: 1000, max: 300000 },
|
|
167
|
+
advanced: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
key: 'maxRows',
|
|
171
|
+
label: 'Max Rows',
|
|
172
|
+
type: FieldType.Number,
|
|
173
|
+
description: 'Maximum number of rows to return',
|
|
174
|
+
defaultValue: 1000,
|
|
175
|
+
validation: { required: false, min: 1, max: 10000 },
|
|
176
|
+
advanced: true,
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
groups: [
|
|
180
|
+
{
|
|
181
|
+
id: 'connection',
|
|
182
|
+
label: 'Connection',
|
|
183
|
+
description: 'Select the data source to query',
|
|
184
|
+
fields: ['connectorId'],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'query_mode',
|
|
188
|
+
label: 'Query Configuration',
|
|
189
|
+
description: 'Configure how you want to build your query',
|
|
190
|
+
fields: ['mode', 'queryType'],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 'visual_builder',
|
|
194
|
+
label: 'Visual Query Builder',
|
|
195
|
+
description: 'Build your query visually without writing code',
|
|
196
|
+
fields: ['visualConfig.tables', 'visualConfig.fields', 'visualConfig.limit'],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 'sql_editor',
|
|
200
|
+
label: 'SQL Editor',
|
|
201
|
+
description: 'Write raw SQL queries',
|
|
202
|
+
fields: ['sqlConfig.sql', 'sqlConfig.parameters'],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: 'settings',
|
|
206
|
+
label: 'Advanced Settings',
|
|
207
|
+
description: 'Configure query execution settings',
|
|
208
|
+
collapsed: true,
|
|
209
|
+
fields: ['timeout', 'maxRows'],
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
outputSchema: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: [
|
|
216
|
+
{
|
|
217
|
+
key: 'data',
|
|
218
|
+
type: FieldType.Array,
|
|
219
|
+
description: 'Query result data as an array of objects',
|
|
220
|
+
example: [{ id: 1, name: 'John Doe', email: 'john@example.com' }],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
key: 'rowCount',
|
|
224
|
+
type: FieldType.Number,
|
|
225
|
+
description: 'Number of rows returned',
|
|
226
|
+
example: 1,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: 'columns',
|
|
230
|
+
type: FieldType.Array,
|
|
231
|
+
description: 'Column names in the result set',
|
|
232
|
+
example: ['id', 'name', 'email'],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: 'executionTime',
|
|
236
|
+
type: FieldType.Number,
|
|
237
|
+
description: 'Query execution time in milliseconds',
|
|
238
|
+
example: 45,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: 'generatedSQL',
|
|
242
|
+
type: FieldType.String,
|
|
243
|
+
description: 'The SQL query that was executed (for visual builder mode)',
|
|
244
|
+
example: 'SELECT id, name, email FROM users WHERE status = \'active\' LIMIT 100',
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
sampleOutput: {
|
|
248
|
+
data: [
|
|
249
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', status: 'active' },
|
|
250
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'active' },
|
|
251
|
+
],
|
|
252
|
+
rowCount: 2,
|
|
253
|
+
columns: ['id', 'name', 'email', 'status'],
|
|
254
|
+
executionTime: 45,
|
|
255
|
+
generatedSQL: 'SELECT id, name, email, status FROM users WHERE status = \'active\' LIMIT 100',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
execution: {
|
|
259
|
+
timeout: 30000,
|
|
260
|
+
retryable: true,
|
|
261
|
+
requiresAuth: true,
|
|
262
|
+
},
|
|
263
|
+
testable: true,
|
|
264
|
+
version: '1.0.0',
|
|
265
|
+
createdAt: '2025-01-19T00:00:00Z',
|
|
266
|
+
updatedAt: '2025-01-19T00:00:00Z',
|
|
267
|
+
createdBy: 'system',
|
|
268
|
+
isOfficial: true,
|
|
269
|
+
};
|
|
270
|
+
export * from './types';
|
|
271
|
+
export * from './config';
|