riverbankcms 0.29.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acceptance/matrix.mjs +17 -3
- package/dist/cli/index.mjs +74900 -29596
- package/dist/cli/init-docs/content/cli-reference.md +22 -0
- package/dist/{entryCommands-5kz7nIFG.mjs → entryCommands-BdWO_ZfG.mjs} +15298 -10490
- package/dist/{eventUpsertInputSchema-DEN6k1oM.mjs → eventUpsertInputSchema-u-IyFUEF.mjs} +3 -582
- package/dist/load-config-BqyywgbJ.mjs +4 -0
- package/dist/{load-config-JcidEUjc.mjs → load-config-C4powIPE.mjs} +2 -2
- package/dist/{plan-BppGb0gS.mjs → plan-AJDYca86.mjs} +1 -1
- package/dist/scaffold/index.mjs +2 -2
- package/dist/sdk-event-upsert-RMUvPiD5.mjs +15672 -0
- package/dist/{src-4CBCWovR.mjs → src-BntuEwG8.mjs} +134 -6
- package/dist/testing.mjs +4 -4
- package/package.json +1 -1
- package/dist/load-config-DkoaFO1t.mjs +0 -4
- package/dist/sdk-event-upsert-CXc13KPT.mjs +0 -63038
|
@@ -1,586 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { m as EVENT_PRESET_VALUES
|
|
2
|
+
import { Cn as ICON_PICKER_PRESETS, _r as linkSchema, a as classifySdkEventSchedule, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer, or as createRichTextDoc, vr as normalizeLinkValue } from "./sdk-event-upsert-RMUvPiD5.mjs";
|
|
3
|
+
import { m as EVENT_PRESET_VALUES } from "./src-BntuEwG8.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
|
-
//#region ../blocks/src/lib/typeGuards.ts
|
|
7
|
-
/**
|
|
8
|
-
* Strict record guard: excludes null, primitives, and arrays.
|
|
9
|
-
*/
|
|
10
|
-
function isRecord$3(value) {
|
|
11
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Non-null object guard: includes arrays for behavior parity with legacy helpers.
|
|
15
|
-
*
|
|
16
|
-
* NOTE: This intentionally narrows to UnknownRecord for compatibility with existing
|
|
17
|
-
* callsites even though arrays pass at runtime. Follow-up cleanup should replace
|
|
18
|
-
* this API with a more precise predicate type and migrate consumers.
|
|
19
|
-
*/
|
|
20
|
-
function isObjectRecord(value) {
|
|
21
|
-
return typeof value === "object" && value !== null;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Coerces unknown input into a strict record, returning an empty object fallback.
|
|
25
|
-
*/
|
|
26
|
-
function asRecord(value) {
|
|
27
|
-
return isRecord$3(value) ? value : {};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../blocks/src/primitives/content/utils/sanitizeHref.ts
|
|
32
|
-
const SAFE_PROTOCOLS = new Set([
|
|
33
|
-
"http:",
|
|
34
|
-
"https:",
|
|
35
|
-
"mailto:",
|
|
36
|
-
"tel:"
|
|
37
|
-
]);
|
|
38
|
-
const CONTROL_CHARS_PATTERN = /[\u0000-\u001F\u007F]+/g;
|
|
39
|
-
function normalizeInput(value) {
|
|
40
|
-
return value.replace(CONTROL_CHARS_PATTERN, "").trim();
|
|
41
|
-
}
|
|
42
|
-
function decodeForSchemeCheck(value) {
|
|
43
|
-
try {
|
|
44
|
-
return decodeURIComponent(value);
|
|
45
|
-
} catch {
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Returns a safe href for rich-text anchors, or null when the value should not be rendered.
|
|
51
|
-
*
|
|
52
|
-
* Policy:
|
|
53
|
-
* - Allow absolute URLs with protocols: http, https, mailto, tel.
|
|
54
|
-
* - Allow root-relative ("/path") and hash-only ("#section") links.
|
|
55
|
-
* - Reject protocol-relative URLs ("//example.com"), bare domains ("example.com"),
|
|
56
|
-
* backslashes, executable schemes (javascript/data/vbscript), malformed URLs, and empty values.
|
|
57
|
-
* - Preserve percent-encoding from the original normalized input.
|
|
58
|
-
*/
|
|
59
|
-
function sanitizeHref(raw) {
|
|
60
|
-
if (typeof raw !== "string") return null;
|
|
61
|
-
const normalized = normalizeInput(raw);
|
|
62
|
-
if (!normalized) return null;
|
|
63
|
-
if (normalized.includes("\\") || normalized.startsWith("//")) return null;
|
|
64
|
-
if (normalized.startsWith("/")) return normalized;
|
|
65
|
-
if (normalized.startsWith("#")) return normalized;
|
|
66
|
-
return sanitizeAbsoluteHref(normalized);
|
|
67
|
-
}
|
|
68
|
-
function sanitizeAbsoluteHref(normalized) {
|
|
69
|
-
const decoded = normalizeInput(decodeForSchemeCheck(normalized));
|
|
70
|
-
const schemeMatch = decoded.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);
|
|
71
|
-
if (!schemeMatch) return null;
|
|
72
|
-
const rawScheme = schemeMatch[1];
|
|
73
|
-
if (!rawScheme) return null;
|
|
74
|
-
const protocol = `${rawScheme.toLowerCase()}:`;
|
|
75
|
-
if (!SAFE_PROTOCOLS.has(protocol)) return null;
|
|
76
|
-
try {
|
|
77
|
-
const parsed = new URL(normalized);
|
|
78
|
-
if (!SAFE_PROTOCOLS.has(parsed.protocol.toLowerCase())) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
} catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
return normalized;
|
|
85
|
-
}
|
|
86
|
-
/** Strict authoring admission; existing stored links keep the renderer's normalization. */
|
|
87
|
-
function isSafeRichTextHref(raw) {
|
|
88
|
-
const decoded = decodeForSchemeCheck(raw);
|
|
89
|
-
return !/[\u0000-\u001F\u007F\\]/.test(decoded) && !decoded.startsWith("//") && sanitizeHref(raw) === raw;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region ../blocks/src/system/manifest/richTextAuthoring.ts
|
|
94
|
-
const optionalText = z.string().max(2048).nullable().optional();
|
|
95
|
-
const destination = z.string().max(2048).refine(isSafeRichTextHref, "Use http, https, mailto, tel, a single-root-relative path or a #fragment without controls or backslashes");
|
|
96
|
-
const linkAttributes = z.object({
|
|
97
|
-
href: destination.nullable().optional(),
|
|
98
|
-
target: z.enum([
|
|
99
|
-
"_blank",
|
|
100
|
-
"_self",
|
|
101
|
-
"_parent",
|
|
102
|
-
"_top"
|
|
103
|
-
]).nullable().optional(),
|
|
104
|
-
rel: optionalText,
|
|
105
|
-
class: optionalText,
|
|
106
|
-
kind: z.enum([
|
|
107
|
-
"internal",
|
|
108
|
-
"page",
|
|
109
|
-
"entry",
|
|
110
|
-
"external",
|
|
111
|
-
"url"
|
|
112
|
-
]).nullable().optional(),
|
|
113
|
-
identifier: optionalText,
|
|
114
|
-
contentType: optionalText,
|
|
115
|
-
routeId: optionalText,
|
|
116
|
-
entityId: optionalText,
|
|
117
|
-
entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES).nullable().optional(),
|
|
118
|
-
title: optionalText,
|
|
119
|
-
typeLabel: optionalText,
|
|
120
|
-
contentTypeKey: optionalText,
|
|
121
|
-
contentTypeName: optionalText,
|
|
122
|
-
updatedAt: optionalText
|
|
123
|
-
}).strict().refine((attrs) => Boolean(attrs.href) || (attrs.kind === "internal" || attrs.kind === "page" || attrs.kind === "entry") && [attrs.routeId, attrs.identifier].some((value) => typeof value === "string" && value.trim().length > 0), {
|
|
124
|
-
message: "Links require a safe href, or an internal kind with a routeId or identifier",
|
|
125
|
-
path: ["href"]
|
|
126
|
-
});
|
|
127
|
-
const noAttributes = z.object({}).strict().optional();
|
|
128
|
-
const markSchema = z.discriminatedUnion("type", [
|
|
129
|
-
z.object({
|
|
130
|
-
type: z.literal("bold"),
|
|
131
|
-
attrs: noAttributes
|
|
132
|
-
}).strict(),
|
|
133
|
-
z.object({
|
|
134
|
-
type: z.literal("italic"),
|
|
135
|
-
attrs: noAttributes
|
|
136
|
-
}).strict(),
|
|
137
|
-
z.object({
|
|
138
|
-
type: z.literal("strike"),
|
|
139
|
-
attrs: noAttributes
|
|
140
|
-
}).strict(),
|
|
141
|
-
z.object({
|
|
142
|
-
type: z.literal("code"),
|
|
143
|
-
attrs: noAttributes
|
|
144
|
-
}).strict(),
|
|
145
|
-
z.object({
|
|
146
|
-
type: z.literal("link"),
|
|
147
|
-
attrs: linkAttributes
|
|
148
|
-
}).strict()
|
|
149
|
-
]);
|
|
150
|
-
const marksSchema = z.array(markSchema).max(5).superRefine((marks, ctx) => {
|
|
151
|
-
if (new Set(marks.map((mark) => mark.type)).size !== marks.length) {
|
|
152
|
-
ctx.addIssue({
|
|
153
|
-
code: "custom",
|
|
154
|
-
message: "Use each mark type at most once"
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (marks.some((mark) => mark.type === "code") && marks.length !== 1) {
|
|
158
|
-
ctx.addIssue({
|
|
159
|
-
code: "custom",
|
|
160
|
-
message: "Code cannot be combined with other marks"
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
const textSchema = z.object({
|
|
165
|
-
type: z.literal("text"),
|
|
166
|
-
text: z.string().min(1).max(5e4),
|
|
167
|
-
marks: marksSchema.optional()
|
|
168
|
-
}).strict();
|
|
169
|
-
const hardBreakSchema = z.object({
|
|
170
|
-
type: z.literal("hardBreak"),
|
|
171
|
-
attrs: noAttributes
|
|
172
|
-
}).strict();
|
|
173
|
-
const inlineSchema = z.discriminatedUnion("type", [textSchema, hardBreakSchema]);
|
|
174
|
-
const paragraphSchema = z.object({
|
|
175
|
-
type: z.literal("paragraph"),
|
|
176
|
-
attrs: noAttributes,
|
|
177
|
-
content: z.array(inlineSchema).max(1e3).optional()
|
|
178
|
-
}).strict();
|
|
179
|
-
const headingSchema = z.object({
|
|
180
|
-
type: z.literal("heading"),
|
|
181
|
-
attrs: z.object({ level: z.union([
|
|
182
|
-
z.literal(1),
|
|
183
|
-
z.literal(2),
|
|
184
|
-
z.literal(3),
|
|
185
|
-
z.literal(4),
|
|
186
|
-
z.literal(5)
|
|
187
|
-
]) }).strict(),
|
|
188
|
-
content: z.array(inlineSchema).max(1e3).optional()
|
|
189
|
-
}).strict();
|
|
190
|
-
const codeBlockSchema = z.object({
|
|
191
|
-
type: z.literal("codeBlock"),
|
|
192
|
-
attrs: z.object({ language: optionalText }).strict().optional(),
|
|
193
|
-
content: z.array(z.object({
|
|
194
|
-
type: z.literal("text"),
|
|
195
|
-
text: z.string().min(1).max(5e4)
|
|
196
|
-
}).strict()).max(1e3).optional()
|
|
197
|
-
}).strict();
|
|
198
|
-
const imageSchema = z.object({
|
|
199
|
-
type: z.literal("image"),
|
|
200
|
-
attrs: z.object({
|
|
201
|
-
src: destination.nullable().optional(),
|
|
202
|
-
identifier: optionalText,
|
|
203
|
-
alt: optionalText,
|
|
204
|
-
title: optionalText,
|
|
205
|
-
width: z.number().positive().nullable().optional(),
|
|
206
|
-
height: z.number().positive().nullable().optional()
|
|
207
|
-
}).strict()
|
|
208
|
-
}).strict();
|
|
209
|
-
const horizontalRuleSchema = z.object({
|
|
210
|
-
type: z.literal("horizontalRule"),
|
|
211
|
-
attrs: noAttributes
|
|
212
|
-
}).strict();
|
|
213
|
-
const blockSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
214
|
-
paragraphSchema,
|
|
215
|
-
headingSchema,
|
|
216
|
-
codeBlockSchema,
|
|
217
|
-
imageSchema,
|
|
218
|
-
horizontalRuleSchema,
|
|
219
|
-
z.object({
|
|
220
|
-
type: z.literal("blockquote"),
|
|
221
|
-
attrs: noAttributes,
|
|
222
|
-
content: z.array(blockSchema).min(1).max(1e3)
|
|
223
|
-
}).strict(),
|
|
224
|
-
z.object({
|
|
225
|
-
type: z.literal("bulletList"),
|
|
226
|
-
attrs: noAttributes,
|
|
227
|
-
content: z.array(listItemSchema).min(1).max(1e3)
|
|
228
|
-
}).strict(),
|
|
229
|
-
z.object({
|
|
230
|
-
type: z.literal("orderedList"),
|
|
231
|
-
attrs: z.object({
|
|
232
|
-
start: z.number().int().positive().optional(),
|
|
233
|
-
type: z.enum([
|
|
234
|
-
"1",
|
|
235
|
-
"a",
|
|
236
|
-
"A",
|
|
237
|
-
"i",
|
|
238
|
-
"I"
|
|
239
|
-
]).nullable().optional()
|
|
240
|
-
}).strict().optional(),
|
|
241
|
-
content: z.array(listItemSchema).min(1).max(1e3)
|
|
242
|
-
}).strict()
|
|
243
|
-
]));
|
|
244
|
-
const listItemSchema = z.lazy(() => z.object({
|
|
245
|
-
type: z.literal("listItem"),
|
|
246
|
-
attrs: noAttributes,
|
|
247
|
-
content: z.tuple([paragraphSchema]).rest(blockSchema)
|
|
248
|
-
}).strict());
|
|
249
|
-
function treeSize(value, depth = 0) {
|
|
250
|
-
if (depth > 12) return {
|
|
251
|
-
depth,
|
|
252
|
-
nodes: 0,
|
|
253
|
-
text: 0
|
|
254
|
-
};
|
|
255
|
-
if (!isRecord$4(value)) return {
|
|
256
|
-
depth,
|
|
257
|
-
nodes: 0,
|
|
258
|
-
text: 0
|
|
259
|
-
};
|
|
260
|
-
const nodes = Array.isArray(value.content) ? value.content : [];
|
|
261
|
-
if (nodes.length > 2e3) return {
|
|
262
|
-
depth,
|
|
263
|
-
nodes: 2001,
|
|
264
|
-
text: 0
|
|
265
|
-
};
|
|
266
|
-
return nodes.reduce((total, node) => {
|
|
267
|
-
if (exceedsBounds(total)) return total;
|
|
268
|
-
const child = treeSize(node, depth + 1);
|
|
269
|
-
return {
|
|
270
|
-
depth: Math.max(total.depth, child.depth),
|
|
271
|
-
nodes: total.nodes + child.nodes,
|
|
272
|
-
text: total.text + child.text
|
|
273
|
-
};
|
|
274
|
-
}, {
|
|
275
|
-
depth,
|
|
276
|
-
nodes: depth === 0 ? 0 : 1,
|
|
277
|
-
text: typeof value.text === "string" ? value.text.length : 0
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
function exceedsBounds(size) {
|
|
281
|
-
return size.depth > 12 || size.nodes > 2e3 || size.text > 1e5;
|
|
282
|
-
}
|
|
283
|
-
/** Closed authoring contract for generated content. Stored legacy documents keep their existing reader. */
|
|
284
|
-
const RichTextAuthoringDocSchema = z.preprocess((value, ctx) => {
|
|
285
|
-
if (exceedsBounds(treeSize(value))) {
|
|
286
|
-
ctx.addIssue({
|
|
287
|
-
code: "custom",
|
|
288
|
-
message: "Rich text must have at most 12 levels, 2000 nodes and 100000 text characters"
|
|
289
|
-
});
|
|
290
|
-
return z.NEVER;
|
|
291
|
-
}
|
|
292
|
-
return value;
|
|
293
|
-
}, z.object({
|
|
294
|
-
type: z.literal("doc"),
|
|
295
|
-
content: z.array(blockSchema).max(1e3)
|
|
296
|
-
}).strict());
|
|
297
|
-
const inlineNodes = [
|
|
298
|
-
"paragraph",
|
|
299
|
-
"text",
|
|
300
|
-
"hardBreak"
|
|
301
|
-
];
|
|
302
|
-
const inlineMarks = [
|
|
303
|
-
"bold",
|
|
304
|
-
"italic",
|
|
305
|
-
"strike",
|
|
306
|
-
"code",
|
|
307
|
-
"link"
|
|
308
|
-
];
|
|
309
|
-
const fullCapabilities = {
|
|
310
|
-
nodes: [
|
|
311
|
-
...inlineNodes,
|
|
312
|
-
"heading",
|
|
313
|
-
"blockquote",
|
|
314
|
-
"bulletList",
|
|
315
|
-
"orderedList",
|
|
316
|
-
"listItem",
|
|
317
|
-
"codeBlock",
|
|
318
|
-
"horizontalRule",
|
|
319
|
-
"image"
|
|
320
|
-
],
|
|
321
|
-
marks: inlineMarks,
|
|
322
|
-
headingLevels: [
|
|
323
|
-
1,
|
|
324
|
-
2,
|
|
325
|
-
3,
|
|
326
|
-
4,
|
|
327
|
-
5
|
|
328
|
-
]
|
|
329
|
-
};
|
|
330
|
-
const inlineCapabilities = {
|
|
331
|
-
nodes: inlineNodes,
|
|
332
|
-
marks: inlineMarks,
|
|
333
|
-
headingLevels: []
|
|
334
|
-
};
|
|
335
|
-
const variantCapabilities = {
|
|
336
|
-
full: fullCapabilities,
|
|
337
|
-
media: fullCapabilities,
|
|
338
|
-
inline: inlineCapabilities,
|
|
339
|
-
limited: inlineCapabilities,
|
|
340
|
-
notes: {
|
|
341
|
-
...inlineCapabilities,
|
|
342
|
-
nodes: [
|
|
343
|
-
...inlineNodes,
|
|
344
|
-
"bulletList",
|
|
345
|
-
"orderedList",
|
|
346
|
-
"listItem"
|
|
347
|
-
]
|
|
348
|
-
},
|
|
349
|
-
consent: {
|
|
350
|
-
...inlineCapabilities,
|
|
351
|
-
marks: [
|
|
352
|
-
"bold",
|
|
353
|
-
"italic",
|
|
354
|
-
"link"
|
|
355
|
-
]
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
/** One capability description for editor configuration, admission and model guidance. */
|
|
359
|
-
function richTextVariantCapabilities(variant) {
|
|
360
|
-
const capabilities = variantCapabilities[variant];
|
|
361
|
-
return {
|
|
362
|
-
nodes: [...capabilities.nodes],
|
|
363
|
-
marks: [...capabilities.marks],
|
|
364
|
-
headingLevels: [...capabilities.headingLevels]
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
function richTextDocumentSupportsVariant(doc, variant) {
|
|
368
|
-
const capabilities = richTextVariantCapabilities(variant);
|
|
369
|
-
const supports = (nodes) => nodes.every((node) => capabilities.nodes.some((type) => type === node.type) && (node.marks ?? []).every((mark) => capabilities.marks.some((type) => type === mark.type)) && (node.type !== "heading" || capabilities.headingLevels.some((level) => level === node.attrs?.level)) && supports(node.content ?? []));
|
|
370
|
-
return supports(doc.content);
|
|
371
|
-
}
|
|
372
|
-
/** Measured product allowance for whole-document edits; output-token limits remain separately enforced. */
|
|
373
|
-
function richTextEditingBudget(doc) {
|
|
374
|
-
const serializedBytes = new TextEncoder().encode(JSON.stringify(doc)).length;
|
|
375
|
-
const nodes = treeSize(doc).nodes;
|
|
376
|
-
return {
|
|
377
|
-
kind: serializedBytes <= 8e3 && nodes <= 120 ? "supported" : "too-large",
|
|
378
|
-
serializedBytes,
|
|
379
|
-
nodes
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region ../blocks/src/system/manifest/richTextSchema.ts
|
|
385
|
-
/**
|
|
386
|
-
* Shared Rich Text Schema
|
|
387
|
-
*
|
|
388
|
-
* This module provides a single source of truth for TipTap rich text validation
|
|
389
|
-
* across both the block-form editor and the block rendering system.
|
|
390
|
-
*
|
|
391
|
-
* Rich-text fields use one canonical root shape:
|
|
392
|
-
* `{ type: 'doc', content: [...] }`.
|
|
393
|
-
*/
|
|
394
|
-
/**
|
|
395
|
-
* TipTap document node schema (recursive structure)
|
|
396
|
-
*
|
|
397
|
-
* Supports the full TipTap document structure including:
|
|
398
|
-
* - type: Node type (e.g., 'doc', 'paragraph', 'text')
|
|
399
|
-
* - content: Nested array of child nodes
|
|
400
|
-
* - text: Text content for text nodes
|
|
401
|
-
* - attrs: Node attributes (e.g., alignment, color)
|
|
402
|
-
* - marks: Text formatting marks (e.g., bold, italic)
|
|
403
|
-
*/
|
|
404
|
-
const TipTapMarkSchema = z.object({
|
|
405
|
-
type: z.string().min(1),
|
|
406
|
-
attrs: z.record(z.string(), z.unknown()).optional()
|
|
407
|
-
}).strict();
|
|
408
|
-
const TipTapNodeSchema = z.lazy(() => z.object({
|
|
409
|
-
type: z.string().min(1),
|
|
410
|
-
content: z.array(TipTapNodeSchema).optional(),
|
|
411
|
-
text: z.string().optional(),
|
|
412
|
-
attrs: z.record(z.string(), z.unknown()).optional(),
|
|
413
|
-
marks: z.array(TipTapMarkSchema).optional()
|
|
414
|
-
}).strict().superRefine((node, ctx) => {
|
|
415
|
-
if (node.type === "doc") {
|
|
416
|
-
ctx.addIssue({
|
|
417
|
-
code: "custom",
|
|
418
|
-
path: ["type"],
|
|
419
|
-
message: "Document nodes are only valid at the rich-text root"
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
if (node.type === "text") {
|
|
423
|
-
if (node.text === undefined || node.text.length === 0) {
|
|
424
|
-
ctx.addIssue({
|
|
425
|
-
code: "custom",
|
|
426
|
-
path: ["text"],
|
|
427
|
-
message: "Text nodes require a non-empty text value"
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
if (node.content !== undefined) {
|
|
431
|
-
ctx.addIssue({
|
|
432
|
-
code: "custom",
|
|
433
|
-
path: ["content"],
|
|
434
|
-
message: "Text nodes cannot contain child nodes"
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
if (node.text !== undefined) {
|
|
440
|
-
ctx.addIssue({
|
|
441
|
-
code: "custom",
|
|
442
|
-
path: ["text"],
|
|
443
|
-
message: "Only text nodes can contain a text value"
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}));
|
|
447
|
-
/**
|
|
448
|
-
* Canonical schema for a TipTap rich-text document root.
|
|
449
|
-
*
|
|
450
|
-
* Stricter than {@link TipTapNodeSchema}: `type` is literally `'doc'` and
|
|
451
|
-
* `content` is required (possibly empty). This is the shape every producer
|
|
452
|
-
* (dummy content, editor output, migrations) must emit, and the shape every
|
|
453
|
-
* non-legacy consumer can rely on.
|
|
454
|
-
*
|
|
455
|
-
*/
|
|
456
|
-
const RichTextDocSchema = z.object({
|
|
457
|
-
type: z.literal("doc"),
|
|
458
|
-
content: z.array(TipTapNodeSchema)
|
|
459
|
-
}).strict();
|
|
460
|
-
/**
|
|
461
|
-
* Type guard for {@link RichTextDoc}.
|
|
462
|
-
*
|
|
463
|
-
* Returns `true` only for the canonical unwrapped form. The shared structural
|
|
464
|
-
* contract lives in `@riverbankcms/core`; parity tests keep its dependency-free
|
|
465
|
-
* guard aligned with this detailed Zod validator.
|
|
466
|
-
*/
|
|
467
|
-
function isRichTextDoc(value) {
|
|
468
|
-
return RichTextDocSchema.safeParse(value).success;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Build a canonical {@link RichTextDoc} from plain-text paragraphs.
|
|
472
|
-
*
|
|
473
|
-
* Single source of truth for constructing a TipTap doc from strings.
|
|
474
|
-
* Used by:
|
|
475
|
-
* - `@riverbankcms/dummy-content` (fixture body generators)
|
|
476
|
-
* - `@riverbankcms/content-model` (default template `cta-full` content)
|
|
477
|
-
*
|
|
478
|
-
* Empty strings produce a paragraph with no `content` array — matching
|
|
479
|
-
* the TipTap convention for empty paragraphs. The shape is exactly what
|
|
480
|
-
* {@link RichTextDocSchema} validates, so the type and runtime check
|
|
481
|
-
* never drift from the constructor.
|
|
482
|
-
*/
|
|
483
|
-
function createRichTextDoc(paragraphs) {
|
|
484
|
-
return {
|
|
485
|
-
type: "doc",
|
|
486
|
-
content: paragraphs.map((text) => text ? {
|
|
487
|
-
type: "paragraph",
|
|
488
|
-
content: [{
|
|
489
|
-
type: "text",
|
|
490
|
-
text
|
|
491
|
-
}]
|
|
492
|
-
} : { type: "paragraph" })
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
function createHardBreakNode() {
|
|
496
|
-
return { type: "hardBreak" };
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Parse a small markdown subset into TipTap inline nodes.
|
|
500
|
-
*
|
|
501
|
-
* This intentionally supports only bold (`**text**`) because the SDK/content
|
|
502
|
-
* import paths use it for lightweight default content, not full markdown.
|
|
503
|
-
*/
|
|
504
|
-
function parseRichTextInlineMarkdown(text) {
|
|
505
|
-
const out = [];
|
|
506
|
-
const pushText = (value, marks) => {
|
|
507
|
-
if (!value) return;
|
|
508
|
-
out.push(marks && marks.length > 0 ? {
|
|
509
|
-
type: "text",
|
|
510
|
-
text: value,
|
|
511
|
-
marks
|
|
512
|
-
} : {
|
|
513
|
-
type: "text",
|
|
514
|
-
text: value
|
|
515
|
-
});
|
|
516
|
-
};
|
|
517
|
-
let rest = text;
|
|
518
|
-
while (rest.length > 0) {
|
|
519
|
-
const start = rest.indexOf("**");
|
|
520
|
-
if (start === -1) {
|
|
521
|
-
pushText(rest);
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
const end = rest.indexOf("**", start + 2);
|
|
525
|
-
if (end === -1) {
|
|
526
|
-
pushText(rest);
|
|
527
|
-
break;
|
|
528
|
-
}
|
|
529
|
-
pushText(rest.slice(0, start));
|
|
530
|
-
pushText(rest.slice(start + 2, end), [{ type: "bold" }]);
|
|
531
|
-
rest = rest.slice(end + 2);
|
|
532
|
-
}
|
|
533
|
-
return out;
|
|
534
|
-
}
|
|
535
|
-
function parseRichTextParagraphInlineMarkdown(text) {
|
|
536
|
-
return text.split("\n").flatMap((line, index) => {
|
|
537
|
-
const lineNodes = parseRichTextInlineMarkdown(line.trim());
|
|
538
|
-
return index === 0 ? lineNodes : [createHardBreakNode(), ...lineNodes];
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Convert a plain string with a tiny markdown subset to canonical TipTap JSON.
|
|
543
|
-
*
|
|
544
|
-
* Double newlines create semantic paragraphs. Single newlines remain inside the
|
|
545
|
-
* current paragraph as TipTap `hardBreak` nodes for line-oriented content such
|
|
546
|
-
* as addresses, opening hours, and contact details.
|
|
547
|
-
*/
|
|
548
|
-
function createRichTextDocFromMarkdown(markdown) {
|
|
549
|
-
const normalized = markdown.replace(/\r\n/g, "\n").trim();
|
|
550
|
-
if (!normalized) return {
|
|
551
|
-
type: "doc",
|
|
552
|
-
content: []
|
|
553
|
-
};
|
|
554
|
-
const paragraphs = normalized.split(/\n{2,}/).map((paragraph) => paragraph.trim()).filter(Boolean);
|
|
555
|
-
return {
|
|
556
|
-
type: "doc",
|
|
557
|
-
content: paragraphs.map((paragraph) => {
|
|
558
|
-
const inline = parseRichTextParagraphInlineMarkdown(paragraph);
|
|
559
|
-
return inline.length > 0 ? {
|
|
560
|
-
type: "paragraph",
|
|
561
|
-
content: inline
|
|
562
|
-
} : { type: "paragraph" };
|
|
563
|
-
})
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
function buildRichTextSchema(options) {
|
|
567
|
-
let schema = RichTextDocSchema;
|
|
568
|
-
if (options?.required) {
|
|
569
|
-
const label = options.label ?? "This field";
|
|
570
|
-
schema = schema.refine((val) => {
|
|
571
|
-
const content = val.content;
|
|
572
|
-
if (!Array.isArray(content) || content.length === 0) return false;
|
|
573
|
-
const first = content[0];
|
|
574
|
-
if (content.length === 1 && isRecord$3(first) && first.type === "paragraph" && (!("content" in first) || first.content == null)) {
|
|
575
|
-
return false;
|
|
576
|
-
}
|
|
577
|
-
return true;
|
|
578
|
-
}, { message: `${label} is required` });
|
|
579
|
-
}
|
|
580
|
-
return schema;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
//#endregion
|
|
584
6
|
//#region ../content-model/src/title-resolution.ts
|
|
585
7
|
/**
|
|
586
8
|
* Content title resolution utilities.
|
|
@@ -1118,7 +540,6 @@ function parseReferenceKind(referenceKind) {
|
|
|
1118
540
|
|
|
1119
541
|
//#endregion
|
|
1120
542
|
//#region ../content-model/src/contentManifest.ts
|
|
1121
|
-
const CONTENT_MODEL_ICON_PICKER_PRESETS = ["cta", "feature"];
|
|
1122
543
|
function assertNever$1(value) {
|
|
1123
544
|
throw new Error(`Unhandled content field mapping decision: ${JSON.stringify(value)}`);
|
|
1124
545
|
}
|
|
@@ -5183,4 +4604,4 @@ const eventUpsertInputSchema = z.object({
|
|
|
5183
4604
|
}));
|
|
5184
4605
|
|
|
5185
4606
|
//#endregion
|
|
5186
|
-
export {
|
|
4607
|
+
export { findUnfilledSentinels as i, buildEntryScaffold as n, validateEntryInstance as r, eventUpsertInputSchema as t };
|
|
@@ -7,7 +7,7 @@ import { existsSync as existsSync$1 } from "fs";
|
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
|
|
9
9
|
//#region package.json
|
|
10
|
-
var version = "0.
|
|
10
|
+
var version = "0.30.1";
|
|
11
11
|
var peerDependencies = { "@riverbankcms/sdk": ">=0.157.0 <1.0.0" };
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "riverbankcms",
|
|
@@ -93,7 +93,7 @@ var package_default = {
|
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/version.ts
|
|
95
95
|
/** The package manifest is the source-run fallback; builds inject this value. */
|
|
96
|
-
const CLI_VERSION = typeof "0.
|
|
96
|
+
const CLI_VERSION = typeof "0.30.1" === "string" ? "0.30.1" : version;
|
|
97
97
|
/**
|
|
98
98
|
* The CLI's SDK peer range is bundled from the CLI manifest alongside its
|
|
99
99
|
* version. Runtime config loading uses this value as the single compatibility
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Zn as parseSiteId, cr as err, lr as ok } from "./src-BntuEwG8.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/dist/scaffold/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../src-
|
|
3
|
-
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-
|
|
2
|
+
import "../src-BntuEwG8.mjs";
|
|
3
|
+
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-AJDYca86.mjs";
|
|
4
4
|
|
|
5
5
|
export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };
|