@etohq/connector-engine 1.5.3 → 1.5.4-alpha.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.
Files changed (35) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/package.json +5 -4
  4. package/dist/engine/connector-engine-impl.d.ts +0 -73
  5. package/dist/engine/connector-engine-impl.d.ts.map +0 -1
  6. package/dist/engine/connector-engine-impl.js +0 -332
  7. package/dist/engine/connector-engine-impl.js.map +0 -1
  8. package/dist/engine/connector-engine.d.ts +0 -54
  9. package/dist/engine/connector-engine.d.ts.map +0 -1
  10. package/dist/engine/connector-engine.js +0 -694
  11. package/dist/engine/connector-engine.js.map +0 -1
  12. package/dist/examples/booking-connector-example.d.ts +0 -7
  13. package/dist/examples/booking-connector-example.d.ts.map +0 -1
  14. package/dist/examples/booking-connector-example.js +0 -221
  15. package/dist/examples/booking-connector-example.js.map +0 -1
  16. package/dist/examples/dynamic-methods-example.d.ts +0 -7
  17. package/dist/examples/dynamic-methods-example.d.ts.map +0 -1
  18. package/dist/examples/dynamic-methods-example.js +0 -163
  19. package/dist/examples/dynamic-methods-example.js.map +0 -1
  20. package/dist/types/base-plugin.d.ts +0 -170
  21. package/dist/types/base-plugin.d.ts.map +0 -1
  22. package/dist/types/base-plugin.js +0 -68
  23. package/dist/types/base-plugin.js.map +0 -1
  24. package/dist/types/engine.d.ts +0 -223
  25. package/dist/types/engine.d.ts.map +0 -1
  26. package/dist/types/engine.js +0 -7
  27. package/dist/types/engine.js.map +0 -1
  28. package/dist/types/operation-groups.d.ts +0 -78
  29. package/dist/types/operation-groups.d.ts.map +0 -1
  30. package/dist/types/operation-groups.js +0 -60
  31. package/dist/types/operation-groups.js.map +0 -1
  32. package/dist/utils/create-connector-engine.d.ts +0 -31
  33. package/dist/utils/create-connector-engine.d.ts.map +0 -1
  34. package/dist/utils/create-connector-engine.js +0 -30
  35. package/dist/utils/create-connector-engine.js.map +0 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @etohq/connector-engine@1.5.1-alpha.4 build /Users/solarsoft0/workspace/obigtech/shopabox/shopabox-platform-api/eto/packages/core/connector-engine
2
+ > @etohq/connector-engine@1.5.4-alpha.0 build /Users/solarsoft0/workspace/etohq/eto/packages/core/connector-engine
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @etohq/connector-engine
2
2
 
3
+ ## 1.5.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @etohq/framework@1.5.4-alpha.0
9
+
3
10
  ## 1.5.1-alpha.9
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@etohq/connector-engine",
3
- "version": "1.5.3",
3
+ "version": "1.5.4-alpha.0",
4
4
  "description": "ETO Framework Core Connector Engine - Universal plugin system for external integrations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "dependencies": {
8
- "bignumber.js": "9.1.2"
8
+ "bignumber.js": "9.1.2",
9
+ "@etohq/framework": "1.5.4-alpha.0"
9
10
  },
10
11
  "devDependencies": {
11
12
  "@mikro-orm/core": "6.4.3",
@@ -17,12 +18,12 @@
17
18
  "typescript": "5.8.3",
18
19
  "tsc-alias": "1.8.6",
19
20
  "vite": "5.2.11",
20
- "@etohq/framework": "1.5.3"
21
+ "@etohq/framework": "1.5.4-alpha.0"
21
22
  },
22
23
  "peerDependencies": {
23
24
  "awilix": "8.0.1",
24
25
  "vite": "5.2.11",
25
- "@etohq/framework": "1.5.3"
26
+ "@etohq/framework": "1.5.4-alpha.0"
26
27
  },
27
28
  "peerDependenciesMeta": {
28
29
  "ioredis": {
@@ -1,73 +0,0 @@
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
@@ -1 +0,0 @@
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,KAA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AAC,6BAA6B;IAyBrC,OAAO,CAAC,0BAA0B;IAoGlC,WAAW,CACT,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,WAAW,GACxB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IAiBzB,eAAe,IAAI,OAAO,CAAC;QAC/B,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;QAC7C,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAA;KACpD,CAAC;IA2CF,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,oBAAoB;CA2E7B;AAKD,iBAAS,eAAe,CAAC,eAAe,SAAS,oBAAoB,EACnE,cAAc,EAAE,eAAe,GAC9B,mBAAmB,CAAC,eAAe,CAAC,GACrC,sBAAsB,CAAC,eAAe,CAAC,CAKxC;AAID,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,oBAAoB,IAAI,UAAU,CAC1E,OAAO,eAAe,CAAC,CAAC,CAAC,CAC1B,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,332 +0,0 @@
1
- "use strict";
2
- /**
3
- * @fileoverview Type-Safe Connector Engine
4
- * @description ETO Framework core connector engine with compile-time type safety
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ConnectorEngine = ConnectorEngine;
8
- const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
9
- // ===== TYPE-SAFE CONNECTOR ENGINE IMPLEMENTATION =====
10
- class ConnectorEngineImpl {
11
- constructor(connectorTypes) {
12
- this.connectorTypes = connectorTypes;
13
- this.connectors = new Map();
14
- this.plugins = new Map();
15
- this.generatedWorkflows = new Map();
16
- this.selectionStrategy = "round_robin";
17
- this.pluginRegistry = this.createPluginRegistry();
18
- this.generateDynamicMethods();
19
- }
20
- setSelectionStrategy(strategy) {
21
- this.selectionStrategy = strategy;
22
- }
23
- getConnectors() {
24
- return Array.from(this.connectors.values());
25
- }
26
- getConnector(connectorId) {
27
- return this.connectors.get(connectorId) || null;
28
- }
29
- // ===== DYNAMIC METHOD GENERATION =====
30
- generateDynamicMethods() {
31
- for (const [connectorType, operations] of Object.entries(this.connectorTypes)) {
32
- for (const operationName of Object.keys(operations)) {
33
- const methodName = `execute${this.capitalize(connectorType)}${this.capitalize(operationName)}`;
34
- this[methodName] = (input, options) => {
35
- // Select connector based on options or auto-select
36
- const connectorId = options?.connectorId ||
37
- this.selectConnector(connectorType, operationName, options?.selection);
38
- // Get the workflow from registry
39
- // createWorkflow already returns a properly typed ReturnWorkflow
40
- const workflow = this.getWorkflow(connectorType, operationName, connectorId);
41
- // Return the workflow directly - it's already a complete ReturnWorkflow
42
- // The workflow function, run(), runAsStep(), etc. are all provided by createWorkflow
43
- return workflow;
44
- };
45
- }
46
- }
47
- }
48
- capitalize(str) {
49
- return str.charAt(0).toUpperCase() + str.slice(1);
50
- }
51
- // ===== CONNECTOR LIFECYCLE =====
52
- async installConnector(provider, config) {
53
- const plugin = this.plugins.get(provider);
54
- if (!plugin) {
55
- throw new Error(`Plugin not found for provider: ${provider}`);
56
- }
57
- await plugin.initialize(config);
58
- this.connectors.set(config.connector_id, config);
59
- // Generate workflows for this connector
60
- this.generateWorkflowsForConnector(config.connector_id, provider, plugin);
61
- return config.connector_id;
62
- }
63
- registerPlugin(provider, plugin) {
64
- this.plugins.set(provider, plugin);
65
- }
66
- async uninstallConnector(connectorId) {
67
- const config = this.connectors.get(connectorId);
68
- if (!config) {
69
- throw new Error(`Connector not found: ${connectorId}`);
70
- }
71
- const plugin = this.plugins.get(config.provider);
72
- if (plugin) {
73
- await plugin.destroy();
74
- }
75
- this.connectors.delete(connectorId);
76
- // Remove generated workflows
77
- for (const [key] of this.generatedWorkflows) {
78
- if (key.includes(connectorId)) {
79
- this.generatedWorkflows.delete(key);
80
- }
81
- }
82
- }
83
- // ===== CONNECTOR SELECTION =====
84
- selectConnector(connectorType, operation, criteria) {
85
- const availableConnectors = Array.from(this.connectors.values()).filter((connector) => {
86
- if (!connector.enabled)
87
- return false;
88
- const plugin = this.plugins.get(connector.provider);
89
- if (!plugin)
90
- return false;
91
- // Check if plugin supports the operation
92
- if (this.isTypedPlugin(plugin)) {
93
- const operations = plugin.getSupportedOperations();
94
- if (!operations[operation])
95
- return false;
96
- }
97
- // Apply selection criteria
98
- if (criteria?.preferredProviders &&
99
- !criteria.preferredProviders.includes(connector.provider)) {
100
- return false;
101
- }
102
- if (criteria?.excludeProviders &&
103
- criteria.excludeProviders.includes(connector.provider)) {
104
- return false;
105
- }
106
- if (criteria?.region &&
107
- connector.metadata?.region !== criteria.region) {
108
- return false;
109
- }
110
- if (criteria?.requireCapabilities) {
111
- for (const capability of criteria.requireCapabilities) {
112
- if (!connector.capabilities[capability]) {
113
- return false;
114
- }
115
- }
116
- }
117
- return true;
118
- });
119
- if (availableConnectors.length === 0) {
120
- throw new Error(`No available connectors for ${connectorType}.${operation}`);
121
- }
122
- // Apply selection strategy
123
- switch (this.selectionStrategy) {
124
- case "round_robin":
125
- return availableConnectors[Math.floor(Math.random() * availableConnectors.length)].connector_id;
126
- case "priority":
127
- // todo fix
128
- return availableConnectors[0].connector_id;
129
- default:
130
- return availableConnectors[0].connector_id;
131
- }
132
- }
133
- // ===== WORKFLOW GENERATION =====
134
- generateWorkflowsForConnector(connectorId, provider, plugin) {
135
- for (const [connectorType, operations] of Object.entries(this.connectorTypes)) {
136
- for (const operationName of Object.keys(operations)) {
137
- // Check if plugin supports this operation
138
- if (this.pluginSupportsOperation(plugin, operationName)) {
139
- const workflowKey = `${connectorType}-${connectorId}-${operationName}`;
140
- const workflow = this.createWorkflowForOperation(connectorId, provider, connectorType, operationName, plugin);
141
- this.generatedWorkflows.set(workflowKey, workflow);
142
- }
143
- }
144
- }
145
- }
146
- createWorkflowForOperation(connectorId, provider, connectorType, operationName, plugin) {
147
- // Create ETO step for this operation
148
- const step = (0, workflows_sdk_1.createStep)(`${provider}-${operationName}`, async (input, { container }) => {
149
- const config = this.connectors.get(connectorId);
150
- if (!config) {
151
- throw new Error(`Connector not found: ${connectorId}`);
152
- }
153
- let result;
154
- if (this.isTypedPlugin(plugin)) {
155
- result = await plugin.executeOperation(config, operationName, input.data);
156
- }
157
- else {
158
- // Fallback for non-typed plugins
159
- const pluginMethod = plugin[operationName];
160
- if (typeof pluginMethod === "function") {
161
- const rawResult = await pluginMethod.call(plugin, config, input.data);
162
- result = {
163
- success: true,
164
- data: rawResult,
165
- metadata: {
166
- connectorId,
167
- provider: config.provider,
168
- executionTime: 0,
169
- timestamp: new Date(),
170
- retryCount: 0,
171
- },
172
- };
173
- }
174
- else {
175
- throw new Error(`Operation ${operationName} not supported by plugin ${provider}`);
176
- }
177
- }
178
- if (!result.success) {
179
- throw new Error(result.error?.message || `Operation ${operationName} failed`);
180
- }
181
- return new workflows_sdk_1.StepResponse(result.data, {
182
- connectorId,
183
- operation: operationName,
184
- result: result.data,
185
- });
186
- }, async (compensationData, { container }) => {
187
- // Auto-generated compensation
188
- console.log(`Compensating ${provider}-${operationName}:`, compensationData);
189
- // Check if plugin has custom compensation
190
- const compensationFn = plugin[`${operationName}_compensate`];
191
- if (compensationFn && typeof compensationFn === "function") {
192
- await compensationFn.call(plugin, compensationData, { container });
193
- }
194
- });
195
- // Create ETO workflow that wraps the step
196
- const workflow = (0, workflows_sdk_1.createWorkflow)(`${provider}-${operationName}-workflow`, (input) => {
197
- const config = this.connectors.get(connectorId);
198
- const stepInput = {
199
- config,
200
- data: input,
201
- };
202
- const result = step(stepInput);
203
- return new workflows_sdk_1.WorkflowResponse(result);
204
- });
205
- return workflow;
206
- }
207
- // ===== WORKFLOW ACCESS =====
208
- getWorkflow(connectorType, operation, connectorId) {
209
- const selectedConnectorId = connectorId || this.selectConnector(connectorType, operation);
210
- const workflowKey = `${connectorType}-${selectedConnectorId}-${operation}`;
211
- const workflow = this.generatedWorkflows.get(workflowKey);
212
- if (!workflow) {
213
- throw new Error(`Workflow not found for ${connectorType}.${operation} with connector ${selectedConnectorId}`);
214
- }
215
- return workflow;
216
- }
217
- // ===== HEALTH MONITORING =====
218
- async getSystemHealth() {
219
- const connectors = {};
220
- let healthyCount = 0;
221
- let totalCount = 0;
222
- for (const [connectorId, config] of this.connectors) {
223
- totalCount++;
224
- const plugin = this.plugins.get(config.provider);
225
- if (plugin) {
226
- try {
227
- connectors[connectorId] = await plugin.healthCheck();
228
- if (connectors[connectorId].status === "healthy") {
229
- healthyCount++;
230
- }
231
- }
232
- catch (error) {
233
- connectors[connectorId] = {
234
- status: "unhealthy",
235
- lastChecked: new Date(),
236
- errors: [error.message],
237
- };
238
- }
239
- }
240
- else {
241
- connectors[connectorId] = {
242
- status: "unhealthy",
243
- lastChecked: new Date(),
244
- errors: ["Plugin not found"],
245
- };
246
- }
247
- }
248
- let overall = "healthy";
249
- if (healthyCount === 0 && totalCount > 0) {
250
- overall = "unhealthy";
251
- }
252
- else if (healthyCount < totalCount) {
253
- overall = "degraded";
254
- }
255
- return { overall, connectors };
256
- }
257
- // ===== UTILITY METHODS =====
258
- isTypedPlugin(plugin) {
259
- return "getSupportedOperations" in plugin && "executeOperation" in plugin;
260
- }
261
- pluginSupportsOperation(plugin, operationName) {
262
- if (this.isTypedPlugin(plugin)) {
263
- const operations = plugin.getSupportedOperations();
264
- return operationName in operations;
265
- }
266
- // For non-typed plugins, check if method exists
267
- return typeof plugin[operationName] === "function";
268
- }
269
- createPluginRegistry() {
270
- const registry = new Map();
271
- return {
272
- registerPlugin: (pluginType, provider, factory) => {
273
- if (!registry.has(pluginType)) {
274
- registry.set(pluginType, new Map());
275
- }
276
- registry.get(pluginType).set(provider, factory);
277
- },
278
- getPlugin: (pluginType, provider) => {
279
- return registry.get(pluginType)?.get(provider) || null;
280
- },
281
- listPlugins: (pluginType) => {
282
- const result = [];
283
- if (pluginType) {
284
- const providers = registry.get(pluginType);
285
- if (providers) {
286
- for (const [provider, factory] of providers) {
287
- result.push({ pluginType, provider, factory });
288
- }
289
- }
290
- }
291
- else {
292
- for (const [type, providers] of registry) {
293
- for (const [provider, factory] of providers) {
294
- result.push({ pluginType: type, provider, factory });
295
- }
296
- }
297
- }
298
- return result;
299
- },
300
- register: function (name, plugin) {
301
- throw new Error("Function not implemented.");
302
- },
303
- unregister: function (name) {
304
- throw new Error("Function not implemented.");
305
- },
306
- get: function (name) {
307
- throw new Error("Function not implemented.");
308
- },
309
- list: function () {
310
- throw new Error("Function not implemented.");
311
- },
312
- has: function (name) {
313
- throw new Error("Function not implemented.");
314
- },
315
- validate: function (plugin) {
316
- throw new Error("Function not implemented.");
317
- },
318
- getOperations: function (pluginName) {
319
- throw new Error("Function not implemented.");
320
- },
321
- getPluginInfo: function (name) {
322
- throw new Error("Function not implemented.");
323
- },
324
- };
325
- }
326
- }
327
- // ===== CONFIGURATION =====
328
- // ===== TYPE-SAFE CONNECTOR ENGINE FACTORY =====
329
- function ConnectorEngine(connectorTypes) {
330
- return new ConnectorEngineImpl(connectorTypes);
331
- }
332
- //# sourceMappingURL=connector-engine-impl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-engine-impl.js","sourceRoot":"","sources":["../../src/engine/connector-engine-impl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAmkBM,0CAAe;AAhjBxB,kEAOuC;AA0DvC,wDAAwD;AAExD,MAAM,mBAAmB;IASvB,YAAoB,cAA+B;QAA/B,mBAAc,GAAd,cAAc,CAAiB;QAN3C,eAAU,GAAsC,IAAI,GAAG,EAAE,CAAA;QACzD,YAAO,GAAqC,IAAI,GAAG,EAAE,CAAA;QAErD,uBAAkB,GAAqB,IAAI,GAAG,EAAE,CAAA;QAChD,sBAAiB,GAA+B,aAAa,CAAA;QAGnE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAA;QACjD,IAAI,CAAC,sBAAsB,EAAE,CAAA;IAC/B,CAAC;IACD,oBAAoB,CAAC,QAAoC;QACvD,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AAC;YACD,QAAQ,EAAE,UAAU,IAAY,EAAE,MAA2B;gBAC3D,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,UAAU,EAAE,UAAU,IAAY;gBAChC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,GAAG,EAAE,UAAU,IAAY;gBACzB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,IAAI,EAAE;gBACJ,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,GAAG,EAAE,UAAU,IAAY;gBACzB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,QAAQ,EAAE,UAAU,MAA2B;gBAC7C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,aAAa,EAAE,UAAU,UAAkB;gBACzC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;YACD,aAAa,EAAE,UAAU,IAAY;gBAQnC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;YAC9C,CAAC;SACF,CAAA;IACH,CAAC;CACF;AACD,4BAA4B;AAE5B,iDAAiD;AAEjD,SAAS,eAAe,CACtB,cAA+B;IAG/B,OAAO,IAAI,mBAAmB,CAC5B,cAAc,CAEyB,CAAA;AAC3C,CAAC"}
@@ -1,54 +0,0 @@
1
- /**
2
- * @fileoverview Universal Connector Engine
3
- * @description Plugin-first connector engine with operation groups and full type safety
4
- */
5
- import { BaseConnectorPlugin } from "../types/base-plugin";
6
- import { OperationGroupsConfig, OperationGroupResult, ExtractGroupNames, ExtractGroupOperations, InferOperationGroupInput, InferOperationGroupOutput } from "../types/operation-groups";
7
- import { EtoContainer, Context } from "@etohq/framework/types";
8
- export interface PluginConfiguration {
9
- [domainName: string]: BaseConnectorPlugin;
10
- }
11
- interface StepDefinition<TInput = unknown, TOutput = unknown> {
12
- stepId: string;
13
- run(input: TInput, context: {
14
- container: EtoContainer;
15
- }): Promise<TOutput>;
16
- }
17
- export interface PluginRegistry {
18
- register(name: string, plugin: BaseConnectorPlugin): void;
19
- get(name: string): BaseConnectorPlugin | undefined;
20
- list(): string[];
21
- validate(plugin: BaseConnectorPlugin): boolean;
22
- getOperations(pluginName: string): string[];
23
- }
24
- export declare function ConnectorEngine<TPlugins extends PluginConfiguration, TOperationGroups extends OperationGroupsConfig = {}>(plugins: TPlugins, operationGroups?: TOperationGroups): void;
25
- type GroupMethods = TOperationGroups extends OperationGroupsConfig ? {
26
- [GroupName in ExtractGroupNames<TOperationGroups>]: {
27
- [Operation in ExtractGroupOperations<TOperationGroups, GroupName> as `execute${Capitalize<GroupName & string>}${Capitalize<Operation & string>}`]: <TInput extends InferOperationGroupInput<InferredConnectorTypes, TOperationGroups, GroupName, Operation>, TOutput extends InferOperationGroupOutput<InferredConnectorTypes, TOperationGroups, GroupName, Operation>>(input: TInput, sharedContext?: Context) => Promise<OperationGroupResult<TOutput>>;
28
- }[ExtractGroupOperations<TOperationGroups, GroupName>];
29
- } : as;
30
- declare class ConnectorEngineImpl implements DomainMethods, GroupMethods {
31
- private readonly plugins;
32
- private readonly operationGroups;
33
- private readonly pluginRegistry;
34
- constructor();
35
- private generateDynamicMethods;
36
- private generateDomainMethods;
37
- private generateGroupMethods;
38
- executeDomainOperation<TInput = unknown, TOutput = unknown>(domain: keyof TPlugins, operation: string, input: TInput, sharedContext?: Context): Promise<TOutput>;
39
- executeGroupOperation<TInput = unknown, TOutput = unknown>(groupId: keyof TOperationGroups, operation: string, input: TInput, sharedContext?: Context): Promise<OperationGroupResult<TOutput>>;
40
- private generateEtoStyleMethods;
41
- private generatePluginMethods;
42
- private generateOperationGroupMethods;
43
- private getGroupMethodName;
44
- private executeSingleOperation;
45
- private executeOperationGroup;
46
- getPluginRegistry(): PluginRegistry;
47
- getGeneratedMethods(): {
48
- domainMethods: string[];
49
- groupMethods: string[];
50
- };
51
- }
52
- export { ConnectorEngineImpl as UniversalConnectorEngine };
53
- export type { PluginConfiguration, PluginRegistry, WorkflowDefinition, StepDefinition, OperationGroupsConfig, OperationGroupResult };
54
- //# sourceMappingURL=connector-engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-engine.d.ts","sourceRoot":"","sources":["../../src/engine/connector-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EACL,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAK/D,MAAM,WAAW,mBAAmB;IAClC,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,CAAC;CAC3C;AAID,UAAU,cAAc,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E;AAOD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC1D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IACnD,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC/C,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7C;AAqDD,wBAAgB,eAAe,CAC7B,QAAQ,SAAS,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