@develit-services/bank 0.2.2 → 0.2.3

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,13 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/bank.CWAToo_g.cjs');
3
+ const database_schema = require('../shared/bank.AJrHfGNj.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
6
  require('date-fns');
7
7
  require('drizzle-orm');
8
- require('@develit-io/general-codes');
9
- require('zod');
10
8
  require('jose');
9
+ require('@develit-io/general-codes');
11
10
  require('drizzle-zod');
12
11
  require('drizzle-orm/relations');
13
12
 
@@ -1,5 +1,8 @@
1
- export { g as account, h as accountCredentials, d as batch, o as ott, e as payment, f as paymentRelations } from '../shared/bank.BGZYksmV.cjs';
2
- import 'drizzle-orm/sqlite-core';
3
- import 'drizzle-orm';
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';
4
2
  import 'zod';
3
+ import 'drizzle-zod';
4
+ import 'drizzle-orm/sqlite-core';
5
5
  import '@develit-io/backend-sdk';
6
+ import 'drizzle-orm/d1';
7
+ import 'drizzle-orm';
8
+ import '@develit-io/general-codes';
@@ -1,5 +1,8 @@
1
- export { g as account, h as accountCredentials, d as batch, o as ott, e as payment, f as paymentRelations } from '../shared/bank.BGZYksmV.mjs';
2
- import 'drizzle-orm/sqlite-core';
3
- import 'drizzle-orm';
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';
4
2
  import 'zod';
3
+ import 'drizzle-zod';
4
+ import 'drizzle-orm/sqlite-core';
5
5
  import '@develit-io/backend-sdk';
6
+ import 'drizzle-orm/d1';
7
+ import 'drizzle-orm';
8
+ import '@develit-io/general-codes';
@@ -1,5 +1,8 @@
1
- export { g as account, h as accountCredentials, d as batch, o as ott, e as payment, f as paymentRelations } from '../shared/bank.BGZYksmV.js';
2
- import 'drizzle-orm/sqlite-core';
3
- import 'drizzle-orm';
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';
4
2
  import 'zod';
3
+ import 'drizzle-zod';
4
+ import 'drizzle-orm/sqlite-core';
5
5
  import '@develit-io/backend-sdk';
6
+ import 'drizzle-orm/d1';
7
+ import 'drizzle-orm';
8
+ import '@develit-io/general-codes';
@@ -1,10 +1,9 @@
1
- export { z as account, D as accountCredentials, v as batch, y as ott, w as payment, x as paymentRelations } from '../shared/bank.B0uSWeRe.mjs';
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';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'date-fns';
5
5
  import 'drizzle-orm';
6
- import '@develit-io/general-codes';
7
- import 'zod';
8
6
  import 'jose';
7
+ import '@develit-io/general-codes';
9
8
  import 'drizzle-zod';
10
9
  import 'drizzle-orm/relations';
@@ -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.CWAToo_g.cjs');
6
+ const database_schema = require('../shared/bank.AJrHfGNj.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.CEraaQIT.cjs');
10
+ const bank = require('../shared/bank.B8vgpVU6.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.B8QzFnJl.cjs');
16
+ require('../shared/bank.Bz_9Rd77.cjs');
17
17
 
18
18
  const upsertAccountCommand = (db, { account }) => {
19
19
  const id = account.id || backendSdk.uuidv4();
@@ -29,6 +29,12 @@ const upsertAccountCommand = (db, { account }) => {
29
29
  };
30
30
  };
31
31
 
32
+ const updatePaymentCommand = (db, { payment }) => {
33
+ return {
34
+ command: db.update(database_schema.tables.payment).set(payment).where(drizzleOrm.eq(database_schema.tables.payment.id, payment.id)).returning()
35
+ };
36
+ };
37
+
32
38
  const upsertBatchCommand = (db, { batch }) => {
33
39
  const id = batch.id || backendSdk.uuidv4();
34
40
  const command = db.insert(database_schema.tables.batch).values({
@@ -280,11 +286,6 @@ const simulateDepositInputSchema = zod.z.object({
280
286
  connectorKey: zod.z.enum(database_schema.CONNECTOR_KEYS)
281
287
  });
282
288
 
283
- const setLastSyncAtInputSchema = zod.z.object({
284
- iban: zod.z.string(),
285
- lastSyncedAt: zod.z.coerce.date()
286
- });
287
-
288
289
  const ALLOWED_BATCH_FILTERS = {
289
290
  ACCOUNT_ID: "filterBatchAccountId",
290
291
  STATUS: "filterBatchStatus"
@@ -574,6 +575,8 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
574
575
  (payment) => {
575
576
  return {
576
577
  id: backendSdk.uuidv4(),
578
+ bankRefId: backendSdk.uuidv4(),
579
+ //TODO(kleinpetr): we won't create payment here (only via sync script)
577
580
  correlationId: payment.correlationId,
578
581
  refId: payment.refId,
579
582
  amount: payment.amount,
@@ -753,7 +756,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
753
756
  }
754
757
  });
755
758
  const updatePayments = payments.map(
756
- (payment) => bank.updatePaymentCommand(this.db, {
759
+ (payment) => updatePaymentCommand(this.db, {
757
760
  payment: { ...payment, status: "INITIALIZED" }
758
761
  }).command
759
762
  );
@@ -910,6 +913,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
910
913
  });
911
914
  const payment = {
912
915
  id: backendSdk.uuidv4(),
916
+ bankRefId: backendSdk.uuidv4(),
913
917
  correlationId: backendSdk.uuidv4(),
914
918
  amount,
915
919
  connectorKey,
@@ -947,27 +951,6 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
947
951
  }
948
952
  );
949
953
  }
950
- async setLastSyncAt(input) {
951
- return this.handleAction(
952
- { data: input, schema: setLastSyncAtInputSchema },
953
- { successMessage: "Last sync set." },
954
- async ({ iban, lastSyncedAt }) => {
955
- const account = await getAccountByIbanQuery(this.db, {
956
- iban
957
- });
958
- if (!account) {
959
- throw backendSdk.createInternalError(null, {
960
- status: 404,
961
- message: "Account for this organization does not exist."
962
- });
963
- }
964
- await bank.updateAccountLastSyncCommand(this.db, {
965
- accountId: account.id,
966
- lastSyncedAt
967
- }).command.execute();
968
- }
969
- );
970
- }
971
954
  async sendPayment(input) {
972
955
  return this.handleAction(
973
956
  { data: input, schema: sendPaymentInputSchema },
@@ -1076,9 +1059,6 @@ __decorateClass([
1076
1059
  __decorateClass([
1077
1060
  backendSdk.action("simulate-deposit")
1078
1061
  ], BankServiceBase.prototype, "simulateDeposit", 1);
1079
- __decorateClass([
1080
- backendSdk.action("set-last-sync-at")
1081
- ], BankServiceBase.prototype, "setLastSyncAt", 1);
1082
1062
  __decorateClass([
1083
1063
  backendSdk.action("send-payment")
1084
1064
  ], BankServiceBase.prototype, "sendPayment", 1);
@@ -1,9 +1,8 @@
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
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
- import { WorkerEntrypoint } from 'cloudflare:workers';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BGZYksmV.cjs';
6
- import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.RD4xwHFf.cjs';
5
+ import { WorkerEntrypoint } from 'cloudflare:workers';
7
6
  import { z } from 'zod';
8
7
  import * as drizzle_zod from 'drizzle-zod';
9
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -1514,14 +1513,6 @@ interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema
1514
1513
  interface SimulateDepositOutput extends PaymentSelectType {
1515
1514
  }
1516
1515
 
1517
- declare const setLastSyncAtInputSchema: z.ZodObject<{
1518
- iban: z.ZodString;
1519
- lastSyncedAt: z.ZodCoercedDate<unknown>;
1520
- }, z.core.$strip>;
1521
- interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
1522
- }
1523
- type SetLastSyncAtOutput = void;
1524
-
1525
1516
  declare const getBatchesInputSchema: z.ZodObject<{
1526
1517
  page: z.ZodNumber;
1527
1518
  limit: z.ZodNumber;
@@ -1969,8 +1960,8 @@ declare const updateAccountInputSchema: z.ZodObject<{
1969
1960
  identity: undefined;
1970
1961
  generated: undefined;
1971
1962
  }, {}, {}>;
1972
- lastSyncedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1973
- name: "last_synced_at";
1963
+ lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
+ name: "last_sync";
1974
1965
  tableName: "account";
1975
1966
  dataType: "date";
1976
1967
  columnType: "SQLiteTimestamp";
@@ -1986,6 +1977,25 @@ declare const updateAccountInputSchema: z.ZodObject<{
1986
1977
  identity: undefined;
1987
1978
  generated: undefined;
1988
1979
  }, {}, {}>;
1980
+ lastSyncMetadata: drizzle_orm_sqlite_core.SQLiteColumn<{
1981
+ name: "last_sync_metadata";
1982
+ tableName: "account";
1983
+ dataType: "json";
1984
+ columnType: "SQLiteTextJson";
1985
+ data: LastSyncMetadata;
1986
+ driverParam: string;
1987
+ notNull: false;
1988
+ hasDefault: false;
1989
+ isPrimaryKey: false;
1990
+ isAutoincrement: false;
1991
+ hasRuntimeDefault: false;
1992
+ enumValues: undefined;
1993
+ baseColumn: never;
1994
+ identity: undefined;
1995
+ generated: undefined;
1996
+ }, {}, {
1997
+ $type: LastSyncMetadata;
1998
+ }>;
1989
1999
  holderName: drizzle_orm_sqlite_core.SQLiteColumn<{
1990
2000
  name: "holder_name";
1991
2001
  tableName: "account";
@@ -2297,7 +2307,8 @@ declare class BankServiceBase extends BankServiceBase_base {
2297
2307
  bankRefId: string;
2298
2308
  batchSizeLimit: number;
2299
2309
  syncIntervalS: number;
2300
- lastSyncedAt: Date | null;
2310
+ lastSyncAt: Date | null;
2311
+ lastSyncMetadata: LastSyncMetadata | null;
2301
2312
  holderName: string;
2302
2313
  address: string | null;
2303
2314
  swiftBic: string | null;
@@ -2346,7 +2357,6 @@ declare class BankServiceBase extends BankServiceBase_base {
2346
2357
  getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
2347
2358
  authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
2348
2359
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
2349
- setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;
2350
2360
  sendPayment(input: SendPaymentInput): Promise<IRPCResponse<SendPaymentOutput>>;
2351
2361
  getBankAccounts(): Promise<IRPCResponse<GetAccountsOutput>>;
2352
2362
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
@@ -1,9 +1,8 @@
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
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
- import { WorkerEntrypoint } from 'cloudflare:workers';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BGZYksmV.mjs';
6
- import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.BOe_Qmuw.mjs';
5
+ import { WorkerEntrypoint } from 'cloudflare:workers';
7
6
  import { z } from 'zod';
8
7
  import * as drizzle_zod from 'drizzle-zod';
9
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -1514,14 +1513,6 @@ interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema
1514
1513
  interface SimulateDepositOutput extends PaymentSelectType {
1515
1514
  }
1516
1515
 
1517
- declare const setLastSyncAtInputSchema: z.ZodObject<{
1518
- iban: z.ZodString;
1519
- lastSyncedAt: z.ZodCoercedDate<unknown>;
1520
- }, z.core.$strip>;
1521
- interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
1522
- }
1523
- type SetLastSyncAtOutput = void;
1524
-
1525
1516
  declare const getBatchesInputSchema: z.ZodObject<{
1526
1517
  page: z.ZodNumber;
1527
1518
  limit: z.ZodNumber;
@@ -1969,8 +1960,8 @@ declare const updateAccountInputSchema: z.ZodObject<{
1969
1960
  identity: undefined;
1970
1961
  generated: undefined;
1971
1962
  }, {}, {}>;
1972
- lastSyncedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1973
- name: "last_synced_at";
1963
+ lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
+ name: "last_sync";
1974
1965
  tableName: "account";
1975
1966
  dataType: "date";
1976
1967
  columnType: "SQLiteTimestamp";
@@ -1986,6 +1977,25 @@ declare const updateAccountInputSchema: z.ZodObject<{
1986
1977
  identity: undefined;
1987
1978
  generated: undefined;
1988
1979
  }, {}, {}>;
1980
+ lastSyncMetadata: drizzle_orm_sqlite_core.SQLiteColumn<{
1981
+ name: "last_sync_metadata";
1982
+ tableName: "account";
1983
+ dataType: "json";
1984
+ columnType: "SQLiteTextJson";
1985
+ data: LastSyncMetadata;
1986
+ driverParam: string;
1987
+ notNull: false;
1988
+ hasDefault: false;
1989
+ isPrimaryKey: false;
1990
+ isAutoincrement: false;
1991
+ hasRuntimeDefault: false;
1992
+ enumValues: undefined;
1993
+ baseColumn: never;
1994
+ identity: undefined;
1995
+ generated: undefined;
1996
+ }, {}, {
1997
+ $type: LastSyncMetadata;
1998
+ }>;
1989
1999
  holderName: drizzle_orm_sqlite_core.SQLiteColumn<{
1990
2000
  name: "holder_name";
1991
2001
  tableName: "account";
@@ -2297,7 +2307,8 @@ declare class BankServiceBase extends BankServiceBase_base {
2297
2307
  bankRefId: string;
2298
2308
  batchSizeLimit: number;
2299
2309
  syncIntervalS: number;
2300
- lastSyncedAt: Date | null;
2310
+ lastSyncAt: Date | null;
2311
+ lastSyncMetadata: LastSyncMetadata | null;
2301
2312
  holderName: string;
2302
2313
  address: string | null;
2303
2314
  swiftBic: string | null;
@@ -2346,7 +2357,6 @@ declare class BankServiceBase extends BankServiceBase_base {
2346
2357
  getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
2347
2358
  authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
2348
2359
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
2349
- setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;
2350
2360
  sendPayment(input: SendPaymentInput): Promise<IRPCResponse<SendPaymentOutput>>;
2351
2361
  getBankAccounts(): Promise<IRPCResponse<GetAccountsOutput>>;
2352
2362
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
@@ -1,9 +1,8 @@
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
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
- import { WorkerEntrypoint } from 'cloudflare:workers';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BGZYksmV.js';
6
- import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.2BgwPCw_.js';
5
+ import { WorkerEntrypoint } from 'cloudflare:workers';
7
6
  import { z } from 'zod';
8
7
  import * as drizzle_zod from 'drizzle-zod';
9
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -1514,14 +1513,6 @@ interface SimulateDepositInput extends z.infer<typeof simulateDepositInputSchema
1514
1513
  interface SimulateDepositOutput extends PaymentSelectType {
1515
1514
  }
1516
1515
 
1517
- declare const setLastSyncAtInputSchema: z.ZodObject<{
1518
- iban: z.ZodString;
1519
- lastSyncedAt: z.ZodCoercedDate<unknown>;
1520
- }, z.core.$strip>;
1521
- interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
1522
- }
1523
- type SetLastSyncAtOutput = void;
1524
-
1525
1516
  declare const getBatchesInputSchema: z.ZodObject<{
1526
1517
  page: z.ZodNumber;
1527
1518
  limit: z.ZodNumber;
@@ -1969,8 +1960,8 @@ declare const updateAccountInputSchema: z.ZodObject<{
1969
1960
  identity: undefined;
1970
1961
  generated: undefined;
1971
1962
  }, {}, {}>;
1972
- lastSyncedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1973
- name: "last_synced_at";
1963
+ lastSyncAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1964
+ name: "last_sync";
1974
1965
  tableName: "account";
1975
1966
  dataType: "date";
1976
1967
  columnType: "SQLiteTimestamp";
@@ -1986,6 +1977,25 @@ declare const updateAccountInputSchema: z.ZodObject<{
1986
1977
  identity: undefined;
1987
1978
  generated: undefined;
1988
1979
  }, {}, {}>;
1980
+ lastSyncMetadata: drizzle_orm_sqlite_core.SQLiteColumn<{
1981
+ name: "last_sync_metadata";
1982
+ tableName: "account";
1983
+ dataType: "json";
1984
+ columnType: "SQLiteTextJson";
1985
+ data: LastSyncMetadata;
1986
+ driverParam: string;
1987
+ notNull: false;
1988
+ hasDefault: false;
1989
+ isPrimaryKey: false;
1990
+ isAutoincrement: false;
1991
+ hasRuntimeDefault: false;
1992
+ enumValues: undefined;
1993
+ baseColumn: never;
1994
+ identity: undefined;
1995
+ generated: undefined;
1996
+ }, {}, {
1997
+ $type: LastSyncMetadata;
1998
+ }>;
1989
1999
  holderName: drizzle_orm_sqlite_core.SQLiteColumn<{
1990
2000
  name: "holder_name";
1991
2001
  tableName: "account";
@@ -2297,7 +2307,8 @@ declare class BankServiceBase extends BankServiceBase_base {
2297
2307
  bankRefId: string;
2298
2308
  batchSizeLimit: number;
2299
2309
  syncIntervalS: number;
2300
- lastSyncedAt: Date | null;
2310
+ lastSyncAt: Date | null;
2311
+ lastSyncMetadata: LastSyncMetadata | null;
2301
2312
  holderName: string;
2302
2313
  address: string | null;
2303
2314
  swiftBic: string | null;
@@ -2346,7 +2357,6 @@ declare class BankServiceBase extends BankServiceBase_base {
2346
2357
  getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
2347
2358
  authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
2348
2359
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
2349
- setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;
2350
2360
  sendPayment(input: SendPaymentInput): Promise<IRPCResponse<SendPaymentOutput>>;
2351
2361
  getBankAccounts(): Promise<IRPCResponse<GetAccountsOutput>>;
2352
2362
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
@@ -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.B0uSWeRe.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.CsAnzmYN.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, u as updatePaymentCommand, a as updateAccountLastSyncCommand } from '../shared/bank.CXUMEJH4.mjs';
8
+ import { g as getCredentialsByAccountId, i as initiateConnector, c as createPaymentCommand } from '../shared/bank.jhJ4j7UB.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.CjZRgRoJ.mjs';
14
+ import '../shared/bank.6g3WuMht.mjs';
15
15
 
16
16
  const upsertAccountCommand = (db, { account }) => {
17
17
  const id = account.id || uuidv4();
@@ -27,6 +27,12 @@ const upsertAccountCommand = (db, { account }) => {
27
27
  };
28
28
  };
29
29
 
30
+ const updatePaymentCommand = (db, { payment }) => {
31
+ return {
32
+ command: db.update(tables.payment).set(payment).where(eq(tables.payment.id, payment.id)).returning()
33
+ };
34
+ };
35
+
30
36
  const upsertBatchCommand = (db, { batch }) => {
31
37
  const id = batch.id || uuidv4();
32
38
  const command = db.insert(tables.batch).values({
@@ -278,11 +284,6 @@ const simulateDepositInputSchema = z.object({
278
284
  connectorKey: z.enum(CONNECTOR_KEYS)
279
285
  });
280
286
 
281
- const setLastSyncAtInputSchema = z.object({
282
- iban: z.string(),
283
- lastSyncedAt: z.coerce.date()
284
- });
285
-
286
287
  const ALLOWED_BATCH_FILTERS = {
287
288
  ACCOUNT_ID: "filterBatchAccountId",
288
289
  STATUS: "filterBatchStatus"
@@ -572,6 +573,8 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
572
573
  (payment) => {
573
574
  return {
574
575
  id: uuidv4(),
576
+ bankRefId: uuidv4(),
577
+ //TODO(kleinpetr): we won't create payment here (only via sync script)
575
578
  correlationId: payment.correlationId,
576
579
  refId: payment.refId,
577
580
  amount: payment.amount,
@@ -908,6 +911,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
908
911
  });
909
912
  const payment = {
910
913
  id: uuidv4(),
914
+ bankRefId: uuidv4(),
911
915
  correlationId: uuidv4(),
912
916
  amount,
913
917
  connectorKey,
@@ -945,27 +949,6 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
945
949
  }
946
950
  );
947
951
  }
948
- async setLastSyncAt(input) {
949
- return this.handleAction(
950
- { data: input, schema: setLastSyncAtInputSchema },
951
- { successMessage: "Last sync set." },
952
- async ({ iban, lastSyncedAt }) => {
953
- const account = await getAccountByIbanQuery(this.db, {
954
- iban
955
- });
956
- if (!account) {
957
- throw createInternalError(null, {
958
- status: 404,
959
- message: "Account for this organization does not exist."
960
- });
961
- }
962
- await updateAccountLastSyncCommand(this.db, {
963
- accountId: account.id,
964
- lastSyncedAt
965
- }).command.execute();
966
- }
967
- );
968
- }
969
952
  async sendPayment(input) {
970
953
  return this.handleAction(
971
954
  { data: input, schema: sendPaymentInputSchema },
@@ -1074,9 +1057,6 @@ __decorateClass([
1074
1057
  __decorateClass([
1075
1058
  action("simulate-deposit")
1076
1059
  ], BankServiceBase.prototype, "simulateDeposit", 1);
1077
- __decorateClass([
1078
- action("set-last-sync-at")
1079
- ], BankServiceBase.prototype, "setLastSyncAt", 1);
1080
1060
  __decorateClass([
1081
1061
  action("send-payment")
1082
1062
  ], BankServiceBase.prototype, "sendPayment", 1);