inlaycms 0.4.0 → 0.5.0

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.
Files changed (131) hide show
  1. package/README.md +18 -709
  2. package/assets/admin/admin.css +1 -1
  3. package/assets/admin/editor.js +63 -46
  4. package/assets/site/consent.js +1 -0
  5. package/dist/adapters/admin/context.d.ts +1 -1
  6. package/dist/adapters/admin/context.js +1 -0
  7. package/dist/adapters/admin/routes.d.ts +2 -0
  8. package/dist/adapters/admin/routes.js +2 -0
  9. package/dist/adapters/admin/screens/backups.js +2 -2
  10. package/dist/adapters/admin/screens/editor.js +2 -1
  11. package/dist/adapters/admin/screens/integrations.d.ts +4 -0
  12. package/dist/adapters/admin/screens/integrations.js +140 -0
  13. package/dist/adapters/admin/screens/lists.js +2 -1
  14. package/dist/adapters/admin/screens/releases.js +1 -1
  15. package/dist/adapters/admin/views/layout.js +3 -0
  16. package/dist/adapters/cli/bin.js +8 -3
  17. package/dist/adapters/mcp/tools/read.js +17 -2
  18. package/dist/adapters/mcp/tools/write.js +4 -0
  19. package/dist/adapters/site/cache.d.ts +8 -2
  20. package/dist/adapters/site/cache.js +13 -4
  21. package/dist/adapters/site/code-files.d.ts +44 -0
  22. package/dist/adapters/site/code-files.js +212 -0
  23. package/dist/adapters/site/consent.d.ts +9 -0
  24. package/dist/adapters/site/consent.js +26 -0
  25. package/dist/adapters/site/context.d.ts +5 -0
  26. package/dist/adapters/site/context.js +97 -20
  27. package/dist/adapters/site/csp.d.ts +11 -0
  28. package/dist/adapters/site/csp.js +36 -0
  29. package/dist/adapters/site/head.js +1 -14
  30. package/dist/adapters/site/headers.d.ts +5 -2
  31. package/dist/adapters/site/headers.js +13 -6
  32. package/dist/adapters/site/integrations.d.ts +48 -0
  33. package/dist/adapters/site/integrations.js +118 -0
  34. package/dist/adapters/site/media-routes.d.ts +2 -0
  35. package/dist/adapters/site/media-routes.js +2 -1
  36. package/dist/adapters/site/plugin.d.ts +2 -0
  37. package/dist/adapters/site/plugin.js +64 -34
  38. package/dist/adapters/site/render.d.ts +31 -14
  39. package/dist/adapters/site/render.js +26 -5
  40. package/dist/adapters/site/routes.d.ts +3 -0
  41. package/dist/adapters/site/routes.js +7 -3
  42. package/dist/adapters/site/scripts.d.ts +6 -0
  43. package/dist/adapters/site/scripts.js +27 -0
  44. package/dist/core/auth/roles.d.ts +1 -1
  45. package/dist/core/auth/roles.js +1 -0
  46. package/dist/core/boot.d.ts +2 -0
  47. package/dist/core/boot.js +3 -0
  48. package/dist/core/content/shipped-input.js +1 -2
  49. package/dist/core/content/validate.d.ts +7 -0
  50. package/dist/core/content/validate.js +24 -1
  51. package/dist/core/core.d.ts +29 -0
  52. package/dist/core/core.js +10 -2
  53. package/dist/core/db/migrate.js +2 -0
  54. package/dist/core/db/migrations/0008_integrations.d.ts +3 -0
  55. package/dist/core/db/migrations/0008_integrations.js +11 -0
  56. package/dist/core/db/schema.d.ts +11 -0
  57. package/dist/core/export/export.js +4 -0
  58. package/dist/core/export/format.d.ts +11 -0
  59. package/dist/core/export/format.js +4 -0
  60. package/dist/core/export/import.js +2 -1
  61. package/dist/core/export/replace.d.ts +6 -1
  62. package/dist/core/export/replace.js +4 -1
  63. package/dist/core/export/report.d.ts +6 -0
  64. package/dist/core/export/report.js +7 -0
  65. package/dist/core/fields/builtins.d.ts +4 -0
  66. package/dist/core/fields/builtins.js +11 -1
  67. package/dist/core/fields/widgets.js +5 -1
  68. package/dist/core/integrations/integrations.d.ts +32 -0
  69. package/dist/core/integrations/integrations.js +80 -0
  70. package/dist/core/integrations/warnings.d.ts +4 -0
  71. package/dist/core/integrations/warnings.js +29 -0
  72. package/dist/core/media/store.d.ts +2 -0
  73. package/dist/core/media/store.js +17 -1
  74. package/dist/core/media/variants.d.ts +14 -0
  75. package/dist/core/media/variants.js +54 -0
  76. package/dist/core/messages/en.d.ts +73 -0
  77. package/dist/core/messages/en.js +73 -0
  78. package/dist/core/registry/code-image.d.ts +16 -0
  79. package/dist/core/registry/code-image.js +13 -0
  80. package/dist/core/registry/define.d.ts +7 -0
  81. package/dist/core/registry/define.js +2 -0
  82. package/dist/core/registry/designed.d.ts +6 -0
  83. package/dist/core/registry/designed.js +8 -0
  84. package/dist/core/registry/integration.d.ts +48 -0
  85. package/dist/core/registry/integration.js +29 -0
  86. package/dist/core/registry/js.d.ts +9 -0
  87. package/dist/core/registry/js.js +39 -0
  88. package/dist/core/registry/registry.js +46 -0
  89. package/dist/core/registry/render.d.ts +39 -4
  90. package/dist/core/release/bundle.d.ts +3 -1
  91. package/dist/core/release/bundle.js +169 -11
  92. package/dist/core/release/manifest.d.ts +29 -1
  93. package/dist/core/release/manifest.js +26 -1
  94. package/dist/core/release/pack.js +13 -2
  95. package/dist/core/release/pointer.js +14 -3
  96. package/dist/core/release/read.d.ts +2 -0
  97. package/dist/core/release/read.js +1 -0
  98. package/dist/core/report.d.ts +3 -0
  99. package/dist/core/richtext/headings.d.ts +10 -0
  100. package/dist/core/richtext/headings.js +37 -0
  101. package/dist/core/richtext/html.d.ts +10 -1
  102. package/dist/core/richtext/html.js +17 -6
  103. package/dist/core/richtext/markdown-text.d.ts +24 -0
  104. package/dist/core/richtext/markdown-text.js +38 -0
  105. package/dist/core/richtext/markdown.js +44 -3
  106. package/dist/core/richtext/schema.d.ts +12 -3
  107. package/dist/core/richtext/schema.js +34 -0
  108. package/dist/core/site/live.d.ts +6 -0
  109. package/dist/core/site/live.js +25 -0
  110. package/dist/host/app.d.ts +2 -0
  111. package/dist/host/app.js +1 -0
  112. package/dist/host/diff.d.ts +11 -0
  113. package/dist/host/diff.js +40 -0
  114. package/dist/host/drain.d.ts +12 -0
  115. package/dist/host/drain.js +34 -0
  116. package/dist/host/ipc.d.ts +2 -0
  117. package/dist/host/ipc.js +5 -1
  118. package/dist/host/preview-worker.js +2 -2
  119. package/dist/host/primary.js +15 -4
  120. package/dist/host/push.js +1 -1
  121. package/dist/host/serve.js +1 -1
  122. package/dist/host/store.d.ts +1 -2
  123. package/dist/host/store.js +32 -6
  124. package/dist/host/worker.js +6 -0
  125. package/dist/image-modules.d.ts +29 -0
  126. package/dist/image-modules.js +1 -0
  127. package/dist/index.d.ts +7 -1
  128. package/dist/index.js +4 -0
  129. package/dist/site.d.ts +8 -1
  130. package/dist/site.js +5 -0
  131. package/package.json +5 -1
@@ -7,13 +7,12 @@ import { isRecord } from '../fields/zod-internals.js';
7
7
  import { inspectUpload } from '../media/library.js';
8
8
  import { markdownToInlineText } from '../richtext/inline.js';
9
9
  import { markdownImages, markdownToRichText } from '../richtext/markdown.js';
10
+ import { KEY_HREF } from '../richtext/markdown-text.js';
10
11
  import { DEFAULT_RICH_TEXT } from '../richtext/schema.js';
11
12
  import { docLabels } from './schema.js';
12
13
  import { imageTarget, realInside, realInsideSync } from './shipped-images.js';
13
14
  import { contentIssue } from './validate.js';
14
15
  const KINDS = new Set(['image', 'file', 'richText', 'inlineText', 'ref', 'link']);
15
- /** The start of a Markdown link target `](inlay:key/<type>` or `](inlay:key/<type>/<key>`; text elsewhere is left alone. */
16
- const KEY_HREF = /\]\(inlay:key\/([\w-]+)(?:\/([\w-]+))?(?=[\s)])/g;
17
16
  /** `root` with the value at `path` replaced, copying only the containers along the path. */
18
17
  function setAt(root, path, value) {
19
18
  const [head, ...rest] = path;
@@ -1,3 +1,4 @@
1
+ import type { z } from 'zod';
1
2
  import { type MessageId } from '../messages/index.js';
2
3
  import type { Registry } from '../registry/registry.js';
3
4
  import type { ContentIssue, DocumentData, IssueCode, PathSegment } from '../types.js';
@@ -19,3 +20,9 @@ export declare function mergeIssues(first: ContentIssue[], more: ContentIssue[])
19
20
  * the parsed data (defaults filled, unknown and blank keys stripped).
20
21
  */
21
22
  export declare function validateContent(registry: Registry, type: string, data: unknown, level: Level): ValidationResult;
23
+ /**
24
+ * Validates a bare field object (`data` keyed by field) at `level`: `'draft'`
25
+ * is lenient, `'strict'` holds every field to its full rules. Blank values
26
+ * count as absent. Issue paths are the field keys.
27
+ */
28
+ export declare function validateValues(schema: z.ZodObject, data: Record<string, unknown>, level: Level): ValidationResult;
@@ -1,4 +1,5 @@
1
- import { DATE_CHECK, DATETIME_CHECK, INLINE_TEXT_MAX, NON_BLANK, TITLE_TEMPLATE_CHECK } from '../fields/builtins.js';
1
+ import { labelsAt, toDraftSchema } from '../fields/walk.js';
2
+ import { DATE_CHECK, DATETIME_CHECK, INLINE_TEXT_MAX, NON_BLANK, PATTERN_CHECK, TITLE_TEMPLATE_CHECK } from '../fields/builtins.js';
2
3
  import { isRecord } from '../fields/zod-internals.js';
3
4
  import { t } from '../messages/index.js';
4
5
  import { docLabels, documentSchema } from './schema.js';
@@ -86,6 +87,10 @@ function mapIssue(issue, value) {
86
87
  if (issue.code === 'custom' && issue.params?.check === TITLE_TEMPLATE_CHECK) {
87
88
  return { code: 'invalid', messageId: 'issue.titleTemplate', params: {} };
88
89
  }
90
+ if (issue.code === 'custom' && issue.params?.check === PATTERN_CHECK) {
91
+ const hint = typeof issue.params.hint === 'string' && issue.params.hint ? ` ${issue.params.hint}` : '';
92
+ return { code: 'invalid', messageId: 'issue.pattern', params: { hint } };
93
+ }
89
94
  if (issue.code === 'invalid_type') {
90
95
  const messageId = EXPECTED[issue.expected];
91
96
  if (messageId)
@@ -128,3 +133,21 @@ export function validateContent(registry, type, data, level) {
128
133
  });
129
134
  return { ok: false, issues };
130
135
  }
136
+ /**
137
+ * Validates a bare field object (`data` keyed by field) at `level`: `'draft'`
138
+ * is lenient, `'strict'` holds every field to its full rules. Blank values
139
+ * count as absent. Issue paths are the field keys.
140
+ */
141
+ export function validateValues(schema, data, level) {
142
+ const input = withoutBlanks(data);
143
+ const result = (level === 'draft' ? toDraftSchema(schema) : schema).safeParse(input);
144
+ if (result.success)
145
+ return { ok: true, data: result.data };
146
+ const issues = result.error.issues.map((issue) => {
147
+ const path = issue.path.filter((s) => typeof s !== 'symbol');
148
+ const labels = labelsAt(schema, path) ?? path.map(String);
149
+ const { code, messageId, params } = mapIssue(issue, valueAt(input, path));
150
+ return contentIssue(path, labels, code, messageId, params);
151
+ });
152
+ return { ok: false, issues };
153
+ }
@@ -14,12 +14,15 @@ import { type VariantFormat } from './media/variants.js';
14
14
  import type { SiteDefinition } from './registry/define.js';
15
15
  import type { ReleaseMigration } from './registry/migration.js';
16
16
  import { type Registry } from './registry/registry.js';
17
+ import { type ActiveIntegration, type IntegrationState } from './integrations/integrations.js';
17
18
  import { type SiteLockStatus } from './site-lock/site-lock.js';
18
19
  import { type SitemapEntry } from './site/sitemap.js';
19
20
  import type { Activity, ContentInput, Ctx, DocumentData, DocumentSummary, DocumentView, ContentRef, Usage, DiffEntry, RevisionMeta, UploadLimits, MediaInfo, MediaStatus, LiveDocument, LiveState, RouteMatch, Redirect, RedirectInput, CodeRedirect } from './types.js';
20
21
  export type { PatchOp, PublishResult, SaveResult, ShippedItem, ShippedReport };
21
22
  export interface Core {
22
23
  registry: Registry;
24
+ /** A loaded release's images that `.md` files the site imports name, by source: what `/media/files/` serves. */
25
+ readonly codeFiles?: ReadonlyMap<string, string>;
23
26
  getDocument(id: string, opts?: {
24
27
  state?: 'head' | 'published';
25
28
  }): Promise<DocumentView | null>;
@@ -145,6 +148,17 @@ export interface Core {
145
148
  path: string;
146
149
  mime: string;
147
150
  }>;
151
+ /** A resized variant of an image site code names, cached under `code-<sha>`. */
152
+ codeImageVariant(file: {
153
+ sha: string;
154
+ path: string;
155
+ }, opts: {
156
+ width: number;
157
+ format: VariantFormat;
158
+ }): Promise<{
159
+ path: string;
160
+ mime: string;
161
+ }>;
148
162
  /** Re-creates missing refs of visible documents; returns how many documents it synced. */
149
163
  repairRefs(): Promise<number>;
150
164
  /** Entries whose slug gives them a page another path hides; editors can't save them until it changes. */
@@ -156,6 +170,11 @@ export interface Core {
156
170
  liveDocuments(groupIds: string[], locale: string, opts?: {
157
171
  state?: LiveState;
158
172
  }): Promise<Map<string, LiveDocument>>;
173
+ /** The group id of each shipped-style document by `type/key` (a missing key means the type); deleted and unknown ones are left out. */
174
+ groupIdsByKey(refs: Array<{
175
+ type: string;
176
+ key: string | null;
177
+ }>): Promise<Map<string, string>>;
159
178
  liveSingleton(type: string, locale: string, opts?: {
160
179
  state?: LiveState;
161
180
  }): Promise<LiveDocument | null>;
@@ -176,6 +195,14 @@ export interface Core {
176
195
  siteLock(): Promise<SiteLockStatus>;
177
196
  setSiteLock(enabled: boolean, ctx: Ctx): Promise<SiteLockStatus>;
178
197
  setSitePassword(password: string, ctx: Ctx): Promise<SiteLockStatus>;
198
+ /** Every integration the site defines with its saved settings; owners only. */
199
+ integrations(ctx: Ctx): Promise<IntegrationState[]>;
200
+ saveIntegration(name: string, input: {
201
+ enabled: boolean;
202
+ values: Record<string, unknown>;
203
+ }, ctx: Ctx): Promise<void>;
204
+ /** The integrations that are on and whose saved values pass; for rendering, no actor. */
205
+ activeIntegrations(): Promise<ActiveIntegration[]>;
179
206
  checkSitePassword(password: string): Promise<boolean>;
180
207
  listRedirects(): Promise<Redirect[]>;
181
208
  createRedirect(input: RedirectInput, ctx: Ctx): Promise<Redirect>;
@@ -220,6 +247,8 @@ export interface CreateCoreOptions {
220
247
  uploads?: UploadLimits;
221
248
  /** A loaded release's shipped files, by source as written in the site. */
222
249
  shippedFiles?: ReadonlyMap<string, string>;
250
+ /** As `shippedFiles`, only the images `.md` files the site imports name. */
251
+ codeFiles?: ReadonlyMap<string, string>;
223
252
  }
224
253
  /** Builds the registry and binds the core functions. Does not migrate the database. */
225
254
  export declare function createCore(opts: CreateCoreOptions): Core;
package/dist/core/core.js CHANGED
@@ -26,12 +26,13 @@ import { InlayError } from './errors.js';
26
26
  import { basename } from 'node:path';
27
27
  import { DEFAULT_MAX_BYTES, DEFAULT_UPLOAD_TYPES } from './media/detect.js';
28
28
  import { addMedia, deleteMedia, getMedia, listMedia, lookupMedia, mediaFile, mediaStats, setMediaAlt } from './media/library.js';
29
- import { mediaVariant } from './media/variants.js';
29
+ import { codeImageVariant, mediaVariant } from './media/variants.js';
30
30
  import { fileMediaStore } from './media/store.js';
31
31
  import { buildRegistry } from './registry/registry.js';
32
+ import { activeIntegrations, listIntegrations, saveIntegration } from './integrations/integrations.js';
32
33
  import { checkSitePassword, readSiteLock, setSiteLock, setSitePassword } from './site-lock/site-lock.js';
33
34
  import { codeRedirectLoops, createRedirect, deleteRedirect, importRedirects, listCodeRedirects, listRedirects } from './redirects/redirects.js';
34
- import { liveAlternates, liveDocuments, liveEntries, liveSingleton } from './site/live.js';
35
+ import { groupIdsByKey, liveAlternates, liveDocuments, liveEntries, liveSingleton } from './site/live.js';
35
36
  import { resolvePath } from './site/resolve.js';
36
37
  import { sitemapEntries } from './site/sitemap.js';
37
38
  /** Builds the registry and binds the core functions. Does not migrate the database. */
@@ -74,6 +75,7 @@ export function createCore(opts) {
74
75
  const published = (r) => r.items.length > 0;
75
76
  return {
76
77
  registry,
78
+ ...(opts.codeFiles !== undefined && { codeFiles: opts.codeFiles }),
77
79
  getDocument: (id, o) => getDocument(deps, id, o),
78
80
  findSingleton: (type, locale) => findSingleton(deps, type, locale),
79
81
  findTranslation: (groupId, locale) => findTranslation(deps, groupId, locale),
@@ -113,9 +115,11 @@ export function createCore(opts) {
113
115
  deleteMedia: live((id, ctx) => deleteMedia(deps, id, ctx)),
114
116
  mediaFile: (id) => mediaFile(deps, id),
115
117
  mediaVariant: (id, o) => mediaVariant(deps, id, o),
118
+ codeImageVariant: (file, o) => codeImageVariant(deps, file, o),
116
119
  repairRefs: () => repairRefs(deps),
117
120
  shadowedEntries: () => shadowedEntries(deps),
118
121
  liveDocuments: (groupIds, locale, o) => liveDocuments(deps, groupIds, locale, o),
122
+ groupIdsByKey: (refs) => groupIdsByKey(deps, refs),
119
123
  liveSingleton: (type, locale, o) => liveSingleton(deps, type, locale, o),
120
124
  liveEntries: (collection, locale, o) => liveEntries(deps, collection, locale, o),
121
125
  liveAlternates: (groupId, o) => liveAlternates(deps, groupId, o),
@@ -190,6 +194,9 @@ export function createCore(opts) {
190
194
  },
191
195
  setSiteLock: live((enabled, ctx) => setSiteLock(deps, enabled, ctx)),
192
196
  setSitePassword: live((password, ctx) => setSitePassword(deps, password, ctx)),
197
+ integrations: (ctx) => listIntegrations(deps, ctx),
198
+ saveIntegration: live((name, input, ctx) => saveIntegration(deps, name, input, ctx)),
199
+ activeIntegrations: () => activeIntegrations(deps),
193
200
  checkSitePassword: (password) => checkSitePassword(deps, password),
194
201
  listRedirects: () => listRedirects(deps),
195
202
  createRedirect: live((input, ctx) => createRedirect(deps, input, ctx)),
@@ -242,6 +249,7 @@ export function readOnlyCore(core) {
242
249
  repairRefs: refuse,
243
250
  setSiteLock: refuse,
244
251
  setSitePassword: refuse,
252
+ saveIntegration: refuse,
245
253
  createRedirect: refuse,
246
254
  deleteRedirect: refuse,
247
255
  importRedirects: refuse,
@@ -6,6 +6,7 @@ import * as m0004 from './migrations/0004_token_cutoffs.js';
6
6
  import * as m0005 from './migrations/0005_site_lock.js';
7
7
  import * as m0006 from './migrations/0006_releases.js';
8
8
  import * as m0007 from './migrations/0007_published_at.js';
9
+ import * as m0008 from './migrations/0008_integrations.js';
9
10
  const systemMigrations = {
10
11
  '0001_content': m0001,
11
12
  '0002_media': m0002,
@@ -14,6 +15,7 @@ const systemMigrations = {
14
15
  '0005_site_lock': m0005,
15
16
  '0006_releases': m0006,
16
17
  '0007_published_at': m0007,
18
+ '0008_integrations': m0008,
17
19
  };
18
20
  function systemMigrator(db) {
19
21
  return new Migrator({
@@ -0,0 +1,3 @@
1
+ import type { Kysely } from 'kysely';
2
+ /** Integration settings: one row per integration the owner has saved, with its values as a JSON object. */
3
+ export declare function up(db: Kysely<any>): Promise<void>;
@@ -0,0 +1,11 @@
1
+ /** Integration settings: one row per integration the owner has saved, with its values as a JSON object. */
2
+ export async function up(db) {
3
+ await db.schema
4
+ .createTable('integrations')
5
+ .addColumn('name', 'text', (c) => c.primaryKey())
6
+ .addColumn('enabled', 'integer', (c) => c.notNull())
7
+ .addColumn('data', 'text', (c) => c.notNull())
8
+ .addColumn('updated_at', 'text', (c) => c.notNull())
9
+ .addColumn('updated_by', 'text')
10
+ .execute();
11
+ }
@@ -106,6 +106,16 @@ export interface TokenCutoffsTable {
106
106
  /** Seconds since the epoch: tokens whose `iat` is at or before this are refused. */
107
107
  before: number;
108
108
  }
109
+ /** Integration settings: one row per integration the owner has saved. */
110
+ export interface IntegrationsTable {
111
+ name: string;
112
+ /** 0 or 1. */
113
+ enabled: number;
114
+ /** JSON object of the saved field values. */
115
+ data: string;
116
+ updated_at: string;
117
+ updated_by: string | null;
118
+ }
109
119
  /** The site password lock: at most one row (`id = 1`). */
110
120
  export interface SiteLockTable {
111
121
  id: number;
@@ -149,6 +159,7 @@ export interface Database {
149
159
  redirects: RedirectsTable;
150
160
  token_cutoffs: TokenCutoffsTable;
151
161
  site_lock: SiteLockTable;
162
+ integrations: IntegrationsTable;
152
163
  releases: ReleasesTable;
153
164
  release_migrations: ReleaseMigrationsTable;
154
165
  user: UserTable;
@@ -8,6 +8,7 @@ import { openDatabase } from '../db/connection.js';
8
8
  import { InlayError } from '../errors.js';
9
9
  import { fileMediaStore } from '../media/store.js';
10
10
  import { t } from '../messages/index.js';
11
+ import { readIntegrationRows } from '../integrations/integrations.js';
11
12
  import { readSiteLock } from '../site-lock/site-lock.js';
12
13
  import { targetOf } from '../redirects/rule.js';
13
14
  import { inlayVersion } from '../version.js';
@@ -27,12 +28,14 @@ export async function exportContent(opts) {
27
28
  let mediaRows;
28
29
  let deletions;
29
30
  let siteLock;
31
+ let integrations;
30
32
  try {
31
33
  content = await readContent(snap);
32
34
  redirects = await readRedirects(snap);
33
35
  mediaRows = await readMedia(snap);
34
36
  deletions = await readDeletions(snap);
35
37
  siteLock = await readSiteLock(snap);
38
+ integrations = await readIntegrationRows(snap);
36
39
  }
37
40
  finally {
38
41
  await snap.destroy();
@@ -82,6 +85,7 @@ export async function exportContent(opts) {
82
85
  })),
83
86
  counts,
84
87
  siteLock,
88
+ integrations,
85
89
  };
86
90
  await writeFile(join(staging, 'manifest.json'), JSON.stringify(manifest, null, 2));
87
91
  await writeFile(join(staging, 'content.ndjson'), lines(content));
@@ -28,6 +28,12 @@ export interface Manifest {
28
28
  enabled: boolean;
29
29
  passwordHash: string | null;
30
30
  };
31
+ /** The integration settings; absent in exports made before they existed. */
32
+ integrations?: Array<{
33
+ name: string;
34
+ enabled: boolean;
35
+ values: Record<string, unknown>;
36
+ }>;
31
37
  }
32
38
  export interface DocumentRecord {
33
39
  record: 'document';
@@ -141,6 +147,11 @@ export declare const manifestSchema: z.ZodObject<{
141
147
  enabled: z.ZodBoolean;
142
148
  passwordHash: z.ZodNullable<z.ZodString>;
143
149
  }, z.core.$strip>>;
150
+ integrations: z.ZodOptional<z.ZodArray<z.ZodObject<{
151
+ name: z.ZodString;
152
+ enabled: z.ZodBoolean;
153
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
154
+ }, z.core.$strip>>>;
144
155
  }, z.core.$strip>;
145
156
  export declare const contentRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
146
157
  record: z.ZodLiteral<"document">;
@@ -30,6 +30,10 @@ export const manifestSchema = z.object({
30
30
  .object({ enabled: z.boolean(), passwordHash: z.string().regex(/^[^:\s]+:[^:\s]+$/).nullable() })
31
31
  .refine((lock) => !lock.enabled || lock.passwordHash !== null)
32
32
  .optional(),
33
+ integrations: z
34
+ .array(z.object({ name: z.string(), enabled: z.boolean(), values: z.record(z.string(), z.unknown()) }))
35
+ .refine((rows) => new Set(rows.map((r) => r.name)).size === rows.length)
36
+ .optional(),
33
37
  });
34
38
  const documentRecord = z.object({
35
39
  record: z.literal('document'),
@@ -85,6 +85,7 @@ export async function planImport(site, bundle, now, current) {
85
85
  media: { files: bundle.media.length, damaged: bundle.damaged.map((m) => m.filename) },
86
86
  redirects: { count: bundle.redirects.length },
87
87
  shipped: await shippedTitles(stage),
88
+ integrations: manifest.integrations ? manifest.integrations.map((r) => ({ name: r.name, enabled: r.enabled })) : null,
88
89
  siteLock: manifest.siteLock
89
90
  ? {
90
91
  enabled: manifest.siteLock.enabled,
@@ -155,7 +156,7 @@ export async function importContent(opts) {
155
156
  });
156
157
  }
157
158
  }
158
- replaced = await replaceContent(opts.db, stage.db, bundle.manifest.siteLock);
159
+ replaced = await replaceContent(opts.db, stage.db, bundle.manifest.siteLock, bundle.manifest.integrations && { rows: bundle.manifest.integrations, now: (opts.now?.() ?? new Date()).toISOString(), by: opts.ctx.actor.id });
159
160
  }
160
161
  catch (e) {
161
162
  if (store)
@@ -1,5 +1,6 @@
1
1
  import type { Kysely } from 'kysely';
2
2
  import type { Database } from '../db/schema.js';
3
+ import { type IntegrationRow } from '../integrations/integrations.js';
3
4
  import { type SiteLockRow } from '../site-lock/site-lock.js';
4
5
  export interface ReplaceCounts {
5
6
  documents: number;
@@ -12,6 +13,10 @@ export interface ReplaceCounts {
12
13
  * in one transaction. `removedMedia` lists the media ids `live` had that
13
14
  * `from` doesn't, so the caller can remove their files once this commits.
14
15
  */
15
- export declare function replaceContent(live: Kysely<Database>, from: Kysely<Database>, siteLock?: SiteLockRow): Promise<ReplaceCounts & {
16
+ export declare function replaceContent(live: Kysely<Database>, from: Kysely<Database>, siteLock?: SiteLockRow, integrations?: {
17
+ rows: IntegrationRow[];
18
+ now: string;
19
+ by: string | null;
20
+ }): Promise<ReplaceCounts & {
16
21
  removedMedia: string[];
17
22
  }>;
@@ -1,3 +1,4 @@
1
+ import { replaceIntegrationRows } from '../integrations/integrations.js';
1
2
  import { writeSiteLock } from '../site-lock/site-lock.js';
2
3
  const CHUNK = 200;
3
4
  /** Deleted children first, so no foreign key is left pointing at a removed row. */
@@ -9,7 +10,7 @@ const COPY_ORDER = ['documents', 'revisions', 'publish_events', 'refs', 'media',
9
10
  * in one transaction. `removedMedia` lists the media ids `live` had that
10
11
  * `from` doesn't, so the caller can remove their files once this commits.
11
12
  */
12
- export async function replaceContent(live, from, siteLock) {
13
+ export async function replaceContent(live, from, siteLock, integrations) {
13
14
  return live.transaction().execute(async (trx) => {
14
15
  const oldMedia = (await trx.selectFrom('media').select('id').execute()).map((m) => m.id);
15
16
  for (const table of DELETE_ORDER)
@@ -24,6 +25,8 @@ export async function replaceContent(live, from, siteLock) {
24
25
  }
25
26
  if (siteLock)
26
27
  await writeSiteLock(trx, siteLock);
28
+ if (integrations)
29
+ await replaceIntegrationRows(trx, integrations.rows, integrations.now, integrations.by);
27
30
  const newMedia = new Set((await trx.selectFrom('media').select('id').execute()).map((m) => m.id));
28
31
  return {
29
32
  documents: copied.get('documents') ?? 0,
@@ -47,9 +47,15 @@ export interface ImportReport {
47
47
  shipped: string[];
48
48
  /** The export's lock, or null for an export made before the lock existed (the import leaves the lock alone). */
49
49
  siteLock: ImportSiteLock | null;
50
+ /** The integrations the export carries, or null for an export made before they existed (the import leaves them alone). */
51
+ integrations: Array<{
52
+ name: string;
53
+ enabled: boolean;
54
+ }> | null;
50
55
  }
51
56
  /** What replacing the lock `current` with `exported` changes. */
52
57
  export declare function siteLockEffects(exported: SiteLockRow, current: SiteLockRow): SiteLockEffect[];
53
58
  export declare function siteLockLines(lock: ImportSiteLock | null): string[];
59
+ export declare function integrationLines(report: ImportReport): string[];
54
60
  /** The report as lines a person reads: one per type and locale, with the documents needing attention indented, then everything else. */
55
61
  export declare function formatImportReport(report: ImportReport): string[];
@@ -24,6 +24,12 @@ export function siteLockLines(lock) {
24
24
  lines.push(t('import.siteLock.exportNoPassword'));
25
25
  return lines;
26
26
  }
27
+ export function integrationLines(report) {
28
+ if (!report.integrations)
29
+ return [];
30
+ const list = report.integrations.map((i) => t(i.enabled ? 'import.integrations.on' : 'import.integrations.off', { name: i.name })).join(', ');
31
+ return [t('import.integrations.replace', { list })];
32
+ }
27
33
  /** The report as lines a person reads: one per type and locale, with the documents needing attention indented, then everything else. */
28
34
  export function formatImportReport(report) {
29
35
  const lines = [];
@@ -46,5 +52,6 @@ export function formatImportReport(report) {
46
52
  if (report.shipped.length > 0)
47
53
  lines.push(t('import.shipped', { titles: report.shipped.join(', ') }));
48
54
  lines.push(...siteLockLines(report.siteLock));
55
+ lines.push(...integrationLines(report));
49
56
  return lines;
50
57
  }
@@ -8,7 +8,11 @@ interface BaseOptions {
8
8
  interface TextOptions extends BaseOptions {
9
9
  maxLength?: number;
10
10
  suggestedLength?: number;
11
+ pattern?: RegExp;
12
+ patternHint?: string;
11
13
  }
14
+ /** The `check` param of the refinement that holds a text field to its `pattern` (the hint is in `params.hint`). */
15
+ export declare const PATTERN_CHECK = "pattern";
12
16
  /** Marks the issue from text and textarea's non-blank check (in `params.check`). */
13
17
  export declare const NON_BLANK = "nonBlank";
14
18
  /** The `check` param of the refinements that make a date or datetime field reject a malformed value. */
@@ -25,6 +25,8 @@ function isRealDate(s) {
25
25
  const dt = new Date(Date.UTC(y, m - 1, d));
26
26
  return dt.getUTCFullYear() === y && dt.getUTCMonth() === m - 1 && dt.getUTCDate() === d;
27
27
  }
28
+ /** The `check` param of the refinement that holds a text field to its `pattern` (the hint is in `params.hint`). */
29
+ export const PATTERN_CHECK = 'pattern';
28
30
  /** Marks the issue from text and textarea's non-blank check (in `params.check`). */
29
31
  export const NON_BLANK = 'nonBlank';
30
32
  /** The `check` param of the refinements that make a date or datetime field reject a malformed value. */
@@ -44,7 +46,15 @@ function stringField(kind, o, also) {
44
46
  draft = draft.max(o.maxLength);
45
47
  if (also)
46
48
  draft = draft.refine(also.test, { params: { check: also.check } });
47
- const strict = draft.refine((s) => s.trim().length > 0, { params: { check: NON_BLANK } });
49
+ let strict = draft;
50
+ const { pattern } = o;
51
+ if (pattern) {
52
+ const re = new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ''));
53
+ strict = draft.refine((s) => s.trim().length === 0 || re.test(s), {
54
+ params: { check: PATTERN_CHECK, hint: o.patternHint ?? '' },
55
+ });
56
+ }
57
+ strict = strict.refine((s) => s.trim().length > 0, { params: { check: NON_BLANK } });
48
58
  return defineField(strict, {
49
59
  kind,
50
60
  ...base(o),
@@ -325,6 +325,10 @@ function toolbarLabels(headings) {
325
325
  bulletList: t('admin.richtext.bulletList'),
326
326
  orderedList: t('admin.richtext.orderedList'),
327
327
  blockquote: t('admin.richtext.blockquote'),
328
+ codeBlock: t('admin.richtext.codeBlock'),
329
+ codeLanguage: t('admin.richtext.codeLanguage'),
330
+ codeLanguageHint: t('admin.richtext.codeLanguageHint'),
331
+ codeLanguageInvalid: t('admin.richtext.codeLanguageInvalid'),
328
332
  image: t('admin.richtext.image'),
329
333
  hardBreak: t('admin.richtext.hardBreak'),
330
334
  table: t('admin.richtext.table'),
@@ -342,7 +346,7 @@ function renderRichText(p, inline) {
342
346
  const features = RICH_TEXT_FEATURES.filter((feature) => opts.features.includes(feature));
343
347
  const value = p.value === undefined ? '' : typeof p.value === 'string' ? p.value : JSON.stringify(p.value);
344
348
  const links = `/admin/pick/documents?${new URLSearchParams({ locale: p.locale, web: '1' }).toString()}`;
345
- return (_jsxs(_Fragment, { children: [p.value !== undefined && _jsx("input", { type: "hidden", name: `${p.name}._present`, value: "", disabled: p.readOnly }), _jsxs("div", { "data-richtext": true, "data-inline": inline, "data-name": p.name, "data-features": features.join(' '), "data-headings": opts.headings.join(' '), "data-labels": JSON.stringify(toolbarLabels(opts.headings)), "data-readonly": p.readOnly, "data-pick-link": links, "data-pick-image": "/admin/pick/media?kind=image", class: "flex flex-col rounded-box border border-base-300 bg-base-100", children: [_jsx("div", { role: "toolbar", "aria-label": t('admin.richtext.toolbar', { field: p.meta.label }), "aria-controls": p.id, class: "flex flex-wrap gap-1 border-b border-base-300 p-1 empty:hidden" }), _jsx("div", { "data-richtext-mount": true, role: "group", id: p.id, "aria-label": p.meta.label, "aria-describedby": p.describedBy, "aria-invalid": p.invalid ? 'true' : undefined, class: `${inline ? INLINE_TEXT_MOUNT : RICH_TEXT_MOUNT} [&_.ProseMirror]:outline-none [&_.ProseMirror-focused]:ring-2 [&_.ProseMirror-focused]:ring-primary [&_p]:my-2 [&_h2]:my-3 [&_h2]:text-2xl [&_h2]:font-bold [&_h3]:my-3 [&_h3]:text-xl [&_h3]:font-bold [&_h4]:my-2 [&_h4]:text-lg [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold [&_h1]:text-3xl [&_h1]:font-bold [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_blockquote]:border-l-4 [&_blockquote]:border-base-300 [&_blockquote]:pl-4 [&_a]:text-primary [&_a]:underline [&_code]:rounded [&_code]:bg-base-200 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[0.9em] [&_table]:my-2 [&_table]:border-collapse [&_th]:border [&_th]:border-base-300 [&_th]:px-2 [&_th]:text-left [&_th]:font-semibold [&_td]:border [&_td]:border-base-300 [&_td]:px-2 [&_img]:inline-block [&_img]:max-h-40 [&_img]:rounded [&_.ProseMirror-selectednode]:outline-2 [&_.ProseMirror-selectednode]:outline-primary` }), _jsx("p", { "data-richtext-error": true, hidden: true, class: "mx-3 mb-3 rounded-box bg-warning px-3 py-1 text-sm text-warning-content", children: t('admin.richtext.unreadable') }), _jsx("input", { type: "hidden", name: p.name, value: value, disabled: p.readOnly }), _jsx("noscript", { children: _jsx("p", { class: "mx-3 mb-3 rounded-box bg-warning px-3 py-1 text-sm text-warning-content", children: t('admin.form.needsJs') }) })] })] }));
349
+ return (_jsxs(_Fragment, { children: [p.value !== undefined && _jsx("input", { type: "hidden", name: `${p.name}._present`, value: "", disabled: p.readOnly }), _jsxs("div", { "data-richtext": true, "data-inline": inline, "data-name": p.name, "data-features": features.join(' '), "data-headings": opts.headings.join(' '), "data-labels": JSON.stringify(toolbarLabels(opts.headings)), "data-readonly": p.readOnly, "data-pick-link": links, "data-pick-image": "/admin/pick/media?kind=image", class: "flex flex-col rounded-box border border-base-300 bg-base-100", children: [_jsx("div", { role: "toolbar", "aria-label": t('admin.richtext.toolbar', { field: p.meta.label }), "aria-controls": p.id, class: "flex flex-wrap gap-1 border-b border-base-300 p-1 empty:hidden" }), _jsx("div", { "data-richtext-mount": true, role: "group", id: p.id, "aria-label": p.meta.label, "aria-describedby": p.describedBy, "aria-invalid": p.invalid ? 'true' : undefined, class: `${inline ? INLINE_TEXT_MOUNT : RICH_TEXT_MOUNT} [&_.ProseMirror]:outline-none [&_.ProseMirror-focused]:ring-2 [&_.ProseMirror-focused]:ring-primary [&_p]:my-2 [&_h2]:my-3 [&_h2]:text-2xl [&_h2]:font-bold [&_h3]:my-3 [&_h3]:text-xl [&_h3]:font-bold [&_h4]:my-2 [&_h4]:text-lg [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold [&_h1]:text-3xl [&_h1]:font-bold [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_blockquote]:border-l-4 [&_blockquote]:border-base-300 [&_blockquote]:pl-4 [&_a]:text-primary [&_a]:underline [&_code]:rounded [&_code]:bg-base-200 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[0.9em] [&_pre]:my-2 [&_pre]:overflow-x-auto [&_pre]:whitespace-pre! [&_pre]:rounded [&_pre]:bg-base-200 [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[0.9em] [&_pre_code]:rounded-none [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-[1em] [&_table]:my-2 [&_table]:border-collapse [&_th]:border [&_th]:border-base-300 [&_th]:px-2 [&_th]:text-left [&_th]:font-semibold [&_td]:border [&_td]:border-base-300 [&_td]:px-2 [&_img]:inline-block [&_img]:max-h-40 [&_img]:rounded [&_.ProseMirror-selectednode]:outline-2 [&_.ProseMirror-selectednode]:outline-primary` }), _jsx("p", { "data-richtext-error": true, hidden: true, class: "mx-3 mb-3 rounded-box bg-warning px-3 py-1 text-sm text-warning-content", children: t('admin.richtext.unreadable') }), _jsx("input", { type: "hidden", name: p.name, value: value, disabled: p.readOnly }), _jsx("noscript", { children: _jsx("p", { class: "mx-3 mb-3 rounded-box bg-warning px-3 py-1 text-sm text-warning-content", children: t('admin.form.needsJs') }) })] })] }));
346
350
  }
347
351
  function parseRichTextForm(form, name, optional, parse) {
348
352
  const raw = form.get(name);
@@ -0,0 +1,32 @@
1
+ import type { Kysely } from 'kysely';
2
+ import type { Database } from '../db/schema.js';
3
+ import type { IntegrationDef } from '../registry/integration.js';
4
+ import type { CoreDeps, Ctx } from '../types.js';
5
+ export interface IntegrationRow {
6
+ name: string;
7
+ enabled: boolean;
8
+ values: Record<string, unknown>;
9
+ }
10
+ export interface IntegrationState {
11
+ def: IntegrationDef;
12
+ enabled: boolean;
13
+ values: Record<string, unknown>;
14
+ /** Switched on and the saved values pass the integration's fields now. */
15
+ active: boolean;
16
+ updatedAt: string | null;
17
+ }
18
+ export interface ActiveIntegration {
19
+ def: IntegrationDef;
20
+ values: Record<string, unknown>;
21
+ }
22
+ /** Every stored row, defined by the site or not, by name. */
23
+ export declare function readIntegrationRows(db: Kysely<Database>): Promise<IntegrationRow[]>;
24
+ /** Replaces the whole table. Opens no transaction of its own, so call it inside the caller's. */
25
+ export declare function replaceIntegrationRows(db: Kysely<Database>, rows: IntegrationRow[], now: string, by: string | null): Promise<void>;
26
+ export declare function listIntegrations(deps: CoreDeps, ctx: Ctx): Promise<IntegrationState[]>;
27
+ export declare function saveIntegration(deps: CoreDeps, name: string, input: {
28
+ enabled: boolean;
29
+ values: Record<string, unknown>;
30
+ }, ctx: Ctx): Promise<void>;
31
+ /** What the site adapter renders: switched on, with saved values that pass the fields now. Needs no actor. */
32
+ export declare function activeIntegrations(deps: CoreDeps): Promise<ActiveIntegration[]>;
@@ -0,0 +1,80 @@
1
+ import { assertCan } from '../auth/roles.js';
2
+ import { validateValues } from '../content/validate.js';
3
+ import { InlayError } from '../errors.js';
4
+ function parseData(data) {
5
+ try {
6
+ const parsed = JSON.parse(data);
7
+ return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) ? parsed : {};
8
+ }
9
+ catch {
10
+ return {};
11
+ }
12
+ }
13
+ /** Every stored row, defined by the site or not, by name. */
14
+ export async function readIntegrationRows(db) {
15
+ const rows = await db.selectFrom('integrations').selectAll().orderBy('name').execute();
16
+ return rows.map((r) => ({ name: r.name, enabled: r.enabled === 1, values: parseData(r.data) }));
17
+ }
18
+ /** Replaces the whole table. Opens no transaction of its own, so call it inside the caller's. */
19
+ export async function replaceIntegrationRows(db, rows, now, by) {
20
+ await db.deleteFrom('integrations').execute();
21
+ if (rows.length === 0)
22
+ return;
23
+ await db
24
+ .insertInto('integrations')
25
+ .values(rows.map((r) => ({ name: r.name, enabled: r.enabled ? 1 : 0, data: JSON.stringify(r.values), updated_at: now, updated_by: by })))
26
+ .execute();
27
+ }
28
+ function definitions(deps) {
29
+ return deps.registry.site.integrations;
30
+ }
31
+ export async function listIntegrations(deps, ctx) {
32
+ assertCan(ctx, 'integrations.manage');
33
+ const stored = await deps.db.selectFrom('integrations').selectAll().execute();
34
+ const byName = new Map(stored.map((r) => [r.name, r]));
35
+ return definitions(deps).map((def) => {
36
+ const row = byName.get(def.name);
37
+ if (!row)
38
+ return { def, enabled: false, values: {}, active: false, updatedAt: null };
39
+ const values = parseData(row.data);
40
+ const enabled = row.enabled === 1;
41
+ return { def, enabled, values, active: enabled && validateValues(def.fields, values, 'strict').ok, updatedAt: row.updated_at };
42
+ });
43
+ }
44
+ export async function saveIntegration(deps, name, input, ctx) {
45
+ assertCan(ctx, 'integrations.manage');
46
+ const def = definitions(deps).find((d) => d.name === name);
47
+ if (!def)
48
+ throw new InlayError('not_found', 'integrations.unknown', { name });
49
+ const result = validateValues(def.fields, input.values, input.enabled ? 'strict' : 'draft');
50
+ if (!result.ok)
51
+ throw new InlayError('validation', 'error.validation', {}, { issues: result.issues });
52
+ const values = {
53
+ name,
54
+ enabled: input.enabled ? 1 : 0,
55
+ data: JSON.stringify(result.data),
56
+ updated_at: deps.now().toISOString(),
57
+ updated_by: ctx.actor.id,
58
+ };
59
+ const { name: _name, ...update } = values;
60
+ await deps.db
61
+ .insertInto('integrations')
62
+ .values(values)
63
+ .onConflict((oc) => oc.column('name').doUpdateSet(update))
64
+ .execute();
65
+ }
66
+ /** What the site adapter renders: switched on, with saved values that pass the fields now. Needs no actor. */
67
+ export async function activeIntegrations(deps) {
68
+ const stored = await deps.db.selectFrom('integrations').selectAll().where('enabled', '=', 1).execute();
69
+ const byName = new Map(stored.map((r) => [r.name, r]));
70
+ const active = [];
71
+ for (const def of definitions(deps)) {
72
+ const row = byName.get(def.name);
73
+ if (!row)
74
+ continue;
75
+ const result = validateValues(def.fields, parseData(row.data), 'strict');
76
+ if (result.ok)
77
+ active.push({ def, values: result.data });
78
+ }
79
+ return active;
80
+ }
@@ -0,0 +1,4 @@
1
+ import type { SiteDefinition } from '../registry/define.js';
2
+ import type { CheckWarning } from '../report.js';
3
+ /** Warnings about the policy a site's code asks for. */
4
+ export declare function policyWarnings(site: SiteDefinition): CheckWarning[];
@@ -0,0 +1,29 @@
1
+ import { t } from '../messages/index.js';
2
+ /** A bare scheme such as `https:` or `data:`, which allows every address under it. */
3
+ const SCHEME = /^[a-z][a-z0-9+.-]*:$/;
4
+ /** Warnings about the policy a site's code asks for. */
5
+ export function policyWarnings(site) {
6
+ const warnings = [];
7
+ const declared = [
8
+ { who: null, csp: site.csp },
9
+ ...site.integrations.map((i) => ({ who: i.name, csp: i.csp })),
10
+ ];
11
+ for (const { who, csp } of declared) {
12
+ const sources = csp['script-src'] ?? [];
13
+ const owner = who === null ? t('definition.cspOwnerSite') : t('definition.cspOwnerIntegration', { name: who });
14
+ if (sources.includes("'unsafe-inline'")) {
15
+ warnings.push({ code: 'csp_unsafe_inline', message: t('report.cspUnsafeInline', { owner }) });
16
+ }
17
+ if (sources.includes("'unsafe-eval'")) {
18
+ warnings.push({ code: 'csp_unsafe_eval', message: t('report.cspUnsafeEval', { owner }) });
19
+ }
20
+ for (const source of sources) {
21
+ if (SCHEME.test(source))
22
+ warnings.push({ code: 'csp_script_scheme', message: t('report.cspScriptScheme', { owner, source }) });
23
+ }
24
+ }
25
+ const overrides = Object.keys(site.headers).some((h) => h.toLowerCase() === 'content-security-policy');
26
+ if (overrides && site.integrations.length > 0)
27
+ warnings.push({ code: 'csp_overridden', message: t('report.cspOverridden') });
28
+ return warnings;
29
+ }