@develit-services/bank 0.0.44 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) 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 +113 -568
  7. package/dist/export/worker.d.cts +81 -14
  8. package/dist/export/worker.d.mts +82 -13
  9. package/dist/export/worker.d.ts +81 -14
  10. package/dist/export/worker.mjs +105 -557
  11. package/dist/export/workflows.cjs +21 -0
  12. package/dist/export/workflows.d.cts +2 -0
  13. package/dist/export/workflows.d.mts +2 -0
  14. package/dist/export/workflows.d.ts +2 -0
  15. package/dist/export/workflows.mjs +15 -0
  16. package/dist/export/wrangler.cjs +7 -0
  17. package/dist/export/wrangler.d.cts +5 -0
  18. package/dist/export/wrangler.d.mts +5 -0
  19. package/dist/export/wrangler.d.ts +5 -0
  20. package/dist/export/wrangler.mjs +7 -0
  21. package/dist/shared/{bank.BVzOzXdX.cjs → bank.3YYIj-n6.cjs} +11 -9
  22. package/dist/shared/{bank.6WoCPIFy.mjs → bank.B72e0ibs.mjs} +1 -1
  23. package/dist/shared/{bank.BPcrbUBa.cjs → bank.BgpXGC_1.cjs} +1 -1
  24. package/dist/shared/{bank.CCilUVCi.d.ts → bank.BriEYREq.d.cts} +4 -4
  25. package/dist/shared/{bank.CCilUVCi.d.cts → bank.BriEYREq.d.mts} +4 -4
  26. package/dist/shared/{bank.CCilUVCi.d.mts → bank.BriEYREq.d.ts} +4 -4
  27. package/dist/shared/bank.CH22Zrdv.d.cts +20 -0
  28. package/dist/shared/bank.CH22Zrdv.d.mts +20 -0
  29. package/dist/shared/bank.CH22Zrdv.d.ts +20 -0
  30. package/dist/shared/{bank.BWcFhTu1.mjs → bank.CcKNlFRd.mjs} +11 -9
  31. package/dist/shared/{bank.DmzkJQVU.d.cts → bank.DSZbtb1J.d.mts} +33 -29
  32. package/dist/shared/{bank.0KTS9nMz.d.ts → bank.Ddhhr_rz.d.ts} +33 -29
  33. package/dist/shared/{bank.NTyp2XAv.d.mts → bank.DqRaP8LS.d.cts} +33 -29
  34. package/dist/shared/bank.GMK4QNvo.cjs +276 -0
  35. package/dist/shared/bank.jyyw3_3-.mjs +267 -0
  36. package/dist/types.cjs +2 -2
  37. package/dist/types.d.cts +16 -9
  38. package/dist/types.d.mts +16 -9
  39. package/dist/types.d.ts +16 -9
  40. package/dist/types.mjs +2 -2
  41. package/package.json +6 -1
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ const export_workflows = require('../shared/bank.GMK4QNvo.cjs');
4
+ require('cloudflare:workers');
5
+ require('cloudflare:workflows');
6
+ require('drizzle-orm/d1');
7
+ require('../shared/bank.3YYIj-n6.cjs');
8
+ require('@develit-io/backend-sdk');
9
+ require('drizzle-orm/sqlite-core');
10
+ require('date-fns');
11
+ require('drizzle-orm');
12
+ require('@develit-io/general-codes');
13
+ require('zod');
14
+ require('jose');
15
+ require('drizzle-zod');
16
+ require('drizzle-orm/relations');
17
+ require('../shared/bank.BgpXGC_1.cjs');
18
+
19
+
20
+
21
+ exports.SyncAccountPaymentsWorkflow = export_workflows.SyncAccountPaymentsWorkflow;
@@ -0,0 +1,2 @@
1
+ export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.CH22Zrdv.cjs';
2
+ import 'cloudflare:workers';
@@ -0,0 +1,2 @@
1
+ export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.CH22Zrdv.mjs';
2
+ import 'cloudflare:workers';
@@ -0,0 +1,2 @@
1
+ export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.CH22Zrdv.js';
2
+ import 'cloudflare:workers';
@@ -0,0 +1,15 @@
1
+ export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.jyyw3_3-.mjs';
2
+ import 'cloudflare:workers';
3
+ import 'cloudflare:workflows';
4
+ import 'drizzle-orm/d1';
5
+ import '../shared/bank.CcKNlFRd.mjs';
6
+ import '@develit-io/backend-sdk';
7
+ import 'drizzle-orm/sqlite-core';
8
+ import 'date-fns';
9
+ import 'drizzle-orm';
10
+ import '@develit-io/general-codes';
11
+ import 'zod';
12
+ import 'jose';
13
+ import 'drizzle-zod';
14
+ import 'drizzle-orm/relations';
15
+ import '../shared/bank.B72e0ibs.mjs';
@@ -34,6 +34,13 @@ function defineBankServiceWrangler(config) {
34
34
  migrations_dir: "./src/database/migrations"
35
35
  }
36
36
  ],
37
+ workflows: [
38
+ {
39
+ name: `${project}-sync-account-payments`,
40
+ binding: "SYNC_ACCOUNT_PAYMENTS_WORKFLOW",
41
+ class_name: "SyncAccountPaymentsWorkflow"
42
+ }
43
+ ],
37
44
  queues: {
38
45
  producers: [
39
46
  {
@@ -31,6 +31,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
31
31
  database_id: string;
32
32
  migrations_dir: string;
33
33
  }[];
34
+ workflows: {
35
+ name: string;
36
+ binding: string;
37
+ class_name: string;
38
+ }[];
34
39
  queues: {
35
40
  producers: {
36
41
  binding: string;
@@ -31,6 +31,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
31
31
  database_id: string;
32
32
  migrations_dir: string;
33
33
  }[];
34
+ workflows: {
35
+ name: string;
36
+ binding: string;
37
+ class_name: string;
38
+ }[];
34
39
  queues: {
35
40
  producers: {
36
41
  binding: string;
@@ -31,6 +31,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
31
31
  database_id: string;
32
32
  migrations_dir: string;
33
33
  }[];
34
+ workflows: {
35
+ name: string;
36
+ binding: string;
37
+ class_name: string;
38
+ }[];
34
39
  queues: {
35
40
  producers: {
36
41
  binding: string;
@@ -32,6 +32,13 @@ function defineBankServiceWrangler(config) {
32
32
  migrations_dir: "./src/database/migrations"
33
33
  }
34
34
  ],
35
+ workflows: [
36
+ {
37
+ name: `${project}-sync-account-payments`,
38
+ binding: "SYNC_ACCOUNT_PAYMENTS_WORKFLOW",
39
+ class_name: "SyncAccountPaymentsWorkflow"
40
+ }
41
+ ],
35
42
  queues: {
36
43
  producers: [
37
44
  {
@@ -566,13 +566,14 @@ class FinbricksConnector extends IBankConnector {
566
566
  };
567
567
  }
568
568
  async getAllAccountPayments({
569
- account
569
+ account,
570
+ filter
570
571
  }) {
571
- const dateFormat = "yyyy-MM-dd";
572
- const dateFrom = dateFns.format(account.lastSyncedAt, dateFormat);
573
- const dateTo = dateFns.format(/* @__PURE__ */ new Date(), dateFormat);
574
572
  let cursor = null;
575
573
  const allPayments = [];
574
+ const dateFormat = "yyyy-MM-dd";
575
+ const dateFrom = dateFns.format(filter.dateFrom, dateFormat);
576
+ const dateTo = dateFns.format(filter?.dateTo ?? /* @__PURE__ */ new Date(), dateFormat);
576
577
  const fetchTransactions = async (cursor2) => {
577
578
  return backendSdk.useResult(
578
579
  this.finbricks.request({
@@ -875,18 +876,19 @@ class ErsteConnector extends IBankConnector {
875
876
  return (await data.json()).signingUrl;
876
877
  }
877
878
  async getAllAccountPayments({
878
- account
879
+ account,
880
+ filter
879
881
  }) {
880
882
  const erstePayments = [];
881
883
  const dateFormat = "yyyy-MM-dd";
882
- const fromDate = dateFns.format(account.lastSyncedAt, dateFormat);
883
- const toDate = dateFns.format(/* @__PURE__ */ new Date(), dateFormat);
884
+ const dateFrom = dateFns.format(filter.dateFrom, dateFormat);
885
+ const dateTo = dateFns.format(filter?.dateTo ?? /* @__PURE__ */ new Date(), dateFormat);
884
886
  let page = 0;
885
887
  const pageSize = 200;
886
888
  const pageCount = 1;
887
889
  while (page < pageCount) {
888
890
  const response = await fetch(
889
- `${this.ACCOUNTS_URI}/my/accounts/${account.id}/transactions?fromDate=${fromDate}&toDate=${toDate}&size=${pageSize}&page=${page}&sort=bookingDate&order=desc`,
891
+ `${this.ACCOUNTS_URI}/my/accounts/${account.id}/transactions?fromDate=${dateFrom}&toDate=${dateTo}&size=${pageSize}&page=${page}&sort=bookingDate&order=desc`,
890
892
  {
891
893
  headers: {
892
894
  "WEB-API-key": this.API_KEY,
@@ -1117,7 +1119,7 @@ const account = sqliteCore.sqliteTable(
1117
1119
  bankRefId: sqliteCore.text("bank_ref_id").notNull(),
1118
1120
  batchSizeLimit: sqliteCore.integer("batch_size_limit").notNull().default(50),
1119
1121
  sync: sqliteCore.integer("sync", { mode: "boolean" }).default(false).notNull(),
1120
- syncPeriod: sqliteCore.integer("sync_period"),
1122
+ syncIntervalS: sqliteCore.integer("sync_interval_s").notNull().default(600),
1121
1123
  lastSyncedAt: sqliteCore.integer("last_synced_at", { mode: "timestamp_ms" })
1122
1124
  },
1123
1125
  (t) => [sqliteCore.unique().on(t.iban)]
@@ -1,4 +1,4 @@
1
- import { F as FinbricksConnector } from './bank.BWcFhTu1.mjs';
1
+ import { F as FinbricksConnector } from './bank.CcKNlFRd.mjs';
2
2
 
3
3
  class MockCobsConnector extends FinbricksConnector {
4
4
  constructor(config) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.BVzOzXdX.cjs');
3
+ const database_schema = require('./bank.3YYIj-n6.cjs');
4
4
 
5
5
  class MockCobsConnector extends database_schema.FinbricksConnector {
6
6
  constructor(config) {
@@ -1041,15 +1041,15 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1041
1041
  identity: undefined;
1042
1042
  generated: undefined;
1043
1043
  }, {}, {}>;
1044
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
- name: "sync_period";
1044
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
+ name: "sync_interval_s";
1046
1046
  tableName: "account";
1047
1047
  dataType: "number";
1048
1048
  columnType: "SQLiteInteger";
1049
1049
  data: number;
1050
1050
  driverParam: number;
1051
- notNull: false;
1052
- hasDefault: false;
1051
+ notNull: true;
1052
+ hasDefault: true;
1053
1053
  isPrimaryKey: false;
1054
1054
  isAutoincrement: false;
1055
1055
  hasRuntimeDefault: false;
@@ -1041,15 +1041,15 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1041
1041
  identity: undefined;
1042
1042
  generated: undefined;
1043
1043
  }, {}, {}>;
1044
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
- name: "sync_period";
1044
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
+ name: "sync_interval_s";
1046
1046
  tableName: "account";
1047
1047
  dataType: "number";
1048
1048
  columnType: "SQLiteInteger";
1049
1049
  data: number;
1050
1050
  driverParam: number;
1051
- notNull: false;
1052
- hasDefault: false;
1051
+ notNull: true;
1052
+ hasDefault: true;
1053
1053
  isPrimaryKey: false;
1054
1054
  isAutoincrement: false;
1055
1055
  hasRuntimeDefault: false;
@@ -1041,15 +1041,15 @@ declare const account: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1041
1041
  identity: undefined;
1042
1042
  generated: undefined;
1043
1043
  }, {}, {}>;
1044
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
- name: "sync_period";
1044
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
1045
+ name: "sync_interval_s";
1046
1046
  tableName: "account";
1047
1047
  dataType: "number";
1048
1048
  columnType: "SQLiteInteger";
1049
1049
  data: number;
1050
1050
  driverParam: number;
1051
- notNull: false;
1052
- hasDefault: false;
1051
+ notNull: true;
1052
+ hasDefault: true;
1053
1053
  isPrimaryKey: false;
1054
1054
  isAutoincrement: false;
1055
1055
  hasRuntimeDefault: false;
@@ -0,0 +1,20 @@
1
+ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
2
+
3
+ type Params = {
4
+ accountId: string;
5
+ };
6
+ declare class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint<BankEnv, Params> {
7
+ run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<{
8
+ status: string;
9
+ }>;
10
+ }
11
+
12
+ type workflows_SyncAccountPaymentsWorkflow = SyncAccountPaymentsWorkflow;
13
+ declare const workflows_SyncAccountPaymentsWorkflow: typeof SyncAccountPaymentsWorkflow;
14
+ declare namespace workflows {
15
+ export {
16
+ workflows_SyncAccountPaymentsWorkflow as SyncAccountPaymentsWorkflow,
17
+ };
18
+ }
19
+
20
+ export { SyncAccountPaymentsWorkflow as S, workflows as w };
@@ -0,0 +1,20 @@
1
+ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
2
+
3
+ type Params = {
4
+ accountId: string;
5
+ };
6
+ declare class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint<BankEnv, Params> {
7
+ run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<{
8
+ status: string;
9
+ }>;
10
+ }
11
+
12
+ type workflows_SyncAccountPaymentsWorkflow = SyncAccountPaymentsWorkflow;
13
+ declare const workflows_SyncAccountPaymentsWorkflow: typeof SyncAccountPaymentsWorkflow;
14
+ declare namespace workflows {
15
+ export {
16
+ workflows_SyncAccountPaymentsWorkflow as SyncAccountPaymentsWorkflow,
17
+ };
18
+ }
19
+
20
+ export { SyncAccountPaymentsWorkflow as S, workflows as w };
@@ -0,0 +1,20 @@
1
+ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
2
+
3
+ type Params = {
4
+ accountId: string;
5
+ };
6
+ declare class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint<BankEnv, Params> {
7
+ run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<{
8
+ status: string;
9
+ }>;
10
+ }
11
+
12
+ type workflows_SyncAccountPaymentsWorkflow = SyncAccountPaymentsWorkflow;
13
+ declare const workflows_SyncAccountPaymentsWorkflow: typeof SyncAccountPaymentsWorkflow;
14
+ declare namespace workflows {
15
+ export {
16
+ workflows_SyncAccountPaymentsWorkflow as SyncAccountPaymentsWorkflow,
17
+ };
18
+ }
19
+
20
+ export { SyncAccountPaymentsWorkflow as S, workflows as w };
@@ -564,13 +564,14 @@ class FinbricksConnector extends IBankConnector {
564
564
  };
565
565
  }
566
566
  async getAllAccountPayments({
567
- account
567
+ account,
568
+ filter
568
569
  }) {
569
- const dateFormat = "yyyy-MM-dd";
570
- const dateFrom = format(account.lastSyncedAt, dateFormat);
571
- const dateTo = format(/* @__PURE__ */ new Date(), dateFormat);
572
570
  let cursor = null;
573
571
  const allPayments = [];
572
+ const dateFormat = "yyyy-MM-dd";
573
+ const dateFrom = format(filter.dateFrom, dateFormat);
574
+ const dateTo = format(filter?.dateTo ?? /* @__PURE__ */ new Date(), dateFormat);
574
575
  const fetchTransactions = async (cursor2) => {
575
576
  return useResult(
576
577
  this.finbricks.request({
@@ -873,18 +874,19 @@ class ErsteConnector extends IBankConnector {
873
874
  return (await data.json()).signingUrl;
874
875
  }
875
876
  async getAllAccountPayments({
876
- account
877
+ account,
878
+ filter
877
879
  }) {
878
880
  const erstePayments = [];
879
881
  const dateFormat = "yyyy-MM-dd";
880
- const fromDate = format(account.lastSyncedAt, dateFormat);
881
- const toDate = format(/* @__PURE__ */ new Date(), dateFormat);
882
+ const dateFrom = format(filter.dateFrom, dateFormat);
883
+ const dateTo = format(filter?.dateTo ?? /* @__PURE__ */ new Date(), dateFormat);
882
884
  let page = 0;
883
885
  const pageSize = 200;
884
886
  const pageCount = 1;
885
887
  while (page < pageCount) {
886
888
  const response = await fetch(
887
- `${this.ACCOUNTS_URI}/my/accounts/${account.id}/transactions?fromDate=${fromDate}&toDate=${toDate}&size=${pageSize}&page=${page}&sort=bookingDate&order=desc`,
889
+ `${this.ACCOUNTS_URI}/my/accounts/${account.id}/transactions?fromDate=${dateFrom}&toDate=${dateTo}&size=${pageSize}&page=${page}&sort=bookingDate&order=desc`,
888
890
  {
889
891
  headers: {
890
892
  "WEB-API-key": this.API_KEY,
@@ -1115,7 +1117,7 @@ const account = sqliteTable(
1115
1117
  bankRefId: text("bank_ref_id").notNull(),
1116
1118
  batchSizeLimit: integer("batch_size_limit").notNull().default(50),
1117
1119
  sync: integer("sync", { mode: "boolean" }).default(false).notNull(),
1118
- syncPeriod: integer("sync_period"),
1120
+ syncIntervalS: integer("sync_interval_s").notNull().default(600),
1119
1121
  lastSyncedAt: integer("last_synced_at", { mode: "timestamp_ms" })
1120
1122
  },
1121
1123
  (t) => [unique().on(t.iban)]
@@ -1,11 +1,24 @@
1
1
  import { Environment } from '@develit-io/backend-sdk';
2
- import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
3
- import { a as PaymentInsertType, t as tables } from './bank.CCilUVCi.cjs';
4
2
  import { DrizzleD1Database } from 'drizzle-orm/d1';
3
+ import { a as PaymentInsertType, t as tables } from './bank.BriEYREq.mjs';
4
+ import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
5
5
  import { z } from 'zod';
6
6
  import * as drizzle_zod from 'drizzle-zod';
7
7
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
8
8
 
9
+ interface BankAccountWithLastSync extends ConnectedAccount {
10
+ lastSyncedAt: Date;
11
+ }
12
+ declare const CONNECTOR_KEYS: readonly ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA"];
13
+ type ConnectorKey = (typeof CONNECTOR_KEYS)[number];
14
+ declare const CREDENTIALS_TYPES: readonly ["AUTH_TOKEN", "REFRESH_TOKEN", "CLIENT_ID", "API_KEY"];
15
+ type CredentialsType = (typeof CREDENTIALS_TYPES)[number];
16
+ declare const TOKEN_TYPES: readonly ["ACCOUNT_AUTHORIZATION"];
17
+ type TokenType = (typeof TOKEN_TYPES)[number];
18
+ interface ConfigEnvironmentBank {
19
+ allowedProviders: ConnectorKey[];
20
+ }
21
+
9
22
  declare const PAYMENT_TYPES: readonly ["SEPA", "SWIFT", "IFSC", "DOMESTIC"];
10
23
  type PaymentType = (typeof PAYMENT_TYPES)[number];
11
24
  declare const CHARGE_BEARERS: readonly ["SHA", "OUR", "BEN"];
@@ -37,19 +50,6 @@ type BankCode = (typeof BANK_CODES)[number];
37
50
  declare const COUNTRY_CODES: ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]];
38
51
  type CountryCode = (typeof COUNTRY_CODES)[number];
39
52
 
40
- interface BankAccountWithLastSync extends ConnectedAccount {
41
- lastSyncedAt: Date;
42
- }
43
- declare const CONNECTOR_KEYS: readonly ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA"];
44
- type ConnectorKey = (typeof CONNECTOR_KEYS)[number];
45
- declare const CREDENTIALS_TYPES: readonly ["AUTH_TOKEN", "REFRESH_TOKEN", "CLIENT_ID", "API_KEY"];
46
- type CredentialsType = (typeof CREDENTIALS_TYPES)[number];
47
- declare const TOKEN_TYPES: readonly ["ACCOUNT_AUTHORIZATION"];
48
- type TokenType = (typeof TOKEN_TYPES)[number];
49
- interface ConfigEnvironmentBank {
50
- allowedProviders: ConnectorKey[];
51
- }
52
-
53
53
  type WithStatus<T extends {
54
54
  status: PaymentStatus;
55
55
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -106,10 +106,14 @@ declare abstract class IBankConnector {
106
106
  }): Promise<InitiatedBatch>;
107
107
  abstract initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
108
108
  abstract initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
109
- abstract getAllAccountPayments({ account, db, env, }: {
109
+ abstract getAllAccountPayments({ account, db, environment, filter, }: {
110
110
  account: AccountSelectType;
111
111
  db: DrizzleD1Database<typeof tables>;
112
- env: Environment;
112
+ environment: Environment;
113
+ filter: {
114
+ dateFrom: Date;
115
+ dateTo?: Date;
116
+ };
113
117
  }): Promise<PaymentInsertType[]>;
114
118
  abstract getPaymentStatus({ paymentId, }: {
115
119
  paymentId: string;
@@ -217,15 +221,15 @@ declare const accountInsertSchema: drizzle_zod.BuildSchema<"insert", {
217
221
  identity: undefined;
218
222
  generated: undefined;
219
223
  }, {}, {}>;
220
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
221
- name: "sync_period";
224
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
225
+ name: "sync_interval_s";
222
226
  tableName: "account";
223
227
  dataType: "number";
224
228
  columnType: "SQLiteInteger";
225
229
  data: number;
226
230
  driverParam: number;
227
- notNull: false;
228
- hasDefault: false;
231
+ notNull: true;
232
+ hasDefault: true;
229
233
  isPrimaryKey: false;
230
234
  isAutoincrement: false;
231
235
  hasRuntimeDefault: false;
@@ -682,15 +686,15 @@ declare const accountUpdateSchema: drizzle_zod.BuildSchema<"update", {
682
686
  identity: undefined;
683
687
  generated: undefined;
684
688
  }, {}, {}>;
685
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
686
- name: "sync_period";
689
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
690
+ name: "sync_interval_s";
687
691
  tableName: "account";
688
692
  dataType: "number";
689
693
  columnType: "SQLiteInteger";
690
694
  data: number;
691
695
  driverParam: number;
692
- notNull: false;
693
- hasDefault: false;
696
+ notNull: true;
697
+ hasDefault: true;
694
698
  isPrimaryKey: false;
695
699
  isAutoincrement: false;
696
700
  hasRuntimeDefault: false;
@@ -1147,15 +1151,15 @@ declare const accountSelectSchema: drizzle_zod.BuildSchema<"select", {
1147
1151
  identity: undefined;
1148
1152
  generated: undefined;
1149
1153
  }, {}, {}>;
1150
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
1151
- name: "sync_period";
1154
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
1155
+ name: "sync_interval_s";
1152
1156
  tableName: "account";
1153
1157
  dataType: "number";
1154
1158
  columnType: "SQLiteInteger";
1155
1159
  data: number;
1156
1160
  driverParam: number;
1157
- notNull: false;
1158
- hasDefault: false;
1161
+ notNull: true;
1162
+ hasDefault: true;
1159
1163
  isPrimaryKey: false;
1160
1164
  isAutoincrement: false;
1161
1165
  hasRuntimeDefault: false;
@@ -1,11 +1,24 @@
1
1
  import { Environment } from '@develit-io/backend-sdk';
2
- import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
3
- import { a as PaymentInsertType, t as tables } from './bank.CCilUVCi.js';
4
2
  import { DrizzleD1Database } from 'drizzle-orm/d1';
3
+ import { a as PaymentInsertType, t as tables } from './bank.BriEYREq.js';
4
+ import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
5
5
  import { z } from 'zod';
6
6
  import * as drizzle_zod from 'drizzle-zod';
7
7
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
8
8
 
9
+ interface BankAccountWithLastSync extends ConnectedAccount {
10
+ lastSyncedAt: Date;
11
+ }
12
+ declare const CONNECTOR_KEYS: readonly ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA"];
13
+ type ConnectorKey = (typeof CONNECTOR_KEYS)[number];
14
+ declare const CREDENTIALS_TYPES: readonly ["AUTH_TOKEN", "REFRESH_TOKEN", "CLIENT_ID", "API_KEY"];
15
+ type CredentialsType = (typeof CREDENTIALS_TYPES)[number];
16
+ declare const TOKEN_TYPES: readonly ["ACCOUNT_AUTHORIZATION"];
17
+ type TokenType = (typeof TOKEN_TYPES)[number];
18
+ interface ConfigEnvironmentBank {
19
+ allowedProviders: ConnectorKey[];
20
+ }
21
+
9
22
  declare const PAYMENT_TYPES: readonly ["SEPA", "SWIFT", "IFSC", "DOMESTIC"];
10
23
  type PaymentType = (typeof PAYMENT_TYPES)[number];
11
24
  declare const CHARGE_BEARERS: readonly ["SHA", "OUR", "BEN"];
@@ -37,19 +50,6 @@ type BankCode = (typeof BANK_CODES)[number];
37
50
  declare const COUNTRY_CODES: ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]];
38
51
  type CountryCode = (typeof COUNTRY_CODES)[number];
39
52
 
40
- interface BankAccountWithLastSync extends ConnectedAccount {
41
- lastSyncedAt: Date;
42
- }
43
- declare const CONNECTOR_KEYS: readonly ["ERSTE", "FINBRICKS", "MOCK", "CREDITAS", "MOCK_COBS", "FIO", "MONETA"];
44
- type ConnectorKey = (typeof CONNECTOR_KEYS)[number];
45
- declare const CREDENTIALS_TYPES: readonly ["AUTH_TOKEN", "REFRESH_TOKEN", "CLIENT_ID", "API_KEY"];
46
- type CredentialsType = (typeof CREDENTIALS_TYPES)[number];
47
- declare const TOKEN_TYPES: readonly ["ACCOUNT_AUTHORIZATION"];
48
- type TokenType = (typeof TOKEN_TYPES)[number];
49
- interface ConfigEnvironmentBank {
50
- allowedProviders: ConnectorKey[];
51
- }
52
-
53
53
  type WithStatus<T extends {
54
54
  status: PaymentStatus;
55
55
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -106,10 +106,14 @@ declare abstract class IBankConnector {
106
106
  }): Promise<InitiatedBatch>;
107
107
  abstract initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
108
108
  abstract initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
109
- abstract getAllAccountPayments({ account, db, env, }: {
109
+ abstract getAllAccountPayments({ account, db, environment, filter, }: {
110
110
  account: AccountSelectType;
111
111
  db: DrizzleD1Database<typeof tables>;
112
- env: Environment;
112
+ environment: Environment;
113
+ filter: {
114
+ dateFrom: Date;
115
+ dateTo?: Date;
116
+ };
113
117
  }): Promise<PaymentInsertType[]>;
114
118
  abstract getPaymentStatus({ paymentId, }: {
115
119
  paymentId: string;
@@ -217,15 +221,15 @@ declare const accountInsertSchema: drizzle_zod.BuildSchema<"insert", {
217
221
  identity: undefined;
218
222
  generated: undefined;
219
223
  }, {}, {}>;
220
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
221
- name: "sync_period";
224
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
225
+ name: "sync_interval_s";
222
226
  tableName: "account";
223
227
  dataType: "number";
224
228
  columnType: "SQLiteInteger";
225
229
  data: number;
226
230
  driverParam: number;
227
- notNull: false;
228
- hasDefault: false;
231
+ notNull: true;
232
+ hasDefault: true;
229
233
  isPrimaryKey: false;
230
234
  isAutoincrement: false;
231
235
  hasRuntimeDefault: false;
@@ -682,15 +686,15 @@ declare const accountUpdateSchema: drizzle_zod.BuildSchema<"update", {
682
686
  identity: undefined;
683
687
  generated: undefined;
684
688
  }, {}, {}>;
685
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
686
- name: "sync_period";
689
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
690
+ name: "sync_interval_s";
687
691
  tableName: "account";
688
692
  dataType: "number";
689
693
  columnType: "SQLiteInteger";
690
694
  data: number;
691
695
  driverParam: number;
692
- notNull: false;
693
- hasDefault: false;
696
+ notNull: true;
697
+ hasDefault: true;
694
698
  isPrimaryKey: false;
695
699
  isAutoincrement: false;
696
700
  hasRuntimeDefault: false;
@@ -1147,15 +1151,15 @@ declare const accountSelectSchema: drizzle_zod.BuildSchema<"select", {
1147
1151
  identity: undefined;
1148
1152
  generated: undefined;
1149
1153
  }, {}, {}>;
1150
- syncPeriod: drizzle_orm_sqlite_core.SQLiteColumn<{
1151
- name: "sync_period";
1154
+ syncIntervalS: drizzle_orm_sqlite_core.SQLiteColumn<{
1155
+ name: "sync_interval_s";
1152
1156
  tableName: "account";
1153
1157
  dataType: "number";
1154
1158
  columnType: "SQLiteInteger";
1155
1159
  data: number;
1156
1160
  driverParam: number;
1157
- notNull: false;
1158
- hasDefault: false;
1161
+ notNull: true;
1162
+ hasDefault: true;
1159
1163
  isPrimaryKey: false;
1160
1164
  isAutoincrement: false;
1161
1165
  hasRuntimeDefault: false;