@festapp/banksync 0.0.0-bootstrap.20260831

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.
@@ -0,0 +1,84 @@
1
+ import { D1Database, Queue, R2Bucket, ForwardableEmailMessage, ExecutionContext, MessageBatch, ScheduledEvent } from '@cloudflare/workers-types';
2
+ import { W as WebhookEnvelope } from './types-Cb5l2lXq.cjs';
3
+
4
+ interface EmailEnvelopeEvidence {
5
+ mailFrom: string;
6
+ rcptTo: string;
7
+ authenticationResults: string | null;
8
+ trustedAuthservId: string;
9
+ }
10
+
11
+ interface VersionedSecretEnv {
12
+ ENCRYPTION_KEY_VERSION?: string;
13
+ [key: `ENCRYPTION_KEY_V${number}`]: string | undefined;
14
+ }
15
+
16
+ interface WebhookQueueMessage {
17
+ message_version: 2;
18
+ delivery_job_id: number;
19
+ delivery_id: string;
20
+ consumer_app_id: string;
21
+ event_kind?: string;
22
+ bank_account_id: number;
23
+ transaction_id: number;
24
+ generation: number;
25
+ dispatch_token: string;
26
+ envelope: WebhookEnvelope;
27
+ }
28
+
29
+ interface Env extends VersionedSecretEnv {
30
+ DB: D1Database;
31
+ WEBHOOK_QUEUE: Queue<WebhookQueueMessage>;
32
+ API_SYNC_QUEUE?: Queue<ApiSyncQueueMessage>;
33
+ ADMIN_SECRET: string;
34
+ WEBHOOK_KEK: string;
35
+ ENCRYPTION_KEY_VERSION?: string;
36
+ ENCRYPTION_KEY_V1?: string;
37
+ FIO_MIN_INTERVAL_S?: string;
38
+ /**
39
+ * Fio egress proxy. Cloudflare Workers cannot reach fioapi.fio.cz (HTTP 525
40
+ * TLS handshake fail). When set, Fio pulls are relayed through this edge
41
+ * function (running on a non-Cloudflare fixed IP). FIO_PROXY_URL is a plain
42
+ * var; FIO_PROXY_SECRET is a wrangler secret. Both unset → direct Fio fetch.
43
+ */
44
+ FIO_PROXY_URL?: string;
45
+ FIO_PROXY_SECRET?: string;
46
+ /** comma-separated emails like 'noreply@fio.cz,info@airbank.cz' */
47
+ SENDER_ALLOWLIST: string;
48
+ /** 'production' | 'development' — gates POST /__test/email */
49
+ ENV?: string;
50
+ /** CF API token w/ Zone:Email Routing Rules:Edit. When unset, banksync skips CF sync (dev mode). */
51
+ CF_API_TOKEN?: string;
52
+ /** CF zone id where Email Routing rules live. */
53
+ CF_ZONE_ID?: string;
54
+ /** Subdomain hosting bank-* receivers (e.g. banksync.festapp.net). */
55
+ BANKSYNC_DOMAIN?: string;
56
+ /** Slack/Discord incoming webhook for alerter. Undefined → alerter disabled. Set via wrangler secret put. */
57
+ ALERT_WEBHOOK_URL?: string;
58
+ /** Bearer credential for an internal alert-ingest endpoint. */
59
+ ALERT_WEBHOOK_SECRET?: string;
60
+ /** R2 bucket binding for weekly SQL backup. Undefined → backup disabled. */
61
+ BACKUPS?: R2Bucket;
62
+ /** Trusted authserv-id observed and verified from Cloudflare Email Routing. */
63
+ EMAIL_AUTHSERV_ID?: string;
64
+ /** Exact comma-separated callback hostnames allowed in production. */
65
+ CALLBACK_HOST_ALLOWLIST?: string;
66
+ /** Active application-layer backup key version. */
67
+ BACKUP_ENCRYPTION_KEY_VERSION?: string;
68
+ BACKUP_ENCRYPTION_KEY_V1?: string;
69
+ BACKUP_ENCRYPTION_KEY_V2?: string;
70
+ }
71
+ interface ApiSyncQueueMessage {
72
+ kind: 'api_sync_tick';
73
+ source: 'cron' | 'self';
74
+ enqueued_at: string;
75
+ }
76
+ declare function processEmail(rawStream: ReadableStream<Uint8Array>, env: Env, envelope: EmailEnvelopeEvidence): Promise<void>;
77
+ declare const _default: {
78
+ email(message: ForwardableEmailMessage, env: Env, _ctx: ExecutionContext): Promise<void>;
79
+ fetch(req: Request, env: Env, _ctx: ExecutionContext): Promise<Response>;
80
+ queue(batch: MessageBatch<unknown>, env: Env, _ctx: ExecutionContext): Promise<void>;
81
+ scheduled(event: ScheduledEvent, env: Env, _ctx: ExecutionContext): Promise<void>;
82
+ };
83
+
84
+ export { type Env, _default as default, processEmail };
@@ -0,0 +1,84 @@
1
+ import { D1Database, Queue, R2Bucket, ForwardableEmailMessage, ExecutionContext, MessageBatch, ScheduledEvent } from '@cloudflare/workers-types';
2
+ import { W as WebhookEnvelope } from './types-Cb5l2lXq.js';
3
+
4
+ interface EmailEnvelopeEvidence {
5
+ mailFrom: string;
6
+ rcptTo: string;
7
+ authenticationResults: string | null;
8
+ trustedAuthservId: string;
9
+ }
10
+
11
+ interface VersionedSecretEnv {
12
+ ENCRYPTION_KEY_VERSION?: string;
13
+ [key: `ENCRYPTION_KEY_V${number}`]: string | undefined;
14
+ }
15
+
16
+ interface WebhookQueueMessage {
17
+ message_version: 2;
18
+ delivery_job_id: number;
19
+ delivery_id: string;
20
+ consumer_app_id: string;
21
+ event_kind?: string;
22
+ bank_account_id: number;
23
+ transaction_id: number;
24
+ generation: number;
25
+ dispatch_token: string;
26
+ envelope: WebhookEnvelope;
27
+ }
28
+
29
+ interface Env extends VersionedSecretEnv {
30
+ DB: D1Database;
31
+ WEBHOOK_QUEUE: Queue<WebhookQueueMessage>;
32
+ API_SYNC_QUEUE?: Queue<ApiSyncQueueMessage>;
33
+ ADMIN_SECRET: string;
34
+ WEBHOOK_KEK: string;
35
+ ENCRYPTION_KEY_VERSION?: string;
36
+ ENCRYPTION_KEY_V1?: string;
37
+ FIO_MIN_INTERVAL_S?: string;
38
+ /**
39
+ * Fio egress proxy. Cloudflare Workers cannot reach fioapi.fio.cz (HTTP 525
40
+ * TLS handshake fail). When set, Fio pulls are relayed through this edge
41
+ * function (running on a non-Cloudflare fixed IP). FIO_PROXY_URL is a plain
42
+ * var; FIO_PROXY_SECRET is a wrangler secret. Both unset → direct Fio fetch.
43
+ */
44
+ FIO_PROXY_URL?: string;
45
+ FIO_PROXY_SECRET?: string;
46
+ /** comma-separated emails like 'noreply@fio.cz,info@airbank.cz' */
47
+ SENDER_ALLOWLIST: string;
48
+ /** 'production' | 'development' — gates POST /__test/email */
49
+ ENV?: string;
50
+ /** CF API token w/ Zone:Email Routing Rules:Edit. When unset, banksync skips CF sync (dev mode). */
51
+ CF_API_TOKEN?: string;
52
+ /** CF zone id where Email Routing rules live. */
53
+ CF_ZONE_ID?: string;
54
+ /** Subdomain hosting bank-* receivers (e.g. banksync.festapp.net). */
55
+ BANKSYNC_DOMAIN?: string;
56
+ /** Slack/Discord incoming webhook for alerter. Undefined → alerter disabled. Set via wrangler secret put. */
57
+ ALERT_WEBHOOK_URL?: string;
58
+ /** Bearer credential for an internal alert-ingest endpoint. */
59
+ ALERT_WEBHOOK_SECRET?: string;
60
+ /** R2 bucket binding for weekly SQL backup. Undefined → backup disabled. */
61
+ BACKUPS?: R2Bucket;
62
+ /** Trusted authserv-id observed and verified from Cloudflare Email Routing. */
63
+ EMAIL_AUTHSERV_ID?: string;
64
+ /** Exact comma-separated callback hostnames allowed in production. */
65
+ CALLBACK_HOST_ALLOWLIST?: string;
66
+ /** Active application-layer backup key version. */
67
+ BACKUP_ENCRYPTION_KEY_VERSION?: string;
68
+ BACKUP_ENCRYPTION_KEY_V1?: string;
69
+ BACKUP_ENCRYPTION_KEY_V2?: string;
70
+ }
71
+ interface ApiSyncQueueMessage {
72
+ kind: 'api_sync_tick';
73
+ source: 'cron' | 'self';
74
+ enqueued_at: string;
75
+ }
76
+ declare function processEmail(rawStream: ReadableStream<Uint8Array>, env: Env, envelope: EmailEnvelopeEvidence): Promise<void>;
77
+ declare const _default: {
78
+ email(message: ForwardableEmailMessage, env: Env, _ctx: ExecutionContext): Promise<void>;
79
+ fetch(req: Request, env: Env, _ctx: ExecutionContext): Promise<Response>;
80
+ queue(batch: MessageBatch<unknown>, env: Env, _ctx: ExecutionContext): Promise<void>;
81
+ scheduled(event: ScheduledEvent, env: Env, _ctx: ExecutionContext): Promise<void>;
82
+ };
83
+
84
+ export { type Env, _default as default, processEmail };