@develit-services/bank 0.7.8 → 0.7.9

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.
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const payment_schema = require('../shared/bank.DgGri2Wr.cjs');
3
+ const payment_schema = require('../shared/bank.IVhZ_RlH.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/relations');
6
6
  require('drizzle-orm/sqlite-core');
7
7
  require('date-fns');
8
- require('@develit-io/general-codes');
9
8
  require('jose');
9
+ require('@develit-io/general-codes');
10
10
  require('drizzle-orm');
11
11
  require('node:crypto');
12
12
  require('drizzle-zod');
@@ -1,7 +1,7 @@
1
- export { ao as account, ap as accountCredentials, aq as batch, ar as ott, as as payment, at as paymentRelations } from '../shared/bank.Vm9IO_UH.cjs';
1
+ export { aq as account, ar as accountCredentials, as as batch, at as ott, au as payment, av as paymentRelations } from '../shared/bank.BJ7LqYtJ.cjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
5
+ import '@develit-io/general-codes';
5
6
  import 'drizzle-zod';
6
7
  import 'zod';
7
- import '@develit-io/general-codes';
@@ -1,7 +1,7 @@
1
- export { ao as account, ap as accountCredentials, aq as batch, ar as ott, as as payment, at as paymentRelations } from '../shared/bank.Vm9IO_UH.mjs';
1
+ export { aq as account, ar as accountCredentials, as as batch, at as ott, au as payment, av as paymentRelations } from '../shared/bank.BJ7LqYtJ.mjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
5
+ import '@develit-io/general-codes';
5
6
  import 'drizzle-zod';
6
7
  import 'zod';
7
- import '@develit-io/general-codes';
@@ -1,7 +1,7 @@
1
- export { ao as account, ap as accountCredentials, aq as batch, ar as ott, as as payment, at as paymentRelations } from '../shared/bank.Vm9IO_UH.js';
1
+ export { aq as account, ar as accountCredentials, as as batch, at as ott, au as payment, av as paymentRelations } from '../shared/bank.BJ7LqYtJ.js';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
5
+ import '@develit-io/general-codes';
5
6
  import 'drizzle-zod';
6
7
  import 'zod';
7
- import '@develit-io/general-codes';
@@ -1,10 +1,10 @@
1
- export { n as account, p as accountCredentials, q as batch, r as ott, s as payment, t as paymentRelations } from '../shared/bank.PB07ttj3.mjs';
1
+ export { n as account, p as accountCredentials, q as batch, r as ott, s as payment, t as paymentRelations } from '../shared/bank.993UA65l.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/relations';
4
4
  import 'drizzle-orm/sqlite-core';
5
5
  import 'date-fns';
6
- import '@develit-io/general-codes';
7
6
  import 'jose';
7
+ import '@develit-io/general-codes';
8
8
  import 'drizzle-orm';
9
9
  import 'node:crypto';
10
10
  import 'drizzle-zod';
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const drizzle = require('../shared/bank.AEdMloQz.cjs');
4
+ const drizzle = require('../shared/bank.Bs7mkXbR.cjs');
5
5
  const cloudflare_workers = require('cloudflare:workers');
6
6
  const d1 = require('drizzle-orm/d1');
7
7
  const zod = require('zod');
8
- const payment_schema = require('../shared/bank.DgGri2Wr.cjs');
8
+ const payment_schema = require('../shared/bank.IVhZ_RlH.cjs');
9
9
  const generalCodes = require('@develit-io/general-codes');
10
10
  require('date-fns');
11
11
  require('jose');
12
12
  const drizzleOrm = require('drizzle-orm');
13
13
  require('node:crypto');
14
- const mock_connector = require('../shared/bank.kYaMR0UG.cjs');
15
- require('../shared/bank.Bz8-M6O4.cjs');
14
+ const mock_connector = require('../shared/bank.Bbpgmcv1.cjs');
15
+ require('../shared/bank.Cp0yvOdq.cjs');
16
16
  require('drizzle-orm/relations');
17
17
  require('drizzle-orm/sqlite-core');
18
18
  require('drizzle-zod');
@@ -470,49 +470,24 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
470
470
  });
471
471
  }
472
472
  let connectedAccounts = [];
473
+ let resolveCredentials;
473
474
  if (!skipAccounts) {
474
- const encryptionKey = await drizzle.importAesKey(
475
- (await this.env.SECRETS_STORE.get({
476
- secretName: "BANK_SERVICE_ENCRYPTION_KEY"
477
- })).data?.secretValue || ""
478
- );
479
475
  const accounts = await this._getConnectedAccounts();
480
- const accountsForConnector = accounts.filter(
481
- (acc) => acc.connectorKey === connectorKey
482
- );
483
- connectedAccounts = await Promise.all(
484
- accountsForConnector.map(async (acc) => {
485
- const credentials = await drizzle.getCredentialsByAccountId(
486
- this.db,
487
- encryptionKey,
488
- {
489
- accountId: acc.id
490
- }
491
- );
492
- if (!credentials) {
493
- throw backendSdk.createInternalError(null, {
494
- message: `No credentials found for account ${acc.id}`,
495
- code: "DB-B-001",
496
- status: 404
497
- });
498
- }
499
- return {
500
- currency: acc.currency,
501
- iban: acc.iban,
502
- token: credentials.value,
503
- id: acc.id,
504
- connectorKey: acc.connectorKey,
505
- bankRefId: acc.bankRefId
506
- };
507
- })
508
- );
476
+ connectedAccounts = accounts.filter((acc) => acc.connectorKey === connectorKey).map((acc) => ({
477
+ currency: acc.currency,
478
+ iban: acc.iban,
479
+ id: acc.id,
480
+ connectorKey: acc.connectorKey,
481
+ bankRefId: acc.bankRefId
482
+ }));
483
+ resolveCredentials = await drizzle.createCredentialsResolver(this.db, this.env);
509
484
  }
510
- const connector = mock_connector.initiateConnector({
485
+ return mock_connector.initiateConnector({
511
486
  bank: connectorKey,
512
487
  connectedAccounts,
488
+ resolveCredentials,
513
489
  env: this.env
514
490
  });
515
- return connector;
516
491
  }
517
492
  async getPayments(input) {
518
493
  return this.handleAction(
@@ -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 } from '../shared/bank.Vm9IO_UH.cjs';
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 } from '../shared/bank.BJ7LqYtJ.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 { S as SendPaymentInput, a as SendPaymentOutput } from '../shared/bank.COC0tqmL.cjs';
@@ -23,6 +23,7 @@ declare const getAuthUriInputSchema: z.ZodObject<{
23
23
  CSAS: "CSAS";
24
24
  AIRBANK: "AIRBANK";
25
25
  KB: "KB";
26
+ CSOB: "CSOB";
26
27
  }>;
27
28
  }, z.core.$strip>;
28
29
  type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
@@ -777,6 +778,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
777
778
  CSAS: "CSAS";
778
779
  AIRBANK: "AIRBANK";
779
780
  KB: "KB";
781
+ CSOB: "CSOB";
780
782
  }>;
781
783
  }, z.core.$strip>;
782
784
  interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema> {
@@ -1273,20 +1275,20 @@ declare const updateAccountInputSchema: z.ZodObject<{
1273
1275
  tableName: "account";
1274
1276
  dataType: "string";
1275
1277
  columnType: "SQLiteText";
1276
- data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1278
+ data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1277
1279
  driverParam: string;
1278
1280
  notNull: true;
1279
1281
  hasDefault: false;
1280
1282
  isPrimaryKey: false;
1281
1283
  isAutoincrement: false;
1282
1284
  hasRuntimeDefault: false;
1283
- enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB"];
1285
+ enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB", "CSOB"];
1284
1286
  baseColumn: never;
1285
1287
  identity: undefined;
1286
1288
  generated: undefined;
1287
1289
  }, {}, {
1288
1290
  length: number | undefined;
1289
- $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1291
+ $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1290
1292
  }>;
1291
1293
  status: drizzle_orm_sqlite_core.SQLiteColumn<{
1292
1294
  name: "status";
@@ -1771,7 +1773,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1771
1773
  name: string | null;
1772
1774
  iban: string;
1773
1775
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1774
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1776
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1775
1777
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1776
1778
  bankRefId: string;
1777
1779
  batchSizeLimit: number;
@@ -1803,7 +1805,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1803
1805
  name: string | null;
1804
1806
  iban: string;
1805
1807
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1806
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1808
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1807
1809
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1808
1810
  bankRefId: string;
1809
1811
  batchSizeLimit: number;
@@ -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 } from '../shared/bank.Vm9IO_UH.mjs';
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 } from '../shared/bank.BJ7LqYtJ.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 { S as SendPaymentInput, a as SendPaymentOutput } from '../shared/bank.COC0tqmL.mjs';
@@ -23,6 +23,7 @@ declare const getAuthUriInputSchema: z.ZodObject<{
23
23
  CSAS: "CSAS";
24
24
  AIRBANK: "AIRBANK";
25
25
  KB: "KB";
26
+ CSOB: "CSOB";
26
27
  }>;
27
28
  }, z.core.$strip>;
28
29
  type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
@@ -777,6 +778,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
777
778
  CSAS: "CSAS";
778
779
  AIRBANK: "AIRBANK";
779
780
  KB: "KB";
781
+ CSOB: "CSOB";
780
782
  }>;
781
783
  }, z.core.$strip>;
782
784
  interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema> {
@@ -1273,20 +1275,20 @@ declare const updateAccountInputSchema: z.ZodObject<{
1273
1275
  tableName: "account";
1274
1276
  dataType: "string";
1275
1277
  columnType: "SQLiteText";
1276
- data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1278
+ data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1277
1279
  driverParam: string;
1278
1280
  notNull: true;
1279
1281
  hasDefault: false;
1280
1282
  isPrimaryKey: false;
1281
1283
  isAutoincrement: false;
1282
1284
  hasRuntimeDefault: false;
1283
- enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB"];
1285
+ enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB", "CSOB"];
1284
1286
  baseColumn: never;
1285
1287
  identity: undefined;
1286
1288
  generated: undefined;
1287
1289
  }, {}, {
1288
1290
  length: number | undefined;
1289
- $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1291
+ $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1290
1292
  }>;
1291
1293
  status: drizzle_orm_sqlite_core.SQLiteColumn<{
1292
1294
  name: "status";
@@ -1771,7 +1773,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1771
1773
  name: string | null;
1772
1774
  iban: string;
1773
1775
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1774
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1776
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1775
1777
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1776
1778
  bankRefId: string;
1777
1779
  batchSizeLimit: number;
@@ -1803,7 +1805,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1803
1805
  name: string | null;
1804
1806
  iban: string;
1805
1807
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1806
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1808
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1807
1809
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1808
1810
  bankRefId: string;
1809
1811
  batchSizeLimit: number;
@@ -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 } from '../shared/bank.Vm9IO_UH.js';
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 } from '../shared/bank.BJ7LqYtJ.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 { S as SendPaymentInput, a as SendPaymentOutput } from '../shared/bank.COC0tqmL.js';
@@ -23,6 +23,7 @@ declare const getAuthUriInputSchema: z.ZodObject<{
23
23
  CSAS: "CSAS";
24
24
  AIRBANK: "AIRBANK";
25
25
  KB: "KB";
26
+ CSOB: "CSOB";
26
27
  }>;
27
28
  }, z.core.$strip>;
28
29
  type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
@@ -777,6 +778,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
777
778
  CSAS: "CSAS";
778
779
  AIRBANK: "AIRBANK";
779
780
  KB: "KB";
781
+ CSOB: "CSOB";
780
782
  }>;
781
783
  }, z.core.$strip>;
782
784
  interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema> {
@@ -1273,20 +1275,20 @@ declare const updateAccountInputSchema: z.ZodObject<{
1273
1275
  tableName: "account";
1274
1276
  dataType: "string";
1275
1277
  columnType: "SQLiteText";
1276
- data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1278
+ data: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1277
1279
  driverParam: string;
1278
1280
  notNull: true;
1279
1281
  hasDefault: false;
1280
1282
  isPrimaryKey: false;
1281
1283
  isAutoincrement: false;
1282
1284
  hasRuntimeDefault: false;
1283
- enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB"];
1285
+ enumValues: ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA", "DBU", "CSAS", "AIRBANK", "KB", "CSOB"];
1284
1286
  baseColumn: never;
1285
1287
  identity: undefined;
1286
1288
  generated: undefined;
1287
1289
  }, {}, {
1288
1290
  length: number | undefined;
1289
- $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1291
+ $type: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1290
1292
  }>;
1291
1293
  status: drizzle_orm_sqlite_core.SQLiteColumn<{
1292
1294
  name: "status";
@@ -1771,7 +1773,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1771
1773
  name: string | null;
1772
1774
  iban: string;
1773
1775
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1774
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1776
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1775
1777
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1776
1778
  bankRefId: string;
1777
1779
  batchSizeLimit: number;
@@ -1803,7 +1805,7 @@ declare class BankServiceBase extends BankServiceBase_base {
1803
1805
  name: string | null;
1804
1806
  iban: string;
1805
1807
  bankCode: "5051" | "0100" | "0300" | "0600" | "0710" | "0800" | "2010" | "2060" | "2070" | "2100" | "2200" | "2220" | "2250" | "2260" | "2600" | "2700" | "3030" | "3060" | "3500" | "4300" | "5500" | "5800" | "6000" | "6200" | "6210" | "6300" | "6363" | "6700" | "6800" | "7910" | "7950" | "7960" | "7970" | "7990" | "8030" | "8040" | "8060" | "8090" | "8150" | "8190" | "8198" | "8220" | "8250" | "8255" | "8265" | "8500";
1806
- connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB";
1808
+ connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA" | "DBU" | "CSAS" | "AIRBANK" | "KB" | "CSOB";
1807
1809
  status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
1808
1810
  bankRefId: string;
1809
1811
  batchSizeLimit: number;
@@ -1,16 +1,16 @@
1
1
  import { uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
2
- import { t as tables, e as encrypt, i as importAesKey, b as getCredentialsByAccountId, u as upsertBatchCommand, g as getBatchByIdQuery, d as createPaymentCommand, a as getAccountByIdQuery } from '../shared/bank.BVRO97AQ.mjs';
2
+ import { t as tables, e as encrypt, b as createCredentialsResolver, u as upsertBatchCommand, g as getBatchByIdQuery, i as importAesKey, d as createPaymentCommand, a as getAccountByIdQuery } from '../shared/bank.CGIeLo8U.mjs';
3
3
  import { WorkerEntrypoint } from 'cloudflare:workers';
4
4
  import { drizzle } from 'drizzle-orm/d1';
5
5
  import { z } from 'zod';
6
- import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, e as PAYMENT_TYPES, a as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, P as PAYMENT_DIRECTIONS, i as accountInsertSchema } from '../shared/bank.PB07ttj3.mjs';
6
+ import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, e as PAYMENT_TYPES, a as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, P as PAYMENT_DIRECTIONS, i as accountInsertSchema } from '../shared/bank.993UA65l.mjs';
7
7
  import { CURRENCY_CODES } from '@develit-io/general-codes';
8
8
  import 'date-fns';
9
9
  import 'jose';
10
10
  import { eq, sql, and, inArray, asc, desc, gte, lte } from 'drizzle-orm';
11
11
  import 'node:crypto';
12
- import { i as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment } from '../shared/bank.CCQB8FnG.mjs';
13
- import '../shared/bank.I0pR4Me2.mjs';
12
+ import { i as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment } from '../shared/bank.CStkMDDC.mjs';
13
+ import '../shared/bank.fIGTiPnp.mjs';
14
14
  import 'drizzle-orm/relations';
15
15
  import 'drizzle-orm/sqlite-core';
16
16
  import 'drizzle-zod';
@@ -468,49 +468,24 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
468
468
  });
469
469
  }
470
470
  let connectedAccounts = [];
471
+ let resolveCredentials;
471
472
  if (!skipAccounts) {
472
- const encryptionKey = await importAesKey(
473
- (await this.env.SECRETS_STORE.get({
474
- secretName: "BANK_SERVICE_ENCRYPTION_KEY"
475
- })).data?.secretValue || ""
476
- );
477
473
  const accounts = await this._getConnectedAccounts();
478
- const accountsForConnector = accounts.filter(
479
- (acc) => acc.connectorKey === connectorKey
480
- );
481
- connectedAccounts = await Promise.all(
482
- accountsForConnector.map(async (acc) => {
483
- const credentials = await getCredentialsByAccountId(
484
- this.db,
485
- encryptionKey,
486
- {
487
- accountId: acc.id
488
- }
489
- );
490
- if (!credentials) {
491
- throw createInternalError(null, {
492
- message: `No credentials found for account ${acc.id}`,
493
- code: "DB-B-001",
494
- status: 404
495
- });
496
- }
497
- return {
498
- currency: acc.currency,
499
- iban: acc.iban,
500
- token: credentials.value,
501
- id: acc.id,
502
- connectorKey: acc.connectorKey,
503
- bankRefId: acc.bankRefId
504
- };
505
- })
506
- );
474
+ connectedAccounts = accounts.filter((acc) => acc.connectorKey === connectorKey).map((acc) => ({
475
+ currency: acc.currency,
476
+ iban: acc.iban,
477
+ id: acc.id,
478
+ connectorKey: acc.connectorKey,
479
+ bankRefId: acc.bankRefId
480
+ }));
481
+ resolveCredentials = await createCredentialsResolver(this.db, this.env);
507
482
  }
508
- const connector = initiateConnector({
483
+ return initiateConnector({
509
484
  bank: connectorKey,
510
485
  connectedAccounts,
486
+ resolveCredentials,
511
487
  env: this.env
512
488
  });
513
- return connector;
514
489
  }
515
490
  async getPayments(input) {
516
491
  return this.handleAction(
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const drizzle = require('../shared/bank.AEdMloQz.cjs');
4
+ const drizzle = require('../shared/bank.Bs7mkXbR.cjs');
5
5
  const batchLifecycle = require('../shared/bank.Bg3Pdwm4.cjs');
6
- const mock_connector = require('../shared/bank.kYaMR0UG.cjs');
6
+ const mock_connector = require('../shared/bank.Bbpgmcv1.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
8
  const cloudflare_workers = require('cloudflare:workers');
9
9
  const cloudflare_workflows = require('cloudflare:workflows');
10
10
  const d1 = require('drizzle-orm/d1');
11
- require('../shared/bank.Bz8-M6O4.cjs');
12
- require('../shared/bank.DgGri2Wr.cjs');
11
+ require('node:crypto');
12
+ require('../shared/bank.IVhZ_RlH.cjs');
13
13
  require('drizzle-orm/relations');
14
14
  require('drizzle-orm/sqlite-core');
15
15
  require('date-fns');
16
- require('@develit-io/general-codes');
17
16
  require('jose');
18
- require('node:crypto');
17
+ require('@develit-io/general-codes');
19
18
  require('drizzle-zod');
19
+ require('../shared/bank.Cp0yvOdq.cjs');
20
20
 
21
21
  const updateAccountLastSyncCommand = (db, {
22
22
  lastSyncAt,
@@ -98,32 +98,15 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
98
98
  if (!account) {
99
99
  throw new cloudflare_workflows.NonRetryableError(`Account not found: ${batch.accountId}`);
100
100
  }
101
- const encryptionKey = await drizzle.importAesKey(
102
- (await this.env.SECRETS_STORE.get({
103
- secretName: "BANK_SERVICE_ENCRYPTION_KEY"
104
- })).data?.secretValue || ""
105
- );
106
- const credentials = await drizzle.getCredentialsByAccountId(db, encryptionKey, {
107
- accountId: account.id
108
- });
109
- if (!credentials) {
110
- throw new cloudflare_workflows.NonRetryableError(
111
- `No credentials found for account: ${account.id}`
112
- );
113
- }
114
- if (credentials.expiresAt < /* @__PURE__ */ new Date()) {
115
- throw new cloudflare_workflows.NonRetryableError(
116
- `Credentials have expired for account: ${account.id}`
117
- );
118
- }
101
+ const resolveCredentials = await drizzle.createCredentialsResolver(db, this.env);
119
102
  const connector = await mock_connector.initiateConnector({
120
103
  env: this.env,
121
104
  bank: account.connectorKey,
105
+ resolveCredentials,
122
106
  connectedAccounts: [
123
107
  {
124
108
  ...account,
125
- iban: account.iban,
126
- token: credentials.value
109
+ iban: account.iban
127
110
  }
128
111
  ]
129
112
  });
@@ -283,7 +266,6 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
283
266
  if (!account.lastSyncAt) {
284
267
  throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
285
268
  }
286
- //! ### This step is currently inside the fetch payments step with retries due to cf workflows output logs (until they allow hiding sensitive data) <-----
287
269
  const payments = await step.do(
288
270
  "fetch bank payments",
289
271
  {
@@ -291,34 +273,18 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
291
273
  timeout: "30 seconds"
292
274
  },
293
275
  async () => {
294
- const encryptionKey = await drizzle.importAesKey(
295
- (await this.env.SECRETS_STORE.get({
296
- secretName: "BANK_SERVICE_ENCRYPTION_KEY"
297
- })).data?.secretValue || ""
298
- );
299
- const credentials = await drizzle.getCredentialsByAccountId(
276
+ const resolveCredentials = await drizzle.createCredentialsResolver(
300
277
  db,
301
- encryptionKey,
302
- { accountId }
278
+ this.env
303
279
  );
304
- if (!credentials) {
305
- throw new cloudflare_workflows.NonRetryableError(
306
- `No credentials found for account: ${accountId}`
307
- );
308
- }
309
- if (credentials.expiresAt < /* @__PURE__ */ new Date()) {
310
- throw new cloudflare_workflows.NonRetryableError(
311
- `Credentials have expired for account: ${accountId}`
312
- );
313
- }
314
280
  const connector = await mock_connector.initiateConnector({
315
281
  env: this.env,
316
282
  bank: account.connectorKey,
283
+ resolveCredentials,
317
284
  connectedAccounts: [
318
285
  {
319
286
  ...account,
320
- iban: account.iban,
321
- token: credentials.value
287
+ iban: account.iban
322
288
  }
323
289
  ]
324
290
  });