@contractspec/integration.providers-impls 3.0.0 → 3.2.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 (121) hide show
  1. package/README.md +59 -9
  2. package/dist/impls/async-event-queue.js +2 -0
  3. package/dist/impls/composio-fallback-resolver.d.ts +34 -0
  4. package/dist/impls/composio-fallback-resolver.js +580 -0
  5. package/dist/impls/composio-mcp.d.ts +22 -0
  6. package/dist/impls/composio-mcp.js +164 -0
  7. package/dist/impls/composio-proxies.d.ts +60 -0
  8. package/dist/impls/composio-proxies.js +311 -0
  9. package/dist/impls/composio-sdk.d.ts +25 -0
  10. package/dist/impls/composio-sdk.js +78 -0
  11. package/dist/impls/composio-types.d.ts +43 -0
  12. package/dist/impls/composio-types.js +54 -0
  13. package/dist/impls/elevenlabs-voice.js +2 -0
  14. package/dist/impls/fal-voice.js +2 -0
  15. package/dist/impls/fathom-meeting-recorder.js +2 -0
  16. package/dist/impls/fathom-meeting-recorder.mapper.js +2 -0
  17. package/dist/impls/fathom-meeting-recorder.utils.js +2 -0
  18. package/dist/impls/fathom-meeting-recorder.webhooks.js +2 -0
  19. package/dist/impls/fireflies-meeting-recorder.js +2 -0
  20. package/dist/impls/fireflies-meeting-recorder.queries.js +2 -0
  21. package/dist/impls/fireflies-meeting-recorder.utils.js +2 -0
  22. package/dist/impls/gcs-storage.js +2 -0
  23. package/dist/impls/gmail-inbound.js +2 -0
  24. package/dist/impls/gmail-outbound.js +2 -0
  25. package/dist/impls/google-calendar.js +2 -0
  26. package/dist/impls/gradium-voice.js +2 -0
  27. package/dist/impls/granola-meeting-recorder.js +2 -0
  28. package/dist/impls/granola-meeting-recorder.mcp.js +2 -0
  29. package/dist/impls/health/base-health-provider.js +2 -0
  30. package/dist/impls/health/hybrid-health-providers.js +2 -0
  31. package/dist/impls/health/official-health-providers.js +2 -0
  32. package/dist/impls/health/provider-normalizers.js +2 -0
  33. package/dist/impls/health/providers.js +2 -0
  34. package/dist/impls/health-provider-factory.js +2 -0
  35. package/dist/impls/index.d.ts +5 -0
  36. package/dist/impls/index.js +657 -0
  37. package/dist/impls/jira.js +2 -0
  38. package/dist/impls/linear.js +2 -0
  39. package/dist/impls/messaging-github.js +2 -0
  40. package/dist/impls/messaging-slack.js +2 -0
  41. package/dist/impls/messaging-whatsapp-meta.js +2 -0
  42. package/dist/impls/messaging-whatsapp-twilio.js +2 -0
  43. package/dist/impls/mistral-conversational.js +2 -0
  44. package/dist/impls/mistral-conversational.session.js +2 -0
  45. package/dist/impls/mistral-embedding.js +2 -0
  46. package/dist/impls/mistral-llm.js +2 -0
  47. package/dist/impls/mistral-stt.js +2 -0
  48. package/dist/impls/notion.js +2 -0
  49. package/dist/impls/posthog-reader.js +2 -0
  50. package/dist/impls/posthog-utils.js +2 -0
  51. package/dist/impls/posthog.js +2 -0
  52. package/dist/impls/postmark-email.js +2 -0
  53. package/dist/impls/powens-client.js +2 -0
  54. package/dist/impls/powens-openbanking.js +2 -0
  55. package/dist/impls/provider-factory.d.ts +24 -0
  56. package/dist/impls/provider-factory.js +70 -0
  57. package/dist/impls/qdrant-vector.js +2 -0
  58. package/dist/impls/stripe-payments.js +2 -0
  59. package/dist/impls/supabase-psql.js +2 -0
  60. package/dist/impls/supabase-vector.js +2 -0
  61. package/dist/impls/tldv-meeting-recorder.js +2 -0
  62. package/dist/impls/twilio-sms.js +2 -0
  63. package/dist/index.js +657 -0
  64. package/dist/node/impls/async-event-queue.js +3 -0
  65. package/dist/node/impls/composio-fallback-resolver.js +580 -0
  66. package/dist/node/impls/composio-mcp.js +164 -0
  67. package/dist/node/impls/composio-proxies.js +311 -0
  68. package/dist/node/impls/composio-sdk.js +78 -0
  69. package/dist/node/impls/composio-types.js +54 -0
  70. package/dist/node/impls/elevenlabs-voice.js +3 -0
  71. package/dist/node/impls/fal-voice.js +3 -0
  72. package/dist/node/impls/fathom-meeting-recorder.js +3 -0
  73. package/dist/node/impls/fathom-meeting-recorder.mapper.js +3 -0
  74. package/dist/node/impls/fathom-meeting-recorder.utils.js +3 -0
  75. package/dist/node/impls/fathom-meeting-recorder.webhooks.js +3 -0
  76. package/dist/node/impls/fireflies-meeting-recorder.js +3 -0
  77. package/dist/node/impls/fireflies-meeting-recorder.queries.js +3 -0
  78. package/dist/node/impls/fireflies-meeting-recorder.utils.js +3 -0
  79. package/dist/node/impls/gcs-storage.js +3 -0
  80. package/dist/node/impls/gmail-inbound.js +3 -0
  81. package/dist/node/impls/gmail-outbound.js +3 -0
  82. package/dist/node/impls/google-calendar.js +3 -0
  83. package/dist/node/impls/gradium-voice.js +3 -0
  84. package/dist/node/impls/granola-meeting-recorder.js +3 -0
  85. package/dist/node/impls/granola-meeting-recorder.mcp.js +3 -0
  86. package/dist/node/impls/health/base-health-provider.js +3 -0
  87. package/dist/node/impls/health/hybrid-health-providers.js +3 -0
  88. package/dist/node/impls/health/official-health-providers.js +3 -0
  89. package/dist/node/impls/health/provider-normalizers.js +3 -0
  90. package/dist/node/impls/health/providers.js +3 -0
  91. package/dist/node/impls/health-provider-factory.js +3 -0
  92. package/dist/node/impls/index.js +658 -0
  93. package/dist/node/impls/jira.js +3 -0
  94. package/dist/node/impls/linear.js +3 -0
  95. package/dist/node/impls/messaging-github.js +3 -0
  96. package/dist/node/impls/messaging-slack.js +3 -0
  97. package/dist/node/impls/messaging-whatsapp-meta.js +3 -0
  98. package/dist/node/impls/messaging-whatsapp-twilio.js +3 -0
  99. package/dist/node/impls/mistral-conversational.js +3 -0
  100. package/dist/node/impls/mistral-conversational.session.js +3 -0
  101. package/dist/node/impls/mistral-embedding.js +3 -0
  102. package/dist/node/impls/mistral-llm.js +3 -0
  103. package/dist/node/impls/mistral-stt.js +3 -0
  104. package/dist/node/impls/notion.js +3 -0
  105. package/dist/node/impls/posthog-reader.js +3 -0
  106. package/dist/node/impls/posthog-utils.js +3 -0
  107. package/dist/node/impls/posthog.js +3 -0
  108. package/dist/node/impls/postmark-email.js +3 -0
  109. package/dist/node/impls/powens-client.js +3 -0
  110. package/dist/node/impls/powens-openbanking.js +3 -0
  111. package/dist/node/impls/provider-factory.js +71 -0
  112. package/dist/node/impls/qdrant-vector.js +3 -0
  113. package/dist/node/impls/stripe-payments.js +3 -0
  114. package/dist/node/impls/supabase-psql.js +3 -0
  115. package/dist/node/impls/supabase-vector.js +3 -0
  116. package/dist/node/impls/tldv-meeting-recorder.js +3 -0
  117. package/dist/node/impls/twilio-sms.js +3 -0
  118. package/dist/node/index.js +658 -0
  119. package/dist/node/secrets/provider.js +3 -0
  120. package/dist/secrets/provider.js +2 -0
  121. package/package.json +71 -10
package/README.md CHANGED
@@ -37,7 +37,7 @@ Secret payload example (`secretRef` target value):
37
37
  Factory usage:
38
38
 
39
39
  ```ts
40
- import { IntegrationProviderFactory } from "@contractspec/integration.providers-impls/impls/provider-factory";
40
+ import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
41
41
 
42
42
  const factory = new IntegrationProviderFactory();
43
43
  const analytics = await factory.createAnalyticsProvider(context); // key: analytics.posthog
@@ -54,7 +54,7 @@ This package ships health/wearables providers routed by a transport strategy:
54
54
  Factory usage:
55
55
 
56
56
  ```ts
57
- import { IntegrationProviderFactory } from "@contractspec/integration.providers-impls/impls/provider-factory";
57
+ import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
58
58
 
59
59
  const factory = new IntegrationProviderFactory();
60
60
  const healthProvider = await factory.createHealthProvider(context); // key: health.*
@@ -158,7 +158,7 @@ Secret payload example (`secretRef` target value):
158
158
  ### 2) Factory usage
159
159
 
160
160
  ```ts
161
- import { IntegrationProviderFactory } from "@contractspec/integration.providers-impls/impls/provider-factory";
161
+ import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
162
162
 
163
163
  const factory = new IntegrationProviderFactory();
164
164
 
@@ -169,20 +169,20 @@ const dbProvider = await factory.createDatabaseProvider(databaseContext); // key
169
169
  ### 3) Direct provider usage
170
170
 
171
171
  ```ts
172
- import { SupabaseVectorProvider } from "@contractspec/integration.providers-impls/impls/supabase-vector";
173
- import { SupabasePostgresProvider } from "@contractspec/integration.providers-impls/impls/supabase-psql";
172
+ import { SupabaseVectorProvider } from '@contractspec/integration.providers-impls/impls/supabase-vector';
173
+ import { SupabasePostgresProvider } from '@contractspec/integration.providers-impls/impls/supabase-psql';
174
174
 
175
175
  const vector = new SupabaseVectorProvider({
176
176
  connectionString: process.env.SUPABASE_DATABASE_URL,
177
- schema: "public",
178
- table: "contractspec_vectors",
179
- distanceMetric: "cosine",
177
+ schema: 'public',
178
+ table: 'contractspec_vectors',
179
+ distanceMetric: 'cosine',
180
180
  });
181
181
 
182
182
  const database = new SupabasePostgresProvider({
183
183
  connectionString: process.env.SUPABASE_DATABASE_URL,
184
184
  maxConnections: 10,
185
- sslMode: "require",
185
+ sslMode: 'require',
186
186
  });
187
187
  ```
188
188
 
@@ -191,3 +191,53 @@ const database = new SupabasePostgresProvider({
191
191
  - `SupabaseVectorProvider` creates `vector` extension/table/indexes automatically when `createTableIfMissing=true`.
192
192
  - `SupabaseVectorProvider` maps scores from pgvector distances (`cosine`, `l2`, `inner_product`) to `VectorSearchResult.score`.
193
193
  - `SupabasePostgresProvider` supports `$1`, `$2`, ... placeholders, transactions, and clean connection shutdown through `close()`.
194
+
195
+ ## Composio universal fallback
196
+
197
+ When an integration key has no native implementation, the factory can delegate to [Composio](https://composio.dev/) -- a platform providing 850+ toolkits (Slack, GitHub, Gmail, Jira, Salesforce, etc.) via MCP or native SDK.
198
+
199
+ ### Enabling the fallback
200
+
201
+ Pass a `ComposioFallbackResolver` when constructing the factory:
202
+
203
+ ```ts
204
+ import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
205
+ import { ComposioFallbackResolver } from '@contractspec/integration.providers-impls/impls/composio-fallback-resolver';
206
+
207
+ const resolver = new ComposioFallbackResolver({
208
+ apiKey: process.env.COMPOSIO_API_KEY!,
209
+ preferredTransport: 'mcp', // "mcp" (default) or "sdk"
210
+ });
211
+
212
+ const factory = new IntegrationProviderFactory({ composioFallback: resolver });
213
+
214
+ // Now any unsupported key falls through to Composio:
215
+ const messaging = await factory.createMessagingProvider(discordContext);
216
+ ```
217
+
218
+ ### Transport modes
219
+
220
+ | Mode | When to use | How it works |
221
+ | ----------------- | ------------------ | --------------------------------------------------------------- |
222
+ | **MCP** (default) | Standard fallback | Creates a Composio session, connects via MCP protocol |
223
+ | **SDK** | Advanced use cases | Uses `@composio/core` directly for tool search, auth management |
224
+
225
+ ### Domain proxy adapters
226
+
227
+ For typed domains (messaging, email, payments, project management, calendar), the resolver returns proxy adapters that implement the ContractSpec interface and translate method calls to Composio tool executions. For untyped domains, a `ComposioGenericProxy` provides raw `executeTool()` access.
228
+
229
+ ### Runtime configuration
230
+
231
+ Add `composio` to your `IntegrationRuntimeConfig`:
232
+
233
+ ```ts
234
+ const runtimeConfig: IntegrationRuntimeConfig = {
235
+ secretProvider: mySecretProvider,
236
+ composio: {
237
+ apiKey: process.env.COMPOSIO_API_KEY!,
238
+ preferredTransport: 'mcp',
239
+ },
240
+ };
241
+ ```
242
+
243
+ See `docs/tech/integrations/composio-fallback.md` for the full architecture.
@@ -1,4 +1,6 @@
1
1
  // @bun
2
+ var __require = import.meta.require;
3
+
2
4
  // src/impls/async-event-queue.ts
3
5
  class AsyncEventQueue {
4
6
  values = [];
@@ -0,0 +1,34 @@
1
+ import type { IntegrationContext } from '@contractspec/integration.runtime/runtime';
2
+ import type { ComposioConfig } from './composio-types';
3
+ import { ComposioGenericProxy } from './composio-proxies';
4
+ import type { MessagingProvider } from '../messaging';
5
+ import type { EmailOutboundProvider } from '../email';
6
+ import type { PaymentsProvider } from '../payments';
7
+ import type { ProjectManagementProvider } from '../project-management';
8
+ import type { CalendarProvider } from '../calendar';
9
+ /**
10
+ * Resolves unsupported integration keys to Composio-backed proxy providers.
11
+ *
12
+ * When IntegrationProviderFactory encounters an unknown key, it delegates
13
+ * to this resolver. The resolver maps the key to a Composio toolkit and
14
+ * returns a domain-typed proxy that translates method calls into Composio
15
+ * tool executions.
16
+ */
17
+ export declare class ComposioFallbackResolver {
18
+ private readonly mcpProvider;
19
+ private readonly sdkProvider;
20
+ private readonly preferredTransport;
21
+ constructor(config: ComposioConfig);
22
+ /**
23
+ * Returns true for any integration key -- Composio is a universal fallback.
24
+ * The actual availability of the toolkit is checked at execution time.
25
+ */
26
+ canHandle(_integrationKey: string): boolean;
27
+ createMessagingProxy(context: IntegrationContext): MessagingProvider;
28
+ createEmailProxy(context: IntegrationContext): EmailOutboundProvider;
29
+ createPaymentsProxy(context: IntegrationContext): PaymentsProvider;
30
+ createProjectManagementProxy(context: IntegrationContext): ProjectManagementProvider;
31
+ createCalendarProxy(context: IntegrationContext): CalendarProvider;
32
+ createGenericProxy(context: IntegrationContext): ComposioGenericProxy;
33
+ private getProxy;
34
+ }