@develit-services/bank 0.3.45 → 0.3.47
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/database/schema.cjs +1 -1
- 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/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +92 -57
- package/dist/export/worker.d.cts +15 -7
- package/dist/export/worker.d.mts +15 -7
- package/dist/export/worker.d.ts +15 -7
- package/dist/export/worker.mjs +92 -57
- package/dist/export/workflows.cjs +4 -4
- package/dist/export/workflows.mjs +4 -4
- package/dist/shared/{bank.CpwLFudl.cjs → bank.BfBw79Y1.cjs} +0 -1
- package/dist/shared/{bank.BEL1HIxZ.d.cts → bank.CF4oNDZH.d.cts} +4 -4
- package/dist/shared/{bank.BEL1HIxZ.d.mts → bank.CF4oNDZH.d.mts} +4 -4
- package/dist/shared/{bank.BEL1HIxZ.d.ts → bank.CF4oNDZH.d.ts} +4 -4
- package/dist/shared/{bank.D0a-MZon.cjs → bank.CwRMB9Ek.cjs} +2 -2
- package/dist/shared/{bank.B1Gpn3ht.mjs → bank.D7JSg_d9.mjs} +1 -1
- package/dist/shared/{bank.CPYfE-Ei.cjs → bank.DXj5tpXa.cjs} +1 -1
- package/dist/shared/{bank.BUEmFxS8.mjs → bank.DYJuicD-.mjs} +2 -2
- package/dist/shared/{bank.D-3fzX63.mjs → bank.m2X4FSvr.mjs} +0 -1
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CF4oNDZH.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'drizzle-zod';
|
|
4
4
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CF4oNDZH.mjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'drizzle-zod';
|
|
4
4
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CF4oNDZH.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'drizzle-zod';
|
|
4
4
|
import 'drizzle-orm/sqlite-core';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { t as account, u as accountCredentials, n as batch, r as ott, p as payment, q as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { t as account, u as accountCredentials, n as batch, r as ott, p as payment, q as paymentRelations } from '../shared/bank.m2X4FSvr.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import 'date-fns';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const cloudflare_workers = require('cloudflare:workers');
|
|
5
5
|
const d1 = require('drizzle-orm/d1');
|
|
6
|
-
const drizzle = require('../shared/bank.
|
|
6
|
+
const drizzle = require('../shared/bank.DXj5tpXa.cjs');
|
|
7
7
|
const zod = require('zod');
|
|
8
|
-
const database_schema = require('../shared/bank.
|
|
8
|
+
const database_schema = require('../shared/bank.BfBw79Y1.cjs');
|
|
9
9
|
const generalCodes = require('@develit-io/general-codes');
|
|
10
10
|
require('date-fns');
|
|
11
11
|
const drizzleOrm = require('drizzle-orm');
|
|
12
12
|
require('jose');
|
|
13
13
|
require('node:crypto');
|
|
14
|
-
const encryption = require('../shared/bank.
|
|
14
|
+
const encryption = require('../shared/bank.CwRMB9Ek.cjs');
|
|
15
15
|
require('drizzle-orm/sqlite-core');
|
|
16
16
|
require('drizzle-orm/relations');
|
|
17
17
|
require('drizzle-zod');
|
|
@@ -260,7 +260,9 @@ const getAuthUriInputSchema = zod.z.object({
|
|
|
260
260
|
|
|
261
261
|
const authorizeAccountInputSchema = zod.z.object({
|
|
262
262
|
ott: zod.z.string(),
|
|
263
|
-
urlParams: zod.z.string()
|
|
263
|
+
urlParams: zod.z.string(),
|
|
264
|
+
syncIntervalS: zod.z.number().int().positive().optional(),
|
|
265
|
+
startSync: zod.z.boolean().optional()
|
|
264
266
|
});
|
|
265
267
|
|
|
266
268
|
const simulateDepositInputSchema = zod.z.object({
|
|
@@ -314,6 +316,14 @@ zod.z.object({
|
|
|
314
316
|
details: backendSdk.workflowInstanceStatusSchema
|
|
315
317
|
});
|
|
316
318
|
|
|
319
|
+
const updateBatchStatusesInputSchema = zod.z.object({
|
|
320
|
+
batchId: zod.z.uuid().optional()
|
|
321
|
+
}).optional();
|
|
322
|
+
zod.z.object({
|
|
323
|
+
processed: zod.z.number(),
|
|
324
|
+
statusChanged: zod.z.number()
|
|
325
|
+
});
|
|
326
|
+
|
|
317
327
|
const ALLOWED_PAYMENT_FILTERS = {
|
|
318
328
|
ACCOUNT_ID: "filterPaymentAccountId",
|
|
319
329
|
AMOUNT: "filterPaymentAmount",
|
|
@@ -564,60 +574,72 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
564
574
|
};
|
|
565
575
|
}
|
|
566
576
|
async updateBatchStatuses(input) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
this.
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
batch
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
577
|
+
return this.handleAction(
|
|
578
|
+
{ data: input, schema: updateBatchStatusesInputSchema },
|
|
579
|
+
{ successMessage: "Batch statuses updated" },
|
|
580
|
+
async (validatedInput) => {
|
|
581
|
+
let pendingBatches;
|
|
582
|
+
if (validatedInput?.batchId) {
|
|
583
|
+
const batch = await encryption.getBatchByIdQuery(this.db, {
|
|
584
|
+
batchId: validatedInput.batchId
|
|
585
|
+
});
|
|
586
|
+
if (!batch) {
|
|
587
|
+
throw backendSdk.createInternalError(null, {
|
|
588
|
+
message: `Batch not found: ${validatedInput.batchId}`,
|
|
589
|
+
code: "DB-B-007",
|
|
590
|
+
status: 404
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
pendingBatches = [batch];
|
|
594
|
+
} else {
|
|
595
|
+
pendingBatches = await getAllPendingBatchesQuery(this.db);
|
|
596
|
+
}
|
|
597
|
+
const accounts = await this._getConnectedAccounts();
|
|
598
|
+
console.log(`Processing ${pendingBatches.length} pending batche(s)`);
|
|
599
|
+
const batchesByConnector = /* @__PURE__ */ new Map();
|
|
600
|
+
for (const batch of pendingBatches) {
|
|
601
|
+
const account = accounts.find((acc) => acc.id === batch.accountId);
|
|
602
|
+
if (!account) {
|
|
603
|
+
this.logError({
|
|
604
|
+
message: `Account not found for batch ${batch.id}, skipping`
|
|
605
|
+
});
|
|
606
|
+
await encryption.upsertBatchCommand(this.db, {
|
|
607
|
+
batch: {
|
|
608
|
+
...batch,
|
|
609
|
+
status: "FAILED",
|
|
610
|
+
statusReason: "ACCOUNT_NOT_FOUND"
|
|
611
|
+
}
|
|
612
|
+
}).command.execute();
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
const batches = batchesByConnector.get(account.connectorKey) || [];
|
|
616
|
+
batches.push(batch);
|
|
617
|
+
batchesByConnector.set(account.connectorKey, batches);
|
|
618
|
+
}
|
|
619
|
+
const allResults = [];
|
|
620
|
+
for (const [connectorKey, batches] of batchesByConnector) {
|
|
621
|
+
console.log(
|
|
622
|
+
`Initializing ${connectorKey} connector for ${batches.length} batches`
|
|
623
|
+
);
|
|
624
|
+
const connector = await this._initiateBankConnector({
|
|
625
|
+
connectorKey
|
|
626
|
+
});
|
|
627
|
+
for (const batch of batches) {
|
|
628
|
+
const result = await this._resolveSingleBatch(batch, connector);
|
|
629
|
+
if (result) {
|
|
630
|
+
allResults.push(result);
|
|
631
|
+
}
|
|
595
632
|
}
|
|
596
|
-
}).command.execute();
|
|
597
|
-
continue;
|
|
598
|
-
}
|
|
599
|
-
const batches = batchesByConnector.get(account.connectorKey) || [];
|
|
600
|
-
batches.push(batch);
|
|
601
|
-
batchesByConnector.set(account.connectorKey, batches);
|
|
602
|
-
}
|
|
603
|
-
const allResults = [];
|
|
604
|
-
for (const [connectorKey, batches] of batchesByConnector) {
|
|
605
|
-
console.log(
|
|
606
|
-
`Initializing ${connectorKey} connector for ${batches.length} batches`
|
|
607
|
-
);
|
|
608
|
-
const connector = await this._initiateBankConnector({
|
|
609
|
-
connectorKey
|
|
610
|
-
});
|
|
611
|
-
for (const batch of batches) {
|
|
612
|
-
const result = await this._resolveSingleBatch(batch, connector);
|
|
613
|
-
if (result) {
|
|
614
|
-
allResults.push(result);
|
|
615
633
|
}
|
|
634
|
+
const changedCount = allResults.filter((r) => r.statusChanged).length;
|
|
635
|
+
console.log(
|
|
636
|
+
`Batch update completed: ${changedCount} status change(s) detected`
|
|
637
|
+
);
|
|
638
|
+
return {
|
|
639
|
+
processed: allResults.length,
|
|
640
|
+
statusChanged: changedCount
|
|
641
|
+
};
|
|
616
642
|
}
|
|
617
|
-
}
|
|
618
|
-
const changedCount = allResults.filter((r) => r.statusChanged).length;
|
|
619
|
-
console.log(
|
|
620
|
-
`Batch update completed: ${changedCount} status change(s) detected.`
|
|
621
643
|
);
|
|
622
644
|
}
|
|
623
645
|
async addPaymentsToBatch({
|
|
@@ -802,7 +824,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
802
824
|
return this.handleAction(
|
|
803
825
|
{ data: input, schema: authorizeAccountInputSchema },
|
|
804
826
|
{ successMessage: "Erste code saved." },
|
|
805
|
-
async ({ ott, urlParams }) => {
|
|
827
|
+
async ({ ott, urlParams, syncIntervalS, startSync }) => {
|
|
806
828
|
const ottRow = await getOttQuery(this.db, {
|
|
807
829
|
ott
|
|
808
830
|
});
|
|
@@ -832,7 +854,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
832
854
|
);
|
|
833
855
|
const upsertAccounts = accounts.map(
|
|
834
856
|
(acc) => upsertAccountCommand(this.db, {
|
|
835
|
-
account: acc
|
|
857
|
+
account: syncIntervalS ? { ...acc, syncIntervalS } : acc
|
|
836
858
|
}).command
|
|
837
859
|
);
|
|
838
860
|
const deleteCredentials = alreadyExistingAccounts.map(
|
|
@@ -864,6 +886,19 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
864
886
|
code: "DB-B-003",
|
|
865
887
|
status: 404
|
|
866
888
|
});
|
|
889
|
+
if (startSync) {
|
|
890
|
+
for (const account of fetchedAccounts) {
|
|
891
|
+
const { error } = await this.syncAccount({
|
|
892
|
+
accountId: account.id
|
|
893
|
+
});
|
|
894
|
+
if (error) {
|
|
895
|
+
this.logError({
|
|
896
|
+
message: `Failed to auto-start sync workflow for account ${account.id}`,
|
|
897
|
+
error
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
867
902
|
return {
|
|
868
903
|
accounts: fetchedAccounts
|
|
869
904
|
};
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.
|
|
1
|
+
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CF4oNDZH.cjs';
|
|
2
2
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
@@ -772,6 +772,8 @@ type GetAuthUriOutput = {
|
|
|
772
772
|
declare const authorizeAccountInputSchema: z.ZodObject<{
|
|
773
773
|
ott: z.ZodString;
|
|
774
774
|
urlParams: z.ZodString;
|
|
775
|
+
syncIntervalS: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
startSync: z.ZodOptional<z.ZodBoolean>;
|
|
775
777
|
}, z.core.$strip>;
|
|
776
778
|
interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
|
|
777
779
|
}
|
|
@@ -1530,7 +1532,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1530
1532
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
1531
1533
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
1532
1534
|
OPEN: "OPEN";
|
|
1533
|
-
FULL: "FULL";
|
|
1534
1535
|
PROCESSING: "PROCESSING";
|
|
1535
1536
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1536
1537
|
SIGNED: "SIGNED";
|
|
@@ -1538,7 +1539,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1538
1539
|
FAILED: "FAILED";
|
|
1539
1540
|
}>, z.ZodArray<z.ZodEnum<{
|
|
1540
1541
|
OPEN: "OPEN";
|
|
1541
|
-
FULL: "FULL";
|
|
1542
1542
|
PROCESSING: "PROCESSING";
|
|
1543
1543
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1544
1544
|
SIGNED: "SIGNED";
|
|
@@ -1642,6 +1642,16 @@ interface ProcessBatchRestartInput extends z.infer<typeof processBatchRestartInp
|
|
|
1642
1642
|
}
|
|
1643
1643
|
type ProcessBatchRestartOutput = z.infer<typeof processBatchRestartOutputSchema>;
|
|
1644
1644
|
|
|
1645
|
+
declare const updateBatchStatusesInputSchema: z.ZodOptional<z.ZodObject<{
|
|
1646
|
+
batchId: z.ZodOptional<z.ZodUUID>;
|
|
1647
|
+
}, z.core.$strip>>;
|
|
1648
|
+
declare const updateBatchStatusesOutputSchema: z.ZodObject<{
|
|
1649
|
+
processed: z.ZodNumber;
|
|
1650
|
+
statusChanged: z.ZodNumber;
|
|
1651
|
+
}, z.core.$strip>;
|
|
1652
|
+
type UpdateBatchStatusesInput = z.infer<typeof updateBatchStatusesInputSchema>;
|
|
1653
|
+
type UpdateBatchStatusesOutput = z.infer<typeof updateBatchStatusesOutputSchema>;
|
|
1654
|
+
|
|
1645
1655
|
declare const getPaymentsInputSchema: z.ZodObject<{
|
|
1646
1656
|
page: z.ZodNumber;
|
|
1647
1657
|
limit: z.ZodNumber;
|
|
@@ -2483,13 +2493,11 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2483
2493
|
currentStatus: string;
|
|
2484
2494
|
statusChanged: boolean;
|
|
2485
2495
|
} | null>;
|
|
2486
|
-
updateBatchStatuses(input?:
|
|
2487
|
-
batchId?: string;
|
|
2488
|
-
}): Promise<void>;
|
|
2496
|
+
updateBatchStatuses(input?: UpdateBatchStatusesInput): Promise<IRPCResponse<UpdateBatchStatusesOutput>>;
|
|
2489
2497
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
2490
2498
|
paymentsToBatch: SendPaymentInput[];
|
|
2491
2499
|
}): Promise<IRPCResponse<{
|
|
2492
|
-
status: "OPEN" | "
|
|
2500
|
+
status: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | null;
|
|
2493
2501
|
id: string;
|
|
2494
2502
|
createdAt: Date | null;
|
|
2495
2503
|
updatedAt: Date | null;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.
|
|
1
|
+
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CF4oNDZH.mjs';
|
|
2
2
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
@@ -772,6 +772,8 @@ type GetAuthUriOutput = {
|
|
|
772
772
|
declare const authorizeAccountInputSchema: z.ZodObject<{
|
|
773
773
|
ott: z.ZodString;
|
|
774
774
|
urlParams: z.ZodString;
|
|
775
|
+
syncIntervalS: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
startSync: z.ZodOptional<z.ZodBoolean>;
|
|
775
777
|
}, z.core.$strip>;
|
|
776
778
|
interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
|
|
777
779
|
}
|
|
@@ -1530,7 +1532,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1530
1532
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
1531
1533
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
1532
1534
|
OPEN: "OPEN";
|
|
1533
|
-
FULL: "FULL";
|
|
1534
1535
|
PROCESSING: "PROCESSING";
|
|
1535
1536
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1536
1537
|
SIGNED: "SIGNED";
|
|
@@ -1538,7 +1539,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1538
1539
|
FAILED: "FAILED";
|
|
1539
1540
|
}>, z.ZodArray<z.ZodEnum<{
|
|
1540
1541
|
OPEN: "OPEN";
|
|
1541
|
-
FULL: "FULL";
|
|
1542
1542
|
PROCESSING: "PROCESSING";
|
|
1543
1543
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1544
1544
|
SIGNED: "SIGNED";
|
|
@@ -1642,6 +1642,16 @@ interface ProcessBatchRestartInput extends z.infer<typeof processBatchRestartInp
|
|
|
1642
1642
|
}
|
|
1643
1643
|
type ProcessBatchRestartOutput = z.infer<typeof processBatchRestartOutputSchema>;
|
|
1644
1644
|
|
|
1645
|
+
declare const updateBatchStatusesInputSchema: z.ZodOptional<z.ZodObject<{
|
|
1646
|
+
batchId: z.ZodOptional<z.ZodUUID>;
|
|
1647
|
+
}, z.core.$strip>>;
|
|
1648
|
+
declare const updateBatchStatusesOutputSchema: z.ZodObject<{
|
|
1649
|
+
processed: z.ZodNumber;
|
|
1650
|
+
statusChanged: z.ZodNumber;
|
|
1651
|
+
}, z.core.$strip>;
|
|
1652
|
+
type UpdateBatchStatusesInput = z.infer<typeof updateBatchStatusesInputSchema>;
|
|
1653
|
+
type UpdateBatchStatusesOutput = z.infer<typeof updateBatchStatusesOutputSchema>;
|
|
1654
|
+
|
|
1645
1655
|
declare const getPaymentsInputSchema: z.ZodObject<{
|
|
1646
1656
|
page: z.ZodNumber;
|
|
1647
1657
|
limit: z.ZodNumber;
|
|
@@ -2483,13 +2493,11 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2483
2493
|
currentStatus: string;
|
|
2484
2494
|
statusChanged: boolean;
|
|
2485
2495
|
} | null>;
|
|
2486
|
-
updateBatchStatuses(input?:
|
|
2487
|
-
batchId?: string;
|
|
2488
|
-
}): Promise<void>;
|
|
2496
|
+
updateBatchStatuses(input?: UpdateBatchStatusesInput): Promise<IRPCResponse<UpdateBatchStatusesOutput>>;
|
|
2489
2497
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
2490
2498
|
paymentsToBatch: SendPaymentInput[];
|
|
2491
2499
|
}): Promise<IRPCResponse<{
|
|
2492
|
-
status: "OPEN" | "
|
|
2500
|
+
status: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | null;
|
|
2493
2501
|
id: string;
|
|
2494
2502
|
createdAt: Date | null;
|
|
2495
2503
|
updatedAt: Date | null;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.
|
|
1
|
+
import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CF4oNDZH.js';
|
|
2
2
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
@@ -772,6 +772,8 @@ type GetAuthUriOutput = {
|
|
|
772
772
|
declare const authorizeAccountInputSchema: z.ZodObject<{
|
|
773
773
|
ott: z.ZodString;
|
|
774
774
|
urlParams: z.ZodString;
|
|
775
|
+
syncIntervalS: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
startSync: z.ZodOptional<z.ZodBoolean>;
|
|
775
777
|
}, z.core.$strip>;
|
|
776
778
|
interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
|
|
777
779
|
}
|
|
@@ -1530,7 +1532,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1530
1532
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
1531
1533
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
1532
1534
|
OPEN: "OPEN";
|
|
1533
|
-
FULL: "FULL";
|
|
1534
1535
|
PROCESSING: "PROCESSING";
|
|
1535
1536
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1536
1537
|
SIGNED: "SIGNED";
|
|
@@ -1538,7 +1539,6 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1538
1539
|
FAILED: "FAILED";
|
|
1539
1540
|
}>, z.ZodArray<z.ZodEnum<{
|
|
1540
1541
|
OPEN: "OPEN";
|
|
1541
|
-
FULL: "FULL";
|
|
1542
1542
|
PROCESSING: "PROCESSING";
|
|
1543
1543
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
1544
1544
|
SIGNED: "SIGNED";
|
|
@@ -1642,6 +1642,16 @@ interface ProcessBatchRestartInput extends z.infer<typeof processBatchRestartInp
|
|
|
1642
1642
|
}
|
|
1643
1643
|
type ProcessBatchRestartOutput = z.infer<typeof processBatchRestartOutputSchema>;
|
|
1644
1644
|
|
|
1645
|
+
declare const updateBatchStatusesInputSchema: z.ZodOptional<z.ZodObject<{
|
|
1646
|
+
batchId: z.ZodOptional<z.ZodUUID>;
|
|
1647
|
+
}, z.core.$strip>>;
|
|
1648
|
+
declare const updateBatchStatusesOutputSchema: z.ZodObject<{
|
|
1649
|
+
processed: z.ZodNumber;
|
|
1650
|
+
statusChanged: z.ZodNumber;
|
|
1651
|
+
}, z.core.$strip>;
|
|
1652
|
+
type UpdateBatchStatusesInput = z.infer<typeof updateBatchStatusesInputSchema>;
|
|
1653
|
+
type UpdateBatchStatusesOutput = z.infer<typeof updateBatchStatusesOutputSchema>;
|
|
1654
|
+
|
|
1645
1655
|
declare const getPaymentsInputSchema: z.ZodObject<{
|
|
1646
1656
|
page: z.ZodNumber;
|
|
1647
1657
|
limit: z.ZodNumber;
|
|
@@ -2483,13 +2493,11 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2483
2493
|
currentStatus: string;
|
|
2484
2494
|
statusChanged: boolean;
|
|
2485
2495
|
} | null>;
|
|
2486
|
-
updateBatchStatuses(input?:
|
|
2487
|
-
batchId?: string;
|
|
2488
|
-
}): Promise<void>;
|
|
2496
|
+
updateBatchStatuses(input?: UpdateBatchStatusesInput): Promise<IRPCResponse<UpdateBatchStatusesOutput>>;
|
|
2489
2497
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
2490
2498
|
paymentsToBatch: SendPaymentInput[];
|
|
2491
2499
|
}): Promise<IRPCResponse<{
|
|
2492
|
-
status: "OPEN" | "
|
|
2500
|
+
status: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | null;
|
|
2493
2501
|
id: string;
|
|
2494
2502
|
createdAt: Date | null;
|
|
2495
2503
|
updatedAt: Date | null;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { uuidv4, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, first, action, service } from '@develit-io/backend-sdk';
|
|
2
2
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
3
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
-
import { t as tables } from '../shared/bank.
|
|
4
|
+
import { t as tables } from '../shared/bank.D7JSg_d9.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, d as CONNECTOR_KEYS, B as BATCH_STATUSES, a as PAYMENT_STATUSES, b as PAYMENT_DIRECTIONS, f as accountInsertSchema } from '../shared/bank.
|
|
6
|
+
import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, d as CONNECTOR_KEYS, B as BATCH_STATUSES, a as PAYMENT_STATUSES, b as PAYMENT_DIRECTIONS, f as accountInsertSchema } from '../shared/bank.m2X4FSvr.mjs';
|
|
7
7
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
8
8
|
import 'date-fns';
|
|
9
9
|
import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
|
|
10
10
|
import 'jose';
|
|
11
11
|
import 'node:crypto';
|
|
12
|
-
import { f as encrypt, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, d as getBatchByIdQuery, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.
|
|
12
|
+
import { f as encrypt, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, d as getBatchByIdQuery, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.DYJuicD-.mjs';
|
|
13
13
|
import 'drizzle-orm/sqlite-core';
|
|
14
14
|
import 'drizzle-orm/relations';
|
|
15
15
|
import 'drizzle-zod';
|
|
@@ -258,7 +258,9 @@ const getAuthUriInputSchema = z.object({
|
|
|
258
258
|
|
|
259
259
|
const authorizeAccountInputSchema = z.object({
|
|
260
260
|
ott: z.string(),
|
|
261
|
-
urlParams: z.string()
|
|
261
|
+
urlParams: z.string(),
|
|
262
|
+
syncIntervalS: z.number().int().positive().optional(),
|
|
263
|
+
startSync: z.boolean().optional()
|
|
262
264
|
});
|
|
263
265
|
|
|
264
266
|
const simulateDepositInputSchema = z.object({
|
|
@@ -312,6 +314,14 @@ z.object({
|
|
|
312
314
|
details: workflowInstanceStatusSchema
|
|
313
315
|
});
|
|
314
316
|
|
|
317
|
+
const updateBatchStatusesInputSchema = z.object({
|
|
318
|
+
batchId: z.uuid().optional()
|
|
319
|
+
}).optional();
|
|
320
|
+
z.object({
|
|
321
|
+
processed: z.number(),
|
|
322
|
+
statusChanged: z.number()
|
|
323
|
+
});
|
|
324
|
+
|
|
315
325
|
const ALLOWED_PAYMENT_FILTERS = {
|
|
316
326
|
ACCOUNT_ID: "filterPaymentAccountId",
|
|
317
327
|
AMOUNT: "filterPaymentAmount",
|
|
@@ -562,60 +572,72 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
562
572
|
};
|
|
563
573
|
}
|
|
564
574
|
async updateBatchStatuses(input) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
this.
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
batch
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
575
|
+
return this.handleAction(
|
|
576
|
+
{ data: input, schema: updateBatchStatusesInputSchema },
|
|
577
|
+
{ successMessage: "Batch statuses updated" },
|
|
578
|
+
async (validatedInput) => {
|
|
579
|
+
let pendingBatches;
|
|
580
|
+
if (validatedInput?.batchId) {
|
|
581
|
+
const batch = await getBatchByIdQuery(this.db, {
|
|
582
|
+
batchId: validatedInput.batchId
|
|
583
|
+
});
|
|
584
|
+
if (!batch) {
|
|
585
|
+
throw createInternalError(null, {
|
|
586
|
+
message: `Batch not found: ${validatedInput.batchId}`,
|
|
587
|
+
code: "DB-B-007",
|
|
588
|
+
status: 404
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
pendingBatches = [batch];
|
|
592
|
+
} else {
|
|
593
|
+
pendingBatches = await getAllPendingBatchesQuery(this.db);
|
|
594
|
+
}
|
|
595
|
+
const accounts = await this._getConnectedAccounts();
|
|
596
|
+
console.log(`Processing ${pendingBatches.length} pending batche(s)`);
|
|
597
|
+
const batchesByConnector = /* @__PURE__ */ new Map();
|
|
598
|
+
for (const batch of pendingBatches) {
|
|
599
|
+
const account = accounts.find((acc) => acc.id === batch.accountId);
|
|
600
|
+
if (!account) {
|
|
601
|
+
this.logError({
|
|
602
|
+
message: `Account not found for batch ${batch.id}, skipping`
|
|
603
|
+
});
|
|
604
|
+
await upsertBatchCommand(this.db, {
|
|
605
|
+
batch: {
|
|
606
|
+
...batch,
|
|
607
|
+
status: "FAILED",
|
|
608
|
+
statusReason: "ACCOUNT_NOT_FOUND"
|
|
609
|
+
}
|
|
610
|
+
}).command.execute();
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
const batches = batchesByConnector.get(account.connectorKey) || [];
|
|
614
|
+
batches.push(batch);
|
|
615
|
+
batchesByConnector.set(account.connectorKey, batches);
|
|
616
|
+
}
|
|
617
|
+
const allResults = [];
|
|
618
|
+
for (const [connectorKey, batches] of batchesByConnector) {
|
|
619
|
+
console.log(
|
|
620
|
+
`Initializing ${connectorKey} connector for ${batches.length} batches`
|
|
621
|
+
);
|
|
622
|
+
const connector = await this._initiateBankConnector({
|
|
623
|
+
connectorKey
|
|
624
|
+
});
|
|
625
|
+
for (const batch of batches) {
|
|
626
|
+
const result = await this._resolveSingleBatch(batch, connector);
|
|
627
|
+
if (result) {
|
|
628
|
+
allResults.push(result);
|
|
629
|
+
}
|
|
593
630
|
}
|
|
594
|
-
}).command.execute();
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
const batches = batchesByConnector.get(account.connectorKey) || [];
|
|
598
|
-
batches.push(batch);
|
|
599
|
-
batchesByConnector.set(account.connectorKey, batches);
|
|
600
|
-
}
|
|
601
|
-
const allResults = [];
|
|
602
|
-
for (const [connectorKey, batches] of batchesByConnector) {
|
|
603
|
-
console.log(
|
|
604
|
-
`Initializing ${connectorKey} connector for ${batches.length} batches`
|
|
605
|
-
);
|
|
606
|
-
const connector = await this._initiateBankConnector({
|
|
607
|
-
connectorKey
|
|
608
|
-
});
|
|
609
|
-
for (const batch of batches) {
|
|
610
|
-
const result = await this._resolveSingleBatch(batch, connector);
|
|
611
|
-
if (result) {
|
|
612
|
-
allResults.push(result);
|
|
613
631
|
}
|
|
632
|
+
const changedCount = allResults.filter((r) => r.statusChanged).length;
|
|
633
|
+
console.log(
|
|
634
|
+
`Batch update completed: ${changedCount} status change(s) detected`
|
|
635
|
+
);
|
|
636
|
+
return {
|
|
637
|
+
processed: allResults.length,
|
|
638
|
+
statusChanged: changedCount
|
|
639
|
+
};
|
|
614
640
|
}
|
|
615
|
-
}
|
|
616
|
-
const changedCount = allResults.filter((r) => r.statusChanged).length;
|
|
617
|
-
console.log(
|
|
618
|
-
`Batch update completed: ${changedCount} status change(s) detected.`
|
|
619
641
|
);
|
|
620
642
|
}
|
|
621
643
|
async addPaymentsToBatch({
|
|
@@ -800,7 +822,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
800
822
|
return this.handleAction(
|
|
801
823
|
{ data: input, schema: authorizeAccountInputSchema },
|
|
802
824
|
{ successMessage: "Erste code saved." },
|
|
803
|
-
async ({ ott, urlParams }) => {
|
|
825
|
+
async ({ ott, urlParams, syncIntervalS, startSync }) => {
|
|
804
826
|
const ottRow = await getOttQuery(this.db, {
|
|
805
827
|
ott
|
|
806
828
|
});
|
|
@@ -830,7 +852,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
830
852
|
);
|
|
831
853
|
const upsertAccounts = accounts.map(
|
|
832
854
|
(acc) => upsertAccountCommand(this.db, {
|
|
833
|
-
account: acc
|
|
855
|
+
account: syncIntervalS ? { ...acc, syncIntervalS } : acc
|
|
834
856
|
}).command
|
|
835
857
|
);
|
|
836
858
|
const deleteCredentials = alreadyExistingAccounts.map(
|
|
@@ -862,6 +884,19 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
862
884
|
code: "DB-B-003",
|
|
863
885
|
status: 404
|
|
864
886
|
});
|
|
887
|
+
if (startSync) {
|
|
888
|
+
for (const account of fetchedAccounts) {
|
|
889
|
+
const { error } = await this.syncAccount({
|
|
890
|
+
accountId: account.id
|
|
891
|
+
});
|
|
892
|
+
if (error) {
|
|
893
|
+
this.logError({
|
|
894
|
+
message: `Failed to auto-start sync workflow for account ${account.id}`,
|
|
895
|
+
error
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
865
900
|
return {
|
|
866
901
|
accounts: fetchedAccounts
|
|
867
902
|
};
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
const cloudflare_workers = require('cloudflare:workers');
|
|
4
4
|
const cloudflare_workflows = require('cloudflare:workflows');
|
|
5
5
|
const d1 = require('drizzle-orm/d1');
|
|
6
|
-
const drizzle = require('../shared/bank.
|
|
6
|
+
const drizzle = require('../shared/bank.DXj5tpXa.cjs');
|
|
7
7
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
8
|
-
const encryption = require('../shared/bank.
|
|
8
|
+
const encryption = require('../shared/bank.CwRMB9Ek.cjs');
|
|
9
9
|
const drizzleOrm = require('drizzle-orm');
|
|
10
10
|
require('date-fns');
|
|
11
|
-
require('../shared/bank.
|
|
11
|
+
require('../shared/bank.BfBw79Y1.cjs');
|
|
12
12
|
require('drizzle-orm/sqlite-core');
|
|
13
13
|
require('drizzle-orm/relations');
|
|
14
14
|
require('@develit-io/general-codes');
|
|
@@ -196,7 +196,7 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
196
196
|
throw new cloudflare_workflows.NonRetryableError(
|
|
197
197
|
`Batch is in FAILED status and cannot be processed, manual review needed`
|
|
198
198
|
);
|
|
199
|
-
if (batch.status === "OPEN"
|
|
199
|
+
if (batch.status === "OPEN") {
|
|
200
200
|
const updatedBatch = await encryption.upsertBatchCommand(db, {
|
|
201
201
|
batch: {
|
|
202
202
|
...batch,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
2
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
3
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
-
import { t as tables } from '../shared/bank.
|
|
4
|
+
import { t as tables } from '../shared/bank.D7JSg_d9.mjs';
|
|
5
5
|
import { asNonEmpty, first } from '@develit-io/backend-sdk';
|
|
6
|
-
import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand, d as getBatchByIdQuery, e as checksum, u as upsertBatchCommand } from '../shared/bank.
|
|
6
|
+
import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand, d as getBatchByIdQuery, e as checksum, u as upsertBatchCommand } from '../shared/bank.DYJuicD-.mjs';
|
|
7
7
|
import { eq } from 'drizzle-orm';
|
|
8
8
|
import 'date-fns';
|
|
9
|
-
import '../shared/bank.
|
|
9
|
+
import '../shared/bank.m2X4FSvr.mjs';
|
|
10
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
11
|
import 'drizzle-orm/relations';
|
|
12
12
|
import '@develit-io/general-codes';
|
|
@@ -194,7 +194,7 @@ class BankProcessBatch extends WorkflowEntrypoint {
|
|
|
194
194
|
throw new NonRetryableError(
|
|
195
195
|
`Batch is in FAILED status and cannot be processed, manual review needed`
|
|
196
196
|
);
|
|
197
|
-
if (batch.status === "OPEN"
|
|
197
|
+
if (batch.status === "OPEN") {
|
|
198
198
|
const updatedBatch = await upsertBatchCommand(db, {
|
|
199
199
|
batch: {
|
|
200
200
|
...batch,
|
|
@@ -71,20 +71,20 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
71
71
|
tableName: "batch";
|
|
72
72
|
dataType: "string";
|
|
73
73
|
columnType: "SQLiteText";
|
|
74
|
-
data: "OPEN" | "
|
|
74
|
+
data: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
75
75
|
driverParam: string;
|
|
76
76
|
notNull: false;
|
|
77
77
|
hasDefault: false;
|
|
78
78
|
isPrimaryKey: false;
|
|
79
79
|
isAutoincrement: false;
|
|
80
80
|
hasRuntimeDefault: false;
|
|
81
|
-
enumValues: ["OPEN", "
|
|
81
|
+
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
82
82
|
baseColumn: never;
|
|
83
83
|
identity: undefined;
|
|
84
84
|
generated: undefined;
|
|
85
85
|
}, {}, {
|
|
86
86
|
length: number | undefined;
|
|
87
|
-
$type: "OPEN" | "
|
|
87
|
+
$type: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
88
88
|
}>;
|
|
89
89
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
90
90
|
name: "status_reason";
|
|
@@ -1607,7 +1607,7 @@ type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Batch status constants
|
|
1609
1609
|
*/
|
|
1610
|
-
declare const BATCH_STATUSES: readonly ["OPEN", "
|
|
1610
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
1611
1611
|
/**
|
|
1612
1612
|
* Type definition for batch status
|
|
1613
1613
|
*/
|
|
@@ -71,20 +71,20 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
71
71
|
tableName: "batch";
|
|
72
72
|
dataType: "string";
|
|
73
73
|
columnType: "SQLiteText";
|
|
74
|
-
data: "OPEN" | "
|
|
74
|
+
data: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
75
75
|
driverParam: string;
|
|
76
76
|
notNull: false;
|
|
77
77
|
hasDefault: false;
|
|
78
78
|
isPrimaryKey: false;
|
|
79
79
|
isAutoincrement: false;
|
|
80
80
|
hasRuntimeDefault: false;
|
|
81
|
-
enumValues: ["OPEN", "
|
|
81
|
+
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
82
82
|
baseColumn: never;
|
|
83
83
|
identity: undefined;
|
|
84
84
|
generated: undefined;
|
|
85
85
|
}, {}, {
|
|
86
86
|
length: number | undefined;
|
|
87
|
-
$type: "OPEN" | "
|
|
87
|
+
$type: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
88
88
|
}>;
|
|
89
89
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
90
90
|
name: "status_reason";
|
|
@@ -1607,7 +1607,7 @@ type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Batch status constants
|
|
1609
1609
|
*/
|
|
1610
|
-
declare const BATCH_STATUSES: readonly ["OPEN", "
|
|
1610
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
1611
1611
|
/**
|
|
1612
1612
|
* Type definition for batch status
|
|
1613
1613
|
*/
|
|
@@ -71,20 +71,20 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
71
71
|
tableName: "batch";
|
|
72
72
|
dataType: "string";
|
|
73
73
|
columnType: "SQLiteText";
|
|
74
|
-
data: "OPEN" | "
|
|
74
|
+
data: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
75
75
|
driverParam: string;
|
|
76
76
|
notNull: false;
|
|
77
77
|
hasDefault: false;
|
|
78
78
|
isPrimaryKey: false;
|
|
79
79
|
isAutoincrement: false;
|
|
80
80
|
hasRuntimeDefault: false;
|
|
81
|
-
enumValues: ["OPEN", "
|
|
81
|
+
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
82
82
|
baseColumn: never;
|
|
83
83
|
identity: undefined;
|
|
84
84
|
generated: undefined;
|
|
85
85
|
}, {}, {
|
|
86
86
|
length: number | undefined;
|
|
87
|
-
$type: "OPEN" | "
|
|
87
|
+
$type: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED";
|
|
88
88
|
}>;
|
|
89
89
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
90
90
|
name: "status_reason";
|
|
@@ -1607,7 +1607,7 @@ type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Batch status constants
|
|
1609
1609
|
*/
|
|
1610
|
-
declare const BATCH_STATUSES: readonly ["OPEN", "
|
|
1610
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
1611
1611
|
/**
|
|
1612
1612
|
* Type definition for batch status
|
|
1613
1613
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const drizzle = require('./bank.
|
|
3
|
+
const drizzle = require('./bank.DXj5tpXa.cjs');
|
|
4
4
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
5
5
|
const drizzleOrm = require('drizzle-orm');
|
|
6
6
|
require('date-fns');
|
|
7
7
|
require('jose');
|
|
8
8
|
require('@develit-io/general-codes');
|
|
9
|
-
require('./bank.
|
|
9
|
+
require('./bank.BfBw79Y1.cjs');
|
|
10
10
|
const node_crypto = require('node:crypto');
|
|
11
11
|
|
|
12
12
|
const createPaymentCommand = (db, { payment }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { uuidv4, useResult, createInternalError } from '@develit-io/backend-sdk';
|
|
2
2
|
import { format, parseISO } from 'date-fns';
|
|
3
|
-
import { s as schema } from './bank.
|
|
3
|
+
import { s as schema } from './bank.m2X4FSvr.mjs';
|
|
4
4
|
import { and, eq } from 'drizzle-orm';
|
|
5
5
|
import { importPKCS8, SignJWT } from 'jose';
|
|
6
6
|
import '@develit-io/general-codes';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const dateFns = require('date-fns');
|
|
5
|
-
const database_schema = require('./bank.
|
|
5
|
+
const database_schema = require('./bank.BfBw79Y1.cjs');
|
|
6
6
|
const drizzleOrm = require('drizzle-orm');
|
|
7
7
|
const jose = require('jose');
|
|
8
8
|
require('@develit-io/general-codes');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector } from './bank.
|
|
1
|
+
import { t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector } from './bank.D7JSg_d9.mjs';
|
|
2
2
|
import { uuidv4 } from '@develit-io/backend-sdk';
|
|
3
3
|
import { eq } from 'drizzle-orm';
|
|
4
4
|
import 'date-fns';
|
|
5
5
|
import 'jose';
|
|
6
6
|
import '@develit-io/general-codes';
|
|
7
|
-
import './bank.
|
|
7
|
+
import './bank.m2X4FSvr.mjs';
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
9
|
|
|
10
10
|
const createPaymentCommand = (db, { payment }) => {
|
package/dist/types.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const drizzle = require('./shared/bank.
|
|
4
|
-
const database_schema = require('./shared/bank.
|
|
3
|
+
const drizzle = require('./shared/bank.DXj5tpXa.cjs');
|
|
4
|
+
const database_schema = require('./shared/bank.BfBw79Y1.cjs');
|
|
5
5
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
6
|
require('@develit-io/backend-sdk');
|
|
7
7
|
require('date-fns');
|
package/dist/types.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.
|
|
2
|
-
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CF4oNDZH.cjs';
|
|
2
|
+
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CF4oNDZH.cjs';
|
|
3
3
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.cjs';
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.
|
|
2
|
-
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CF4oNDZH.mjs';
|
|
2
|
+
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CF4oNDZH.mjs';
|
|
3
3
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.mjs';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.
|
|
2
|
-
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CF4oNDZH.js';
|
|
2
|
+
export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CF4oNDZH.js';
|
|
3
3
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.js';
|
package/dist/types.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, a as MockCobsConnector, M as MockConnector, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.
|
|
2
|
-
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, d as CONNECTOR_KEYS, c as COUNTRY_CODES, e as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, b as PAYMENT_DIRECTIONS, a as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, i as accountCredentialsInsertSchema, k as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, f as accountInsertSchema, h as accountSelectSchema, g as accountUpdateSchema, o as ottInsertSchema, m as ottSelectSchema, l as ottUpdateSchema } from './shared/bank.
|
|
1
|
+
export { E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, a as MockCobsConnector, M as MockConnector, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.D7JSg_d9.mjs';
|
|
2
|
+
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, d as CONNECTOR_KEYS, c as COUNTRY_CODES, e as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, b as PAYMENT_DIRECTIONS, a as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, i as accountCredentialsInsertSchema, k as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, f as accountInsertSchema, h as accountSelectSchema, g as accountUpdateSchema, o as ottInsertSchema, m as ottSelectSchema, l as ottUpdateSchema } from './shared/bank.m2X4FSvr.mjs';
|
|
3
3
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
5
5
|
import 'date-fns';
|