@festapp/banksync 0.2.4 → 0.2.5

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,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// src/normalize.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;// src/normalize.ts
2
2
  var ISO_ALIASES = {
3
3
  "k\u010D": "CZK",
4
4
  "kc": "CZK",
@@ -575,6 +575,17 @@ var FioTokenInvalidOrInactive = (_class = class extends FioApiError {
575
575
  this.name = "FioTokenInvalidOrInactive";
576
576
  }
577
577
  }, _class);
578
+ var FioReceivingAccountMismatch = (_class2 = class extends Error {
579
+ constructor(expectedAccount, receivedAccount) {
580
+ super("fio_receiving_account_mismatch");_class2.prototype.__init2.call(this);;
581
+ this.expectedAccount = expectedAccount;
582
+ this.receivedAccount = receivedAccount;
583
+ this.name = "FioReceivingAccountMismatch";
584
+ }
585
+
586
+
587
+ __init2() {this.code = "fio_receiving_account_mismatch"}
588
+ }, _class2);
578
589
  var FioRateLimited = class extends FioApiError {
579
590
  constructor(status, retryAfterS) {
580
591
  super(`Fio API ${status}`, status);
@@ -743,4 +754,5 @@ async function fetchFioStatement(token, from, to, proxy) {
743
754
 
744
755
 
745
756
 
746
- exports.normalizeCurrency = normalizeCurrency; exports.toCents = toCents; exports.decimalToCents = decimalToCents; exports.BANK_CODES = BANK_CODES; exports.detectProvider = detectProvider; exports.parseEmail = parseEmail; exports.encodeRf = encodeRf; exports.decodeRf = decodeRf; exports.resolveVariableSymbol = resolveVariableSymbol; exports.extractReferenceCandidates = extractReferenceCandidates; exports.buildWebhookEnvelope = buildWebhookEnvelope; exports.signWebhook = signWebhook; exports.WebhookVerificationError = WebhookVerificationError; exports.verifyWebhook = verifyWebhook; exports.FioApiError = FioApiError; exports.FioTokenInvalidOrInactive = FioTokenInvalidOrInactive; exports.FioRateLimited = FioRateLimited; exports.FioTransientFailure = FioTransientFailure; exports.fetchNewTransactions = fetchNewTransactions; exports.setFioPointer = setFioPointer; exports.mapFioTransaction = mapFioTransaction; exports.fetchFioStatement = fetchFioStatement;
757
+
758
+ exports.normalizeCurrency = normalizeCurrency; exports.toCents = toCents; exports.decimalToCents = decimalToCents; exports.BANK_CODES = BANK_CODES; exports.detectProvider = detectProvider; exports.parseEmail = parseEmail; exports.encodeRf = encodeRf; exports.decodeRf = decodeRf; exports.resolveVariableSymbol = resolveVariableSymbol; exports.extractReferenceCandidates = extractReferenceCandidates; exports.buildWebhookEnvelope = buildWebhookEnvelope; exports.signWebhook = signWebhook; exports.WebhookVerificationError = WebhookVerificationError; exports.verifyWebhook = verifyWebhook; exports.FioApiError = FioApiError; exports.FioTokenInvalidOrInactive = FioTokenInvalidOrInactive; exports.FioReceivingAccountMismatch = FioReceivingAccountMismatch; exports.FioRateLimited = FioRateLimited; exports.FioTransientFailure = FioTransientFailure; exports.fetchNewTransactions = fetchNewTransactions; exports.setFioPointer = setFioPointer; exports.mapFioTransaction = mapFioTransaction; exports.fetchFioStatement = fetchFioStatement;
@@ -575,6 +575,17 @@ var FioTokenInvalidOrInactive = class extends FioApiError {
575
575
  this.name = "FioTokenInvalidOrInactive";
576
576
  }
577
577
  };
578
+ var FioReceivingAccountMismatch = class extends Error {
579
+ constructor(expectedAccount, receivedAccount) {
580
+ super("fio_receiving_account_mismatch");
581
+ this.expectedAccount = expectedAccount;
582
+ this.receivedAccount = receivedAccount;
583
+ this.name = "FioReceivingAccountMismatch";
584
+ }
585
+ expectedAccount;
586
+ receivedAccount;
587
+ code = "fio_receiving_account_mismatch";
588
+ };
578
589
  var FioRateLimited = class extends FioApiError {
579
590
  constructor(status, retryAfterS) {
580
591
  super(`Fio API ${status}`, status);
@@ -737,6 +748,7 @@ export {
737
748
  verifyWebhook,
738
749
  FioApiError,
739
750
  FioTokenInvalidOrInactive,
751
+ FioReceivingAccountMismatch,
740
752
  FioRateLimited,
741
753
  FioTransientFailure,
742
754
  fetchNewTransactions,
@@ -11,7 +11,8 @@
11
11
 
12
12
 
13
13
 
14
- var _chunk5SYCSFXKcjs = require('./chunk-5SYCSFXK.cjs');
14
+
15
+ var _chunkLZYEDVHQcjs = require('./chunk-LZYEDVHQ.cjs');
15
16
 
16
17
  // src/mime.ts
17
18
  var _postalmime = require('postal-mime'); var _postalmime2 = _interopRequireDefault(_postalmime);
@@ -68,13 +69,13 @@ function classifyEmail(extracted, identity, account, allowlist) {
68
69
  if (account.ingest_mode === "api") {
69
70
  return { kind: "reject", reason: "email_ingest_disabled", bankAccountId: account.id, received: false };
70
71
  }
71
- const provider = _chunk5SYCSFXKcjs.detectProvider.call(void 0, extracted.text, account.account_number);
72
+ const provider = _chunkLZYEDVHQcjs.detectProvider.call(void 0, extracted.text, account.account_number);
72
73
  if (provider === "unknown") {
73
74
  return { kind: "reject", reason: `unknown_provider: ${account.account_number}`, bankAccountId: account.id, received: true };
74
75
  }
75
76
  let parsed;
76
77
  try {
77
- parsed = _chunk5SYCSFXKcjs.parseEmail.call(void 0, extracted.text, provider);
78
+ parsed = _chunkLZYEDVHQcjs.parseEmail.call(void 0, extracted.text, provider);
78
79
  } catch (err) {
79
80
  return { kind: "reject", reason: `${err}`.replace(/^Error:\s*/, ""), bankAccountId: account.id, received: true };
80
81
  }
@@ -611,7 +612,7 @@ async function insertTransaction(db, args) {
611
612
  const v2 = _optionalChain([schema, 'optionalAccess', _16 => _16.value]) === "11";
612
613
  const p = {
613
614
  ...args.payload,
614
- vs: v2 ? _nullishCoalesce(_nullishCoalesce(args.payload.raw_vs, () => ( args.payload.vs)), () => ( null)) : _chunk5SYCSFXKcjs.resolveVariableSymbol.call(void 0, args.payload)
615
+ vs: v2 ? _nullishCoalesce(_nullishCoalesce(args.payload.raw_vs, () => ( args.payload.vs)), () => ( null)) : _chunkLZYEDVHQcjs.resolveVariableSymbol.call(void 0, args.payload)
615
616
  };
616
617
  if (p.transaction_id != null && p.source === "fio_api") {
617
618
  const hit = await db.prepare(SQL_FIND_DUPLICATE_FIO).bind(args.bank_account_id, p.transaction_id).first();
@@ -1228,7 +1229,7 @@ async function ensureDeliveryJobs(db, transactionId, cutover) {
1228
1229
  for (const row of candidates.results) {
1229
1230
  const { pairing_code, consumer_app_id, event_version, created_at: _createdAt, ...transaction } = row;
1230
1231
  const deliveryId = _ulid.ulid.call(void 0, );
1231
- const envelope = _chunk5SYCSFXKcjs.buildWebhookEnvelope.call(void 0, {
1232
+ const envelope = _chunkLZYEDVHQcjs.buildWebhookEnvelope.call(void 0, {
1232
1233
  delivery_id: deliveryId,
1233
1234
  pairing_code: row.pairing_code,
1234
1235
  transaction,
@@ -1550,7 +1551,7 @@ async function httpResult(response, deliveryId, usedPrevSecret, primaryStatus) {
1550
1551
  return "receipt" in parsed ? { kind: "http", httpStatus: response.status, usedPrevSecret, primaryStatus, receipt: parsed.receipt } : { kind: "http", httpStatus: response.status, usedPrevSecret, primaryStatus, receiptError: parsed.error };
1551
1552
  }
1552
1553
  async function postSigned(url2, envelope, secret) {
1553
- const signed = await _chunk5SYCSFXKcjs.signWebhook.call(void 0, { envelope, secret });
1554
+ const signed = await _chunkLZYEDVHQcjs.signWebhook.call(void 0, { envelope, secret });
1554
1555
  const controller = new AbortController();
1555
1556
  const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
1556
1557
  try {
@@ -2708,7 +2709,7 @@ async function recoverBankAccount(db, account, env, proxy) {
2708
2709
  let statement;
2709
2710
  if (batch.cipher !== null && batch.key_version !== null) statement = JSON.parse(await decryptSecret(batch.cipher, batch.key_version, env));
2710
2711
  else {
2711
- statement = await _chunk5SYCSFXKcjs.fetchFioStatement.call(void 0, credential, batch.from_date, batch.to_date, proxy);
2712
+ statement = await _chunkLZYEDVHQcjs.fetchFioStatement.call(void 0, credential, batch.from_date, batch.to_date, proxy);
2712
2713
  await renew();
2713
2714
  const encrypted = await encryptSecret(JSON.stringify(statement), env);
2714
2715
  await db.prepare(`UPDATE bank_recovery_batches SET cipher=?,key_version=?,state='spooled' WHERE id=?`).bind(encrypted.cipher, encrypted.keyVersion, batch.id).run();
@@ -2716,11 +2717,14 @@ async function recoverBankAccount(db, account, env, proxy) {
2716
2717
  const identity = String(_nullishCoalesce(_optionalChain([statement, 'access', _57 => _57.info, 'optionalAccess', _58 => _58.iban]), () => ( ""))).replace(/\s/g, "").toUpperCase();
2717
2718
  const domestic = `${_nullishCoalesce(_optionalChain([statement, 'access', _59 => _59.info, 'optionalAccess', _60 => _60.accountId]), () => ( ""))}/${_nullishCoalesce(_optionalChain([statement, 'access', _61 => _61.info, 'optionalAccess', _62 => _62.bankId]), () => ( ""))}`;
2718
2719
  const expected = account.account_number.replace(/\s/g, "").toUpperCase();
2719
- if (expected !== identity && expected !== domestic) throw new Error("fio_receiving_account_mismatch");
2720
+ if (expected !== identity && expected !== domestic) {
2721
+ await db.prepare("UPDATE bank_recovery_batches SET cipher=NULL,key_version=NULL,state='fetching' WHERE id=?").bind(batch.id).run();
2722
+ throw new (0, _chunkLZYEDVHQcjs.FioReceivingAccountMismatch)(expected, identity || domestic);
2723
+ }
2720
2724
  let inserted = 0, skipped = 0;
2721
2725
  for (const raw of statement.transactions) {
2722
2726
  await renew();
2723
- const mapped = _chunk5SYCSFXKcjs.mapFioTransaction.call(void 0, raw);
2727
+ const mapped = _chunkLZYEDVHQcjs.mapFioTransaction.call(void 0, raw);
2724
2728
  if (!mapped || mapped.identity_kind !== "movement") throw new Error("fio_unverified_movement");
2725
2729
  if (mapped.currency !== String(_nullishCoalesce(_optionalChain([statement, 'access', _63 => _63.info, 'optionalAccess', _64 => _64.currency]), () => ( ""))).toUpperCase()) throw new Error("fio_statement_currency_mismatch");
2726
2730
  const result = await insertTransaction(db, { bank_account_id: account.id, payload: mapped });
@@ -2969,7 +2973,7 @@ async function runBankApiSync(env, account) {
2969
2973
  const token = await decryptSecret(account.api_token_cipher, account.api_token_key_ver, env);
2970
2974
  if (isBackfill && account.api_last_success_at === null) {
2971
2975
  await markBankAccountApiFetchStarted(env.DB, account.id);
2972
- await _chunk5SYCSFXKcjs.setFioPointer.call(void 0, token, yyyyMmDdDaysAgo(90), fioProxyConfig(env));
2976
+ await _chunkLZYEDVHQcjs.setFioPointer.call(void 0, token, yyyyMmDdDaysAgo(90), fioProxyConfig(env));
2973
2977
  await markBankAccountApiPointerSet(env.DB, account.id);
2974
2978
  await writeEvent(env.DB, {
2975
2979
  event_type: "api_pointer_set",
@@ -2989,7 +2993,7 @@ async function runBankApiSync(env, account) {
2989
2993
  };
2990
2994
  }
2991
2995
  await markBankAccountApiFetchStarted(env.DB, account.id);
2992
- const raw = await _chunk5SYCSFXKcjs.fetchNewTransactions.call(void 0, token, fioProxyConfig(env));
2996
+ const raw = await _chunkLZYEDVHQcjs.fetchNewTransactions.call(void 0, token, fioProxyConfig(env));
2993
2997
  let inserted = 0;
2994
2998
  let skippedDuplicate = 0;
2995
2999
  let skippedOutgoing = 0;
@@ -2998,7 +3002,7 @@ async function runBankApiSync(env, account) {
2998
3002
  for (const item of raw) {
2999
3003
  let mapped;
3000
3004
  try {
3001
- mapped = _chunk5SYCSFXKcjs.mapFioTransaction.call(void 0, item);
3005
+ mapped = _chunkLZYEDVHQcjs.mapFioTransaction.call(void 0, item);
3002
3006
  } catch (err) {
3003
3007
  parseErrors++;
3004
3008
  await insertParseLog(env.DB, {
@@ -3053,8 +3057,8 @@ async function runBankApiSync(env, account) {
3053
3057
  deferred: false
3054
3058
  };
3055
3059
  } catch (err) {
3056
- await markBankAccountApiFetchFailure(env.DB, account.id, err instanceof _chunk5SYCSFXKcjs.FioTokenInvalidOrInactive ? err.code : String(err));
3057
- if (err instanceof _chunk5SYCSFXKcjs.FioRateLimited) {
3060
+ await markBankAccountApiFetchFailure(env.DB, account.id, err instanceof _chunkLZYEDVHQcjs.FioTokenInvalidOrInactive || err instanceof _chunkLZYEDVHQcjs.FioReceivingAccountMismatch ? err.code : String(err));
3061
+ if (err instanceof _chunkLZYEDVHQcjs.FioRateLimited) {
3058
3062
  await writeEvent(env.DB, {
3059
3063
  event_type: "api_rate_limited",
3060
3064
  bank_account_id: account.id,
@@ -3079,11 +3083,11 @@ async function runDueBankApiSyncs(env) {
3079
3083
  deferred: result.deferred
3080
3084
  });
3081
3085
  } catch (err) {
3082
- if (err instanceof _chunk5SYCSFXKcjs.FioRateLimited) {
3086
+ if (err instanceof _chunkLZYEDVHQcjs.FioRateLimited) {
3083
3087
  log("api_rate_limited", { bank_account_id: account.id, account_type: account.account_type, retry_after_s: err.retryAfterS });
3084
3088
  continue;
3085
3089
  }
3086
- if (err instanceof _chunk5SYCSFXKcjs.FioTransientFailure) {
3090
+ if (err instanceof _chunkLZYEDVHQcjs.FioTransientFailure) {
3087
3091
  logError("api_transient_failure", err, { bank_account_id: account.id, account_type: account.account_type });
3088
3092
  continue;
3089
3093
  }
@@ -3551,10 +3555,13 @@ async function dispatch(url2, req, env, authCtx, bodyText) {
3551
3555
  api_backfill_done: _nullishCoalesce(_optionalChain([updated, 'optionalAccess', _99 => _99.api_backfill_done]), () => ( false))
3552
3556
  });
3553
3557
  } catch (err) {
3554
- if (err instanceof _chunk5SYCSFXKcjs.FioTokenInvalidOrInactive) {
3558
+ if (err instanceof _chunkLZYEDVHQcjs.FioReceivingAccountMismatch) {
3559
+ return jsonResponse({ error: err.code, expected_account: err.expectedAccount, received_account: err.receivedAccount }, 422);
3560
+ }
3561
+ if (err instanceof _chunkLZYEDVHQcjs.FioTokenInvalidOrInactive) {
3555
3562
  return jsonResponse({ error: err.code, bank_http_status: err.status }, 422);
3556
3563
  }
3557
- if (err instanceof _chunk5SYCSFXKcjs.FioRateLimited || err instanceof _chunk5SYCSFXKcjs.FioTransientFailure) {
3564
+ if (err instanceof _chunkLZYEDVHQcjs.FioRateLimited || err instanceof _chunkLZYEDVHQcjs.FioTransientFailure) {
3558
3565
  logError("fio_api_manual_sync_failed", err, { bank_account_id: id });
3559
3566
  return jsonResponse({ error: "fio_api_transient_failure" }, 503);
3560
3567
  }
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  FioRateLimited,
3
+ FioReceivingAccountMismatch,
3
4
  FioTokenInvalidOrInactive,
4
5
  FioTransientFailure,
5
6
  buildWebhookEnvelope,
@@ -11,7 +12,7 @@ import {
11
12
  resolveVariableSymbol,
12
13
  setFioPointer,
13
14
  signWebhook
14
- } from "./chunk-JFSJO3OJ.js";
15
+ } from "./chunk-RCK3ZC4R.js";
15
16
 
16
17
  // src/mime.ts
17
18
  import PostalMime from "postal-mime";
@@ -2716,7 +2717,10 @@ async function recoverBankAccount(db, account, env, proxy) {
2716
2717
  const identity = String(statement.info?.iban ?? "").replace(/\s/g, "").toUpperCase();
2717
2718
  const domestic = `${statement.info?.accountId ?? ""}/${statement.info?.bankId ?? ""}`;
2718
2719
  const expected = account.account_number.replace(/\s/g, "").toUpperCase();
2719
- if (expected !== identity && expected !== domestic) throw new Error("fio_receiving_account_mismatch");
2720
+ if (expected !== identity && expected !== domestic) {
2721
+ await db.prepare("UPDATE bank_recovery_batches SET cipher=NULL,key_version=NULL,state='fetching' WHERE id=?").bind(batch.id).run();
2722
+ throw new FioReceivingAccountMismatch(expected, identity || domestic);
2723
+ }
2720
2724
  let inserted = 0, skipped = 0;
2721
2725
  for (const raw of statement.transactions) {
2722
2726
  await renew();
@@ -3053,7 +3057,7 @@ async function runBankApiSync(env, account) {
3053
3057
  deferred: false
3054
3058
  };
3055
3059
  } catch (err) {
3056
- await markBankAccountApiFetchFailure(env.DB, account.id, err instanceof FioTokenInvalidOrInactive ? err.code : String(err));
3060
+ await markBankAccountApiFetchFailure(env.DB, account.id, err instanceof FioTokenInvalidOrInactive || err instanceof FioReceivingAccountMismatch ? err.code : String(err));
3057
3061
  if (err instanceof FioRateLimited) {
3058
3062
  await writeEvent(env.DB, {
3059
3063
  event_type: "api_rate_limited",
@@ -3551,6 +3555,9 @@ async function dispatch(url2, req, env, authCtx, bodyText) {
3551
3555
  api_backfill_done: updated?.api_backfill_done ?? false
3552
3556
  });
3553
3557
  } catch (err) {
3558
+ if (err instanceof FioReceivingAccountMismatch) {
3559
+ return jsonResponse({ error: err.code, expected_account: err.expectedAccount, received_account: err.receivedAccount }, 422);
3560
+ }
3554
3561
  if (err instanceof FioTokenInvalidOrInactive) {
3555
3562
  return jsonResponse({ error: err.code, bank_http_status: err.status }, 422);
3556
3563
  }
package/dist/index.cjs CHANGED
@@ -20,8 +20,8 @@
20
20
 
21
21
 
22
22
 
23
- var _chunk5SYCSFXKcjs = require('./chunk-5SYCSFXK.cjs');
24
23
 
24
+ var _chunkLZYEDVHQcjs = require('./chunk-LZYEDVHQ.cjs');
25
25
 
26
26
 
27
27
 
@@ -43,4 +43,6 @@ var _chunk5SYCSFXKcjs = require('./chunk-5SYCSFXK.cjs');
43
43
 
44
44
 
45
45
 
46
- exports.BANK_CODES = _chunk5SYCSFXKcjs.BANK_CODES; exports.FioApiError = _chunk5SYCSFXKcjs.FioApiError; exports.FioRateLimited = _chunk5SYCSFXKcjs.FioRateLimited; exports.FioTokenInvalidOrInactive = _chunk5SYCSFXKcjs.FioTokenInvalidOrInactive; exports.FioTransientFailure = _chunk5SYCSFXKcjs.FioTransientFailure; exports.WebhookVerificationError = _chunk5SYCSFXKcjs.WebhookVerificationError; exports.buildWebhookEnvelope = _chunk5SYCSFXKcjs.buildWebhookEnvelope; exports.decimalToCents = _chunk5SYCSFXKcjs.decimalToCents; exports.decodeRf = _chunk5SYCSFXKcjs.decodeRf; exports.detectProvider = _chunk5SYCSFXKcjs.detectProvider; exports.encodeRf = _chunk5SYCSFXKcjs.encodeRf; exports.extractReferenceCandidates = _chunk5SYCSFXKcjs.extractReferenceCandidates; exports.fetchNewTransactions = _chunk5SYCSFXKcjs.fetchNewTransactions; exports.mapFioTransaction = _chunk5SYCSFXKcjs.mapFioTransaction; exports.normalizeCurrency = _chunk5SYCSFXKcjs.normalizeCurrency; exports.parseEmail = _chunk5SYCSFXKcjs.parseEmail; exports.resolveVariableSymbol = _chunk5SYCSFXKcjs.resolveVariableSymbol; exports.setFioPointer = _chunk5SYCSFXKcjs.setFioPointer; exports.signWebhook = _chunk5SYCSFXKcjs.signWebhook; exports.toCents = _chunk5SYCSFXKcjs.toCents; exports.verifyWebhook = _chunk5SYCSFXKcjs.verifyWebhook;
46
+
47
+
48
+ exports.BANK_CODES = _chunkLZYEDVHQcjs.BANK_CODES; exports.FioApiError = _chunkLZYEDVHQcjs.FioApiError; exports.FioRateLimited = _chunkLZYEDVHQcjs.FioRateLimited; exports.FioReceivingAccountMismatch = _chunkLZYEDVHQcjs.FioReceivingAccountMismatch; exports.FioTokenInvalidOrInactive = _chunkLZYEDVHQcjs.FioTokenInvalidOrInactive; exports.FioTransientFailure = _chunkLZYEDVHQcjs.FioTransientFailure; exports.WebhookVerificationError = _chunkLZYEDVHQcjs.WebhookVerificationError; exports.buildWebhookEnvelope = _chunkLZYEDVHQcjs.buildWebhookEnvelope; exports.decimalToCents = _chunkLZYEDVHQcjs.decimalToCents; exports.decodeRf = _chunkLZYEDVHQcjs.decodeRf; exports.detectProvider = _chunkLZYEDVHQcjs.detectProvider; exports.encodeRf = _chunkLZYEDVHQcjs.encodeRf; exports.extractReferenceCandidates = _chunkLZYEDVHQcjs.extractReferenceCandidates; exports.fetchNewTransactions = _chunkLZYEDVHQcjs.fetchNewTransactions; exports.mapFioTransaction = _chunkLZYEDVHQcjs.mapFioTransaction; exports.normalizeCurrency = _chunkLZYEDVHQcjs.normalizeCurrency; exports.parseEmail = _chunkLZYEDVHQcjs.parseEmail; exports.resolveVariableSymbol = _chunkLZYEDVHQcjs.resolveVariableSymbol; exports.setFioPointer = _chunkLZYEDVHQcjs.setFioPointer; exports.signWebhook = _chunkLZYEDVHQcjs.signWebhook; exports.toCents = _chunkLZYEDVHQcjs.toCents; exports.verifyWebhook = _chunkLZYEDVHQcjs.verifyWebhook;
package/dist/index.d.cts CHANGED
@@ -95,6 +95,12 @@ declare class FioTokenInvalidOrInactive extends FioApiError {
95
95
  readonly code = "fio_token_invalid_or_inactive";
96
96
  constructor();
97
97
  }
98
+ declare class FioReceivingAccountMismatch extends Error {
99
+ readonly expectedAccount: string;
100
+ readonly receivedAccount: string;
101
+ readonly code = "fio_receiving_account_mismatch";
102
+ constructor(expectedAccount: string, receivedAccount: string);
103
+ }
98
104
  declare class FioRateLimited extends FioApiError {
99
105
  readonly retryAfterS: number | null;
100
106
  constructor(status: number, retryAfterS: number | null);
@@ -118,4 +124,4 @@ declare function fetchNewTransactions(token: string, proxy?: FioProxyConfig): Pr
118
124
  declare function setFioPointer(token: string, yyyyMmDd: string, proxy?: FioProxyConfig): Promise<void>;
119
125
  declare function mapFioTransaction(raw: FioTransaction): Omit<Transaction, 'id' | 'bank_account_id'> | null;
120
126
 
121
- export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, FioTokenInvalidOrInactive, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decimalToCents, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
127
+ export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, FioReceivingAccountMismatch, FioTokenInvalidOrInactive, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decimalToCents, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
package/dist/index.d.ts CHANGED
@@ -95,6 +95,12 @@ declare class FioTokenInvalidOrInactive extends FioApiError {
95
95
  readonly code = "fio_token_invalid_or_inactive";
96
96
  constructor();
97
97
  }
98
+ declare class FioReceivingAccountMismatch extends Error {
99
+ readonly expectedAccount: string;
100
+ readonly receivedAccount: string;
101
+ readonly code = "fio_receiving_account_mismatch";
102
+ constructor(expectedAccount: string, receivedAccount: string);
103
+ }
98
104
  declare class FioRateLimited extends FioApiError {
99
105
  readonly retryAfterS: number | null;
100
106
  constructor(status: number, retryAfterS: number | null);
@@ -118,4 +124,4 @@ declare function fetchNewTransactions(token: string, proxy?: FioProxyConfig): Pr
118
124
  declare function setFioPointer(token: string, yyyyMmDd: string, proxy?: FioProxyConfig): Promise<void>;
119
125
  declare function mapFioTransaction(raw: FioTransaction): Omit<Transaction, 'id' | 'bank_account_id'> | null;
120
126
 
121
- export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, FioTokenInvalidOrInactive, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decimalToCents, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
127
+ export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, FioReceivingAccountMismatch, FioTokenInvalidOrInactive, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decimalToCents, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  BANK_CODES,
3
3
  FioApiError,
4
4
  FioRateLimited,
5
+ FioReceivingAccountMismatch,
5
6
  FioTokenInvalidOrInactive,
6
7
  FioTransientFailure,
7
8
  WebhookVerificationError,
@@ -20,11 +21,12 @@ import {
20
21
  signWebhook,
21
22
  toCents,
22
23
  verifyWebhook
23
- } from "./chunk-JFSJO3OJ.js";
24
+ } from "./chunk-RCK3ZC4R.js";
24
25
  export {
25
26
  BANK_CODES,
26
27
  FioApiError,
27
28
  FioRateLimited,
29
+ FioReceivingAccountMismatch,
28
30
  FioTokenInvalidOrInactive,
29
31
  FioTransientFailure,
30
32
  WebhookVerificationError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@festapp/banksync",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Bank transaction ingestion for Cloudflare Workers: Czech bank email and Fio API parsing, durable deduplication, and signed webhook delivery.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.24.0",