@develit-services/bank 4.0.0 → 4.2.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 (32) hide show
  1. package/dist/database/schema.d.cts +1 -1
  2. package/dist/database/schema.d.mts +1 -1
  3. package/dist/database/schema.d.ts +1 -1
  4. package/dist/export/worker.cjs +99 -2
  5. package/dist/export/worker.d.cts +3 -2
  6. package/dist/export/worker.d.mts +3 -2
  7. package/dist/export/worker.d.ts +3 -2
  8. package/dist/export/worker.mjs +99 -2
  9. package/dist/export/workflows.cjs +102 -87
  10. package/dist/export/workflows.mjs +102 -87
  11. package/dist/export/wrangler.d.cts +2 -1
  12. package/dist/export/wrangler.d.mts +2 -1
  13. package/dist/export/wrangler.d.ts +2 -1
  14. package/dist/shared/{bank.BXMgOZmB.d.ts → bank.BOI0GA-f.d.cts} +2 -0
  15. package/dist/shared/{bank.BXMgOZmB.d.cts → bank.BOI0GA-f.d.mts} +2 -0
  16. package/dist/shared/{bank.BXMgOZmB.d.mts → bank.BOI0GA-f.d.ts} +2 -0
  17. package/dist/shared/{bank.1DaJXkX5.cjs → bank.C2QV_SMx.cjs} +26 -4
  18. package/dist/shared/{bank.Cwbl-Mjn.mjs → bank.CL02VO9K.mjs} +26 -4
  19. package/dist/shared/{bank.BGZ_RQHW.d.cts → bank.CT-uUhZB.d.mts} +1 -1
  20. package/dist/shared/{bank.C3FUz-p6.cjs → bank.Cfu7ZqyP.cjs} +1 -1
  21. package/dist/shared/{bank.CVlQjnAl.d.ts → bank.DDmes7Gx.d.ts} +1 -1
  22. package/dist/shared/{bank.DDoo3Iz3.d.mts → bank.DUd_XvqB.d.cts} +1 -1
  23. package/dist/shared/{bank.BydmpvCs.d.cts → bank.Dq24vYU7.d.cts} +1 -0
  24. package/dist/shared/{bank.BydmpvCs.d.mts → bank.Dq24vYU7.d.mts} +1 -0
  25. package/dist/shared/{bank.BydmpvCs.d.ts → bank.Dq24vYU7.d.ts} +1 -0
  26. package/dist/shared/{bank.lJOMYeVw.mjs → bank.qcrBpYcu.mjs} +1 -1
  27. package/dist/types.cjs +1 -1
  28. package/dist/types.d.cts +9 -5
  29. package/dist/types.d.mts +9 -5
  30. package/dist/types.d.ts +9 -5
  31. package/dist/types.mjs +1 -1
  32. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BXMgOZmB.cjs';
1
+ export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BOI0GA-f.cjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import '@develit-io/general-codes';
@@ -1,4 +1,4 @@
1
- export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BXMgOZmB.mjs';
1
+ export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BOI0GA-f.mjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import '@develit-io/general-codes';
@@ -1,4 +1,4 @@
1
- export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BXMgOZmB.js';
1
+ export { aA as account, aB as accountCredentials, aC as batch, aD as ott, aE as payment, aF as paymentRequest } from '../shared/bank.BOI0GA-f.js';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import '@develit-io/general-codes';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const ott_zod = require('../shared/bank.1DaJXkX5.cjs');
4
+ const ott_zod = require('../shared/bank.C2QV_SMx.cjs');
5
5
  const drizzleOrm = require('drizzle-orm');
6
6
  const cloudflare_workers = require('cloudflare:workers');
7
7
  const d1 = require('drizzle-orm/d1');
@@ -11,10 +11,69 @@ const database_schema = require('../shared/bank.9Yw4KHyl.cjs');
11
11
  const generalCodes = require('@develit-io/general-codes');
12
12
  require('date-fns');
13
13
  require('node:crypto');
14
- const credentialsResolver = require('../shared/bank.C3FUz-p6.cjs');
14
+ const credentialsResolver = require('../shared/bank.Cfu7ZqyP.cjs');
15
15
  require('drizzle-orm/zod');
16
16
  require('drizzle-orm/sqlite-core');
17
17
 
18
+ const SYNC_WORKFLOW_HEARTBEAT_CRON = "0 */8 * * *";
19
+ const DEAD_STATUSES = /* @__PURE__ */ new Set([
20
+ "complete",
21
+ "terminated",
22
+ "errored",
23
+ "unknown"
24
+ ]);
25
+ async function heartbeatSyncWorkflows({
26
+ entities,
27
+ resetAfterIterations,
28
+ getInstance,
29
+ createInstance,
30
+ logger
31
+ }) {
32
+ await Promise.all(
33
+ entities.map(async ({ id, iterationCount }) => {
34
+ try {
35
+ const instance = await getInstance(id);
36
+ const { status } = await instance.status();
37
+ if (DEAD_STATUSES.has(status)) {
38
+ await instance.restart();
39
+ logger.info("sync-workflow.heartbeat.zombie-recovery", {
40
+ id,
41
+ previousStatus: status
42
+ });
43
+ return;
44
+ }
45
+ if (iterationCount == null) {
46
+ logger.warn("sync-workflow.heartbeat.iteration-count-missing", {
47
+ id,
48
+ status
49
+ });
50
+ return;
51
+ }
52
+ if (iterationCount >= resetAfterIterations) {
53
+ await instance.restart();
54
+ logger.info("sync-workflow.heartbeat.scheduled-reset", {
55
+ id,
56
+ iterationCount
57
+ });
58
+ }
59
+ } catch (err) {
60
+ try {
61
+ await createInstance(id);
62
+ logger.info("sync-workflow.heartbeat.created-missing-instance", {
63
+ id
64
+ });
65
+ } catch (createErr) {
66
+ logger.error("sync-workflow.heartbeat.failed", {
67
+ id,
68
+ error: err instanceof Error ? err.message : String(err),
69
+ createError: createErr instanceof Error ? createErr.message : String(createErr)
70
+ });
71
+ }
72
+ }
73
+ })
74
+ );
75
+ }
76
+
18
77
  const sendPaymentInputSchema = zod.z.object({
19
78
  correlationId: zod.z.string().min(1),
20
79
  refId: zod.z.string().optional(),
@@ -874,8 +933,46 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
874
933
  if (controller.cron === this.env.CRON_PAYMENT_STATUSES) {
875
934
  console.log("Scheduled CRON payment request statuses");
876
935
  await this.updatePaymentRequestStatuses();
936
+ return;
937
+ }
938
+ if (controller.cron === SYNC_WORKFLOW_HEARTBEAT_CRON) {
939
+ console.log("Scheduled CRON sync workflow heartbeat");
940
+ await this.heartbeatSyncWorkflows();
877
941
  }
878
942
  }
943
+ async heartbeatSyncWorkflows() {
944
+ const accounts = await this.db.select({
945
+ id: ott_zod.tables.account.id,
946
+ lastSyncMetadata: ott_zod.tables.account.lastSyncMetadata
947
+ }).from(ott_zod.tables.account).where(drizzleOrm.eq(ott_zod.tables.account.status, "AUTHORIZED")).all();
948
+ const resetAfterIterations = Number(
949
+ this.env.SYNC_WORKFLOW_RESET_AFTER_ITERATIONS
950
+ );
951
+ if (!Number.isFinite(resetAfterIterations) || resetAfterIterations <= 0) {
952
+ console.error(
953
+ "Invalid SYNC_WORKFLOW_RESET_AFTER_ITERATIONS, skipping heartbeat",
954
+ { value: this.env.SYNC_WORKFLOW_RESET_AFTER_ITERATIONS }
955
+ );
956
+ return;
957
+ }
958
+ await heartbeatSyncWorkflows({
959
+ entities: accounts.map((a) => ({
960
+ id: a.id,
961
+ iterationCount: a.lastSyncMetadata?.iterationCount
962
+ })),
963
+ resetAfterIterations,
964
+ getInstance: (id) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(id),
965
+ createInstance: (id) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
966
+ id,
967
+ params: { accountId: id }
968
+ }),
969
+ logger: {
970
+ info: (event, data) => console.log(JSON.stringify({ level: "info", event, ...data })),
971
+ warn: (event, data) => console.warn(JSON.stringify({ level: "warn", event, ...data })),
972
+ error: (event, data) => console.error(JSON.stringify({ level: "error", event, ...data }))
973
+ }
974
+ });
975
+ }
879
976
  async handleAuthorizationCallback(input) {
880
977
  return this.handleAction(
881
978
  { data: input, schema: handleAuthorizationCallbackInputSchema },
@@ -1,6 +1,6 @@
1
1
  import * as drizzle_orm from 'drizzle-orm';
2
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BXMgOZmB.cjs';
3
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.BGZ_RQHW.cjs';
2
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BOI0GA-f.cjs';
3
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.DUd_XvqB.cjs';
4
4
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
5
5
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -3886,6 +3886,7 @@ declare class BankServiceBase extends BankServiceBase_base {
3886
3886
  statusChanged: number;
3887
3887
  }>>;
3888
3888
  scheduled(controller: ScheduledController): Promise<void>;
3889
+ private heartbeatSyncWorkflows;
3889
3890
  handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
3890
3891
  processBatch(input: ProcessBatchInput): Promise<IRPCResponse<ProcessBatchOutput>>;
3891
3892
  processBatchStatus(input: ProcessBatchStatusInput): Promise<IRPCResponse<ProcessBatchStatusOutput>>;
@@ -1,6 +1,6 @@
1
1
  import * as drizzle_orm from 'drizzle-orm';
2
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BXMgOZmB.mjs';
3
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.DDoo3Iz3.mjs';
2
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BOI0GA-f.mjs';
3
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.CT-uUhZB.mjs';
4
4
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
5
5
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -3886,6 +3886,7 @@ declare class BankServiceBase extends BankServiceBase_base {
3886
3886
  statusChanged: number;
3887
3887
  }>>;
3888
3888
  scheduled(controller: ScheduledController): Promise<void>;
3889
+ private heartbeatSyncWorkflows;
3889
3890
  handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
3890
3891
  processBatch(input: ProcessBatchInput): Promise<IRPCResponse<ProcessBatchOutput>>;
3891
3892
  processBatchStatus(input: ProcessBatchStatusInput): Promise<IRPCResponse<ProcessBatchStatusOutput>>;
@@ -1,6 +1,6 @@
1
1
  import * as drizzle_orm from 'drizzle-orm';
2
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BXMgOZmB.js';
3
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.CVlQjnAl.js';
2
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, b as ConfigEnvironmentBank, t as tables, c as ConnectorKey, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from '../shared/bank.BOI0GA-f.js';
3
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.DDmes7Gx.js';
4
4
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
5
5
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -3886,6 +3886,7 @@ declare class BankServiceBase extends BankServiceBase_base {
3886
3886
  statusChanged: number;
3887
3887
  }>>;
3888
3888
  scheduled(controller: ScheduledController): Promise<void>;
3889
+ private heartbeatSyncWorkflows;
3889
3890
  handleAuthorizationCallback(input: HandleAuthorizationCallbackInput): Promise<IRPCResponse<HandleAuthorizationCallbackOutput>>;
3890
3891
  processBatch(input: ProcessBatchInput): Promise<IRPCResponse<ProcessBatchOutput>>;
3891
3892
  processBatchStatus(input: ProcessBatchStatusInput): Promise<IRPCResponse<ProcessBatchStatusOutput>>;
@@ -1,5 +1,5 @@
1
1
  import { bankAccountMetadataSchema, structuredAddressSchema, uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
2
- import { B as tables, g as accountInsertSchema, G as relations, H as initiateConnector, o as isProcessedStatus, p as isTerminalStatus, J as getNonTerminalPaymentRequestsQuery, x as toIncomingPayment, j as assignAccount, u as toBatchedPayment, y as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.Cwbl-Mjn.mjs';
2
+ import { B as tables, g as accountInsertSchema, G as relations, H as initiateConnector, o as isProcessedStatus, p as isTerminalStatus, J as getNonTerminalPaymentRequestsQuery, x as toIncomingPayment, j as assignAccount, u as toBatchedPayment, y as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.CL02VO9K.mjs';
3
3
  import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count } from 'drizzle-orm';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { drizzle } from 'drizzle-orm/d1';
@@ -9,10 +9,69 @@ import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAYMENT_TYPES, b
9
9
  import { CURRENCY_CODES } from '@develit-io/general-codes';
10
10
  import 'date-fns';
11
11
  import 'node:crypto';
12
- import { h as encrypt, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, i as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from '../shared/bank.lJOMYeVw.mjs';
12
+ import { h as encrypt, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, i as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from '../shared/bank.qcrBpYcu.mjs';
13
13
  import 'drizzle-orm/zod';
14
14
  import 'drizzle-orm/sqlite-core';
15
15
 
16
+ const SYNC_WORKFLOW_HEARTBEAT_CRON = "0 */8 * * *";
17
+ const DEAD_STATUSES = /* @__PURE__ */ new Set([
18
+ "complete",
19
+ "terminated",
20
+ "errored",
21
+ "unknown"
22
+ ]);
23
+ async function heartbeatSyncWorkflows({
24
+ entities,
25
+ resetAfterIterations,
26
+ getInstance,
27
+ createInstance,
28
+ logger
29
+ }) {
30
+ await Promise.all(
31
+ entities.map(async ({ id, iterationCount }) => {
32
+ try {
33
+ const instance = await getInstance(id);
34
+ const { status } = await instance.status();
35
+ if (DEAD_STATUSES.has(status)) {
36
+ await instance.restart();
37
+ logger.info("sync-workflow.heartbeat.zombie-recovery", {
38
+ id,
39
+ previousStatus: status
40
+ });
41
+ return;
42
+ }
43
+ if (iterationCount == null) {
44
+ logger.warn("sync-workflow.heartbeat.iteration-count-missing", {
45
+ id,
46
+ status
47
+ });
48
+ return;
49
+ }
50
+ if (iterationCount >= resetAfterIterations) {
51
+ await instance.restart();
52
+ logger.info("sync-workflow.heartbeat.scheduled-reset", {
53
+ id,
54
+ iterationCount
55
+ });
56
+ }
57
+ } catch (err) {
58
+ try {
59
+ await createInstance(id);
60
+ logger.info("sync-workflow.heartbeat.created-missing-instance", {
61
+ id
62
+ });
63
+ } catch (createErr) {
64
+ logger.error("sync-workflow.heartbeat.failed", {
65
+ id,
66
+ error: err instanceof Error ? err.message : String(err),
67
+ createError: createErr instanceof Error ? createErr.message : String(createErr)
68
+ });
69
+ }
70
+ }
71
+ })
72
+ );
73
+ }
74
+
16
75
  const sendPaymentInputSchema = z.object({
17
76
  correlationId: z.string().min(1),
18
77
  refId: z.string().optional(),
@@ -872,8 +931,46 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
872
931
  if (controller.cron === this.env.CRON_PAYMENT_STATUSES) {
873
932
  console.log("Scheduled CRON payment request statuses");
874
933
  await this.updatePaymentRequestStatuses();
934
+ return;
935
+ }
936
+ if (controller.cron === SYNC_WORKFLOW_HEARTBEAT_CRON) {
937
+ console.log("Scheduled CRON sync workflow heartbeat");
938
+ await this.heartbeatSyncWorkflows();
875
939
  }
876
940
  }
941
+ async heartbeatSyncWorkflows() {
942
+ const accounts = await this.db.select({
943
+ id: tables.account.id,
944
+ lastSyncMetadata: tables.account.lastSyncMetadata
945
+ }).from(tables.account).where(eq(tables.account.status, "AUTHORIZED")).all();
946
+ const resetAfterIterations = Number(
947
+ this.env.SYNC_WORKFLOW_RESET_AFTER_ITERATIONS
948
+ );
949
+ if (!Number.isFinite(resetAfterIterations) || resetAfterIterations <= 0) {
950
+ console.error(
951
+ "Invalid SYNC_WORKFLOW_RESET_AFTER_ITERATIONS, skipping heartbeat",
952
+ { value: this.env.SYNC_WORKFLOW_RESET_AFTER_ITERATIONS }
953
+ );
954
+ return;
955
+ }
956
+ await heartbeatSyncWorkflows({
957
+ entities: accounts.map((a) => ({
958
+ id: a.id,
959
+ iterationCount: a.lastSyncMetadata?.iterationCount
960
+ })),
961
+ resetAfterIterations,
962
+ getInstance: (id) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(id),
963
+ createInstance: (id) => this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.create({
964
+ id,
965
+ params: { accountId: id }
966
+ }),
967
+ logger: {
968
+ info: (event, data) => console.log(JSON.stringify({ level: "info", event, ...data })),
969
+ warn: (event, data) => console.warn(JSON.stringify({ level: "warn", event, ...data })),
970
+ error: (event, data) => console.error(JSON.stringify({ level: "error", event, ...data }))
971
+ }
972
+ });
973
+ }
877
974
  async handleAuthorizationCallback(input) {
878
975
  return this.handleAction(
879
976
  { data: input, schema: handleAuthorizationCallbackInputSchema },
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const ott_zod = require('../shared/bank.1DaJXkX5.cjs');
4
+ const ott_zod = require('../shared/bank.C2QV_SMx.cjs');
5
5
  const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
6
6
  const drizzleOrm = require('drizzle-orm');
7
- const credentialsResolver = require('../shared/bank.C3FUz-p6.cjs');
7
+ const credentialsResolver = require('../shared/bank.Cfu7ZqyP.cjs');
8
8
  const cloudflare_workers = require('cloudflare:workers');
9
9
  const cloudflare_workflows = require('cloudflare:workflows');
10
10
  const d1 = require('drizzle-orm/d1');
@@ -305,6 +305,10 @@ function createWorkflowLogger(instanceId) {
305
305
  };
306
306
  }
307
307
 
308
+ function getStepCount(ctx) {
309
+ return ctx.step?.count ?? 0;
310
+ }
311
+
308
312
  async function pushToQueue(queue, message) {
309
313
  if (!Array.isArray(message)) {
310
314
  await queue.send(message, { contentType: "v8" });
@@ -325,6 +329,10 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
325
329
  if (!accountId) {
326
330
  throw new cloudflare_workflows.NonRetryableError(`Haven't obtained accountId to load.`);
327
331
  }
332
+ const workflowStartedAt = await step.do(
333
+ "capture workflow start time",
334
+ async () => Date.now()
335
+ );
328
336
  while (true) {
329
337
  const now = /* @__PURE__ */ new Date();
330
338
  const account = await step.do("load account", async () => {
@@ -390,99 +398,106 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
390
398
  const paymentsToProcess = payments.filter(
391
399
  (p) => ott_zod.isPaymentCompleted(p.parsed)
392
400
  );
393
- if (paymentsToProcess.length) {
394
- const lastSyncBankRefIds = account.lastSyncMetadata?.lastSyncBankRefIds || [];
395
- const paymentsToInsert = paymentsToProcess.filter(
396
- (p) => !lastSyncBankRefIds.includes(p.parsed.bankRefId)
397
- );
398
- await step.do(
399
- "process new payments and update lastSyncAt",
400
- async () => {
401
- const eventsToEmit = [];
402
- const bankRefIds = paymentsToInsert.map((p) => p.parsed.bankRefId).filter((id) => id != null);
403
- const matchingRequests = bankRefIds.length > 0 ? await db.select().from(ott_zod.tables.paymentRequest).where(
401
+ const lastSyncBankRefIds = account.lastSyncMetadata?.lastSyncBankRefIds || [];
402
+ const paymentsToInsert = paymentsToProcess.filter(
403
+ (p) => !lastSyncBankRefIds.includes(p.parsed.bankRefId)
404
+ );
405
+ await step.do(
406
+ "process new payments and update lastSyncAt",
407
+ async (ctx) => {
408
+ const eventsToEmit = [];
409
+ const bankRefIds = paymentsToInsert.map((p) => p.parsed.bankRefId).filter((id) => id != null);
410
+ const BANK_REF_ID_CHUNK_SIZE = 90;
411
+ const matchingRequests = [];
412
+ for (let i = 0; i < bankRefIds.length; i += BANK_REF_ID_CHUNK_SIZE) {
413
+ const chunkIds = bankRefIds.slice(i, i + BANK_REF_ID_CHUNK_SIZE);
414
+ const rows = await db.select().from(ott_zod.tables.paymentRequest).where(
404
415
  drizzleOrm.and(
405
- drizzleOrm.inArray(ott_zod.tables.paymentRequest.bankRefId, bankRefIds),
416
+ drizzleOrm.inArray(ott_zod.tables.paymentRequest.bankRefId, chunkIds),
406
417
  drizzleOrm.eq(ott_zod.tables.paymentRequest.accountId, account.id),
407
- drizzleOrm.eq(
408
- ott_zod.tables.paymentRequest.connectorKey,
409
- account.connectorKey
410
- )
418
+ drizzleOrm.eq(ott_zod.tables.paymentRequest.connectorKey, account.connectorKey)
411
419
  )
412
- ) : [];
413
- const requestByBankRefId = Object.fromEntries(
414
- matchingRequests.map((r) => [r.bankRefId, r])
415
420
  );
416
- const enrichedPayments = paymentsToInsert.map((p) => {
417
- const req = p.parsed.bankRefId && requestByBankRefId[p.parsed.bankRefId] || null;
418
- if (!req) return p;
419
- return {
420
- ...p,
421
- parsed: {
422
- ...p.parsed,
423
- // queue-bus: transaction matching (DBU doesn't echo these in statements)
424
- vs: p.parsed.vs ?? req.vs,
425
- ss: p.parsed.ss ?? req.ss,
426
- ks: p.parsed.ks ?? req.ks,
427
- message: p.parsed.message ?? req.message,
428
- // queue-bus: party creation
429
- creditor: {
430
- ...p.parsed.creditor,
431
- holderName: p.parsed.creditor?.holderName ?? req.creditor?.holderName
432
- },
433
- debtor: {
434
- ...p.parsed.debtor,
435
- holderName: p.parsed.debtor?.holderName ?? req.debtor?.holderName
436
- }
437
- // NOT enriched: chargeBearer, instructionPriority, refId, batchId,
438
- // createdAt, address, swiftBic — no downstream consumer in payment table
421
+ matchingRequests.push(...rows);
422
+ }
423
+ const requestByBankRefId = Object.fromEntries(
424
+ matchingRequests.map((r) => [r.bankRefId, r])
425
+ );
426
+ const enrichedPayments = paymentsToInsert.map((p) => {
427
+ const req = p.parsed.bankRefId && requestByBankRefId[p.parsed.bankRefId] || null;
428
+ if (!req) return p;
429
+ return {
430
+ ...p,
431
+ parsed: {
432
+ ...p.parsed,
433
+ // queue-bus: transaction matching (DBU doesn't echo these in statements)
434
+ vs: p.parsed.vs ?? req.vs,
435
+ ss: p.parsed.ss ?? req.ss,
436
+ ks: p.parsed.ks ?? req.ks,
437
+ message: p.parsed.message ?? req.message,
438
+ // queue-bus: party creation
439
+ creditor: {
440
+ ...p.parsed.creditor,
441
+ holderName: p.parsed.creditor?.holderName ?? req.creditor?.holderName
442
+ },
443
+ debtor: {
444
+ ...p.parsed.debtor,
445
+ holderName: p.parsed.debtor?.holderName ?? req.debtor?.holderName
439
446
  }
440
- };
441
- });
442
- const createCommands = enrichedPayments.map(
443
- (p) => credentialsResolver.createPaymentCommand(db, { payment: p.parsed }).command
447
+ // NOT enriched: chargeBearer, instructionPriority, refId, batchId,
448
+ // createdAt, address, swiftBic — no downstream consumer in payment table
449
+ }
450
+ };
451
+ });
452
+ const createCommands = enrichedPayments.map(
453
+ (p) => credentialsResolver.createPaymentCommand(db, { payment: p.parsed }).command
454
+ );
455
+ eventsToEmit.push(
456
+ ...enrichedPayments.map((p) => ({
457
+ eventType: "BANK_PAYMENT",
458
+ eventSignal: "paymentFetched",
459
+ bankPayment: p.parsed,
460
+ metadata: {
461
+ correlationId: p.parsed.correlationId,
462
+ entityId: p.parsed.id,
463
+ timestamp: /* @__PURE__ */ new Date()
464
+ }
465
+ }))
466
+ );
467
+ const lastSyncMetadata = {
468
+ payments: payments.length,
469
+ paymentsToProcess: paymentsToProcess.length,
470
+ paymentsInserted: paymentsToInsert.length,
471
+ lastSyncBankRefIds: paymentsToProcess.filter((p) => p.parsed.status === "BOOKED").map((p) => p.parsed.bankRefId),
472
+ lastSyncPayments: lastSyncBankRefIds.length,
473
+ eventsEmitted: eventsToEmit.length,
474
+ iterationCount: getStepCount(ctx),
475
+ workflowStartedAt
476
+ };
477
+ const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
478
+ accountId: account.id,
479
+ lastSyncAt: now,
480
+ lastSyncMetadata
481
+ }).command;
482
+ if (createCommands.length) {
483
+ await db.batch(
484
+ backendSdk.asNonEmpty([updateLastSyncCommand, ...createCommands])
444
485
  );
445
- eventsToEmit.push(
446
- ...enrichedPayments.map((p) => ({
447
- eventType: "BANK_PAYMENT",
448
- eventSignal: "paymentFetched",
449
- bankPayment: p.parsed,
450
- metadata: {
451
- correlationId: p.parsed.correlationId,
452
- entityId: p.parsed.id,
453
- timestamp: /* @__PURE__ */ new Date()
454
- }
455
- }))
486
+ } else {
487
+ await updateLastSyncCommand;
488
+ }
489
+ if (eventsToEmit.length) {
490
+ await pushToQueue(
491
+ this.env.QUEUE_BUS_QUEUE,
492
+ eventsToEmit
456
493
  );
457
- const lastSyncMetadata = {
458
- payments: payments.length,
459
- paymentsToProcess: paymentsToProcess.length,
460
- paymentsInserted: paymentsToInsert.length,
461
- lastSyncBankRefIds: paymentsToProcess.filter((p) => p.parsed.status === "BOOKED").map((p) => p.parsed.bankRefId),
462
- lastSyncPayments: lastSyncBankRefIds.length,
463
- eventsEmitted: eventsToEmit.length
464
- };
465
- const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
466
- accountId: account.id,
467
- lastSyncAt: now,
468
- lastSyncMetadata
469
- }).command;
470
- if (eventsToEmit.length) {
471
- await db.batch(
472
- backendSdk.asNonEmpty([updateLastSyncCommand, ...createCommands])
473
- );
474
- await pushToQueue(
475
- this.env.QUEUE_BUS_QUEUE,
476
- eventsToEmit
477
- );
478
- }
479
- return {
480
- ...lastSyncMetadata,
481
- newLastSyncAt: now
482
- };
483
494
  }
484
- );
485
- }
495
+ return {
496
+ ...lastSyncMetadata,
497
+ newLastSyncAt: now
498
+ };
499
+ }
500
+ );
486
501
  await step.sleep(
487
502
  "Sleep for next sync",
488
503
  `${account.syncIntervalS} seconds`
@@ -1,8 +1,8 @@
1
1
  import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
2
- import { B as tables, G as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, H as initiateConnector, m as isPaymentCompleted } from '../shared/bank.Cwbl-Mjn.mjs';
2
+ import { B as tables, G as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, H as initiateConnector, m as isPaymentCompleted } from '../shared/bank.CL02VO9K.mjs';
3
3
  import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
4
4
  import { eq, and, inArray } from 'drizzle-orm';
5
- import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.lJOMYeVw.mjs';
5
+ import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.qcrBpYcu.mjs';
6
6
  import { WorkflowEntrypoint } from 'cloudflare:workers';
7
7
  import { NonRetryableError } from 'cloudflare:workflows';
8
8
  import { drizzle } from 'drizzle-orm/d1';
@@ -303,6 +303,10 @@ function createWorkflowLogger(instanceId) {
303
303
  };
304
304
  }
305
305
 
306
+ function getStepCount(ctx) {
307
+ return ctx.step?.count ?? 0;
308
+ }
309
+
306
310
  async function pushToQueue(queue, message) {
307
311
  if (!Array.isArray(message)) {
308
312
  await queue.send(message, { contentType: "v8" });
@@ -323,6 +327,10 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
323
327
  if (!accountId) {
324
328
  throw new NonRetryableError(`Haven't obtained accountId to load.`);
325
329
  }
330
+ const workflowStartedAt = await step.do(
331
+ "capture workflow start time",
332
+ async () => Date.now()
333
+ );
326
334
  while (true) {
327
335
  const now = /* @__PURE__ */ new Date();
328
336
  const account = await step.do("load account", async () => {
@@ -388,99 +396,106 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
388
396
  const paymentsToProcess = payments.filter(
389
397
  (p) => isPaymentCompleted(p.parsed)
390
398
  );
391
- if (paymentsToProcess.length) {
392
- const lastSyncBankRefIds = account.lastSyncMetadata?.lastSyncBankRefIds || [];
393
- const paymentsToInsert = paymentsToProcess.filter(
394
- (p) => !lastSyncBankRefIds.includes(p.parsed.bankRefId)
395
- );
396
- await step.do(
397
- "process new payments and update lastSyncAt",
398
- async () => {
399
- const eventsToEmit = [];
400
- const bankRefIds = paymentsToInsert.map((p) => p.parsed.bankRefId).filter((id) => id != null);
401
- const matchingRequests = bankRefIds.length > 0 ? await db.select().from(tables.paymentRequest).where(
399
+ const lastSyncBankRefIds = account.lastSyncMetadata?.lastSyncBankRefIds || [];
400
+ const paymentsToInsert = paymentsToProcess.filter(
401
+ (p) => !lastSyncBankRefIds.includes(p.parsed.bankRefId)
402
+ );
403
+ await step.do(
404
+ "process new payments and update lastSyncAt",
405
+ async (ctx) => {
406
+ const eventsToEmit = [];
407
+ const bankRefIds = paymentsToInsert.map((p) => p.parsed.bankRefId).filter((id) => id != null);
408
+ const BANK_REF_ID_CHUNK_SIZE = 90;
409
+ const matchingRequests = [];
410
+ for (let i = 0; i < bankRefIds.length; i += BANK_REF_ID_CHUNK_SIZE) {
411
+ const chunkIds = bankRefIds.slice(i, i + BANK_REF_ID_CHUNK_SIZE);
412
+ const rows = await db.select().from(tables.paymentRequest).where(
402
413
  and(
403
- inArray(tables.paymentRequest.bankRefId, bankRefIds),
414
+ inArray(tables.paymentRequest.bankRefId, chunkIds),
404
415
  eq(tables.paymentRequest.accountId, account.id),
405
- eq(
406
- tables.paymentRequest.connectorKey,
407
- account.connectorKey
408
- )
416
+ eq(tables.paymentRequest.connectorKey, account.connectorKey)
409
417
  )
410
- ) : [];
411
- const requestByBankRefId = Object.fromEntries(
412
- matchingRequests.map((r) => [r.bankRefId, r])
413
418
  );
414
- const enrichedPayments = paymentsToInsert.map((p) => {
415
- const req = p.parsed.bankRefId && requestByBankRefId[p.parsed.bankRefId] || null;
416
- if (!req) return p;
417
- return {
418
- ...p,
419
- parsed: {
420
- ...p.parsed,
421
- // queue-bus: transaction matching (DBU doesn't echo these in statements)
422
- vs: p.parsed.vs ?? req.vs,
423
- ss: p.parsed.ss ?? req.ss,
424
- ks: p.parsed.ks ?? req.ks,
425
- message: p.parsed.message ?? req.message,
426
- // queue-bus: party creation
427
- creditor: {
428
- ...p.parsed.creditor,
429
- holderName: p.parsed.creditor?.holderName ?? req.creditor?.holderName
430
- },
431
- debtor: {
432
- ...p.parsed.debtor,
433
- holderName: p.parsed.debtor?.holderName ?? req.debtor?.holderName
434
- }
435
- // NOT enriched: chargeBearer, instructionPriority, refId, batchId,
436
- // createdAt, address, swiftBic — no downstream consumer in payment table
419
+ matchingRequests.push(...rows);
420
+ }
421
+ const requestByBankRefId = Object.fromEntries(
422
+ matchingRequests.map((r) => [r.bankRefId, r])
423
+ );
424
+ const enrichedPayments = paymentsToInsert.map((p) => {
425
+ const req = p.parsed.bankRefId && requestByBankRefId[p.parsed.bankRefId] || null;
426
+ if (!req) return p;
427
+ return {
428
+ ...p,
429
+ parsed: {
430
+ ...p.parsed,
431
+ // queue-bus: transaction matching (DBU doesn't echo these in statements)
432
+ vs: p.parsed.vs ?? req.vs,
433
+ ss: p.parsed.ss ?? req.ss,
434
+ ks: p.parsed.ks ?? req.ks,
435
+ message: p.parsed.message ?? req.message,
436
+ // queue-bus: party creation
437
+ creditor: {
438
+ ...p.parsed.creditor,
439
+ holderName: p.parsed.creditor?.holderName ?? req.creditor?.holderName
440
+ },
441
+ debtor: {
442
+ ...p.parsed.debtor,
443
+ holderName: p.parsed.debtor?.holderName ?? req.debtor?.holderName
437
444
  }
438
- };
439
- });
440
- const createCommands = enrichedPayments.map(
441
- (p) => createPaymentCommand(db, { payment: p.parsed }).command
445
+ // NOT enriched: chargeBearer, instructionPriority, refId, batchId,
446
+ // createdAt, address, swiftBic — no downstream consumer in payment table
447
+ }
448
+ };
449
+ });
450
+ const createCommands = enrichedPayments.map(
451
+ (p) => createPaymentCommand(db, { payment: p.parsed }).command
452
+ );
453
+ eventsToEmit.push(
454
+ ...enrichedPayments.map((p) => ({
455
+ eventType: "BANK_PAYMENT",
456
+ eventSignal: "paymentFetched",
457
+ bankPayment: p.parsed,
458
+ metadata: {
459
+ correlationId: p.parsed.correlationId,
460
+ entityId: p.parsed.id,
461
+ timestamp: /* @__PURE__ */ new Date()
462
+ }
463
+ }))
464
+ );
465
+ const lastSyncMetadata = {
466
+ payments: payments.length,
467
+ paymentsToProcess: paymentsToProcess.length,
468
+ paymentsInserted: paymentsToInsert.length,
469
+ lastSyncBankRefIds: paymentsToProcess.filter((p) => p.parsed.status === "BOOKED").map((p) => p.parsed.bankRefId),
470
+ lastSyncPayments: lastSyncBankRefIds.length,
471
+ eventsEmitted: eventsToEmit.length,
472
+ iterationCount: getStepCount(ctx),
473
+ workflowStartedAt
474
+ };
475
+ const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
476
+ accountId: account.id,
477
+ lastSyncAt: now,
478
+ lastSyncMetadata
479
+ }).command;
480
+ if (createCommands.length) {
481
+ await db.batch(
482
+ asNonEmpty([updateLastSyncCommand, ...createCommands])
442
483
  );
443
- eventsToEmit.push(
444
- ...enrichedPayments.map((p) => ({
445
- eventType: "BANK_PAYMENT",
446
- eventSignal: "paymentFetched",
447
- bankPayment: p.parsed,
448
- metadata: {
449
- correlationId: p.parsed.correlationId,
450
- entityId: p.parsed.id,
451
- timestamp: /* @__PURE__ */ new Date()
452
- }
453
- }))
484
+ } else {
485
+ await updateLastSyncCommand;
486
+ }
487
+ if (eventsToEmit.length) {
488
+ await pushToQueue(
489
+ this.env.QUEUE_BUS_QUEUE,
490
+ eventsToEmit
454
491
  );
455
- const lastSyncMetadata = {
456
- payments: payments.length,
457
- paymentsToProcess: paymentsToProcess.length,
458
- paymentsInserted: paymentsToInsert.length,
459
- lastSyncBankRefIds: paymentsToProcess.filter((p) => p.parsed.status === "BOOKED").map((p) => p.parsed.bankRefId),
460
- lastSyncPayments: lastSyncBankRefIds.length,
461
- eventsEmitted: eventsToEmit.length
462
- };
463
- const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
464
- accountId: account.id,
465
- lastSyncAt: now,
466
- lastSyncMetadata
467
- }).command;
468
- if (eventsToEmit.length) {
469
- await db.batch(
470
- asNonEmpty([updateLastSyncCommand, ...createCommands])
471
- );
472
- await pushToQueue(
473
- this.env.QUEUE_BUS_QUEUE,
474
- eventsToEmit
475
- );
476
- }
477
- return {
478
- ...lastSyncMetadata,
479
- newLastSyncAt: now
480
- };
481
492
  }
482
- );
483
- }
493
+ return {
494
+ ...lastSyncMetadata,
495
+ newLastSyncAt: now
496
+ };
497
+ }
498
+ );
484
499
  await step.sleep(
485
500
  "Sleep for next sync",
486
501
  `${account.syncIntervalS} seconds`
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.BydmpvCs.cjs';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.Dq24vYU7.cjs';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -15,6 +15,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  ENVIRONMENT: string;
19
20
  };
20
21
  services: {
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.BydmpvCs.mjs';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.Dq24vYU7.mjs';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -15,6 +15,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  ENVIRONMENT: string;
19
20
  };
20
21
  services: {
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.BydmpvCs.js';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.Dq24vYU7.js';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -15,6 +15,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  ENVIRONMENT: string;
19
20
  };
20
21
  services: {
@@ -28,6 +28,8 @@ interface LastSyncMetadata {
28
28
  lastSyncPayments: number;
29
29
  lastSyncBankRefIds: string[];
30
30
  eventsEmitted: number;
31
+ iterationCount?: number;
32
+ workflowStartedAt?: number;
31
33
  }
32
34
  type ConnectorConfig = Record<string, string | number | boolean | null>;
33
35
 
@@ -28,6 +28,8 @@ interface LastSyncMetadata {
28
28
  lastSyncPayments: number;
29
29
  lastSyncBankRefIds: string[];
30
30
  eventsEmitted: number;
31
+ iterationCount?: number;
32
+ workflowStartedAt?: number;
31
33
  }
32
34
  type ConnectorConfig = Record<string, string | number | boolean | null>;
33
35
 
@@ -28,6 +28,8 @@ interface LastSyncMetadata {
28
28
  lastSyncPayments: number;
29
29
  lastSyncBankRefIds: string[];
30
30
  eventsEmitted: number;
31
+ iterationCount?: number;
32
+ workflowStartedAt?: number;
31
33
  }
32
34
  type ConnectorConfig = Record<string, string | number | boolean | null>;
33
35
 
@@ -47,6 +47,20 @@ async function signFinbricksJws({
47
47
  return `${header}..${signature}`;
48
48
  }
49
49
 
50
+ const SENSITIVE_FIELDS = /* @__PURE__ */ new Set(["clientId"]);
51
+ const REDACTED = "[REDACTED]";
52
+ function redactFinbricksPayload(value) {
53
+ if (Array.isArray(value)) return value.map(redactFinbricksPayload);
54
+ if (value && typeof value === "object") {
55
+ const out = {};
56
+ for (const [key, v] of Object.entries(value)) {
57
+ out[key] = SENSITIVE_FIELDS.has(key) ? REDACTED : redactFinbricksPayload(v);
58
+ }
59
+ return out;
60
+ }
61
+ return value;
62
+ }
63
+
50
64
  const useFinbricksFetch = async (config, init) => {
51
65
  const {
52
66
  baseUrl,
@@ -93,7 +107,7 @@ const useFinbricksFetch = async (config, init) => {
93
107
  {
94
108
  method,
95
109
  url: url.toString(),
96
- body: body ?? null
110
+ body: body ? redactFinbricksPayload(body) : null
97
111
  },
98
112
  null,
99
113
  2
@@ -106,14 +120,20 @@ const useFinbricksFetch = async (config, init) => {
106
120
  });
107
121
  if (!res.ok) {
108
122
  const text = await res.text().catch(() => "unknown error");
123
+ let redactedBody = text;
124
+ try {
125
+ redactedBody = redactFinbricksPayload(JSON.parse(text));
126
+ } catch {
127
+ }
109
128
  console.error("[Finbricks] error response", {
110
129
  status: res.status,
111
130
  statusText: res.statusText,
112
131
  url: url.toString(),
113
- body: text
132
+ body: redactedBody
114
133
  });
134
+ const errorMessage = typeof redactedBody === "string" ? redactedBody : JSON.stringify(redactedBody);
115
135
  throw new Error(
116
- `Finbricks API error: ${res.status} ${res.statusText} \u2013 ${text}`
136
+ `Finbricks API error: ${res.status} ${res.statusText} \u2013 ${errorMessage}`
117
137
  );
118
138
  }
119
139
  const json = await res.json();
@@ -123,7 +143,7 @@ const useFinbricksFetch = async (config, init) => {
123
143
  {
124
144
  status: res.status,
125
145
  url: url.toString(),
126
- body: json
146
+ body: redactFinbricksPayload(json)
127
147
  },
128
148
  null,
129
149
  2
@@ -1408,6 +1428,7 @@ const calculateCzechIban = (accountNumber, bankCode) => {
1408
1428
 
1409
1429
  const dbuAccountConfigSchema = zod.z.object({
1410
1430
  with4EyeApproval: zod.z.enum(["Y", "N"]).default("Y"),
1431
+ realizeImmediate: zod.z.enum(["Y", "N"]).default("Y"),
1411
1432
  channelCode: zod.z.string().default("WWW"),
1412
1433
  actionTypeCode: zod.z.string().default("TRANSFER"),
1413
1434
  transactionTypeCode: zod.z.string().default("TRANSFER"),
@@ -1787,6 +1808,7 @@ class DbuConnector extends IBankConnector {
1787
1808
  constSymbol: payment.ks,
1788
1809
  uniqueExternalId: payment.id,
1789
1810
  with4EyeApproval: cfg.with4EyeApproval,
1811
+ realizeImmediate: cfg.realizeImmediate,
1790
1812
  applicationCode: this.applicationCode
1791
1813
  };
1792
1814
  const response = await this.makeRequest(
@@ -45,6 +45,20 @@ async function signFinbricksJws({
45
45
  return `${header}..${signature}`;
46
46
  }
47
47
 
48
+ const SENSITIVE_FIELDS = /* @__PURE__ */ new Set(["clientId"]);
49
+ const REDACTED = "[REDACTED]";
50
+ function redactFinbricksPayload(value) {
51
+ if (Array.isArray(value)) return value.map(redactFinbricksPayload);
52
+ if (value && typeof value === "object") {
53
+ const out = {};
54
+ for (const [key, v] of Object.entries(value)) {
55
+ out[key] = SENSITIVE_FIELDS.has(key) ? REDACTED : redactFinbricksPayload(v);
56
+ }
57
+ return out;
58
+ }
59
+ return value;
60
+ }
61
+
48
62
  const useFinbricksFetch = async (config, init) => {
49
63
  const {
50
64
  baseUrl,
@@ -91,7 +105,7 @@ const useFinbricksFetch = async (config, init) => {
91
105
  {
92
106
  method,
93
107
  url: url.toString(),
94
- body: body ?? null
108
+ body: body ? redactFinbricksPayload(body) : null
95
109
  },
96
110
  null,
97
111
  2
@@ -104,14 +118,20 @@ const useFinbricksFetch = async (config, init) => {
104
118
  });
105
119
  if (!res.ok) {
106
120
  const text = await res.text().catch(() => "unknown error");
121
+ let redactedBody = text;
122
+ try {
123
+ redactedBody = redactFinbricksPayload(JSON.parse(text));
124
+ } catch {
125
+ }
107
126
  console.error("[Finbricks] error response", {
108
127
  status: res.status,
109
128
  statusText: res.statusText,
110
129
  url: url.toString(),
111
- body: text
130
+ body: redactedBody
112
131
  });
132
+ const errorMessage = typeof redactedBody === "string" ? redactedBody : JSON.stringify(redactedBody);
113
133
  throw new Error(
114
- `Finbricks API error: ${res.status} ${res.statusText} \u2013 ${text}`
134
+ `Finbricks API error: ${res.status} ${res.statusText} \u2013 ${errorMessage}`
115
135
  );
116
136
  }
117
137
  const json = await res.json();
@@ -121,7 +141,7 @@ const useFinbricksFetch = async (config, init) => {
121
141
  {
122
142
  status: res.status,
123
143
  url: url.toString(),
124
- body: json
144
+ body: redactFinbricksPayload(json)
125
145
  },
126
146
  null,
127
147
  2
@@ -1406,6 +1426,7 @@ const calculateCzechIban = (accountNumber, bankCode) => {
1406
1426
 
1407
1427
  const dbuAccountConfigSchema = z.object({
1408
1428
  with4EyeApproval: z.enum(["Y", "N"]).default("Y"),
1429
+ realizeImmediate: z.enum(["Y", "N"]).default("Y"),
1409
1430
  channelCode: z.string().default("WWW"),
1410
1431
  actionTypeCode: z.string().default("TRANSFER"),
1411
1432
  transactionTypeCode: z.string().default("TRANSFER"),
@@ -1785,6 +1806,7 @@ class DbuConnector extends IBankConnector {
1785
1806
  constSymbol: payment.ks,
1786
1807
  uniqueExternalId: payment.id,
1787
1808
  with4EyeApproval: cfg.with4EyeApproval,
1809
+ realizeImmediate: cfg.realizeImmediate,
1788
1810
  applicationCode: this.applicationCode
1789
1811
  };
1790
1812
  const response = await this.makeRequest(
@@ -1,4 +1,4 @@
1
- import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BXMgOZmB.cjs';
1
+ import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BOI0GA-f.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const drizzleOrm = require('drizzle-orm');
4
- const ott_zod = require('./bank.1DaJXkX5.cjs');
4
+ const ott_zod = require('./bank.C2QV_SMx.cjs');
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  require('./bank.9Yw4KHyl.cjs');
7
7
  require('date-fns');
@@ -1,4 +1,4 @@
1
- import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BXMgOZmB.js';
1
+ import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BOI0GA-f.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -1,4 +1,4 @@
1
- import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BXMgOZmB.mjs';
1
+ import { e as CurrencyCode, Q as BankCode, a0 as CountryCode, P as PaymentRequestSelectType } from './bank.BOI0GA-f.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -15,6 +15,7 @@ interface BankServiceWranglerConfig {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  [key: string]: string | boolean;
19
20
  };
20
21
  triggers: {
@@ -15,6 +15,7 @@ interface BankServiceWranglerConfig {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  [key: string]: string | boolean;
19
20
  };
20
21
  triggers: {
@@ -15,6 +15,7 @@ interface BankServiceWranglerConfig {
15
15
  DBUCS_APPLICATION_CODE: string;
16
16
  DBUCS_TX_AUTH_URI: string;
17
17
  REDIRECT_URI: string;
18
+ SYNC_WORKFLOW_RESET_AFTER_ITERATIONS: string;
18
19
  [key: string]: string | boolean;
19
20
  };
20
21
  triggers: {
@@ -1,5 +1,5 @@
1
1
  import { sql, and, eq, isNull } from 'drizzle-orm';
2
- import { B as tables } from './bank.Cwbl-Mjn.mjs';
2
+ import { B as tables } from './bank.CL02VO9K.mjs';
3
3
  import { uuidv4 } from '@develit-io/backend-sdk';
4
4
  import './bank.BzDNLxB_.mjs';
5
5
  import 'date-fns';
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const ott_zod = require('./shared/bank.1DaJXkX5.cjs');
3
+ const ott_zod = require('./shared/bank.C2QV_SMx.cjs');
4
4
  const database_schema = require('./shared/bank.9Yw4KHyl.cjs');
5
5
  const batchLifecycle = require('./shared/bank.NF8bZBy0.cjs');
6
6
  const generalCodes = require('@develit-io/general-codes');
package/dist/types.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BXMgOZmB.cjs';
2
- export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BXMgOZmB.cjs';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BGZ_RQHW.cjs';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.BGZ_RQHW.cjs';
1
+ import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BOI0GA-f.cjs';
2
+ export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BOI0GA-f.cjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.DUd_XvqB.cjs';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.DUd_XvqB.cjs';
5
5
  import { z } from 'zod';
6
- export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.BydmpvCs.cjs';
6
+ export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.Dq24vYU7.cjs';
7
7
  import { BaseEvent } from '@develit-io/backend-sdk';
8
8
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
9
9
  import * as drizzle_orm from 'drizzle-orm';
@@ -306,6 +306,10 @@ declare const dbuAccountConfigSchema: z.ZodObject<{
306
306
  Y: "Y";
307
307
  N: "N";
308
308
  }>>;
309
+ realizeImmediate: z.ZodDefault<z.ZodEnum<{
310
+ Y: "Y";
311
+ N: "N";
312
+ }>>;
309
313
  channelCode: z.ZodDefault<z.ZodString>;
310
314
  actionTypeCode: z.ZodDefault<z.ZodString>;
311
315
  transactionTypeCode: z.ZodDefault<z.ZodString>;
package/dist/types.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BXMgOZmB.mjs';
2
- export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BXMgOZmB.mjs';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.DDoo3Iz3.mjs';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.DDoo3Iz3.mjs';
1
+ import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BOI0GA-f.mjs';
2
+ export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BOI0GA-f.mjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.CT-uUhZB.mjs';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.CT-uUhZB.mjs';
5
5
  import { z } from 'zod';
6
- export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.BydmpvCs.mjs';
6
+ export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.Dq24vYU7.mjs';
7
7
  import { BaseEvent } from '@develit-io/backend-sdk';
8
8
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
9
9
  import * as drizzle_orm from 'drizzle-orm';
@@ -306,6 +306,10 @@ declare const dbuAccountConfigSchema: z.ZodObject<{
306
306
  Y: "Y";
307
307
  N: "N";
308
308
  }>>;
309
+ realizeImmediate: z.ZodDefault<z.ZodEnum<{
310
+ Y: "Y";
311
+ N: "N";
312
+ }>>;
309
313
  channelCode: z.ZodDefault<z.ZodString>;
310
314
  actionTypeCode: z.ZodDefault<z.ZodString>;
311
315
  transactionTypeCode: z.ZodDefault<z.ZodString>;
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BXMgOZmB.js';
2
- export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BXMgOZmB.js';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.CVlQjnAl.js';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.CVlQjnAl.js';
1
+ import { I as IBankConnector, c as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.BOI0GA-f.js';
2
+ export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BATCH_MODES, N as BATCH_STATUES, N as BATCH_STATUSES, O as BankAccountWithLastSync, Q as BankCode, R as BatchInsertType, S as BatchLifecycle, T as BatchMode, U as BatchPayment, B as BatchSelectType, V as BatchStatus, W as CHARGE_BEARERS, X as CONNECTOR_KEYS, Y as COUNTRY_CODES, Z as CREDENTIALS_TYPES, _ as ChargeBearer, $ as CompletedBatch, b as ConfigEnvironmentBank, C as ConnectorConfig, a0 as CountryCode, a1 as CredentialsType, e as CurrencyCode, a2 as INSTRUCTION_PRIORITIES, a3 as InstructionPriority, L as LastSyncMetadata, a4 as PAYMENT_DIRECTIONS, a5 as PAYMENT_REQUEST_STATUSES, a6 as PAYMENT_STATUSES, a7 as PAYMENT_TYPES, a8 as PaymentDirection, a9 as PaymentFailedInsertType, aa as PaymentInsertType, ab as PaymentLifecycle, ac as PaymentPreparedInsertType, ad as PaymentStatus, ae as ProcessingBatch, af as ReadyToSignBatch, ag as ResolvedCredentials, ah as TOKEN_TYPES, ai as TokenType, aj as accountCredentialsInsertSchema, ak as accountCredentialsSelectSchema, al as accountCredentialsUpdateSchema, am as accountInsertSchema, an as accountSelectSchema, ao as accountUpdateSchema, ap as hasPaymentAccountAssigned, aq as isBatchAuthorized, ar as isBatchCompleted, as as isBatchFailed, at as isBatchInitiated, au as isBatchProcessing, av as isBatchReadyToSign, aw as isPaymentCompleted, ax as isPendingStatus, ay as isProcessedStatus, az as isTerminalStatus } from './shared/bank.BOI0GA-f.js';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.DDmes7Gx.js';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.DDmes7Gx.js';
5
5
  import { z } from 'zod';
6
- export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.BydmpvCs.js';
6
+ export { a as BankServiceEnv, B as BankServiceWranglerConfig } from './shared/bank.Dq24vYU7.js';
7
7
  import { BaseEvent } from '@develit-io/backend-sdk';
8
8
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
9
9
  import * as drizzle_orm from 'drizzle-orm';
@@ -306,6 +306,10 @@ declare const dbuAccountConfigSchema: z.ZodObject<{
306
306
  Y: "Y";
307
307
  N: "N";
308
308
  }>>;
309
+ realizeImmediate: z.ZodDefault<z.ZodEnum<{
310
+ Y: "Y";
311
+ N: "N";
312
+ }>>;
309
313
  channelCode: z.ZodDefault<z.ZodString>;
310
314
  actionTypeCode: z.ZodDefault<z.ZodString>;
311
315
  transactionTypeCode: z.ZodDefault<z.ZodString>;
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as accountCredentialsInsertSchema, e as accountCredentialsSelectSchema, f as accountCredentialsUpdateSchema, g as accountInsertSchema, h as accountSelectSchema, i as accountUpdateSchema, j as assignAccount, k as dbuAccountConfigSchema, l as hasPaymentAccountAssigned, m as isPaymentCompleted, n as isPendingStatus, o as isProcessedStatus, p as isTerminalStatus, q as ottInsertSchema, r as ottSelectSchema, s as ottUpdateSchema, t as signFinbricksJws, u as toBatchedPayment, v as toBatchedPaymentFromPaymentRequest, w as toCompletedPayment, x as toIncomingPayment, y as toPaymentRequestInsert, z as toPreparedPayment, A as useFinbricksFetch } from './shared/bank.Cwbl-Mjn.mjs';
1
+ export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as accountCredentialsInsertSchema, e as accountCredentialsSelectSchema, f as accountCredentialsUpdateSchema, g as accountInsertSchema, h as accountSelectSchema, i as accountUpdateSchema, j as assignAccount, k as dbuAccountConfigSchema, l as hasPaymentAccountAssigned, m as isPaymentCompleted, n as isPendingStatus, o as isProcessedStatus, p as isTerminalStatus, q as ottInsertSchema, r as ottSelectSchema, s as ottUpdateSchema, t as signFinbricksJws, u as toBatchedPayment, v as toBatchedPaymentFromPaymentRequest, w as toCompletedPayment, x as toIncomingPayment, y as toPaymentRequestInsert, z as toPreparedPayment, A as useFinbricksFetch } from './shared/bank.CL02VO9K.mjs';
2
2
  export { A as ACCOUNT_STATUSES, B as BATCH_MODES, a as BATCH_STATUES, a as BATCH_STATUSES, C as CHARGE_BEARERS, b as CONNECTOR_KEYS, c as COUNTRY_CODES, d as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, P as PAYMENT_DIRECTIONS, e as PAYMENT_REQUEST_STATUSES, f as PAYMENT_STATUSES, g as PAYMENT_TYPES, T as TOKEN_TYPES } from './shared/bank.BzDNLxB_.mjs';
3
3
  export { i as isBatchAuthorized, a as isBatchCompleted, b as isBatchFailed, c as isBatchInitiated, d as isBatchProcessing, e as isBatchReadyToSign } from './shared/bank.XqSw509X.mjs';
4
4
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {