@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.
Files changed (77) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/CHANGELOG.md +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +253 -0
  5. package/dist/engine/clean-connector-engine.d.ts +81 -0
  6. package/dist/engine/clean-connector-engine.d.ts.map +1 -0
  7. package/dist/engine/clean-connector-engine.js +350 -0
  8. package/dist/engine/clean-connector-engine.js.map +1 -0
  9. package/dist/engine/connector-engine-impl.d.ts +73 -0
  10. package/dist/engine/connector-engine-impl.d.ts.map +1 -0
  11. package/dist/engine/connector-engine-impl.js +332 -0
  12. package/dist/engine/connector-engine-impl.js.map +1 -0
  13. package/dist/engine/connector-engine.d.ts +54 -0
  14. package/dist/engine/connector-engine.d.ts.map +1 -0
  15. package/dist/engine/connector-engine.js +694 -0
  16. package/dist/engine/connector-engine.js.map +1 -0
  17. package/dist/engine/index.d.ts +7 -0
  18. package/dist/engine/index.d.ts.map +1 -0
  19. package/dist/engine/index.js +10 -0
  20. package/dist/engine/index.js.map +1 -0
  21. package/dist/engine/routing-engine.d.ts +26 -0
  22. package/dist/engine/routing-engine.d.ts.map +1 -0
  23. package/dist/engine/routing-engine.js +329 -0
  24. package/dist/engine/routing-engine.js.map +1 -0
  25. package/dist/examples/booking-connector-example.d.ts +7 -0
  26. package/dist/examples/booking-connector-example.d.ts.map +1 -0
  27. package/dist/examples/booking-connector-example.js +221 -0
  28. package/dist/examples/booking-connector-example.js.map +1 -0
  29. package/dist/examples/dynamic-methods-example.d.ts +7 -0
  30. package/dist/examples/dynamic-methods-example.d.ts.map +1 -0
  31. package/dist/examples/dynamic-methods-example.js +163 -0
  32. package/dist/examples/dynamic-methods-example.js.map +1 -0
  33. package/dist/index.d.ts +9 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +14 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/types/base-plugin.d.ts +170 -0
  38. package/dist/types/base-plugin.d.ts.map +1 -0
  39. package/dist/types/base-plugin.js +68 -0
  40. package/dist/types/base-plugin.js.map +1 -0
  41. package/dist/types/connector-plugin.d.ts +22 -0
  42. package/dist/types/connector-plugin.d.ts.map +1 -0
  43. package/dist/types/connector-plugin.js +11 -0
  44. package/dist/types/connector-plugin.js.map +1 -0
  45. package/dist/types/engine.d.ts +223 -0
  46. package/dist/types/engine.d.ts.map +1 -0
  47. package/dist/types/engine.js +7 -0
  48. package/dist/types/engine.js.map +1 -0
  49. package/dist/types/index.d.ts +5 -0
  50. package/dist/types/index.d.ts.map +1 -0
  51. package/dist/types/index.js +9 -0
  52. package/dist/types/index.js.map +1 -0
  53. package/dist/types/operation-groups.d.ts +78 -0
  54. package/dist/types/operation-groups.d.ts.map +1 -0
  55. package/dist/types/operation-groups.js +60 -0
  56. package/dist/types/operation-groups.js.map +1 -0
  57. package/dist/types/routing-config.d.ts +116 -0
  58. package/dist/types/routing-config.d.ts.map +1 -0
  59. package/dist/types/routing-config.js +6 -0
  60. package/dist/types/routing-config.js.map +1 -0
  61. package/dist/utils/create-connector-engine.d.ts +31 -0
  62. package/dist/utils/create-connector-engine.d.ts.map +1 -0
  63. package/dist/utils/create-connector-engine.js +30 -0
  64. package/dist/utils/create-connector-engine.js.map +1 -0
  65. package/examples/booking-example.ts +168 -0
  66. package/examples/booking-test.ts +231 -0
  67. package/hyperswitch-example.ts +263 -0
  68. package/jest.config.js +2 -0
  69. package/package.json +54 -0
  70. package/src/engine/clean-connector-engine.ts +726 -0
  71. package/src/engine/index.ts +13 -0
  72. package/src/engine/routing-engine.ts +394 -0
  73. package/src/index.ts +32 -0
  74. package/src/types/connector-plugin.ts +34 -0
  75. package/src/types/index.ts +5 -0
  76. package/src/types/routing-config.ts +196 -0
  77. package/tsconfig.json +3 -0
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Booking Connector Engine Example
4
+ * @description Example usage of the type-safe connector engine for booking operations
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.demonstrateConnectorEngine = demonstrateConnectorEngine;
8
+ exports.demonstrateTypeSafety = demonstrateTypeSafety;
9
+ const index_1 = require("../index");
10
+ // Calendar Plugin
11
+ class GoogleCalendarPlugin extends index_1.AbstractConnectorPlugin {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.operationTypes = {
15
+ createEvent: {
16
+ inputSchema: {},
17
+ outputSchema: {},
18
+ description: 'Create calendar event',
19
+ timeout: 30000
20
+ },
21
+ updateEvent: {
22
+ inputSchema: {},
23
+ outputSchema: {},
24
+ description: 'Update calendar event',
25
+ timeout: 30000
26
+ },
27
+ deleteEvent: {
28
+ inputSchema: {},
29
+ outputSchema: {},
30
+ description: 'Delete calendar event',
31
+ timeout: 15000
32
+ }
33
+ };
34
+ }
35
+ getName() {
36
+ return 'google-calendar';
37
+ }
38
+ getVersion() {
39
+ return '1.0.0';
40
+ }
41
+ getCapabilities() {
42
+ return {
43
+ health_check: true,
44
+ webhook_handling: true,
45
+ calendar_events: true,
46
+ meeting_links: true
47
+ };
48
+ }
49
+ async createEvent(config, data, context) {
50
+ // Mock implementation
51
+ return {
52
+ eventId: `gcal_${Date.now()}`,
53
+ eventUrl: `https://calendar.google.com/event/${Date.now()}`,
54
+ meetingUrl: `https://meet.google.com/${Math.random().toString(36).substr(2, 9)}`,
55
+ status: 'created'
56
+ };
57
+ }
58
+ async updateEvent(config, input, context) {
59
+ return {
60
+ eventId: input.eventId,
61
+ eventUrl: `https://calendar.google.com/event/${input.eventId}`,
62
+ status: 'created'
63
+ };
64
+ }
65
+ async deleteEvent(config, input, context) {
66
+ return { success: true };
67
+ }
68
+ }
69
+ // Email Plugin
70
+ class SendGridEmailPlugin extends index_1.AbstractConnectorPlugin {
71
+ constructor() {
72
+ super(...arguments);
73
+ this.operationTypes = {
74
+ sendEmail: {
75
+ inputSchema: {},
76
+ outputSchema: {},
77
+ description: 'Send email notification',
78
+ timeout: 15000
79
+ },
80
+ sendBulkEmail: {
81
+ inputSchema: {},
82
+ outputSchema: {},
83
+ description: 'Send bulk email notifications',
84
+ timeout: 60000
85
+ }
86
+ };
87
+ }
88
+ getName() {
89
+ return 'sendgrid-email';
90
+ }
91
+ getVersion() {
92
+ return '1.0.0';
93
+ }
94
+ getCapabilities() {
95
+ return {
96
+ health_check: true,
97
+ webhook_handling: true,
98
+ email_notifications: true,
99
+ bulk_email: true,
100
+ templates: true
101
+ };
102
+ }
103
+ async sendEmail(config, data, context) {
104
+ // Mock implementation
105
+ return {
106
+ messageId: `sg_${Date.now()}`,
107
+ status: 'sent',
108
+ deliveredAt: new Date()
109
+ };
110
+ }
111
+ async sendBulkEmail(config, input, context) {
112
+ return {
113
+ batchId: `batch_${Date.now()}`,
114
+ totalSent: input.recipients.length
115
+ };
116
+ }
117
+ }
118
+ // ===== CONNECTOR ENGINE SETUP =====
119
+ // Define plugins
120
+ const plugins = {
121
+ calendar: new GoogleCalendarPlugin(),
122
+ notification: new SendGridEmailPlugin()
123
+ };
124
+ // Define operation groups
125
+ const operationGroups = (0, index_1.createOperationGroupBuilder)()
126
+ .addGroup('booking', {
127
+ domains: ['calendar', 'notification'],
128
+ operations: ['createEvent', 'sendEmail'],
129
+ options: {
130
+ behavior: 'execute_all',
131
+ timeout: 45000,
132
+ retries: 2
133
+ }
134
+ })
135
+ .addGroup('calendar', {
136
+ domains: ['calendar'],
137
+ operations: ['createEvent', 'updateEvent', 'deleteEvent'],
138
+ options: {
139
+ behavior: 'route_by_domain',
140
+ connectorId: 'calendar',
141
+ timeout: 30000
142
+ }
143
+ })
144
+ .build();
145
+ // ===== USAGE EXAMPLE =====
146
+ async function demonstrateConnectorEngine() {
147
+ // Validate configuration
148
+ const validation = (0, index_1.validateConnectorEngineConfig)(plugins, operationGroups);
149
+ if (!validation.valid) {
150
+ console.error('Configuration validation failed:', validation.errors);
151
+ return;
152
+ }
153
+ if (validation.warnings.length > 0) {
154
+ console.warn('Configuration warnings:', validation.warnings);
155
+ }
156
+ // Create connector engine
157
+ const engine = (0, index_1.createConnectorEngine)(plugins, operationGroups);
158
+ // Initialize plugins
159
+ const calendarConfig = {
160
+ connector_id: 'google-calendar-1',
161
+ provider: 'google',
162
+ name: 'Google Calendar',
163
+ config: { apiKey: 'mock-api-key' },
164
+ capabilities: plugins.calendar.getCapabilities(),
165
+ enabled: true
166
+ };
167
+ const emailConfig = {
168
+ connector_id: 'sendgrid-1',
169
+ provider: 'sendgrid',
170
+ name: 'SendGrid Email',
171
+ config: { apiKey: 'mock-sendgrid-key' },
172
+ capabilities: plugins.notification.getCapabilities(),
173
+ enabled: true
174
+ };
175
+ await plugins.calendar.initialize(calendarConfig);
176
+ await plugins.notification.initialize(emailConfig);
177
+ // Example 1: Execute booking operation group (creates event + sends notification)
178
+ console.log('=== Booking Operation Group Example ===');
179
+ // This would be generated as: executeBookingCreateEvent and executeBookingSendEmail
180
+ // But since we're using 'execute_all' behavior, it executes both operations
181
+ // Example 2: Execute single calendar operation
182
+ console.log('=== Single Calendar Operation Example ===');
183
+ try {
184
+ // Get available domains and operations
185
+ console.log('Available domains:', engine.getAvailableDomains());
186
+ console.log('Calendar operations:', engine.getAvailableOperations('calendar'));
187
+ console.log('Notification operations:', engine.getAvailableOperations('notification'));
188
+ // Check system health
189
+ const health = await engine.getSystemHealth();
190
+ console.log('System health:', health);
191
+ console.log('Connector engine demonstration completed successfully!');
192
+ }
193
+ catch (error) {
194
+ console.error('Error during demonstration:', error);
195
+ }
196
+ finally {
197
+ // Clean up
198
+ await plugins.calendar.destroy();
199
+ await plugins.notification.destroy();
200
+ }
201
+ }
202
+ // ===== TYPE SAFETY DEMONSTRATION =====
203
+ function demonstrateTypeSafety() {
204
+ // The connector engine provides full type safety:
205
+ // 1. Plugin operations are type-checked
206
+ const calendarPlugin = new GoogleCalendarPlugin();
207
+ // ✅ This is type-safe - TypeScript knows the expected input/output types
208
+ // calendarPlugin.createEvent(config, eventData, context) -> Promise<CalendarEventResult>
209
+ // 2. Operation groups are validated at compile time
210
+ // ✅ TypeScript ensures domains and operations exist
211
+ // 3. No 'any' types - everything is properly typed
212
+ // ✅ Full IntelliSense support and compile-time error checking
213
+ console.log('Type safety demonstration - check TypeScript compilation for errors!');
214
+ }
215
+ // Run demonstration if this file is executed directly
216
+ if (require.main === module) {
217
+ demonstrateConnectorEngine()
218
+ .then(() => demonstrateTypeSafety())
219
+ .catch(console.error);
220
+ }
221
+ //# sourceMappingURL=booking-connector-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"booking-connector-example.js","sourceRoot":"","sources":["../../src/examples/booking-connector-example.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAmNH,gEAiEC;AAID,sDAgBC;AAtSD,oCAQkB;AAkClB,kBAAkB;AAClB,MAAM,oBAAqB,SAAQ,+BAAuB;IAA1D;;QACE,mBAAc,GAAG;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,EAAuB;gBACpC,YAAY,EAAE,EAAyB;gBACvC,WAAW,EAAE,uBAAuB;gBACpC,OAAO,EAAE,KAAK;aACf;YACD,WAAW,EAAE;gBACX,WAAW,EAAE,EAA8D;gBAC3E,YAAY,EAAE,EAAyB;gBACvC,WAAW,EAAE,uBAAuB;gBACpC,OAAO,EAAE,KAAK;aACf;YACD,WAAW,EAAE;gBACX,WAAW,EAAE,EAAyB;gBACtC,YAAY,EAAE,EAA0B;gBACxC,WAAW,EAAE,uBAAuB;gBACpC,OAAO,EAAE,KAAK;aACf;SACF,CAAC;IAoDJ,CAAC;IAlDC,OAAO;QACL,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,eAAe;QACb,OAAO;YACL,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE,IAAI;YACtB,eAAe,EAAE,IAAI;YACrB,aAAa,EAAE,IAAI;SACpB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,W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C,qBAAqB,EAAE,CAAC;SACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview Dynamic Methods Example
3
+ * @description Example showing execute<Domain><Operation> and execute<GroupName><Operation> patterns
4
+ */
5
+ export declare function demonstrateDynamicMethods(): Promise<void>;
6
+ export declare function demonstrateTypeSafety(): void;
7
+ //# sourceMappingURL=dynamic-methods-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-methods-example.d.ts","sourceRoot":"","sources":["../../src/examples/dynamic-methods-example.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2IH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAsD/D;AAID,wBAAgB,qBAAqB,IAAI,IAAI,CAkB5C"}
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Dynamic Methods Example
4
+ * @description Example showing execute<Domain><Operation> and execute<GroupName><Operation> patterns
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.demonstrateDynamicMethods = demonstrateDynamicMethods;
8
+ exports.demonstrateTypeSafety = demonstrateTypeSafety;
9
+ const index_1 = require("../index");
10
+ // ✅ Simple Calendar Plugin - methods can return values directly
11
+ class CalendarPlugin extends index_1.AbstractConnectorPlugin {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.operationTypes = {
15
+ createEvent: {
16
+ inputSchema: {},
17
+ outputSchema: {}
18
+ },
19
+ updateEvent: {
20
+ inputSchema: {},
21
+ outputSchema: {}
22
+ }
23
+ };
24
+ }
25
+ getName() { return 'calendar'; }
26
+ getVersion() { return '1.0.0'; }
27
+ getCapabilities() {
28
+ return { health_check: true, webhook_handling: false, calendar_events: true };
29
+ }
30
+ // ✅ Simple method - just return the result
31
+ async createEvent(config, data, context) {
32
+ return {
33
+ eventId: `cal_${Date.now()}`,
34
+ eventUrl: `https://calendar.example.com/event/${Date.now()}`,
35
+ status: 'created'
36
+ };
37
+ }
38
+ // ✅ Simple method - just return the result
39
+ async updateEvent(config, input, context) {
40
+ return {
41
+ eventId: input.eventId,
42
+ eventUrl: `https://calendar.example.com/event/${input.eventId}`,
43
+ status: 'created'
44
+ };
45
+ }
46
+ }
47
+ // ✅ Simple Email Plugin
48
+ class EmailPlugin extends index_1.AbstractConnectorPlugin {
49
+ constructor() {
50
+ super(...arguments);
51
+ this.operationTypes = {
52
+ sendEmail: {
53
+ inputSchema: {},
54
+ outputSchema: {}
55
+ }
56
+ };
57
+ }
58
+ getName() { return 'email'; }
59
+ getVersion() { return '1.0.0'; }
60
+ getCapabilities() {
61
+ return { health_check: true, webhook_handling: false, email_notifications: true };
62
+ }
63
+ // ✅ Simple method - just return the result
64
+ async sendEmail(config, data, context) {
65
+ return {
66
+ messageId: `email_${Date.now()}`,
67
+ status: 'sent'
68
+ };
69
+ }
70
+ }
71
+ // ===== CONNECTOR ENGINE SETUP =====
72
+ const plugins = {
73
+ calendar: new CalendarPlugin(),
74
+ email: new EmailPlugin()
75
+ };
76
+ const operationGroups = {
77
+ booking: {
78
+ domains: ['calendar', 'email'],
79
+ operations: ['createEvent', 'sendEmail'],
80
+ options: {
81
+ behavior: 'execute_all', // Execute both calendar and email operations
82
+ timeout: 30000
83
+ }
84
+ },
85
+ notification: {
86
+ domains: ['email'],
87
+ operations: ['sendEmail'],
88
+ options: {
89
+ behavior: 'route_by_domain', // Route to email domain
90
+ timeout: 15000
91
+ }
92
+ }
93
+ };
94
+ // ===== USAGE EXAMPLE =====
95
+ async function demonstrateDynamicMethods() {
96
+ console.log('=== Dynamic Methods Example ===');
97
+ // Create connector engine
98
+ const engine = (0, index_1.createConnectorEngine)(plugins, operationGroups);
99
+ // Show generated methods
100
+ const methods = engine.getGeneratedMethods();
101
+ console.log('Generated domain methods:', methods.domainMethods);
102
+ console.log('Generated group methods:', methods.groupMethods);
103
+ // ✅ DOMAIN METHODS: execute<Domain><Operation>
104
+ console.log('\n=== Domain Methods ===');
105
+ // executeCalendarCreateEvent - calls calendar.createEvent directly
106
+ const calendarResult = await engine.executeCalendarCreateEvent({
107
+ title: 'Team Meeting',
108
+ startTime: new Date(),
109
+ endTime: new Date(Date.now() + 60 * 60 * 1000),
110
+ attendees: ['user@example.com']
111
+ });
112
+ console.log('Calendar result:', calendarResult);
113
+ // executeEmailSendEmail - calls email.sendEmail directly
114
+ const emailResult = await engine.executeEmailSendEmail({
115
+ to: 'user@example.com',
116
+ subject: 'Meeting Invitation',
117
+ body: 'You have been invited to a meeting'
118
+ });
119
+ console.log('Email result:', emailResult);
120
+ // ✅ GROUP METHODS: execute<GroupName><Operation>
121
+ console.log('\n=== Group Methods ===');
122
+ // executeBookingCreateEvent - executes calendar.createEvent AND email.sendEmail (execute_all)
123
+ const bookingResult = await engine.executeBookingCreateEvent({
124
+ title: 'Team Meeting',
125
+ startTime: new Date(),
126
+ endTime: new Date(Date.now() + 60 * 60 * 1000),
127
+ attendees: ['user@example.com']
128
+ });
129
+ console.log('Booking result (execute_all):', bookingResult);
130
+ // executeNotificationSendEmail - routes to email.sendEmail (route_by_domain)
131
+ const notificationResult = await engine.executeNotificationSendEmail({
132
+ to: 'user@example.com',
133
+ subject: 'Notification',
134
+ body: 'This is a notification'
135
+ });
136
+ console.log('Notification result (route_by_domain):', notificationResult);
137
+ console.log('\n=== Type Safety Demo ===');
138
+ console.log('All methods are fully typed with IntelliSense support!');
139
+ console.log('Try typing engine.execute... in your IDE to see auto-completion');
140
+ }
141
+ // ===== TYPE SAFETY DEMONSTRATION =====
142
+ function demonstrateTypeSafety() {
143
+ const engine = (0, index_1.createConnectorEngine)(plugins, operationGroups);
144
+ // ✅ These methods are generated dynamically with full type safety:
145
+ // Domain methods (direct plugin calls):
146
+ // - engine.executeCalendarCreateEvent(data) -> Promise<CalendarEventResult>
147
+ // - engine.executeCalendarUpdateEvent(data) -> Promise<CalendarEventResult>
148
+ // - engine.executeEmailSendEmail(data) -> Promise<EmailResult>
149
+ // Group methods (based on operation group behavior):
150
+ // - engine.executeBookingCreateEvent(data) -> Promise<OperationGroupResult<CalendarEventResult>>
151
+ // - engine.executeBookingSendEmail(data) -> Promise<OperationGroupResult<EmailResult>>
152
+ // - engine.executeNotificationSendEmail(data) -> Promise<OperationGroupResult<EmailResult>>
153
+ console.log('Type safety: All methods have proper TypeScript types!');
154
+ console.log('IntelliSense: Auto-completion works for all generated methods!');
155
+ console.log('Compile-time errors: Invalid inputs are caught at build time!');
156
+ }
157
+ // Run demonstration if this file is executed directly
158
+ if (require.main === module) {
159
+ demonstrateDynamicMethods()
160
+ .then(() => demonstrateTypeSafety())
161
+ .catch(console.error);
162
+ }
163
+ //# sourceMappingURL=dynamic-methods-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-methods-example.js","sourceRoot":"","sources":["../../src/examples/dynamic-methods-example.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA2IH,8DAsDC;AAID,sDAkBC;AArND,oCAMkB;AA6BlB,gEAAgE;AAChE,MAAM,cAAe,SAAQ,+BAAuB;IAApD;;QACE,mBAAc,GAAG;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,EAAuB;gBACpC,YAAY,EAAE,EAAyB;aACxC;YACD,WAAW,EAAE;gBACX,WAAW,EAAE,EAA8D;gBAC3E,YAAY,EAAE,EAAyB;aACxC;SACF,CAAC;IAiCJ,CAAC;IA/BC,OAAO,KAAa,OAAO,UAAU,CAAC,CAAC,CAAC;IACxC,UAAU,KAAa,OAAO,OAAO,CAAC,CAAC,CAAC;IACxC,eAAe;QACb,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,WAAW,CACf,MAAuB,EACvB,IAAuB,EACvB,OAAoC;QAEpC,OAAO;YACL,OAAO,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE;Y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,CAAC;IAC9E,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;AAC/E,CAAC;AAED,sDAAsD;AACtD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,yBAAyB,EAAE;SACxB,IAAI,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;SACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fileoverview ETO Framework Connector Engine
3
+ * @description Clean plugin-first connector engine with Hyperswitch-style routing
4
+ */
5
+ export { ConnectorEngine } from "./engine/clean-connector-engine";
6
+ export type { ConnectorRegistry, OperationGroup, OperationGroups, EngineConfig, GroupResult } from "./engine/clean-connector-engine";
7
+ export { type ConnectorPlugin, type OperationType, AbstractConnectorPlugin } from "./types/connector-plugin";
8
+ export type { RoutingConfig, RoutingContext, RoutingDecision, ConnectorMetrics, RoutingRule, ConnectorChoice, RoutingAlgorithm } from "./types/routing-config";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,gBAAgB,EACjB,MAAM,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview ETO Framework Connector Engine
4
+ * @description Clean plugin-first connector engine with Hyperswitch-style routing
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AbstractConnectorPlugin = exports.ConnectorEngine = void 0;
8
+ // ===== CORE ENGINE =====
9
+ var clean_connector_engine_1 = require("./engine/clean-connector-engine");
10
+ Object.defineProperty(exports, "ConnectorEngine", { enumerable: true, get: function () { return clean_connector_engine_1.ConnectorEngine; } });
11
+ // ===== PLUGIN TYPES =====
12
+ var connector_plugin_1 = require("./types/connector-plugin");
13
+ Object.defineProperty(exports, "AbstractConnectorPlugin", { enumerable: true, get: function () { return connector_plugin_1.AbstractConnectorPlugin; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0BAA0B;AAC1B,0EAAkE;AAAzD,yHAAA,eAAe,OAAA;AASxB,2BAA2B;AAC3B,6DAIkC;AADhC,2HAAA,uBAAuB,OAAA"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @fileoverview Base Plugin Interface
3
+ * @description Enhanced base interface with operation types and container context
4
+ */
5
+ import { ConnectorConfig, ConnectorCapabilities, PluginHealthStatus } from "./engine";
6
+ import { EtoContainer } from "@etohq/types";
7
+ export interface StepDefinition<TInput = unknown, TOutput = unknown> {
8
+ stepId: string;
9
+ run(input: TInput, context: {
10
+ container: EtoContainer;
11
+ }): Promise<TOutput>;
12
+ }
13
+ export interface OperationDefinition<TInput = unknown, TOutput = unknown> {
14
+ inputSchema: TInput;
15
+ outputSchema: TOutput;
16
+ description?: string;
17
+ timeout?: number;
18
+ retries?: number;
19
+ }
20
+ export interface BaseConnectorPlugin {
21
+ getName(): string;
22
+ getVersion(): string;
23
+ getCapabilities(): ConnectorCapabilities;
24
+ initialize(config: ConnectorConfig): Promise<void>;
25
+ destroy(): Promise<void>;
26
+ healthCheck(): Promise<PluginHealthStatus>;
27
+ operationTypes?: Record<string, OperationDefinition>;
28
+ parseWebhook?(config: ConnectorConfig, payload: unknown, headers: Record<string, string>): Promise<WebhookEvent>;
29
+ validateWebhook?(config: ConnectorConfig, payload: unknown, signature: string): boolean;
30
+ [operationName: string]: unknown;
31
+ }
32
+ export interface UniversalConnectorPlugin extends BaseConnectorPlugin {
33
+ [operationName: string]: ((config: ConnectorConfig, input: unknown, context: {
34
+ container: EtoContainer;
35
+ }) => StepDefinition | Promise<unknown>) | unknown;
36
+ }
37
+ export interface TypedConnectorPlugin<TOperations extends Record<string, OperationDefinition> = Record<string, OperationDefinition>> extends BaseConnectorPlugin {
38
+ operationTypes: TOperations;
39
+ getSupportedOperations(): TOperations;
40
+ executeOperation<K extends keyof TOperations>(config: ConnectorConfig, operationName: K, input: TOperations[K] extends {
41
+ inputSchema: infer I;
42
+ } ? I : unknown, context: {
43
+ container: EtoContainer;
44
+ }): StepDefinition | Promise<TOperations[K] extends {
45
+ outputSchema: infer O;
46
+ } ? O : unknown>;
47
+ }
48
+ export interface WebhookEvent {
49
+ id: string;
50
+ type: string;
51
+ source: string;
52
+ timestamp: Date;
53
+ data: unknown;
54
+ metadata?: Record<string, unknown>;
55
+ }
56
+ export interface ConnectorPluginFactory<TPlugin extends BaseConnectorPlugin = BaseConnectorPlugin> {
57
+ create(config: ConnectorConfig): Promise<TPlugin>;
58
+ validate(config: ConnectorConfig): boolean;
59
+ getRequiredConfig(): string[];
60
+ getOptionalConfig(): string[];
61
+ }
62
+ export interface PluginRegistry {
63
+ register(name: string, plugin: BaseConnectorPlugin): void;
64
+ unregister(name: string): void;
65
+ get(name: string): BaseConnectorPlugin | undefined;
66
+ list(): string[];
67
+ has(name: string): boolean;
68
+ validate(plugin: BaseConnectorPlugin): boolean;
69
+ getOperations(pluginName: string): string[];
70
+ getPluginInfo(name: string): {
71
+ name: string;
72
+ version: string;
73
+ capabilities: ConnectorCapabilities;
74
+ operations: string[];
75
+ } | undefined;
76
+ }
77
+ export declare enum PluginType {
78
+ PAYMENT = "payment",
79
+ NOTIFICATION = "notification",
80
+ CALENDAR = "calendar",
81
+ VIDEO = "video",
82
+ STORAGE = "storage",
83
+ ANALYTICS = "analytics",
84
+ RESOURCE = "resource",
85
+ CUSTOM = "custom"
86
+ }
87
+ export interface PluginMetadata {
88
+ name: string;
89
+ version: string;
90
+ type: PluginType;
91
+ description?: string;
92
+ author?: string;
93
+ homepage?: string;
94
+ repository?: string;
95
+ license?: string;
96
+ keywords?: string[];
97
+ dependencies?: Record<string, string>;
98
+ peerDependencies?: Record<string, string>;
99
+ }
100
+ export interface PluginConfigSchema {
101
+ type: 'object';
102
+ properties: Record<string, {
103
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
104
+ description?: string;
105
+ required?: boolean;
106
+ default?: unknown;
107
+ enum?: unknown[];
108
+ pattern?: string;
109
+ minimum?: number;
110
+ maximum?: number;
111
+ }>;
112
+ required?: string[];
113
+ additionalProperties?: boolean;
114
+ }
115
+ export declare abstract class AbstractConnectorPlugin implements BaseConnectorPlugin {
116
+ protected config: ConnectorConfig | null;
117
+ protected initialized: boolean;
118
+ abstract getName(): string;
119
+ abstract getVersion(): string;
120
+ abstract getCapabilities(): ConnectorCapabilities;
121
+ initialize(config: ConnectorConfig): Promise<void>;
122
+ destroy(): Promise<void>;
123
+ healthCheck(): Promise<PluginHealthStatus>;
124
+ protected ensureInitialized(): void;
125
+ protected getConfig(): ConnectorConfig;
126
+ }
127
+ export interface PluginRegistry {
128
+ registerPlugin<TPlugin extends BaseConnectorPlugin>(pluginType: string, provider: string, factory: ConnectorPluginFactory<TPlugin>): void;
129
+ getPlugin(pluginType: string, provider: string): ConnectorPluginFactory | null;
130
+ listPlugins(pluginType?: string): Array<{
131
+ pluginType: string;
132
+ provider: string;
133
+ factory: ConnectorPluginFactory;
134
+ }>;
135
+ }
136
+ export interface OperationDefinition {
137
+ name: string;
138
+ inputSchema: any;
139
+ outputSchema: any;
140
+ description?: string;
141
+ requiredCapabilities?: string[];
142
+ }
143
+ export interface TypedConnectorPlugin<TOperations extends Record<string, OperationDefinition> = Record<string, OperationDefinition>> extends BaseConnectorPlugin {
144
+ getSupportedOperations(): TOperations;
145
+ executeOperation<K extends keyof TOperations>(config: ConnectorConfig, operationName: K, input: TOperations[K] extends {
146
+ inputSchema: infer I;
147
+ } ? I : any): Promise<ConnectorResponse<TOperations[K] extends {
148
+ outputSchema: infer O;
149
+ } ? O : any>>;
150
+ }
151
+ export declare enum PluginType {
152
+ PAYMENT = "payment",
153
+ NOTIFICATION = "notification",
154
+ CALENDAR = "calendar",
155
+ VIDEO = "video",
156
+ STORAGE = "storage",
157
+ RESOURCE = "resource",
158
+ BOOKING = "booking"
159
+ }
160
+ export interface ProviderInfo {
161
+ name: string;
162
+ displayName: string;
163
+ description?: string;
164
+ logoUrl?: string;
165
+ websiteUrl?: string;
166
+ supportedRegions?: string[];
167
+ requiredCredentials: string[];
168
+ optionalCredentials?: string[];
169
+ }
170
+ //# sourceMappingURL=base-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-plugin.d.ts","sourceRoot":"","sources":["../../src/types/base-plugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACjE,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;AAID,MAAM,WAAW,mBAAmB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM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