@develit-services/bank 0.7.2 → 0.7.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.
@@ -11,7 +11,7 @@ require('date-fns');
11
11
  require('jose');
12
12
  const drizzleOrm = require('drizzle-orm');
13
13
  require('node:crypto');
14
- const mock_connector = require('../shared/bank.CNXTZfXB.cjs');
14
+ const mock_connector = require('../shared/bank.CBQJX5Zr.cjs');
15
15
  require('../shared/bank.DlW1XNug.cjs');
16
16
  require('drizzle-orm/relations');
17
17
  require('drizzle-orm/sqlite-core');
@@ -9,7 +9,7 @@ import 'date-fns';
9
9
  import 'jose';
10
10
  import { eq, sql, inArray, and, asc, desc, gte, lte } from 'drizzle-orm';
11
11
  import 'node:crypto';
12
- import { i as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment } from '../shared/bank.4MQtZVnP.mjs';
12
+ import { i as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment } from '../shared/bank.wq0LUeFW.mjs';
13
13
  import '../shared/bank.CTtFAN03.mjs';
14
14
  import 'drizzle-orm/relations';
15
15
  import 'drizzle-orm/sqlite-core';
@@ -3,7 +3,7 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const drizzle = require('../shared/bank.CTqIXnHg.cjs');
5
5
  const batchLifecycle = require('../shared/bank.Bg3Pdwm4.cjs');
6
- const mock_connector = require('../shared/bank.CNXTZfXB.cjs');
6
+ const mock_connector = require('../shared/bank.CBQJX5Zr.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
8
  const cloudflare_workers = require('cloudflare:workers');
9
9
  const cloudflare_workflows = require('cloudflare:workflows');
@@ -144,7 +144,11 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
144
144
  result = await initiateBatchByType();
145
145
  } catch (err) {
146
146
  const message = err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : String(err);
147
- throw new cloudflare_workflows.NonRetryableError(message);
147
+ const status = typeof err === "object" && err !== null && "status" in err ? Number(err.status) : 0;
148
+ if (status >= 400 && status < 500) {
149
+ throw new cloudflare_workflows.NonRetryableError(message);
150
+ }
151
+ throw new Error(message);
148
152
  }
149
153
  const {
150
154
  authorizationUrls,
@@ -1,7 +1,7 @@
1
1
  import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
2
2
  import { t as tables, g as getBatchByIdQuery, c as checksum, u as upsertBatchCommand, a as getAccountByIdQuery, i as importAesKey, b as getCredentialsByAccountId, d as createPaymentCommand } from '../shared/bank.e8T8fQDG.mjs';
3
3
  import { f as isBatchSigned, a as isBatchFailed, c as isBatchOpen, g as isPaymentCompleted } from '../shared/bank.CbAwwIhZ.mjs';
4
- import { h as toPreparedPayment, i as initiateConnector, f as toCompletedPayment } from '../shared/bank.4MQtZVnP.mjs';
4
+ import { h as toPreparedPayment, i as initiateConnector, f as toCompletedPayment } from '../shared/bank.wq0LUeFW.mjs';
5
5
  import { eq } from 'drizzle-orm';
6
6
  import { WorkflowEntrypoint } from 'cloudflare:workers';
7
7
  import { NonRetryableError } from 'cloudflare:workflows';
@@ -142,7 +142,11 @@ class BankProcessBatch extends WorkflowEntrypoint {
142
142
  result = await initiateBatchByType();
143
143
  } catch (err) {
144
144
  const message = err instanceof Error ? err.message : typeof err === "object" && err !== null && "message" in err ? String(err.message) : String(err);
145
- throw new NonRetryableError(message);
145
+ const status = typeof err === "object" && err !== null && "status" in err ? Number(err.status) : 0;
146
+ if (status >= 400 && status < 500) {
147
+ throw new NonRetryableError(message);
148
+ }
149
+ throw new Error(message);
146
150
  }
147
151
  const {
148
152
  authorizationUrls,
@@ -583,7 +583,7 @@ class FinbricksConnector extends IBankConnector {
583
583
  );
584
584
  if (error || !response) {
585
585
  console.error("FINBRICKS BATCH ERROR", error);
586
- throw backendSdk.createInternalError(error);
586
+ throw error ?? backendSdk.createInternalError(null);
587
587
  }
588
588
  const initiatedAt = /* @__PURE__ */ new Date();
589
589
  return {
@@ -781,7 +781,7 @@ class FinbricksConnector extends IBankConnector {
781
781
  const [response, error] = await fetchTransactions(cursor);
782
782
  if (error || !response) {
783
783
  console.error(error, "TRANSACTIONS GET ERROR");
784
- throw backendSdk.createInternalError(error);
784
+ throw error ?? backendSdk.createInternalError(null);
785
785
  }
786
786
  const { transactions, links } = response;
787
787
  cursor = links?.[0]?.value || null;
@@ -581,7 +581,7 @@ class FinbricksConnector extends IBankConnector {
581
581
  );
582
582
  if (error || !response) {
583
583
  console.error("FINBRICKS BATCH ERROR", error);
584
- throw createInternalError(error);
584
+ throw error ?? createInternalError(null);
585
585
  }
586
586
  const initiatedAt = /* @__PURE__ */ new Date();
587
587
  return {
@@ -779,7 +779,7 @@ class FinbricksConnector extends IBankConnector {
779
779
  const [response, error] = await fetchTransactions(cursor);
780
780
  if (error || !response) {
781
781
  console.error(error, "TRANSACTIONS GET ERROR");
782
- throw createInternalError(error);
782
+ throw error ?? createInternalError(null);
783
783
  }
784
784
  const { transactions, links } = response;
785
785
  cursor = links?.[0]?.value || null;
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const mock_connector = require('./shared/bank.CNXTZfXB.cjs');
3
+ const mock_connector = require('./shared/bank.CBQJX5Zr.cjs');
4
4
  const payment_schema = require('./shared/bank.D7kwLMqF.cjs');
5
5
  const batchLifecycle = require('./shared/bank.Bg3Pdwm4.cjs');
6
6
  const generalCodes = require('@develit-io/general-codes');
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, e as batchTransform, s as signFinbricksJws, t as toBatchedPayment, f as toCompletedPayment, g as toIncomingPayment, h as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.4MQtZVnP.mjs';
1
+ export { D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, e as batchTransform, s as signFinbricksJws, t as toBatchedPayment, f as toCompletedPayment, g as toIncomingPayment, h as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.wq0LUeFW.mjs';
2
2
  export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, a as CONNECTOR_KEYS, b as COUNTRY_CODES, c as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, P as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, e as PAYMENT_TYPES, T as TOKEN_TYPES, f as accountCredentialsInsertSchema, g as accountCredentialsSelectSchema, h as accountCredentialsUpdateSchema, i as accountInsertSchema, j as accountSelectSchema, k as accountUpdateSchema, o as ottInsertSchema, l as ottSelectSchema, m as ottUpdateSchema } from './shared/bank.BnIYdBEF.mjs';
3
3
  export { h as hasPaymentAccountAssigned, i as isBatchCompleted, a as isBatchFailed, b as isBatchInitiated, c as isBatchOpen, d as isBatchProcessing, e as isBatchReadyToSign, f as isBatchSigned, g as isPaymentCompleted, j as isPaymentPrepared } from './shared/bank.CbAwwIhZ.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": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {