@contractspec/lib.contracts 1.56.1 → 1.57.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 (212) hide show
  1. package/dist/_virtual/{rolldown_runtime.js → _rolldown/runtime.js} +3 -3
  2. package/dist/app-config/app-config.contracts.d.ts +50 -50
  3. package/dist/app-config/events.d.ts +27 -27
  4. package/dist/app-config/lifecycle-contracts.d.ts +54 -54
  5. package/dist/app-config/runtime.js +3 -3
  6. package/dist/app-config/validation.js +3 -3
  7. package/dist/capabilities/capabilities.js +20 -20
  8. package/dist/capabilities/context.d.ts +0 -1
  9. package/dist/capabilities/context.js +1 -1
  10. package/dist/capabilities/guards.d.ts +0 -1
  11. package/dist/capabilities/index.d.ts +2 -1
  12. package/dist/capabilities/index.js +2 -1
  13. package/dist/capabilities/meeting-recorder.d.ts +10 -0
  14. package/dist/capabilities/meeting-recorder.js +82 -0
  15. package/dist/capabilities/validation.d.ts +0 -1
  16. package/dist/client/react/drivers/rn-reusables.d.ts +0 -1
  17. package/dist/client/react/drivers/shadcn.d.ts +0 -1
  18. package/dist/client/react/form-render.js +3 -3
  19. package/dist/contract-registry/schemas.d.ts +2 -2
  20. package/dist/data-views/registry.d.ts +0 -1
  21. package/dist/data-views/spec.d.ts +0 -1
  22. package/dist/docs/commands/docsPublish.command.d.ts +13 -13
  23. package/dist/docs/contracts.d.ts +103 -103
  24. package/dist/docs/events/docsGenerated.event.d.ts +13 -13
  25. package/dist/docs/events/docsPublished.event.d.ts +15 -15
  26. package/dist/docs/forms/docsSearch.form.d.ts +4 -4
  27. package/dist/docs/queries/contractReference.query.d.ts +47 -47
  28. package/dist/docs/queries/docsIndex.query.d.ts +57 -57
  29. package/dist/docs/tech/llm/llm-integration.docblock.d.ts +0 -1
  30. package/dist/docs/tech/mcp-endpoints.docblock.js +5 -0
  31. package/dist/events.d.ts +0 -1
  32. package/dist/examples/index.d.ts +0 -1
  33. package/dist/examples/registry.d.ts +0 -1
  34. package/dist/examples/schema.d.ts +17 -17
  35. package/dist/experiments/spec.d.ts +2 -4
  36. package/dist/features/index.d.ts +0 -1
  37. package/dist/features/types.d.ts +2 -5
  38. package/dist/forms/forms.d.ts +1 -2
  39. package/dist/forms/forms.js +1 -2
  40. package/dist/index.d.ts +42 -1
  41. package/dist/index.js +36 -1
  42. package/dist/install.d.ts +2 -5
  43. package/dist/integrations/docs/integrations.docblock.js +19 -1
  44. package/dist/integrations/index.d.ts +26 -1
  45. package/dist/integrations/index.js +20 -1
  46. package/dist/integrations/meeting-recorder/contracts/index.d.ts +10 -0
  47. package/dist/integrations/meeting-recorder/contracts/index.js +12 -0
  48. package/dist/integrations/meeting-recorder/contracts/meetings.d.ts +458 -0
  49. package/dist/integrations/meeting-recorder/contracts/meetings.js +149 -0
  50. package/dist/integrations/meeting-recorder/contracts/transcripts.d.ts +173 -0
  51. package/dist/integrations/meeting-recorder/contracts/transcripts.js +156 -0
  52. package/dist/integrations/meeting-recorder/contracts/webhooks.d.ts +92 -0
  53. package/dist/integrations/meeting-recorder/contracts/webhooks.js +82 -0
  54. package/dist/integrations/meeting-recorder/meeting-recorder.capability.d.ts +7 -0
  55. package/dist/integrations/meeting-recorder/meeting-recorder.capability.js +21 -0
  56. package/dist/integrations/meeting-recorder/meeting-recorder.feature.d.ts +11 -0
  57. package/dist/integrations/meeting-recorder/meeting-recorder.feature.js +67 -0
  58. package/dist/integrations/meeting-recorder/models.d.ts +407 -0
  59. package/dist/integrations/meeting-recorder/models.js +295 -0
  60. package/dist/integrations/meeting-recorder/telemetry.d.ts +16 -0
  61. package/dist/integrations/meeting-recorder/telemetry.js +42 -0
  62. package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
  63. package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
  64. package/dist/integrations/openbanking/contracts/transactions.d.ts +48 -48
  65. package/dist/integrations/openbanking/models.d.ts +55 -55
  66. package/dist/integrations/operations.d.ts +102 -102
  67. package/dist/integrations/providers/analytics-reader.d.ts +107 -0
  68. package/dist/integrations/providers/analytics-reader.js +0 -0
  69. package/dist/integrations/providers/analytics-writer.d.ts +10 -0
  70. package/dist/integrations/providers/analytics-writer.js +0 -0
  71. package/dist/integrations/providers/analytics.d.ts +49 -0
  72. package/dist/integrations/providers/analytics.js +0 -0
  73. package/dist/integrations/providers/database.d.ts +15 -0
  74. package/dist/integrations/providers/database.js +0 -0
  75. package/dist/integrations/providers/fal.d.ts +8 -0
  76. package/dist/integrations/providers/fal.js +94 -0
  77. package/dist/integrations/providers/fathom.d.ts +8 -0
  78. package/dist/integrations/providers/fathom.js +114 -0
  79. package/dist/integrations/providers/fireflies.d.ts +8 -0
  80. package/dist/integrations/providers/fireflies.js +98 -0
  81. package/dist/integrations/providers/gradium.d.ts +8 -0
  82. package/dist/integrations/providers/gradium.js +92 -0
  83. package/dist/integrations/providers/granola.d.ts +8 -0
  84. package/dist/integrations/providers/granola.js +71 -0
  85. package/dist/integrations/providers/index.d.ts +19 -1
  86. package/dist/integrations/providers/index.js +13 -1
  87. package/dist/integrations/providers/jira.d.ts +8 -0
  88. package/dist/integrations/providers/jira.js +90 -0
  89. package/dist/integrations/providers/linear.d.ts +8 -0
  90. package/dist/integrations/providers/linear.js +85 -0
  91. package/dist/integrations/providers/meeting-recorder.d.ts +132 -0
  92. package/dist/integrations/providers/meeting-recorder.js +0 -0
  93. package/dist/integrations/providers/notion.d.ts +8 -0
  94. package/dist/integrations/providers/notion.js +91 -0
  95. package/dist/integrations/providers/posthog.d.ts +8 -0
  96. package/dist/integrations/providers/posthog.js +107 -0
  97. package/dist/integrations/providers/project-management.d.ts +35 -0
  98. package/dist/integrations/providers/project-management.js +0 -0
  99. package/dist/integrations/providers/registry.d.ts +0 -1
  100. package/dist/integrations/providers/registry.js +24 -0
  101. package/dist/integrations/providers/supabase-postgres.d.ts +8 -0
  102. package/dist/integrations/providers/supabase-postgres.js +73 -0
  103. package/dist/integrations/providers/supabase-vector.d.ts +8 -0
  104. package/dist/integrations/providers/supabase-vector.js +93 -0
  105. package/dist/integrations/providers/tldv.d.ts +8 -0
  106. package/dist/integrations/providers/tldv.js +98 -0
  107. package/dist/integrations/runtime.js +0 -1
  108. package/dist/integrations/spec.d.ts +1 -1
  109. package/dist/jobs/queue.d.ts +0 -1
  110. package/dist/knowledge/binding.d.ts +1 -3
  111. package/dist/knowledge/operations.d.ts +66 -66
  112. package/dist/llm/exporters.d.ts +0 -1
  113. package/dist/llm/exporters.js +0 -1
  114. package/dist/llm/prompts.d.ts +0 -1
  115. package/dist/llm/types.d.ts +0 -1
  116. package/dist/onboarding-base.d.ts +29 -29
  117. package/dist/openapi.d.ts +0 -1
  118. package/dist/operations/operation.d.ts +19 -43
  119. package/dist/operations/registry.d.ts +0 -1
  120. package/dist/operations/registry.js +2 -2
  121. package/dist/operations/report/getContractVerificationStatus.d.ts +10 -10
  122. package/dist/ownership.d.ts +41 -88
  123. package/dist/policy/guards.d.ts +0 -1
  124. package/dist/policy/guards.js +3 -3
  125. package/dist/policy/index.d.ts +0 -1
  126. package/dist/policy/validation.d.ts +0 -1
  127. package/dist/product-intent/contract-patch-intent.d.ts +103 -0
  128. package/dist/product-intent/contract-patch-intent.js +33 -0
  129. package/dist/product-intent/contract-spec-patch.d.ts +89 -0
  130. package/dist/product-intent/contract-spec-patch.js +27 -0
  131. package/dist/product-intent/evidence.d.ts +17 -0
  132. package/dist/product-intent/evidence.js +13 -0
  133. package/dist/product-intent/findings.d.ts +60 -0
  134. package/dist/product-intent/findings.js +17 -0
  135. package/dist/product-intent/impact-report.d.ts +60 -0
  136. package/dist/product-intent/impact-report.js +27 -0
  137. package/dist/product-intent/index.d.ts +16 -0
  138. package/dist/product-intent/index.js +17 -0
  139. package/dist/product-intent/insights.d.ts +65 -0
  140. package/dist/product-intent/insights.js +23 -0
  141. package/dist/product-intent/opportunity-brief.d.ts +195 -0
  142. package/dist/product-intent/opportunity-brief.js +42 -0
  143. package/dist/product-intent/problems.d.ts +62 -0
  144. package/dist/product-intent/problems.js +22 -0
  145. package/dist/product-intent/registry.d.ts +32 -0
  146. package/dist/product-intent/registry.js +49 -0
  147. package/dist/product-intent/runtime.d.ts +103 -0
  148. package/dist/product-intent/runtime.js +101 -0
  149. package/dist/product-intent/spec.d.ts +676 -0
  150. package/dist/product-intent/spec.js +53 -0
  151. package/dist/product-intent/task-pack.d.ts +101 -0
  152. package/dist/product-intent/task-pack.js +34 -0
  153. package/dist/product-intent/tickets.d.ts +70 -0
  154. package/dist/product-intent/tickets.js +24 -0
  155. package/dist/product-intent/types.d.ts +12 -0
  156. package/dist/product-intent/types.js +13 -0
  157. package/dist/product-intent/ui-wireframe.d.ts +103 -0
  158. package/dist/product-intent/ui-wireframe.js +33 -0
  159. package/dist/registry-utils.d.ts +0 -1
  160. package/dist/registry-utils.js +3 -3
  161. package/dist/resources.js +1 -1
  162. package/dist/schema-to-markdown.d.ts +0 -1
  163. package/dist/server/contracts-adapter-input.js +2 -2
  164. package/dist/server/graphql-pothos.d.ts +0 -1
  165. package/dist/server/mcp/createMcpServer.d.ts +0 -1
  166. package/dist/server/rest-express.d.ts +0 -1
  167. package/dist/server/rest-generic.js +3 -3
  168. package/dist/server/rest-next-app.d.ts +0 -1
  169. package/dist/tests/spec.d.ts +0 -1
  170. package/dist/translations/registry.d.ts +0 -1
  171. package/dist/translations/spec.d.ts +0 -1
  172. package/dist/translations/validation.d.ts +0 -1
  173. package/dist/types.d.ts +5 -12
  174. package/dist/versioning/types.d.ts +0 -1
  175. package/dist/versioning/utils.d.ts +0 -1
  176. package/dist/workflow/adapters/memory-store.d.ts +0 -1
  177. package/dist/workflow/context.d.ts +0 -1
  178. package/dist/workflow/context.js +2 -2
  179. package/dist/workflow/runner.d.ts +1 -2
  180. package/dist/workspace-config/contractsrc-schema.d.ts +0 -1
  181. package/dist/workspace-config/contractsrc-types.d.ts +1 -3
  182. package/package.json +110 -32
  183. package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +0 -20
  184. package/dist/integrations/providers/impls/elevenlabs-voice.js +0 -95
  185. package/dist/integrations/providers/impls/gcs-storage.d.ts +0 -24
  186. package/dist/integrations/providers/impls/gcs-storage.js +0 -88
  187. package/dist/integrations/providers/impls/gmail-inbound.d.ts +0 -26
  188. package/dist/integrations/providers/impls/gmail-inbound.js +0 -200
  189. package/dist/integrations/providers/impls/gmail-outbound.d.ts +0 -18
  190. package/dist/integrations/providers/impls/gmail-outbound.js +0 -105
  191. package/dist/integrations/providers/impls/google-calendar.d.ts +0 -23
  192. package/dist/integrations/providers/impls/google-calendar.js +0 -154
  193. package/dist/integrations/providers/impls/index.d.ts +0 -15
  194. package/dist/integrations/providers/impls/index.js +0 -16
  195. package/dist/integrations/providers/impls/mistral-embedding.d.ts +0 -23
  196. package/dist/integrations/providers/impls/mistral-embedding.js +0 -41
  197. package/dist/integrations/providers/impls/mistral-llm.d.ts +0 -31
  198. package/dist/integrations/providers/impls/mistral-llm.js +0 -247
  199. package/dist/integrations/providers/impls/postmark-email.d.ts +0 -19
  200. package/dist/integrations/providers/impls/postmark-email.js +0 -55
  201. package/dist/integrations/providers/impls/powens-client.d.ts +0 -124
  202. package/dist/integrations/providers/impls/powens-client.js +0 -171
  203. package/dist/integrations/providers/impls/powens-openbanking.d.ts +0 -27
  204. package/dist/integrations/providers/impls/powens-openbanking.js +0 -218
  205. package/dist/integrations/providers/impls/provider-factory.d.ts +0 -26
  206. package/dist/integrations/providers/impls/provider-factory.js +0 -146
  207. package/dist/integrations/providers/impls/qdrant-vector.d.ts +0 -24
  208. package/dist/integrations/providers/impls/qdrant-vector.js +0 -69
  209. package/dist/integrations/providers/impls/stripe-payments.d.ts +0 -28
  210. package/dist/integrations/providers/impls/stripe-payments.js +0 -202
  211. package/dist/integrations/providers/impls/twilio-sms.d.ts +0 -20
  212. package/dist/integrations/providers/impls/twilio-sms.js +0 -58
@@ -1,218 +0,0 @@
1
- import { PowensClient, PowensClientError } from "./powens-client.js";
2
-
3
- //#region src/integrations/providers/impls/powens-openbanking.ts
4
- var PowensOpenBankingProvider = class {
5
- client;
6
- logger;
7
- constructor(options) {
8
- this.client = new PowensClient(options);
9
- this.logger = options.logger;
10
- }
11
- async listAccounts(params) {
12
- if (!params.userId) throw new PowensClientError("Powens account listing requires the upstream userId mapped to Powens user UUID.", 400);
13
- const context = this.toContext(params.tenantId, params.connectionId);
14
- try {
15
- const response = await this.client.listAccounts({
16
- userUuid: params.userId,
17
- cursor: params.cursor,
18
- limit: params.pageSize,
19
- includeBalances: params.includeBalances,
20
- institutionUuid: params.institutionId
21
- });
22
- return {
23
- accounts: response.accounts.map((account) => this.mapAccount(account, context)),
24
- nextCursor: response.pagination?.nextCursor,
25
- hasMore: response.pagination?.hasMore
26
- };
27
- } catch (error) {
28
- this.handleError("listAccounts", error);
29
- }
30
- }
31
- async getAccountDetails(params) {
32
- const context = this.toContext(params.tenantId, params.connectionId);
33
- try {
34
- const account = await this.client.getAccount(params.accountId);
35
- return this.mapAccountDetails(account, context);
36
- } catch (error) {
37
- this.handleError("getAccountDetails", error);
38
- }
39
- }
40
- async listTransactions(params) {
41
- const context = this.toContext(params.tenantId, params.connectionId);
42
- try {
43
- const response = await this.client.listTransactions({
44
- accountUuid: params.accountId,
45
- cursor: params.cursor,
46
- limit: params.pageSize,
47
- from: params.from,
48
- to: params.to,
49
- includePending: params.includePending
50
- });
51
- return {
52
- transactions: response.transactions.map((transaction) => this.mapTransaction(transaction, context)),
53
- nextCursor: response.pagination?.nextCursor,
54
- hasMore: response.pagination?.hasMore
55
- };
56
- } catch (error) {
57
- this.handleError("listTransactions", error);
58
- }
59
- }
60
- async getBalances(params) {
61
- const context = this.toContext(params.tenantId, params.connectionId);
62
- try {
63
- return (await this.client.getBalances(params.accountId)).filter((balance) => params.balanceTypes?.length ? params.balanceTypes.includes(balance.type) : true).map((balance) => this.mapBalance(balance, context));
64
- } catch (error) {
65
- this.handleError("getBalances", error);
66
- }
67
- }
68
- async getConnectionStatus(params) {
69
- try {
70
- const status = await this.client.getConnectionStatus(params.connectionId);
71
- return {
72
- connectionId: params.connectionId,
73
- tenantId: params.tenantId,
74
- status: this.mapConnectionStatus(status.status),
75
- lastCheckedAt: status.lastAttemptAt,
76
- errorCode: status.errorCode,
77
- errorMessage: status.errorMessage,
78
- details: status.metadata
79
- };
80
- } catch (error) {
81
- this.handleError("getConnectionStatus", error);
82
- }
83
- }
84
- mapAccount(account, context) {
85
- return {
86
- id: account.uuid,
87
- externalId: account.reference ?? account.uuid,
88
- tenantId: context.tenantId,
89
- connectionId: context.connectionId,
90
- userId: account.userUuid,
91
- displayName: account.name,
92
- institutionId: account.institution.id,
93
- institutionName: account.institution.name,
94
- institutionLogoUrl: account.institution.logoUrl,
95
- accountType: account.type ?? "unknown",
96
- iban: account.iban,
97
- bic: account.bic,
98
- currency: account.currency ?? "EUR",
99
- accountNumberMasked: account.metadata?.account_number_masked,
100
- ownership: this.mapOwnership(account.metadata?.ownership),
101
- status: this.mapAccountStatus(account.status),
102
- lastSyncedAt: account.metadata?.last_sync_at,
103
- metadata: account.metadata
104
- };
105
- }
106
- mapAccountDetails(account, context) {
107
- return {
108
- ...this.mapAccount(account, context),
109
- productCode: account.metadata?.product_code,
110
- openedAt: account.metadata?.opened_at,
111
- closedAt: account.metadata?.closed_at,
112
- availableBalance: account.availableBalance ?? void 0,
113
- currentBalance: account.balance ?? void 0,
114
- creditLimit: account.metadata?.credit_limit,
115
- customFields: account.metadata
116
- };
117
- }
118
- mapTransaction(transaction, context) {
119
- return {
120
- id: transaction.uuid,
121
- externalId: transaction.uuid,
122
- tenantId: context.tenantId,
123
- accountId: transaction.accountUuid,
124
- connectionId: context.connectionId,
125
- amount: transaction.amount,
126
- currency: transaction.currency,
127
- direction: transaction.direction === "credit" ? "credit" : "debit",
128
- description: transaction.description ?? transaction.rawLabel,
129
- bookingDate: transaction.bookingDate,
130
- valueDate: transaction.valueDate,
131
- postedAt: transaction.bookingDate,
132
- category: transaction.category,
133
- rawCategory: transaction.rawLabel,
134
- merchantName: transaction.merchantName,
135
- merchantCategoryCode: transaction.merchantCategoryCode,
136
- counterpartyName: transaction.counterpartyName,
137
- counterpartyAccount: transaction.counterpartyAccount,
138
- reference: transaction.metadata?.reference,
139
- status: this.mapTransactionStatus(transaction.status),
140
- metadata: transaction.metadata
141
- };
142
- }
143
- mapBalance(balance, context) {
144
- return {
145
- accountId: balance.accountUuid,
146
- connectionId: context.connectionId,
147
- tenantId: context.tenantId,
148
- type: balance.type ?? "current",
149
- currency: balance.currency ?? "EUR",
150
- amount: balance.amount,
151
- lastUpdatedAt: balance.updatedAt,
152
- metadata: balance.metadata
153
- };
154
- }
155
- toContext(tenantId, connectionId) {
156
- return {
157
- tenantId,
158
- connectionId
159
- };
160
- }
161
- mapOwnership(value) {
162
- switch (value?.toLowerCase()) {
163
- case "individual":
164
- case "personal": return "individual";
165
- case "joint": return "joint";
166
- case "business":
167
- case "corporate": return "business";
168
- default: return "unknown";
169
- }
170
- }
171
- mapAccountStatus(status) {
172
- switch (status?.toLowerCase()) {
173
- case "active":
174
- case "enabled": return "active";
175
- case "disabled":
176
- case "inactive": return "inactive";
177
- case "closed": return "closed";
178
- case "suspended": return "suspended";
179
- default: return "active";
180
- }
181
- }
182
- mapTransactionStatus(status) {
183
- switch (status?.toLowerCase()) {
184
- case "pending":
185
- case "authorised": return "pending";
186
- case "booked":
187
- case "posted": return "booked";
188
- case "cancelled":
189
- case "rejected": return "cancelled";
190
- default: return "booked";
191
- }
192
- }
193
- mapConnectionStatus(status) {
194
- switch (status) {
195
- case "healthy": return "healthy";
196
- case "pending": return "degraded";
197
- case "error": return "error";
198
- case "revoked": return "disconnected";
199
- default: return "degraded";
200
- }
201
- }
202
- handleError(operation, error) {
203
- if (error instanceof PowensClientError) {
204
- this.logger?.error?.(`[PowensOpenBankingProvider] ${operation} failed`, {
205
- status: error.status,
206
- code: error.code,
207
- requestId: error.requestId,
208
- message: error.message
209
- });
210
- throw error;
211
- }
212
- this.logger?.error?.(`[PowensOpenBankingProvider] ${operation} failed with unexpected error`, error);
213
- throw error instanceof Error ? error : /* @__PURE__ */ new Error(`Powens operation "${operation}" failed`);
214
- }
215
- };
216
-
217
- //#endregion
218
- export { PowensOpenBankingProvider };
@@ -1,26 +0,0 @@
1
- import { PaymentsProvider } from "../payments.js";
2
- import { LLMProvider } from "../llm.js";
3
- import { EmbeddingProvider } from "../embedding.js";
4
- import { VectorStoreProvider } from "../vector-store.js";
5
- import { EmailOutboundProvider } from "../email.js";
6
- import { SmsProvider } from "../sms.js";
7
- import { VoiceProvider } from "../voice.js";
8
- import { ObjectStorageProvider } from "../storage.js";
9
- import { OpenBankingProvider } from "../openbanking.js";
10
- import { IntegrationContext } from "../../runtime.js";
11
-
12
- //#region src/integrations/providers/impls/provider-factory.d.ts
13
- declare class IntegrationProviderFactory {
14
- createPaymentsProvider(context: IntegrationContext): Promise<PaymentsProvider>;
15
- createEmailOutboundProvider(context: IntegrationContext): Promise<EmailOutboundProvider>;
16
- createSmsProvider(context: IntegrationContext): Promise<SmsProvider>;
17
- createVectorStoreProvider(context: IntegrationContext): Promise<VectorStoreProvider>;
18
- createObjectStorageProvider(context: IntegrationContext): Promise<ObjectStorageProvider>;
19
- createVoiceProvider(context: IntegrationContext): Promise<VoiceProvider>;
20
- createLlmProvider(context: IntegrationContext): Promise<LLMProvider>;
21
- createEmbeddingProvider(context: IntegrationContext): Promise<EmbeddingProvider>;
22
- createOpenBankingProvider(context: IntegrationContext): Promise<OpenBankingProvider>;
23
- private loadSecrets;
24
- }
25
- //#endregion
26
- export { IntegrationProviderFactory };
@@ -1,146 +0,0 @@
1
- import { ElevenLabsVoiceProvider } from "./elevenlabs-voice.js";
2
- import { GoogleCloudStorageProvider } from "./gcs-storage.js";
3
- import { MistralLLMProvider } from "./mistral-llm.js";
4
- import { MistralEmbeddingProvider } from "./mistral-embedding.js";
5
- import { QdrantVectorProvider } from "./qdrant-vector.js";
6
- import { StripePaymentsProvider } from "./stripe-payments.js";
7
- import { PostmarkEmailProvider } from "./postmark-email.js";
8
- import { TwilioSmsProvider } from "./twilio-sms.js";
9
- import { PowensOpenBankingProvider } from "./powens-openbanking.js";
10
- import { Buffer } from "node:buffer";
11
-
12
- //#region src/integrations/providers/impls/provider-factory.ts
13
- const SECRET_CACHE = /* @__PURE__ */ new Map();
14
- var IntegrationProviderFactory = class {
15
- async createPaymentsProvider(context) {
16
- const secrets = await this.loadSecrets(context);
17
- switch (context.spec.meta.key) {
18
- case "payments.stripe": return new StripePaymentsProvider({ apiKey: requireSecret(secrets, "apiKey", "Stripe API key is required") });
19
- default: throw new Error(`Unsupported payments integration: ${context.spec.meta.key}`);
20
- }
21
- }
22
- async createEmailOutboundProvider(context) {
23
- const secrets = await this.loadSecrets(context);
24
- switch (context.spec.meta.key) {
25
- case "email.postmark": return new PostmarkEmailProvider({
26
- serverToken: requireSecret(secrets, "serverToken", "Postmark server token is required"),
27
- defaultFromEmail: context.config.fromEmail,
28
- messageStream: context.config.messageStream
29
- });
30
- default: throw new Error(`Unsupported email integration: ${context.spec.meta.key}`);
31
- }
32
- }
33
- async createSmsProvider(context) {
34
- const secrets = await this.loadSecrets(context);
35
- switch (context.spec.meta.key) {
36
- case "sms.twilio": return new TwilioSmsProvider({
37
- accountSid: requireSecret(secrets, "accountSid", "Twilio account SID is required"),
38
- authToken: requireSecret(secrets, "authToken", "Twilio auth token is required"),
39
- fromNumber: context.config.fromNumber
40
- });
41
- default: throw new Error(`Unsupported SMS integration: ${context.spec.meta.key}`);
42
- }
43
- }
44
- async createVectorStoreProvider(context) {
45
- const secrets = await this.loadSecrets(context);
46
- switch (context.spec.meta.key) {
47
- case "vectordb.qdrant": return new QdrantVectorProvider({
48
- url: requireConfig(context, "apiUrl", "Qdrant apiUrl config is required"),
49
- apiKey: secrets.apiKey,
50
- clientParams: context.config
51
- });
52
- default: throw new Error(`Unsupported vector store integration: ${context.spec.meta.key}`);
53
- }
54
- }
55
- async createObjectStorageProvider(context) {
56
- const secrets = await this.loadSecrets(context);
57
- switch (context.spec.meta.key) {
58
- case "storage.s3":
59
- case "storage.gcs": return new GoogleCloudStorageProvider({
60
- bucket: requireConfig(context, "bucket", "Storage bucket is required"),
61
- clientOptions: secrets.type === "service_account" ? { credentials: secrets } : void 0
62
- });
63
- default: throw new Error(`Unsupported storage integration: ${context.spec.meta.key}`);
64
- }
65
- }
66
- async createVoiceProvider(context) {
67
- const secrets = await this.loadSecrets(context);
68
- switch (context.spec.meta.key) {
69
- case "ai-voice.elevenlabs": return new ElevenLabsVoiceProvider({
70
- apiKey: requireSecret(secrets, "apiKey", "ElevenLabs API key is required"),
71
- defaultVoiceId: context.config.defaultVoiceId
72
- });
73
- default: throw new Error(`Unsupported voice integration: ${context.spec.meta.key}`);
74
- }
75
- }
76
- async createLlmProvider(context) {
77
- const secrets = await this.loadSecrets(context);
78
- switch (context.spec.meta.key) {
79
- case "ai-llm.mistral": return new MistralLLMProvider({
80
- apiKey: requireSecret(secrets, "apiKey", "Mistral API key is required"),
81
- defaultModel: context.config.model
82
- });
83
- default: throw new Error(`Unsupported LLM integration: ${context.spec.meta.key}`);
84
- }
85
- }
86
- async createEmbeddingProvider(context) {
87
- const secrets = await this.loadSecrets(context);
88
- switch (context.spec.meta.key) {
89
- case "ai-llm.mistral": return new MistralEmbeddingProvider({
90
- apiKey: requireSecret(secrets, "apiKey", "Mistral API key is required"),
91
- defaultModel: context.config.embeddingModel
92
- });
93
- default: throw new Error(`Unsupported embeddings integration: ${context.spec.meta.key}`);
94
- }
95
- }
96
- async createOpenBankingProvider(context) {
97
- const secrets = await this.loadSecrets(context);
98
- const config = context.config;
99
- switch (context.spec.meta.key) {
100
- case "openbanking.powens": {
101
- const environmentValue = requireConfig(context, "environment", "Powens environment (sandbox | production) must be specified in integration config.");
102
- if (environmentValue !== "sandbox" && environmentValue !== "production") throw new Error(`Powens environment "${environmentValue}" is invalid. Expected "sandbox" or "production".`);
103
- return new PowensOpenBankingProvider({
104
- clientId: requireSecret(secrets, "clientId", "Powens clientId is required"),
105
- clientSecret: requireSecret(secrets, "clientSecret", "Powens clientSecret is required"),
106
- apiKey: secrets.apiKey,
107
- environment: environmentValue,
108
- baseUrl: config?.baseUrl
109
- });
110
- }
111
- default: throw new Error(`Unsupported open banking integration: ${context.spec.meta.key}`);
112
- }
113
- }
114
- async loadSecrets(context) {
115
- const cacheKey = context.connection.meta.id;
116
- if (SECRET_CACHE.has(cacheKey)) {
117
- const cached = SECRET_CACHE.get(cacheKey);
118
- if (cached) return cached;
119
- }
120
- const value = parseSecret(await context.secretProvider.getSecret(context.secretReference));
121
- SECRET_CACHE.set(cacheKey, value);
122
- return value;
123
- }
124
- };
125
- function parseSecret(secret) {
126
- const text = Buffer.from(secret.data).toString("utf-8").trim();
127
- if (!text) return {};
128
- try {
129
- return JSON.parse(text);
130
- } catch {
131
- return { apiKey: text };
132
- }
133
- }
134
- function requireSecret(secrets, key, message) {
135
- const value = secrets[key];
136
- if (value == null || value === "") throw new Error(message);
137
- return value;
138
- }
139
- function requireConfig(context, key, message) {
140
- const value = context.config?.[key];
141
- if (value == null) throw new Error(message);
142
- return value;
143
- }
144
-
145
- //#endregion
146
- export { IntegrationProviderFactory };
@@ -1,24 +0,0 @@
1
- import { VectorDeleteRequest, VectorSearchQuery, VectorSearchResult, VectorStoreProvider, VectorUpsertRequest } from "../vector-store.js";
2
- import { QdrantClient, QdrantClientParams } from "@qdrant/js-client-rest";
3
-
4
- //#region src/integrations/providers/impls/qdrant-vector.d.ts
5
- interface QdrantVectorProviderOptions {
6
- url: string;
7
- apiKey?: string;
8
- client?: QdrantClient;
9
- createCollectionIfMissing?: boolean;
10
- distance?: 'Cosine' | 'Euclid' | 'Dot' | 'Manhattan';
11
- clientParams?: Omit<QdrantClientParams, 'url' | 'apiKey'>;
12
- }
13
- declare class QdrantVectorProvider implements VectorStoreProvider {
14
- private readonly client;
15
- private readonly createCollectionIfMissing;
16
- private readonly distance;
17
- constructor(options: QdrantVectorProviderOptions);
18
- upsert(request: VectorUpsertRequest): Promise<void>;
19
- search(query: VectorSearchQuery): Promise<VectorSearchResult[]>;
20
- delete(request: VectorDeleteRequest): Promise<void>;
21
- private ensureCollection;
22
- }
23
- //#endregion
24
- export { QdrantVectorProvider, QdrantVectorProviderOptions };
@@ -1,69 +0,0 @@
1
- import { QdrantClient } from "@qdrant/js-client-rest";
2
-
3
- //#region src/integrations/providers/impls/qdrant-vector.ts
4
- var QdrantVectorProvider = class {
5
- client;
6
- createCollectionIfMissing;
7
- distance;
8
- constructor(options) {
9
- this.client = options.client ?? new QdrantClient({
10
- url: options.url,
11
- apiKey: options.apiKey,
12
- ...options.clientParams
13
- });
14
- this.createCollectionIfMissing = options.createCollectionIfMissing ?? true;
15
- this.distance = options.distance ?? "Cosine";
16
- }
17
- async upsert(request) {
18
- if (request.documents.length === 0) return;
19
- const vectorSize = request.documents[0]?.vector.length ?? 0;
20
- if (this.createCollectionIfMissing) await this.ensureCollection(request.collection, vectorSize);
21
- const points = request.documents.map((document) => ({
22
- id: document.id,
23
- vector: document.vector,
24
- payload: {
25
- ...document.payload,
26
- ...document.namespace ? { namespace: document.namespace } : {},
27
- ...document.expiresAt ? { expiresAt: document.expiresAt.toISOString() } : {}
28
- }
29
- }));
30
- await this.client.upsert(request.collection, {
31
- wait: true,
32
- points
33
- });
34
- }
35
- async search(query) {
36
- return (await this.client.search(query.collection, {
37
- vector: query.vector,
38
- limit: query.topK,
39
- filter: query.filter,
40
- score_threshold: query.scoreThreshold,
41
- with_payload: true,
42
- with_vector: false
43
- })).map((item) => ({
44
- id: String(item.id),
45
- score: item.score,
46
- payload: item.payload ?? void 0,
47
- namespace: typeof item.payload === "object" && item.payload !== null ? item.payload.namespace : void 0
48
- }));
49
- }
50
- async delete(request) {
51
- await this.client.delete(request.collection, {
52
- wait: true,
53
- points: request.ids
54
- });
55
- }
56
- async ensureCollection(collectionName, vectorSize) {
57
- try {
58
- await this.client.getCollection(collectionName);
59
- } catch {
60
- await this.client.createCollection(collectionName, { vectors: {
61
- size: vectorSize,
62
- distance: this.distance
63
- } });
64
- }
65
- }
66
- };
67
-
68
- //#endregion
69
- export { QdrantVectorProvider };
@@ -1,28 +0,0 @@
1
- import { CapturePaymentInput, CreateCustomerInput, CreatePaymentIntentInput, ListInvoicesQuery, ListTransactionsQuery, PaymentCustomer, PaymentIntent, PaymentInvoice, PaymentRefund, PaymentTransaction, PaymentsProvider, RefundPaymentInput } from "../payments.js";
2
- import Stripe from "stripe";
3
-
4
- //#region src/integrations/providers/impls/stripe-payments.d.ts
5
- interface StripePaymentsProviderOptions {
6
- apiKey: string;
7
- stripe?: Stripe;
8
- }
9
- declare class StripePaymentsProvider implements PaymentsProvider {
10
- private readonly stripe;
11
- constructor(options: StripePaymentsProviderOptions);
12
- createCustomer(input: CreateCustomerInput): Promise<PaymentCustomer>;
13
- getCustomer(customerId: string): Promise<PaymentCustomer | null>;
14
- createPaymentIntent(input: CreatePaymentIntentInput): Promise<PaymentIntent>;
15
- capturePayment(paymentIntentId: string, input?: CapturePaymentInput): Promise<PaymentIntent>;
16
- cancelPaymentIntent(paymentIntentId: string): Promise<PaymentIntent>;
17
- refundPayment(input: RefundPaymentInput): Promise<PaymentRefund>;
18
- listInvoices(query?: ListInvoicesQuery): Promise<PaymentInvoice[]>;
19
- listTransactions(query?: ListTransactionsQuery): Promise<PaymentTransaction[]>;
20
- private toCustomer;
21
- private toPaymentIntent;
22
- private toInvoice;
23
- private toMoney;
24
- private toMetadata;
25
- private mergeMetadata;
26
- }
27
- //#endregion
28
- export { StripePaymentsProvider, StripePaymentsProviderOptions };