@hintergrund/worker 0.2.3 → 0.3.1
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/dist/api/cms/handlers/admin-users.handler.d.ts +1 -0
- package/dist/api/cms/handlers/admin-users.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/admin-users.handler.js +60 -79
- package/dist/api/cms/handlers/auth.handler.d.ts +1 -1
- package/dist/api/cms/handlers/auth.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/auth.handler.js +13 -94
- package/dist/api/cms/handlers/dashboard.handler.d.ts +1 -1
- package/dist/api/cms/handlers/dashboard.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/dashboard.handler.js +1 -1
- package/dist/api/cms/handlers/github-secrets.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/github-secrets.handler.js +8 -1
- package/dist/api/cms/handlers/integrations.handler.d.ts +5 -0
- package/dist/api/cms/handlers/integrations.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/integrations.handler.js +24 -0
- package/dist/api/cms/handlers/recovery.handler.d.ts +5 -0
- package/dist/api/cms/handlers/recovery.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/recovery.handler.js +53 -0
- package/dist/api/cms/handlers/setup.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/setup.handler.js +97 -35
- package/dist/api/cms/handlers/website-repo.handler.d.ts +2 -1
- package/dist/api/cms/handlers/website-repo.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/website-repo.handler.js +64 -55
- package/dist/api/cms/routes/auth.routes.d.ts +1 -1
- package/dist/api/cms/routes/auth.routes.d.ts.map +1 -1
- package/dist/api/cms/routes/auth.routes.js +7 -2
- package/dist/api/cms/routes/index.d.ts +1 -1
- package/dist/api/cms/routes/index.d.ts.map +1 -1
- package/dist/api/cms/routes/index.js +7 -11
- package/dist/api/emails/handlers/campaigns.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/campaigns.handler.js +3 -4
- package/dist/api/emails/handlers/invoice.handler.d.ts +8 -15
- package/dist/api/emails/handlers/invoice.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/invoice.handler.js +142 -170
- package/dist/api/emails/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/public.handler.js +27 -8
- package/dist/api/emails/handlers/send.handler.d.ts +1 -3
- package/dist/api/emails/handlers/send.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/send.handler.js +18 -65
- package/dist/api/emails/handlers/settings.handler.d.ts +60 -12
- package/dist/api/emails/handlers/settings.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/settings.handler.js +35 -94
- package/dist/api/emails/routes/admin.routes.d.ts.map +1 -1
- package/dist/api/emails/routes/admin.routes.js +5 -6
- package/dist/api/emails/routes/mail.routes.d.ts +5 -0
- package/dist/api/emails/routes/mail.routes.d.ts.map +1 -0
- package/dist/api/emails/routes/mail.routes.js +188 -0
- package/dist/api/shop/handlers/products.handler.d.ts +2 -2
- package/dist/api/shop/handlers/products.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/products.handler.js +21 -8
- package/dist/api/shop/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/public.handler.js +17 -66
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -18
- package/dist/lib/auth/crypto.d.ts +0 -1
- package/dist/lib/auth/crypto.d.ts.map +1 -1
- package/dist/lib/auth/crypto.js +1 -4
- package/dist/lib/brand.d.ts +6 -0
- package/dist/lib/brand.d.ts.map +1 -0
- package/dist/lib/brand.js +31 -0
- package/dist/lib/config.d.ts +1 -2
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +1 -8
- package/dist/lib/email-template.d.ts +4 -7
- package/dist/lib/email-template.d.ts.map +1 -1
- package/dist/lib/email-template.js +9 -31
- package/dist/lib/email.d.ts +20 -11
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +29 -19
- package/dist/lib/github.d.ts +1 -1
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +13 -4
- package/dist/lib/integration-health.d.ts +18 -0
- package/dist/lib/integration-health.d.ts.map +1 -0
- package/dist/lib/integration-health.js +51 -0
- package/dist/lib/invoice.d.ts +13 -0
- package/dist/lib/invoice.d.ts.map +1 -0
- package/dist/lib/invoice.js +41 -0
- package/dist/lib/mail-schema.d.ts +2 -0
- package/dist/lib/mail-schema.d.ts.map +1 -0
- package/dist/lib/mail-schema.js +56 -0
- package/dist/lib/mail.d.ts +83 -0
- package/dist/lib/mail.d.ts.map +1 -0
- package/dist/lib/mail.js +211 -0
- package/dist/lib/project-db.d.ts +3 -4
- package/dist/lib/project-db.d.ts.map +1 -1
- package/dist/lib/project-db.js +14 -43
- package/dist/lib/template.d.ts.map +1 -1
- package/dist/lib/template.js +28 -0
- package/dist/lib/user-recovery.d.ts +9 -0
- package/dist/lib/user-recovery.d.ts.map +1 -0
- package/dist/lib/user-recovery.js +42 -0
- package/dist/lib/website-i18n.d.ts +10 -0
- package/dist/lib/website-i18n.d.ts.map +1 -0
- package/dist/lib/website-i18n.js +195 -0
- package/dist/middleware/auth.d.ts +3 -1
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +8 -4
- package/package.json +4 -2
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts +0 -6
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/agent-conversations.handler.js +0 -87
- package/dist/api/cms/handlers/website-templates.handler.d.ts +0 -6
- package/dist/api/cms/handlers/website-templates.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/website-templates.handler.js +0 -53
- package/dist/api/shop/handlers/prices.handler.d.ts +0 -4
- package/dist/api/shop/handlers/prices.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/prices.handler.js +0 -6
- package/dist/hintergrund-assets.d.ts +0 -5
- package/dist/hintergrund-assets.d.ts.map +0 -1
- package/dist/hintergrund-assets.js +0 -11
package/dist/lib/github.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare class GitHubClient {
|
|
|
76
76
|
* Use this for images, videos, and other binary files
|
|
77
77
|
* Returns null if file doesn't exist
|
|
78
78
|
*/
|
|
79
|
-
readFileBinary(path: string): Promise<{
|
|
79
|
+
readFileBinary(path: string, maxBytes?: number): Promise<{
|
|
80
80
|
content: string;
|
|
81
81
|
sha: string;
|
|
82
82
|
} | null>;
|
package/dist/lib/github.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/lib/github.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMxC;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,sBAAsB,GAAG,CACjD;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACtB,GACC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CACzB,CACD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAA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AAC,IAAI,CAAC;IAY5D,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;OAEG;IACH,WAAW;;;;;CAOX;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAErE"}
|
package/dist/lib/github.js
CHANGED
|
@@ -115,7 +115,7 @@ export class GitHubClient {
|
|
|
115
115
|
* Use this for images, videos, and other binary files
|
|
116
116
|
* Returns null if file doesn't exist
|
|
117
117
|
*/
|
|
118
|
-
async readFileBinary(path) {
|
|
118
|
+
async readFileBinary(path, maxBytes = 10 * 1024 * 1024) {
|
|
119
119
|
try {
|
|
120
120
|
const response = await (await this.octokit()).rest.repos.getContent({
|
|
121
121
|
owner: this.owner,
|
|
@@ -126,9 +126,18 @@ export class GitHubClient {
|
|
|
126
126
|
if (Array.isArray(response.data) || !('content' in response.data)) {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
if (response.data.size > maxBytes)
|
|
130
|
+
throw new RangeError('Binary file exceeds size limit');
|
|
131
|
+
// The Contents API omits bytes for files larger than 1 MB. Fetch the
|
|
132
|
+
// blob by SHA instead; an empty data URL would silently break images.
|
|
133
|
+
let content = response.data.content;
|
|
134
|
+
if (response.data.encoding === 'none') {
|
|
135
|
+
const blob = await (await this.octokit()).rest.git.getBlob({
|
|
136
|
+
owner: this.owner, repo: this.repo, file_sha: response.data.sha
|
|
137
|
+
});
|
|
138
|
+
content = blob.data.content;
|
|
139
|
+
}
|
|
140
|
+
const rawContent = (content || '').replace(/\s/g, '');
|
|
132
141
|
return {
|
|
133
142
|
content: rawContent,
|
|
134
143
|
sha: response.data.sha
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const INTEGRATION_SECRETS: {
|
|
2
|
+
readonly stripe: "STRIPE_SECRET_KEY";
|
|
3
|
+
readonly plunk: "API_KEY";
|
|
4
|
+
readonly google: "GEMINI_API_KEY";
|
|
5
|
+
readonly deepseek: "DEEPSEEK_API_KEY";
|
|
6
|
+
};
|
|
7
|
+
export type IntegrationProvider = keyof typeof INTEGRATION_SECRETS;
|
|
8
|
+
export interface IntegrationHealth {
|
|
9
|
+
status: 'healthy' | 'warning' | 'invalid' | 'unavailable' | 'missing';
|
|
10
|
+
valid: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function isIntegrationProvider(value: string): value is IntegrationProvider;
|
|
14
|
+
/** Read-only probes: never send mail, create a charge, or run billable inference.
|
|
15
|
+
* Provider response bodies/errors and credentials must never be returned to callers.
|
|
16
|
+
*/
|
|
17
|
+
export declare function checkIntegrationKey(provider: IntegrationProvider, rawKey: string): Promise<IntegrationHealth>;
|
|
18
|
+
//# sourceMappingURL=integration-health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-health.d.ts","sourceRoot":"","sources":["../../src/lib/integration-health.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;CAEtB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACnE,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IACtE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CAChB;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,mBAAmB,CAEjF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqCnH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const INTEGRATION_SECRETS = {
|
|
2
|
+
stripe: 'STRIPE_SECRET_KEY', plunk: 'API_KEY', google: 'GEMINI_API_KEY', deepseek: 'DEEPSEEK_API_KEY',
|
|
3
|
+
};
|
|
4
|
+
export function isIntegrationProvider(value) {
|
|
5
|
+
return Object.prototype.hasOwnProperty.call(INTEGRATION_SECRETS, value);
|
|
6
|
+
}
|
|
7
|
+
/** Read-only probes: never send mail, create a charge, or run billable inference.
|
|
8
|
+
* Provider response bodies/errors and credentials must never be returned to callers.
|
|
9
|
+
*/
|
|
10
|
+
export async function checkIntegrationKey(provider, rawKey) {
|
|
11
|
+
const key = rawKey.trim();
|
|
12
|
+
if (!key || key === 'NOT_CONFIGURED')
|
|
13
|
+
return { status: 'missing', valid: false, message: 'No key is configured.' };
|
|
14
|
+
if (key.length > 4096 || /[\r\n]/.test(key))
|
|
15
|
+
return { status: 'invalid', valid: false, message: 'Invalid API key format.' };
|
|
16
|
+
const endpoints = {
|
|
17
|
+
stripe: 'https://api.stripe.com/v1/account',
|
|
18
|
+
plunk: 'https://next-api.useplunk.com/contacts?limit=1',
|
|
19
|
+
google: 'https://generativelanguage.googleapis.com/v1beta/models?pageSize=1',
|
|
20
|
+
deepseek: 'https://api.deepseek.com/models',
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(endpoints[provider], {
|
|
24
|
+
headers: provider === 'google' ? { 'x-goog-api-key': key } : { Authorization: `Bearer ${key}` },
|
|
25
|
+
signal: AbortSignal.timeout(10000), redirect: 'error',
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
await response.body?.cancel();
|
|
29
|
+
const invalid = [400, 401, 403].includes(response.status);
|
|
30
|
+
return { status: invalid ? 'invalid' : 'unavailable', valid: false, message: invalid
|
|
31
|
+
? 'The provider rejected this key or its permissions. Check the secret key and try again.'
|
|
32
|
+
: 'The provider is temporarily unavailable or rate-limiting requests. Try again later.' };
|
|
33
|
+
}
|
|
34
|
+
if (provider === 'stripe') {
|
|
35
|
+
const account = await response.json();
|
|
36
|
+
if (!account.charges_enabled || !account.payouts_enabled)
|
|
37
|
+
return {
|
|
38
|
+
status: 'warning', valid: true,
|
|
39
|
+
message: 'Key accepted. Payments or payouts are not enabled yet; finish account setup in Stripe. Webhook delivery is not tested.',
|
|
40
|
+
};
|
|
41
|
+
return { status: 'healthy', valid: true, message: 'Key accepted; Stripe API is reachable and payments/payouts are enabled. Webhook delivery is not tested.' };
|
|
42
|
+
}
|
|
43
|
+
await response.body?.cancel();
|
|
44
|
+
return { status: 'healthy', valid: true, message: provider === 'plunk'
|
|
45
|
+
? 'Secret key accepted; Plunk API is reachable. Verify your sender domain in Plunk before sending. No email was sent.'
|
|
46
|
+
: 'Key accepted; model API is reachable. Inference quota and billing are not tested.' };
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return { status: 'unavailable', valid: false, message: 'Could not reach the provider within 10 seconds. Try again.' };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import { type Brand, type InvoiceDesign, type InvoiceData } from '@hintergrund/runtime-contracts';
|
|
3
|
+
import type { Bindings } from '../index';
|
|
4
|
+
export declare function renderInvoice(env: Bindings, data: InvoiceData, draft?: {
|
|
5
|
+
brand: Brand;
|
|
6
|
+
design: InvoiceDesign;
|
|
7
|
+
assets?: Partial<Record<'logo' | 'bodyFont' | 'displayFont', Uint8Array>>;
|
|
8
|
+
}): Promise<Uint8Array<ArrayBufferLike>>;
|
|
9
|
+
/** Authenticated, side-effect-free preview. Only presentation can be supplied. */
|
|
10
|
+
export declare function previewInvoice(c: Context<{
|
|
11
|
+
Bindings: Bindings;
|
|
12
|
+
}>): Promise<Response>;
|
|
13
|
+
//# sourceMappingURL=invoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice.d.ts","sourceRoot":"","sources":["../../src/lib/invoice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAwC,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACxI,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKzC,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,UAAU,CAAC,CAAC,CAAA;CAAE,wCAU/L;AAED,kFAAkF;AAClF,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqB1F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { validateBrand, validateInvoiceDesign } from '@hintergrund/runtime-contracts';
|
|
2
|
+
import { readBrand, readInvoiceDesign, readBrandAsset } from './brand';
|
|
3
|
+
import { readEmailSettings } from '../api/emails/handlers/settings.handler';
|
|
4
|
+
import { generateInvoicePdf } from '../api/emails/handlers/invoice.handler';
|
|
5
|
+
export async function renderInvoice(env, data, draft) {
|
|
6
|
+
const brand = draft?.brand ?? await readBrand(env);
|
|
7
|
+
const design = draft?.design ?? await readInvoiceDesign(env);
|
|
8
|
+
const { settings } = await readEmailSettings(env);
|
|
9
|
+
const [logo, bodyFont, displayFont] = await Promise.all([
|
|
10
|
+
design.showLogo && brand.logoPath ? draft?.assets?.logo ?? readBrandAsset(env, brand.logoPath) : undefined,
|
|
11
|
+
brand.bodyFontPath ? draft?.assets?.bodyFont ?? readBrandAsset(env, brand.bodyFontPath) : undefined,
|
|
12
|
+
brand.displayFontPath ? draft?.assets?.displayFont ?? readBrandAsset(env, brand.displayFontPath) : undefined,
|
|
13
|
+
]);
|
|
14
|
+
return generateInvoicePdf(settings.invoice, data, brand, design, { logo, bodyFont, displayFont });
|
|
15
|
+
}
|
|
16
|
+
/** Authenticated, side-effect-free preview. Only presentation can be supplied. */
|
|
17
|
+
export async function previewInvoice(c) {
|
|
18
|
+
try {
|
|
19
|
+
const input = await c.req.json();
|
|
20
|
+
const brand = validateBrand(input.brand), design = validateInvoiceDesign(input.design);
|
|
21
|
+
const assets = {};
|
|
22
|
+
for (const key of ['logo', 'bodyFont', 'displayFont']) {
|
|
23
|
+
const content = input.assets?.[key];
|
|
24
|
+
if (content === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
if (typeof content !== 'string' || content.length > 8 * 1024 * 1024 || !/^[A-Za-z0-9+/]*={0,2}$/.test(content))
|
|
27
|
+
throw new Error('Invalid preview asset.');
|
|
28
|
+
assets[key] = Uint8Array.from(atob(content), char => char.charCodeAt(0));
|
|
29
|
+
}
|
|
30
|
+
const pdf = await renderInvoice(c.env, {
|
|
31
|
+
invoiceNumber: 'PREVIEW-001', invoiceDate: '2026-01-15', dueDate: '2026-01-29',
|
|
32
|
+
customerName: 'Sample Customer', customerEmail: 'sample@example.com', customerAddress: 'Example Street 12\n12345 Example City',
|
|
33
|
+
items: [{ description: 'Sample product', quantity: 2, unitPrice: 25, total: 50 }, { description: 'A longer service description to demonstrate wrapping in the invoice table', quantity: 1, unitPrice: 100, total: 100 }],
|
|
34
|
+
subtotal: 150, tax: 28.5, total: 178.5, currency: 'EUR', notes: 'PREVIEW ONLY — not a financial document.',
|
|
35
|
+
}, { brand, design, assets });
|
|
36
|
+
return new Response(pdf, { headers: { 'Content-Type': 'application/pdf', 'Cache-Control': 'no-store', 'Content-Disposition': 'inline; filename="invoice-preview.pdf"' } });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return c.json({ error: error instanceof Error ? error.message : 'Invoice preview failed.' }, 400);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const MAIL_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS user_recovery (\n user_id TEXT PRIMARY KEY REFERENCES admin_users(id) ON DELETE CASCADE,\n token_hash TEXT NOT NULL UNIQUE,\n expires_at INTEGER NOT NULL,\n created_at INTEGER NOT NULL\n);\nCREATE TABLE IF NOT EXISTS auth_rate_limits (\n key TEXT PRIMARY KEY,\n count INTEGER NOT NULL,\n expires_at INTEGER NOT NULL\n);\nCREATE TABLE IF NOT EXISTS mailboxes (\n address TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n last_received_at INTEGER,\n -- Exactly one mailbox per project receives mail addressed to any other\n -- address on the domain. Created on the first unmatched delivery so a project\n -- never silently rejects mail to its own domain.\n catch_all INTEGER NOT NULL DEFAULT 0\n);\nCREATE TABLE IF NOT EXISTS mail_messages (\n id TEXT PRIMARY KEY,\n thread_id TEXT NOT NULL,\n mailbox TEXT NOT NULL REFERENCES mailboxes(address),\n direction TEXT NOT NULL CHECK(direction IN ('inbound','outbound')),\n status TEXT NOT NULL CHECK(status IN ('received','draft','queued','sending','accepted','delivered','bounced','complained','failed','uncertain')),\n sender TEXT NOT NULL,\n reply_address TEXT,\n recipient TEXT NOT NULL,\n subject TEXT NOT NULL,\n body_text TEXT NOT NULL,\n message_id TEXT,\n in_reply_to TEXT,\n references_json TEXT NOT NULL DEFAULT '[]',\n raw_key TEXT,\n attachments_json TEXT NOT NULL DEFAULT '[]',\n provider_id TEXT,\n error TEXT,\n read_at INTEGER,\n archived_at INTEGER,\n spam INTEGER NOT NULL DEFAULT 0,\n attempts INTEGER NOT NULL DEFAULT 0,\n next_attempt_at INTEGER,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n -- Keyed on the delivered address, not the storing mailbox: with a catch-all,\n -- one message addressed to two unmatched addresses is two real deliveries.\n UNIQUE(recipient, message_id, direction)\n);\nCREATE INDEX IF NOT EXISTS idx_mail_folder ON mail_messages(direction, status, created_at DESC);\nCREATE INDEX IF NOT EXISTS idx_mail_thread ON mail_messages(thread_id, created_at);\nCREATE INDEX IF NOT EXISTS idx_mail_outbox ON mail_messages(status, next_attempt_at);\nCREATE UNIQUE INDEX IF NOT EXISTS idx_mailbox_catch_all ON mailboxes(catch_all) WHERE catch_all = 1;\n";
|
|
2
|
+
//# sourceMappingURL=mail-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail-schema.d.ts","sourceRoot":"","sources":["../../src/lib/mail-schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,kqEAuD3B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const MAIL_SCHEMA_SQL = `
|
|
2
|
+
CREATE TABLE IF NOT EXISTS user_recovery (
|
|
3
|
+
user_id TEXT PRIMARY KEY REFERENCES admin_users(id) ON DELETE CASCADE,
|
|
4
|
+
token_hash TEXT NOT NULL UNIQUE,
|
|
5
|
+
expires_at INTEGER NOT NULL,
|
|
6
|
+
created_at INTEGER NOT NULL
|
|
7
|
+
);
|
|
8
|
+
CREATE TABLE IF NOT EXISTS auth_rate_limits (
|
|
9
|
+
key TEXT PRIMARY KEY,
|
|
10
|
+
count INTEGER NOT NULL,
|
|
11
|
+
expires_at INTEGER NOT NULL
|
|
12
|
+
);
|
|
13
|
+
CREATE TABLE IF NOT EXISTS mailboxes (
|
|
14
|
+
address TEXT PRIMARY KEY,
|
|
15
|
+
name TEXT NOT NULL,
|
|
16
|
+
created_at INTEGER NOT NULL,
|
|
17
|
+
last_received_at INTEGER,
|
|
18
|
+
-- Exactly one mailbox per project receives mail addressed to any other
|
|
19
|
+
-- address on the domain. Created on the first unmatched delivery so a project
|
|
20
|
+
-- never silently rejects mail to its own domain.
|
|
21
|
+
catch_all INTEGER NOT NULL DEFAULT 0
|
|
22
|
+
);
|
|
23
|
+
CREATE TABLE IF NOT EXISTS mail_messages (
|
|
24
|
+
id TEXT PRIMARY KEY,
|
|
25
|
+
thread_id TEXT NOT NULL,
|
|
26
|
+
mailbox TEXT NOT NULL REFERENCES mailboxes(address),
|
|
27
|
+
direction TEXT NOT NULL CHECK(direction IN ('inbound','outbound')),
|
|
28
|
+
status TEXT NOT NULL CHECK(status IN ('received','draft','queued','sending','accepted','delivered','bounced','complained','failed','uncertain')),
|
|
29
|
+
sender TEXT NOT NULL,
|
|
30
|
+
reply_address TEXT,
|
|
31
|
+
recipient TEXT NOT NULL,
|
|
32
|
+
subject TEXT NOT NULL,
|
|
33
|
+
body_text TEXT NOT NULL,
|
|
34
|
+
message_id TEXT,
|
|
35
|
+
in_reply_to TEXT,
|
|
36
|
+
references_json TEXT NOT NULL DEFAULT '[]',
|
|
37
|
+
raw_key TEXT,
|
|
38
|
+
attachments_json TEXT NOT NULL DEFAULT '[]',
|
|
39
|
+
provider_id TEXT,
|
|
40
|
+
error TEXT,
|
|
41
|
+
read_at INTEGER,
|
|
42
|
+
archived_at INTEGER,
|
|
43
|
+
spam INTEGER NOT NULL DEFAULT 0,
|
|
44
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
45
|
+
next_attempt_at INTEGER,
|
|
46
|
+
created_at INTEGER NOT NULL,
|
|
47
|
+
updated_at INTEGER NOT NULL,
|
|
48
|
+
-- Keyed on the delivered address, not the storing mailbox: with a catch-all,
|
|
49
|
+
-- one message addressed to two unmatched addresses is two real deliveries.
|
|
50
|
+
UNIQUE(recipient, message_id, direction)
|
|
51
|
+
);
|
|
52
|
+
CREATE INDEX IF NOT EXISTS idx_mail_folder ON mail_messages(direction, status, created_at DESC);
|
|
53
|
+
CREATE INDEX IF NOT EXISTS idx_mail_thread ON mail_messages(thread_id, created_at);
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_mail_outbox ON mail_messages(status, next_attempt_at);
|
|
55
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_mailbox_catch_all ON mailboxes(catch_all) WHERE catch_all = 1;
|
|
56
|
+
`;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Bindings } from '../index';
|
|
2
|
+
export interface MailAttachment {
|
|
3
|
+
key: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
contentType: string;
|
|
6
|
+
size: number;
|
|
7
|
+
}
|
|
8
|
+
export interface MailMessage {
|
|
9
|
+
id: string;
|
|
10
|
+
thread_id: string;
|
|
11
|
+
mailbox: string;
|
|
12
|
+
direction: 'inbound' | 'outbound';
|
|
13
|
+
status: string;
|
|
14
|
+
sender: string;
|
|
15
|
+
reply_address: string | null;
|
|
16
|
+
recipient: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
body_text: string;
|
|
19
|
+
message_id: string | null;
|
|
20
|
+
in_reply_to: string | null;
|
|
21
|
+
references_json: string;
|
|
22
|
+
raw_key: string | null;
|
|
23
|
+
attachments_json: string;
|
|
24
|
+
provider_id: string | null;
|
|
25
|
+
error: string | null;
|
|
26
|
+
read_at: number | null;
|
|
27
|
+
archived_at: number | null;
|
|
28
|
+
spam: number;
|
|
29
|
+
attempts: number;
|
|
30
|
+
next_attempt_at: number | null;
|
|
31
|
+
created_at: number;
|
|
32
|
+
updated_at: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const MAX_MAIL_BYTES: number;
|
|
35
|
+
export declare const CATCH_ALL_LOCAL_PART = "hello";
|
|
36
|
+
export declare const CATCH_ALL_NAME = "All mail";
|
|
37
|
+
export declare function messageReferences(value: string): string[];
|
|
38
|
+
export declare function publicMessage(row: MailMessage): {
|
|
39
|
+
hasRaw: boolean;
|
|
40
|
+
attachments: MailAttachment[];
|
|
41
|
+
id: string;
|
|
42
|
+
thread_id: string;
|
|
43
|
+
mailbox: string;
|
|
44
|
+
direction: "inbound" | "outbound";
|
|
45
|
+
status: string;
|
|
46
|
+
sender: string;
|
|
47
|
+
reply_address: string | null;
|
|
48
|
+
recipient: string;
|
|
49
|
+
subject: string;
|
|
50
|
+
body_text: string;
|
|
51
|
+
message_id: string | null;
|
|
52
|
+
in_reply_to: string | null;
|
|
53
|
+
provider_id: string | null;
|
|
54
|
+
error: string | null;
|
|
55
|
+
read_at: number | null;
|
|
56
|
+
archived_at: number | null;
|
|
57
|
+
spam: number;
|
|
58
|
+
attempts: number;
|
|
59
|
+
next_attempt_at: number | null;
|
|
60
|
+
created_at: number;
|
|
61
|
+
updated_at: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The domain this project receives mail for, from the hostname it was
|
|
65
|
+
* provisioned with. Every project has a Cloudflare zone, so this is the same
|
|
66
|
+
* domain its catch-all Email Routing rule was installed on. Returns undefined
|
|
67
|
+
* only in local development, where the delivered address is trusted instead.
|
|
68
|
+
*/
|
|
69
|
+
export declare function projectMailDomain(env: Bindings): string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve which mailbox stores a delivery.
|
|
72
|
+
*
|
|
73
|
+
* An exact registered address wins. Otherwise the project's catch-all receives
|
|
74
|
+
* it, which is auto-created on first use so a newly routed domain does not
|
|
75
|
+
* bounce mail before the owner has added any mailbox by hand. Replies send FROM
|
|
76
|
+
* the storing mailbox, so this must always be a real, sendable address.
|
|
77
|
+
*/
|
|
78
|
+
export declare function deliveryMailbox(db: D1Database, recipient: string, mailDomain?: string): Promise<string | null>;
|
|
79
|
+
/** Cloudflare routes addresses to this handler; successful return follows durable storage, never fire-and-forget. */
|
|
80
|
+
export declare function receiveEmail(message: ForwardableEmailMessage, env: Bindings): Promise<void>;
|
|
81
|
+
/** Durable D1 outbox. Stable provider idempotency keys prevent duplicate sends on retry. */
|
|
82
|
+
export declare function processOutbox(env: Bindings): Promise<void>;
|
|
83
|
+
//# sourceMappingURL=mail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../../src/lib/mail.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,WAAW,cAAc;IAAG,GAAG,EAAE,MAA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AAE;QAZ9F,MAAM;eAAa,MAAM;aAAW,MAAM;eAAa,SAAS,GAAG,UAAU;YAAU,MAAM;YACzF,MAAM;mBAAiB,MAAM,GAAG,IAAI;eAAa,MAAM;aAAW,MAAM;eAAa,MAAM;gBAAc,MAAM,GAAG,IAAI;iBACjH,MAAM,GAAG,IAAI;iBACb,MAAM,GAAG,IAAI;WAAS,MAAM,GAAG,IAAI;aAAW,MAAM,GAAG,IAAI;iBAAe,MAAM,GAAG,IAAI;UAC9F,MAAM;cAAY,MAAM;qBAAmB,MAAM,GAAG,IAAI;gBAAc,MAAM;gBAAc,MAAM;EAStG;AAUD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAGnE;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsBpH;AAED,qHAAqH;AACrH,wBAAsB,YAAY,CAAC,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDjG;AAED,4FAA4F;AAC5F,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ChE"}
|
package/dist/lib/mail.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import PostalMime from 'postal-mime';
|
|
2
|
+
import { ensureSchema, sha256Base64Url } from './project-db';
|
|
3
|
+
import { EmailProviderError, sendEmail } from './email';
|
|
4
|
+
import { escapeHtml, validEmail } from './user-recovery';
|
|
5
|
+
export const MAX_MAIL_BYTES = 10 * 1024 * 1024;
|
|
6
|
+
export const CATCH_ALL_LOCAL_PART = 'hello';
|
|
7
|
+
export const CATCH_ALL_NAME = 'All mail';
|
|
8
|
+
export function messageReferences(value) { return (value.match(/<[^<>\s]{1,250}>/g) || []).slice(-20); }
|
|
9
|
+
export function publicMessage(row) {
|
|
10
|
+
const { raw_key, references_json, attachments_json, ...rest } = row;
|
|
11
|
+
return { ...rest, hasRaw: !!raw_key, attachments: JSON.parse(attachments_json) };
|
|
12
|
+
}
|
|
13
|
+
async function bytes(stream) {
|
|
14
|
+
const reader = stream.getReader();
|
|
15
|
+
const chunks = [];
|
|
16
|
+
let size = 0;
|
|
17
|
+
try {
|
|
18
|
+
for (;;) {
|
|
19
|
+
const { value, done } = await reader.read();
|
|
20
|
+
if (done)
|
|
21
|
+
break;
|
|
22
|
+
size += value.length;
|
|
23
|
+
if (size > MAX_MAIL_BYTES) {
|
|
24
|
+
await reader.cancel();
|
|
25
|
+
throw new Error('Message too large');
|
|
26
|
+
}
|
|
27
|
+
chunks.push(value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
reader.releaseLock();
|
|
32
|
+
}
|
|
33
|
+
const result = new Uint8Array(size);
|
|
34
|
+
let offset = 0;
|
|
35
|
+
for (const chunk of chunks) {
|
|
36
|
+
result.set(chunk, offset);
|
|
37
|
+
offset += chunk.length;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The domain this project receives mail for, from the hostname it was
|
|
43
|
+
* provisioned with. Every project has a Cloudflare zone, so this is the same
|
|
44
|
+
* domain its catch-all Email Routing rule was installed on. Returns undefined
|
|
45
|
+
* only in local development, where the delivered address is trusted instead.
|
|
46
|
+
*/
|
|
47
|
+
export function projectMailDomain(env) {
|
|
48
|
+
if (!env.PUBLIC_ORIGIN)
|
|
49
|
+
return undefined;
|
|
50
|
+
try {
|
|
51
|
+
return new URL(env.PUBLIC_ORIGIN).hostname.toLowerCase() || undefined;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve which mailbox stores a delivery.
|
|
59
|
+
*
|
|
60
|
+
* An exact registered address wins. Otherwise the project's catch-all receives
|
|
61
|
+
* it, which is auto-created on first use so a newly routed domain does not
|
|
62
|
+
* bounce mail before the owner has added any mailbox by hand. Replies send FROM
|
|
63
|
+
* the storing mailbox, so this must always be a real, sendable address.
|
|
64
|
+
*/
|
|
65
|
+
export async function deliveryMailbox(db, recipient, mailDomain) {
|
|
66
|
+
// Validate before any lookup: a malformed envelope address must never be
|
|
67
|
+
// stored, not even against an existing catch-all.
|
|
68
|
+
if (!validEmail(recipient))
|
|
69
|
+
return null;
|
|
70
|
+
const exact = await db.prepare('SELECT address FROM mailboxes WHERE address = ?').bind(recipient).first();
|
|
71
|
+
if (exact)
|
|
72
|
+
return exact.address;
|
|
73
|
+
const catchAll = await db.prepare('SELECT address FROM mailboxes WHERE catch_all = 1 LIMIT 1').first();
|
|
74
|
+
if (catchAll)
|
|
75
|
+
return catchAll.address;
|
|
76
|
+
// Anchor the auto-created catch-all to the project's own domain. Every project
|
|
77
|
+
// is provisioned with one, so an envelope for any other domain is not ours to
|
|
78
|
+
// accept and must never mint a mailbox we cannot send from.
|
|
79
|
+
const envelopeDomain = recipient.split('@')[1];
|
|
80
|
+
// The project's own zone, or a subdomain of it: a site on acme.com may receive
|
|
81
|
+
// mail routed from mail.acme.com without clobbering existing MX records.
|
|
82
|
+
if (mailDomain && envelopeDomain !== mailDomain && !envelopeDomain.endsWith(`.${mailDomain}`) && !mailDomain.endsWith(`.${envelopeDomain}`))
|
|
83
|
+
return null;
|
|
84
|
+
const address = `${CATCH_ALL_LOCAL_PART}@${envelopeDomain}`;
|
|
85
|
+
await db.prepare(`INSERT INTO mailboxes (address, name, created_at, catch_all) VALUES (?, ?, ?, 1)
|
|
86
|
+
ON CONFLICT(address) DO UPDATE SET catch_all = 1`).bind(address, CATCH_ALL_NAME, Date.now()).run();
|
|
87
|
+
// A concurrent delivery may have claimed the flag first; the partial unique
|
|
88
|
+
// index guarantees a single winner, so re-read rather than assume.
|
|
89
|
+
const active = await db.prepare('SELECT address FROM mailboxes WHERE catch_all = 1 LIMIT 1').first();
|
|
90
|
+
return active?.address ?? address;
|
|
91
|
+
}
|
|
92
|
+
/** Cloudflare routes addresses to this handler; successful return follows durable storage, never fire-and-forget. */
|
|
93
|
+
export async function receiveEmail(message, env) {
|
|
94
|
+
if (!env.MAIL_STORAGE)
|
|
95
|
+
throw new Error('MAIL_STORAGE binding is required for incoming email');
|
|
96
|
+
if (message.rawSize > MAX_MAIL_BYTES) {
|
|
97
|
+
message.setReject('Maximum message size is 10 MiB');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const db = await ensureSchema(env);
|
|
101
|
+
const recipient = message.to.toLowerCase().trim();
|
|
102
|
+
// Mail addressed to any address on the project's domain is kept. An address the
|
|
103
|
+
// owner never created lands in the catch-all mailbox rather than bouncing, so a
|
|
104
|
+
// project cannot silently lose mail sent to its own domain. `recipient` always
|
|
105
|
+
// records the address the sender actually used.
|
|
106
|
+
const mailbox = await deliveryMailbox(db, recipient, projectMailDomain(env));
|
|
107
|
+
if (!mailbox) {
|
|
108
|
+
message.setReject('No mailbox is configured for this domain');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const raw = await bytes(message.raw);
|
|
112
|
+
const parsed = await PostalMime.parse(raw, { maxNestingDepth: 20, maxHeadersSize: 128 * 1024, maxRfc822NestingDepth: 3 });
|
|
113
|
+
const hash = Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', raw))).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
114
|
+
const messageId = messageReferences(parsed.messageId || '')[0] || `<${hash}@inbound.local>`;
|
|
115
|
+
const id = `mail_${await sha256Base64Url(`${recipient}:${messageId}`)}`;
|
|
116
|
+
if (await db.prepare('SELECT id FROM mail_messages WHERE id = ?').bind(id).first())
|
|
117
|
+
return;
|
|
118
|
+
const sender = parsed.from?.address && validEmail(parsed.from.address) ? parsed.from.address.toLowerCase() : message.from.toLowerCase();
|
|
119
|
+
const replyAddress = parsed.replyTo?.find(address => address.address && validEmail(address.address))?.address?.toLowerCase() || sender;
|
|
120
|
+
const refs = messageReferences(`${parsed.references || ''} ${parsed.inReplyTo || ''}`);
|
|
121
|
+
let threadId = id;
|
|
122
|
+
// Match actual message identifiers and correspondent, never subject alone.
|
|
123
|
+
for (const reference of [...refs].reverse()) {
|
|
124
|
+
// Scope by the address the correspondent wrote to, not the storing mailbox:
|
|
125
|
+
// once an owner creates an address that previously fell through to the
|
|
126
|
+
// catch-all, its existing thread must keep its history.
|
|
127
|
+
const parent = await db.prepare(`SELECT thread_id FROM mail_messages WHERE recipient = ? AND message_id = ?
|
|
128
|
+
AND (sender = ? OR recipient = ?) LIMIT 1`).bind(recipient, reference, sender, sender).first();
|
|
129
|
+
if (parent) {
|
|
130
|
+
threadId = parent.thread_id;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const rawKey = `mail/${id}/original.eml`;
|
|
135
|
+
await env.MAIL_STORAGE.put(rawKey, raw, { httpMetadata: { contentType: 'message/rfc822' } });
|
|
136
|
+
const attachments = [];
|
|
137
|
+
for (const [index, attachment] of parsed.attachments.entries()) {
|
|
138
|
+
const content = typeof attachment.content === 'string' ? new TextEncoder().encode(attachment.content) : new Uint8Array(attachment.content);
|
|
139
|
+
const key = `mail/${id}/attachments/${index}`;
|
|
140
|
+
await env.MAIL_STORAGE.put(key, content);
|
|
141
|
+
attachments.push({ key, filename: (attachment.filename || `attachment-${index + 1}`).slice(0, 200), contentType: attachment.mimeType, size: content.byteLength });
|
|
142
|
+
}
|
|
143
|
+
// Plain text only in the admin: no active HTML, tracking pixels or remote resource loads.
|
|
144
|
+
const text = (parsed.text || (parsed.html || '').replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, '').replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, '').replace(/<[^>]*>/g, ' ').replace(/ /g, ' ')).slice(0, 250000);
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
await db.prepare('UPDATE mailboxes SET last_received_at = ? WHERE address = ?').bind(now, mailbox).run();
|
|
147
|
+
// Spam headers are advisory only; untrusted content is never an authorization signal.
|
|
148
|
+
const spam = /^(yes|true)/i.test(message.headers.get('X-Spam-Flag') || '') ? 1 : 0;
|
|
149
|
+
await db.prepare(`INSERT INTO mail_messages
|
|
150
|
+
(id, thread_id, mailbox, direction, status, sender, reply_address, recipient, subject, body_text, message_id, in_reply_to, references_json, raw_key, attachments_json, spam, created_at, updated_at)
|
|
151
|
+
VALUES (?, ?, ?, 'inbound', 'received', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING`)
|
|
152
|
+
.bind(id, threadId, mailbox, sender, replyAddress, recipient, (parsed.subject || '(no subject)').slice(0, 998), text, messageId, refs[refs.length - 1] || null, JSON.stringify(refs), rawKey, JSON.stringify(attachments), spam, now, now).run();
|
|
153
|
+
}
|
|
154
|
+
/** Durable D1 outbox. Stable provider idempotency keys prevent duplicate sends on retry. */
|
|
155
|
+
export async function processOutbox(env) {
|
|
156
|
+
const db = await ensureSchema(env);
|
|
157
|
+
const now = Date.now();
|
|
158
|
+
// A crashed/expired isolate may have handed the message to the provider. Retry the SAME key only.
|
|
159
|
+
await db.prepare("UPDATE mail_messages SET status = 'queued' WHERE status = 'sending' AND updated_at < ?").bind(now - 5 * 60000).run();
|
|
160
|
+
const { results } = await db.prepare("SELECT * FROM mail_messages WHERE status = 'queued' AND next_attempt_at <= ? ORDER BY created_at LIMIT 10").bind(now).all();
|
|
161
|
+
for (const row of results) {
|
|
162
|
+
if (row.attempts >= 5 || (row.attempts > 0 && now - row.created_at > 20 * 3600000)) {
|
|
163
|
+
await db.prepare("UPDATE mail_messages SET status = 'uncertain', error = 'Delivery could not be confirmed. Check provider logs before sending again.' WHERE id = ? AND status = 'queued'").bind(row.id).run();
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const claim = await db.prepare("UPDATE mail_messages SET status = 'sending', attempts = attempts + 1, updated_at = ? WHERE id = ? AND status = 'queued'").bind(now, row.id).run();
|
|
167
|
+
if (!claim.meta.changes)
|
|
168
|
+
continue;
|
|
169
|
+
try {
|
|
170
|
+
const headers = { 'Message-ID': row.message_id };
|
|
171
|
+
if (row.in_reply_to)
|
|
172
|
+
headers['In-Reply-To'] = row.in_reply_to;
|
|
173
|
+
const refs = JSON.parse(row.references_json);
|
|
174
|
+
if (refs.length)
|
|
175
|
+
headers.References = refs.join(' ').slice(-998);
|
|
176
|
+
const attachments = [];
|
|
177
|
+
for (const item of JSON.parse(row.attachments_json)) {
|
|
178
|
+
const object = await env.MAIL_STORAGE?.get(item.key);
|
|
179
|
+
if (!object)
|
|
180
|
+
throw new Error('Attachment unavailable');
|
|
181
|
+
const buffer = new Uint8Array(await object.arrayBuffer());
|
|
182
|
+
let binary = '';
|
|
183
|
+
for (let i = 0; i < buffer.length; i += 8192)
|
|
184
|
+
binary += String.fromCharCode(...buffer.subarray(i, i + 8192));
|
|
185
|
+
attachments.push({ filename: item.filename, content: btoa(binary), contentType: item.contentType });
|
|
186
|
+
}
|
|
187
|
+
const receipt = await sendEmail(env, { to: row.recipient, from: row.mailbox, replyTo: row.mailbox, subject: row.subject,
|
|
188
|
+
html: `<div style="white-space:pre-wrap">${escapeHtml(row.body_text)}</div>`, text: row.body_text,
|
|
189
|
+
headers, attachments, idempotencyKey: row.id });
|
|
190
|
+
await db.prepare("UPDATE mail_messages SET status = 'accepted', provider_id = ?, error = NULL, updated_at = ? WHERE id = ? AND status = 'sending'")
|
|
191
|
+
.bind(receipt.providerId || null, Date.now(), row.id).run();
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const provider = error instanceof EmailProviderError ? error : null;
|
|
195
|
+
const duplicate = !!provider && provider.status === 409;
|
|
196
|
+
const permanent = !!provider && provider.status >= 400 && provider.status < 500 && ![408, 429].includes(provider.status);
|
|
197
|
+
const status = duplicate ? 'uncertain' : permanent ? 'failed' : 'queued';
|
|
198
|
+
// Send-time rejection (including suppressed or unsubscribed recipients) is final
|
|
199
|
+
// and carries the provider's reason. Everything else retries automatically.
|
|
200
|
+
const detail = duplicate ? 'Provider already processed this key. Check provider logs to confirm delivery.'
|
|
201
|
+
: permanent ? `Send rejected (${provider.status})${provider.reason ? `: ${provider.reason}` : '. Check provider logs.'}`.slice(0, 500)
|
|
202
|
+
: 'Sending unavailable. Automatic retries are limited to five attempts.';
|
|
203
|
+
await db.prepare('UPDATE mail_messages SET status = ?, error = ?, next_attempt_at = ?, updated_at = ? WHERE id = ? AND status = \'sending\'')
|
|
204
|
+
.bind(status, detail, Date.now() + Math.min(3600000, 60000 * 2 ** row.attempts), Date.now(), row.id).run();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
await db.batch([
|
|
208
|
+
db.prepare('DELETE FROM user_recovery WHERE expires_at < ?').bind(Math.floor(now / 1000)),
|
|
209
|
+
db.prepare('DELETE FROM auth_rate_limits WHERE expires_at < ?').bind(Math.floor(now / 1000)),
|
|
210
|
+
]);
|
|
211
|
+
}
|
package/dist/lib/project-db.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { Bindings } from '../index';
|
|
2
|
-
export type LoginMethod = 'password' | 'otp';
|
|
3
2
|
export interface AdminUser {
|
|
4
3
|
id: string;
|
|
5
4
|
email: string;
|
|
6
5
|
name: string | null;
|
|
7
6
|
password_hash: string | null;
|
|
8
|
-
login_method: LoginMethod;
|
|
9
7
|
/** 1 for the project owner created during setup, null for everyone else. */
|
|
10
8
|
initial_admin: number | null;
|
|
11
9
|
disabled_at: number | null;
|
|
12
10
|
created_at: number;
|
|
13
11
|
updated_at: number;
|
|
14
12
|
}
|
|
15
|
-
export declare const PROJECT_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS admin_users (\n\tid TEXT NOT NULL PRIMARY KEY,\n\temail TEXT NOT NULL UNIQUE,\n\tname TEXT,\n\tpassword_hash TEXT,\n\tlogin_method TEXT NOT NULL
|
|
13
|
+
export declare const PROJECT_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS admin_users (\n\tid TEXT NOT NULL PRIMARY KEY,\n\temail TEXT NOT NULL UNIQUE,\n\tname TEXT,\n\tpassword_hash TEXT,\n\tlogin_method TEXT NOT NULL DEFAULT 'password',\n\tinitial_admin INTEGER UNIQUE,\n\tdisabled_at INTEGER,\n\tcreated_at INTEGER NOT NULL,\n\tupdated_at INTEGER NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS subscribers (\n\tid TEXT NOT NULL PRIMARY KEY,\n\temail TEXT NOT NULL UNIQUE,\n\tname TEXT,\n\tstatus TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'subscribed', 'unsubscribed', 'bounced', 'complained')),\n\tsource TEXT NOT NULL DEFAULT 'website' CHECK(source IN ('manual', 'import', 'website')),\n\tdata_json TEXT NOT NULL DEFAULT '{}',\n\tconfirmation_token TEXT,\n\tconfirmation_sent_at INTEGER,\n\tconfirmed_at INTEGER,\n\tsubscribed_at INTEGER,\n\tunsubscribed_at INTEGER,\n\tunsubscribe_token TEXT,\n\tcreated_at INTEGER NOT NULL,\n\tupdated_at INTEGER NOT NULL\n);\n\nCREATE UNIQUE INDEX IF NOT EXISTS idx_subscribers_email ON subscribers(email);\nCREATE INDEX IF NOT EXISTS idx_subscribers_status ON subscribers(status);\nCREATE INDEX IF NOT EXISTS idx_subscribers_created_at ON subscribers(created_at DESC);\nCREATE INDEX IF NOT EXISTS idx_subscribers_source ON subscribers(source);\n\nCREATE TABLE IF NOT EXISTS campaigns (\n\tid TEXT NOT NULL PRIMARY KEY,\n\tname TEXT NOT NULL,\n\tsubject TEXT NOT NULL,\n\tbody_html TEXT NOT NULL,\n\tstatus TEXT NOT NULL DEFAULT 'draft' CHECK(status IN ('draft', 'scheduled', 'sent')),\n\trecipient_count INTEGER,\n\tscheduled_at INTEGER,\n\tsent_at INTEGER,\n\tcreated_at INTEGER NOT NULL,\n\tupdated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_campaigns_status ON campaigns(status);\nCREATE INDEX IF NOT EXISTS idx_campaigns_created_at ON campaigns(created_at DESC);\n\nCREATE TABLE IF NOT EXISTS shop_orders (\n\tid TEXT NOT NULL PRIMARY KEY,\n\torder_number TEXT NOT NULL UNIQUE,\n\tstatus TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'approved', 'successful', 'aborted', 'failed')),\n\tpayment_method TEXT NOT NULL DEFAULT 'bank_transfer' CHECK(payment_method IN ('bank_transfer', 'stripe')),\n\tcustomer_json TEXT NOT NULL DEFAULT '{}',\n\titems_json TEXT NOT NULL DEFAULT '[]',\n\ttotals_json TEXT NOT NULL DEFAULT '{\"subtotal\":0,\"shipping\":0,\"tax\":0,\"total\":0,\"currency\":\"eur\"}',\n\tstripe_session_id TEXT,\n\tstripe_payment_intent_id TEXT,\n\tinvoice_number TEXT,\n\tinvoice_sent_at INTEGER,\n\tmetadata_json TEXT NOT NULL DEFAULT '{}',\n\tcreated_at INTEGER NOT NULL,\n\tupdated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_shop_orders_status ON shop_orders(status);\nCREATE INDEX IF NOT EXISTS idx_shop_orders_payment_method ON shop_orders(payment_method);\nCREATE INDEX IF NOT EXISTS idx_shop_orders_stripe_session ON shop_orders(stripe_session_id);\nCREATE UNIQUE INDEX IF NOT EXISTS idx_shop_orders_order_number ON shop_orders(order_number);\n";
|
|
16
14
|
export declare function getProjectDb(env: Bindings): D1Database;
|
|
17
15
|
export declare function ensureSchema(env: Bindings): Promise<D1Database>;
|
|
18
16
|
export declare function nowSeconds(): number;
|
|
@@ -20,5 +18,6 @@ export declare function createId(prefix: string): string;
|
|
|
20
18
|
export declare function sha256Base64Url(value: string): Promise<string>;
|
|
21
19
|
export declare function getAdminUserByEmail(env: Bindings, email: string): Promise<AdminUser | null>;
|
|
22
20
|
export declare function getAdminUserById(env: Bindings, userId: string): Promise<AdminUser | null>;
|
|
23
|
-
export declare function
|
|
21
|
+
export declare function credentialVersion(user: AdminUser): Promise<string>;
|
|
22
|
+
export declare function issueSessionForUser(user: AdminUser): Promise<Record<string, unknown>>;
|
|
24
23
|
//# sourceMappingURL=project-db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-db.d.ts","sourceRoot":"","sources":["../../src/lib/project-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"project-db.d.ts","sourceRoot":"","sources":["../../src/lib/project-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACnB;AAKD,eAAO,MAAM,kBAAkB,62FAwE9B,CAAC;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,CAMtD;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAerE;AAGD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOpE;AAED,wBAAsB,mBAAmB,CA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