@actuate-media/cms-core 0.25.1 → 0.27.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.
- package/dist/__tests__/api/collections-discovery.test.js +47 -0
- package/dist/__tests__/api/collections-discovery.test.js.map +1 -1
- package/dist/__tests__/api/page-sections-routes.test.d.ts +2 -0
- package/dist/__tests__/api/page-sections-routes.test.d.ts.map +1 -0
- package/dist/__tests__/api/page-sections-routes.test.js +271 -0
- package/dist/__tests__/api/page-sections-routes.test.js.map +1 -0
- package/dist/__tests__/api/stats-collection-filter.test.d.ts +2 -0
- package/dist/__tests__/api/stats-collection-filter.test.d.ts.map +1 -0
- package/dist/__tests__/api/stats-collection-filter.test.js +190 -0
- package/dist/__tests__/api/stats-collection-filter.test.js.map +1 -0
- package/dist/__tests__/api/stats-routes.test.d.ts +2 -0
- package/dist/__tests__/api/stats-routes.test.d.ts.map +1 -0
- package/dist/__tests__/api/stats-routes.test.js +251 -0
- package/dist/__tests__/api/stats-routes.test.js.map +1 -0
- package/dist/__tests__/content-health/scanner.test.d.ts +2 -0
- package/dist/__tests__/content-health/scanner.test.d.ts.map +1 -0
- package/dist/__tests__/content-health/scanner.test.js +151 -0
- package/dist/__tests__/content-health/scanner.test.js.map +1 -0
- package/dist/__tests__/diagnostics/api-metrics.test.d.ts +2 -0
- package/dist/__tests__/diagnostics/api-metrics.test.d.ts.map +1 -0
- package/dist/__tests__/diagnostics/api-metrics.test.js +153 -0
- package/dist/__tests__/diagnostics/api-metrics.test.js.map +1 -0
- package/dist/api/handler-factory.d.ts.map +1 -1
- package/dist/api/handler-factory.js +31 -1
- package/dist/api/handler-factory.js.map +1 -1
- package/dist/api/handlers.d.ts.map +1 -1
- package/dist/api/handlers.js +678 -5
- package/dist/api/handlers.js.map +1 -1
- package/dist/config/types.d.ts +8 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/content-health/cron.d.ts +67 -0
- package/dist/content-health/cron.d.ts.map +1 -0
- package/dist/content-health/cron.js +167 -0
- package/dist/content-health/cron.js.map +1 -0
- package/dist/content-health/scanner.d.ts +118 -0
- package/dist/content-health/scanner.d.ts.map +1 -0
- package/dist/content-health/scanner.js +263 -0
- package/dist/content-health/scanner.js.map +1 -0
- package/dist/diagnostics/api-metrics.d.ts +135 -0
- package/dist/diagnostics/api-metrics.d.ts.map +1 -0
- package/dist/diagnostics/api-metrics.js +374 -0
- package/dist/diagnostics/api-metrics.js.map +1 -0
- package/dist/sections/__tests__/sections.test.d.ts +2 -0
- package/dist/sections/__tests__/sections.test.d.ts.map +1 -0
- package/dist/sections/__tests__/sections.test.js +215 -0
- package/dist/sections/__tests__/sections.test.js.map +1 -0
- package/dist/sections/helpers.d.ts +62 -0
- package/dist/sections/helpers.d.ts.map +1 -0
- package/dist/sections/helpers.js +202 -0
- package/dist/sections/helpers.js.map +1 -0
- package/dist/sections/index.d.ts +13 -0
- package/dist/sections/index.d.ts.map +1 -0
- package/dist/sections/index.js +12 -0
- package/dist/sections/index.js.map +1 -0
- package/dist/sections/registry.d.ts +27 -0
- package/dist/sections/registry.d.ts.map +1 -0
- package/dist/sections/registry.js +349 -0
- package/dist/sections/registry.js.map +1 -0
- package/dist/sections/types.d.ts +127 -0
- package/dist/sections/types.d.ts.map +1 -0
- package/dist/sections/types.js +21 -0
- package/dist/sections/types.js.map +1 -0
- package/dist/sections/validate.d.ts +10 -0
- package/dist/sections/validate.d.ts.map +1 -0
- package/dist/sections/validate.js +92 -0
- package/dist/sections/validate.js.map +1 -0
- package/package.json +6 -1
- package/prisma/migrations/0007_dashboard_metrics/migration.sql +74 -0
- package/prisma/schema.prisma +180 -73
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { PageSection, PostHeaderConfig, PostTemplate, SectionSettings, SectionTypeId } from './types.js';
|
|
2
|
+
/** Generate a unique section id (UUID when available, monotonic fallback). */
|
|
3
|
+
export declare function generateSectionId(): string;
|
|
4
|
+
/** Create a fresh section of the given type, seeded with registry defaults. */
|
|
5
|
+
export declare function createSection(type: SectionTypeId): PageSection;
|
|
6
|
+
/** Insert a section at `index` (defaults to the end). Returns a new array. */
|
|
7
|
+
export declare function addSection(sections: PageSection[], section: PageSection, index?: number): PageSection[];
|
|
8
|
+
export declare function removeSection(sections: PageSection[], id: string): PageSection[];
|
|
9
|
+
/** Duplicate a section (new id, "(Copy)" suffix), inserted right after the original. */
|
|
10
|
+
export declare function duplicateSection(sections: PageSection[], id: string): PageSection[];
|
|
11
|
+
export declare function toggleSectionVisibility(sections: PageSection[], id: string): PageSection[];
|
|
12
|
+
/** Explicitly set a section's visibility (used by the API toggle endpoint). */
|
|
13
|
+
export declare function setSectionVisibility(sections: PageSection[], id: string, visible: boolean): PageSection[];
|
|
14
|
+
/** Move the section with `id` to a new index (clamped). Returns a new array. */
|
|
15
|
+
export declare function moveSection(sections: PageSection[], id: string, toIndex: number): PageSection[];
|
|
16
|
+
/** Reorder to an explicit id order (used by drag-and-drop drop handlers). */
|
|
17
|
+
export declare function reorderSections(sections: PageSection[], orderedIds: string[]): PageSection[];
|
|
18
|
+
export declare function updateSectionContent(sections: PageSection[], id: string, patch: Record<string, unknown>): PageSection[];
|
|
19
|
+
export declare function updateSectionSettings(sections: PageSection[], id: string, patch: Partial<SectionSettings>): PageSection[];
|
|
20
|
+
export declare function updateSectionMeta(sections: PageSection[], id: string, patch: {
|
|
21
|
+
name?: string;
|
|
22
|
+
internalLabel?: string;
|
|
23
|
+
}): PageSection[];
|
|
24
|
+
/**
|
|
25
|
+
* Normalize arbitrary JSON into a clean `PageSection[]`.
|
|
26
|
+
*
|
|
27
|
+
* Drops entries with an unknown `sectionType` (rather than rendering a
|
|
28
|
+
* blank), backfills missing ids/names, and coerces visibility. Used when
|
|
29
|
+
* reading `data.sections` from the DB and when accepting an AI/agent
|
|
30
|
+
* payload that may be partially shaped.
|
|
31
|
+
*/
|
|
32
|
+
export declare function coerceSections(raw: unknown): PageSection[];
|
|
33
|
+
/**
|
|
34
|
+
* Build a fully-formed section from a (possibly partial) AI/agent payload:
|
|
35
|
+
* start from the registry defaults for `type`, then shallow-merge the
|
|
36
|
+
* provided `content` / `settings` and apply an optional display name.
|
|
37
|
+
* The returned section always has a fresh id + valid shape.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildSection(type: SectionTypeId, input?: {
|
|
40
|
+
name?: string;
|
|
41
|
+
internalLabel?: string;
|
|
42
|
+
visible?: boolean;
|
|
43
|
+
content?: Record<string, unknown>;
|
|
44
|
+
settings?: Partial<SectionSettings>;
|
|
45
|
+
}): PageSection;
|
|
46
|
+
/** Sensible default header layout for a brand-new post type template. */
|
|
47
|
+
export declare function defaultPostHeader(): PostHeaderConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Normalize arbitrary JSON into a clean {@link PostHeaderConfig}, falling
|
|
50
|
+
* back to {@link defaultPostHeader} for any missing/invalid keys. Used when
|
|
51
|
+
* reading a `post-templates` document or accepting an agent payload.
|
|
52
|
+
*/
|
|
53
|
+
export declare function coercePostHeader(raw: unknown): PostHeaderConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Build a default template for a post type: a centered header plus an
|
|
56
|
+
* article body and a related-posts block — a usable starting point an
|
|
57
|
+
* author or AI agent can then alter.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createPostTemplate(postType: string): PostTemplate;
|
|
60
|
+
/** Normalize a raw `post-templates` document's data into a {@link PostTemplate}. */
|
|
61
|
+
export declare function coercePostTemplate(postType: string, raw: unknown): PostTemplate;
|
|
62
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/sections/helpers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAA;AAMnB,8EAA8E;AAC9E,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAID,+EA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ED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,WAAW,EAAE,EACvB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C,WAAW,EAAE,CAEf;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,EAAE,CAoB1D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,KAAK,GAAE;IACL,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC/B,GACL,WAAW,CAUb;AAID,yEAAyE;AACzE,wBAAgB,iBAAiB,IAAI,gBAAgB,CAUpD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAmB/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAMjE;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,YAAY,CAO/E"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers over `PageSection[]`.
|
|
3
|
+
*
|
|
4
|
+
* Every function is side-effect free and returns a NEW array, so the admin
|
|
5
|
+
* editor state, the REST section endpoints, the MCP tools, and the unit
|
|
6
|
+
* tests all share ONE implementation. No DOM, React, or Node APIs here —
|
|
7
|
+
* keep this module isomorphic so it runs in the browser and on the server.
|
|
8
|
+
*/
|
|
9
|
+
import { SECTION_TYPES, getSectionType } from './registry.js';
|
|
10
|
+
// ─── ID generation ───────────────────────────────────────────────────
|
|
11
|
+
let idCounter = 0;
|
|
12
|
+
/** Generate a unique section id (UUID when available, monotonic fallback). */
|
|
13
|
+
export function generateSectionId() {
|
|
14
|
+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
15
|
+
return crypto.randomUUID();
|
|
16
|
+
}
|
|
17
|
+
idCounter += 1;
|
|
18
|
+
return `sec_${Date.now().toString(36)}_${idCounter}`;
|
|
19
|
+
}
|
|
20
|
+
// ─── Section factory + array helpers ─────────────────────────────────
|
|
21
|
+
/** Create a fresh section of the given type, seeded with registry defaults. */
|
|
22
|
+
export function createSection(type) {
|
|
23
|
+
const def = SECTION_TYPES[type];
|
|
24
|
+
return {
|
|
25
|
+
id: generateSectionId(),
|
|
26
|
+
sectionType: type,
|
|
27
|
+
name: def.name,
|
|
28
|
+
visible: true,
|
|
29
|
+
// deep clone so two sections never share content/settings references
|
|
30
|
+
content: structuredClone(def.defaultContent),
|
|
31
|
+
settings: structuredClone(def.defaultSettings),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Insert a section at `index` (defaults to the end). Returns a new array. */
|
|
35
|
+
export function addSection(sections, section, index) {
|
|
36
|
+
const next = sections.slice();
|
|
37
|
+
const at = index === undefined || index < 0 || index > next.length ? next.length : index;
|
|
38
|
+
next.splice(at, 0, section);
|
|
39
|
+
return next;
|
|
40
|
+
}
|
|
41
|
+
export function removeSection(sections, id) {
|
|
42
|
+
return sections.filter((s) => s.id !== id);
|
|
43
|
+
}
|
|
44
|
+
/** Duplicate a section (new id, "(Copy)" suffix), inserted right after the original. */
|
|
45
|
+
export function duplicateSection(sections, id) {
|
|
46
|
+
const idx = sections.findIndex((s) => s.id === id);
|
|
47
|
+
if (idx === -1)
|
|
48
|
+
return sections;
|
|
49
|
+
const original = sections[idx];
|
|
50
|
+
const copy = {
|
|
51
|
+
...original,
|
|
52
|
+
id: generateSectionId(),
|
|
53
|
+
name: `${original.name} (Copy)`,
|
|
54
|
+
content: structuredClone(original.content),
|
|
55
|
+
settings: structuredClone(original.settings),
|
|
56
|
+
};
|
|
57
|
+
return addSection(sections, copy, idx + 1);
|
|
58
|
+
}
|
|
59
|
+
export function toggleSectionVisibility(sections, id) {
|
|
60
|
+
return sections.map((s) => (s.id === id ? { ...s, visible: !s.visible } : s));
|
|
61
|
+
}
|
|
62
|
+
/** Explicitly set a section's visibility (used by the API toggle endpoint). */
|
|
63
|
+
export function setSectionVisibility(sections, id, visible) {
|
|
64
|
+
return sections.map((s) => (s.id === id ? { ...s, visible } : s));
|
|
65
|
+
}
|
|
66
|
+
/** Move the section with `id` to a new index (clamped). Returns a new array. */
|
|
67
|
+
export function moveSection(sections, id, toIndex) {
|
|
68
|
+
const from = sections.findIndex((s) => s.id === id);
|
|
69
|
+
if (from === -1)
|
|
70
|
+
return sections;
|
|
71
|
+
const next = sections.slice();
|
|
72
|
+
const [moved] = next.splice(from, 1);
|
|
73
|
+
const clamped = Math.max(0, Math.min(toIndex, next.length));
|
|
74
|
+
next.splice(clamped, 0, moved);
|
|
75
|
+
return next;
|
|
76
|
+
}
|
|
77
|
+
/** Reorder to an explicit id order (used by drag-and-drop drop handlers). */
|
|
78
|
+
export function reorderSections(sections, orderedIds) {
|
|
79
|
+
const byId = new Map(sections.map((s) => [s.id, s]));
|
|
80
|
+
const ordered = orderedIds.map((id) => byId.get(id)).filter((s) => Boolean(s));
|
|
81
|
+
// append any sections missing from orderedIds (defensive) to avoid data loss
|
|
82
|
+
for (const s of sections)
|
|
83
|
+
if (!orderedIds.includes(s.id))
|
|
84
|
+
ordered.push(s);
|
|
85
|
+
return ordered;
|
|
86
|
+
}
|
|
87
|
+
export function updateSectionContent(sections, id, patch) {
|
|
88
|
+
return sections.map((s) => (s.id === id ? { ...s, content: { ...s.content, ...patch } } : s));
|
|
89
|
+
}
|
|
90
|
+
export function updateSectionSettings(sections, id, patch) {
|
|
91
|
+
return sections.map((s) => (s.id === id ? { ...s, settings: { ...s.settings, ...patch } } : s));
|
|
92
|
+
}
|
|
93
|
+
export function updateSectionMeta(sections, id, patch) {
|
|
94
|
+
return sections.map((s) => (s.id === id ? { ...s, ...patch } : s));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Normalize arbitrary JSON into a clean `PageSection[]`.
|
|
98
|
+
*
|
|
99
|
+
* Drops entries with an unknown `sectionType` (rather than rendering a
|
|
100
|
+
* blank), backfills missing ids/names, and coerces visibility. Used when
|
|
101
|
+
* reading `data.sections` from the DB and when accepting an AI/agent
|
|
102
|
+
* payload that may be partially shaped.
|
|
103
|
+
*/
|
|
104
|
+
export function coerceSections(raw) {
|
|
105
|
+
if (!Array.isArray(raw))
|
|
106
|
+
return [];
|
|
107
|
+
const out = [];
|
|
108
|
+
for (const item of raw) {
|
|
109
|
+
if (!item || typeof item !== 'object')
|
|
110
|
+
continue;
|
|
111
|
+
const s = item;
|
|
112
|
+
const type = String(s.sectionType ?? '');
|
|
113
|
+
if (!getSectionType(type))
|
|
114
|
+
continue; // drop unknown types instead of rendering blanks
|
|
115
|
+
out.push({
|
|
116
|
+
id: typeof s.id === 'string' && s.id ? s.id : generateSectionId(),
|
|
117
|
+
sectionType: type,
|
|
118
|
+
name: typeof s.name === 'string' ? s.name : SECTION_TYPES[type].name,
|
|
119
|
+
internalLabel: typeof s.internalLabel === 'string' ? s.internalLabel : undefined,
|
|
120
|
+
visible: s.visible !== false,
|
|
121
|
+
content: s.content && typeof s.content === 'object' ? s.content : {},
|
|
122
|
+
settings: s.settings && typeof s.settings === 'object' ? s.settings : {},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Build a fully-formed section from a (possibly partial) AI/agent payload:
|
|
129
|
+
* start from the registry defaults for `type`, then shallow-merge the
|
|
130
|
+
* provided `content` / `settings` and apply an optional display name.
|
|
131
|
+
* The returned section always has a fresh id + valid shape.
|
|
132
|
+
*/
|
|
133
|
+
export function buildSection(type, input = {}) {
|
|
134
|
+
const base = createSection(type);
|
|
135
|
+
return {
|
|
136
|
+
...base,
|
|
137
|
+
name: input.name && input.name.trim() ? input.name : base.name,
|
|
138
|
+
...(input.internalLabel !== undefined ? { internalLabel: input.internalLabel } : {}),
|
|
139
|
+
visible: input.visible !== false,
|
|
140
|
+
content: { ...base.content, ...(input.content ?? {}) },
|
|
141
|
+
settings: { ...base.settings, ...(input.settings ?? {}) },
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// ─── Post templates ──────────────────────────────────────────────────
|
|
145
|
+
/** Sensible default header layout for a brand-new post type template. */
|
|
146
|
+
export function defaultPostHeader() {
|
|
147
|
+
return {
|
|
148
|
+
layout: 'centered',
|
|
149
|
+
showFeaturedImage: true,
|
|
150
|
+
showExcerpt: true,
|
|
151
|
+
showAuthor: true,
|
|
152
|
+
showDate: true,
|
|
153
|
+
showCategory: true,
|
|
154
|
+
showReadingTime: false,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Normalize arbitrary JSON into a clean {@link PostHeaderConfig}, falling
|
|
159
|
+
* back to {@link defaultPostHeader} for any missing/invalid keys. Used when
|
|
160
|
+
* reading a `post-templates` document or accepting an agent payload.
|
|
161
|
+
*/
|
|
162
|
+
export function coercePostHeader(raw) {
|
|
163
|
+
const base = defaultPostHeader();
|
|
164
|
+
if (!raw || typeof raw !== 'object')
|
|
165
|
+
return base;
|
|
166
|
+
const r = raw;
|
|
167
|
+
const layout = r.layout === 'centered' || r.layout === 'left' || r.layout === 'overlay'
|
|
168
|
+
? r.layout
|
|
169
|
+
: base.layout;
|
|
170
|
+
const bool = (key) => typeof r[key] === 'boolean' ? r[key] : base[key];
|
|
171
|
+
return {
|
|
172
|
+
layout,
|
|
173
|
+
showFeaturedImage: bool('showFeaturedImage'),
|
|
174
|
+
showExcerpt: bool('showExcerpt'),
|
|
175
|
+
showAuthor: bool('showAuthor'),
|
|
176
|
+
showDate: bool('showDate'),
|
|
177
|
+
showCategory: bool('showCategory'),
|
|
178
|
+
showReadingTime: bool('showReadingTime'),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Build a default template for a post type: a centered header plus an
|
|
183
|
+
* article body and a related-posts block — a usable starting point an
|
|
184
|
+
* author or AI agent can then alter.
|
|
185
|
+
*/
|
|
186
|
+
export function createPostTemplate(postType) {
|
|
187
|
+
return {
|
|
188
|
+
postType,
|
|
189
|
+
header: defaultPostHeader(),
|
|
190
|
+
sections: [createSection('article-body'), createSection('related-posts')],
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/** Normalize a raw `post-templates` document's data into a {@link PostTemplate}. */
|
|
194
|
+
export function coercePostTemplate(postType, raw) {
|
|
195
|
+
const data = raw && typeof raw === 'object' ? raw : {};
|
|
196
|
+
return {
|
|
197
|
+
postType,
|
|
198
|
+
header: coercePostHeader(data.header),
|
|
199
|
+
sections: coerceSections(data.sections),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/sections/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAS7D,wEAAwE;AAExE,IAAI,SAAS,GAAG,CAAC,CAAA;AAEjB,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,UAAU,EAAE,CAAA;IAC5B,CAAC;IACD,SAAS,IAAI,CAAC,CAAA;IACd,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAA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C,CAAC,CAAE,IAAI,CAAC,GAAG,CAAa,CAAA;IAC5E,OAAO;QACL,MAAM;QACN,iBAAiB,EAAE,IAAI,CAAC,mBAAmB,CAAC;QAC5C,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC;QAChC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC;QAC9B,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;QAC1B,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC;QAClC,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAAC;KACzC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO;QACL,QAAQ;QACR,MAAM,EAAE,iBAAiB,EAAE;QAC3B,QAAQ,EAAE,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;KAC1E,CAAA;AACH,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,GAAY;IAC/D,MAAM,IAAI,GAAG,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAE,GAA+B,CAAC,CAAC,CAAC,EAAE,CAAA;IACnF,OAAO;QACL,QAAQ;QACR,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC;QACrC,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;KACxC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat, section-based Page Editor model — shared across the admin editor,
|
|
3
|
+
* the REST API, and the MCP server.
|
|
4
|
+
*
|
|
5
|
+
* Exposed as the `@actuate-media/cms-core/page-sections` subpath (NOT the
|
|
6
|
+
* package root) to avoid colliding with the page-builder *tree* model,
|
|
7
|
+
* which already exports `SectionSettings` / `createSection` from the root.
|
|
8
|
+
*/
|
|
9
|
+
export { SECTION_TYPES, SECTION_TYPE_LIST, getSectionType, getSectionTypesForScope, sectionTypeLabel, isKnownSectionType, } from './registry.js';
|
|
10
|
+
export { generateSectionId, createSection, buildSection, addSection, removeSection, duplicateSection, toggleSectionVisibility, setSectionVisibility, moveSection, reorderSections, updateSectionContent, updateSectionSettings, updateSectionMeta, coerceSections, defaultPostHeader, coercePostHeader, createPostTemplate, coercePostTemplate, } from './helpers.js';
|
|
11
|
+
export { validateSectionContent } from './validate.js';
|
|
12
|
+
export type { SectionTypeId, SectionScope, SectionFieldType, SectionFieldDef, SectionSettings, SectionTypeDef, PageSection, PostHeaderConfig, PostTemplate, SectionValidationIssue, SectionValidationResult, } from './types.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,YAAY,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat, section-based Page Editor model — shared across the admin editor,
|
|
3
|
+
* the REST API, and the MCP server.
|
|
4
|
+
*
|
|
5
|
+
* Exposed as the `@actuate-media/cms-core/page-sections` subpath (NOT the
|
|
6
|
+
* package root) to avoid colliding with the page-builder *tree* model,
|
|
7
|
+
* which already exports `SectionSettings` / `createSection` from the root.
|
|
8
|
+
*/
|
|
9
|
+
export { SECTION_TYPES, SECTION_TYPE_LIST, getSectionType, getSectionTypesForScope, sectionTypeLabel, isKnownSectionType, } from './registry.js';
|
|
10
|
+
export { generateSectionId, createSection, buildSection, addSection, removeSection, duplicateSection, toggleSectionVisibility, setSectionVisibility, moveSection, reorderSections, updateSectionContent, updateSectionSettings, updateSectionMeta, coerceSections, defaultPostHeader, coercePostHeader, createPostTemplate, coercePostTemplate, } from './helpers.js';
|
|
11
|
+
export { validateSectionContent } from './validate.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section-type registry — the single source of truth for the flat Page
|
|
3
|
+
* Editor model. The admin editor re-exports this; the REST API and MCP
|
|
4
|
+
* server read it for discovery + validation.
|
|
5
|
+
*
|
|
6
|
+
* Only types listed here can be added/created, so neither the Add Section
|
|
7
|
+
* gallery nor an AI agent can produce a section without a working renderer
|
|
8
|
+
* + inspector + schema ("no dead sections").
|
|
9
|
+
*/
|
|
10
|
+
import type { SectionScope, SectionTypeDef, SectionTypeId } from './types.js';
|
|
11
|
+
export declare const SECTION_TYPES: Record<SectionTypeId, SectionTypeDef>;
|
|
12
|
+
/** Ordered list for the Add Section gallery + discovery endpoints. */
|
|
13
|
+
export declare const SECTION_TYPE_LIST: SectionTypeDef[];
|
|
14
|
+
export declare function getSectionType(id: string): SectionTypeDef | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Section types available in a given editor context, in registry order.
|
|
17
|
+
*
|
|
18
|
+
* The Page editor passes `'page'`, the Post editor + Post Template editor
|
|
19
|
+
* pass `'post'`, so each Add Section gallery shows only the types that make
|
|
20
|
+
* sense (and have a working renderer) for that surface.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSectionTypesForScope(scope: SectionScope): SectionTypeDef[];
|
|
23
|
+
/** Human label for a section type id, with a graceful fallback. */
|
|
24
|
+
export declare function sectionTypeLabel(id: string): string;
|
|
25
|
+
/** True when `id` is a registered, renderable section type. */
|
|
26
|
+
export declare function isKnownSectionType(id: string): id is SectionTypeId;
|
|
27
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/sections/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAmB,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI9F,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,cAAc,CA0T/D,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAW7C,CAAA;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,EAAE,CAE7E;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,aAAa,CAElE"}
|