@lssm/lib.contracts 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-config/app-config.feature.js +53 -1
- package/dist/app-config/contracts.d.ts +50 -50
- package/dist/app-config/contracts.js +396 -1
- package/dist/app-config/docs/app-config.docblock.js +22 -220
- package/dist/app-config/events.d.ts +27 -27
- package/dist/app-config/events.js +168 -1
- package/dist/app-config/index.js +8 -1
- package/dist/app-config/lifecycle-contracts.d.ts +80 -80
- package/dist/app-config/lifecycle-contracts.js +441 -1
- package/dist/app-config/runtime.js +617 -1
- package/dist/app-config/spec.js +36 -1
- package/dist/app-config/validation.js +538 -1
- package/dist/capabilities/docs/capabilities.docblock.js +22 -1
- package/dist/capabilities/openbanking.js +92 -1
- package/dist/capabilities.js +50 -1
- package/dist/client/index.js +9 -1
- package/dist/client/react/drivers/rn-reusables.js +21 -1
- package/dist/client/react/drivers/shadcn.js +11 -1
- package/dist/client/react/feature-render.js +43 -1
- package/dist/client/react/form-render.js +298 -1
- package/dist/client/react/index.js +8 -1
- package/dist/contract-registry/index.js +3 -1
- package/dist/contract-registry/schemas.js +61 -1
- package/dist/contracts-adapter-hydration.js +41 -1
- package/dist/contracts-adapter-input.js +77 -1
- package/dist/data-views/docs/data-views.docblock.js +22 -1
- package/dist/data-views/query-generator.js +48 -1
- package/dist/data-views/runtime.js +39 -1
- package/dist/data-views.js +35 -1
- package/dist/docs/PUBLISHING.docblock.js +17 -76
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -350
- package/dist/docs/index.js +33 -1
- package/dist/docs/meta.docs.js +15 -2
- package/dist/docs/presentations.js +77 -1
- package/dist/docs/registry.js +51 -1
- package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +17 -383
- package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +17 -68
- package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +17 -140
- package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +17 -86
- package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +17 -1
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +25 -2
- package/dist/docs/tech/contracts/README.docblock.js +21 -1
- package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -1
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -180
- package/dist/docs/tech/contracts/migrations.docblock.js +21 -1
- package/dist/docs/tech/contracts/openapi-export.docblock.js +22 -2
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +19 -60
- package/dist/docs/tech/contracts/overlays.docblock.js +21 -68
- package/dist/docs/tech/contracts/tests.docblock.js +21 -132
- package/dist/docs/tech/contracts/themes.docblock.js +21 -1
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +21 -106
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -213
- package/dist/docs/tech/llm/llm-integration.docblock.js +74 -5
- package/dist/docs/tech/mcp-endpoints.docblock.js +38 -1
- package/dist/docs/tech/presentation-runtime.docblock.js +17 -1
- package/dist/docs/tech/schema/README.docblock.js +21 -262
- package/dist/docs/tech/studio/learning-events.docblock.js +49 -1
- package/dist/docs/tech/studio/learning-journeys.docblock.js +25 -2
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +24 -2
- package/dist/docs/tech/studio/project-access-teams.docblock.js +26 -16
- package/dist/docs/tech/studio/project-routing.docblock.js +68 -1
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +23 -2
- package/dist/docs/tech/studio/team-invitations.docblock.js +41 -36
- package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -1
- package/dist/docs/tech/studio/workspaces.docblock.js +24 -2
- package/dist/docs/tech/telemetry-ingest.docblock.js +37 -3
- package/dist/docs/tech/templates/runtime.docblock.js +21 -1
- package/dist/docs/tech/vscode-extension.docblock.js +37 -3
- package/dist/docs/tech/workflows/overview.docblock.js +21 -1
- package/dist/docs/tech-contracts.docs.js +19 -2
- package/dist/events.js +12 -1
- package/dist/experiments/docs/experiments.docblock.js +22 -128
- package/dist/experiments/evaluator.js +101 -1
- package/dist/experiments/spec.js +33 -1
- package/dist/features.js +68 -1
- package/dist/forms/docs/forms.docblock.js +22 -1
- package/dist/forms.js +119 -1
- package/dist/index.js +107 -1
- package/dist/install.js +40 -1
- package/dist/integrations/contracts.d.ts +102 -102
- package/dist/integrations/contracts.js +388 -1
- package/dist/integrations/docs/integrations.docblock.js +95 -1
- package/dist/integrations/health.js +69 -1
- package/dist/integrations/index.js +23 -1
- package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
- package/dist/integrations/openbanking/contracts/accounts.js +237 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
- package/dist/integrations/openbanking/contracts/balances.js +167 -1
- package/dist/integrations/openbanking/contracts/index.js +12 -1
- package/dist/integrations/openbanking/contracts/transactions.d.ts +48 -48
- package/dist/integrations/openbanking/contracts/transactions.js +218 -1
- package/dist/integrations/openbanking/guards.js +32 -1
- package/dist/integrations/openbanking/models.d.ts +55 -55
- package/dist/integrations/openbanking/models.js +242 -1
- package/dist/integrations/openbanking/openbanking.feature.js +68 -1
- package/dist/integrations/openbanking/telemetry.js +39 -1
- package/dist/integrations/providers/elevenlabs.js +56 -1
- package/dist/integrations/providers/gcs-storage.js +79 -1
- package/dist/integrations/providers/gmail.js +91 -1
- package/dist/integrations/providers/google-calendar.js +70 -1
- package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -1
- package/dist/integrations/providers/impls/gcs-storage.js +88 -1
- package/dist/integrations/providers/impls/gmail-inbound.js +200 -1
- package/dist/integrations/providers/impls/gmail-outbound.js +104 -5
- package/dist/integrations/providers/impls/google-calendar.js +154 -1
- package/dist/integrations/providers/impls/index.js +16 -1
- package/dist/integrations/providers/impls/mistral-embedding.js +41 -1
- package/dist/integrations/providers/impls/mistral-llm.js +247 -1
- package/dist/integrations/providers/impls/postmark-email.js +55 -1
- package/dist/integrations/providers/impls/powens-client.js +171 -1
- package/dist/integrations/providers/impls/powens-openbanking.js +218 -1
- package/dist/integrations/providers/impls/provider-factory.js +142 -1
- package/dist/integrations/providers/impls/qdrant-vector.js +69 -1
- package/dist/integrations/providers/impls/stripe-payments.js +202 -1
- package/dist/integrations/providers/impls/twilio-sms.js +58 -1
- package/dist/integrations/providers/index.js +13 -1
- package/dist/integrations/providers/mistral.js +72 -1
- package/dist/integrations/providers/postmark.js +72 -1
- package/dist/integrations/providers/powens.js +120 -1
- package/dist/integrations/providers/qdrant.js +77 -1
- package/dist/integrations/providers/registry.js +34 -1
- package/dist/integrations/providers/stripe.js +87 -1
- package/dist/integrations/providers/twilio-sms.js +65 -1
- package/dist/integrations/runtime.js +186 -1
- package/dist/integrations/secrets/aws-secret-manager.js +231 -1
- package/dist/integrations/secrets/env-secret-provider.js +81 -1
- package/dist/integrations/secrets/gcp-secret-manager.js +229 -1
- package/dist/integrations/secrets/index.js +8 -1
- package/dist/integrations/secrets/manager.js +103 -1
- package/dist/integrations/secrets/provider.js +58 -1
- package/dist/integrations/secrets/scaleway-secret-manager.js +247 -1
- package/dist/integrations/spec.js +39 -1
- package/dist/jobs/define-job.js +16 -1
- package/dist/jobs/gcp-cloud-tasks.js +53 -1
- package/dist/jobs/gcp-pubsub.js +39 -1
- package/dist/jobs/handlers/gmail-sync-handler.js +9 -1
- package/dist/jobs/handlers/index.js +12 -1
- package/dist/jobs/handlers/ping-handler.js +15 -1
- package/dist/jobs/handlers/storage-document-handler.js +14 -1
- package/dist/jobs/index.js +4 -1
- package/dist/jobs/memory-queue.js +71 -1
- package/dist/jobs/queue.js +33 -1
- package/dist/jobs/scaleway-sqs-queue.js +153 -1
- package/dist/jsonschema.d.ts +3 -3
- package/dist/jsonschema.js +32 -1
- package/dist/knowledge/contracts.d.ts +66 -66
- package/dist/knowledge/contracts.js +317 -1
- package/dist/knowledge/docs/knowledge.docblock.js +22 -138
- package/dist/knowledge/index.js +10 -1
- package/dist/knowledge/ingestion/document-processor.js +54 -1
- package/dist/knowledge/ingestion/embedding-service.js +25 -1
- package/dist/knowledge/ingestion/gmail-adapter.js +50 -5
- package/dist/knowledge/ingestion/index.js +7 -1
- package/dist/knowledge/ingestion/storage-adapter.js +26 -1
- package/dist/knowledge/ingestion/vector-indexer.js +32 -1
- package/dist/knowledge/query/index.js +3 -1
- package/dist/knowledge/query/service.js +64 -2
- package/dist/knowledge/runtime.js +49 -1
- package/dist/knowledge/spaces/email-threads.js +38 -1
- package/dist/knowledge/spaces/financial-docs.js +38 -1
- package/dist/knowledge/spaces/financial-overview.js +42 -1
- package/dist/knowledge/spaces/index.js +8 -1
- package/dist/knowledge/spaces/product-canon.js +38 -1
- package/dist/knowledge/spaces/support-faq.js +41 -1
- package/dist/knowledge/spaces/uploaded-docs.js +38 -1
- package/dist/knowledge/spec.js +39 -1
- package/dist/llm/exporters.js +541 -8
- package/dist/llm/index.js +4 -1
- package/dist/llm/prompts.js +246 -56
- package/dist/markdown.js +116 -3
- package/dist/migrations.js +33 -1
- package/dist/onboarding-base.d.ts +29 -29
- package/dist/onboarding-base.js +196 -1
- package/dist/openapi.js +75 -1
- package/dist/openbanking/docs/openbanking.docblock.js +22 -109
- package/dist/ownership.js +40 -1
- package/dist/policy/docs/policy.docblock.js +22 -1
- package/dist/policy/engine.js +223 -1
- package/dist/policy/opa-adapter.js +71 -1
- package/dist/policy/spec.js +33 -1
- package/dist/presentations/docs/presentations-conventions.docblock.js +21 -7
- package/dist/presentations.backcompat.js +47 -1
- package/dist/presentations.d.ts +3 -3
- package/dist/presentations.js +66 -1
- package/dist/presentations.v2.js +278 -6
- package/dist/prompt.js +10 -1
- package/dist/promptRegistry.js +34 -1
- package/dist/regenerator/docs/regenerator.docblock.js +22 -184
- package/dist/regenerator/executor.js +86 -1
- package/dist/regenerator/index.js +6 -1
- package/dist/regenerator/service.js +92 -1
- package/dist/regenerator/sinks.js +32 -1
- package/dist/regenerator/utils.js +51 -1
- package/dist/registry.js +208 -1
- package/dist/resources.js +47 -1
- package/dist/schema/dist/EnumType.js +2 -1
- package/dist/schema/dist/FieldType.js +49 -1
- package/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/schema/dist/SchemaModel.js +39 -1
- package/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/schema/dist/entity/index.js +2 -1
- package/dist/schema/dist/entity/types.js +1 -1
- package/dist/schema/dist/index.js +6 -1
- package/dist/schema-to-markdown.js +214 -10
- package/dist/server/graphql-pothos.js +128 -1
- package/dist/server/index.js +10 -1
- package/dist/server/mcp/createMcpServer.js +28 -1
- package/dist/server/mcp/registerPresentations.js +151 -1
- package/dist/server/mcp/registerPrompts.js +36 -2
- package/dist/server/mcp/registerResources.js +35 -1
- package/dist/server/mcp/registerTools.js +22 -1
- package/dist/server/provider-mcp.js +3 -1
- package/dist/server/rest-elysia.js +20 -1
- package/dist/server/rest-express.js +39 -1
- package/dist/server/rest-generic.js +125 -1
- package/dist/server/rest-next-app.js +38 -1
- package/dist/server/rest-next-mcp.js +45 -1
- package/dist/server/rest-next-pages.js +25 -1
- package/dist/spec.js +35 -1
- package/dist/telemetry/anomaly.js +48 -1
- package/dist/telemetry/docs/telemetry.docblock.js +22 -139
- package/dist/telemetry/index.js +5 -1
- package/dist/telemetry/spec.js +69 -1
- package/dist/telemetry/tracker.js +76 -1
- package/dist/tests/index.js +4 -1
- package/dist/tests/runner.js +150 -1
- package/dist/tests/spec.js +33 -1
- package/dist/themes.js +39 -1
- package/dist/workflow/adapters/db-adapter.js +83 -1
- package/dist/workflow/adapters/file-adapter.js +11 -1
- package/dist/workflow/adapters/index.js +5 -1
- package/dist/workflow/adapters/memory-store.js +58 -1
- package/dist/workflow/expression.js +98 -1
- package/dist/workflow/index.js +9 -1
- package/dist/workflow/runner.js +337 -1
- package/dist/workflow/sla-monitor.js +47 -1
- package/dist/workflow/spec.js +32 -1
- package/dist/workflow/validation.js +175 -1
- package/package.json +11 -4
|
@@ -1 +1,218 @@
|
|
|
1
|
-
import{PowensClient
|
|
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 +1,142 @@
|
|
|
1
|
-
import
|
|
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
|
+
});
|
|
51
|
+
default: throw new Error(`Unsupported vector store integration: ${context.spec.meta.key}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async createObjectStorageProvider(context) {
|
|
55
|
+
const secrets = await this.loadSecrets(context);
|
|
56
|
+
switch (context.spec.meta.key) {
|
|
57
|
+
case "storage.s3":
|
|
58
|
+
case "storage.gcs": return new GoogleCloudStorageProvider({
|
|
59
|
+
bucket: requireConfig(context, "bucket", "Storage bucket is required"),
|
|
60
|
+
clientOptions: secrets.type === "service_account" ? { credentials: secrets } : void 0
|
|
61
|
+
});
|
|
62
|
+
default: throw new Error(`Unsupported storage integration: ${context.spec.meta.key}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async createVoiceProvider(context) {
|
|
66
|
+
const secrets = await this.loadSecrets(context);
|
|
67
|
+
switch (context.spec.meta.key) {
|
|
68
|
+
case "ai-voice.elevenlabs": return new ElevenLabsVoiceProvider({
|
|
69
|
+
apiKey: requireSecret(secrets, "apiKey", "ElevenLabs API key is required"),
|
|
70
|
+
defaultVoiceId: context.config.defaultVoiceId
|
|
71
|
+
});
|
|
72
|
+
default: throw new Error(`Unsupported voice integration: ${context.spec.meta.key}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async createLlmProvider(context) {
|
|
76
|
+
const secrets = await this.loadSecrets(context);
|
|
77
|
+
switch (context.spec.meta.key) {
|
|
78
|
+
case "ai-llm.mistral": return new MistralLLMProvider({
|
|
79
|
+
apiKey: requireSecret(secrets, "apiKey", "Mistral API key is required"),
|
|
80
|
+
defaultModel: context.config.model
|
|
81
|
+
});
|
|
82
|
+
default: throw new Error(`Unsupported LLM integration: ${context.spec.meta.key}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async createEmbeddingProvider(context) {
|
|
86
|
+
const secrets = await this.loadSecrets(context);
|
|
87
|
+
switch (context.spec.meta.key) {
|
|
88
|
+
case "ai-llm.mistral": return new MistralEmbeddingProvider({
|
|
89
|
+
apiKey: requireSecret(secrets, "apiKey", "Mistral API key is required"),
|
|
90
|
+
defaultModel: context.config.embeddingModel
|
|
91
|
+
});
|
|
92
|
+
default: throw new Error(`Unsupported embeddings integration: ${context.spec.meta.key}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async createOpenBankingProvider(context) {
|
|
96
|
+
const secrets = await this.loadSecrets(context);
|
|
97
|
+
const config = context.config;
|
|
98
|
+
switch (context.spec.meta.key) {
|
|
99
|
+
case "openbanking.powens": {
|
|
100
|
+
const environmentValue = requireConfig(context, "environment", "Powens environment (sandbox | production) must be specified in integration config.");
|
|
101
|
+
if (environmentValue !== "sandbox" && environmentValue !== "production") throw new Error(`Powens environment "${environmentValue}" is invalid. Expected "sandbox" or "production".`);
|
|
102
|
+
return new PowensOpenBankingProvider({
|
|
103
|
+
clientId: requireSecret(secrets, "clientId", "Powens clientId is required"),
|
|
104
|
+
clientSecret: requireSecret(secrets, "clientSecret", "Powens clientSecret is required"),
|
|
105
|
+
apiKey: secrets.apiKey,
|
|
106
|
+
environment: environmentValue,
|
|
107
|
+
baseUrl: config?.baseUrl
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
default: throw new Error(`Unsupported open banking integration: ${context.spec.meta.key}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async loadSecrets(context) {
|
|
114
|
+
const cacheKey = context.connection.meta.id;
|
|
115
|
+
if (SECRET_CACHE.has(cacheKey)) return SECRET_CACHE.get(cacheKey);
|
|
116
|
+
const value = parseSecret(await context.secretProvider.getSecret(context.secretReference));
|
|
117
|
+
SECRET_CACHE.set(cacheKey, value);
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
function parseSecret(secret) {
|
|
122
|
+
const text = Buffer.from(secret.data).toString("utf-8").trim();
|
|
123
|
+
if (!text) return {};
|
|
124
|
+
try {
|
|
125
|
+
return JSON.parse(text);
|
|
126
|
+
} catch {
|
|
127
|
+
return { apiKey: text };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function requireSecret(secrets, key, message) {
|
|
131
|
+
const value = secrets[key];
|
|
132
|
+
if (value == null || value === "") throw new Error(message);
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
function requireConfig(context, key, message) {
|
|
136
|
+
const value = context.config?.[key];
|
|
137
|
+
if (value == null) throw new Error(message);
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//#endregion
|
|
142
|
+
export { IntegrationProviderFactory };
|
|
@@ -1 +1,69 @@
|
|
|
1
|
-
import{QdrantClient
|
|
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;
|
|
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 (error) {
|
|
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 +1,202 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
|
|
3
|
+
//#region src/integrations/providers/impls/stripe-payments.ts
|
|
4
|
+
const API_VERSION = "2025-10-29.clover";
|
|
5
|
+
var StripePaymentsProvider = class {
|
|
6
|
+
stripe;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.stripe = options.stripe ?? new Stripe(options.apiKey, { apiVersion: API_VERSION });
|
|
9
|
+
}
|
|
10
|
+
async createCustomer(input) {
|
|
11
|
+
const customer = await this.stripe.customers.create({
|
|
12
|
+
email: input.email,
|
|
13
|
+
name: input.name,
|
|
14
|
+
description: input.description,
|
|
15
|
+
metadata: input.metadata
|
|
16
|
+
});
|
|
17
|
+
return this.toCustomer(customer);
|
|
18
|
+
}
|
|
19
|
+
async getCustomer(customerId) {
|
|
20
|
+
const customer = await this.stripe.customers.retrieve(customerId);
|
|
21
|
+
if (customer.deleted) return null;
|
|
22
|
+
return this.toCustomer(customer);
|
|
23
|
+
}
|
|
24
|
+
async createPaymentIntent(input) {
|
|
25
|
+
const intent = await this.stripe.paymentIntents.create({
|
|
26
|
+
amount: input.amount.amount,
|
|
27
|
+
currency: input.amount.currency,
|
|
28
|
+
customer: input.customerId,
|
|
29
|
+
description: input.description,
|
|
30
|
+
capture_method: input.captureMethod ?? "automatic",
|
|
31
|
+
confirmation_method: input.confirmationMethod ?? "automatic",
|
|
32
|
+
automatic_payment_methods: { enabled: true },
|
|
33
|
+
metadata: input.metadata,
|
|
34
|
+
return_url: input.returnUrl,
|
|
35
|
+
statement_descriptor: input.statementDescriptor
|
|
36
|
+
});
|
|
37
|
+
return this.toPaymentIntent(intent);
|
|
38
|
+
}
|
|
39
|
+
async capturePayment(paymentIntentId, input) {
|
|
40
|
+
const intent = await this.stripe.paymentIntents.capture(paymentIntentId, input?.amount ? { amount_to_capture: input.amount.amount } : void 0);
|
|
41
|
+
return this.toPaymentIntent(intent);
|
|
42
|
+
}
|
|
43
|
+
async cancelPaymentIntent(paymentIntentId) {
|
|
44
|
+
const intent = await this.stripe.paymentIntents.cancel(paymentIntentId);
|
|
45
|
+
return this.toPaymentIntent(intent);
|
|
46
|
+
}
|
|
47
|
+
async refundPayment(input) {
|
|
48
|
+
const refund = await this.stripe.refunds.create({
|
|
49
|
+
payment_intent: input.paymentIntentId,
|
|
50
|
+
amount: input.amount?.amount,
|
|
51
|
+
reason: mapRefundReason(input.reason),
|
|
52
|
+
metadata: input.metadata
|
|
53
|
+
});
|
|
54
|
+
const paymentIntentId = typeof refund.payment_intent === "string" ? refund.payment_intent : refund.payment_intent?.id ?? "";
|
|
55
|
+
return {
|
|
56
|
+
id: refund.id,
|
|
57
|
+
paymentIntentId,
|
|
58
|
+
amount: {
|
|
59
|
+
amount: refund.amount ?? 0,
|
|
60
|
+
currency: refund.currency?.toUpperCase() ?? "USD"
|
|
61
|
+
},
|
|
62
|
+
status: mapRefundStatus(refund.status),
|
|
63
|
+
reason: refund.reason ?? void 0,
|
|
64
|
+
metadata: this.toMetadata(refund.metadata),
|
|
65
|
+
createdAt: refund.created ? /* @__PURE__ */ new Date(refund.created * 1e3) : void 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async listInvoices(query) {
|
|
69
|
+
const requestedStatus = query?.status?.[0];
|
|
70
|
+
const stripeStatus = requestedStatus && requestedStatus !== "deleted" ? requestedStatus : void 0;
|
|
71
|
+
return (await this.stripe.invoices.list({
|
|
72
|
+
customer: query?.customerId,
|
|
73
|
+
status: stripeStatus,
|
|
74
|
+
limit: query?.limit,
|
|
75
|
+
starting_after: query?.startingAfter
|
|
76
|
+
})).data.map((invoice) => this.toInvoice(invoice));
|
|
77
|
+
}
|
|
78
|
+
async listTransactions(query) {
|
|
79
|
+
return (await this.stripe.charges.list({
|
|
80
|
+
customer: query?.customerId,
|
|
81
|
+
payment_intent: query?.paymentIntentId,
|
|
82
|
+
limit: query?.limit,
|
|
83
|
+
starting_after: query?.startingAfter
|
|
84
|
+
})).data.map((charge) => ({
|
|
85
|
+
id: charge.id,
|
|
86
|
+
paymentIntentId: typeof charge.payment_intent === "string" ? charge.payment_intent : charge.payment_intent?.id,
|
|
87
|
+
amount: {
|
|
88
|
+
amount: charge.amount,
|
|
89
|
+
currency: charge.currency?.toUpperCase() ?? "USD"
|
|
90
|
+
},
|
|
91
|
+
type: "capture",
|
|
92
|
+
status: mapChargeStatus(charge.status),
|
|
93
|
+
description: charge.description ?? void 0,
|
|
94
|
+
createdAt: /* @__PURE__ */ new Date(charge.created * 1e3),
|
|
95
|
+
metadata: this.mergeMetadata(this.toMetadata(charge.metadata), { balanceTransaction: typeof charge.balance_transaction === "string" ? charge.balance_transaction : void 0 })
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
toCustomer(customer) {
|
|
99
|
+
const metadata = this.toMetadata(customer.metadata);
|
|
100
|
+
const updatedAtValue = metadata?.updatedAt;
|
|
101
|
+
return {
|
|
102
|
+
id: customer.id,
|
|
103
|
+
email: customer.email ?? void 0,
|
|
104
|
+
name: customer.name ?? void 0,
|
|
105
|
+
metadata,
|
|
106
|
+
createdAt: customer.created ? /* @__PURE__ */ new Date(customer.created * 1e3) : void 0,
|
|
107
|
+
updatedAt: updatedAtValue ? new Date(updatedAtValue) : void 0
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
toPaymentIntent(intent) {
|
|
111
|
+
const metadata = this.toMetadata(intent.metadata);
|
|
112
|
+
return {
|
|
113
|
+
id: intent.id,
|
|
114
|
+
amount: this.toMoney(intent.amount_received ?? intent.amount ?? 0, intent.currency),
|
|
115
|
+
status: mapPaymentIntentStatus(intent.status),
|
|
116
|
+
customerId: typeof intent.customer === "string" ? intent.customer : intent.customer?.id,
|
|
117
|
+
description: intent.description ?? void 0,
|
|
118
|
+
clientSecret: intent.client_secret ?? void 0,
|
|
119
|
+
metadata,
|
|
120
|
+
createdAt: /* @__PURE__ */ new Date(intent.created * 1e3),
|
|
121
|
+
updatedAt: intent.canceled_at != null ? /* @__PURE__ */ new Date(intent.canceled_at * 1e3) : /* @__PURE__ */ new Date(intent.created * 1e3)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
toInvoice(invoice) {
|
|
125
|
+
const metadata = this.toMetadata(invoice.metadata);
|
|
126
|
+
return {
|
|
127
|
+
id: invoice.id,
|
|
128
|
+
number: invoice.number ?? void 0,
|
|
129
|
+
status: invoice.status ?? "draft",
|
|
130
|
+
amountDue: this.toMoney(invoice.amount_due ?? 0, invoice.currency),
|
|
131
|
+
amountPaid: this.toMoney(invoice.amount_paid ?? 0, invoice.currency),
|
|
132
|
+
customerId: typeof invoice.customer === "string" ? invoice.customer : invoice.customer?.id,
|
|
133
|
+
dueDate: invoice.due_date ? /* @__PURE__ */ new Date(invoice.due_date * 1e3) : void 0,
|
|
134
|
+
hostedInvoiceUrl: invoice.hosted_invoice_url ?? void 0,
|
|
135
|
+
metadata,
|
|
136
|
+
createdAt: invoice.created ? /* @__PURE__ */ new Date(invoice.created * 1e3) : void 0,
|
|
137
|
+
updatedAt: invoice.status_transitions?.finalized_at ? /* @__PURE__ */ new Date(invoice.status_transitions.finalized_at * 1e3) : void 0
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
toMoney(amount, currency) {
|
|
141
|
+
return {
|
|
142
|
+
amount,
|
|
143
|
+
currency: currency?.toUpperCase() ?? "USD"
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
toMetadata(metadata) {
|
|
147
|
+
if (!metadata) return void 0;
|
|
148
|
+
const entries = Object.entries(metadata).filter((entry) => typeof entry[1] === "string");
|
|
149
|
+
if (entries.length === 0) return void 0;
|
|
150
|
+
return Object.fromEntries(entries);
|
|
151
|
+
}
|
|
152
|
+
mergeMetadata(base, extras) {
|
|
153
|
+
const filteredExtras = Object.entries(extras).filter((entry) => typeof entry[1] === "string");
|
|
154
|
+
if (!base && filteredExtras.length === 0) return;
|
|
155
|
+
return {
|
|
156
|
+
...base ?? {},
|
|
157
|
+
...Object.fromEntries(filteredExtras)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
function mapRefundReason(reason) {
|
|
162
|
+
if (!reason) return void 0;
|
|
163
|
+
return [
|
|
164
|
+
"duplicate",
|
|
165
|
+
"fraudulent",
|
|
166
|
+
"requested_by_customer"
|
|
167
|
+
].includes(reason) ? reason : void 0;
|
|
168
|
+
}
|
|
169
|
+
function mapPaymentIntentStatus(status) {
|
|
170
|
+
switch (status) {
|
|
171
|
+
case "requires_payment_method": return "requires_payment_method";
|
|
172
|
+
case "requires_confirmation": return "requires_confirmation";
|
|
173
|
+
case "requires_action":
|
|
174
|
+
case "requires_capture": return "requires_action";
|
|
175
|
+
case "processing": return "processing";
|
|
176
|
+
case "succeeded": return "succeeded";
|
|
177
|
+
case "canceled": return "canceled";
|
|
178
|
+
default: return "requires_payment_method";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function mapRefundStatus(status) {
|
|
182
|
+
switch (status) {
|
|
183
|
+
case "pending":
|
|
184
|
+
case "succeeded":
|
|
185
|
+
case "failed":
|
|
186
|
+
case "canceled": return status;
|
|
187
|
+
default: return "pending";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function mapChargeStatus(status) {
|
|
191
|
+
switch (status) {
|
|
192
|
+
case "pending":
|
|
193
|
+
case "processing": return "pending";
|
|
194
|
+
case "succeeded": return "succeeded";
|
|
195
|
+
case "failed":
|
|
196
|
+
case "canceled": return "failed";
|
|
197
|
+
default: return "pending";
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
export { StripePaymentsProvider };
|