@prenta/core 7.7.0 → 7.7.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/CHANGELOG.md +12 -0
- package/dist/api/route-helpers/auth.d.ts +131 -0
- package/dist/api/route-helpers/auth.d.ts.map +1 -0
- package/dist/api/route-helpers/auth.js +505 -0
- package/dist/api/route-helpers/auth.js.map +1 -0
- package/dist/api/route-helpers/authoring.d.ts +32 -0
- package/dist/api/route-helpers/authoring.d.ts.map +1 -0
- package/dist/api/route-helpers/authoring.js +99 -0
- package/dist/api/route-helpers/authoring.js.map +1 -0
- package/dist/api/route-helpers/forms.d.ts +46 -0
- package/dist/api/route-helpers/forms.d.ts.map +1 -0
- package/dist/api/route-helpers/forms.js +435 -0
- package/dist/api/route-helpers/forms.js.map +1 -0
- package/dist/api/route-helpers/http.d.ts +87 -0
- package/dist/api/route-helpers/http.d.ts.map +1 -0
- package/dist/api/route-helpers/http.js +286 -0
- package/dist/api/route-helpers/http.js.map +1 -0
- package/dist/api/route-helpers/media.d.ts +37 -0
- package/dist/api/route-helpers/media.d.ts.map +1 -0
- package/dist/api/route-helpers/media.js +189 -0
- package/dist/api/route-helpers/media.js.map +1 -0
- package/dist/api/route-helpers/page-shape.d.ts +31 -0
- package/dist/api/route-helpers/page-shape.d.ts.map +1 -0
- package/dist/api/route-helpers/page-shape.js +98 -0
- package/dist/api/route-helpers/page-shape.js.map +1 -0
- package/dist/api/route-helpers.d.ts +8 -358
- package/dist/api/route-helpers.d.ts.map +1 -1
- package/dist/api/route-helpers.js +7 -1592
- package/dist/api/route-helpers.js.map +1 -1
- package/dist/api/routes/seo/handlers/analysis.d.ts +4 -0
- package/dist/api/routes/seo/handlers/analysis.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/analysis.js +131 -0
- package/dist/api/routes/seo/handlers/analysis.js.map +1 -0
- package/dist/api/routes/seo/handlers/audits.d.ts +5 -0
- package/dist/api/routes/seo/handlers/audits.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/audits.js +121 -0
- package/dist/api/routes/seo/handlers/audits.js.map +1 -0
- package/dist/api/routes/seo/handlers/content.d.ts +4 -0
- package/dist/api/routes/seo/handlers/content.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/content.js +330 -0
- package/dist/api/routes/seo/handlers/content.js.map +1 -0
- package/dist/api/routes/seo/handlers/issue-helpers.d.ts +37 -0
- package/dist/api/routes/seo/handlers/issue-helpers.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/issue-helpers.js +72 -0
- package/dist/api/routes/seo/handlers/issue-helpers.js.map +1 -0
- package/dist/api/routes/seo/handlers/issues-briefs.d.ts +7 -0
- package/dist/api/routes/seo/handlers/issues-briefs.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/issues-briefs.js +341 -0
- package/dist/api/routes/seo/handlers/issues-briefs.js.map +1 -0
- package/dist/api/routes/seo/handlers/issues-fixes.d.ts +4 -0
- package/dist/api/routes/seo/handlers/issues-fixes.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/issues-fixes.js +233 -0
- package/dist/api/routes/seo/handlers/issues-fixes.js.map +1 -0
- package/dist/api/routes/seo/handlers/issues-list.d.ts +7 -0
- package/dist/api/routes/seo/handlers/issues-list.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/issues-list.js +191 -0
- package/dist/api/routes/seo/handlers/issues-list.js.map +1 -0
- package/dist/api/routes/seo/handlers/links.d.ts +6 -0
- package/dist/api/routes/seo/handlers/links.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/links.js +383 -0
- package/dist/api/routes/seo/handlers/links.js.map +1 -0
- package/dist/api/routes/seo/handlers/overview.d.ts +4 -0
- package/dist/api/routes/seo/handlers/overview.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/overview.js +348 -0
- package/dist/api/routes/seo/handlers/overview.js.map +1 -0
- package/dist/api/routes/seo/handlers/pages.d.ts +2 -0
- package/dist/api/routes/seo/handlers/pages.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/pages.js +38 -0
- package/dist/api/routes/seo/handlers/pages.js.map +1 -0
- package/dist/api/routes/seo/handlers/proposals.d.ts +4 -0
- package/dist/api/routes/seo/handlers/proposals.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/proposals.js +93 -0
- package/dist/api/routes/seo/handlers/proposals.js.map +1 -0
- package/dist/api/routes/seo/handlers/public-files.d.ts +6 -0
- package/dist/api/routes/seo/handlers/public-files.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/public-files.js +328 -0
- package/dist/api/routes/seo/handlers/public-files.js.map +1 -0
- package/dist/api/routes/seo/handlers/shared.d.ts +24 -0
- package/dist/api/routes/seo/handlers/shared.d.ts.map +1 -0
- package/dist/api/routes/seo/handlers/shared.js +67 -0
- package/dist/api/routes/seo/handlers/shared.js.map +1 -0
- package/dist/api/routes/seo.d.ts +5 -5
- package/dist/api/routes/seo.d.ts.map +1 -1
- package/dist/api/routes/seo.js +56 -2610
- package/dist/api/routes/seo.js.map +1 -1
- package/dist/api/routes/users/handlers/api-keys.d.ts +4 -0
- package/dist/api/routes/users/handlers/api-keys.d.ts.map +1 -0
- package/dist/api/routes/users/handlers/api-keys.js +164 -0
- package/dist/api/routes/users/handlers/api-keys.js.map +1 -0
- package/dist/api/routes/users/handlers/invites.d.ts +7 -0
- package/dist/api/routes/users/handlers/invites.d.ts.map +1 -0
- package/dist/api/routes/users/handlers/invites.js +201 -0
- package/dist/api/routes/users/handlers/invites.js.map +1 -0
- package/dist/api/routes/users/handlers/users-admin.d.ts +7 -0
- package/dist/api/routes/users/handlers/users-admin.d.ts.map +1 -0
- package/dist/api/routes/users/handlers/users-admin.js +310 -0
- package/dist/api/routes/users/handlers/users-admin.js.map +1 -0
- package/dist/api/routes/users/handlers/users-detail.d.ts +16 -0
- package/dist/api/routes/users/handlers/users-detail.d.ts.map +1 -0
- package/dist/api/routes/users/handlers/users-detail.js +525 -0
- package/dist/api/routes/users/handlers/users-detail.js.map +1 -0
- package/dist/api/routes/users.d.ts +4 -0
- package/dist/api/routes/users.d.ts.map +1 -1
- package/dist/api/routes/users.js +38 -1177
- package/dist/api/routes/users.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/api/route-helpers/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,qFAAqF;AACrF,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,GAAG,GAAG,UAAU,GAAG,MAAM,CAAA;IAC/B,OAAO,MAAM,CAAC,yBAAyB,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;AAC7F,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,UAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QACzF,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,EAAE,CAAA;AACR,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC3C,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;IACl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GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAW,EACX,aAAsB;IAEtB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACrE,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAA;QACzB,MAAM,WAAW,GAAG,CAClB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,aAAa,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAC9E,CAAC,IAAI,EAAE,CAAA;QACR,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAA;QAClD,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAA;QACxE,IAAI,cAAc,GAAG,sBAAsB;YAAE,OAAO,IAAI,CAAA;QACxD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QACpD,IAAI,MAAM,CAAC,UAAU,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,GAAG,sBAAsB;YAAE,OAAO,IAAI,CAAA;QACtF,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare function normalizeRedirect(redirect: any): any;
|
|
2
|
+
export declare function normalizeSeoPage(page: any): {
|
|
3
|
+
id: any;
|
|
4
|
+
collection: any;
|
|
5
|
+
updatedAt: any;
|
|
6
|
+
url: {};
|
|
7
|
+
title: any;
|
|
8
|
+
score: number;
|
|
9
|
+
issues: number;
|
|
10
|
+
metaTitle: {};
|
|
11
|
+
metaDescription: {};
|
|
12
|
+
canonical: {};
|
|
13
|
+
schemaType: {};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Renders a 1200x630 SVG suitable for og:image. We don't pull in Satori/resvg
|
|
17
|
+
* because most integrators don't need PNG — major crawlers (Facebook, Twitter,
|
|
18
|
+
* LinkedIn, Slack, Discord) handle image/svg+xml correctly. Sites that
|
|
19
|
+
* specifically need PNG can override with their own /og endpoint via
|
|
20
|
+
* @vercel/og and point `seo.defaultOgImage` at it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderOgSvg(opts: {
|
|
23
|
+
title: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
siteName?: string | null;
|
|
26
|
+
theme: 'light' | 'dark';
|
|
27
|
+
bg: string;
|
|
28
|
+
fg: string;
|
|
29
|
+
muted: string;
|
|
30
|
+
}): string;
|
|
31
|
+
//# sourceMappingURL=page-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-shape.d.ts","sourceRoot":"","sources":["../../../src/api/route-helpers/page-shape.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,OAS9C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;EAyBzC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,MAAM,CAyDT"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { asRecord } from './http.js';
|
|
2
|
+
export function normalizeRedirect(redirect) {
|
|
3
|
+
return {
|
|
4
|
+
...redirect,
|
|
5
|
+
from: redirect.from ?? redirect.source ?? '',
|
|
6
|
+
to: redirect.to ?? redirect.destination ?? '',
|
|
7
|
+
type: String(redirect.type ?? redirect.statusCode ?? 301),
|
|
8
|
+
hits: Number(redirect.hits ?? 0),
|
|
9
|
+
active: redirect.active ?? true,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function normalizeSeoPage(page) {
|
|
13
|
+
const data = asRecord(page.data);
|
|
14
|
+
const structuredData = asRecord(page.structuredData);
|
|
15
|
+
const issueValue = structuredData.issues ?? data.issues;
|
|
16
|
+
const issueCount = Array.isArray(issueValue) ? issueValue.length : Number(issueValue ?? 0);
|
|
17
|
+
const slug = String(data.slug ?? page.slug ?? page.id ?? '');
|
|
18
|
+
const schemaType = data.schemaType ?? data.structuredDataType ?? structuredData.schemaType ?? '';
|
|
19
|
+
// Return ONLY the derived summary fields — never the raw `data` /
|
|
20
|
+
// `structuredData` JSONB blobs. This endpoint powers a summary table; for
|
|
21
|
+
// section-built pages those blobs are large, so spreading them made the
|
|
22
|
+
// response grow linearly with page content (megabytes for a table that only
|
|
23
|
+
// needs a dozen scalar fields).
|
|
24
|
+
return {
|
|
25
|
+
id: page.id,
|
|
26
|
+
collection: page.collection,
|
|
27
|
+
updatedAt: page.updatedAt,
|
|
28
|
+
url: data.url ?? (slug === 'home' ? '/' : `/${slug}`),
|
|
29
|
+
title: data.title ?? page.title ?? 'Untitled',
|
|
30
|
+
score: Number(structuredData.score ?? data.score ?? 0),
|
|
31
|
+
issues: issueCount,
|
|
32
|
+
metaTitle: data.metaTitle ?? '',
|
|
33
|
+
metaDescription: data.metaDescription ?? '',
|
|
34
|
+
canonical: data.canonical ?? data.canonicalUrl ?? '',
|
|
35
|
+
schemaType,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Renders a 1200x630 SVG suitable for og:image. We don't pull in Satori/resvg
|
|
40
|
+
* because most integrators don't need PNG — major crawlers (Facebook, Twitter,
|
|
41
|
+
* LinkedIn, Slack, Discord) handle image/svg+xml correctly. Sites that
|
|
42
|
+
* specifically need PNG can override with their own /og endpoint via
|
|
43
|
+
* @vercel/og and point `seo.defaultOgImage` at it.
|
|
44
|
+
*/
|
|
45
|
+
export function renderOgSvg(opts) {
|
|
46
|
+
const { title, description, siteName, bg, fg, muted } = opts;
|
|
47
|
+
// Naive line wrapping at ~22 chars (large font). Good enough for an OG card;
|
|
48
|
+
// anything longer than ~3 lines gets truncated with an ellipsis.
|
|
49
|
+
const wrap = (text, maxChars, maxLines) => {
|
|
50
|
+
const words = text.split(/\s+/);
|
|
51
|
+
const lines = [];
|
|
52
|
+
let current = '';
|
|
53
|
+
for (const w of words) {
|
|
54
|
+
if (lines.length >= maxLines)
|
|
55
|
+
break;
|
|
56
|
+
const next = current ? `${current} ${w}` : w;
|
|
57
|
+
if (next.length > maxChars) {
|
|
58
|
+
if (current)
|
|
59
|
+
lines.push(current);
|
|
60
|
+
current = w;
|
|
61
|
+
if (lines.length === maxLines - 1 && words.indexOf(w) < words.length - 1) {
|
|
62
|
+
lines.push(current.length > maxChars ? current.slice(0, maxChars - 1) + '…' : current + '…');
|
|
63
|
+
current = '';
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
current = next;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (current && lines.length < maxLines)
|
|
72
|
+
lines.push(current);
|
|
73
|
+
return lines;
|
|
74
|
+
};
|
|
75
|
+
const escapeSvg = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
76
|
+
const titleLines = wrap(title, 28, 3);
|
|
77
|
+
const descLines = description ? wrap(description, 60, 2) : [];
|
|
78
|
+
const titleEls = titleLines
|
|
79
|
+
.map((line, i) => `<tspan x="60" dy="${i === 0 ? 0 : 78}">${escapeSvg(line)}</tspan>`)
|
|
80
|
+
.join('');
|
|
81
|
+
const descEls = descLines
|
|
82
|
+
.map((line, i) => `<tspan x="60" dy="${i === 0 ? 0 : 36}">${escapeSvg(line)}</tspan>`)
|
|
83
|
+
.join('');
|
|
84
|
+
// Layout: site name top-left, title bottom-left, description below title.
|
|
85
|
+
// Coordinates are roughly aligned to the 1200x630 spec used by every major
|
|
86
|
+
// social platform.
|
|
87
|
+
const titleY = descLines.length > 0 ? 360 : 420;
|
|
88
|
+
const descY = titleY + 80 * titleLines.length;
|
|
89
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
90
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
|
|
91
|
+
<rect width="1200" height="630" fill="${bg}"/>
|
|
92
|
+
${siteName ? `<text x="60" y="100" font-family="system-ui, -apple-system, Segoe UI, Arial, sans-serif" font-size="28" font-weight="500" fill="${muted}">${escapeSvg(siteName)}</text>` : ''}
|
|
93
|
+
<text x="60" y="${titleY}" font-family="system-ui, -apple-system, Segoe UI, Arial, sans-serif" font-size="68" font-weight="700" fill="${fg}">${titleEls}</text>
|
|
94
|
+
${descLines.length > 0 ? `<text x="60" y="${descY}" font-family="system-ui, -apple-system, Segoe UI, Arial, sans-serif" font-size="30" fill="${muted}">${descEls}</text>` : ''}
|
|
95
|
+
<rect x="60" y="560" width="60" height="6" fill="${fg}" rx="3"/>
|
|
96
|
+
</svg>`;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=page-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-shape.js","sourceRoot":"","sources":["../../../src/api/route-helpers/page-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,UAAU,i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AI,EAAE,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;SACrF,IAAI,CAAC,EAAE,CAAC,CAAA;IACX,MAAM,OAAO,GAAG,SAAS;SACtB,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;SACrF,IAAI,CAAC,EAAE,CAAC,CAAA;IAEX,0EAA0E;IAC1E,2EAA2E;IAC3E,mBAAmB;IACnB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/C,MAAM,KAAK,GAAG,MAAM,GAAG,EAAE,GAAG,UAAU,CAAC,MAAM,CAAA;IAE7C,OAAO;;0CAEiC,EAAE;IACxC,QAAQ,CAAC,CAAC,CAAC,mIAAmI,KAAK,KAAK,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;oBACzK,MAAM,gHAAgH,EAAE,KAAK,QAAQ;IACrJ,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,KAAK,8FAA8F,KAAK,KAAK,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE;qDAC3H,EAAE;OAChD,CAAA;AACP,CAAC"}
|
|
@@ -1,361 +1,11 @@
|
|
|
1
|
-
import type { ActionContext } from '../actions.js';
|
|
2
|
-
import { type TeamOptions } from '../auth/team.js';
|
|
3
|
-
import type { FetchFormEntriesParams, FetchFormsParams, FormDefinition } from '../forms/types.js';
|
|
4
|
-
import { type IncomingFile } from '../forms/files.js';
|
|
5
|
-
import { type ApiKeyScope } from '../security/api-key-enhanced.js';
|
|
6
|
-
import { SECURITY_HEADERS } from './security-headers.js';
|
|
7
|
-
import type { PrentaDB } from '../db/client-types.js';
|
|
8
|
-
export declare function importBlobStorage(): Promise<any>;
|
|
9
1
|
export { importAIPlugin } from '../ai/plugin-import.js';
|
|
10
|
-
|
|
11
|
-
* Build the system/user prompt for an inline co-author action. Kept
|
|
12
|
-
* deterministic and small so the governed runtime can route it to any
|
|
13
|
-
* configured provider/model.
|
|
14
|
-
*/
|
|
15
|
-
export declare function buildCoauthorPrompt(action: 'rewrite' | 'expand' | 'compress' | 'proofread', body: {
|
|
16
|
-
text?: string;
|
|
17
|
-
style?: string;
|
|
18
|
-
tone?: string;
|
|
19
|
-
instructions?: string;
|
|
20
|
-
targetLength?: number;
|
|
21
|
-
}): {
|
|
22
|
-
system: string;
|
|
23
|
-
user: string;
|
|
24
|
-
maxTokens: number;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Common helper for the read endpoints. Reads the `?populate=` query param,
|
|
28
|
-
* fetches the target collection's field schema, and expands every relation
|
|
29
|
-
* reference into a {@link RelationSummary}. When the caller didn't ask for
|
|
30
|
-
* population (or the doc has no `data` field) we short-circuit and return
|
|
31
|
-
* the doc untouched.
|
|
32
|
-
*
|
|
33
|
-
* Lives here (not in `actions.ts`) because the rest of the actions API
|
|
34
|
-
* stays purely DB-shaped — population is an HTTP concern.
|
|
35
|
-
*/
|
|
36
|
-
export declare function maybePopulate(request: Request, collection: string, doc: Record<string, unknown> | null, dbInstance: PrentaDB, viewer?: {
|
|
37
|
-
id?: string;
|
|
38
|
-
role?: string;
|
|
39
|
-
}): Promise<Record<string, unknown> | null>;
|
|
40
|
-
export { SECURITY_HEADERS };
|
|
41
|
-
export declare function json(data: unknown, status?: number): Response;
|
|
42
|
-
/**
|
|
43
|
-
* Variant of `json()` that emits the Phase-5.5 public-read
|
|
44
|
-
* `Cache-Control` header when the active CMS config opts in.
|
|
45
|
-
*
|
|
46
|
-
* - Session-cookie requests always get `private, no-store`.
|
|
47
|
-
* - API-key / unauthenticated requests get
|
|
48
|
-
* `public, s-maxage=N, stale-while-revalidate=M` when
|
|
49
|
-
* `cache.publicReads.enabled` is true.
|
|
50
|
-
* - Otherwise no `Cache-Control` header is set (i.e. the response is
|
|
51
|
-
* uncacheable downstream, matching the pre-5.5 behaviour).
|
|
52
|
-
*
|
|
53
|
-
* Use this for the public read endpoints (`/collections/:slug`,
|
|
54
|
-
* `/collections/:slug/:id`, `/globals/:slug`, `/resolve`). Mutating
|
|
55
|
-
* endpoints stay on the plain `json()` so the CDN never caches a write
|
|
56
|
-
* response by accident.
|
|
57
|
-
*/
|
|
58
|
-
export declare function jsonWithCache(data: unknown, request: Request, status?: number): Response;
|
|
59
|
-
export declare function errorResponse(message: string, status: number): Response;
|
|
60
|
-
export declare function internalError(err: unknown, context?: string): Response;
|
|
61
|
-
/**
|
|
62
|
-
* Map a thrown action-layer error to the right HTTP status. The data layer
|
|
63
|
-
* throws plain `Error`s with stable, human-readable prefixes for client-fixable
|
|
64
|
-
* problems (publish validation, access/permission, not-found); those are 4xx
|
|
65
|
-
* and the message is safe to return verbatim. Anything else falls through to
|
|
66
|
-
* {@link internalError} (500, generic message, logged).
|
|
67
|
-
*/
|
|
68
|
-
export declare function actionError(err: unknown, context?: string): Response;
|
|
69
|
-
export declare function clampPageSize(raw: number | string | null, max?: number, fallback?: number): number;
|
|
70
|
-
/**
|
|
71
|
-
* Clamp a 1-based list `page` query param. Negative / zero / NaN values must
|
|
72
|
-
* never reach Prisma `skip` (negative OFFSET → validation error → opaque 500).
|
|
73
|
-
* Mirrors forms/users/redirects (`Math.max(1, …)`).
|
|
74
|
-
*/
|
|
75
|
-
export declare function clampPage(raw: number | string | null | undefined, fallback?: number): number;
|
|
76
|
-
/** Parse a JSON object body; invalid JSON or a non-object yields a 400. */
|
|
77
|
-
export declare function readJsonBody(request: Request): Promise<{
|
|
78
|
-
ok: true;
|
|
79
|
-
data: Record<string, unknown>;
|
|
80
|
-
} | {
|
|
81
|
-
ok: false;
|
|
82
|
-
error: Response;
|
|
83
|
-
}>;
|
|
84
|
-
export declare function mediaUrl(storageKey: unknown): string;
|
|
85
|
-
export declare function normalizeMediaItem(media: any): any;
|
|
86
|
-
/**
|
|
87
|
-
* Map the `MediaUsage` join rows (with their related document) into the
|
|
88
|
-
* `{ page, path }[]` shape the admin drawer renders. Soft-deleted documents
|
|
89
|
-
* are excluded so trashed pages don't keep an asset looking "in use".
|
|
90
|
-
*/
|
|
91
|
-
export declare function buildMediaUsedOn(mediaUsages: unknown): {
|
|
92
|
-
page: string;
|
|
93
|
-
path: string;
|
|
94
|
-
}[];
|
|
95
|
-
/**
|
|
96
|
-
* Derive a concise, Title-Cased title from AI-generated alt text. The alt
|
|
97
|
-
* text is already a model output describing the image, so the title stays
|
|
98
|
-
* grounded in real content rather than the filename.
|
|
99
|
-
*/
|
|
100
|
-
export declare function deriveMediaTitleFromAlt(alt: string): string;
|
|
101
|
-
export declare function asRecord(value: unknown): Record<string, unknown>;
|
|
102
|
-
export declare function normalizeSubmission(submission: any): any;
|
|
103
|
-
/**
|
|
104
|
-
* Map a forms-service domain error to an HTTP response. Returns `null` for
|
|
105
|
-
* unrecognised errors so the caller can fall through to `internalError`.
|
|
106
|
-
*/
|
|
107
|
-
export declare function mapFormError(err: unknown): Response | null;
|
|
108
|
-
export declare function parseFormsQuery(url: URL): FetchFormsParams;
|
|
109
|
-
export declare function parseEntriesQuery(url: URL): FetchFormEntriesParams;
|
|
110
|
-
/**
|
|
111
|
-
* Build CORS headers for the public form endpoints. When the form has no
|
|
112
|
-
* embed allowlist we reflect the requesting origin (open embedding). When an
|
|
113
|
-
* allowlist is set we only echo the origin if it matches, so a disallowed site
|
|
114
|
-
* cannot read the response. Browser-level CORS is complemented by a hard
|
|
115
|
-
* server-side origin check in the submit handler.
|
|
116
|
-
*/
|
|
117
|
-
export declare function formCorsHeaders(request: Request, allowedDomains?: string[]): Record<string, string>;
|
|
118
|
-
export declare function jsonWithHeaders(data: unknown, status: number, extra: Record<string, string>): Response;
|
|
119
|
-
/**
|
|
120
|
-
* Parse a public submission request into field values, files, and metadata.
|
|
121
|
-
* Supports both `application/json` (no files) and `multipart/form-data`
|
|
122
|
-
* (files + fields). Unknown/oversized bodies are rejected by the caller's
|
|
123
|
-
* Content-Length gate before this runs.
|
|
124
|
-
*/
|
|
125
|
-
export declare function parseSubmissionRequest(request: Request): Promise<{
|
|
126
|
-
values: Record<string, unknown>;
|
|
127
|
-
files: IncomingFile[];
|
|
128
|
-
meta: {
|
|
129
|
-
attribution: Record<string, unknown> | null;
|
|
130
|
-
elapsedMs: number | null;
|
|
131
|
-
pageUrl: string | null;
|
|
132
|
-
captchaToken: string;
|
|
133
|
-
};
|
|
134
|
-
} | null>;
|
|
135
|
-
/**
|
|
136
|
-
* Shared public-submission handler used by both the slug-based public route and
|
|
137
|
-
* the legacy by-id route. Enforces per-IP+form rate limiting, embed-origin
|
|
138
|
-
* allowlisting, optional CAPTCHA, file validation, then runs the core
|
|
139
|
-
* submission pipeline. Always responds with CORS headers so embedded forms can
|
|
140
|
-
* read the result.
|
|
141
|
-
*/
|
|
142
|
-
export declare function submitToForm(request: Request, form: FormDefinition): Promise<Response>;
|
|
143
|
-
/** Native HTML form posts typically prefer HTML; fetch/XHR clients send Accept: application/json. */
|
|
144
|
-
export declare function requestPrefersHtmlResponse(request: Request): boolean;
|
|
145
|
-
export declare function normalizeRedirect(redirect: any): any;
|
|
146
|
-
export declare function normalizeSeoPage(page: any): {
|
|
147
|
-
id: any;
|
|
148
|
-
collection: any;
|
|
149
|
-
updatedAt: any;
|
|
150
|
-
url: {};
|
|
151
|
-
title: any;
|
|
152
|
-
score: number;
|
|
153
|
-
issues: number;
|
|
154
|
-
metaTitle: {};
|
|
155
|
-
metaDescription: {};
|
|
156
|
-
canonical: {};
|
|
157
|
-
schemaType: {};
|
|
158
|
-
};
|
|
159
|
-
export declare function hasModel(d: any, name: string): boolean;
|
|
160
|
-
/** Format a number compactly, e.g. 8400 -> "8.4K", 1_200_000 -> "1.2M". */
|
|
161
|
-
export declare function formatCompactNumber(n: number): string;
|
|
162
|
-
/** Minimal CSV line parser supporting double-quoted fields with escaped quotes. */
|
|
163
|
-
export declare function parseCsvLine(line: string): string[];
|
|
164
|
-
export declare function modelNotAvailable(name: string): Response;
|
|
165
|
-
/**
|
|
166
|
-
* XML-escape a value for safe inclusion in sitemap content. Sitemaps reject
|
|
167
|
-
* unescaped ampersands and angle brackets; URLs frequently contain `&` query
|
|
168
|
-
* separators, so this is non-optional.
|
|
169
|
-
*/
|
|
170
|
-
export declare function escapeXml(value: string): string;
|
|
171
|
-
/**
|
|
172
|
-
* URLs per sitemap file. The sitemaps protocol caps a single file at 50,000
|
|
173
|
-
* URLs, but the child-sitemap route must load each row's full `data` JSON blob
|
|
174
|
-
* (for path/noindex/images) into memory to build the XML — at 45k rows that is
|
|
175
|
-
* hundreds of MB per request on an unauthenticated, crawler-hit endpoint. We
|
|
176
|
-
* cap well below the protocol limit to bound per-request memory; collections
|
|
177
|
-
* larger than this are split across multiple `?page=N` files referenced from
|
|
178
|
-
* the sitemap index, so no URLs are lost.
|
|
179
|
-
*/
|
|
180
|
-
export declare const SITEMAP_PAGE_SIZE = 10000;
|
|
181
|
-
/**
|
|
182
|
-
* Renders a 1200x630 SVG suitable for og:image. We don't pull in Satori/resvg
|
|
183
|
-
* because most integrators don't need PNG — major crawlers (Facebook, Twitter,
|
|
184
|
-
* LinkedIn, Slack, Discord) handle image/svg+xml correctly. Sites that
|
|
185
|
-
* specifically need PNG can override with their own /og endpoint via
|
|
186
|
-
* @vercel/og and point `seo.defaultOgImage` at it.
|
|
187
|
-
*/
|
|
188
|
-
export declare function renderOgSvg(opts: {
|
|
189
|
-
title: string;
|
|
190
|
-
description?: string;
|
|
191
|
-
siteName?: string | null;
|
|
192
|
-
theme: 'light' | 'dark';
|
|
193
|
-
bg: string;
|
|
194
|
-
fg: string;
|
|
195
|
-
muted: string;
|
|
196
|
-
}): string;
|
|
197
|
-
/**
|
|
198
|
-
* Log unexpected query failures from the `safe*` wrappers.
|
|
199
|
-
*
|
|
200
|
-
* The wrappers exist so an optional Prisma model (e.g. a delegate
|
|
201
|
-
* that older schemas don't define) doesn't blow up the route — they
|
|
202
|
-
* return the empty value (`0` / `[]`) when the model isn't available.
|
|
203
|
-
* That defensive contract historically swallowed *every* error,
|
|
204
|
-
* including Prisma's "Unknown argument" rejections that flag a real
|
|
205
|
-
* application bug (see the `relationLoadStrategy` regression
|
|
206
|
-
* discovered while landing Phase 5.5 #5). Logging the underlying
|
|
207
|
-
* error preserves the defensive return semantics while making the
|
|
208
|
-
* actual class of bug visible in Vercel + Sentry logs.
|
|
209
|
-
*
|
|
210
|
-
* Kept private to this module — it's a logging contract, not a
|
|
211
|
-
* public API.
|
|
212
|
-
*/
|
|
213
|
-
export declare function logSafeQueryFailure(scope: string, err: unknown): void;
|
|
214
|
-
export declare function safeCount(model: any, where?: Record<string, unknown>): Promise<number>;
|
|
215
|
-
export declare function safeFindMany<T>(model: any, args: Record<string, unknown>): Promise<T[]>;
|
|
216
|
-
/**
|
|
217
|
-
* String-level gate before fetching a media `storageKey`. Delegates to
|
|
218
|
-
* {@link validateWebhookUrl} (IP canonicalization for decimal/octal/hex,
|
|
219
|
-
* CGNAT, metadata, etc.) so this allowlist cannot drift from the SSRF policy
|
|
220
|
-
* used by `safeFetch`. Also rejects `*.local` (mDNS) which webhook validation
|
|
221
|
-
* does not cover.
|
|
222
|
-
*/
|
|
223
|
-
export declare function isAllowedStorageUrl(url: string): boolean;
|
|
224
|
-
/**
|
|
225
|
-
* Fetch image bytes for multimodal (vision) analysis through {@link safeFetch}
|
|
226
|
-
* (SSRF-safe: re-validates the host, DNS-resolves to defeat rebinding, no
|
|
227
|
-
* redirects). Returns `null` on any failure (non-image, oversize, blocked,
|
|
228
|
-
* network) so the caller transparently falls back to a context-only heuristic.
|
|
229
|
-
*/
|
|
230
|
-
export declare function fetchImageForVision(url: string, knownMimeType?: string): Promise<{
|
|
231
|
-
base64: string;
|
|
232
|
-
mimeType: string;
|
|
233
|
-
} | null>;
|
|
234
|
-
export declare function getSessionSecret(): string;
|
|
235
|
-
export declare function isSecretMissing(): boolean;
|
|
236
|
-
/**
|
|
237
|
-
* Authenticated request context. `apiKey` is set when the request was
|
|
238
|
-
* authenticated via an `act_sk_*` API key (rather than a user session) — in
|
|
239
|
-
* that case `sessionId` is the API key id and `role` reflects either the
|
|
240
|
-
* granted `admin` scope or `'API_KEY'` for scoped keys.
|
|
241
|
-
*/
|
|
242
|
-
export type AuthSession = {
|
|
243
|
-
userId: string;
|
|
244
|
-
role: string;
|
|
245
|
-
sessionId: string;
|
|
246
|
-
apiKey?: {
|
|
247
|
-
id: string;
|
|
248
|
-
scopes: ApiKeyScope;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
export declare function extractSession(request: Request): Promise<AuthSession | null>;
|
|
252
|
-
export declare function parseCookieHeader(cookieHeader: string): Record<string, string>;
|
|
253
|
-
/**
|
|
254
|
-
* Verify a password (or "current password") posted in the X-Reauth-Password
|
|
255
|
-
* header against the authenticated user. Returns an error Response when the
|
|
256
|
-
* header is missing or the password is wrong; returns null on success.
|
|
257
|
-
*
|
|
258
|
-
* Use this for high-impact account changes (TOTP enable/disable, role change,
|
|
259
|
-
* delete user, etc.) so a stolen session alone cannot perform them.
|
|
260
|
-
*/
|
|
261
|
-
export declare function requirePasswordReauth(request: Request, userId: string): Promise<Response | null>;
|
|
262
|
-
export declare function requireAuth(request: Request): Promise<{
|
|
263
|
-
session: AuthSession;
|
|
264
|
-
error?: never;
|
|
265
|
-
} | {
|
|
266
|
-
session?: never;
|
|
267
|
-
error: Response;
|
|
268
|
-
}>;
|
|
269
|
-
/**
|
|
270
|
-
* API-key collection-scope check as a plain denial reason (`null` = allowed).
|
|
271
|
-
* JWT sessions are never denied here — role checks are the route's job. Use
|
|
272
|
-
* this where the collection is only known deep inside a service (e.g. an SEO
|
|
273
|
-
* fix that writes a document) and a `Response` cannot be returned directly.
|
|
274
|
-
*/
|
|
275
|
-
export declare function apiKeyCollectionScopeDenial(session: AuthSession, collection: string, action: 'read' | 'create' | 'update' | 'delete'): string | null;
|
|
276
|
-
/**
|
|
277
|
-
* Check that the request's auth context permits `action` on `collection`.
|
|
278
|
-
* - Session-authenticated requests fall through to `requireRole` semantics:
|
|
279
|
-
* write actions require WRITE_ROLES.
|
|
280
|
-
* - API-key-authenticated requests must have an explicit scope match.
|
|
281
|
-
*/
|
|
282
|
-
export declare function requireCollectionScope(session: AuthSession, collection: string, action: 'read' | 'create' | 'update' | 'delete'): Response | null;
|
|
283
|
-
export declare function requireGlobalScope(session: AuthSession, slug: string): Response | null;
|
|
284
|
-
export declare function requireMediaScope(session: AuthSession): Response | null;
|
|
285
|
-
export declare function requireAdminScope(session: AuthSession): Response | null;
|
|
286
|
-
export declare function buildActionContext(session: {
|
|
287
|
-
userId: string;
|
|
288
|
-
role: string;
|
|
289
|
-
}, db: PrentaDB, locale?: string): ActionContext;
|
|
290
|
-
export declare const WRITE_ROLES: Set<string>;
|
|
291
|
-
export declare const ADMIN_ROLES: Set<string>;
|
|
292
|
-
export declare function requireRole(role: string, allowedRoles: Set<string>): Response | null;
|
|
293
|
-
/**
|
|
294
|
-
* Build the shared {@link TeamOptions} for the Users endpoints from config +
|
|
295
|
-
* session: the workspace domain (for external-domain detection) and the seat
|
|
296
|
-
* cap (config-provided; null = unlimited until billing exists).
|
|
297
|
-
*/
|
|
298
|
-
export declare function teamOptionsFor(session: AuthSession): TeamOptions;
|
|
299
|
-
/**
|
|
300
|
-
* DB-aware variant of {@link isEmailConfigured} — also true when a provider
|
|
301
|
-
* is configured through Settings > Email.
|
|
302
|
-
*/
|
|
303
|
-
export declare function isEmailConfiguredAsync(db?: unknown): Promise<boolean>;
|
|
304
|
-
export declare const loginLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
305
|
-
export declare const loginUnknownLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
306
|
-
/** Per-email-hash login limiter so account protection does not depend on IP. */
|
|
307
|
-
export declare const loginEmailLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
308
|
-
export declare const inviteLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
309
|
-
export declare const totpLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
310
|
-
export declare const emailTestLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
311
|
-
export declare const aiGenerateLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
312
|
-
export declare const uploadLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
313
|
-
export declare const aiAnalysisLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
314
|
-
export declare const AI_ANALYSIS_MAX_CHARS = 50000;
|
|
315
|
-
export declare const linkHealthLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
316
|
-
export declare const seoAuditLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
317
|
-
export declare const searchConsoleTestLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
318
|
-
export declare const searchSyncLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
319
|
-
export declare const digestTestSendLimiter: import("../security/rate-limit.js").RateLimiter;
|
|
320
|
-
export declare function checkRateLimitAsync(limiter: {
|
|
321
|
-
check: (key: string) => Promise<{
|
|
322
|
-
allowed: boolean;
|
|
323
|
-
}>;
|
|
324
|
-
}, key: string): Promise<boolean>;
|
|
325
|
-
/**
|
|
326
|
-
* Resolve the client IP from trusted-proxy headers (Vercel first, then x-real-ip,
|
|
327
|
-
* then x-forwarded-for only when PRENTA_TRUST_PROXY=1). Returns 'unknown' when
|
|
328
|
-
* no trustworthy source is available — callers MUST treat that case as a hard
|
|
329
|
-
* failure for security-sensitive decisions like rate-limit keys and IP allowlists.
|
|
330
|
-
*/
|
|
331
|
-
export declare function clientIp(request: Request): string;
|
|
332
|
-
/**
|
|
333
|
-
* Compute a before/after diff of top-level scalar (string/number/boolean) keys
|
|
334
|
-
* between a stored record and an incoming patch. Used to audit settings changes
|
|
335
|
-
* without ever logging nested objects (which may hold secret blobs).
|
|
336
|
-
*/
|
|
337
|
-
export declare function diffScalarKeys(previous: Record<string, unknown>, next: Record<string, unknown>): Array<{
|
|
338
|
-
key: string;
|
|
339
|
-
from: unknown;
|
|
340
|
-
to: unknown;
|
|
341
|
-
}>;
|
|
342
|
-
/**
|
|
343
|
-
* After a successful primary-credential check, prune the user's active sessions
|
|
344
|
-
* down to the configured concurrent maximum (default 5; configurable via
|
|
345
|
-
* `auth.maxConcurrentSessions`). Strategy is "revoke oldest" so a user can
|
|
346
|
-
* always sign in.
|
|
347
|
-
*/
|
|
348
|
-
export declare function enforceSessionLimitsForUser(d: any, userId: string): Promise<void>;
|
|
349
|
-
/** Revoke every live API key for a user. Called with session revocation. */
|
|
350
|
-
export declare function revokeUserApiKeys(d: any, userId: string): Promise<number>;
|
|
351
|
-
export declare function getAdminPath(): string;
|
|
2
|
+
export { SECURITY_HEADERS } from './security-headers.js';
|
|
352
3
|
export { findCollectionDef, collectionSupportsSections } from '../config/collection-lookup.js';
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
export declare function enforceDocumentReadAccess(session: AuthSession, collection: string): Promise<Response | null>;
|
|
4
|
+
export { importBlobStorage, mediaUrl, normalizeMediaItem, buildMediaUsedOn, deriveMediaTitleFromAlt, isAllowedStorageUrl, fetchImageForVision, } from './route-helpers/media.js';
|
|
5
|
+
export { buildCoauthorPrompt, maybePopulate } from './route-helpers/authoring.js';
|
|
6
|
+
export { json, jsonWithCache, errorResponse, internalError, actionError, clampPageSize, clampPage, readJsonBody, asRecord, hasModel, formatCompactNumber, parseCsvLine, modelNotAvailable, escapeXml, SITEMAP_PAGE_SIZE, logSafeQueryFailure, safeCount, safeFindMany, } from './route-helpers/http.js';
|
|
7
|
+
export { normalizeSubmission, mapFormError, parseFormsQuery, parseEntriesQuery, formCorsHeaders, jsonWithHeaders, parseSubmissionRequest, submitToForm, requestPrefersHtmlResponse, } from './route-helpers/forms.js';
|
|
8
|
+
export { normalizeRedirect, normalizeSeoPage, renderOgSvg } from './route-helpers/page-shape.js';
|
|
9
|
+
export { getSessionSecret, isSecretMissing, extractSession, parseCookieHeader, requirePasswordReauth, requireAuth, apiKeyCollectionScopeDenial, requireCollectionScope, requireGlobalScope, requireMediaScope, requireAdminScope, buildActionContext, WRITE_ROLES, ADMIN_ROLES, requireRole, teamOptionsFor, isEmailConfiguredAsync, loginLimiter, loginUnknownLimiter, loginEmailLimiter, inviteLimiter, totpLimiter, emailTestLimiter, aiGenerateLimiter, uploadLimiter, aiAnalysisLimiter, AI_ANALYSIS_MAX_CHARS, linkHealthLimiter, seoAuditLimiter, searchConsoleTestLimiter, searchSyncLimiter, digestTestSendLimiter, checkRateLimitAsync, clientIp, diffScalarKeys, enforceSessionLimitsForUser, revokeUserApiKeys, getAdminPath, enforceDocumentReadAccess, } from './route-helpers/auth.js';
|
|
10
|
+
export type { AuthSession } from './route-helpers/auth.js';
|
|
361
11
|
//# sourceMappingURL=route-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-helpers.d.ts","sourceRoot":"","sources":["../../src/api/route-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"route-helpers.d.ts","sourceRoot":"","sources":["../../src/api/route-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAIxD,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAC9F,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,mB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