@etohq/connector-engine 1.5.1-alpha.4
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/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/dist/engine/clean-connector-engine.d.ts +81 -0
- package/dist/engine/clean-connector-engine.d.ts.map +1 -0
- package/dist/engine/clean-connector-engine.js +350 -0
- package/dist/engine/clean-connector-engine.js.map +1 -0
- package/dist/engine/connector-engine-impl.d.ts +73 -0
- package/dist/engine/connector-engine-impl.d.ts.map +1 -0
- package/dist/engine/connector-engine-impl.js +332 -0
- package/dist/engine/connector-engine-impl.js.map +1 -0
- package/dist/engine/connector-engine.d.ts +54 -0
- package/dist/engine/connector-engine.d.ts.map +1 -0
- package/dist/engine/connector-engine.js +694 -0
- package/dist/engine/connector-engine.js.map +1 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +10 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/routing-engine.d.ts +26 -0
- package/dist/engine/routing-engine.d.ts.map +1 -0
- package/dist/engine/routing-engine.js +329 -0
- package/dist/engine/routing-engine.js.map +1 -0
- package/dist/examples/booking-connector-example.d.ts +7 -0
- package/dist/examples/booking-connector-example.d.ts.map +1 -0
- package/dist/examples/booking-connector-example.js +221 -0
- package/dist/examples/booking-connector-example.js.map +1 -0
- package/dist/examples/dynamic-methods-example.d.ts +7 -0
- package/dist/examples/dynamic-methods-example.d.ts.map +1 -0
- package/dist/examples/dynamic-methods-example.js +163 -0
- package/dist/examples/dynamic-methods-example.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/types/base-plugin.d.ts +170 -0
- package/dist/types/base-plugin.d.ts.map +1 -0
- package/dist/types/base-plugin.js +68 -0
- package/dist/types/base-plugin.js.map +1 -0
- package/dist/types/connector-plugin.d.ts +22 -0
- package/dist/types/connector-plugin.d.ts.map +1 -0
- package/dist/types/connector-plugin.js +11 -0
- package/dist/types/connector-plugin.js.map +1 -0
- package/dist/types/engine.d.ts +223 -0
- package/dist/types/engine.d.ts.map +1 -0
- package/dist/types/engine.js +7 -0
- package/dist/types/engine.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operation-groups.d.ts +78 -0
- package/dist/types/operation-groups.d.ts.map +1 -0
- package/dist/types/operation-groups.js +60 -0
- package/dist/types/operation-groups.js.map +1 -0
- package/dist/types/routing-config.d.ts +116 -0
- package/dist/types/routing-config.d.ts.map +1 -0
- package/dist/types/routing-config.js +6 -0
- package/dist/types/routing-config.js.map +1 -0
- package/dist/utils/create-connector-engine.d.ts +31 -0
- package/dist/utils/create-connector-engine.d.ts.map +1 -0
- package/dist/utils/create-connector-engine.js +30 -0
- package/dist/utils/create-connector-engine.js.map +1 -0
- package/examples/booking-example.ts +168 -0
- package/examples/booking-test.ts +231 -0
- package/hyperswitch-example.ts +263 -0
- package/jest.config.js +2 -0
- package/package.json +54 -0
- package/src/engine/clean-connector-engine.ts +726 -0
- package/src/engine/index.ts +13 -0
- package/src/engine/routing-engine.ts +394 -0
- package/src/index.ts +32 -0
- package/src/types/connector-plugin.ts +34 -0
- package/src/types/index.ts +5 -0
- package/src/types/routing-config.ts +196 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Clean Connector Engine - First Principles Implementation
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConnectorEngine = ConnectorEngine;
|
|
7
|
+
const routing_engine_1 = require("./routing-engine");
|
|
8
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
9
|
+
// ===== ENGINE IMPLEMENTATION =====
|
|
10
|
+
class ConnectorEngineImpl {
|
|
11
|
+
constructor(connectors, groups, config) {
|
|
12
|
+
this.connectors = connectors;
|
|
13
|
+
this.groups = groups;
|
|
14
|
+
this.configLoader = config.configLoader;
|
|
15
|
+
this.routingConfigLoader = config.routingConfigLoader;
|
|
16
|
+
this.routingEngine = new routing_engine_1.RoutingEngine();
|
|
17
|
+
this.generateDynamicMethods();
|
|
18
|
+
}
|
|
19
|
+
// ===== DYNAMIC METHOD GENERATION =====
|
|
20
|
+
generateDynamicMethods() {
|
|
21
|
+
this.generateConnectorMethods();
|
|
22
|
+
this.generateGroupMethods();
|
|
23
|
+
}
|
|
24
|
+
generateConnectorMethods() {
|
|
25
|
+
for (const [connectorId, plugin] of Object.entries(this.connectors)) {
|
|
26
|
+
for (const operationName of Object.keys(plugin.operations)) {
|
|
27
|
+
const methodName = `execute${this.capitalize(connectorId)}${this.capitalize(operationName)}`;
|
|
28
|
+
this[methodName] = () => {
|
|
29
|
+
return this.createConnectorWorkflow(connectorId, operationName);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
generateGroupMethods() {
|
|
35
|
+
// Auto-generate group methods even without explicit groups
|
|
36
|
+
this.generateAutoGroups();
|
|
37
|
+
// Generate methods for explicit groups
|
|
38
|
+
for (const [groupName, groupConfig] of Object.entries(this.groups)) {
|
|
39
|
+
for (const operationName of groupConfig.operations) {
|
|
40
|
+
const methodName = `execute${this.capitalize(groupName)}${this.capitalize(operationName)}`;
|
|
41
|
+
this[methodName] = (input, context) => {
|
|
42
|
+
return this.createSmartGroupWorkflow(groupName, operationName, input, context);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Auto-generate groups for gradual adoption with type safety
|
|
48
|
+
generateAutoGroups() {
|
|
49
|
+
const domainGroups = {};
|
|
50
|
+
// Group connectors by domain (plugin type)
|
|
51
|
+
for (const [connectorId, plugin] of Object.entries(this.connectors)) {
|
|
52
|
+
const domain = plugin.getName(); // Use plugin name as domain
|
|
53
|
+
if (!domainGroups[domain]) {
|
|
54
|
+
domainGroups[domain] = { connectors: [], operations: new Set() };
|
|
55
|
+
}
|
|
56
|
+
domainGroups[domain].connectors.push(connectorId);
|
|
57
|
+
// Add all operations from this plugin
|
|
58
|
+
for (const op of Array.from(Object.keys(plugin.operations))) {
|
|
59
|
+
domainGroups[domain].operations.add(op);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Generate group methods for each domain
|
|
63
|
+
for (const [domain, { connectors, operations }] of Object.entries(domainGroups)) {
|
|
64
|
+
for (const operationName of operations) {
|
|
65
|
+
const methodName = `execute${this.capitalize(domain)}${this.capitalize(operationName)}`;
|
|
66
|
+
// Only generate if not already exists (explicit groups take precedence)
|
|
67
|
+
if (!this[methodName]) {
|
|
68
|
+
;
|
|
69
|
+
this[methodName] = (input, context) => {
|
|
70
|
+
return this.createAutoGroupWorkflow(domain, operationName, input, context, connectors);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Create workflow for auto-generated groups
|
|
77
|
+
createAutoGroupWorkflow(domain, operationName, input, context, availableConnectors) {
|
|
78
|
+
return (0, workflows_sdk_1.createWorkflow)(`${domain}-${operationName}-auto`, (workflowInput) => {
|
|
79
|
+
const step = (0, workflows_sdk_1.createStep)(`${domain}-${operationName}-auto-step`, async (stepInput, { container }) => {
|
|
80
|
+
// Get connectors for this domain
|
|
81
|
+
const domainConnectors = availableConnectors ||
|
|
82
|
+
Object.keys(this.connectors).filter((id) => this.connectors[id].getName() === domain);
|
|
83
|
+
if (domainConnectors.length === 0) {
|
|
84
|
+
throw new Error(`No connectors available for domain: ${domain}`);
|
|
85
|
+
}
|
|
86
|
+
// Simple routing: try routing if available, otherwise use first connector
|
|
87
|
+
let selectedConnector;
|
|
88
|
+
if (this.routingConfigLoader) {
|
|
89
|
+
try {
|
|
90
|
+
const routingConfig = await this.routingConfigLoader(domain);
|
|
91
|
+
const routingContext = this.extractRoutingContext(stepInput, context, operationName, domain);
|
|
92
|
+
const routingDecision = await this.routingEngine.route(routingContext, routingConfig);
|
|
93
|
+
selectedConnector = routingDecision.selected_connector;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Fallback to simple selection if routing fails
|
|
97
|
+
selectedConnector = domainConnectors[0];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// No routing - use round robin or first available
|
|
102
|
+
selectedConnector = domainConnectors[0];
|
|
103
|
+
}
|
|
104
|
+
// Execute on selected connector
|
|
105
|
+
const config = await this.configLoader(selectedConnector);
|
|
106
|
+
const plugin = this.connectors[selectedConnector];
|
|
107
|
+
const operation = plugin.operations[operationName];
|
|
108
|
+
if (!operation) {
|
|
109
|
+
throw new Error(`Operation ${operationName} not found on connector ${selectedConnector}`);
|
|
110
|
+
}
|
|
111
|
+
const startTime = Date.now();
|
|
112
|
+
const result = await operation(stepInput, config);
|
|
113
|
+
return new workflows_sdk_1.StepResponse({
|
|
114
|
+
groupName: domain,
|
|
115
|
+
executedConnectors: [selectedConnector],
|
|
116
|
+
results: { [selectedConnector]: result },
|
|
117
|
+
metadata: {
|
|
118
|
+
behavior: "auto_group",
|
|
119
|
+
executionTime: Date.now() - startTime,
|
|
120
|
+
routingDecision: { selected_connector: selectedConnector, algorithm_used: 'auto', rule_applied: undefined },
|
|
121
|
+
algorithm: 'auto',
|
|
122
|
+
ruleApplied: undefined
|
|
123
|
+
},
|
|
124
|
+
}, result);
|
|
125
|
+
});
|
|
126
|
+
const result = step(workflowInput);
|
|
127
|
+
return new workflows_sdk_1.WorkflowResponse(result);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
capitalize(str) {
|
|
131
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
132
|
+
}
|
|
133
|
+
// ===== WORKFLOW CREATION =====
|
|
134
|
+
createConnectorWorkflow(connectorId, operationName) {
|
|
135
|
+
return (0, workflows_sdk_1.createWorkflow)(`${connectorId}-${operationName}`, (workflowInput) => {
|
|
136
|
+
const step = (0, workflows_sdk_1.createStep)(`${connectorId}-${operationName}-step`, async (stepInput, { container }) => {
|
|
137
|
+
const config = await this.configLoader(connectorId);
|
|
138
|
+
const plugin = this.connectors[connectorId];
|
|
139
|
+
const operation = plugin.operations[operationName];
|
|
140
|
+
if (!operation) {
|
|
141
|
+
throw new Error(`Operation ${operationName} not found on connector ${connectorId}`);
|
|
142
|
+
}
|
|
143
|
+
const result = await operation(stepInput, config);
|
|
144
|
+
return new workflows_sdk_1.StepResponse(result, result);
|
|
145
|
+
});
|
|
146
|
+
const result = step(workflowInput);
|
|
147
|
+
return new workflows_sdk_1.WorkflowResponse(result);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
createSmartGroupWorkflow(groupName, operationName, input, context) {
|
|
151
|
+
return (0, workflows_sdk_1.createWorkflow)(`${groupName}-${operationName}-smart`, (workflowInput) => {
|
|
152
|
+
const step = (0, workflows_sdk_1.createStep)(`${groupName}-${operationName}-smart-step`, async (stepInput, { container }) => {
|
|
153
|
+
// Load routing config from DB
|
|
154
|
+
const routingConfig = this.routingConfigLoader
|
|
155
|
+
? await this.routingConfigLoader(groupName)
|
|
156
|
+
: {
|
|
157
|
+
profile_id: 'default',
|
|
158
|
+
name: 'default',
|
|
159
|
+
algorithm: 'priority',
|
|
160
|
+
connectors: [],
|
|
161
|
+
rules: [],
|
|
162
|
+
created_at: new Date().toISOString(),
|
|
163
|
+
updated_at: new Date().toISOString(),
|
|
164
|
+
modified_at: new Date().toISOString(),
|
|
165
|
+
version: 1
|
|
166
|
+
};
|
|
167
|
+
// Create dynamic routing context from plugin input
|
|
168
|
+
const routingContext = this.extractRoutingContext(stepInput, context, operationName, groupName);
|
|
169
|
+
// Use smart routing to select connector
|
|
170
|
+
const routingDecision = await this.routingEngine.route(routingContext, routingConfig);
|
|
171
|
+
// Execute on selected connector
|
|
172
|
+
const selectedConnector = routingDecision.selected_connector;
|
|
173
|
+
const config = await this.configLoader(selectedConnector);
|
|
174
|
+
const plugin = this.connectors[selectedConnector];
|
|
175
|
+
const operation = plugin.operations[operationName];
|
|
176
|
+
if (!operation) {
|
|
177
|
+
throw new Error(`Operation ${operationName} not found on connector ${selectedConnector}`);
|
|
178
|
+
}
|
|
179
|
+
const startTime = Date.now();
|
|
180
|
+
try {
|
|
181
|
+
const result = await operation(stepInput, config);
|
|
182
|
+
// Update metrics for successful execution
|
|
183
|
+
await this.routingEngine.updateMetrics(selectedConnector, true, Date.now() - startTime);
|
|
184
|
+
return new workflows_sdk_1.StepResponse({
|
|
185
|
+
groupName,
|
|
186
|
+
executedConnectors: [selectedConnector],
|
|
187
|
+
results: { [selectedConnector]: result },
|
|
188
|
+
metadata: {
|
|
189
|
+
behavior: "smart_routing",
|
|
190
|
+
executionTime: Date.now() - startTime,
|
|
191
|
+
routingDecision,
|
|
192
|
+
algorithm: routingDecision.algorithm_used,
|
|
193
|
+
ruleApplied: routingDecision.rule_applied,
|
|
194
|
+
},
|
|
195
|
+
}, result);
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
// Update metrics for failed execution
|
|
199
|
+
await this.routingEngine.updateMetrics(selectedConnector, false, Date.now() - startTime);
|
|
200
|
+
// Try fallback connectors if available
|
|
201
|
+
if (routingDecision.alternative_connectors.length > 0) {
|
|
202
|
+
return await this.tryFallbackConnectors(routingDecision.alternative_connectors, operationName, stepInput, groupName, startTime, routingContext);
|
|
203
|
+
}
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const result = step(workflowInput);
|
|
208
|
+
return new workflows_sdk_1.WorkflowResponse(result);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// ===== DYNAMIC CONTEXT EXTRACTION =====
|
|
212
|
+
extractRoutingContext(input, providedContext, operationName, groupName) {
|
|
213
|
+
const inputObj = input;
|
|
214
|
+
// Start with provided context or defaults
|
|
215
|
+
const baseContext = {
|
|
216
|
+
operation: operationName,
|
|
217
|
+
domain: groupName,
|
|
218
|
+
...providedContext,
|
|
219
|
+
};
|
|
220
|
+
// Extract common fields from input (works for any domain)
|
|
221
|
+
if (inputObj.region !== undefined)
|
|
222
|
+
baseContext.region = inputObj.region;
|
|
223
|
+
if (inputObj.country !== undefined)
|
|
224
|
+
baseContext.country = inputObj.country;
|
|
225
|
+
if (inputObj.userId !== undefined)
|
|
226
|
+
baseContext.userId = inputObj.userId;
|
|
227
|
+
if (inputObj.user_id !== undefined)
|
|
228
|
+
baseContext.userId = inputObj.user_id;
|
|
229
|
+
if (inputObj.tenantId !== undefined)
|
|
230
|
+
baseContext.tenantId = inputObj.tenantId;
|
|
231
|
+
if (inputObj.tenant_id !== undefined)
|
|
232
|
+
baseContext.tenantId = inputObj.tenant_id;
|
|
233
|
+
if (inputObj.priority !== undefined)
|
|
234
|
+
baseContext.priority = inputObj.priority;
|
|
235
|
+
if (inputObj.resourceType !== undefined)
|
|
236
|
+
baseContext.resourceType = inputObj.resourceType;
|
|
237
|
+
if (inputObj.resource_type !== undefined)
|
|
238
|
+
baseContext.resourceType = inputObj.resource_type;
|
|
239
|
+
// Extract size/amount fields (could be file size, payment amount, etc.)
|
|
240
|
+
if (inputObj.size !== undefined)
|
|
241
|
+
baseContext.resourceSize = inputObj.size;
|
|
242
|
+
if (inputObj.amount !== undefined)
|
|
243
|
+
baseContext.resourceSize = inputObj.amount;
|
|
244
|
+
if (inputObj.fileSize !== undefined)
|
|
245
|
+
baseContext.resourceSize = inputObj.fileSize;
|
|
246
|
+
if (inputObj.file_size !== undefined)
|
|
247
|
+
baseContext.resourceSize = inputObj.file_size;
|
|
248
|
+
// Include all custom fields for rule evaluation
|
|
249
|
+
baseContext.metadata = {
|
|
250
|
+
...baseContext.metadata,
|
|
251
|
+
operation: operationName,
|
|
252
|
+
domain: groupName,
|
|
253
|
+
inputFields: Object.keys(inputObj),
|
|
254
|
+
// Include any custom fields from input for rule evaluation
|
|
255
|
+
customFields: this.extractCustomFields(inputObj),
|
|
256
|
+
};
|
|
257
|
+
return baseContext;
|
|
258
|
+
}
|
|
259
|
+
extractCustomFields(input) {
|
|
260
|
+
const customFields = {};
|
|
261
|
+
const standardFields = [
|
|
262
|
+
"region",
|
|
263
|
+
"country",
|
|
264
|
+
"userId",
|
|
265
|
+
"user_id",
|
|
266
|
+
"tenantId",
|
|
267
|
+
"tenant_id",
|
|
268
|
+
"priority",
|
|
269
|
+
"resourceType",
|
|
270
|
+
"resource_type",
|
|
271
|
+
"size",
|
|
272
|
+
"amount",
|
|
273
|
+
"fileSize",
|
|
274
|
+
"file_size",
|
|
275
|
+
];
|
|
276
|
+
for (const [key, value] of Object.entries(input)) {
|
|
277
|
+
if (!standardFields.includes(key)) {
|
|
278
|
+
customFields[key] = value;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return customFields;
|
|
282
|
+
}
|
|
283
|
+
async tryFallbackConnectors(fallbackConnectors, operationName, input, groupName, originalStartTime, context) {
|
|
284
|
+
const errors = {};
|
|
285
|
+
for (const connectorId of fallbackConnectors) {
|
|
286
|
+
try {
|
|
287
|
+
const config = await this.configLoader(connectorId);
|
|
288
|
+
const plugin = this.connectors[connectorId];
|
|
289
|
+
const operation = plugin.operations[operationName];
|
|
290
|
+
if (!operation)
|
|
291
|
+
continue;
|
|
292
|
+
const startTime = Date.now();
|
|
293
|
+
const result = await operation(input, config);
|
|
294
|
+
// Update metrics for successful fallback
|
|
295
|
+
await this.routingEngine.updateMetrics(connectorId, true, Date.now() - startTime);
|
|
296
|
+
return new workflows_sdk_1.StepResponse({
|
|
297
|
+
groupName,
|
|
298
|
+
executedConnectors: [connectorId],
|
|
299
|
+
results: { [connectorId]: result },
|
|
300
|
+
metadata: {
|
|
301
|
+
behavior: "fallback_routing",
|
|
302
|
+
executionTime: Date.now() - originalStartTime,
|
|
303
|
+
routingDecision: { selected_connector: connectorId, algorithm_used: 'fallback', rule_applied: undefined },
|
|
304
|
+
algorithm: 'fallback',
|
|
305
|
+
ruleApplied: undefined
|
|
306
|
+
},
|
|
307
|
+
}, result);
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
errors[connectorId] =
|
|
311
|
+
error instanceof Error ? error : new Error(String(error));
|
|
312
|
+
// Update metrics for failed fallback
|
|
313
|
+
await this.routingEngine.updateMetrics(connectorId, false, Date.now() - originalStartTime);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
throw new Error(`All connectors failed for ${groupName}.${operationName}. Errors: ${JSON.stringify(errors)}`);
|
|
317
|
+
}
|
|
318
|
+
// ===== PUBLIC API =====
|
|
319
|
+
async execute(connectorId, operation, input) {
|
|
320
|
+
const config = await this.configLoader(connectorId);
|
|
321
|
+
const plugin = this.connectors[connectorId];
|
|
322
|
+
const operationFn = plugin.operations[operation];
|
|
323
|
+
if (!operationFn) {
|
|
324
|
+
throw new Error(`Operation ${String(operation)} not found on connector ${String(connectorId)}`);
|
|
325
|
+
}
|
|
326
|
+
return await operationFn(input, config);
|
|
327
|
+
}
|
|
328
|
+
async executeGroup(groupName, operation, input) {
|
|
329
|
+
// Use smart routing workflow and extract result
|
|
330
|
+
const workflow = this.createSmartGroupWorkflow(groupName, operation, input);
|
|
331
|
+
const result = await workflow.run({ input });
|
|
332
|
+
return result.result;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// ===== ENGINE FACTORY =====
|
|
336
|
+
function ConnectorEngine(connectors, groups, config) {
|
|
337
|
+
const engineConfig = config || {
|
|
338
|
+
configLoader: async () => ({}), // Default empty config
|
|
339
|
+
routingConfigLoader: async () => ({
|
|
340
|
+
profile_id: "default",
|
|
341
|
+
name: "default",
|
|
342
|
+
algorithm: { type: "priority", data: [] },
|
|
343
|
+
created_at: new Date().toISOString(),
|
|
344
|
+
modified_at: new Date().toISOString(),
|
|
345
|
+
version: 1,
|
|
346
|
+
}),
|
|
347
|
+
};
|
|
348
|
+
return new ConnectorEngineImpl(connectors, groups || {}, engineConfig);
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=clean-connector-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-connector-engine.js","sourceRoot":"","sources":["../../src/engine/clean-connector-engine.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA0qBH,0CA+BC;AArsBD,qDAAgD;AAChD,kEAOuC;AAuHvC,oCAAoC;AAEpC,MAAM,mBAAmB;IAUvB,YACE,UAAuB,EACvB,MAAe,EACf,MAAyB;QAEzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAA;QACrD,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,EAAE,CAAA;QAExC,IAAI,CAAC,sBAAsB,EAAE,CAAA;IAC/B,CAAC;IAED,wCAAwC;IAEhC,sBAAsB;QAC5B,IAAI,CAAC,wBAAwB,EAAE,CAAA;QAC/B,IAAI,CAAC,oBAAoB,EAAE,CAAA;IAC7B,CAAC;IAEO,wBAAwB;QAC9B,KAAK,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACpE,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC3D,MAAM,UAAU,GAAG,UAAU,IAAI,CAAC,UAAU,CAC1C,WAAW,CACZ,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAEnC;gBAAC,IAAY,CAAC,UAAU,CAAC,GAAG,GA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,WAAW,EAAE;YACpC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,OAAO,EAAE,CAAC;SACX,CAAC;KACH,CAAA;IAED,OAAO,IAAI,mBAAmB,CAC5B,UAAU,EACV,MAAM,IAAK,EAAc,EACzB,YAAY,CAIS,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type-Safe Connector Engine
|
|
3
|
+
* @description ETO Framework core connector engine with compile-time type safety
|
|
4
|
+
*/
|
|
5
|
+
import { ConnectorID, ConnectorConfig, ExecutionOptions, ConnectorSelectionCriteria, ConnectorSelectionStrategy, PluginHealthStatus } from "../types/engine";
|
|
6
|
+
import { BaseConnectorPlugin } from "../types/base-plugin";
|
|
7
|
+
import { ReturnWorkflow } from "@etohq/framework/workflows-sdk";
|
|
8
|
+
export interface ConnectorTypesConfig {
|
|
9
|
+
[connectorType: string]: {
|
|
10
|
+
[operation: string]: {
|
|
11
|
+
input: any;
|
|
12
|
+
output: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
type ConnectorEngineMethods<TConnectorTypes extends ConnectorTypesConfig> = {
|
|
17
|
+
[K in keyof TConnectorTypes]: {
|
|
18
|
+
[Op in keyof TConnectorTypes[K] as `execute${Capitalize<K & string>}${Capitalize<Op & string>}`]: (input: TConnectorTypes[K][Op] extends {
|
|
19
|
+
input: infer I;
|
|
20
|
+
} ? I : never, options?: ExecutionOptions) => ReturnWorkflow<TConnectorTypes[K][Op] extends {
|
|
21
|
+
input: infer I;
|
|
22
|
+
} ? I : never, TConnectorTypes[K][Op] extends {
|
|
23
|
+
output: infer O;
|
|
24
|
+
} ? O : never, [
|
|
25
|
+
]>;
|
|
26
|
+
};
|
|
27
|
+
}[keyof TConnectorTypes];
|
|
28
|
+
interface BaseEngineMethods {
|
|
29
|
+
installConnector(provider: string, config: ConnectorConfig): Promise<ConnectorID>;
|
|
30
|
+
registerPlugin(provider: string, plugin: BaseConnectorPlugin): void;
|
|
31
|
+
uninstallConnector(connectorId: ConnectorID): Promise<void>;
|
|
32
|
+
selectConnector(connectorType: string, operation: string, criteria?: ConnectorSelectionCriteria): ConnectorID;
|
|
33
|
+
getWorkflow(connectorType: string, operation: string, connectorId?: ConnectorID): any;
|
|
34
|
+
getSystemHealth(): Promise<{
|
|
35
|
+
overall: "healthy" | "degraded" | "unhealthy";
|
|
36
|
+
connectors: Record<ConnectorID, PluginHealthStatus>;
|
|
37
|
+
}>;
|
|
38
|
+
setSelectionStrategy(strategy: ConnectorSelectionStrategy): void;
|
|
39
|
+
getConnectors(): ConnectorConfig[];
|
|
40
|
+
getConnector(connectorId: ConnectorID): ConnectorConfig | null;
|
|
41
|
+
}
|
|
42
|
+
declare class ConnectorEngineImpl<TConnectorTypes extends ConnectorTypesConfig> implements BaseEngineMethods {
|
|
43
|
+
private connectorTypes;
|
|
44
|
+
private connectors;
|
|
45
|
+
private plugins;
|
|
46
|
+
private pluginRegistry;
|
|
47
|
+
private generatedWorkflows;
|
|
48
|
+
private selectionStrategy;
|
|
49
|
+
constructor(connectorTypes: TConnectorTypes);
|
|
50
|
+
setSelectionStrategy(strategy: ConnectorSelectionStrategy): void;
|
|
51
|
+
getConnectors(): ConnectorConfig[];
|
|
52
|
+
getConnector(connectorId: ConnectorID): ConnectorConfig | null;
|
|
53
|
+
private generateDynamicMethods;
|
|
54
|
+
private capitalize;
|
|
55
|
+
installConnector(provider: string, config: ConnectorConfig): Promise<ConnectorID>;
|
|
56
|
+
registerPlugin(provider: string, plugin: BaseConnectorPlugin): void;
|
|
57
|
+
uninstallConnector(connectorId: ConnectorID): Promise<void>;
|
|
58
|
+
selectConnector(connectorType: string, operation: string, criteria?: ConnectorSelectionCriteria): ConnectorID;
|
|
59
|
+
private generateWorkflowsForConnector;
|
|
60
|
+
private createWorkflowForOperation;
|
|
61
|
+
getWorkflow(connectorType: string, operation: string, connectorId?: ConnectorID): ReturnWorkflow<any, any, []>;
|
|
62
|
+
getSystemHealth(): Promise<{
|
|
63
|
+
overall: "healthy" | "degraded" | "unhealthy";
|
|
64
|
+
connectors: Record<ConnectorID, PluginHealthStatus>;
|
|
65
|
+
}>;
|
|
66
|
+
private isTypedPlugin;
|
|
67
|
+
private pluginSupportsOperation;
|
|
68
|
+
private createPluginRegistry;
|
|
69
|
+
}
|
|
70
|
+
declare function ConnectorEngine<TConnectorTypes extends ConnectorTypesConfig>(connectorTypes: TConnectorTypes): ConnectorEngineImpl<TConnectorTypes> & ConnectorEngineMethods<TConnectorTypes>;
|
|
71
|
+
export type ConnectorEngineType<T extends ConnectorTypesConfig> = ReturnType<typeof ConnectorEngine<T>>;
|
|
72
|
+
export { ConnectorEngine };
|
|
73
|
+
//# sourceMappingURL=connector-engine-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-engine-impl.d.ts","sourceRoot":"","sources":["../../src/engine/connector-engine-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,0BAA0B,EAC1B,0BAA0B,EAE1B,kBAAkB,EAEnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,mBAAmB,EAIpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAML,cAAc,EACf,MAAM,gCAAgC,CAAA;AAIvC,MAAM,WAAW,oBAAoB;IACnC,CAAC,aAAa,EAAE,MAAM,GAAG;QACvB,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,KAAK,EAAE,GAAG,CAAA;YACV,MAAM,EAAE,GAAG,CAAA;SACZ,CAAA;KACF,CAAA;CACF;AAID,KAAK,sBAAsB,CAAC,eAAe,SAAS,oBAAoB,IAAI;KACzE,CAAC,IAAI,MAAM,eAAe,GAAG;SAC3B,EAAE,IAAI,MAAM,eAAe,CAAC,CAAC,CAAC,IAAI,UAAU,UAAU,CACrD,CAAC,GAAG,MAAM,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