@festapp/banksync 0.1.6 → 0.2.2
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.
- package/README.md +66 -8
- package/dist/{chunk-5QXHZGAW.js → chunk-3WM2GGFL.js} +66 -27
- package/dist/{chunk-PBN2BUNR.cjs → chunk-N7BVOSFN.cjs} +66 -27
- package/dist/cloudflare.cjs +344 -115
- package/dist/cloudflare.d.cts +3 -1
- package/dist/cloudflare.d.ts +3 -1
- package/dist/cloudflare.js +289 -60
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +11 -18
- package/dist/index.d.ts +11 -18
- package/dist/index.js +3 -1
- package/dist/{types-Cb5l2lXq.d.cts → types-DZX_B1qb.d.cts} +8 -2
- package/dist/{types-Cb5l2lXq.d.ts → types-DZX_B1qb.d.ts} +8 -2
- package/migrations/0011_complete_bank_facts.sql +52 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var _chunkPBN2BUNRcjs = require('./chunk-PBN2BUNR.cjs');
|
|
22
21
|
|
|
22
|
+
var _chunkN7BVOSFNcjs = require('./chunk-N7BVOSFN.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -39,4 +39,6 @@ var _chunkPBN2BUNRcjs = require('./chunk-PBN2BUNR.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
exports.BANK_CODES = _chunkN7BVOSFNcjs.BANK_CODES; exports.FioApiError = _chunkN7BVOSFNcjs.FioApiError; exports.FioRateLimited = _chunkN7BVOSFNcjs.FioRateLimited; exports.FioTransientFailure = _chunkN7BVOSFNcjs.FioTransientFailure; exports.WebhookVerificationError = _chunkN7BVOSFNcjs.WebhookVerificationError; exports.buildWebhookEnvelope = _chunkN7BVOSFNcjs.buildWebhookEnvelope; exports.decimalToCents = _chunkN7BVOSFNcjs.decimalToCents; exports.decodeRf = _chunkN7BVOSFNcjs.decodeRf; exports.detectProvider = _chunkN7BVOSFNcjs.detectProvider; exports.encodeRf = _chunkN7BVOSFNcjs.encodeRf; exports.extractReferenceCandidates = _chunkN7BVOSFNcjs.extractReferenceCandidates; exports.fetchNewTransactions = _chunkN7BVOSFNcjs.fetchNewTransactions; exports.mapFioTransaction = _chunkN7BVOSFNcjs.mapFioTransaction; exports.normalizeCurrency = _chunkN7BVOSFNcjs.normalizeCurrency; exports.parseEmail = _chunkN7BVOSFNcjs.parseEmail; exports.resolveVariableSymbol = _chunkN7BVOSFNcjs.resolveVariableSymbol; exports.setFioPointer = _chunkN7BVOSFNcjs.setFioPointer; exports.signWebhook = _chunkN7BVOSFNcjs.signWebhook; exports.toCents = _chunkN7BVOSFNcjs.toCents; exports.verifyWebhook = _chunkN7BVOSFNcjs.verifyWebhook;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Transaction, W as WebhookEnvelope } from './types-
|
|
2
|
-
export { B as BankAccount, a as WebhookConsumer, b as WebhookSubscription } from './types-
|
|
1
|
+
import { T as Transaction, W as WebhookEnvelope } from './types-DZX_B1qb.cjs';
|
|
2
|
+
export { B as BankAccount, a as WebhookConsumer, b as WebhookSubscription } from './types-DZX_B1qb.cjs';
|
|
3
3
|
|
|
4
4
|
declare const BANK_CODES: Record<string, string>;
|
|
5
5
|
type EmailProvider = 'fio_email' | 'airbank_email';
|
|
@@ -11,21 +11,11 @@ declare function parseEmail(text: string, provider: EmailProvider): ParsedEmailT
|
|
|
11
11
|
|
|
12
12
|
declare function normalizeCurrency(raw: string): string;
|
|
13
13
|
declare function toCents(amount: number, currency: string): number;
|
|
14
|
+
/** Convert a decimal representation without binary floating point rounding. */
|
|
15
|
+
declare function decimalToCents(raw: string, currency: string): number;
|
|
14
16
|
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* looks like in free text. banksync extracts *candidate* tokens; the billing
|
|
18
|
-
* resolver (`billing_credit_mark_paid`) decides which pending order they hit.
|
|
19
|
-
*
|
|
20
|
-
* Carriers, in descending confidence:
|
|
21
|
-
* 1. the structured `vs` field (Czech variable symbol)
|
|
22
|
-
* 2. a labelled `VS<digits>` / `/VS/<digits>` token in the message
|
|
23
|
-
* 3. an ISO 11649 `RF` creditor reference (our EUR/EPC rail wraps the VS in it)
|
|
24
|
-
* 4. a bare VS-shaped 6–10 digit run
|
|
25
|
-
*
|
|
26
|
-
* A candidate only ever credits when it EQUALS a pending order's ledger-unique
|
|
27
|
-
* VS and the amount/currency guard passes — so over-generating here is safe.
|
|
28
|
-
*/
|
|
17
|
+
/** Legacy v1 compatibility utilities. Canonical v2 bank facts do not infer order identifiers.
|
|
18
|
+
* Consumers own payment identification and their business rules. */
|
|
29
19
|
interface ReferenceSource {
|
|
30
20
|
vs?: string | null;
|
|
31
21
|
ss?: string | null;
|
|
@@ -34,7 +24,7 @@ interface ReferenceSource {
|
|
|
34
24
|
comment?: string | null;
|
|
35
25
|
}
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
27
|
+
* Legacy v1 projection value. A real structured VS
|
|
38
28
|
* wins. Otherwise only a checksum-valid RF carrying a 1-10 digit VS may fill
|
|
39
29
|
* the field; labelled/bare free-text candidates remain resolver hints and are
|
|
40
30
|
* never promoted into stored structured data.
|
|
@@ -55,6 +45,7 @@ declare function buildWebhookEnvelope(args: {
|
|
|
55
45
|
delivery_id: string;
|
|
56
46
|
pairing_code: string;
|
|
57
47
|
transaction: Transaction;
|
|
48
|
+
event_version?: '1' | '2';
|
|
58
49
|
}): WebhookEnvelope;
|
|
59
50
|
declare function signWebhook(args: {
|
|
60
51
|
envelope: WebhookEnvelope;
|
|
@@ -74,6 +65,8 @@ interface VerifyWebhookArgs {
|
|
|
74
65
|
signature: string;
|
|
75
66
|
toleranceSeconds?: number;
|
|
76
67
|
nowSeconds?: number;
|
|
68
|
+
/** Defaults to v1 for existing consumers. Festapp explicitly opts into v2. */
|
|
69
|
+
eventVersion?: '1' | '2';
|
|
77
70
|
}
|
|
78
71
|
/**
|
|
79
72
|
* Safe public verification contract. Consumers must durably claim the returned
|
|
@@ -118,4 +111,4 @@ declare function fetchNewTransactions(token: string, proxy?: FioProxyConfig): Pr
|
|
|
118
111
|
declare function setFioPointer(token: string, yyyyMmDd: string, proxy?: FioProxyConfig): Promise<void>;
|
|
119
112
|
declare function mapFioTransaction(raw: FioTransaction): Omit<Transaction, 'id' | 'bank_account_id'> | null;
|
|
120
113
|
|
|
121
|
-
export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
|
|
114
|
+
export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, 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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Transaction, W as WebhookEnvelope } from './types-
|
|
2
|
-
export { B as BankAccount, a as WebhookConsumer, b as WebhookSubscription } from './types-
|
|
1
|
+
import { T as Transaction, W as WebhookEnvelope } from './types-DZX_B1qb.js';
|
|
2
|
+
export { B as BankAccount, a as WebhookConsumer, b as WebhookSubscription } from './types-DZX_B1qb.js';
|
|
3
3
|
|
|
4
4
|
declare const BANK_CODES: Record<string, string>;
|
|
5
5
|
type EmailProvider = 'fio_email' | 'airbank_email';
|
|
@@ -11,21 +11,11 @@ declare function parseEmail(text: string, provider: EmailProvider): ParsedEmailT
|
|
|
11
11
|
|
|
12
12
|
declare function normalizeCurrency(raw: string): string;
|
|
13
13
|
declare function toCents(amount: number, currency: string): number;
|
|
14
|
+
/** Convert a decimal representation without binary floating point rounding. */
|
|
15
|
+
declare function decimalToCents(raw: string, currency: string): number;
|
|
14
16
|
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* looks like in free text. banksync extracts *candidate* tokens; the billing
|
|
18
|
-
* resolver (`billing_credit_mark_paid`) decides which pending order they hit.
|
|
19
|
-
*
|
|
20
|
-
* Carriers, in descending confidence:
|
|
21
|
-
* 1. the structured `vs` field (Czech variable symbol)
|
|
22
|
-
* 2. a labelled `VS<digits>` / `/VS/<digits>` token in the message
|
|
23
|
-
* 3. an ISO 11649 `RF` creditor reference (our EUR/EPC rail wraps the VS in it)
|
|
24
|
-
* 4. a bare VS-shaped 6–10 digit run
|
|
25
|
-
*
|
|
26
|
-
* A candidate only ever credits when it EQUALS a pending order's ledger-unique
|
|
27
|
-
* VS and the amount/currency guard passes — so over-generating here is safe.
|
|
28
|
-
*/
|
|
17
|
+
/** Legacy v1 compatibility utilities. Canonical v2 bank facts do not infer order identifiers.
|
|
18
|
+
* Consumers own payment identification and their business rules. */
|
|
29
19
|
interface ReferenceSource {
|
|
30
20
|
vs?: string | null;
|
|
31
21
|
ss?: string | null;
|
|
@@ -34,7 +24,7 @@ interface ReferenceSource {
|
|
|
34
24
|
comment?: string | null;
|
|
35
25
|
}
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
27
|
+
* Legacy v1 projection value. A real structured VS
|
|
38
28
|
* wins. Otherwise only a checksum-valid RF carrying a 1-10 digit VS may fill
|
|
39
29
|
* the field; labelled/bare free-text candidates remain resolver hints and are
|
|
40
30
|
* never promoted into stored structured data.
|
|
@@ -55,6 +45,7 @@ declare function buildWebhookEnvelope(args: {
|
|
|
55
45
|
delivery_id: string;
|
|
56
46
|
pairing_code: string;
|
|
57
47
|
transaction: Transaction;
|
|
48
|
+
event_version?: '1' | '2';
|
|
58
49
|
}): WebhookEnvelope;
|
|
59
50
|
declare function signWebhook(args: {
|
|
60
51
|
envelope: WebhookEnvelope;
|
|
@@ -74,6 +65,8 @@ interface VerifyWebhookArgs {
|
|
|
74
65
|
signature: string;
|
|
75
66
|
toleranceSeconds?: number;
|
|
76
67
|
nowSeconds?: number;
|
|
68
|
+
/** Defaults to v1 for existing consumers. Festapp explicitly opts into v2. */
|
|
69
|
+
eventVersion?: '1' | '2';
|
|
77
70
|
}
|
|
78
71
|
/**
|
|
79
72
|
* Safe public verification contract. Consumers must durably claim the returned
|
|
@@ -118,4 +111,4 @@ declare function fetchNewTransactions(token: string, proxy?: FioProxyConfig): Pr
|
|
|
118
111
|
declare function setFioPointer(token: string, yyyyMmDd: string, proxy?: FioProxyConfig): Promise<void>;
|
|
119
112
|
declare function mapFioTransaction(raw: FioTransaction): Omit<Transaction, 'id' | 'bank_account_id'> | null;
|
|
120
113
|
|
|
121
|
-
export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, type FioTransaction, FioTransientFailure, type ParsedEmailTransaction, type ReferenceSource, type SignedWebhook, Transaction, type VerifyWebhookArgs, WebhookEnvelope, type WebhookVerificationCode, WebhookVerificationError, buildWebhookEnvelope, decodeRf, detectProvider, encodeRf, extractReferenceCandidates, fetchNewTransactions, mapFioTransaction, normalizeCurrency, parseEmail, resolveVariableSymbol, setFioPointer, signWebhook, toCents, verifyWebhook };
|
|
114
|
+
export { BANK_CODES, type EmailProvider, FioApiError, type FioColumn, type FioProxyConfig, FioRateLimited, 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
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
FioTransientFailure,
|
|
6
6
|
WebhookVerificationError,
|
|
7
7
|
buildWebhookEnvelope,
|
|
8
|
+
decimalToCents,
|
|
8
9
|
decodeRf,
|
|
9
10
|
detectProvider,
|
|
10
11
|
encodeRf,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
signWebhook,
|
|
19
20
|
toCents,
|
|
20
21
|
verifyWebhook
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3WM2GGFL.js";
|
|
22
23
|
export {
|
|
23
24
|
BANK_CODES,
|
|
24
25
|
FioApiError,
|
|
@@ -26,6 +27,7 @@ export {
|
|
|
26
27
|
FioTransientFailure,
|
|
27
28
|
WebhookVerificationError,
|
|
28
29
|
buildWebhookEnvelope,
|
|
30
|
+
decimalToCents,
|
|
29
31
|
decodeRf,
|
|
30
32
|
detectProvider,
|
|
31
33
|
encodeRf,
|
|
@@ -20,7 +20,7 @@ interface BankAccount {
|
|
|
20
20
|
interface Transaction {
|
|
21
21
|
id: number;
|
|
22
22
|
bank_account_id: number;
|
|
23
|
-
/** INTEGER, lowest unit (e.g. 1990 = 19.90 CZK),
|
|
23
|
+
/** INTEGER, lowest unit (e.g. 1990 = 19.90 CZK), signed exact minor units */
|
|
24
24
|
amount_cents: number;
|
|
25
25
|
/** ISO 4217 alpha-3 uppercase (CZK/EUR/USD) */
|
|
26
26
|
currency: string;
|
|
@@ -42,6 +42,12 @@ interface Transaction {
|
|
|
42
42
|
comment: string | null;
|
|
43
43
|
/** Fio API column17 — ID pokynu, available only from Fio API pull */
|
|
44
44
|
command_id: string | null;
|
|
45
|
+
/** V2 facts; absent only on retained v1 records. */
|
|
46
|
+
payer_reference?: string | null;
|
|
47
|
+
raw_vs?: string | null;
|
|
48
|
+
direction?: 'incoming' | 'outgoing' | 'zero';
|
|
49
|
+
identity_kind?: 'movement' | 'observation' | 'historical_unverified';
|
|
50
|
+
identity_provenance?: string;
|
|
45
51
|
source: 'email' | 'fio_api';
|
|
46
52
|
date: string;
|
|
47
53
|
/** Original timezone offset in minutes (e.g. CET=60, CEST=120). Debug only — all queries use UTC date. */
|
|
@@ -52,7 +58,7 @@ interface Transaction {
|
|
|
52
58
|
interface WebhookEnvelope {
|
|
53
59
|
event: 'transaction.received';
|
|
54
60
|
/** Bumped when shape of `data` or signing string changes */
|
|
55
|
-
event_version: '1';
|
|
61
|
+
event_version: '1' | '2';
|
|
56
62
|
/** ULID, stable across retries — sole idempotence key */
|
|
57
63
|
delivery_id: string;
|
|
58
64
|
pairing_code: string;
|
|
@@ -20,7 +20,7 @@ interface BankAccount {
|
|
|
20
20
|
interface Transaction {
|
|
21
21
|
id: number;
|
|
22
22
|
bank_account_id: number;
|
|
23
|
-
/** INTEGER, lowest unit (e.g. 1990 = 19.90 CZK),
|
|
23
|
+
/** INTEGER, lowest unit (e.g. 1990 = 19.90 CZK), signed exact minor units */
|
|
24
24
|
amount_cents: number;
|
|
25
25
|
/** ISO 4217 alpha-3 uppercase (CZK/EUR/USD) */
|
|
26
26
|
currency: string;
|
|
@@ -42,6 +42,12 @@ interface Transaction {
|
|
|
42
42
|
comment: string | null;
|
|
43
43
|
/** Fio API column17 — ID pokynu, available only from Fio API pull */
|
|
44
44
|
command_id: string | null;
|
|
45
|
+
/** V2 facts; absent only on retained v1 records. */
|
|
46
|
+
payer_reference?: string | null;
|
|
47
|
+
raw_vs?: string | null;
|
|
48
|
+
direction?: 'incoming' | 'outgoing' | 'zero';
|
|
49
|
+
identity_kind?: 'movement' | 'observation' | 'historical_unverified';
|
|
50
|
+
identity_provenance?: string;
|
|
45
51
|
source: 'email' | 'fio_api';
|
|
46
52
|
date: string;
|
|
47
53
|
/** Original timezone offset in minutes (e.g. CET=60, CEST=120). Debug only — all queries use UTC date. */
|
|
@@ -52,7 +58,7 @@ interface Transaction {
|
|
|
52
58
|
interface WebhookEnvelope {
|
|
53
59
|
event: 'transaction.received';
|
|
54
60
|
/** Bumped when shape of `data` or signing string changes */
|
|
55
|
-
event_version: '1';
|
|
61
|
+
event_version: '1' | '2';
|
|
56
62
|
/** ULID, stable across retries — sole idempotence key */
|
|
57
63
|
delivery_id: string;
|
|
58
64
|
pairing_code: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
-- Schema 11: preserve row IDs and immutable delivery payloads. No historical email ID reinterpretation.
|
|
2
|
+
CREATE TABLE bank_sync_upgrade_sequence AS SELECT seq FROM sqlite_sequence WHERE name='transactions';
|
|
3
|
+
CREATE TABLE transactions_v2 (
|
|
4
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
|
+
bank_account_id INTEGER NOT NULL REFERENCES bank_accounts(id),
|
|
6
|
+
amount_cents INTEGER NOT NULL CHECK (amount_cents BETWEEN -9007199254740991 AND 9007199254740991),
|
|
7
|
+
currency TEXT NOT NULL CHECK (length(currency) = 3 AND currency = upper(currency)),
|
|
8
|
+
counter_account TEXT,
|
|
9
|
+
bank_code TEXT,
|
|
10
|
+
bank_name TEXT,
|
|
11
|
+
vs TEXT,
|
|
12
|
+
ks TEXT,
|
|
13
|
+
ss TEXT,
|
|
14
|
+
message TEXT,
|
|
15
|
+
sender_name TEXT,
|
|
16
|
+
user_identification TEXT,
|
|
17
|
+
transaction_type TEXT,
|
|
18
|
+
performed_by TEXT,
|
|
19
|
+
comment TEXT,
|
|
20
|
+
command_id TEXT,
|
|
21
|
+
source TEXT NOT NULL,
|
|
22
|
+
date TEXT NOT NULL,
|
|
23
|
+
date_offset_min INTEGER,
|
|
24
|
+
transaction_id TEXT,
|
|
25
|
+
external_id TEXT,
|
|
26
|
+
payer_reference TEXT,
|
|
27
|
+
raw_vs TEXT,
|
|
28
|
+
direction TEXT NOT NULL DEFAULT 'incoming' CHECK (direction IN ('incoming','outgoing','zero')),
|
|
29
|
+
identity_kind TEXT NOT NULL DEFAULT 'historical_unverified',
|
|
30
|
+
identity_provenance TEXT NOT NULL DEFAULT 'historical_unverified',
|
|
31
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
32
|
+
);
|
|
33
|
+
INSERT INTO transactions_v2 (id, bank_account_id, amount_cents, currency, counter_account, bank_code, bank_name, vs, ks, ss, message, sender_name, user_identification, transaction_type, performed_by, comment, command_id, source, date, date_offset_min, transaction_id, external_id, created_at, raw_vs, identity_kind, identity_provenance)
|
|
34
|
+
SELECT id, bank_account_id, amount_cents, currency, counter_account, bank_code, bank_name, vs, ks, ss, message, sender_name, user_identification, transaction_type, performed_by, comment, command_id, source, date, date_offset_min, transaction_id, external_id, created_at, vs, CASE WHEN source='fio_api' AND transaction_id IS NOT NULL THEN 'movement' ELSE 'historical_unverified' END,
|
|
35
|
+
CASE WHEN source='fio_api' AND transaction_id IS NOT NULL THEN 'fio_api_column22' ELSE 'historical_unverified' END FROM transactions;
|
|
36
|
+
DROP TABLE transactions;
|
|
37
|
+
ALTER TABLE transactions_v2 RENAME TO transactions;
|
|
38
|
+
INSERT INTO sqlite_sequence(name,seq) SELECT 'transactions',COALESCE((SELECT seq FROM bank_sync_upgrade_sequence),0) WHERE NOT EXISTS(SELECT 1 FROM sqlite_sequence WHERE name='transactions');
|
|
39
|
+
UPDATE sqlite_sequence SET seq=MAX(seq,COALESCE((SELECT seq FROM bank_sync_upgrade_sequence),0)) WHERE name='transactions';
|
|
40
|
+
DROP TABLE bank_sync_upgrade_sequence;
|
|
41
|
+
CREATE UNIQUE INDEX idx_tx_ext ON transactions(bank_account_id, external_id) WHERE external_id IS NOT NULL;
|
|
42
|
+
CREATE UNIQUE INDEX idx_tx_fio ON transactions(bank_account_id, transaction_id) WHERE transaction_id IS NOT NULL AND identity_kind='movement';
|
|
43
|
+
ALTER TABLE webhook_consumers ADD COLUMN event_version TEXT NOT NULL DEFAULT '1' CHECK(event_version IN ('1','2'));
|
|
44
|
+
CREATE TABLE bank_poll_leases (credential_hash TEXT PRIMARY KEY, token TEXT NOT NULL, lease_until TEXT NOT NULL, next_allowed_at TEXT NOT NULL);
|
|
45
|
+
CREATE TABLE bank_recovery_batches (id TEXT PRIMARY KEY, bank_account_id INTEGER NOT NULL REFERENCES bank_accounts(id), from_date TEXT NOT NULL, to_date TEXT NOT NULL, cipher TEXT, key_version INTEGER, state TEXT NOT NULL CHECK(state IN ('fetching','spooled','completed')), created_at TEXT NOT NULL DEFAULT (datetime('now')), completed_at TEXT);
|
|
46
|
+
ALTER TABLE bank_accounts ADD COLUMN ingest_enabled INTEGER NOT NULL DEFAULT 1;
|
|
47
|
+
ALTER TABLE bank_accounts ADD COLUMN api_token_hash TEXT;
|
|
48
|
+
ALTER TABLE bank_accounts ADD COLUMN api_pointer_initialized INTEGER NOT NULL DEFAULT 0;
|
|
49
|
+
ALTER TABLE bank_accounts ADD COLUMN api_reconciled_through TEXT;
|
|
50
|
+
UPDATE bank_accounts SET api_pointer_initialized=1 WHERE api_last_success_at IS NOT NULL;
|
|
51
|
+
CREATE TABLE authenticated_email_spool (id TEXT PRIMARY KEY, bank_account_id INTEGER NOT NULL REFERENCES bank_accounts(id), body_sha256 TEXT NOT NULL, cipher TEXT NOT NULL, key_version INTEGER NOT NULL, state TEXT NOT NULL DEFAULT 'pending' CHECK(state IN ('pending','completed')), attempts INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL DEFAULT (datetime('now')), completed_at TEXT);
|
|
52
|
+
UPDATE schema_meta SET value='11' WHERE key='version';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@festapp/banksync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@cloudflare/workers-types": "^5.20260730.1",
|
|
53
|
-
"@types/better-sqlite3": "^
|
|
53
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
54
54
|
"better-sqlite3": "^13.0.3",
|
|
55
55
|
"tsup": "^8.5.0",
|
|
56
56
|
"typescript": "^5.9.3",
|
|
57
57
|
"vite": "^8.2.2",
|
|
58
58
|
"vitest": "^4.1.5",
|
|
59
|
-
"wrangler": "4.
|
|
59
|
+
"wrangler": "4.130.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20"
|