@develit-services/bank 5.7.1 → 5.8.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 +221 -17
- package/dist/base.d.cts +21 -14
- package/dist/base.d.mts +21 -14
- package/dist/base.d.ts +21 -14
- package/dist/base.mjs +221 -17
- 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 +203 -40
- package/dist/export/workflows.d.cts +1 -0
- package/dist/export/workflows.d.mts +1 -0
- package/dist/export/workflows.d.ts +1 -0
- package/dist/export/workflows.mjs +204 -41
- package/dist/service.d.cts +3 -0
- package/dist/service.d.mts +3 -0
- package/dist/service.d.ts +3 -0
- package/dist/shared/{bank.CBpXmaTL.d.ts → bank.BOeuHdjy.d.ts} +1 -1
- package/dist/shared/{bank.BQwwtIR4.d.cts → bank.CefGTNH1.d.cts} +5 -3
- package/dist/shared/{bank.BQwwtIR4.d.mts → bank.CefGTNH1.d.mts} +5 -3
- package/dist/shared/{bank.BQwwtIR4.d.ts → bank.CefGTNH1.d.ts} +5 -3
- package/dist/shared/{bank.BUzoc8p6.d.cts → bank.CtIkqQG9.d.cts} +1 -1
- package/dist/shared/{bank.B0DNtuUM.cjs → bank.Cy7xa566.cjs} +31 -0
- package/dist/shared/{bank.DLU1sOBm.mjs → bank.D6gBgL07.mjs} +28 -1
- package/dist/shared/{bank.DZ3Ow4bP.d.mts → bank.oNDZ44du.d.mts} +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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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.BVXtqHnq.mjs';
|
|
3
3
|
import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
|
|
4
|
-
import {
|
|
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.
|
|
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 isSupersededBy, h as createPaymentCommand, r as resolveIterationBudget } from '../shared/bank.D6gBgL07.mjs';
|
|
6
6
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
7
7
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
8
8
|
import { drizzle } from 'drizzle-orm/d1';
|
|
@@ -18,12 +18,17 @@ import 'drizzle-orm/zod';
|
|
|
18
18
|
const updateAccountLastSyncCommand = (db, {
|
|
19
19
|
lastSyncAt,
|
|
20
20
|
accountId,
|
|
21
|
-
lastSyncMetadata
|
|
21
|
+
lastSyncMetadata,
|
|
22
|
+
seenInstanceId
|
|
22
23
|
}) => {
|
|
24
|
+
const markerUnchanged = seenInstanceId === void 0 ? void 0 : (
|
|
25
|
+
// IS instead of = so a null marker compares equal to null.
|
|
26
|
+
sql`json_extract(${tables.account.lastSyncMetadata}, '$.instanceId') IS ${seenInstanceId}`
|
|
27
|
+
);
|
|
23
28
|
const command = db.update(tables.account).set({
|
|
24
29
|
lastSyncAt,
|
|
25
30
|
lastSyncMetadata
|
|
26
|
-
}).where(eq(tables.account.id, accountId)).returning();
|
|
31
|
+
}).where(and(eq(tables.account.id, accountId), markerUnchanged)).returning();
|
|
27
32
|
return {
|
|
28
33
|
command
|
|
29
34
|
};
|
|
@@ -338,6 +343,72 @@ function getStepCount(ctx) {
|
|
|
338
343
|
return ctx.step?.count ?? 0;
|
|
339
344
|
}
|
|
340
345
|
|
|
346
|
+
const MAX_CATCH_UP_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
347
|
+
function resolveSyncWindow(lastSyncAt, nowMs, maxWindowMs) {
|
|
348
|
+
const openEnded = {
|
|
349
|
+
dateFrom: lastSyncAt,
|
|
350
|
+
dateTo: new Date(Math.max(nowMs, lastSyncAt.getTime())),
|
|
351
|
+
isCatchUp: false
|
|
352
|
+
};
|
|
353
|
+
if (!Number.isFinite(maxWindowMs) || maxWindowMs <= 0) return openEnded;
|
|
354
|
+
const clippedToMs = lastSyncAt.getTime() + maxWindowMs;
|
|
355
|
+
if (clippedToMs >= nowMs) return openEnded;
|
|
356
|
+
return {
|
|
357
|
+
dateFrom: lastSyncAt,
|
|
358
|
+
dateTo: new Date(clippedToMs),
|
|
359
|
+
isCatchUp: true
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const STEP_RESULT_BYTE_CEILING = 800 * 1024;
|
|
364
|
+
class StepResultTooLargeError extends NonRetryableError {
|
|
365
|
+
}
|
|
366
|
+
function guardStepResultSize(value, ceilingBytes = STEP_RESULT_BYTE_CEILING) {
|
|
367
|
+
const bytes = new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
368
|
+
if (bytes > ceilingBytes) {
|
|
369
|
+
const count = Array.isArray(value) ? value.length : 1;
|
|
370
|
+
throw new StepResultTooLargeError(
|
|
371
|
+
`Fetched ${count} payments (${bytes} bytes), over the ${ceilingBytes} byte step result ceiling`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function rethrowFetchError(err) {
|
|
376
|
+
if (err instanceof NonRetryableError) throw err;
|
|
377
|
+
const message = err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : JSON.stringify(err);
|
|
378
|
+
throw new Error(message);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const MIN_CATCH_UP_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
382
|
+
async function fetchBoundedByWindow({
|
|
383
|
+
window,
|
|
384
|
+
fetchWindow,
|
|
385
|
+
guardResult,
|
|
386
|
+
minWindowMs,
|
|
387
|
+
onNarrowed
|
|
388
|
+
}) {
|
|
389
|
+
let current = window;
|
|
390
|
+
while (true) {
|
|
391
|
+
const result = await fetchWindow(current);
|
|
392
|
+
try {
|
|
393
|
+
guardResult(result);
|
|
394
|
+
return { result, window: current };
|
|
395
|
+
} catch (tooLarge) {
|
|
396
|
+
if (!(tooLarge instanceof StepResultTooLargeError)) throw tooLarge;
|
|
397
|
+
const halvedSpanMs = Math.floor(
|
|
398
|
+
(current.dateTo.getTime() - current.dateFrom.getTime()) / 2
|
|
399
|
+
);
|
|
400
|
+
if (halvedSpanMs < minWindowMs) throw tooLarge;
|
|
401
|
+
current = {
|
|
402
|
+
dateFrom: current.dateFrom,
|
|
403
|
+
dateTo: new Date(current.dateFrom.getTime() + halvedSpanMs),
|
|
404
|
+
// Stops short of the original target, so another pass is needed.
|
|
405
|
+
isCatchUp: true
|
|
406
|
+
};
|
|
407
|
+
onNarrowed?.(current);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
341
412
|
async function pushToQueue(queue, message) {
|
|
342
413
|
if (!Array.isArray(message)) {
|
|
343
414
|
await queue.send(message, { contentType: "v8" });
|
|
@@ -352,7 +423,8 @@ async function pushToQueue(queue, message) {
|
|
|
352
423
|
}
|
|
353
424
|
class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
354
425
|
async run(event, step) {
|
|
355
|
-
const { accountId } = event.payload;
|
|
426
|
+
const { accountId, maxIterations } = event.payload;
|
|
427
|
+
const iterationBudget = resolveIterationBudget(maxIterations);
|
|
356
428
|
const db = drizzle(this.env.BANK_D1, { schema: tables, relations });
|
|
357
429
|
const logger = createWorkflowLogger(event.instanceId);
|
|
358
430
|
if (!accountId) {
|
|
@@ -362,8 +434,7 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
362
434
|
"capture workflow start time",
|
|
363
435
|
async () => Date.now()
|
|
364
436
|
);
|
|
365
|
-
|
|
366
|
-
const now = /* @__PURE__ */ new Date();
|
|
437
|
+
for (let iteration = 0; iteration < iterationBudget; iteration++) {
|
|
367
438
|
const account = await step.do("load account", async () => {
|
|
368
439
|
const account2 = await getAccountByIdQuery(db, { accountId });
|
|
369
440
|
if (!account2) {
|
|
@@ -374,7 +445,38 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
374
445
|
if (!account.lastSyncAt) {
|
|
375
446
|
throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
|
|
376
447
|
}
|
|
377
|
-
|
|
448
|
+
if (isSupersededBy(
|
|
449
|
+
event.instanceId,
|
|
450
|
+
account.lastSyncMetadata?.instanceId,
|
|
451
|
+
accountId
|
|
452
|
+
)) {
|
|
453
|
+
logger.info("sync.superseded", {
|
|
454
|
+
accountId,
|
|
455
|
+
instanceId: event.instanceId,
|
|
456
|
+
supersededBy: account.lastSyncMetadata?.instanceId,
|
|
457
|
+
iteration
|
|
458
|
+
});
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const lastSyncAtMs = account.lastSyncAt.getTime();
|
|
462
|
+
const windowMs = await step.do("resolve sync window", async () => {
|
|
463
|
+
const window = resolveSyncWindow(
|
|
464
|
+
new Date(lastSyncAtMs),
|
|
465
|
+
Date.now(),
|
|
466
|
+
MAX_CATCH_UP_WINDOW_MS
|
|
467
|
+
);
|
|
468
|
+
return {
|
|
469
|
+
dateFromMs: window.dateFrom.getTime(),
|
|
470
|
+
dateToMs: window.dateTo.getTime(),
|
|
471
|
+
isCatchUp: window.isCatchUp
|
|
472
|
+
};
|
|
473
|
+
});
|
|
474
|
+
const syncWindow = {
|
|
475
|
+
dateFrom: new Date(windowMs.dateFromMs),
|
|
476
|
+
dateTo: new Date(windowMs.dateToMs),
|
|
477
|
+
isCatchUp: windowMs.isCatchUp
|
|
478
|
+
};
|
|
479
|
+
const fetched = await step.do(
|
|
378
480
|
"fetch bank payments",
|
|
379
481
|
{
|
|
380
482
|
retries: { limit: 5, delay: "2 minutes", backoff: "exponential" },
|
|
@@ -403,42 +505,88 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
403
505
|
}
|
|
404
506
|
]
|
|
405
507
|
});
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
508
|
+
const fetchWindow = async (window) => {
|
|
509
|
+
const result = await connector.getAllAccountPayments({
|
|
510
|
+
account,
|
|
511
|
+
filter: {
|
|
512
|
+
dateFrom: window.dateFrom,
|
|
513
|
+
dateTo: window.dateTo
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
const identifiable = result.filter(
|
|
517
|
+
(p) => p.parsed.bankRefId?.trim()
|
|
518
|
+
);
|
|
519
|
+
const skipped = result.length - identifiable.length;
|
|
520
|
+
if (skipped > 0) {
|
|
521
|
+
logger.warn("payments.fetch.skipped_blank_bank_ref", {
|
|
522
|
+
accountId,
|
|
523
|
+
connectorKey: account.connectorKey,
|
|
524
|
+
skipped
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
return Promise.all(
|
|
528
|
+
identifiable.map(async (p) => ({
|
|
529
|
+
parsed: {
|
|
530
|
+
...p.parsed,
|
|
531
|
+
id: await deriveV4PaymentId(p.parsed)
|
|
532
|
+
}
|
|
533
|
+
}))
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
let bounded;
|
|
537
|
+
try {
|
|
538
|
+
bounded = await fetchBoundedByWindow({
|
|
539
|
+
window: syncWindow,
|
|
540
|
+
fetchWindow,
|
|
541
|
+
guardResult: guardStepResultSize,
|
|
542
|
+
minWindowMs: MIN_CATCH_UP_WINDOW_MS,
|
|
543
|
+
onNarrowed: (narrowed) => logger.warn("payments.fetch.window-narrowed", {
|
|
544
|
+
accountId,
|
|
545
|
+
connectorKey: account.connectorKey,
|
|
546
|
+
dateFrom: narrowed.dateFrom.toISOString(),
|
|
547
|
+
dateTo: narrowed.dateTo.toISOString()
|
|
548
|
+
})
|
|
549
|
+
});
|
|
550
|
+
} catch (err) {
|
|
551
|
+
if (err instanceof StepResultTooLargeError) {
|
|
552
|
+
logger.error("payments.fetch.result-too-large", {
|
|
553
|
+
accountId,
|
|
554
|
+
connectorKey: account.connectorKey,
|
|
555
|
+
dateFrom: syncWindow.dateFrom.toISOString(),
|
|
556
|
+
dateTo: syncWindow.dateTo.toISOString()
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
throw err;
|
|
560
|
+
}
|
|
410
561
|
logger.info("payments.fetch.completed", {
|
|
411
562
|
accountId,
|
|
412
563
|
connectorKey: account.connectorKey,
|
|
413
|
-
paymentsCount: result.length
|
|
564
|
+
paymentsCount: bounded.result.length
|
|
414
565
|
});
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
skipped
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
return Promise.all(
|
|
427
|
-
identifiable.map(async (p) => ({
|
|
428
|
-
parsed: { ...p.parsed, id: await deriveV4PaymentId(p.parsed) }
|
|
429
|
-
}))
|
|
430
|
-
);
|
|
566
|
+
return {
|
|
567
|
+
payments: bounded.result,
|
|
568
|
+
windowMs: {
|
|
569
|
+
dateFromMs: bounded.window.dateFrom.getTime(),
|
|
570
|
+
dateToMs: bounded.window.dateTo.getTime(),
|
|
571
|
+
isCatchUp: bounded.window.isCatchUp
|
|
572
|
+
}
|
|
573
|
+
};
|
|
431
574
|
} catch (err) {
|
|
432
|
-
const message = err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : JSON.stringify(err);
|
|
433
575
|
logger.error("payments.fetch.failed", {
|
|
434
576
|
accountId,
|
|
435
577
|
connectorKey: account.connectorKey,
|
|
436
|
-
error: message
|
|
578
|
+
error: err instanceof Error ? err.message : String(err)
|
|
437
579
|
});
|
|
438
|
-
|
|
580
|
+
rethrowFetchError(err);
|
|
439
581
|
}
|
|
440
582
|
}
|
|
441
583
|
);
|
|
584
|
+
const payments = fetched.payments;
|
|
585
|
+
const effectiveWindow = {
|
|
586
|
+
dateFrom: new Date(fetched.windowMs.dateFromMs),
|
|
587
|
+
dateTo: new Date(fetched.windowMs.dateToMs),
|
|
588
|
+
isCatchUp: fetched.windowMs.isCatchUp
|
|
589
|
+
};
|
|
442
590
|
const paymentsToProcess = payments.filter(
|
|
443
591
|
(p) => isPaymentCompleted(p.parsed)
|
|
444
592
|
);
|
|
@@ -513,6 +661,7 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
513
661
|
}))
|
|
514
662
|
);
|
|
515
663
|
const lastSyncMetadata = {
|
|
664
|
+
instanceId: event.instanceId,
|
|
516
665
|
payments: payments.length,
|
|
517
666
|
paymentsToProcess: paymentsToProcess.length,
|
|
518
667
|
paymentsInserted: paymentsToInsert.length,
|
|
@@ -529,15 +678,27 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
529
678
|
};
|
|
530
679
|
const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
|
|
531
680
|
accountId: account.id,
|
|
532
|
-
|
|
533
|
-
|
|
681
|
+
// End of the window just fetched, not `now`: while catching up the
|
|
682
|
+
// window stops short of now, and advancing past it would skip every
|
|
683
|
+
// payment in the gap.
|
|
684
|
+
lastSyncAt: effectiveWindow.dateTo,
|
|
685
|
+
lastSyncMetadata,
|
|
686
|
+
seenInstanceId: account.lastSyncMetadata?.instanceId ?? null
|
|
534
687
|
}).command;
|
|
688
|
+
let syncStateRows;
|
|
535
689
|
if (createCommands.length) {
|
|
536
|
-
await db.batch(
|
|
690
|
+
const [updateResult] = await db.batch(
|
|
537
691
|
asNonEmpty([updateLastSyncCommand, ...createCommands])
|
|
538
692
|
);
|
|
693
|
+
syncStateRows = updateResult;
|
|
539
694
|
} else {
|
|
540
|
-
await updateLastSyncCommand;
|
|
695
|
+
syncStateRows = await updateLastSyncCommand;
|
|
696
|
+
}
|
|
697
|
+
if (syncStateRows.length === 0) {
|
|
698
|
+
logger.info("sync.write-superseded", {
|
|
699
|
+
accountId,
|
|
700
|
+
instanceId: event.instanceId
|
|
701
|
+
});
|
|
541
702
|
}
|
|
542
703
|
if (eventsToEmit.length) {
|
|
543
704
|
await pushToQueue(
|
|
@@ -547,14 +708,16 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
547
708
|
}
|
|
548
709
|
return {
|
|
549
710
|
...lastSyncMetadata,
|
|
550
|
-
newLastSyncAt:
|
|
711
|
+
newLastSyncAt: effectiveWindow.dateTo
|
|
551
712
|
};
|
|
552
713
|
}
|
|
553
714
|
);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
715
|
+
if (!effectiveWindow.isCatchUp) {
|
|
716
|
+
await step.sleep(
|
|
717
|
+
"Sleep for next sync",
|
|
718
|
+
`${account.syncIntervalS} seconds`
|
|
719
|
+
);
|
|
720
|
+
}
|
|
558
721
|
}
|
|
559
722
|
}
|
|
560
723
|
}
|
package/dist/service.d.cts
CHANGED
|
@@ -17,6 +17,9 @@ 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
|
+
SYNC_WORKFLOW_MAX_ITERATIONS: string;
|
|
20
23
|
[key: string]: string | number | boolean;
|
|
21
24
|
}
|
|
22
25
|
declare const BANK_SERVICE_BINDINGS: {
|
package/dist/service.d.mts
CHANGED
|
@@ -17,6 +17,9 @@ 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
|
+
SYNC_WORKFLOW_MAX_ITERATIONS: string;
|
|
20
23
|
[key: string]: string | number | boolean;
|
|
21
24
|
}
|
|
22
25
|
declare const BANK_SERVICE_BINDINGS: {
|
package/dist/service.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ 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
|
+
SYNC_WORKFLOW_MAX_ITERATIONS: string;
|
|
20
23
|
[key: string]: string | number | boolean;
|
|
21
24
|
}
|
|
22
25
|
declare const BANK_SERVICE_BINDINGS: {
|
|
@@ -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.CefGTNH1.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
|
|
@@ -27,6 +27,8 @@ interface LastSyncMetadata {
|
|
|
27
27
|
eventsEmitted: number;
|
|
28
28
|
iterationCount?: number;
|
|
29
29
|
workflowStartedAt?: number;
|
|
30
|
+
/** Which instance wrote this sync — lets an older sibling detect it was superseded. */
|
|
31
|
+
instanceId?: string;
|
|
30
32
|
}
|
|
31
33
|
type ConnectorConfig = Record<string, string | number | boolean | null>;
|
|
32
34
|
|
|
@@ -3230,7 +3232,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3230
3232
|
name: string;
|
|
3231
3233
|
tableName: "batch";
|
|
3232
3234
|
dataType: "string enum";
|
|
3233
|
-
data: "AUTHORIZED" | "
|
|
3235
|
+
data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
|
|
3234
3236
|
driverParam: string;
|
|
3235
3237
|
notNull: false;
|
|
3236
3238
|
hasDefault: false;
|
|
@@ -3606,7 +3608,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3606
3608
|
name: string;
|
|
3607
3609
|
tableName: "payment";
|
|
3608
3610
|
dataType: "string enum";
|
|
3609
|
-
data: "
|
|
3611
|
+
data: "BOOKED" | "REJECTED" | "PROCESSING" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3610
3612
|
driverParam: string;
|
|
3611
3613
|
notNull: true;
|
|
3612
3614
|
hasDefault: false;
|
|
@@ -4110,7 +4112,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4110
4112
|
name: string;
|
|
4111
4113
|
tableName: "payment_request";
|
|
4112
4114
|
dataType: "string enum";
|
|
4113
|
-
data: "
|
|
4115
|
+
data: "OPENED" | "AUTHORIZED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
|
|
4114
4116
|
driverParam: string;
|
|
4115
4117
|
notNull: true;
|
|
4116
4118
|
hasDefault: false;
|
|
@@ -27,6 +27,8 @@ interface LastSyncMetadata {
|
|
|
27
27
|
eventsEmitted: number;
|
|
28
28
|
iterationCount?: number;
|
|
29
29
|
workflowStartedAt?: number;
|
|
30
|
+
/** Which instance wrote this sync — lets an older sibling detect it was superseded. */
|
|
31
|
+
instanceId?: string;
|
|
30
32
|
}
|
|
31
33
|
type ConnectorConfig = Record<string, string | number | boolean | null>;
|
|
32
34
|
|
|
@@ -3230,7 +3232,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3230
3232
|
name: string;
|
|
3231
3233
|
tableName: "batch";
|
|
3232
3234
|
dataType: "string enum";
|
|
3233
|
-
data: "AUTHORIZED" | "
|
|
3235
|
+
data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
|
|
3234
3236
|
driverParam: string;
|
|
3235
3237
|
notNull: false;
|
|
3236
3238
|
hasDefault: false;
|
|
@@ -3606,7 +3608,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3606
3608
|
name: string;
|
|
3607
3609
|
tableName: "payment";
|
|
3608
3610
|
dataType: "string enum";
|
|
3609
|
-
data: "
|
|
3611
|
+
data: "BOOKED" | "REJECTED" | "PROCESSING" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3610
3612
|
driverParam: string;
|
|
3611
3613
|
notNull: true;
|
|
3612
3614
|
hasDefault: false;
|
|
@@ -4110,7 +4112,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4110
4112
|
name: string;
|
|
4111
4113
|
tableName: "payment_request";
|
|
4112
4114
|
dataType: "string enum";
|
|
4113
|
-
data: "
|
|
4115
|
+
data: "OPENED" | "AUTHORIZED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
|
|
4114
4116
|
driverParam: string;
|
|
4115
4117
|
notNull: true;
|
|
4116
4118
|
hasDefault: false;
|
|
@@ -27,6 +27,8 @@ interface LastSyncMetadata {
|
|
|
27
27
|
eventsEmitted: number;
|
|
28
28
|
iterationCount?: number;
|
|
29
29
|
workflowStartedAt?: number;
|
|
30
|
+
/** Which instance wrote this sync — lets an older sibling detect it was superseded. */
|
|
31
|
+
instanceId?: string;
|
|
30
32
|
}
|
|
31
33
|
type ConnectorConfig = Record<string, string | number | boolean | null>;
|
|
32
34
|
|
|
@@ -3230,7 +3232,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3230
3232
|
name: string;
|
|
3231
3233
|
tableName: "batch";
|
|
3232
3234
|
dataType: "string enum";
|
|
3233
|
-
data: "AUTHORIZED" | "
|
|
3235
|
+
data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
|
|
3234
3236
|
driverParam: string;
|
|
3235
3237
|
notNull: false;
|
|
3236
3238
|
hasDefault: false;
|
|
@@ -3606,7 +3608,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3606
3608
|
name: string;
|
|
3607
3609
|
tableName: "payment";
|
|
3608
3610
|
dataType: "string enum";
|
|
3609
|
-
data: "
|
|
3611
|
+
data: "BOOKED" | "REJECTED" | "PROCESSING" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
|
|
3610
3612
|
driverParam: string;
|
|
3611
3613
|
notNull: true;
|
|
3612
3614
|
hasDefault: false;
|
|
@@ -4110,7 +4112,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
4110
4112
|
name: string;
|
|
4111
4113
|
tableName: "payment_request";
|
|
4112
4114
|
dataType: "string enum";
|
|
4113
|
-
data: "
|
|
4115
|
+
data: "OPENED" | "AUTHORIZED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
|
|
4114
4116
|
driverParam: string;
|
|
4115
4117
|
notNull: true;
|
|
4116
4118
|
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.CefGTNH1.cjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
|
|
@@ -9,6 +9,33 @@ require('jose');
|
|
|
9
9
|
require('@develit-io/general-codes');
|
|
10
10
|
const node_crypto = require('node:crypto');
|
|
11
11
|
|
|
12
|
+
function parseInstanceWindow(instanceId, accountId) {
|
|
13
|
+
const prefix = `${accountId}-`;
|
|
14
|
+
if (!instanceId.startsWith(prefix)) return -1;
|
|
15
|
+
const suffix = instanceId.slice(prefix.length);
|
|
16
|
+
if (!/^\d+$/.test(suffix)) return -1;
|
|
17
|
+
return Number(suffix);
|
|
18
|
+
}
|
|
19
|
+
function resolveCurrentSyncInstanceId(accountId, recordedInstanceId) {
|
|
20
|
+
return recordedInstanceId ?? accountId;
|
|
21
|
+
}
|
|
22
|
+
function isSupersededBy(myInstanceId, recordedInstanceId, accountId) {
|
|
23
|
+
if (recordedInstanceId == null) return false;
|
|
24
|
+
return parseInstanceWindow(recordedInstanceId, accountId) > parseInstanceWindow(myInstanceId, accountId);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizeBudget(value) {
|
|
28
|
+
if (!Number.isFinite(value) || value < 1) return void 0;
|
|
29
|
+
return Math.floor(value);
|
|
30
|
+
}
|
|
31
|
+
function parseIterationBudgetParam(value) {
|
|
32
|
+
return normalizeBudget(Number(value?.trim() || Number.NaN));
|
|
33
|
+
}
|
|
34
|
+
function resolveIterationBudget(maxIterations) {
|
|
35
|
+
if (maxIterations == null) return Number.POSITIVE_INFINITY;
|
|
36
|
+
return normalizeBudget(maxIterations) ?? Number.POSITIVE_INFINITY;
|
|
37
|
+
}
|
|
38
|
+
|
|
12
39
|
const createPaymentCommand = (db, { payment }) => {
|
|
13
40
|
return {
|
|
14
41
|
command: db.insert(paymentDirection.tables.payment).values({
|
|
@@ -370,5 +397,9 @@ exports.getBatchByIdQuery = getBatchByIdQuery;
|
|
|
370
397
|
exports.getPaymentRequestsByBatchIdQuery = getPaymentRequestsByBatchIdQuery;
|
|
371
398
|
exports.importAesKey = importAesKey;
|
|
372
399
|
exports.initiateConnector = initiateConnector;
|
|
400
|
+
exports.isSupersededBy = isSupersededBy;
|
|
401
|
+
exports.parseIterationBudgetParam = parseIterationBudgetParam;
|
|
402
|
+
exports.resolveCurrentSyncInstanceId = resolveCurrentSyncInstanceId;
|
|
403
|
+
exports.resolveIterationBudget = resolveIterationBudget;
|
|
373
404
|
exports.updatePaymentRequestStatusCommand = updatePaymentRequestStatusCommand;
|
|
374
405
|
exports.upsertBatchCommand = upsertBatchCommand;
|
|
@@ -7,6 +7,33 @@ import 'jose';
|
|
|
7
7
|
import '@develit-io/general-codes';
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
9
|
|
|
10
|
+
function parseInstanceWindow(instanceId, accountId) {
|
|
11
|
+
const prefix = `${accountId}-`;
|
|
12
|
+
if (!instanceId.startsWith(prefix)) return -1;
|
|
13
|
+
const suffix = instanceId.slice(prefix.length);
|
|
14
|
+
if (!/^\d+$/.test(suffix)) return -1;
|
|
15
|
+
return Number(suffix);
|
|
16
|
+
}
|
|
17
|
+
function resolveCurrentSyncInstanceId(accountId, recordedInstanceId) {
|
|
18
|
+
return recordedInstanceId ?? accountId;
|
|
19
|
+
}
|
|
20
|
+
function isSupersededBy(myInstanceId, recordedInstanceId, accountId) {
|
|
21
|
+
if (recordedInstanceId == null) return false;
|
|
22
|
+
return parseInstanceWindow(recordedInstanceId, accountId) > parseInstanceWindow(myInstanceId, accountId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function normalizeBudget(value) {
|
|
26
|
+
if (!Number.isFinite(value) || value < 1) return void 0;
|
|
27
|
+
return Math.floor(value);
|
|
28
|
+
}
|
|
29
|
+
function parseIterationBudgetParam(value) {
|
|
30
|
+
return normalizeBudget(Number(value?.trim() || Number.NaN));
|
|
31
|
+
}
|
|
32
|
+
function resolveIterationBudget(maxIterations) {
|
|
33
|
+
if (maxIterations == null) return Number.POSITIVE_INFINITY;
|
|
34
|
+
return normalizeBudget(maxIterations) ?? Number.POSITIVE_INFINITY;
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
const createPaymentCommand = (db, { payment }) => {
|
|
11
38
|
return {
|
|
12
39
|
command: db.insert(tables.payment).values({
|
|
@@ -359,4 +386,4 @@ const initiateConnector = async ({
|
|
|
359
386
|
}
|
|
360
387
|
};
|
|
361
388
|
|
|
362
|
-
export { getPaymentRequestsByBatchIdQuery as a, getAccountByIdQuery as b, checksum as c, createCredentialsResolver as d, updatePaymentRequestStatusCommand as e,
|
|
389
|
+
export { getPaymentRequestsByBatchIdQuery as a, getAccountByIdQuery as b, checksum as c, createCredentialsResolver as d, updatePaymentRequestStatusCommand as e, isSupersededBy as f, getBatchByIdQuery as g, createPaymentCommand as h, initiateConnector as i, encrypt as j, resolveCurrentSyncInstanceId as k, importAesKey as l, parseIterationBudgetParam as p, resolveIterationBudget as r, 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.CefGTNH1.mjs';
|
|
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.CefGTNH1.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.CefGTNH1.cjs';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.CtIkqQG9.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.CtIkqQG9.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.CefGTNH1.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.CefGTNH1.mjs';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.oNDZ44du.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.oNDZ44du.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.CefGTNH1.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.CefGTNH1.js';
|
|
3
|
+
import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BOeuHdjy.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.BOeuHdjy.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';
|