@develit-services/bank 0.2.3 → 0.2.4

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.
Files changed (32) hide show
  1. package/dist/database/schema.cjs +1 -1
  2. package/dist/database/schema.d.cts +1 -1
  3. package/dist/database/schema.d.mts +1 -1
  4. package/dist/database/schema.d.ts +1 -1
  5. package/dist/database/schema.mjs +1 -1
  6. package/dist/export/worker.cjs +29 -16
  7. package/dist/export/worker.d.cts +2 -2
  8. package/dist/export/worker.d.mts +2 -2
  9. package/dist/export/worker.d.ts +2 -2
  10. package/dist/export/worker.mjs +26 -13
  11. package/dist/export/workflows.cjs +22 -17
  12. package/dist/export/workflows.mjs +20 -15
  13. package/dist/export/wrangler.cjs +1 -0
  14. package/dist/export/wrangler.d.cts +1 -0
  15. package/dist/export/wrangler.d.mts +1 -0
  16. package/dist/export/wrangler.d.ts +1 -0
  17. package/dist/export/wrangler.mjs +1 -0
  18. package/dist/shared/{bank.jhJ4j7UB.mjs → bank.BvUtf1S3.mjs} +41 -5
  19. package/dist/shared/{bank.B8vgpVU6.cjs → bank.CHS79KTx.cjs} +42 -4
  20. package/dist/shared/{bank.eVSSL0hq.d.cts → bank.Cfz44GPA.d.cts} +4 -4
  21. package/dist/shared/{bank.eVSSL0hq.d.mts → bank.Cfz44GPA.d.mts} +4 -4
  22. package/dist/shared/{bank.eVSSL0hq.d.ts → bank.Cfz44GPA.d.ts} +4 -4
  23. package/dist/shared/{bank.Bz_9Rd77.cjs → bank.CyinOg3r.cjs} +1 -1
  24. package/dist/shared/{bank.6g3WuMht.mjs → bank.DKtu6cfY.mjs} +1 -1
  25. package/dist/shared/{bank.CsAnzmYN.mjs → bank.DXn9jD0Q.mjs} +1 -2
  26. package/dist/shared/{bank.AJrHfGNj.cjs → bank.NdqOkgpd.cjs} +1 -2
  27. package/dist/types.cjs +2 -2
  28. package/dist/types.d.cts +2 -2
  29. package/dist/types.d.mts +2 -2
  30. package/dist/types.d.ts +2 -2
  31. package/dist/types.mjs +2 -2
  32. package/package.json +2 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/bank.AJrHfGNj.cjs');
3
+ const database_schema = require('../shared/bank.NdqOkgpd.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
6
  require('date-fns');
@@ -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.eVSSL0hq.cjs';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.Cfz44GPA.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.eVSSL0hq.mjs';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.Cfz44GPA.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.eVSSL0hq.js';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.Cfz44GPA.js';
2
2
  import 'zod';
3
3
  import 'drizzle-zod';
4
4
  import 'drizzle-orm/sqlite-core';
@@ -1,4 +1,4 @@
1
- export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.CsAnzmYN.mjs';
1
+ export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.DXn9jD0Q.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'date-fns';
@@ -3,17 +3,17 @@
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 database_schema = require('../shared/bank.AJrHfGNj.cjs');
6
+ const database_schema = require('../shared/bank.NdqOkgpd.cjs');
7
7
  require('jose');
8
8
  const generalCodes = require('@develit-io/general-codes');
9
9
  const zod = require('zod');
10
- const bank = require('../shared/bank.B8vgpVU6.cjs');
10
+ const encryption = require('../shared/bank.CHS79KTx.cjs');
11
11
  const drizzleOrm = require('drizzle-orm');
12
12
  require('drizzle-orm/sqlite-core');
13
13
  require('date-fns');
14
14
  require('drizzle-zod');
15
15
  require('drizzle-orm/relations');
16
- require('../shared/bank.Bz_9Rd77.cjs');
16
+ require('../shared/bank.CyinOg3r.cjs');
17
17
 
18
18
  const upsertAccountCommand = (db, { account }) => {
19
19
  const id = account.id || backendSdk.uuidv4();
@@ -79,9 +79,14 @@ const expireOneTimeTokenCommand = (db, {
79
79
  };
80
80
  };
81
81
 
82
- const createAccountCredentialsCommand = (db, { credentials }) => {
82
+ const createAccountCredentialsCommand = async (db, encryptionKey, { credentials }) => {
83
83
  const id = credentials.id || backendSdk.uuidv4();
84
- const command = db.insert(database_schema.tables.accountCredentials).values({ ...credentials, id }).returning();
84
+ const encryptedValue = await encryption.encrypt(credentials.value, encryptionKey);
85
+ const command = db.insert(database_schema.tables.accountCredentials).values({
86
+ ...credentials,
87
+ id,
88
+ value: encryptedValue
89
+ }).returning();
85
90
  return {
86
91
  id,
87
92
  command
@@ -399,11 +404,16 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
399
404
  const accountsForConnector = accounts.filter(
400
405
  (acc) => acc.connectorKey === connectorKey
401
406
  );
407
+ const encryptionKey = await encryption.importAesKey(this.env.ENCRYPTION_KEY);
402
408
  const accountsWithCredentials = await Promise.all(
403
409
  accountsForConnector.map(async (acc) => {
404
- const credentials = await bank.getCredentialsByAccountId(this.db, {
405
- accountId: acc.id
406
- });
410
+ const credentials = await encryption.getCredentialsByAccountId(
411
+ this.db,
412
+ encryptionKey,
413
+ {
414
+ accountId: acc.id
415
+ }
416
+ );
407
417
  if (!credentials) {
408
418
  throw backendSdk.createInternalError(null, {
409
419
  message: `No credentials found for account ${acc.id}`
@@ -418,7 +428,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
418
428
  };
419
429
  })
420
430
  );
421
- this.bankConnector = bank.initiateConnector({
431
+ this.bankConnector = encryption.initiateConnector({
422
432
  bank: connectorKey,
423
433
  connectedAccounts: accountsWithCredentials,
424
434
  env: this.env
@@ -719,7 +729,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
719
729
  ...preparedBatch.failedPayments,
720
730
  ...preparedBatch.newlyPreparedPayments
721
731
  ].map(
722
- (p) => bank.createPaymentCommand(this.db, { payment: p }).command.execute()
732
+ (p) => encryption.createPaymentCommand(this.db, { payment: p }).command.execute()
723
733
  )
724
734
  ]);
725
735
  await upsertBatchCommand(this.db, {
@@ -860,11 +870,14 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
860
870
  accountId: acc.id
861
871
  }).command
862
872
  );
863
- const createAccountCredentials = credentials.map(
864
- (cr) => createAccountCredentialsCommand(this.db, {
865
- credentials: cr
866
- }).command
867
- );
873
+ const encryptionKey = await encryption.importAesKey(this.env.ENCRYPTION_KEY);
874
+ const createAccountCredentials = (await Promise.all(
875
+ credentials.map(
876
+ async (cr) => createAccountCredentialsCommand(this.db, encryptionKey, {
877
+ credentials: cr
878
+ })
879
+ )
880
+ )).map((cmd) => cmd.command);
868
881
  const { command: updateOtt } = expireOneTimeTokenCommand(this.db, {
869
882
  ott
870
883
  });
@@ -934,7 +947,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
934
947
  debtor,
935
948
  debtorIban: debtor.iban
936
949
  };
937
- const { command } = bank.createPaymentCommand(this.db, { payment });
950
+ const { command } = encryption.createPaymentCommand(this.db, { payment });
938
951
  const createdPayment = await command.execute().then(backendSdk.first);
939
952
  this.logQueuePush({ payment, isPaymentExecuted: true });
940
953
  await this.pushToQueue(this.env.QUEUE_BUS_QUEUE, {
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.eVSSL0hq.cjs';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.Cfz44GPA.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';
@@ -1961,7 +1961,7 @@ declare const updateAccountInputSchema: z.ZodObject<{
1961
1961
  generated: undefined;
1962
1962
  }, {}, {}>;
1963
1963
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
- name: "last_sync";
1964
+ name: "last_sync_at";
1965
1965
  tableName: "account";
1966
1966
  dataType: "date";
1967
1967
  columnType: "SQLiteTimestamp";
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.eVSSL0hq.mjs';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.Cfz44GPA.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';
@@ -1961,7 +1961,7 @@ declare const updateAccountInputSchema: z.ZodObject<{
1961
1961
  generated: undefined;
1962
1962
  }, {}, {}>;
1963
1963
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
- name: "last_sync";
1964
+ name: "last_sync_at";
1965
1965
  tableName: "account";
1966
1966
  dataType: "date";
1967
1967
  columnType: "SQLiteTimestamp";
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.eVSSL0hq.js';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, I as IBankConnector, a as ConnectorKey, b as PaymentInsertType } from '../shared/bank.Cfz44GPA.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';
@@ -1961,7 +1961,7 @@ declare const updateAccountInputSchema: z.ZodObject<{
1961
1961
  generated: undefined;
1962
1962
  }, {}, {}>;
1963
1963
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
- name: "last_sync";
1964
+ name: "last_sync_at";
1965
1965
  tableName: "account";
1966
1966
  dataType: "date";
1967
1967
  columnType: "SQLiteTimestamp";
@@ -1,17 +1,17 @@
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, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.CsAnzmYN.mjs';
4
+ import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.DXn9jD0Q.mjs';
5
5
  import 'jose';
6
6
  import { CURRENCY_CODES } from '@develit-io/general-codes';
7
7
  import { z } from 'zod';
8
- import { g as getCredentialsByAccountId, i as initiateConnector, c as createPaymentCommand } from '../shared/bank.jhJ4j7UB.mjs';
8
+ import { e as encrypt, i as importAesKey, g as getCredentialsByAccountId, a as initiateConnector, c as createPaymentCommand } from '../shared/bank.BvUtf1S3.mjs';
9
9
  import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import 'date-fns';
12
12
  import 'drizzle-zod';
13
13
  import 'drizzle-orm/relations';
14
- import '../shared/bank.6g3WuMht.mjs';
14
+ import '../shared/bank.DKtu6cfY.mjs';
15
15
 
16
16
  const upsertAccountCommand = (db, { account }) => {
17
17
  const id = account.id || uuidv4();
@@ -77,9 +77,14 @@ const expireOneTimeTokenCommand = (db, {
77
77
  };
78
78
  };
79
79
 
80
- const createAccountCredentialsCommand = (db, { credentials }) => {
80
+ const createAccountCredentialsCommand = async (db, encryptionKey, { credentials }) => {
81
81
  const id = credentials.id || uuidv4();
82
- const command = db.insert(tables.accountCredentials).values({ ...credentials, id }).returning();
82
+ const encryptedValue = await encrypt(credentials.value, encryptionKey);
83
+ const command = db.insert(tables.accountCredentials).values({
84
+ ...credentials,
85
+ id,
86
+ value: encryptedValue
87
+ }).returning();
83
88
  return {
84
89
  id,
85
90
  command
@@ -397,11 +402,16 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
397
402
  const accountsForConnector = accounts.filter(
398
403
  (acc) => acc.connectorKey === connectorKey
399
404
  );
405
+ const encryptionKey = await importAesKey(this.env.ENCRYPTION_KEY);
400
406
  const accountsWithCredentials = await Promise.all(
401
407
  accountsForConnector.map(async (acc) => {
402
- const credentials = await getCredentialsByAccountId(this.db, {
403
- accountId: acc.id
404
- });
408
+ const credentials = await getCredentialsByAccountId(
409
+ this.db,
410
+ encryptionKey,
411
+ {
412
+ accountId: acc.id
413
+ }
414
+ );
405
415
  if (!credentials) {
406
416
  throw createInternalError(null, {
407
417
  message: `No credentials found for account ${acc.id}`
@@ -858,11 +868,14 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
858
868
  accountId: acc.id
859
869
  }).command
860
870
  );
861
- const createAccountCredentials = credentials.map(
862
- (cr) => createAccountCredentialsCommand(this.db, {
863
- credentials: cr
864
- }).command
865
- );
871
+ const encryptionKey = await importAesKey(this.env.ENCRYPTION_KEY);
872
+ const createAccountCredentials = (await Promise.all(
873
+ credentials.map(
874
+ async (cr) => createAccountCredentialsCommand(this.db, encryptionKey, {
875
+ credentials: cr
876
+ })
877
+ )
878
+ )).map((cmd) => cmd.command);
866
879
  const { command: updateOtt } = expireOneTimeTokenCommand(this.db, {
867
880
  ott
868
881
  });
@@ -3,9 +3,9 @@
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 database_schema = require('../shared/bank.AJrHfGNj.cjs');
6
+ const database_schema = require('../shared/bank.NdqOkgpd.cjs');
7
7
  const backendSdk = require('@develit-io/backend-sdk');
8
- const bank = require('../shared/bank.B8vgpVU6.cjs');
8
+ const encryption = require('../shared/bank.CHS79KTx.cjs');
9
9
  const drizzleOrm = require('drizzle-orm');
10
10
  require('drizzle-orm/sqlite-core');
11
11
  require('date-fns');
@@ -13,7 +13,7 @@ require('jose');
13
13
  require('@develit-io/general-codes');
14
14
  require('drizzle-zod');
15
15
  require('drizzle-orm/relations');
16
- require('../shared/bank.Bz_9Rd77.cjs');
16
+ require('../shared/bank.CyinOg3r.cjs');
17
17
 
18
18
  const updateAccountLastSyncCommand = (db, {
19
19
  lastSyncAt,
@@ -58,18 +58,7 @@ class SyncAccountPaymentsWorkflow extends cloudflare_workers.WorkflowEntrypoint
58
58
  if (!account.lastSyncAt) {
59
59
  throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
60
60
  }
61
- const credentials = await step.do(
62
- "load account credentials",
63
- async () => {
64
- const credentials2 = await bank.getCredentialsByAccountId(db, { accountId });
65
- if (!credentials2) {
66
- throw new cloudflare_workflows.NonRetryableError(
67
- `No credentials found for account: ${accountId}`
68
- );
69
- }
70
- return credentials2;
71
- }
72
- );
61
+ //! ### This step is currently inside the fetch payments step with retries due to cf workflows output logs (until they allow hiding sensitive data) <-----
73
62
  const payments = await step.do(
74
63
  "fetch bank payments",
75
64
  {
@@ -77,7 +66,23 @@ class SyncAccountPaymentsWorkflow extends cloudflare_workers.WorkflowEntrypoint
77
66
  timeout: "30 seconds"
78
67
  },
79
68
  async () => {
80
- const connector = bank.initiateConnector({
69
+ const encryptionKey = await encryption.importAesKey(this.env.ENCRYPTION_KEY);
70
+ const credentials = await encryption.getCredentialsByAccountId(
71
+ db,
72
+ encryptionKey,
73
+ { accountId }
74
+ );
75
+ if (!credentials) {
76
+ throw new cloudflare_workflows.NonRetryableError(
77
+ `No credentials found for account: ${accountId}`
78
+ );
79
+ }
80
+ if (credentials.expiresAt < /* @__PURE__ */ new Date()) {
81
+ throw new cloudflare_workflows.NonRetryableError(
82
+ `Credentials have expired for account: ${accountId}`
83
+ );
84
+ }
85
+ const connector = encryption.initiateConnector({
81
86
  env: this.env,
82
87
  bank: account.connectorKey,
83
88
  connectedAccounts: [
@@ -109,7 +114,7 @@ class SyncAccountPaymentsWorkflow extends cloudflare_workers.WorkflowEntrypoint
109
114
  async () => {
110
115
  const eventsToEmit = [];
111
116
  const createCommands = paymentsToInsert.map(
112
- (p) => bank.createPaymentCommand(db, { payment: p.parsed }).command
117
+ (p) => encryption.createPaymentCommand(db, { payment: p.parsed }).command
113
118
  );
114
119
  eventsToEmit.push(
115
120
  ...paymentsToInsert.map((p) => ({
@@ -1,9 +1,9 @@
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.CsAnzmYN.mjs';
4
+ import { t as tables } from '../shared/bank.DXn9jD0Q.mjs';
5
5
  import { asNonEmpty } from '@develit-io/backend-sdk';
6
- import { g as getCredentialsByAccountId, i as initiateConnector, c as createPaymentCommand } from '../shared/bank.jhJ4j7UB.mjs';
6
+ import { i as importAesKey, g as getCredentialsByAccountId, a as initiateConnector, c as createPaymentCommand } from '../shared/bank.BvUtf1S3.mjs';
7
7
  import { eq } from 'drizzle-orm';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'date-fns';
@@ -11,7 +11,7 @@ import 'jose';
11
11
  import '@develit-io/general-codes';
12
12
  import 'drizzle-zod';
13
13
  import 'drizzle-orm/relations';
14
- import '../shared/bank.6g3WuMht.mjs';
14
+ import '../shared/bank.DKtu6cfY.mjs';
15
15
 
16
16
  const updateAccountLastSyncCommand = (db, {
17
17
  lastSyncAt,
@@ -56,18 +56,7 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
56
56
  if (!account.lastSyncAt) {
57
57
  throw new Error(`lastSyncedAt is not set for account: ${accountId}`);
58
58
  }
59
- const credentials = await step.do(
60
- "load account credentials",
61
- async () => {
62
- const credentials2 = await getCredentialsByAccountId(db, { accountId });
63
- if (!credentials2) {
64
- throw new NonRetryableError(
65
- `No credentials found for account: ${accountId}`
66
- );
67
- }
68
- return credentials2;
69
- }
70
- );
59
+ //! ### This step is currently inside the fetch payments step with retries due to cf workflows output logs (until they allow hiding sensitive data) <-----
71
60
  const payments = await step.do(
72
61
  "fetch bank payments",
73
62
  {
@@ -75,6 +64,22 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
75
64
  timeout: "30 seconds"
76
65
  },
77
66
  async () => {
67
+ const encryptionKey = await importAesKey(this.env.ENCRYPTION_KEY);
68
+ const credentials = await getCredentialsByAccountId(
69
+ db,
70
+ encryptionKey,
71
+ { accountId }
72
+ );
73
+ if (!credentials) {
74
+ throw new NonRetryableError(
75
+ `No credentials found for account: ${accountId}`
76
+ );
77
+ }
78
+ if (credentials.expiresAt < /* @__PURE__ */ new Date()) {
79
+ throw new NonRetryableError(
80
+ `Credentials have expired for account: ${accountId}`
81
+ );
82
+ }
78
83
  const connector = initiateConnector({
79
84
  env: this.env,
80
85
  bank: account.connectorKey,
@@ -11,6 +11,7 @@ function defineBankServiceWrangler(config) {
11
11
  }),
12
12
  vars: {
13
13
  // Secrets
14
+ ENCRYPTION_KEY: "[SECRET]",
14
15
  FINBRICKS_PRIVATE_KEY_PEM: "[SECRET]",
15
16
  ERSTE_API_KEY: "[SECRET]",
16
17
  ERSTE_CLIENT_SECRET: "[SECRET]",
@@ -13,6 +13,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
13
13
  CRON_PAYMENTS_PROCESSING: string;
14
14
  BANK_AUTH_RECIPIENT: string;
15
15
  REDIRECT_URI: string;
16
+ ENCRYPTION_KEY: string;
16
17
  FINBRICKS_PRIVATE_KEY_PEM: string;
17
18
  ERSTE_API_KEY: string;
18
19
  ERSTE_CLIENT_SECRET: string;
@@ -13,6 +13,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
13
13
  CRON_PAYMENTS_PROCESSING: string;
14
14
  BANK_AUTH_RECIPIENT: string;
15
15
  REDIRECT_URI: string;
16
+ ENCRYPTION_KEY: string;
16
17
  FINBRICKS_PRIVATE_KEY_PEM: string;
17
18
  ERSTE_API_KEY: string;
18
19
  ERSTE_CLIENT_SECRET: string;
@@ -13,6 +13,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
13
13
  CRON_PAYMENTS_PROCESSING: string;
14
14
  BANK_AUTH_RECIPIENT: string;
15
15
  REDIRECT_URI: string;
16
+ ENCRYPTION_KEY: string;
16
17
  FINBRICKS_PRIVATE_KEY_PEM: string;
17
18
  ERSTE_API_KEY: string;
18
19
  ERSTE_CLIENT_SECRET: string;
@@ -9,6 +9,7 @@ function defineBankServiceWrangler(config) {
9
9
  }),
10
10
  vars: {
11
11
  // Secrets
12
+ ENCRYPTION_KEY: "[SECRET]",
12
13
  FINBRICKS_PRIVATE_KEY_PEM: "[SECRET]",
13
14
  ERSTE_API_KEY: "[SECRET]",
14
15
  ERSTE_CLIENT_SECRET: "[SECRET]",
@@ -1,8 +1,9 @@
1
- import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector } from './bank.CsAnzmYN.mjs';
1
+ import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector } from './bank.DXn9jD0Q.mjs';
2
+ import '@develit-io/backend-sdk';
2
3
  import { eq } from 'drizzle-orm';
3
- import { M as MockCobsConnector } from './bank.6g3WuMht.mjs';
4
4
  import 'jose';
5
5
  import '@develit-io/general-codes';
6
+ import { M as MockCobsConnector } from './bank.DKtu6cfY.mjs';
6
7
 
7
8
  const createPaymentCommand = (db, { payment }) => {
8
9
  return {
@@ -14,9 +15,12 @@ const createPaymentCommand = (db, { payment }) => {
14
15
  };
15
16
  };
16
17
 
17
- const getCredentialsByAccountId = async (db, { accountId }) => {
18
+ const getCredentialsByAccountId = async (db, encryptionKey, { accountId }) => {
18
19
  const cred = await db.select().from(tables.accountCredentials).where(eq(tables.accountCredentials.accountId, accountId)).get();
19
- return cred;
20
+ return cred ? {
21
+ ...cred,
22
+ value: await decrypt(cred.value, encryptionKey)
23
+ } : void 0;
20
24
  };
21
25
 
22
26
  class CreditasConnector extends FinbricksConnector {
@@ -91,4 +95,36 @@ const initiateConnector = ({
91
95
  }
92
96
  };
93
97
 
94
- export { createPaymentCommand as c, getCredentialsByAccountId as g, initiateConnector as i };
98
+ async function importAesKey(base64Key) {
99
+ const raw = Uint8Array.from(atob(base64Key), (c) => c.charCodeAt(0));
100
+ return await crypto.subtle.importKey("raw", raw, { name: "AES-GCM" }, false, [
101
+ "encrypt",
102
+ "decrypt"
103
+ ]);
104
+ }
105
+ async function encrypt(value, key) {
106
+ const encoder = new TextEncoder();
107
+ const iv = crypto.getRandomValues(new Uint8Array(12));
108
+ const ciphertext = await crypto.subtle.encrypt(
109
+ { name: "AES-GCM", iv },
110
+ key,
111
+ encoder.encode(value)
112
+ );
113
+ const combined = new Uint8Array(iv.length + ciphertext.byteLength);
114
+ combined.set(iv, 0);
115
+ combined.set(new Uint8Array(ciphertext), iv.length);
116
+ return btoa(String.fromCharCode(...combined));
117
+ }
118
+ async function decrypt(base64, key) {
119
+ const raw = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
120
+ const iv = raw.slice(0, 12);
121
+ const ciphertext = raw.slice(12);
122
+ const decrypted = await crypto.subtle.decrypt(
123
+ { name: "AES-GCM", iv },
124
+ key,
125
+ ciphertext
126
+ );
127
+ return new TextDecoder().decode(decrypted);
128
+ }
129
+
130
+ export { initiateConnector as a, createPaymentCommand as c, encrypt as e, getCredentialsByAccountId as g, importAesKey as i };
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.AJrHfGNj.cjs');
3
+ const database_schema = require('./bank.NdqOkgpd.cjs');
4
+ require('@develit-io/backend-sdk');
4
5
  const drizzleOrm = require('drizzle-orm');
5
- const mockCobs_connector = require('./bank.Bz_9Rd77.cjs');
6
6
  require('jose');
7
7
  require('@develit-io/general-codes');
8
+ const mockCobs_connector = require('./bank.CyinOg3r.cjs');
8
9
 
9
10
  const createPaymentCommand = (db, { payment }) => {
10
11
  return {
@@ -16,9 +17,12 @@ const createPaymentCommand = (db, { payment }) => {
16
17
  };
17
18
  };
18
19
 
19
- const getCredentialsByAccountId = async (db, { accountId }) => {
20
+ const getCredentialsByAccountId = async (db, encryptionKey, { accountId }) => {
20
21
  const cred = await db.select().from(database_schema.tables.accountCredentials).where(drizzleOrm.eq(database_schema.tables.accountCredentials.accountId, accountId)).get();
21
- return cred;
22
+ return cred ? {
23
+ ...cred,
24
+ value: await decrypt(cred.value, encryptionKey)
25
+ } : void 0;
22
26
  };
23
27
 
24
28
  class CreditasConnector extends database_schema.FinbricksConnector {
@@ -93,6 +97,40 @@ const initiateConnector = ({
93
97
  }
94
98
  };
95
99
 
100
+ async function importAesKey(base64Key) {
101
+ const raw = Uint8Array.from(atob(base64Key), (c) => c.charCodeAt(0));
102
+ return await crypto.subtle.importKey("raw", raw, { name: "AES-GCM" }, false, [
103
+ "encrypt",
104
+ "decrypt"
105
+ ]);
106
+ }
107
+ async function encrypt(value, key) {
108
+ const encoder = new TextEncoder();
109
+ const iv = crypto.getRandomValues(new Uint8Array(12));
110
+ const ciphertext = await crypto.subtle.encrypt(
111
+ { name: "AES-GCM", iv },
112
+ key,
113
+ encoder.encode(value)
114
+ );
115
+ const combined = new Uint8Array(iv.length + ciphertext.byteLength);
116
+ combined.set(iv, 0);
117
+ combined.set(new Uint8Array(ciphertext), iv.length);
118
+ return btoa(String.fromCharCode(...combined));
119
+ }
120
+ async function decrypt(base64, key) {
121
+ const raw = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
122
+ const iv = raw.slice(0, 12);
123
+ const ciphertext = raw.slice(12);
124
+ const decrypted = await crypto.subtle.decrypt(
125
+ { name: "AES-GCM", iv },
126
+ key,
127
+ ciphertext
128
+ );
129
+ return new TextDecoder().decode(decrypted);
130
+ }
131
+
96
132
  exports.createPaymentCommand = createPaymentCommand;
133
+ exports.encrypt = encrypt;
97
134
  exports.getCredentialsByAccountId = getCredentialsByAccountId;
135
+ exports.importAesKey = importAesKey;
98
136
  exports.initiateConnector = initiateConnector;
@@ -1025,7 +1025,7 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1025
1025
  generated: undefined;
1026
1026
  }, {}, {}>;
1027
1027
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1028
- name: "last_sync";
1028
+ name: "last_sync_at";
1029
1029
  tableName: "account";
1030
1030
  dataType: "date";
1031
1031
  columnType: "SQLiteTimestamp";
@@ -1808,7 +1808,7 @@ declare const accountInsertSchema: drizzle_zod.BuildSchema<"insert", {
1808
1808
  generated: undefined;
1809
1809
  }, {}, {}>;
1810
1810
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1811
- name: "last_sync";
1811
+ name: "last_sync_at";
1812
1812
  tableName: "account";
1813
1813
  dataType: "date";
1814
1814
  columnType: "SQLiteTimestamp";
@@ -2275,7 +2275,7 @@ declare const accountUpdateSchema: drizzle_zod.BuildSchema<"update", {
2275
2275
  generated: undefined;
2276
2276
  }, {}, {}>;
2277
2277
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2278
- name: "last_sync";
2278
+ name: "last_sync_at";
2279
2279
  tableName: "account";
2280
2280
  dataType: "date";
2281
2281
  columnType: "SQLiteTimestamp";
@@ -2742,7 +2742,7 @@ declare const accountSelectSchema: drizzle_zod.BuildSchema<"select", {
2742
2742
  generated: undefined;
2743
2743
  }, {}, {}>;
2744
2744
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2745
- name: "last_sync";
2745
+ name: "last_sync_at";
2746
2746
  tableName: "account";
2747
2747
  dataType: "date";
2748
2748
  columnType: "SQLiteTimestamp";
@@ -1025,7 +1025,7 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1025
1025
  generated: undefined;
1026
1026
  }, {}, {}>;
1027
1027
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1028
- name: "last_sync";
1028
+ name: "last_sync_at";
1029
1029
  tableName: "account";
1030
1030
  dataType: "date";
1031
1031
  columnType: "SQLiteTimestamp";
@@ -1808,7 +1808,7 @@ declare const accountInsertSchema: drizzle_zod.BuildSchema<"insert", {
1808
1808
  generated: undefined;
1809
1809
  }, {}, {}>;
1810
1810
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1811
- name: "last_sync";
1811
+ name: "last_sync_at";
1812
1812
  tableName: "account";
1813
1813
  dataType: "date";
1814
1814
  columnType: "SQLiteTimestamp";
@@ -2275,7 +2275,7 @@ declare const accountUpdateSchema: drizzle_zod.BuildSchema<"update", {
2275
2275
  generated: undefined;
2276
2276
  }, {}, {}>;
2277
2277
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2278
- name: "last_sync";
2278
+ name: "last_sync_at";
2279
2279
  tableName: "account";
2280
2280
  dataType: "date";
2281
2281
  columnType: "SQLiteTimestamp";
@@ -2742,7 +2742,7 @@ declare const accountSelectSchema: drizzle_zod.BuildSchema<"select", {
2742
2742
  generated: undefined;
2743
2743
  }, {}, {}>;
2744
2744
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2745
- name: "last_sync";
2745
+ name: "last_sync_at";
2746
2746
  tableName: "account";
2747
2747
  dataType: "date";
2748
2748
  columnType: "SQLiteTimestamp";
@@ -1025,7 +1025,7 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1025
1025
  generated: undefined;
1026
1026
  }, {}, {}>;
1027
1027
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1028
- name: "last_sync";
1028
+ name: "last_sync_at";
1029
1029
  tableName: "account";
1030
1030
  dataType: "date";
1031
1031
  columnType: "SQLiteTimestamp";
@@ -1808,7 +1808,7 @@ declare const accountInsertSchema: drizzle_zod.BuildSchema<"insert", {
1808
1808
  generated: undefined;
1809
1809
  }, {}, {}>;
1810
1810
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1811
- name: "last_sync";
1811
+ name: "last_sync_at";
1812
1812
  tableName: "account";
1813
1813
  dataType: "date";
1814
1814
  columnType: "SQLiteTimestamp";
@@ -2275,7 +2275,7 @@ declare const accountUpdateSchema: drizzle_zod.BuildSchema<"update", {
2275
2275
  generated: undefined;
2276
2276
  }, {}, {}>;
2277
2277
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2278
- name: "last_sync";
2278
+ name: "last_sync_at";
2279
2279
  tableName: "account";
2280
2280
  dataType: "date";
2281
2281
  columnType: "SQLiteTimestamp";
@@ -2742,7 +2742,7 @@ declare const accountSelectSchema: drizzle_zod.BuildSchema<"select", {
2742
2742
  generated: undefined;
2743
2743
  }, {}, {}>;
2744
2744
  lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2745
- name: "last_sync";
2745
+ name: "last_sync_at";
2746
2746
  tableName: "account";
2747
2747
  dataType: "date";
2748
2748
  columnType: "SQLiteTimestamp";
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.AJrHfGNj.cjs');
3
+ const database_schema = require('./bank.NdqOkgpd.cjs');
4
4
 
5
5
  class MockCobsConnector extends database_schema.FinbricksConnector {
6
6
  constructor(config) {
@@ -1,4 +1,4 @@
1
- import { F as FinbricksConnector } from './bank.CsAnzmYN.mjs';
1
+ import { F as FinbricksConnector } from './bank.DXn9jD0Q.mjs';
2
2
 
3
3
  class MockCobsConnector extends FinbricksConnector {
4
4
  constructor(config) {
@@ -307,7 +307,6 @@ class FinbricksConnector extends IBankConnector {
307
307
  id: uuidv4()
308
308
  })
309
309
  );
310
- console.log(accounts, "accs finbricks");
311
310
  const credentials = accounts.map((acc) => ({
312
311
  connectorKey: this.PROVIDER,
313
312
  expiresAt: new Date(Date.now() + 36e5),
@@ -1166,7 +1165,7 @@ const account = sqliteTable(
1166
1165
  bankRefId: text("bank_ref_id").notNull(),
1167
1166
  batchSizeLimit: integer("batch_size_limit").notNull().default(50),
1168
1167
  syncIntervalS: integer("sync_interval_s").notNull().default(600),
1169
- lastSyncAt: integer("last_sync", { mode: "timestamp_ms" }),
1168
+ lastSyncAt: integer("last_sync_at", { mode: "timestamp_ms" }),
1170
1169
  lastSyncMetadata: text("last_sync_metadata", {
1171
1170
  mode: "json"
1172
1171
  }).$type()
@@ -309,7 +309,6 @@ class FinbricksConnector extends IBankConnector {
309
309
  id: backendSdk.uuidv4()
310
310
  })
311
311
  );
312
- console.log(accounts, "accs finbricks");
313
312
  const credentials = accounts.map((acc) => ({
314
313
  connectorKey: this.PROVIDER,
315
314
  expiresAt: new Date(Date.now() + 36e5),
@@ -1168,7 +1167,7 @@ const account = sqliteCore.sqliteTable(
1168
1167
  bankRefId: sqliteCore.text("bank_ref_id").notNull(),
1169
1168
  batchSizeLimit: sqliteCore.integer("batch_size_limit").notNull().default(50),
1170
1169
  syncIntervalS: sqliteCore.integer("sync_interval_s").notNull().default(600),
1171
- lastSyncAt: sqliteCore.integer("last_sync", { mode: "timestamp_ms" }),
1170
+ lastSyncAt: sqliteCore.integer("last_sync_at", { mode: "timestamp_ms" }),
1172
1171
  lastSyncMetadata: sqliteCore.text("last_sync_metadata", {
1173
1172
  mode: "json"
1174
1173
  }).$type()
package/dist/types.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./shared/bank.AJrHfGNj.cjs');
4
- const mockCobs_connector = require('./shared/bank.Bz_9Rd77.cjs');
3
+ const database_schema = require('./shared/bank.NdqOkgpd.cjs');
4
+ const mockCobs_connector = require('./shared/bank.CyinOg3r.cjs');
5
5
  const generalCodes = require('@develit-io/general-codes');
6
6
  require('@develit-io/backend-sdk');
7
7
  require('drizzle-orm/sqlite-core');
package/dist/types.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.eVSSL0hq.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, 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, u as paymentInitializedInsertType } from './shared/bank.eVSSL0hq.cjs';
1
+ import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.Cfz44GPA.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, 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, u as paymentInitializedInsertType } from './shared/bank.Cfz44GPA.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.BchnXQDL.cjs';
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.eVSSL0hq.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, 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, u as paymentInitializedInsertType } from './shared/bank.eVSSL0hq.mjs';
1
+ import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.Cfz44GPA.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, 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, u as paymentInitializedInsertType } from './shared/bank.Cfz44GPA.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.BchnXQDL.mjs';
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.eVSSL0hq.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, 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, u as paymentInitializedInsertType } from './shared/bank.eVSSL0hq.js';
1
+ import { I as IBankConnector, c as IncomingPaymentMessage, d as InitiatedPayment, a as ConnectorKey, e as ConnectedAccount, f as AccountCredentialsInsertType, g as AccountInsertType, h as PaymentPreparedInsertType, i as InitiatedBatch, j 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.Cfz44GPA.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, 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, u as paymentInitializedInsertType } from './shared/bank.Cfz44GPA.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.BchnXQDL.js';
package/dist/types.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, q as ottSelectSchema, p as ottUpdateSchema, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.CsAnzmYN.mjs';
2
- export { M as MockCobsConnector } from './shared/bank.6g3WuMht.mjs';
1
+ export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, q as ottSelectSchema, p as ottUpdateSchema, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.DXn9jD0Q.mjs';
2
+ export { M as MockCobsConnector } from './shared/bank.DKtu6cfY.mjs';
3
3
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
4
4
  import '@develit-io/backend-sdk';
5
5
  import 'drizzle-orm/sqlite-core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,6 +49,7 @@
49
49
  "test:cov": "vitest run --coverage",
50
50
  "test:unit": "vitest unit fixtures",
51
51
  "test:int": "vitest integration",
52
+ "test:workflows": "vitest workflows",
52
53
  "build": "unbuild",
53
54
  "changelogen": "bunx changelogen@latest --bump",
54
55
  "release": "bun run build && bunx changelogen@latest --release --push && npm publish --access public"