@develit-services/bank 6.0.0 → 6.1.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.
- package/dist/base.cjs +23 -136
- package/dist/base.d.cts +14 -20
- package/dist/base.d.mts +14 -20
- package/dist/base.d.ts +14 -20
- package/dist/base.mjs +22 -135
- package/dist/database/schema.d.cts +1 -1
- package/dist/database/schema.d.mts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/export/workflows.cjs +1 -24
- package/dist/export/workflows.mjs +1 -24
- package/dist/service.d.cts +0 -2
- package/dist/service.d.mts +0 -2
- package/dist/service.d.ts +0 -2
- package/dist/shared/{bank.D9DoIABz.mjs → bank.BWR4dqQ5.mjs} +1 -48
- package/dist/shared/{bank.D19D3a9C.d.mts → bank.CDB7SWNr.d.mts} +1 -1
- package/dist/shared/{bank.DQZxSHKV.cjs → bank.CSmuzdUJ.cjs} +0 -55
- package/dist/shared/{bank.DZyrkXc_.d.cts → bank.CggHtT3y.d.cts} +1 -1
- package/dist/shared/{bank.CgiEbvJu.d.cts → bank.D3w3JIsQ.d.cts} +3 -3
- package/dist/shared/{bank.CgiEbvJu.d.mts → bank.D3w3JIsQ.d.mts} +3 -3
- package/dist/shared/{bank.CgiEbvJu.d.ts → bank.D3w3JIsQ.d.ts} +3 -3
- package/dist/shared/{bank.-8YAJoxw.d.ts → bank.DhMeQgpB.d.ts} +1 -1
- package/dist/types.d.cts +4 -4
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
package/dist/base.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const paymentDirection = require('./shared/bank.BsWBG0gb.cjs');
|
|
5
|
-
const bank = require('./shared/bank.DQZxSHKV.cjs');
|
|
6
5
|
const drizzleOrm = require('drizzle-orm');
|
|
7
6
|
const cloudflare_workers = require('cloudflare:workers');
|
|
8
7
|
const d1 = require('drizzle-orm/d1');
|
|
9
8
|
require('jose');
|
|
9
|
+
const bank = require('./shared/bank.CSmuzdUJ.cjs');
|
|
10
10
|
const zod = require('zod');
|
|
11
11
|
const database_schema = require('./shared/bank.Ca3jzmIb.cjs');
|
|
12
12
|
const generalCodes = require('@develit-io/general-codes');
|
|
@@ -107,50 +107,14 @@ async function heartbeatSyncWorkflows({
|
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
createInstance,
|
|
113
|
-
logger,
|
|
114
|
-
now = Date.now,
|
|
115
|
-
recoveryWindowMs = bank.DISPATCH_RECOVERY_WINDOW_MS
|
|
116
|
-
}) {
|
|
117
|
-
const at = now();
|
|
118
|
-
await Promise.all(
|
|
119
|
-
entities.map(async (entity) => {
|
|
120
|
-
const { id, lastSyncAt } = entity;
|
|
121
|
-
if (!lastSyncAt) {
|
|
122
|
-
logger.warn("sync-workflow.dispatch.sync-age-unknown", { id });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const instanceId = bank.buildDispatchInstanceId(id, at, recoveryWindowMs);
|
|
126
|
-
try {
|
|
127
|
-
await createInstance(instanceId, id);
|
|
128
|
-
logger.info("sync-workflow.dispatch.created", {
|
|
129
|
-
id,
|
|
130
|
-
instanceId,
|
|
131
|
-
lastSyncAt: lastSyncAt.toISOString()
|
|
132
|
-
});
|
|
133
|
-
} catch (err) {
|
|
134
|
-
if (bank.isAlreadyExists(err)) return;
|
|
135
|
-
logger.error("sync-workflow.dispatch.failed", {
|
|
136
|
-
id,
|
|
137
|
-
instanceId,
|
|
138
|
-
error: err instanceof Error ? err.message : String(err)
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
);
|
|
110
|
+
function isAlreadyExists(err) {
|
|
111
|
+
return /already exists/i.test(extractMessage(err));
|
|
143
112
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const raw = selection?.trim();
|
|
147
|
-
if (!raw) return false;
|
|
148
|
-
if (raw.toLowerCase() === "all") return true;
|
|
149
|
-
return raw.split(",").map((id) => id.trim()).includes(accountId);
|
|
113
|
+
function isInstanceNotFound(err) {
|
|
114
|
+
return /instance.*not.?found|not.?found.*instance/i.test(extractMessage(err));
|
|
150
115
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
-
return isDispatchEnabled(accountId, selection);
|
|
116
|
+
function extractMessage(err) {
|
|
117
|
+
return err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : "";
|
|
154
118
|
}
|
|
155
119
|
|
|
156
120
|
const FINITE_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -987,32 +951,18 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
987
951
|
{ successMessage: "Account sync workflow started" },
|
|
988
952
|
async ({ accountId }) => {
|
|
989
953
|
await this.setSyncEnabledOrThrow(accountId, true);
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
this.env.
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
} catch (err) {
|
|
1002
|
-
if (!bank.isAlreadyExists(err)) throw err;
|
|
1003
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(instanceId);
|
|
1004
|
-
}
|
|
1005
|
-
return {
|
|
1006
|
-
instanceId: instance2.id,
|
|
1007
|
-
details: await instance2.status()
|
|
1008
|
-
};
|
|
954
|
+
let instance;
|
|
955
|
+
try {
|
|
956
|
+
instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
|
|
957
|
+
id: accountId,
|
|
958
|
+
params: {
|
|
959
|
+
accountId
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
} catch (err) {
|
|
963
|
+
if (!isAlreadyExists(err)) throw err;
|
|
964
|
+
instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
1009
965
|
}
|
|
1010
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
|
|
1011
|
-
id: accountId,
|
|
1012
|
-
params: {
|
|
1013
|
-
accountId
|
|
1014
|
-
}
|
|
1015
|
-
});
|
|
1016
966
|
return {
|
|
1017
967
|
instanceId: instance.id,
|
|
1018
968
|
details: await instance.status()
|
|
@@ -1039,34 +989,13 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
1039
989
|
{ successMessage: "Account sync workflow restarted" },
|
|
1040
990
|
async ({ accountId }) => {
|
|
1041
991
|
await this.setSyncEnabledOrThrow(accountId, true);
|
|
1042
|
-
if (isDispatchActive(
|
|
1043
|
-
accountId,
|
|
1044
|
-
this.env.SYNC_DISPATCH_ACCOUNT_IDS,
|
|
1045
|
-
this.env.CRON_SYNC_WORKFLOW_DISPATCH
|
|
1046
|
-
)) {
|
|
1047
|
-
const instanceId = bank.buildDispatchInstanceId(accountId, Date.now());
|
|
1048
|
-
let instance2;
|
|
1049
|
-
try {
|
|
1050
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create(
|
|
1051
|
-
bank.buildDispatchCreateOptions(instanceId, accountId)
|
|
1052
|
-
);
|
|
1053
|
-
} catch (err) {
|
|
1054
|
-
if (!bank.isAlreadyExists(err)) throw err;
|
|
1055
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(instanceId);
|
|
1056
|
-
await instance2.restart();
|
|
1057
|
-
}
|
|
1058
|
-
return {
|
|
1059
|
-
instanceId: instance2.id,
|
|
1060
|
-
details: await instance2.status()
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
992
|
let instance;
|
|
1064
993
|
try {
|
|
1065
994
|
const existing = await this.getCurrentSyncInstance(accountId);
|
|
1066
995
|
await existing.restart();
|
|
1067
996
|
instance = existing;
|
|
1068
997
|
} catch (err) {
|
|
1069
|
-
if (!
|
|
998
|
+
if (!isInstanceNotFound(err)) throw err;
|
|
1070
999
|
}
|
|
1071
1000
|
if (!instance) {
|
|
1072
1001
|
instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
|
|
@@ -1376,19 +1305,11 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
1376
1305
|
console.log("Scheduled CRON payment request statuses");
|
|
1377
1306
|
await this.updatePaymentRequestStatuses();
|
|
1378
1307
|
}
|
|
1379
|
-
if (controller.cron === this.env.CRON_SYNC_WORKFLOW_DISPATCH) {
|
|
1380
|
-
await this.dispatchSyncWorkflows();
|
|
1381
|
-
}
|
|
1382
1308
|
if (controller.cron === this.env.CRON_SYNC_WORKFLOW_HEARTBEAT) {
|
|
1383
1309
|
console.log("Scheduled CRON sync workflow heartbeat");
|
|
1384
1310
|
await this.heartbeatSyncWorkflows();
|
|
1385
1311
|
}
|
|
1386
1312
|
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Lifecycle actions must target the instance that actually syncs the
|
|
1389
|
-
* account — under dispatch that is the windowed instance recorded with the
|
|
1390
|
-
* last sync write, not the legacy canonical id.
|
|
1391
|
-
*/
|
|
1392
1313
|
async setSyncEnabledOrThrow(accountId, syncEnabled) {
|
|
1393
1314
|
const [updated] = await updateAccountSyncEnabledCommand(this.db, {
|
|
1394
1315
|
accountId,
|
|
@@ -1399,25 +1320,7 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
1399
1320
|
}
|
|
1400
1321
|
}
|
|
1401
1322
|
async getCurrentSyncInstance(accountId) {
|
|
1402
|
-
|
|
1403
|
-
return this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
1404
|
-
bank.resolveCurrentSyncInstanceId(
|
|
1405
|
-
accountId,
|
|
1406
|
-
account?.lastSyncMetadata?.instanceId
|
|
1407
|
-
)
|
|
1408
|
-
);
|
|
1409
|
-
}
|
|
1410
|
-
async dispatchSyncWorkflows() {
|
|
1411
|
-
const selection = this.env.SYNC_DISPATCH_ACCOUNT_IDS;
|
|
1412
|
-
if (!selection?.trim()) return;
|
|
1413
|
-
const accounts = await getSyncCandidateAccountsQuery(this.db);
|
|
1414
|
-
await dispatchSyncWorkflows({
|
|
1415
|
-
entities: accounts.filter((a) => isDispatchEnabled(a.id, selection)),
|
|
1416
|
-
createInstance: (instanceId, accountId) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create(
|
|
1417
|
-
bank.buildDispatchCreateOptions(instanceId, accountId)
|
|
1418
|
-
),
|
|
1419
|
-
logger: syncEventConsoleLogger
|
|
1420
|
-
});
|
|
1323
|
+
return this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
1421
1324
|
}
|
|
1422
1325
|
async heartbeatSyncWorkflows() {
|
|
1423
1326
|
const accounts = await getSyncCandidateAccountsQuery(this.db);
|
|
@@ -1432,13 +1335,7 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
1432
1335
|
return;
|
|
1433
1336
|
}
|
|
1434
1337
|
await heartbeatSyncWorkflows({
|
|
1435
|
-
entities: accounts.
|
|
1436
|
-
(a) => !isDispatchActive(
|
|
1437
|
-
a.id,
|
|
1438
|
-
this.env.SYNC_DISPATCH_ACCOUNT_IDS,
|
|
1439
|
-
this.env.CRON_SYNC_WORKFLOW_DISPATCH
|
|
1440
|
-
)
|
|
1441
|
-
).map((a) => ({
|
|
1338
|
+
entities: accounts.map((a) => ({
|
|
1442
1339
|
id: a.id,
|
|
1443
1340
|
iterationCount: a.lastSyncMetadata?.iterationCount,
|
|
1444
1341
|
syncIntervalS: a.syncIntervalS,
|
|
@@ -2210,12 +2107,7 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
2210
2107
|
if (includeWorkflow) {
|
|
2211
2108
|
let status;
|
|
2212
2109
|
try {
|
|
2213
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
2214
|
-
bank.resolveCurrentSyncInstanceId(
|
|
2215
|
-
a.id,
|
|
2216
|
-
a.lastSyncMetadata?.instanceId
|
|
2217
|
-
)
|
|
2218
|
-
);
|
|
2110
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(a.id);
|
|
2219
2111
|
status = await instance.status();
|
|
2220
2112
|
} catch (_) {
|
|
2221
2113
|
status = null;
|
|
@@ -2315,12 +2207,7 @@ exports.BankServiceBase = class BankServiceBase extends backendSdk.develitWorker
|
|
|
2315
2207
|
throw accountNotFoundError();
|
|
2316
2208
|
}
|
|
2317
2209
|
try {
|
|
2318
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
2319
|
-
bank.resolveCurrentSyncInstanceId(
|
|
2320
|
-
accountId,
|
|
2321
|
-
account.lastSyncMetadata?.instanceId
|
|
2322
|
-
)
|
|
2323
|
-
);
|
|
2210
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
2324
2211
|
await terminateSyncWorkflow(instance);
|
|
2325
2212
|
} catch (error) {
|
|
2326
2213
|
this.log({
|
package/dist/base.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.D3w3JIsQ.cjs';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.CggHtT3y.cjs';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2711,15 +2711,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2711
2711
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2712
2712
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2713
2713
|
AUTHORIZED: "AUTHORIZED";
|
|
2714
|
-
COMPLETED: "COMPLETED";
|
|
2715
2714
|
PROCESSING: "PROCESSING";
|
|
2716
2715
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2716
|
+
COMPLETED: "COMPLETED";
|
|
2717
2717
|
FAILED: "FAILED";
|
|
2718
2718
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2719
2719
|
AUTHORIZED: "AUTHORIZED";
|
|
2720
|
-
COMPLETED: "COMPLETED";
|
|
2721
2720
|
PROCESSING: "PROCESSING";
|
|
2722
2721
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2722
|
+
COMPLETED: "COMPLETED";
|
|
2723
2723
|
FAILED: "FAILED";
|
|
2724
2724
|
}>>]>>;
|
|
2725
2725
|
}, z.core.$strip>;
|
|
@@ -2956,20 +2956,20 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2956
2956
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2957
2957
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2958
2958
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2959
|
-
BOOKED: "BOOKED";
|
|
2960
|
-
REJECTED: "REJECTED";
|
|
2961
|
-
PENDING: "PENDING";
|
|
2962
2959
|
PROCESSING: "PROCESSING";
|
|
2960
|
+
PENDING: "PENDING";
|
|
2961
|
+
BOOKED: "BOOKED";
|
|
2963
2962
|
CANCELLED: "CANCELLED";
|
|
2963
|
+
REJECTED: "REJECTED";
|
|
2964
2964
|
SCHEDULED: "SCHEDULED";
|
|
2965
2965
|
HOLD: "HOLD";
|
|
2966
2966
|
INFO: "INFO";
|
|
2967
2967
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2968
|
-
BOOKED: "BOOKED";
|
|
2969
|
-
REJECTED: "REJECTED";
|
|
2970
|
-
PENDING: "PENDING";
|
|
2971
2968
|
PROCESSING: "PROCESSING";
|
|
2969
|
+
PENDING: "PENDING";
|
|
2970
|
+
BOOKED: "BOOKED";
|
|
2972
2971
|
CANCELLED: "CANCELLED";
|
|
2972
|
+
REJECTED: "REJECTED";
|
|
2973
2973
|
SCHEDULED: "SCHEDULED";
|
|
2974
2974
|
HOLD: "HOLD";
|
|
2975
2975
|
INFO: "INFO";
|
|
@@ -3903,20 +3903,20 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3903
3903
|
}, z.core.$strip>;
|
|
3904
3904
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3905
3905
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3906
|
-
OPENED: "OPENED";
|
|
3907
3906
|
AUTHORIZED: "AUTHORIZED";
|
|
3908
3907
|
COMPLETED: "COMPLETED";
|
|
3909
3908
|
BOOKED: "BOOKED";
|
|
3910
|
-
SETTLED: "SETTLED";
|
|
3911
3909
|
REJECTED: "REJECTED";
|
|
3910
|
+
OPENED: "OPENED";
|
|
3911
|
+
SETTLED: "SETTLED";
|
|
3912
3912
|
CLOSED: "CLOSED";
|
|
3913
3913
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3914
|
-
OPENED: "OPENED";
|
|
3915
3914
|
AUTHORIZED: "AUTHORIZED";
|
|
3916
3915
|
COMPLETED: "COMPLETED";
|
|
3917
3916
|
BOOKED: "BOOKED";
|
|
3918
|
-
SETTLED: "SETTLED";
|
|
3919
3917
|
REJECTED: "REJECTED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
|
+
SETTLED: "SETTLED";
|
|
3920
3920
|
CLOSED: "CLOSED";
|
|
3921
3921
|
}>>]>>;
|
|
3922
3922
|
filterPaymentType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -4212,14 +4212,8 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4212
4212
|
statusChanged: number;
|
|
4213
4213
|
}>>;
|
|
4214
4214
|
scheduled(controller: ScheduledController): Promise<void>;
|
|
4215
|
-
/**
|
|
4216
|
-
* Lifecycle actions must target the instance that actually syncs the
|
|
4217
|
-
* account — under dispatch that is the windowed instance recorded with the
|
|
4218
|
-
* last sync write, not the legacy canonical id.
|
|
4219
|
-
*/
|
|
4220
4215
|
private setSyncEnabledOrThrow;
|
|
4221
4216
|
private getCurrentSyncInstance;
|
|
4222
|
-
private dispatchSyncWorkflows;
|
|
4223
4217
|
private heartbeatSyncWorkflows;
|
|
4224
4218
|
handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
|
|
4225
4219
|
closePaymentRequest(input: ClosePaymentRequestInput): Promise<IRPCResponse<ClosePaymentRequestOutput>>;
|
package/dist/base.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.D3w3JIsQ.mjs';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.CDB7SWNr.mjs';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2711,15 +2711,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2711
2711
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2712
2712
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2713
2713
|
AUTHORIZED: "AUTHORIZED";
|
|
2714
|
-
COMPLETED: "COMPLETED";
|
|
2715
2714
|
PROCESSING: "PROCESSING";
|
|
2716
2715
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2716
|
+
COMPLETED: "COMPLETED";
|
|
2717
2717
|
FAILED: "FAILED";
|
|
2718
2718
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2719
2719
|
AUTHORIZED: "AUTHORIZED";
|
|
2720
|
-
COMPLETED: "COMPLETED";
|
|
2721
2720
|
PROCESSING: "PROCESSING";
|
|
2722
2721
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2722
|
+
COMPLETED: "COMPLETED";
|
|
2723
2723
|
FAILED: "FAILED";
|
|
2724
2724
|
}>>]>>;
|
|
2725
2725
|
}, z.core.$strip>;
|
|
@@ -2956,20 +2956,20 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2956
2956
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2957
2957
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2958
2958
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2959
|
-
BOOKED: "BOOKED";
|
|
2960
|
-
REJECTED: "REJECTED";
|
|
2961
|
-
PENDING: "PENDING";
|
|
2962
2959
|
PROCESSING: "PROCESSING";
|
|
2960
|
+
PENDING: "PENDING";
|
|
2961
|
+
BOOKED: "BOOKED";
|
|
2963
2962
|
CANCELLED: "CANCELLED";
|
|
2963
|
+
REJECTED: "REJECTED";
|
|
2964
2964
|
SCHEDULED: "SCHEDULED";
|
|
2965
2965
|
HOLD: "HOLD";
|
|
2966
2966
|
INFO: "INFO";
|
|
2967
2967
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2968
|
-
BOOKED: "BOOKED";
|
|
2969
|
-
REJECTED: "REJECTED";
|
|
2970
|
-
PENDING: "PENDING";
|
|
2971
2968
|
PROCESSING: "PROCESSING";
|
|
2969
|
+
PENDING: "PENDING";
|
|
2970
|
+
BOOKED: "BOOKED";
|
|
2972
2971
|
CANCELLED: "CANCELLED";
|
|
2972
|
+
REJECTED: "REJECTED";
|
|
2973
2973
|
SCHEDULED: "SCHEDULED";
|
|
2974
2974
|
HOLD: "HOLD";
|
|
2975
2975
|
INFO: "INFO";
|
|
@@ -3903,20 +3903,20 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3903
3903
|
}, z.core.$strip>;
|
|
3904
3904
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3905
3905
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3906
|
-
OPENED: "OPENED";
|
|
3907
3906
|
AUTHORIZED: "AUTHORIZED";
|
|
3908
3907
|
COMPLETED: "COMPLETED";
|
|
3909
3908
|
BOOKED: "BOOKED";
|
|
3910
|
-
SETTLED: "SETTLED";
|
|
3911
3909
|
REJECTED: "REJECTED";
|
|
3910
|
+
OPENED: "OPENED";
|
|
3911
|
+
SETTLED: "SETTLED";
|
|
3912
3912
|
CLOSED: "CLOSED";
|
|
3913
3913
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3914
|
-
OPENED: "OPENED";
|
|
3915
3914
|
AUTHORIZED: "AUTHORIZED";
|
|
3916
3915
|
COMPLETED: "COMPLETED";
|
|
3917
3916
|
BOOKED: "BOOKED";
|
|
3918
|
-
SETTLED: "SETTLED";
|
|
3919
3917
|
REJECTED: "REJECTED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
|
+
SETTLED: "SETTLED";
|
|
3920
3920
|
CLOSED: "CLOSED";
|
|
3921
3921
|
}>>]>>;
|
|
3922
3922
|
filterPaymentType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -4212,14 +4212,8 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4212
4212
|
statusChanged: number;
|
|
4213
4213
|
}>>;
|
|
4214
4214
|
scheduled(controller: ScheduledController): Promise<void>;
|
|
4215
|
-
/**
|
|
4216
|
-
* Lifecycle actions must target the instance that actually syncs the
|
|
4217
|
-
* account — under dispatch that is the windowed instance recorded with the
|
|
4218
|
-
* last sync write, not the legacy canonical id.
|
|
4219
|
-
*/
|
|
4220
4215
|
private setSyncEnabledOrThrow;
|
|
4221
4216
|
private getCurrentSyncInstance;
|
|
4222
|
-
private dispatchSyncWorkflows;
|
|
4223
4217
|
private heartbeatSyncWorkflows;
|
|
4224
4218
|
handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
|
|
4225
4219
|
closePaymentRequest(input: ClosePaymentRequestInput): Promise<IRPCResponse<ClosePaymentRequestOutput>>;
|
package/dist/base.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.D3w3JIsQ.js';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.DhMeQgpB.js';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2711,15 +2711,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2711
2711
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2712
2712
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2713
2713
|
AUTHORIZED: "AUTHORIZED";
|
|
2714
|
-
COMPLETED: "COMPLETED";
|
|
2715
2714
|
PROCESSING: "PROCESSING";
|
|
2716
2715
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2716
|
+
COMPLETED: "COMPLETED";
|
|
2717
2717
|
FAILED: "FAILED";
|
|
2718
2718
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2719
2719
|
AUTHORIZED: "AUTHORIZED";
|
|
2720
|
-
COMPLETED: "COMPLETED";
|
|
2721
2720
|
PROCESSING: "PROCESSING";
|
|
2722
2721
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2722
|
+
COMPLETED: "COMPLETED";
|
|
2723
2723
|
FAILED: "FAILED";
|
|
2724
2724
|
}>>]>>;
|
|
2725
2725
|
}, z.core.$strip>;
|
|
@@ -2956,20 +2956,20 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2956
2956
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2957
2957
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2958
2958
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2959
|
-
BOOKED: "BOOKED";
|
|
2960
|
-
REJECTED: "REJECTED";
|
|
2961
|
-
PENDING: "PENDING";
|
|
2962
2959
|
PROCESSING: "PROCESSING";
|
|
2960
|
+
PENDING: "PENDING";
|
|
2961
|
+
BOOKED: "BOOKED";
|
|
2963
2962
|
CANCELLED: "CANCELLED";
|
|
2963
|
+
REJECTED: "REJECTED";
|
|
2964
2964
|
SCHEDULED: "SCHEDULED";
|
|
2965
2965
|
HOLD: "HOLD";
|
|
2966
2966
|
INFO: "INFO";
|
|
2967
2967
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2968
|
-
BOOKED: "BOOKED";
|
|
2969
|
-
REJECTED: "REJECTED";
|
|
2970
|
-
PENDING: "PENDING";
|
|
2971
2968
|
PROCESSING: "PROCESSING";
|
|
2969
|
+
PENDING: "PENDING";
|
|
2970
|
+
BOOKED: "BOOKED";
|
|
2972
2971
|
CANCELLED: "CANCELLED";
|
|
2972
|
+
REJECTED: "REJECTED";
|
|
2973
2973
|
SCHEDULED: "SCHEDULED";
|
|
2974
2974
|
HOLD: "HOLD";
|
|
2975
2975
|
INFO: "INFO";
|
|
@@ -3903,20 +3903,20 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3903
3903
|
}, z.core.$strip>;
|
|
3904
3904
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3905
3905
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3906
|
-
OPENED: "OPENED";
|
|
3907
3906
|
AUTHORIZED: "AUTHORIZED";
|
|
3908
3907
|
COMPLETED: "COMPLETED";
|
|
3909
3908
|
BOOKED: "BOOKED";
|
|
3910
|
-
SETTLED: "SETTLED";
|
|
3911
3909
|
REJECTED: "REJECTED";
|
|
3910
|
+
OPENED: "OPENED";
|
|
3911
|
+
SETTLED: "SETTLED";
|
|
3912
3912
|
CLOSED: "CLOSED";
|
|
3913
3913
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3914
|
-
OPENED: "OPENED";
|
|
3915
3914
|
AUTHORIZED: "AUTHORIZED";
|
|
3916
3915
|
COMPLETED: "COMPLETED";
|
|
3917
3916
|
BOOKED: "BOOKED";
|
|
3918
|
-
SETTLED: "SETTLED";
|
|
3919
3917
|
REJECTED: "REJECTED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
|
+
SETTLED: "SETTLED";
|
|
3920
3920
|
CLOSED: "CLOSED";
|
|
3921
3921
|
}>>]>>;
|
|
3922
3922
|
filterPaymentType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -4212,14 +4212,8 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4212
4212
|
statusChanged: number;
|
|
4213
4213
|
}>>;
|
|
4214
4214
|
scheduled(controller: ScheduledController): Promise<void>;
|
|
4215
|
-
/**
|
|
4216
|
-
* Lifecycle actions must target the instance that actually syncs the
|
|
4217
|
-
* account — under dispatch that is the windowed instance recorded with the
|
|
4218
|
-
* last sync write, not the legacy canonical id.
|
|
4219
|
-
*/
|
|
4220
4215
|
private setSyncEnabledOrThrow;
|
|
4221
4216
|
private getCurrentSyncInstance;
|
|
4222
|
-
private dispatchSyncWorkflows;
|
|
4223
4217
|
private heartbeatSyncWorkflows;
|
|
4224
4218
|
handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
|
|
4225
4219
|
closePaymentRequest(input: ClosePaymentRequestInput): Promise<IRPCResponse<ClosePaymentRequestOutput>>;
|
package/dist/base.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, bankAccountMetadataSchema, structuredAddressSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
|
|
2
2
|
import { G as tables, g as accountInsertSchema, H as relations, o as isProcessedStatus, p as isTerminalStatus, L as getNonTerminalPaymentRequestsQuery, x as toIncomingPayment, N as calculateCzechIban, j as assignAccount, u as toBatchedPayment, y as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from './shared/bank.kz-PKVi5.mjs';
|
|
3
|
-
import { k as isAlreadyExists, D as DISPATCH_RECOVERY_WINDOW_MS, l as buildDispatchInstanceId, m as encrypt, d as createCredentialsResolver, i as initiateConnector, n as buildDispatchCreateOptions, o as isInstanceNotFound, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, b as getAccountByIdQuery, r as resolveCurrentSyncInstanceId, p as importAesKey, j as createPaymentCommand } from './shared/bank.D9DoIABz.mjs';
|
|
4
3
|
import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count } from 'drizzle-orm';
|
|
5
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
6
5
|
import { drizzle } from 'drizzle-orm/d1';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import { h as encrypt, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, j as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from './shared/bank.BWR4dqQ5.mjs';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAYMENT_TYPES, b as CONNECTOR_KEYS, a as BATCH_STATUSES, f as PAYMENT_STATUSES, P as PAYMENT_DIRECTIONS, e as PAYMENT_REQUEST_STATUSES } from './shared/bank.BT7HayCV.mjs';
|
|
10
10
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
@@ -105,50 +105,14 @@ async function heartbeatSyncWorkflows({
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
createInstance,
|
|
111
|
-
logger,
|
|
112
|
-
now = Date.now,
|
|
113
|
-
recoveryWindowMs = DISPATCH_RECOVERY_WINDOW_MS
|
|
114
|
-
}) {
|
|
115
|
-
const at = now();
|
|
116
|
-
await Promise.all(
|
|
117
|
-
entities.map(async (entity) => {
|
|
118
|
-
const { id, lastSyncAt } = entity;
|
|
119
|
-
if (!lastSyncAt) {
|
|
120
|
-
logger.warn("sync-workflow.dispatch.sync-age-unknown", { id });
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const instanceId = buildDispatchInstanceId(id, at, recoveryWindowMs);
|
|
124
|
-
try {
|
|
125
|
-
await createInstance(instanceId, id);
|
|
126
|
-
logger.info("sync-workflow.dispatch.created", {
|
|
127
|
-
id,
|
|
128
|
-
instanceId,
|
|
129
|
-
lastSyncAt: lastSyncAt.toISOString()
|
|
130
|
-
});
|
|
131
|
-
} catch (err) {
|
|
132
|
-
if (isAlreadyExists(err)) return;
|
|
133
|
-
logger.error("sync-workflow.dispatch.failed", {
|
|
134
|
-
id,
|
|
135
|
-
instanceId,
|
|
136
|
-
error: err instanceof Error ? err.message : String(err)
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
);
|
|
108
|
+
function isAlreadyExists(err) {
|
|
109
|
+
return /already exists/i.test(extractMessage(err));
|
|
141
110
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const raw = selection?.trim();
|
|
145
|
-
if (!raw) return false;
|
|
146
|
-
if (raw.toLowerCase() === "all") return true;
|
|
147
|
-
return raw.split(",").map((id) => id.trim()).includes(accountId);
|
|
111
|
+
function isInstanceNotFound(err) {
|
|
112
|
+
return /instance.*not.?found|not.?found.*instance/i.test(extractMessage(err));
|
|
148
113
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
return isDispatchEnabled(accountId, selection);
|
|
114
|
+
function extractMessage(err) {
|
|
115
|
+
return err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : "";
|
|
152
116
|
}
|
|
153
117
|
|
|
154
118
|
const FINITE_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -985,32 +949,18 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
985
949
|
{ successMessage: "Account sync workflow started" },
|
|
986
950
|
async ({ accountId }) => {
|
|
987
951
|
await this.setSyncEnabledOrThrow(accountId, true);
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
this.env.
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
} catch (err) {
|
|
1000
|
-
if (!isAlreadyExists(err)) throw err;
|
|
1001
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(instanceId);
|
|
1002
|
-
}
|
|
1003
|
-
return {
|
|
1004
|
-
instanceId: instance2.id,
|
|
1005
|
-
details: await instance2.status()
|
|
1006
|
-
};
|
|
952
|
+
let instance;
|
|
953
|
+
try {
|
|
954
|
+
instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
|
|
955
|
+
id: accountId,
|
|
956
|
+
params: {
|
|
957
|
+
accountId
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
} catch (err) {
|
|
961
|
+
if (!isAlreadyExists(err)) throw err;
|
|
962
|
+
instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
1007
963
|
}
|
|
1008
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
|
|
1009
|
-
id: accountId,
|
|
1010
|
-
params: {
|
|
1011
|
-
accountId
|
|
1012
|
-
}
|
|
1013
|
-
});
|
|
1014
964
|
return {
|
|
1015
965
|
instanceId: instance.id,
|
|
1016
966
|
details: await instance.status()
|
|
@@ -1037,27 +987,6 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1037
987
|
{ successMessage: "Account sync workflow restarted" },
|
|
1038
988
|
async ({ accountId }) => {
|
|
1039
989
|
await this.setSyncEnabledOrThrow(accountId, true);
|
|
1040
|
-
if (isDispatchActive(
|
|
1041
|
-
accountId,
|
|
1042
|
-
this.env.SYNC_DISPATCH_ACCOUNT_IDS,
|
|
1043
|
-
this.env.CRON_SYNC_WORKFLOW_DISPATCH
|
|
1044
|
-
)) {
|
|
1045
|
-
const instanceId = buildDispatchInstanceId(accountId, Date.now());
|
|
1046
|
-
let instance2;
|
|
1047
|
-
try {
|
|
1048
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create(
|
|
1049
|
-
buildDispatchCreateOptions(instanceId, accountId)
|
|
1050
|
-
);
|
|
1051
|
-
} catch (err) {
|
|
1052
|
-
if (!isAlreadyExists(err)) throw err;
|
|
1053
|
-
instance2 = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(instanceId);
|
|
1054
|
-
await instance2.restart();
|
|
1055
|
-
}
|
|
1056
|
-
return {
|
|
1057
|
-
instanceId: instance2.id,
|
|
1058
|
-
details: await instance2.status()
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
990
|
let instance;
|
|
1062
991
|
try {
|
|
1063
992
|
const existing = await this.getCurrentSyncInstance(accountId);
|
|
@@ -1374,19 +1303,11 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1374
1303
|
console.log("Scheduled CRON payment request statuses");
|
|
1375
1304
|
await this.updatePaymentRequestStatuses();
|
|
1376
1305
|
}
|
|
1377
|
-
if (controller.cron === this.env.CRON_SYNC_WORKFLOW_DISPATCH) {
|
|
1378
|
-
await this.dispatchSyncWorkflows();
|
|
1379
|
-
}
|
|
1380
1306
|
if (controller.cron === this.env.CRON_SYNC_WORKFLOW_HEARTBEAT) {
|
|
1381
1307
|
console.log("Scheduled CRON sync workflow heartbeat");
|
|
1382
1308
|
await this.heartbeatSyncWorkflows();
|
|
1383
1309
|
}
|
|
1384
1310
|
}
|
|
1385
|
-
/**
|
|
1386
|
-
* Lifecycle actions must target the instance that actually syncs the
|
|
1387
|
-
* account — under dispatch that is the windowed instance recorded with the
|
|
1388
|
-
* last sync write, not the legacy canonical id.
|
|
1389
|
-
*/
|
|
1390
1311
|
async setSyncEnabledOrThrow(accountId, syncEnabled) {
|
|
1391
1312
|
const [updated] = await updateAccountSyncEnabledCommand(this.db, {
|
|
1392
1313
|
accountId,
|
|
@@ -1397,25 +1318,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1397
1318
|
}
|
|
1398
1319
|
}
|
|
1399
1320
|
async getCurrentSyncInstance(accountId) {
|
|
1400
|
-
|
|
1401
|
-
return this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
1402
|
-
resolveCurrentSyncInstanceId(
|
|
1403
|
-
accountId,
|
|
1404
|
-
account?.lastSyncMetadata?.instanceId
|
|
1405
|
-
)
|
|
1406
|
-
);
|
|
1407
|
-
}
|
|
1408
|
-
async dispatchSyncWorkflows() {
|
|
1409
|
-
const selection = this.env.SYNC_DISPATCH_ACCOUNT_IDS;
|
|
1410
|
-
if (!selection?.trim()) return;
|
|
1411
|
-
const accounts = await getSyncCandidateAccountsQuery(this.db);
|
|
1412
|
-
await dispatchSyncWorkflows({
|
|
1413
|
-
entities: accounts.filter((a) => isDispatchEnabled(a.id, selection)),
|
|
1414
|
-
createInstance: (instanceId, accountId) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create(
|
|
1415
|
-
buildDispatchCreateOptions(instanceId, accountId)
|
|
1416
|
-
),
|
|
1417
|
-
logger: syncEventConsoleLogger
|
|
1418
|
-
});
|
|
1321
|
+
return this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
1419
1322
|
}
|
|
1420
1323
|
async heartbeatSyncWorkflows() {
|
|
1421
1324
|
const accounts = await getSyncCandidateAccountsQuery(this.db);
|
|
@@ -1430,13 +1333,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1430
1333
|
return;
|
|
1431
1334
|
}
|
|
1432
1335
|
await heartbeatSyncWorkflows({
|
|
1433
|
-
entities: accounts.
|
|
1434
|
-
(a) => !isDispatchActive(
|
|
1435
|
-
a.id,
|
|
1436
|
-
this.env.SYNC_DISPATCH_ACCOUNT_IDS,
|
|
1437
|
-
this.env.CRON_SYNC_WORKFLOW_DISPATCH
|
|
1438
|
-
)
|
|
1439
|
-
).map((a) => ({
|
|
1336
|
+
entities: accounts.map((a) => ({
|
|
1440
1337
|
id: a.id,
|
|
1441
1338
|
iterationCount: a.lastSyncMetadata?.iterationCount,
|
|
1442
1339
|
syncIntervalS: a.syncIntervalS,
|
|
@@ -2208,12 +2105,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
2208
2105
|
if (includeWorkflow) {
|
|
2209
2106
|
let status;
|
|
2210
2107
|
try {
|
|
2211
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
2212
|
-
resolveCurrentSyncInstanceId(
|
|
2213
|
-
a.id,
|
|
2214
|
-
a.lastSyncMetadata?.instanceId
|
|
2215
|
-
)
|
|
2216
|
-
);
|
|
2108
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(a.id);
|
|
2217
2109
|
status = await instance.status();
|
|
2218
2110
|
} catch (_) {
|
|
2219
2111
|
status = null;
|
|
@@ -2313,12 +2205,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
2313
2205
|
throw accountNotFoundError();
|
|
2314
2206
|
}
|
|
2315
2207
|
try {
|
|
2316
|
-
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(
|
|
2317
|
-
resolveCurrentSyncInstanceId(
|
|
2318
|
-
accountId,
|
|
2319
|
-
account.lastSyncMetadata?.instanceId
|
|
2320
|
-
)
|
|
2321
|
-
);
|
|
2208
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
2322
2209
|
await terminateSyncWorkflow(instance);
|
|
2323
2210
|
} catch (error) {
|
|
2324
2211
|
this.log({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.
|
|
1
|
+
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.D3w3JIsQ.cjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/general-codes';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.
|
|
1
|
+
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.D3w3JIsQ.mjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/general-codes';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.
|
|
1
|
+
export { aC as account, aD as accountCredentials, aE as batch, aF as ott, aG as payment, aH as paymentRequest } from '../shared/bank.D3w3JIsQ.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/general-codes';
|
|
@@ -4,7 +4,7 @@ const backendSdk = require('@develit-io/backend-sdk');
|
|
|
4
4
|
const paymentDirection = require('../shared/bank.BsWBG0gb.cjs');
|
|
5
5
|
const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
|
|
6
6
|
const drizzleOrm = require('drizzle-orm');
|
|
7
|
-
const bank = require('../shared/bank.
|
|
7
|
+
const bank = require('../shared/bank.CSmuzdUJ.cjs');
|
|
8
8
|
const cloudflare_workers = require('cloudflare:workers');
|
|
9
9
|
const cloudflare_workflows = require('cloudflare:workflows');
|
|
10
10
|
const d1 = require('drizzle-orm/d1');
|
|
@@ -431,7 +431,6 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
431
431
|
if (!accountId) {
|
|
432
432
|
throw new cloudflare_workflows.NonRetryableError(`Haven't obtained accountId to load.`);
|
|
433
433
|
}
|
|
434
|
-
const deadlineMs = bank.computeWindowDeadline(event.instanceId, accountId);
|
|
435
434
|
const workflowStartedAt = await step.do(
|
|
436
435
|
"capture workflow start time",
|
|
437
436
|
async () => Date.now()
|
|
@@ -455,19 +454,6 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
455
454
|
if (!account.lastSyncAt) {
|
|
456
455
|
throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
|
|
457
456
|
}
|
|
458
|
-
if (bank.isSupersededBy(
|
|
459
|
-
event.instanceId,
|
|
460
|
-
account.lastSyncMetadata?.instanceId,
|
|
461
|
-
accountId
|
|
462
|
-
)) {
|
|
463
|
-
logger.info("sync.superseded", {
|
|
464
|
-
accountId,
|
|
465
|
-
instanceId: event.instanceId,
|
|
466
|
-
supersededBy: account.lastSyncMetadata?.instanceId,
|
|
467
|
-
iteration
|
|
468
|
-
});
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
457
|
const lastSyncAtMs = account.lastSyncAt.getTime();
|
|
472
458
|
const windowMs = await step.do("resolve sync window", async () => {
|
|
473
459
|
const window = resolveSyncWindow(
|
|
@@ -481,15 +467,6 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
481
467
|
isCatchUp: window.isCatchUp
|
|
482
468
|
};
|
|
483
469
|
});
|
|
484
|
-
if (deadlineMs != null && windowMs.dateFromMs >= deadlineMs) {
|
|
485
|
-
logger.info("sync.window-elapsed", {
|
|
486
|
-
accountId,
|
|
487
|
-
instanceId: event.instanceId,
|
|
488
|
-
iteration,
|
|
489
|
-
deadline: new Date(deadlineMs).toISOString()
|
|
490
|
-
});
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
470
|
const syncWindow = {
|
|
494
471
|
dateFrom: new Date(windowMs.dateFromMs),
|
|
495
472
|
dateTo: new Date(windowMs.dateToMs),
|
|
@@ -2,7 +2,7 @@ import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
|
2
2
|
import { G as tables, H as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, m as isPaymentCompleted } from '../shared/bank.kz-PKVi5.mjs';
|
|
3
3
|
import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
|
|
4
4
|
import { sql, and, eq, inArray } from 'drizzle-orm';
|
|
5
|
-
import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, f as
|
|
5
|
+
import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.BWR4dqQ5.mjs';
|
|
6
6
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
7
7
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
8
8
|
import { drizzle } from 'drizzle-orm/d1';
|
|
@@ -429,7 +429,6 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
429
429
|
if (!accountId) {
|
|
430
430
|
throw new NonRetryableError(`Haven't obtained accountId to load.`);
|
|
431
431
|
}
|
|
432
|
-
const deadlineMs = computeWindowDeadline(event.instanceId, accountId);
|
|
433
432
|
const workflowStartedAt = await step.do(
|
|
434
433
|
"capture workflow start time",
|
|
435
434
|
async () => Date.now()
|
|
@@ -453,19 +452,6 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
453
452
|
if (!account.lastSyncAt) {
|
|
454
453
|
throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
|
|
455
454
|
}
|
|
456
|
-
if (isSupersededBy(
|
|
457
|
-
event.instanceId,
|
|
458
|
-
account.lastSyncMetadata?.instanceId,
|
|
459
|
-
accountId
|
|
460
|
-
)) {
|
|
461
|
-
logger.info("sync.superseded", {
|
|
462
|
-
accountId,
|
|
463
|
-
instanceId: event.instanceId,
|
|
464
|
-
supersededBy: account.lastSyncMetadata?.instanceId,
|
|
465
|
-
iteration
|
|
466
|
-
});
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
455
|
const lastSyncAtMs = account.lastSyncAt.getTime();
|
|
470
456
|
const windowMs = await step.do("resolve sync window", async () => {
|
|
471
457
|
const window = resolveSyncWindow(
|
|
@@ -479,15 +465,6 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
479
465
|
isCatchUp: window.isCatchUp
|
|
480
466
|
};
|
|
481
467
|
});
|
|
482
|
-
if (deadlineMs != null && windowMs.dateFromMs >= deadlineMs) {
|
|
483
|
-
logger.info("sync.window-elapsed", {
|
|
484
|
-
accountId,
|
|
485
|
-
instanceId: event.instanceId,
|
|
486
|
-
iteration,
|
|
487
|
-
deadline: new Date(deadlineMs).toISOString()
|
|
488
|
-
});
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
468
|
const syncWindow = {
|
|
492
469
|
dateFrom: new Date(windowMs.dateFromMs),
|
|
493
470
|
dateTo: new Date(windowMs.dateToMs),
|
package/dist/service.d.cts
CHANGED
|
@@ -17,8 +17,6 @@ interface BankServiceVariables {
|
|
|
17
17
|
DBUCS_TX_AUTH_URI: string;
|
|
18
18
|
REDIRECT_URI: string;
|
|
19
19
|
SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
|
|
20
|
-
CRON_SYNC_WORKFLOW_DISPATCH: string;
|
|
21
|
-
SYNC_DISPATCH_ACCOUNT_IDS: string;
|
|
22
20
|
[key: string]: string | number | boolean;
|
|
23
21
|
}
|
|
24
22
|
declare const BANK_SERVICE_BINDINGS: {
|
package/dist/service.d.mts
CHANGED
|
@@ -17,8 +17,6 @@ interface BankServiceVariables {
|
|
|
17
17
|
DBUCS_TX_AUTH_URI: string;
|
|
18
18
|
REDIRECT_URI: string;
|
|
19
19
|
SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
|
|
20
|
-
CRON_SYNC_WORKFLOW_DISPATCH: string;
|
|
21
|
-
SYNC_DISPATCH_ACCOUNT_IDS: string;
|
|
22
20
|
[key: string]: string | number | boolean;
|
|
23
21
|
}
|
|
24
22
|
declare const BANK_SERVICE_BINDINGS: {
|
package/dist/service.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ interface BankServiceVariables {
|
|
|
17
17
|
DBUCS_TX_AUTH_URI: string;
|
|
18
18
|
REDIRECT_URI: string;
|
|
19
19
|
SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
|
|
20
|
-
CRON_SYNC_WORKFLOW_DISPATCH: string;
|
|
21
|
-
SYNC_DISPATCH_ACCOUNT_IDS: string;
|
|
22
20
|
[key: string]: string | number | boolean;
|
|
23
21
|
}
|
|
24
22
|
declare const BANK_SERVICE_BINDINGS: {
|
|
@@ -7,53 +7,6 @@ import 'jose';
|
|
|
7
7
|
import '@develit-io/general-codes';
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
9
|
|
|
10
|
-
const DISPATCH_RECOVERY_WINDOW_MS = 5 * 60 * 1e3;
|
|
11
|
-
function parseInstanceWindow(instanceId, accountId) {
|
|
12
|
-
const prefix = `${accountId}-`;
|
|
13
|
-
if (!instanceId.startsWith(prefix)) return -1;
|
|
14
|
-
const suffix = instanceId.slice(prefix.length);
|
|
15
|
-
if (!/^\d+$/.test(suffix)) return -1;
|
|
16
|
-
return Number(suffix);
|
|
17
|
-
}
|
|
18
|
-
function buildDispatchInstanceId(accountId, nowMs, recoveryWindowMs = DISPATCH_RECOVERY_WINDOW_MS) {
|
|
19
|
-
return `${accountId}-${Math.floor(nowMs / recoveryWindowMs)}`;
|
|
20
|
-
}
|
|
21
|
-
function buildDispatchCreateOptions(instanceId, accountId) {
|
|
22
|
-
return {
|
|
23
|
-
id: instanceId,
|
|
24
|
-
params: { accountId },
|
|
25
|
-
// Dispatch mints ~24 instances per account per day and step outputs carry
|
|
26
|
-
// bank payloads — the default 30-day retention would pile up billable
|
|
27
|
-
// storage for state nobody reads after success.
|
|
28
|
-
retention: {
|
|
29
|
-
successRetention: "1 day",
|
|
30
|
-
errorRetention: "7 days"
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function computeWindowDeadline(instanceId, accountId, recoveryWindowMs = DISPATCH_RECOVERY_WINDOW_MS) {
|
|
35
|
-
const window = parseInstanceWindow(instanceId, accountId);
|
|
36
|
-
if (window < 0) return null;
|
|
37
|
-
return (window + 1) * recoveryWindowMs;
|
|
38
|
-
}
|
|
39
|
-
function isAlreadyExists(err) {
|
|
40
|
-
return /already exists/i.test(extractMessage(err));
|
|
41
|
-
}
|
|
42
|
-
function isInstanceNotFound(err) {
|
|
43
|
-
return /instance.*not.?found|not.?found.*instance/i.test(extractMessage(err));
|
|
44
|
-
}
|
|
45
|
-
function extractMessage(err) {
|
|
46
|
-
return err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : "";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function resolveCurrentSyncInstanceId(accountId, recordedInstanceId) {
|
|
50
|
-
return recordedInstanceId ?? accountId;
|
|
51
|
-
}
|
|
52
|
-
function isSupersededBy(myInstanceId, recordedInstanceId, accountId) {
|
|
53
|
-
if (recordedInstanceId == null) return false;
|
|
54
|
-
return parseInstanceWindow(recordedInstanceId, accountId) > parseInstanceWindow(myInstanceId, accountId);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
10
|
const createPaymentCommand = (db, { payment }) => {
|
|
58
11
|
return {
|
|
59
12
|
command: db.insert(tables.payment).values({
|
|
@@ -406,4 +359,4 @@ const initiateConnector = async ({
|
|
|
406
359
|
}
|
|
407
360
|
};
|
|
408
361
|
|
|
409
|
-
export {
|
|
362
|
+
export { getPaymentRequestsByBatchIdQuery as a, getAccountByIdQuery as b, checksum as c, createCredentialsResolver as d, updatePaymentRequestStatusCommand as e, createPaymentCommand as f, getBatchByIdQuery as g, encrypt as h, initiateConnector as i, importAesKey as j, upsertBatchCommand as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.
|
|
1
|
+
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.D3w3JIsQ.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
|
|
@@ -9,53 +9,6 @@ require('jose');
|
|
|
9
9
|
require('@develit-io/general-codes');
|
|
10
10
|
const node_crypto = require('node:crypto');
|
|
11
11
|
|
|
12
|
-
const DISPATCH_RECOVERY_WINDOW_MS = 5 * 60 * 1e3;
|
|
13
|
-
function parseInstanceWindow(instanceId, accountId) {
|
|
14
|
-
const prefix = `${accountId}-`;
|
|
15
|
-
if (!instanceId.startsWith(prefix)) return -1;
|
|
16
|
-
const suffix = instanceId.slice(prefix.length);
|
|
17
|
-
if (!/^\d+$/.test(suffix)) return -1;
|
|
18
|
-
return Number(suffix);
|
|
19
|
-
}
|
|
20
|
-
function buildDispatchInstanceId(accountId, nowMs, recoveryWindowMs = DISPATCH_RECOVERY_WINDOW_MS) {
|
|
21
|
-
return `${accountId}-${Math.floor(nowMs / recoveryWindowMs)}`;
|
|
22
|
-
}
|
|
23
|
-
function buildDispatchCreateOptions(instanceId, accountId) {
|
|
24
|
-
return {
|
|
25
|
-
id: instanceId,
|
|
26
|
-
params: { accountId },
|
|
27
|
-
// Dispatch mints ~24 instances per account per day and step outputs carry
|
|
28
|
-
// bank payloads — the default 30-day retention would pile up billable
|
|
29
|
-
// storage for state nobody reads after success.
|
|
30
|
-
retention: {
|
|
31
|
-
successRetention: "1 day",
|
|
32
|
-
errorRetention: "7 days"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function computeWindowDeadline(instanceId, accountId, recoveryWindowMs = DISPATCH_RECOVERY_WINDOW_MS) {
|
|
37
|
-
const window = parseInstanceWindow(instanceId, accountId);
|
|
38
|
-
if (window < 0) return null;
|
|
39
|
-
return (window + 1) * recoveryWindowMs;
|
|
40
|
-
}
|
|
41
|
-
function isAlreadyExists(err) {
|
|
42
|
-
return /already exists/i.test(extractMessage(err));
|
|
43
|
-
}
|
|
44
|
-
function isInstanceNotFound(err) {
|
|
45
|
-
return /instance.*not.?found|not.?found.*instance/i.test(extractMessage(err));
|
|
46
|
-
}
|
|
47
|
-
function extractMessage(err) {
|
|
48
|
-
return err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : "";
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function resolveCurrentSyncInstanceId(accountId, recordedInstanceId) {
|
|
52
|
-
return recordedInstanceId ?? accountId;
|
|
53
|
-
}
|
|
54
|
-
function isSupersededBy(myInstanceId, recordedInstanceId, accountId) {
|
|
55
|
-
if (recordedInstanceId == null) return false;
|
|
56
|
-
return parseInstanceWindow(recordedInstanceId, accountId) > parseInstanceWindow(myInstanceId, accountId);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
12
|
const createPaymentCommand = (db, { payment }) => {
|
|
60
13
|
return {
|
|
61
14
|
command: db.insert(paymentDirection.tables.payment).values({
|
|
@@ -408,11 +361,7 @@ const initiateConnector = async ({
|
|
|
408
361
|
}
|
|
409
362
|
};
|
|
410
363
|
|
|
411
|
-
exports.DISPATCH_RECOVERY_WINDOW_MS = DISPATCH_RECOVERY_WINDOW_MS;
|
|
412
|
-
exports.buildDispatchCreateOptions = buildDispatchCreateOptions;
|
|
413
|
-
exports.buildDispatchInstanceId = buildDispatchInstanceId;
|
|
414
364
|
exports.checksum = checksum;
|
|
415
|
-
exports.computeWindowDeadline = computeWindowDeadline;
|
|
416
365
|
exports.createCredentialsResolver = createCredentialsResolver;
|
|
417
366
|
exports.createPaymentCommand = createPaymentCommand;
|
|
418
367
|
exports.encrypt = encrypt;
|
|
@@ -421,9 +370,5 @@ exports.getBatchByIdQuery = getBatchByIdQuery;
|
|
|
421
370
|
exports.getPaymentRequestsByBatchIdQuery = getPaymentRequestsByBatchIdQuery;
|
|
422
371
|
exports.importAesKey = importAesKey;
|
|
423
372
|
exports.initiateConnector = initiateConnector;
|
|
424
|
-
exports.isAlreadyExists = isAlreadyExists;
|
|
425
|
-
exports.isInstanceNotFound = isInstanceNotFound;
|
|
426
|
-
exports.isSupersededBy = isSupersededBy;
|
|
427
|
-
exports.resolveCurrentSyncInstanceId = resolveCurrentSyncInstanceId;
|
|
428
373
|
exports.updatePaymentRequestStatusCommand = updatePaymentRequestStatusCommand;
|
|
429
374
|
exports.upsertBatchCommand = upsertBatchCommand;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.
|
|
1
|
+
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.D3w3JIsQ.cjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
|
|
@@ -3280,7 +3280,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3280
3280
|
name: string;
|
|
3281
3281
|
tableName: "batch";
|
|
3282
3282
|
dataType: "string enum";
|
|
3283
|
-
data: "AUTHORIZED" | "
|
|
3283
|
+
data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
|
|
3284
3284
|
driverParam: string;
|
|
3285
3285
|
notNull: false;
|
|
3286
3286
|
hasDefault: false;
|
|
@@ -3656,7 +3656,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3656
3656
|
name: string;
|
|
3657
3657
|
tableName: "payment";
|
|
3658
3658
|
dataType: "string enum";
|
|
3659
|
-
data: "
|
|
3659
|
+
data: "PROCESSING" | "PENDING" | "BOOKED" | "CANCELLED" | "REJECTED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3660
3660
|
driverParam: string;
|
|
3661
3661
|
notNull: true;
|
|
3662
3662
|
hasDefault: false;
|
|
@@ -4160,7 +4160,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4160
4160
|
name: string;
|
|
4161
4161
|
tableName: "payment_request";
|
|
4162
4162
|
dataType: "string enum";
|
|
4163
|
-
data: "
|
|
4163
|
+
data: "AUTHORIZED" | "COMPLETED" | "BOOKED" | "REJECTED" | "OPENED" | "SETTLED" | "CLOSED";
|
|
4164
4164
|
driverParam: string;
|
|
4165
4165
|
notNull: true;
|
|
4166
4166
|
hasDefault: false;
|
|
@@ -3280,7 +3280,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3280
3280
|
name: string;
|
|
3281
3281
|
tableName: "batch";
|
|
3282
3282
|
dataType: "string enum";
|
|
3283
|
-
data: "AUTHORIZED" | "
|
|
3283
|
+
data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
|
|
3284
3284
|
driverParam: string;
|
|
3285
3285
|
notNull: false;
|
|
3286
3286
|
hasDefault: false;
|
|
@@ -3656,7 +3656,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3656
3656
|
name: string;
|
|
3657
3657
|
tableName: "payment";
|
|
3658
3658
|
dataType: "string enum";
|
|
3659
|
-
data: "
|
|
3659
|
+
data: "PROCESSING" | "PENDING" | "BOOKED" | "CANCELLED" | "REJECTED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3660
3660
|
driverParam: string;
|
|
3661
3661
|
notNull: true;
|
|
3662
3662
|
hasDefault: false;
|
|
@@ -4160,7 +4160,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4160
4160
|
name: string;
|
|
4161
4161
|
tableName: "payment_request";
|
|
4162
4162
|
dataType: "string enum";
|
|
4163
|
-
data: "
|
|
4163
|
+
data: "AUTHORIZED" | "COMPLETED" | "BOOKED" | "REJECTED" | "OPENED" | "SETTLED" | "CLOSED";
|
|
4164
4164
|
driverParam: string;
|
|
4165
4165
|
notNull: true;
|
|
4166
4166
|
hasDefault: false;
|
|
@@ -3280,7 +3280,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3280
3280
|
name: string;
|
|
3281
3281
|
tableName: "batch";
|
|
3282
3282
|
dataType: "string enum";
|
|
3283
|
-
data: "AUTHORIZED" | "
|
|
3283
|
+
data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
|
|
3284
3284
|
driverParam: string;
|
|
3285
3285
|
notNull: false;
|
|
3286
3286
|
hasDefault: false;
|
|
@@ -3656,7 +3656,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3656
3656
|
name: string;
|
|
3657
3657
|
tableName: "payment";
|
|
3658
3658
|
dataType: "string enum";
|
|
3659
|
-
data: "
|
|
3659
|
+
data: "PROCESSING" | "PENDING" | "BOOKED" | "CANCELLED" | "REJECTED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3660
3660
|
driverParam: string;
|
|
3661
3661
|
notNull: true;
|
|
3662
3662
|
hasDefault: false;
|
|
@@ -4160,7 +4160,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4160
4160
|
name: string;
|
|
4161
4161
|
tableName: "payment_request";
|
|
4162
4162
|
dataType: "string enum";
|
|
4163
|
-
data: "
|
|
4163
|
+
data: "AUTHORIZED" | "COMPLETED" | "BOOKED" | "REJECTED" | "OPENED" | "SETTLED" | "CLOSED";
|
|
4164
4164
|
driverParam: string;
|
|
4165
4165
|
notNull: true;
|
|
4166
4166
|
hasDefault: false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.
|
|
1
|
+
import { e as CurrencyCode, S as BankCode, a2 as CountryCode, P as PaymentRequestSelectType } from './bank.D3w3JIsQ.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.
|
|
2
|
-
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.
|
|
3
|
-
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.
|
|
4
|
-
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.D3w3JIsQ.cjs';
|
|
2
|
+
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.D3w3JIsQ.cjs';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.CggHtT3y.cjs';
|
|
4
|
+
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.CggHtT3y.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { BaseEvent } from '@develit-io/backend-sdk';
|
|
7
7
|
import * as drizzle_orm_zod from 'drizzle-orm/zod';
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.
|
|
2
|
-
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.
|
|
3
|
-
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.
|
|
4
|
-
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.D3w3JIsQ.mjs';
|
|
2
|
+
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.D3w3JIsQ.mjs';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.CDB7SWNr.mjs';
|
|
4
|
+
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.CDB7SWNr.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { BaseEvent } from '@develit-io/backend-sdk';
|
|
7
7
|
import * as drizzle_orm_zod from 'drizzle-orm/zod';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.
|
|
2
|
-
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.
|
|
3
|
-
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank
|
|
4
|
-
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank
|
|
1
|
+
import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, E as EndToEndIdPayment, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.D3w3JIsQ.js';
|
|
2
|
+
export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, F as AccountCredentialsUpdateType, G as AccountPatchType, J as AccountStatus, K as AccountUpdateType, M as AuthorizedBatch, N as BASE_TERMINAL_STATUSES, O as BATCH_MODES, Q as BATCH_STATUES, Q as BATCH_STATUSES, R as BankAccountWithLastSync, S as BankCode, T as BatchInsertType, U as BatchLifecycle, V as BatchMode, W as BatchPayment, B as BatchSelectType, X as BatchStatus, Y as CHARGE_BEARERS, Z as CONNECTOR_KEYS, _ as COUNTRY_CODES, $ as CREDENTIALS_TYPES, a0 as ChargeBearer, a1 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a2 as CountryCode, a3 as CredentialsType, e as CurrencyCode, a4 as INSTRUCTION_PRIORITIES, a5 as InstructionPriority, L as LastSyncMetadata, a6 as PAYMENT_DIRECTIONS, a7 as PAYMENT_REQUEST_STATUSES, a8 as PAYMENT_STATUSES, a9 as PAYMENT_TYPES, aa as PaymentDirection, ab as PaymentFailedInsertType, ac as PaymentInsertType, ad as PaymentLifecycle, ae as PaymentPreparedInsertType, af as PaymentStatus, ag as ProcessingBatch, ah as ReadyToSignBatch, ai as ResolvedCredentials, aj as TOKEN_TYPES, ak as TokenType, al as accountCredentialsInsertSchema, am as accountCredentialsSelectSchema, an as accountCredentialsUpdateSchema, ao as accountInsertSchema, ap as accountSelectSchema, aq as accountUpdateSchema, ar as hasPaymentAccountAssigned, as as isBatchAuthorized, at as isBatchCompleted, au as isBatchFailed, av as isBatchInitiated, aw as isBatchProcessing, ax as isBatchReadyToSign, ay as isPaymentCompleted, az as isPendingStatus, aA as isProcessedStatus, aB as isTerminalStatus } from './shared/bank.D3w3JIsQ.js';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.DhMeQgpB.js';
|
|
4
|
+
export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.DhMeQgpB.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { BaseEvent } from '@develit-io/backend-sdk';
|
|
7
7
|
import * as drizzle_orm_zod from 'drizzle-orm/zod';
|