riverbankcms 0.30.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 +3 -3
- package/dist/cli/index.mjs +516 -50
- package/dist/{entryCommands-DqqGit0l.mjs → entryCommands-BdWO_ZfG.mjs} +98 -11
- package/dist/{eventUpsertInputSchema-EGy8zFUx.mjs → eventUpsertInputSchema-u-IyFUEF.mjs} +3 -500
- package/dist/load-config-BqyywgbJ.mjs +4 -0
- package/dist/{load-config-Dgw0C6y3.mjs → load-config-C4powIPE.mjs} +2 -2
- package/dist/{plan-cE7TKMc1.mjs → plan-AJDYca86.mjs} +1 -1
- package/dist/scaffold/index.mjs +2 -2
- package/dist/{sdk-event-upsert-mPJpEQ2x.mjs → sdk-event-upsert-RMUvPiD5.mjs} +784 -134
- package/dist/{src-DOwrYdTk.mjs → src-BntuEwG8.mjs} +107 -0
- package/dist/testing.mjs +4 -4
- package/package.json +1 -1
- package/dist/load-config-3e2Npz2O.mjs +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $n as unsafeAsSiteId, B as footerNavigationLayouts, Bn as unsafeAsSafeDownloadFilename, Dn as unsafeAsEntitlementId, Et as localScheduleTimePattern, F as parseMailingListGlobalForm, Fn as unsafeAsFileChecksumSha256, Ft as BOOKING_COURSE_INSTALMENT_DEADLINES, Gn as unsafeAsProductId, Hn as unsafeAsStorageBucketName, In as unsafeAsMediaAssetId, It as validateBookingPaymentOptionKinds, K as parsePublicContactDetails, Ln as unsafeAsOriginalFilename, Mn as parseMediaAssetId, Mt as parseBookingTimeZone, Nn as unsafeAsDeclaredMimeType, Nt as parseUtcIsoDateTimeString, P as parseConfiguredMailingListProvider, Pn as unsafeAsDetectedMimeType, Q as stableJsonStringify, Rn as unsafeAsPositiveByteCount, Un as unsafeAsStoragePath, Vn as unsafeAsSiteScopedStoragePath, W as isCanonicalRichTextDoc, Wn as unsafeAsUploadSessionId, X as SENSITIVE_COLLECTION_MODES, Y as SENSITIVE_COLLECTION_CONFIRMATION_VERSION, Yn as unsafeAsSiteFontId, Zn as parseSiteId, bn as unsafeAsBookingRequirementId, cn as mapReadonlyNonEmptyArray, cr as err, er as unsafeAsUserId, et as locationValueSchema, f as resolveSiteVerticalBookingConfig, h as ORDINARY_EVENT_PRESET_VALUES, jn as unsafeAsBookingSessionId, lr as ok, m as EVENT_PRESET_VALUES, on as fromArray, ot as isPresent, q as parseWeeklyOpeningHours, s as NAVIGATION_LOCATIONS, sn as mapNonEmptyArray, vn as assertNever, z as parseFooterCompositionV1, zn as unsafeAsPositiveSeconds } from "./src-
|
|
2
|
+
import { $n as unsafeAsSiteId, B as footerNavigationLayouts, Bn as unsafeAsSafeDownloadFilename, Dn as unsafeAsEntitlementId, Et as localScheduleTimePattern, F as parseMailingListGlobalForm, Fn as unsafeAsFileChecksumSha256, Ft as BOOKING_COURSE_INSTALMENT_DEADLINES, Gn as unsafeAsProductId, Hn as unsafeAsStorageBucketName, In as unsafeAsMediaAssetId, It as validateBookingPaymentOptionKinds, K as parsePublicContactDetails, Ln as unsafeAsOriginalFilename, Mn as parseMediaAssetId, Mt as parseBookingTimeZone, Nn as unsafeAsDeclaredMimeType, Nt as parseUtcIsoDateTimeString, P as parseConfiguredMailingListProvider, Pn as unsafeAsDetectedMimeType, Q as stableJsonStringify, Rn as unsafeAsPositiveByteCount, Un as unsafeAsStoragePath, Vn as unsafeAsSiteScopedStoragePath, W as isCanonicalRichTextDoc, Wn as unsafeAsUploadSessionId, X as SENSITIVE_COLLECTION_MODES, Y as SENSITIVE_COLLECTION_CONFIRMATION_VERSION, Yn as unsafeAsSiteFontId, Zn as parseSiteId, bn as unsafeAsBookingRequirementId, cn as mapReadonlyNonEmptyArray, cr as err, er as unsafeAsUserId, et as locationValueSchema, f as resolveSiteVerticalBookingConfig, h as ORDINARY_EVENT_PRESET_VALUES, jn as unsafeAsBookingSessionId, lr as ok, m as EVENT_PRESET_VALUES, on as fromArray, ot as isPresent, q as parseWeeklyOpeningHours, r as isRecord$5, s as NAVIGATION_LOCATIONS, sn as mapNonEmptyArray, t as OFFLINE_PAYMENT_METHODS, vn as assertNever, z as parseFooterCompositionV1, zn as unsafeAsPositiveSeconds } from "./src-BntuEwG8.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
@@ -517,7 +517,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
517
517
|
}
|
|
518
518
|
return out;
|
|
519
519
|
}
|
|
520
|
-
function isRecord$
|
|
520
|
+
function isRecord$6(value) {
|
|
521
521
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
522
522
|
}
|
|
523
523
|
function isUnknownArray$2(value) {
|
|
@@ -528,7 +528,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
528
528
|
const set = /* @__PURE__ */ new Set([...a, ...b]);
|
|
529
529
|
return Array.from(set);
|
|
530
530
|
}
|
|
531
|
-
if (isRecord$
|
|
531
|
+
if (isRecord$6(a) && isRecord$6(b)) {
|
|
532
532
|
const out = { ...a };
|
|
533
533
|
for (const key of Object.keys(b)) out[key] = deepMerge(a[key], b[key]);
|
|
534
534
|
return out;
|
|
@@ -1222,9 +1222,606 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1222
1222
|
exports.updateStandardContactFormDefinition = updateStandardContactFormDefinition;
|
|
1223
1223
|
}));
|
|
1224
1224
|
|
|
1225
|
+
//#endregion
|
|
1226
|
+
//#region ../core/src/links.ts
|
|
1227
|
+
const nullableString = z.union([z.string().min(1), z.null()]);
|
|
1228
|
+
const RESOLVED_INTERNAL_LINK_ENTITY_TYPES = [
|
|
1229
|
+
"page",
|
|
1230
|
+
"content",
|
|
1231
|
+
"pageSurface"
|
|
1232
|
+
];
|
|
1233
|
+
function isResolvedInternalLinkEntityType(value) {
|
|
1234
|
+
return typeof value === "string" && RESOLVED_INTERNAL_LINK_ENTITY_TYPES.includes(value);
|
|
1235
|
+
}
|
|
1236
|
+
const resolvedInternalLinkKeys = [
|
|
1237
|
+
"entityId",
|
|
1238
|
+
"entityType",
|
|
1239
|
+
"href",
|
|
1240
|
+
"title",
|
|
1241
|
+
"typeLabel"
|
|
1242
|
+
];
|
|
1243
|
+
const internalRouteOnlyLinkSchema = z.object({
|
|
1244
|
+
kind: z.literal("internal"),
|
|
1245
|
+
routeId: z.string().min(1)
|
|
1246
|
+
}).passthrough().superRefine((value, ctx) => {
|
|
1247
|
+
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
1248
|
+
if (!hasResolvedMetadata) return;
|
|
1249
|
+
ctx.addIssue({
|
|
1250
|
+
code: "custom",
|
|
1251
|
+
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
const internalResolvedLinkSchema = z.object({
|
|
1255
|
+
kind: z.literal("internal"),
|
|
1256
|
+
routeId: z.string().min(1),
|
|
1257
|
+
entityId: z.string().min(1),
|
|
1258
|
+
entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES),
|
|
1259
|
+
href: z.string().min(1),
|
|
1260
|
+
title: z.string().min(1),
|
|
1261
|
+
typeLabel: z.string().min(1),
|
|
1262
|
+
contentTypeKey: nullableString.optional(),
|
|
1263
|
+
contentTypeName: nullableString.optional(),
|
|
1264
|
+
updatedAt: nullableString.optional()
|
|
1265
|
+
}).passthrough();
|
|
1266
|
+
const internalLinkSchema = z.union([internalResolvedLinkSchema, internalRouteOnlyLinkSchema]);
|
|
1267
|
+
const externalLinkSchema = z.object({
|
|
1268
|
+
kind: z.literal("external"),
|
|
1269
|
+
href: z.string().min(1)
|
|
1270
|
+
}).passthrough();
|
|
1271
|
+
const customLinkSchema = z.object({
|
|
1272
|
+
kind: z.literal("url"),
|
|
1273
|
+
href: z.string().min(1)
|
|
1274
|
+
}).passthrough();
|
|
1275
|
+
const pageLinkSchema = z.object({
|
|
1276
|
+
kind: z.literal("page"),
|
|
1277
|
+
identifier: z.string().min(1)
|
|
1278
|
+
}).passthrough();
|
|
1279
|
+
const entryLinkSchema = z.object({
|
|
1280
|
+
kind: z.literal("entry"),
|
|
1281
|
+
contentType: z.string().min(1),
|
|
1282
|
+
identifier: z.string().min(1)
|
|
1283
|
+
}).passthrough();
|
|
1284
|
+
/** Convert legacy URL strings without inventing page or entry references. */
|
|
1285
|
+
function normalizeLinkValue(value) {
|
|
1286
|
+
return typeof value === "string" && value.trim().length > 0 ? {
|
|
1287
|
+
kind: "url",
|
|
1288
|
+
href: value.trim()
|
|
1289
|
+
} : value;
|
|
1290
|
+
}
|
|
1291
|
+
const linkSchema = z.union([
|
|
1292
|
+
internalLinkSchema,
|
|
1293
|
+
externalLinkSchema,
|
|
1294
|
+
customLinkSchema,
|
|
1295
|
+
pageLinkSchema,
|
|
1296
|
+
entryLinkSchema
|
|
1297
|
+
]);
|
|
1298
|
+
function visitLinkValueReferences(value, visitor) {
|
|
1299
|
+
const parsed = linkSchema.safeParse(value);
|
|
1300
|
+
if (!parsed.success) {
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const link = parsed.data;
|
|
1304
|
+
switch (link.kind) {
|
|
1305
|
+
case "internal":
|
|
1306
|
+
visitor.routeIds.add(link.routeId);
|
|
1307
|
+
return;
|
|
1308
|
+
case "page":
|
|
1309
|
+
visitor.pageIdentifiers.add(link.identifier);
|
|
1310
|
+
return;
|
|
1311
|
+
case "entry":
|
|
1312
|
+
visitor.entryIdentifiers.add(link.contentType, link.identifier);
|
|
1313
|
+
return;
|
|
1314
|
+
case "external":
|
|
1315
|
+
case "url": return;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
function isInternalResolvedLinkValue(value) {
|
|
1319
|
+
return value?.kind === "internal" && hasResolvedLinkIdentity(value) && "href" in value && "title" in value && "typeLabel" in value && typeof value.href === "string" && typeof value.title === "string" && typeof value.typeLabel === "string";
|
|
1320
|
+
}
|
|
1321
|
+
/** The route-only form deliberately has no resolved entity identity. */
|
|
1322
|
+
function hasResolvedLinkIdentity(value) {
|
|
1323
|
+
return "entityId" in value && "entityType" in value && typeof value.entityId === "string" && isResolvedInternalLinkEntityType(value.entityType);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region ../core/src/rich-text-href.ts
|
|
1328
|
+
const SAFE_PROTOCOLS = new Set([
|
|
1329
|
+
"http:",
|
|
1330
|
+
"https:",
|
|
1331
|
+
"mailto:",
|
|
1332
|
+
"tel:"
|
|
1333
|
+
]);
|
|
1334
|
+
const CONTROL_CHARS_PATTERN = /[\u0000-\u001F\u007F]+/g;
|
|
1335
|
+
function normalizeInput(value) {
|
|
1336
|
+
return value.replace(CONTROL_CHARS_PATTERN, "").trim();
|
|
1337
|
+
}
|
|
1338
|
+
function decodeForSchemeCheck(value) {
|
|
1339
|
+
try {
|
|
1340
|
+
return decodeURIComponent(value);
|
|
1341
|
+
} catch {
|
|
1342
|
+
return value;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Returns a safe href for rich-text anchors, or null when the value should not be rendered.
|
|
1347
|
+
*
|
|
1348
|
+
* Policy:
|
|
1349
|
+
* - Allow absolute URLs with protocols: http, https, mailto, tel.
|
|
1350
|
+
* - Allow root-relative ("/path") and hash-only ("#section") links.
|
|
1351
|
+
* - Reject protocol-relative URLs ("//example.com"), bare domains ("example.com"),
|
|
1352
|
+
* backslashes, executable schemes (javascript/data/vbscript), malformed URLs, and empty values.
|
|
1353
|
+
* - Preserve percent-encoding from the original normalized input.
|
|
1354
|
+
*/
|
|
1355
|
+
function sanitizeHref(raw) {
|
|
1356
|
+
if (typeof raw !== "string") return null;
|
|
1357
|
+
const normalized = normalizeInput(raw);
|
|
1358
|
+
if (!normalized) return null;
|
|
1359
|
+
if (normalized.includes("\\") || normalized.startsWith("//")) return null;
|
|
1360
|
+
if (normalized.startsWith("/")) return normalized;
|
|
1361
|
+
if (normalized.startsWith("#")) return normalized;
|
|
1362
|
+
return sanitizeAbsoluteHref(normalized);
|
|
1363
|
+
}
|
|
1364
|
+
function sanitizeAbsoluteHref(normalized) {
|
|
1365
|
+
const decoded = normalizeInput(decodeForSchemeCheck(normalized));
|
|
1366
|
+
const schemeMatch = decoded.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);
|
|
1367
|
+
if (schemeMatch === null) return null;
|
|
1368
|
+
const rawScheme = schemeMatch[1];
|
|
1369
|
+
if (rawScheme === undefined || rawScheme.length === 0) return null;
|
|
1370
|
+
const protocol = `${rawScheme.toLowerCase()}:`;
|
|
1371
|
+
if (!SAFE_PROTOCOLS.has(protocol)) return null;
|
|
1372
|
+
try {
|
|
1373
|
+
const parsed = new URL(normalized);
|
|
1374
|
+
if (!SAFE_PROTOCOLS.has(parsed.protocol.toLowerCase())) {
|
|
1375
|
+
return null;
|
|
1376
|
+
}
|
|
1377
|
+
} catch {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
return normalized;
|
|
1381
|
+
}
|
|
1382
|
+
/** Strict authoring admission; existing stored links keep the renderer's normalization. */
|
|
1383
|
+
function isSafeRichTextHref(raw) {
|
|
1384
|
+
const decoded = decodeForSchemeCheck(raw);
|
|
1385
|
+
return !/[\u0000-\u001F\u007F\\]/.test(decoded) && !decoded.startsWith("//") && sanitizeHref(raw) === raw;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region ../core/src/rich-text-authoring.ts
|
|
1390
|
+
const optionalText = z.string().max(2048).nullable().optional();
|
|
1391
|
+
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");
|
|
1392
|
+
const linkAttributes = z.object({
|
|
1393
|
+
href: destination.nullable().optional(),
|
|
1394
|
+
target: z.enum([
|
|
1395
|
+
"_blank",
|
|
1396
|
+
"_self",
|
|
1397
|
+
"_parent",
|
|
1398
|
+
"_top"
|
|
1399
|
+
]).nullable().optional(),
|
|
1400
|
+
rel: optionalText,
|
|
1401
|
+
class: optionalText,
|
|
1402
|
+
kind: z.enum([
|
|
1403
|
+
"internal",
|
|
1404
|
+
"page",
|
|
1405
|
+
"entry",
|
|
1406
|
+
"external",
|
|
1407
|
+
"url"
|
|
1408
|
+
]).nullable().optional(),
|
|
1409
|
+
identifier: optionalText,
|
|
1410
|
+
contentType: optionalText,
|
|
1411
|
+
routeId: optionalText,
|
|
1412
|
+
entityId: optionalText,
|
|
1413
|
+
entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES).nullable().optional(),
|
|
1414
|
+
title: optionalText,
|
|
1415
|
+
typeLabel: optionalText,
|
|
1416
|
+
contentTypeKey: optionalText,
|
|
1417
|
+
contentTypeName: optionalText,
|
|
1418
|
+
updatedAt: optionalText
|
|
1419
|
+
}).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), {
|
|
1420
|
+
message: "Links require a safe href, or an internal kind with a routeId or identifier",
|
|
1421
|
+
path: ["href"]
|
|
1422
|
+
});
|
|
1423
|
+
const noAttributes = z.object({}).strict().optional();
|
|
1424
|
+
const markSchema = z.discriminatedUnion("type", [
|
|
1425
|
+
z.object({
|
|
1426
|
+
type: z.literal("bold"),
|
|
1427
|
+
attrs: noAttributes
|
|
1428
|
+
}).strict(),
|
|
1429
|
+
z.object({
|
|
1430
|
+
type: z.literal("italic"),
|
|
1431
|
+
attrs: noAttributes
|
|
1432
|
+
}).strict(),
|
|
1433
|
+
z.object({
|
|
1434
|
+
type: z.literal("strike"),
|
|
1435
|
+
attrs: noAttributes
|
|
1436
|
+
}).strict(),
|
|
1437
|
+
z.object({
|
|
1438
|
+
type: z.literal("code"),
|
|
1439
|
+
attrs: noAttributes
|
|
1440
|
+
}).strict(),
|
|
1441
|
+
z.object({
|
|
1442
|
+
type: z.literal("link"),
|
|
1443
|
+
attrs: linkAttributes
|
|
1444
|
+
}).strict()
|
|
1445
|
+
]);
|
|
1446
|
+
const marksSchema = z.array(markSchema).max(5).superRefine((marks, ctx) => {
|
|
1447
|
+
if (new Set(marks.map((mark) => mark.type)).size !== marks.length) {
|
|
1448
|
+
ctx.addIssue({
|
|
1449
|
+
code: "custom",
|
|
1450
|
+
message: "Use each mark type at most once"
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
if (marks.some((mark) => mark.type === "code") && marks.length !== 1) {
|
|
1454
|
+
ctx.addIssue({
|
|
1455
|
+
code: "custom",
|
|
1456
|
+
message: "Code cannot be combined with other marks"
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
const textSchema = z.object({
|
|
1461
|
+
type: z.literal("text"),
|
|
1462
|
+
text: z.string().min(1).max(5e4),
|
|
1463
|
+
marks: marksSchema.optional()
|
|
1464
|
+
}).strict();
|
|
1465
|
+
const hardBreakSchema = z.object({
|
|
1466
|
+
type: z.literal("hardBreak"),
|
|
1467
|
+
attrs: noAttributes
|
|
1468
|
+
}).strict();
|
|
1469
|
+
const inlineSchema = z.discriminatedUnion("type", [textSchema, hardBreakSchema]);
|
|
1470
|
+
const paragraphSchema = z.object({
|
|
1471
|
+
type: z.literal("paragraph"),
|
|
1472
|
+
attrs: noAttributes,
|
|
1473
|
+
content: z.array(inlineSchema).max(1e3).optional()
|
|
1474
|
+
}).strict();
|
|
1475
|
+
const headingSchema = z.object({
|
|
1476
|
+
type: z.literal("heading"),
|
|
1477
|
+
attrs: z.object({ level: z.union([
|
|
1478
|
+
z.literal(1),
|
|
1479
|
+
z.literal(2),
|
|
1480
|
+
z.literal(3),
|
|
1481
|
+
z.literal(4),
|
|
1482
|
+
z.literal(5)
|
|
1483
|
+
]) }).strict(),
|
|
1484
|
+
content: z.array(inlineSchema).max(1e3).optional()
|
|
1485
|
+
}).strict();
|
|
1486
|
+
const codeBlockSchema = z.object({
|
|
1487
|
+
type: z.literal("codeBlock"),
|
|
1488
|
+
attrs: z.object({ language: optionalText }).strict().optional(),
|
|
1489
|
+
content: z.array(z.object({
|
|
1490
|
+
type: z.literal("text"),
|
|
1491
|
+
text: z.string().min(1).max(5e4)
|
|
1492
|
+
}).strict()).max(1e3).optional()
|
|
1493
|
+
}).strict();
|
|
1494
|
+
const imageSchema = z.object({
|
|
1495
|
+
type: z.literal("image"),
|
|
1496
|
+
attrs: z.object({
|
|
1497
|
+
src: destination.nullable().optional(),
|
|
1498
|
+
identifier: optionalText,
|
|
1499
|
+
alt: optionalText,
|
|
1500
|
+
title: optionalText,
|
|
1501
|
+
width: z.number().positive().nullable().optional(),
|
|
1502
|
+
height: z.number().positive().nullable().optional()
|
|
1503
|
+
}).strict()
|
|
1504
|
+
}).strict();
|
|
1505
|
+
const horizontalRuleSchema = z.object({
|
|
1506
|
+
type: z.literal("horizontalRule"),
|
|
1507
|
+
attrs: noAttributes
|
|
1508
|
+
}).strict();
|
|
1509
|
+
const blockSchema$1 = z.lazy(() => z.discriminatedUnion("type", [
|
|
1510
|
+
paragraphSchema,
|
|
1511
|
+
headingSchema,
|
|
1512
|
+
codeBlockSchema,
|
|
1513
|
+
imageSchema,
|
|
1514
|
+
horizontalRuleSchema,
|
|
1515
|
+
z.object({
|
|
1516
|
+
type: z.literal("blockquote"),
|
|
1517
|
+
attrs: noAttributes,
|
|
1518
|
+
content: z.array(blockSchema$1).min(1).max(1e3)
|
|
1519
|
+
}).strict(),
|
|
1520
|
+
z.object({
|
|
1521
|
+
type: z.literal("bulletList"),
|
|
1522
|
+
attrs: noAttributes,
|
|
1523
|
+
content: z.array(listItemSchema).min(1).max(1e3)
|
|
1524
|
+
}).strict(),
|
|
1525
|
+
z.object({
|
|
1526
|
+
type: z.literal("orderedList"),
|
|
1527
|
+
attrs: z.object({
|
|
1528
|
+
start: z.number().int().positive().optional(),
|
|
1529
|
+
type: z.enum([
|
|
1530
|
+
"1",
|
|
1531
|
+
"a",
|
|
1532
|
+
"A",
|
|
1533
|
+
"i",
|
|
1534
|
+
"I"
|
|
1535
|
+
]).nullable().optional()
|
|
1536
|
+
}).strict().optional(),
|
|
1537
|
+
content: z.array(listItemSchema).min(1).max(1e3)
|
|
1538
|
+
}).strict()
|
|
1539
|
+
]));
|
|
1540
|
+
const listItemSchema = z.lazy(() => z.object({
|
|
1541
|
+
type: z.literal("listItem"),
|
|
1542
|
+
attrs: noAttributes,
|
|
1543
|
+
content: z.tuple([paragraphSchema]).rest(blockSchema$1)
|
|
1544
|
+
}).strict());
|
|
1545
|
+
function treeSize(value, depth = 0) {
|
|
1546
|
+
if (depth > 12) return {
|
|
1547
|
+
depth,
|
|
1548
|
+
nodes: 0,
|
|
1549
|
+
text: 0
|
|
1550
|
+
};
|
|
1551
|
+
if (!isRecord$5(value)) return {
|
|
1552
|
+
depth,
|
|
1553
|
+
nodes: 0,
|
|
1554
|
+
text: 0
|
|
1555
|
+
};
|
|
1556
|
+
const nodes = Array.isArray(value.content) ? value.content : [];
|
|
1557
|
+
if (nodes.length > 2e3) return {
|
|
1558
|
+
depth,
|
|
1559
|
+
nodes: 2001,
|
|
1560
|
+
text: 0
|
|
1561
|
+
};
|
|
1562
|
+
return nodes.reduce((total, node) => {
|
|
1563
|
+
if (exceedsBounds(total)) return total;
|
|
1564
|
+
const child = treeSize(node, depth + 1);
|
|
1565
|
+
return {
|
|
1566
|
+
depth: Math.max(total.depth, child.depth),
|
|
1567
|
+
nodes: total.nodes + child.nodes,
|
|
1568
|
+
text: total.text + child.text
|
|
1569
|
+
};
|
|
1570
|
+
}, {
|
|
1571
|
+
depth,
|
|
1572
|
+
nodes: depth === 0 ? 0 : 1,
|
|
1573
|
+
text: typeof value.text === "string" ? value.text.length : 0
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
function exceedsBounds(size) {
|
|
1577
|
+
return size.depth > 12 || size.nodes > 2e3 || size.text > 1e5;
|
|
1578
|
+
}
|
|
1579
|
+
/** Closed authoring contract for generated content. Stored legacy documents keep their existing reader. */
|
|
1580
|
+
const RichTextAuthoringDocSchema = z.preprocess((value, ctx) => {
|
|
1581
|
+
if (exceedsBounds(treeSize(value))) {
|
|
1582
|
+
ctx.addIssue({
|
|
1583
|
+
code: "custom",
|
|
1584
|
+
message: "Rich text must have at most 12 levels, 2000 nodes and 100000 text characters"
|
|
1585
|
+
});
|
|
1586
|
+
return z.NEVER;
|
|
1587
|
+
}
|
|
1588
|
+
return value;
|
|
1589
|
+
}, z.object({
|
|
1590
|
+
type: z.literal("doc"),
|
|
1591
|
+
content: z.array(blockSchema$1).max(1e3)
|
|
1592
|
+
}).strict());
|
|
1593
|
+
const inlineNodes = [
|
|
1594
|
+
"paragraph",
|
|
1595
|
+
"text",
|
|
1596
|
+
"hardBreak"
|
|
1597
|
+
];
|
|
1598
|
+
const inlineMarks = [
|
|
1599
|
+
"bold",
|
|
1600
|
+
"italic",
|
|
1601
|
+
"strike",
|
|
1602
|
+
"code",
|
|
1603
|
+
"link"
|
|
1604
|
+
];
|
|
1605
|
+
const fullCapabilities = {
|
|
1606
|
+
nodes: [
|
|
1607
|
+
...inlineNodes,
|
|
1608
|
+
"heading",
|
|
1609
|
+
"blockquote",
|
|
1610
|
+
"bulletList",
|
|
1611
|
+
"orderedList",
|
|
1612
|
+
"listItem",
|
|
1613
|
+
"codeBlock",
|
|
1614
|
+
"horizontalRule",
|
|
1615
|
+
"image"
|
|
1616
|
+
],
|
|
1617
|
+
marks: inlineMarks,
|
|
1618
|
+
headingLevels: [
|
|
1619
|
+
1,
|
|
1620
|
+
2,
|
|
1621
|
+
3,
|
|
1622
|
+
4,
|
|
1623
|
+
5
|
|
1624
|
+
]
|
|
1625
|
+
};
|
|
1626
|
+
const inlineCapabilities = {
|
|
1627
|
+
nodes: inlineNodes,
|
|
1628
|
+
marks: inlineMarks,
|
|
1629
|
+
headingLevels: []
|
|
1630
|
+
};
|
|
1631
|
+
const variantCapabilities = {
|
|
1632
|
+
full: fullCapabilities,
|
|
1633
|
+
media: fullCapabilities,
|
|
1634
|
+
inline: inlineCapabilities,
|
|
1635
|
+
limited: inlineCapabilities,
|
|
1636
|
+
notes: {
|
|
1637
|
+
...inlineCapabilities,
|
|
1638
|
+
nodes: [
|
|
1639
|
+
...inlineNodes,
|
|
1640
|
+
"bulletList",
|
|
1641
|
+
"orderedList",
|
|
1642
|
+
"listItem"
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
consent: {
|
|
1646
|
+
...inlineCapabilities,
|
|
1647
|
+
marks: [
|
|
1648
|
+
"bold",
|
|
1649
|
+
"italic",
|
|
1650
|
+
"link"
|
|
1651
|
+
]
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
/** One capability description for editor configuration, admission and model guidance. */
|
|
1655
|
+
function richTextVariantCapabilities(variant) {
|
|
1656
|
+
const capabilities = variantCapabilities[variant];
|
|
1657
|
+
return {
|
|
1658
|
+
nodes: [...capabilities.nodes],
|
|
1659
|
+
marks: [...capabilities.marks],
|
|
1660
|
+
headingLevels: [...capabilities.headingLevels]
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
function richTextDocumentSupportsVariant(doc, variant) {
|
|
1664
|
+
const capabilities = richTextVariantCapabilities(variant);
|
|
1665
|
+
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 ?? []));
|
|
1666
|
+
return supports(doc.content);
|
|
1667
|
+
}
|
|
1668
|
+
/** Measured product allowance for whole-document edits; output-token limits remain separately enforced. */
|
|
1669
|
+
function richTextEditingBudget(doc) {
|
|
1670
|
+
const serializedBytes = new TextEncoder().encode(JSON.stringify(doc)).length;
|
|
1671
|
+
const nodes = treeSize(doc).nodes;
|
|
1672
|
+
return {
|
|
1673
|
+
kind: serializedBytes <= 8e3 && nodes <= 120 ? "supported" : "too-large",
|
|
1674
|
+
serializedBytes,
|
|
1675
|
+
nodes
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
//#endregion
|
|
1680
|
+
//#region ../core/src/rich-text-schema.ts
|
|
1681
|
+
/**
|
|
1682
|
+
* Shared Rich Text Schema
|
|
1683
|
+
*
|
|
1684
|
+
* This module provides a single source of truth for TipTap rich text validation
|
|
1685
|
+
* across both the block-form editor and the block rendering system.
|
|
1686
|
+
*
|
|
1687
|
+
* Rich-text fields use one canonical root shape:
|
|
1688
|
+
* `{ type: 'doc', content: [...] }`.
|
|
1689
|
+
*/
|
|
1690
|
+
/**
|
|
1691
|
+
* TipTap document node schema (recursive structure)
|
|
1692
|
+
*
|
|
1693
|
+
* Supports the full TipTap document structure including:
|
|
1694
|
+
* - type: Node type (e.g., 'doc', 'paragraph', 'text')
|
|
1695
|
+
* - content: Nested array of child nodes
|
|
1696
|
+
* - text: Text content for text nodes
|
|
1697
|
+
* - attrs: Node attributes (e.g., alignment, color)
|
|
1698
|
+
* - marks: Text formatting marks (e.g., bold, italic)
|
|
1699
|
+
*/
|
|
1700
|
+
const TipTapMarkSchema = z.object({
|
|
1701
|
+
type: z.string().min(1),
|
|
1702
|
+
attrs: z.record(z.string(), z.unknown()).optional()
|
|
1703
|
+
}).strict();
|
|
1704
|
+
const TipTapNodeSchema = z.lazy(() => z.object({
|
|
1705
|
+
type: z.string().min(1),
|
|
1706
|
+
content: z.array(TipTapNodeSchema).optional(),
|
|
1707
|
+
text: z.string().optional(),
|
|
1708
|
+
attrs: z.record(z.string(), z.unknown()).optional(),
|
|
1709
|
+
marks: z.array(TipTapMarkSchema).optional()
|
|
1710
|
+
}).strict().superRefine((node, ctx) => {
|
|
1711
|
+
if (node.type === "doc") {
|
|
1712
|
+
ctx.addIssue({
|
|
1713
|
+
code: "custom",
|
|
1714
|
+
path: ["type"],
|
|
1715
|
+
message: "Document nodes are only valid at the rich-text root"
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
if (node.type === "text") {
|
|
1719
|
+
if (node.text === undefined || node.text.length === 0) {
|
|
1720
|
+
ctx.addIssue({
|
|
1721
|
+
code: "custom",
|
|
1722
|
+
path: ["text"],
|
|
1723
|
+
message: "Text nodes require a non-empty text value"
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
if (node.content !== undefined) {
|
|
1727
|
+
ctx.addIssue({
|
|
1728
|
+
code: "custom",
|
|
1729
|
+
path: ["content"],
|
|
1730
|
+
message: "Text nodes cannot contain child nodes"
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
if (node.text !== undefined) {
|
|
1736
|
+
ctx.addIssue({
|
|
1737
|
+
code: "custom",
|
|
1738
|
+
path: ["text"],
|
|
1739
|
+
message: "Only text nodes can contain a text value"
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
}));
|
|
1743
|
+
/**
|
|
1744
|
+
* Canonical schema for a TipTap rich-text document root.
|
|
1745
|
+
*
|
|
1746
|
+
* Stricter than {@link TipTapNodeSchema}: `type` is literally `'doc'` and
|
|
1747
|
+
* `content` is required (possibly empty). This is the shape every producer
|
|
1748
|
+
* (dummy content, editor output, migrations) must emit, and the shape every
|
|
1749
|
+
* non-legacy consumer can rely on.
|
|
1750
|
+
*
|
|
1751
|
+
*/
|
|
1752
|
+
const RichTextDocSchema = z.object({
|
|
1753
|
+
type: z.literal("doc"),
|
|
1754
|
+
content: z.array(TipTapNodeSchema)
|
|
1755
|
+
}).strict();
|
|
1756
|
+
/**
|
|
1757
|
+
* Type guard for {@link RichTextDoc}.
|
|
1758
|
+
*
|
|
1759
|
+
* Returns `true` only for the canonical unwrapped form. The shared structural
|
|
1760
|
+
* contract lives in `@riverbankcms/core`; parity tests keep its dependency-free
|
|
1761
|
+
* guard aligned with this detailed Zod validator.
|
|
1762
|
+
*/
|
|
1763
|
+
function isRichTextDoc(value) {
|
|
1764
|
+
return RichTextDocSchema.safeParse(value).success;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Build a canonical {@link RichTextDoc} from plain-text paragraphs.
|
|
1768
|
+
*
|
|
1769
|
+
* Single source of truth for constructing a TipTap doc from strings.
|
|
1770
|
+
* Used by:
|
|
1771
|
+
* - `@riverbankcms/dummy-content` (fixture body generators)
|
|
1772
|
+
* - `@riverbankcms/content-model` (default template `cta-full` content)
|
|
1773
|
+
*
|
|
1774
|
+
* Empty strings produce a paragraph with no `content` array — matching
|
|
1775
|
+
* the TipTap convention for empty paragraphs. The shape is exactly what
|
|
1776
|
+
* {@link RichTextDocSchema} validates, so the type and runtime check
|
|
1777
|
+
* never drift from the constructor.
|
|
1778
|
+
*/
|
|
1779
|
+
function createRichTextDoc(paragraphs) {
|
|
1780
|
+
return {
|
|
1781
|
+
type: "doc",
|
|
1782
|
+
content: paragraphs.map((text) => text ? {
|
|
1783
|
+
type: "paragraph",
|
|
1784
|
+
content: [{
|
|
1785
|
+
type: "text",
|
|
1786
|
+
text
|
|
1787
|
+
}]
|
|
1788
|
+
} : { type: "paragraph" })
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Build Zod validation schema for rich text fields
|
|
1793
|
+
*
|
|
1794
|
+
* @param options - Optional configuration
|
|
1795
|
+
* @param options.required - If true, validates that content is not empty
|
|
1796
|
+
* @param options.label - Field label for error messages (defaults to 'This field')
|
|
1797
|
+
* @returns Zod schema for rich text validation
|
|
1798
|
+
*
|
|
1799
|
+
* @example
|
|
1800
|
+
* // Basic usage
|
|
1801
|
+
* const schema = buildRichTextSchema()
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* // Required field with custom label
|
|
1805
|
+
* const schema = buildRichTextSchema({ required: true, label: 'Description' })
|
|
1806
|
+
*/
|
|
1807
|
+
function buildRichTextSchema(options) {
|
|
1808
|
+
if (options?.required === true) {
|
|
1809
|
+
const label = options.label ?? "This field";
|
|
1810
|
+
return RichTextDocSchema.refine((val) => {
|
|
1811
|
+
const content = val.content;
|
|
1812
|
+
if (!Array.isArray(content) || content.length === 0) return false;
|
|
1813
|
+
const first = content[0];
|
|
1814
|
+
if (content.length === 1 && isRecord$5(first) && first.type === "paragraph" && (!("content" in first) || first.content == null)) {
|
|
1815
|
+
return false;
|
|
1816
|
+
}
|
|
1817
|
+
return true;
|
|
1818
|
+
}, { message: `${label} is required` });
|
|
1819
|
+
}
|
|
1820
|
+
return RichTextDocSchema;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1225
1823
|
//#endregion
|
|
1226
1824
|
//#region ../site-commands/src/bookingQuestionConsent.ts
|
|
1227
|
-
const RichTextDocSchema = z.custom(isCanonicalRichTextDoc);
|
|
1228
1825
|
/**
|
|
1229
1826
|
* Questions & consent settings as a request carries them: the Booking tab's
|
|
1230
1827
|
* save, and a create that asks for consent before the event exists (#1475).
|
|
@@ -1497,6 +2094,65 @@ const bookingQuestionsProductMeaning = {
|
|
|
1497
2094
|
description: "Choose the questions people answer when booking or afterwards. Open the event or service’s Booking › Questions page and I can help more there.",
|
|
1498
2095
|
inputSchema: changeBookingQuestionsInputSchema
|
|
1499
2096
|
};
|
|
2097
|
+
/** Model-facing authoring removes the content/schema envelopes; command and loadable result stay canonical. */
|
|
2098
|
+
const assistantQuestionSelectionSchema = z.discriminatedUnion("kind", [
|
|
2099
|
+
z.object({
|
|
2100
|
+
kind: z.literal("define_short_form"),
|
|
2101
|
+
name: z.string().min(1),
|
|
2102
|
+
fields: import_dist$1.bookingQuestionsFlatSchemaSchema.shape.fields
|
|
2103
|
+
}).strict(),
|
|
2104
|
+
z.object({
|
|
2105
|
+
kind: z.literal("define_questionnaire"),
|
|
2106
|
+
name: z.string().min(1),
|
|
2107
|
+
sections: import_dist$1.bookingQuestionsDetailedSchemaSchema.shape.sections
|
|
2108
|
+
}).strict(),
|
|
2109
|
+
bookingQuestionSetSelectionSchema.options[1],
|
|
2110
|
+
bookingQuestionSetSelectionSchema.options[2],
|
|
2111
|
+
bookingQuestionSetSelectionSchema.options[3],
|
|
2112
|
+
bookingQuestionSetSelectionSchema.options[4]
|
|
2113
|
+
]);
|
|
2114
|
+
const assistantBookingQuestionsProposalInputSchema = proposeBookingQuestionsInputSchema.extend({ selection: assistantQuestionSelectionSchema });
|
|
2115
|
+
/** The shared contract owns the one translation into the existing planner/save command. */
|
|
2116
|
+
function bookingQuestionsCommandFromAssistant(input) {
|
|
2117
|
+
const selection = input.selection;
|
|
2118
|
+
switch (selection.kind) {
|
|
2119
|
+
case "define_short_form": return {
|
|
2120
|
+
...input,
|
|
2121
|
+
selection: {
|
|
2122
|
+
kind: "define",
|
|
2123
|
+
name: selection.name,
|
|
2124
|
+
content: {
|
|
2125
|
+
shape: "short-form",
|
|
2126
|
+
schema: {
|
|
2127
|
+
version: "1.0",
|
|
2128
|
+
fields: selection.fields
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
case "define_questionnaire": return {
|
|
2134
|
+
...input,
|
|
2135
|
+
selection: {
|
|
2136
|
+
kind: "define",
|
|
2137
|
+
name: selection.name,
|
|
2138
|
+
content: {
|
|
2139
|
+
shape: "detailed-questionnaire",
|
|
2140
|
+
schema: {
|
|
2141
|
+
schemaVersion: 2,
|
|
2142
|
+
sections: selection.sections
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
case "keep":
|
|
2148
|
+
case "attach":
|
|
2149
|
+
case "copy":
|
|
2150
|
+
case "detach": return {
|
|
2151
|
+
...input,
|
|
2152
|
+
selection
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
1500
2156
|
|
|
1501
2157
|
//#endregion
|
|
1502
2158
|
//#region ../site-commands/src/bookingCommandValues.ts
|
|
@@ -1734,7 +2390,8 @@ const bookingPageLookIdValues = [
|
|
|
1734
2390
|
"site-style:lantern",
|
|
1735
2391
|
"site-style:poster",
|
|
1736
2392
|
"site-style:loom",
|
|
1737
|
-
"site-style:brook"
|
|
2393
|
+
"site-style:brook",
|
|
2394
|
+
"site-style:poise"
|
|
1738
2395
|
];
|
|
1739
2396
|
/** Boundary admission for draft and suggestion inputs. */
|
|
1740
2397
|
function parseBookingPageLookId(value) {
|
|
@@ -11510,6 +12167,62 @@ function checkDraftListingMatchesStatus(command, ctx) {
|
|
|
11510
12167
|
});
|
|
11511
12168
|
}
|
|
11512
12169
|
|
|
12170
|
+
//#endregion
|
|
12171
|
+
//#region ../site-commands/src/packageCommandFields.ts
|
|
12172
|
+
const packageTrainerRefSchema = z.union([resourceRefSchema("appointment-resource"), resourceRefSchema("staff")]);
|
|
12173
|
+
const recipeSalePaymentSchema = z.discriminatedUnion("kind", [z.object({
|
|
12174
|
+
kind: z.literal("paid"),
|
|
12175
|
+
method: z.enum(OFFLINE_PAYMENT_METHODS),
|
|
12176
|
+
paidOn: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
|
|
12177
|
+
}).strict(), z.object({ kind: z.literal("owed") }).strict()]);
|
|
12178
|
+
/** A package a recipe sells rather than grants. Only a sale can hold the package with a coach. */
|
|
12179
|
+
const recipePackageSaleSchema = z.object({
|
|
12180
|
+
priceCents: nonNegativeIntegerSchema,
|
|
12181
|
+
payment: recipeSalePaymentSchema,
|
|
12182
|
+
heldWithStaffMemberRef: packageTrainerRefSchema.optional()
|
|
12183
|
+
}).strict();
|
|
12184
|
+
/** A sale starts from the product's credits and expiry; usage is recorded by bookings paid from it. */
|
|
12185
|
+
function validateRecipePackageSale(input, ctx) {
|
|
12186
|
+
if (input.sale === undefined) return;
|
|
12187
|
+
if (input.creditsRemaining !== undefined) ctx.addIssue({
|
|
12188
|
+
code: "custom",
|
|
12189
|
+
path: ["creditsRemaining"],
|
|
12190
|
+
message: "A package sale starts with the product credits. Book sessions paid from it to use them, or leave out sale for a custom balance."
|
|
12191
|
+
});
|
|
12192
|
+
if (input.expiresAt !== undefined) ctx.addIssue({
|
|
12193
|
+
code: "custom",
|
|
12194
|
+
path: ["expiresAt"],
|
|
12195
|
+
message: "A package sale takes the product expiry. Leave out sale for a custom expiry."
|
|
12196
|
+
});
|
|
12197
|
+
if (input.status !== "active") ctx.addIssue({
|
|
12198
|
+
code: "custom",
|
|
12199
|
+
path: ["status"],
|
|
12200
|
+
message: "A package sale starts active."
|
|
12201
|
+
});
|
|
12202
|
+
}
|
|
12203
|
+
function validatePackageTeam(input, ctx) {
|
|
12204
|
+
if (input.ownerStaffMemberRef !== undefined && input.bookingTeamMemberScope !== "sold_with") ctx.addIssue({
|
|
12205
|
+
code: "custom",
|
|
12206
|
+
path: ["bookingTeamMemberScope"],
|
|
12207
|
+
message: "Trainer-owned packages must use sold_with."
|
|
12208
|
+
});
|
|
12209
|
+
if (input.productUseCase === "event_pass" && (input.ownerStaffMemberRef !== undefined || input.bookingTeamMemberScope !== undefined)) ctx.addIssue({
|
|
12210
|
+
code: "custom",
|
|
12211
|
+
path: ["bookingTeamMemberScope"],
|
|
12212
|
+
message: "Team member scope applies only to appointment packages."
|
|
12213
|
+
});
|
|
12214
|
+
}
|
|
12215
|
+
function validateRecipePackageProduct(input, ctx) {
|
|
12216
|
+
validatePackageTeam(input, ctx);
|
|
12217
|
+
const scopeIsValid = input.productUseCase === "event_pass" ? input.appointmentScope === undefined : input.appointmentScope !== undefined;
|
|
12218
|
+
if (scopeIsValid) return;
|
|
12219
|
+
ctx.addIssue({
|
|
12220
|
+
code: "custom",
|
|
12221
|
+
path: ["appointmentScope"],
|
|
12222
|
+
message: input.productUseCase === "event_pass" ? "appointmentScope is only valid for appointment_package passes" : "appointmentScope is required for appointment_package passes"
|
|
12223
|
+
});
|
|
12224
|
+
}
|
|
12225
|
+
|
|
11513
12226
|
//#endregion
|
|
11514
12227
|
//#region ../site-commands/src/bookingCommandSchemas.ts
|
|
11515
12228
|
const appointmentAvailabilityRefSchema = resourceRefSchema("availability");
|
|
@@ -11614,16 +12327,10 @@ const upsertBookingPassProductCommandSchema = z.object({
|
|
|
11614
12327
|
"not_on_sale"
|
|
11615
12328
|
]).default("online"),
|
|
11616
12329
|
productUseCase: z.enum(bookingPassProductUseCases).default("event_pass"),
|
|
11617
|
-
appointmentScope: appointmentPackageScopeSchema.optional()
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
ctx.addIssue({
|
|
11622
|
-
code: "custom",
|
|
11623
|
-
path: ["appointmentScope"],
|
|
11624
|
-
message: input.productUseCase === "event_pass" ? "appointmentScope is only valid for appointment_package passes" : "appointmentScope is required for appointment_package passes"
|
|
11625
|
-
});
|
|
11626
|
-
})
|
|
12330
|
+
appointmentScope: appointmentPackageScopeSchema.optional(),
|
|
12331
|
+
bookingTeamMemberScope: z.enum(["any", "sold_with"]).optional(),
|
|
12332
|
+
ownerStaffMemberRef: packageTrainerRefSchema.optional()
|
|
12333
|
+
}).strict().superRefine(validateRecipePackageProduct)
|
|
11627
12334
|
}).strict();
|
|
11628
12335
|
const upsertBookingMembershipProductCommandSchema = z.object({
|
|
11629
12336
|
type: z.literal("upsertBookingMembershipProduct"),
|
|
@@ -11657,11 +12364,12 @@ const grantCustomerPassCommandSchema = z.object({
|
|
|
11657
12364
|
input: z.object({
|
|
11658
12365
|
customerRef: bookingCustomerRefSchema,
|
|
11659
12366
|
passRef: passProductRefSchema,
|
|
12367
|
+
sale: recipePackageSaleSchema.optional(),
|
|
11660
12368
|
creditsRemaining: nonNegativeIntegerSchema.optional(),
|
|
11661
12369
|
expiresAt: isoDateTimeSchema.nullable().optional(),
|
|
11662
12370
|
status: z.enum(customerPassStatuses).default("active"),
|
|
11663
12371
|
note: z.string().trim().min(1).optional()
|
|
11664
|
-
}).strict()
|
|
12372
|
+
}).strict().superRefine(validateRecipePackageSale)
|
|
11665
12373
|
}).strict();
|
|
11666
12374
|
const grantCustomerMembershipCommandSchema = z.object({
|
|
11667
12375
|
type: z.literal("grantCustomerMembership"),
|
|
@@ -11696,6 +12404,18 @@ const seedAppointmentBookingCommandSchema = z.object({
|
|
|
11696
12404
|
endAt: isoDateTimeSchema,
|
|
11697
12405
|
timezone: ianaTimezoneSchema,
|
|
11698
12406
|
status: z.enum(appointmentBookingStatuses).default("confirmed"),
|
|
12407
|
+
payment: z.discriminatedUnion("kind", [
|
|
12408
|
+
z.object({
|
|
12409
|
+
kind: z.literal("package"),
|
|
12410
|
+
customerPassRef: customerPassRefSchema
|
|
12411
|
+
}).strict(),
|
|
12412
|
+
z.object({
|
|
12413
|
+
kind: z.literal("paid"),
|
|
12414
|
+
amountCents: positiveIntegerSchema,
|
|
12415
|
+
method: z.enum(OFFLINE_PAYMENT_METHODS)
|
|
12416
|
+
}).strict(),
|
|
12417
|
+
z.object({ kind: z.literal("owed") }).strict()
|
|
12418
|
+
]).optional(),
|
|
11699
12419
|
formSubmission: unknownRecordSchema.default({}),
|
|
11700
12420
|
note: z.string().trim().min(1).optional()
|
|
11701
12421
|
}).strict().superRefine((input, ctx) => {
|
|
@@ -11801,10 +12521,18 @@ const freeServiceInputSchema = z.object({
|
|
|
11801
12521
|
priceAmount: z.null().optional(),
|
|
11802
12522
|
payment: z.object({ mode: z.literal("free") }).strict()
|
|
11803
12523
|
}).strict();
|
|
12524
|
+
const packagesOnlyServiceInputSchema = z.object({
|
|
12525
|
+
...appointmentServiceCommonInputFields,
|
|
12526
|
+
priceAmount: z.number().int().nonnegative().nullable().optional(),
|
|
12527
|
+
payment: z.object({ mode: z.literal("packages_only") }).strict()
|
|
12528
|
+
}).strict();
|
|
11804
12529
|
const paidOnlineServiceInputSchema = z.object({
|
|
11805
12530
|
...appointmentServiceCommonInputFields,
|
|
11806
12531
|
priceAmount: z.number().int().positive(),
|
|
11807
|
-
payment: z.object({
|
|
12532
|
+
payment: z.object({
|
|
12533
|
+
mode: z.literal("paid_online_intent"),
|
|
12534
|
+
allowPackages: z.literal(true).optional()
|
|
12535
|
+
}).strict()
|
|
11808
12536
|
}).strict();
|
|
11809
12537
|
/**
|
|
11810
12538
|
* A service input with one of the three category placements: none, a
|
|
@@ -11824,6 +12552,7 @@ const upsertAppointmentServiceCommandSchema = z.object({
|
|
|
11824
12552
|
input: z.unknown().superRefine(rejectBothAppointmentServiceCategoryKeys).pipe(z.union([
|
|
11825
12553
|
withAppointmentServiceCategoryPlacement(manualRequestServiceInputSchema),
|
|
11826
12554
|
withAppointmentServiceCategoryPlacement(freeServiceInputSchema),
|
|
12555
|
+
withAppointmentServiceCategoryPlacement(packagesOnlyServiceInputSchema),
|
|
11827
12556
|
withAppointmentServiceCategoryPlacement(paidOnlineServiceInputSchema)
|
|
11828
12557
|
]))
|
|
11829
12558
|
}).strict();
|
|
@@ -12178,6 +12907,14 @@ const upsertStaffMemberCommandSchema = z.object({
|
|
|
12178
12907
|
ref: staffRefSchema,
|
|
12179
12908
|
input: z.object({
|
|
12180
12909
|
identity: staffMemberIdentitySchema,
|
|
12910
|
+
access: z.object({
|
|
12911
|
+
memberId: z.string().uuid(),
|
|
12912
|
+
capabilities: z.array(z.enum([
|
|
12913
|
+
"appointments",
|
|
12914
|
+
"event_ops",
|
|
12915
|
+
"packages"
|
|
12916
|
+
])).min(1)
|
|
12917
|
+
}).strict().optional(),
|
|
12181
12918
|
displayName: z.string().min(1),
|
|
12182
12919
|
roleLabel: z.string().optional(),
|
|
12183
12920
|
shortBio: z.string().optional(),
|
|
@@ -13359,20 +14096,21 @@ function bookingCommandRefContributions(command) {
|
|
|
13359
14096
|
}],
|
|
13360
14097
|
...bookingQuestionRefContributions(command.input.bookingQuestions)
|
|
13361
14098
|
]);
|
|
13362
|
-
case "upsertBookingPassProduct": return
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
ref,
|
|
13366
|
-
field:
|
|
13367
|
-
}
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
14099
|
+
case "upsertBookingPassProduct": return passProductContributions(command);
|
|
14100
|
+
case "grantCustomerPass": return providedWithRequirements(command.ref, [
|
|
14101
|
+
{
|
|
14102
|
+
ref: command.input.customerRef,
|
|
14103
|
+
field: "input.customerRef"
|
|
14104
|
+
},
|
|
14105
|
+
{
|
|
14106
|
+
ref: command.input.passRef,
|
|
14107
|
+
field: "input.passRef"
|
|
14108
|
+
},
|
|
14109
|
+
...command.input.sale?.heldWithStaffMemberRef !== undefined ? [{
|
|
14110
|
+
ref: command.input.sale.heldWithStaffMemberRef,
|
|
14111
|
+
field: "input.sale.heldWithStaffMemberRef"
|
|
14112
|
+
}] : []
|
|
14113
|
+
]);
|
|
13376
14114
|
case "grantCustomerMembership": return providedWithRequirements(command.ref, [{
|
|
13377
14115
|
ref: command.input.customerRef,
|
|
13378
14116
|
field: "input.customerRef"
|
|
@@ -13392,7 +14130,11 @@ function bookingCommandRefContributions(command) {
|
|
|
13392
14130
|
{
|
|
13393
14131
|
ref: command.input.resourceRef,
|
|
13394
14132
|
field: "input.resourceRef"
|
|
13395
|
-
}
|
|
14133
|
+
},
|
|
14134
|
+
...command.input.payment?.kind === "package" ? [{
|
|
14135
|
+
ref: command.input.payment.customerPassRef,
|
|
14136
|
+
field: "input.payment.customerPassRef"
|
|
14137
|
+
}] : []
|
|
13396
14138
|
]);
|
|
13397
14139
|
case "seedEventSeriesRegistration": return providedWithRequirements(command.ref, [{
|
|
13398
14140
|
ref: command.input.customerRef,
|
|
@@ -13477,6 +14219,15 @@ function portalOrderSubjectRefContribution(subject) {
|
|
|
13477
14219
|
default: return assertNever(subject);
|
|
13478
14220
|
}
|
|
13479
14221
|
}
|
|
14222
|
+
function passProductContributions(command) {
|
|
14223
|
+
return providedWithRequirements(command.ref, [...command.input.ownerStaffMemberRef !== undefined ? [{
|
|
14224
|
+
ref: command.input.ownerStaffMemberRef,
|
|
14225
|
+
field: "input.ownerStaffMemberRef"
|
|
14226
|
+
}] : [], ...command.input.appointmentScope?.mode === "selected_services" ? command.input.appointmentScope.serviceRefs.map((ref, index) => ({
|
|
14227
|
+
ref,
|
|
14228
|
+
field: `input.appointmentScope.serviceRefs[${index}]`
|
|
14229
|
+
})) : []]);
|
|
14230
|
+
}
|
|
13480
14231
|
|
|
13481
14232
|
//#endregion
|
|
13482
14233
|
//#region ../site-commands/src/refContributions.ts
|
|
@@ -14411,107 +15162,6 @@ function isUnlistedEventPage(linkedRuns) {
|
|
|
14411
15162
|
return pageRuns.length > 0 && pageRuns.every((run) => run?.visibility === "unlisted");
|
|
14412
15163
|
}
|
|
14413
15164
|
|
|
14414
|
-
//#endregion
|
|
14415
|
-
//#region ../core/src/links.ts
|
|
14416
|
-
const nullableString = z.union([z.string().min(1), z.null()]);
|
|
14417
|
-
const RESOLVED_INTERNAL_LINK_ENTITY_TYPES = [
|
|
14418
|
-
"page",
|
|
14419
|
-
"content",
|
|
14420
|
-
"pageSurface"
|
|
14421
|
-
];
|
|
14422
|
-
function isResolvedInternalLinkEntityType(value) {
|
|
14423
|
-
return typeof value === "string" && RESOLVED_INTERNAL_LINK_ENTITY_TYPES.includes(value);
|
|
14424
|
-
}
|
|
14425
|
-
const resolvedInternalLinkKeys = [
|
|
14426
|
-
"entityId",
|
|
14427
|
-
"entityType",
|
|
14428
|
-
"href",
|
|
14429
|
-
"title",
|
|
14430
|
-
"typeLabel"
|
|
14431
|
-
];
|
|
14432
|
-
const internalRouteOnlyLinkSchema = z.object({
|
|
14433
|
-
kind: z.literal("internal"),
|
|
14434
|
-
routeId: z.string().min(1)
|
|
14435
|
-
}).passthrough().superRefine((value, ctx) => {
|
|
14436
|
-
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
14437
|
-
if (!hasResolvedMetadata) return;
|
|
14438
|
-
ctx.addIssue({
|
|
14439
|
-
code: "custom",
|
|
14440
|
-
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
14441
|
-
});
|
|
14442
|
-
});
|
|
14443
|
-
const internalResolvedLinkSchema = z.object({
|
|
14444
|
-
kind: z.literal("internal"),
|
|
14445
|
-
routeId: z.string().min(1),
|
|
14446
|
-
entityId: z.string().min(1),
|
|
14447
|
-
entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES),
|
|
14448
|
-
href: z.string().min(1),
|
|
14449
|
-
title: z.string().min(1),
|
|
14450
|
-
typeLabel: z.string().min(1),
|
|
14451
|
-
contentTypeKey: nullableString.optional(),
|
|
14452
|
-
contentTypeName: nullableString.optional(),
|
|
14453
|
-
updatedAt: nullableString.optional()
|
|
14454
|
-
}).passthrough();
|
|
14455
|
-
const internalLinkSchema = z.union([internalResolvedLinkSchema, internalRouteOnlyLinkSchema]);
|
|
14456
|
-
const externalLinkSchema = z.object({
|
|
14457
|
-
kind: z.literal("external"),
|
|
14458
|
-
href: z.string().min(1)
|
|
14459
|
-
}).passthrough();
|
|
14460
|
-
const customLinkSchema = z.object({
|
|
14461
|
-
kind: z.literal("url"),
|
|
14462
|
-
href: z.string().min(1)
|
|
14463
|
-
}).passthrough();
|
|
14464
|
-
const pageLinkSchema = z.object({
|
|
14465
|
-
kind: z.literal("page"),
|
|
14466
|
-
identifier: z.string().min(1)
|
|
14467
|
-
}).passthrough();
|
|
14468
|
-
const entryLinkSchema = z.object({
|
|
14469
|
-
kind: z.literal("entry"),
|
|
14470
|
-
contentType: z.string().min(1),
|
|
14471
|
-
identifier: z.string().min(1)
|
|
14472
|
-
}).passthrough();
|
|
14473
|
-
/** Convert legacy URL strings without inventing page or entry references. */
|
|
14474
|
-
function normalizeLinkValue(value) {
|
|
14475
|
-
return typeof value === "string" && value.trim().length > 0 ? {
|
|
14476
|
-
kind: "url",
|
|
14477
|
-
href: value.trim()
|
|
14478
|
-
} : value;
|
|
14479
|
-
}
|
|
14480
|
-
const linkSchema = z.union([
|
|
14481
|
-
internalLinkSchema,
|
|
14482
|
-
externalLinkSchema,
|
|
14483
|
-
customLinkSchema,
|
|
14484
|
-
pageLinkSchema,
|
|
14485
|
-
entryLinkSchema
|
|
14486
|
-
]);
|
|
14487
|
-
function visitLinkValueReferences(value, visitor) {
|
|
14488
|
-
const parsed = linkSchema.safeParse(value);
|
|
14489
|
-
if (!parsed.success) {
|
|
14490
|
-
return;
|
|
14491
|
-
}
|
|
14492
|
-
const link = parsed.data;
|
|
14493
|
-
switch (link.kind) {
|
|
14494
|
-
case "internal":
|
|
14495
|
-
visitor.routeIds.add(link.routeId);
|
|
14496
|
-
return;
|
|
14497
|
-
case "page":
|
|
14498
|
-
visitor.pageIdentifiers.add(link.identifier);
|
|
14499
|
-
return;
|
|
14500
|
-
case "entry":
|
|
14501
|
-
visitor.entryIdentifiers.add(link.contentType, link.identifier);
|
|
14502
|
-
return;
|
|
14503
|
-
case "external":
|
|
14504
|
-
case "url": return;
|
|
14505
|
-
}
|
|
14506
|
-
}
|
|
14507
|
-
function isInternalResolvedLinkValue(value) {
|
|
14508
|
-
return value?.kind === "internal" && hasResolvedLinkIdentity(value) && "href" in value && "title" in value && "typeLabel" in value && typeof value.href === "string" && typeof value.title === "string" && typeof value.typeLabel === "string";
|
|
14509
|
-
}
|
|
14510
|
-
/** The route-only form deliberately has no resolved entity identity. */
|
|
14511
|
-
function hasResolvedLinkIdentity(value) {
|
|
14512
|
-
return "entityId" in value && "entityType" in value && typeof value.entityId === "string" && isResolvedInternalLinkEntityType(value.entityType);
|
|
14513
|
-
}
|
|
14514
|
-
|
|
14515
15165
|
//#endregion
|
|
14516
15166
|
//#region ../api/src/sdk-event-booking-offer.ts
|
|
14517
15167
|
function classifySdkEventBookingOffer(input) {
|
|
@@ -15019,4 +15669,4 @@ function parseSdkEventRunUpsertInput(input, runIndex, options) {
|
|
|
15019
15669
|
}
|
|
15020
15670
|
|
|
15021
15671
|
//#endregion
|
|
15022
|
-
export {
|
|
15672
|
+
export { boxBackgroundOverlaySchema as $, asDesignSystemTemplateId as $n, buttonStyleSelectionSchema as $t, bookingPaymentCollectionOptionSchema as A, bookingPageLookIdValues as An, createFormRef as Ar, resolveMediaIdentifier as At, defaultHeaderBrandPreferences as B, eventListTreatmentValues as Bn, MAX_MANAGEMENT_MEDIA_UPLOAD_BYTES as Bt, entryIdentifierForCommand as C, ICON_PICKER_PRESETS as Cn, createBlockRef as Cr, PUBLIC_FILE_FIELD_KINDS as Ct, hasConfiguredBookingVertical as D, asFooterLookId as Dn, createEventCategoryRef as Dr, buildMediaIdentifierFromFilename as Dt, pagePathForCommand as E, SUPPORTED_LOADER_ENDPOINTS as En, createContentEntryRef as Er, mediaIdentifierSchema as Et, parseSiteChromeBackgroundColorToken as F, parseBookingPageLookId as Fn, refSlug as Fr, getMimeType as Ft, sectionStylesOverrideSchema as G, visibleHeadingDecorationFamilyValues as Gn, boxlessCardVariantValue as Gt, cardStylesOverrideSchema as H, headingDecorationColorTokenValues as Hn, managementMediaLibraryUploadLimitForMimeType as Ht, backgroundAppearanceColorTokenNames as I, siteChromeBackgroundOverrideOwner as In, slugPart as Ir, asRecord as It, headerVariantValues as J, asBlockOrderIndex as Jn, cardVariantRoleValues as Jt, themeSchema as K, asAppearancePresetId as Kn, cardRoleSchema as Kt, defaultHeaderPreferences as L, SYSTEM_BLOCK_KINDS as Ln, __commonJSMin as Lr, normalizeAmbiguousStoragePathForSite as Lt, defaultFooterPreferences as M, headerLayoutIdValues as Mn, createPageRef as Mr, deriveVideoSlotPolicy as Mt, footerPreferencesSchema as N, headerStyleIdValues as Nn, createSiteCommandSiteRef as Nr, resolveVideoSelectionIntentForMediaField as Nt, eventCommandScheduleSchema as O, asHeaderLayoutId as On, createEventSeriesRef as Or, parseCanonicalMediaIdentifier as Ot, headerPreferencesSchema as P, pageDesignEditorBackgroundOverrideOwner as Pn, createVenueRef as Pr, getExtensionForMimeType as Pt, customCssRuleSchema as Q, asDesignPageId as Qn, BUTTON_STYLE_IDS as Qt, defaultHeaderNavPreferences as R, VARIANT_ROLES as Rn, __toESM as Rr, parseRelativeStoragePath as Rt, blockOrderIdentifiersForCommand as S, parseThemeColorToken as Sn, ianaTimezoneSchema as Sr, resolveManagedMediaReference as St, pageIdentifierForCommand as T, parseGradientPresetId as Tn, createCommandRef as Tr, mediaTypeDiscriminants as Tt, containerStylesOverrideSchema as U, isArrangementMode as Un, parseSafeDownloadFilename as Ut, footerModeSchema as V, eyebrowTreatmentValues as Vn, classifyKnownMimeType as Vt, headerPositioningValues as W, tileTreatmentValues as Wn, getFontWidthRange as Wt, headerInteractionQuietPalette as X, asDesignBlockId as Xn, openCardRoleValue as Xt, headerInteractionPaletteValues as Y, asBoundaryOptionId as Yn, itemRoleValues as Yt, blockCustomCssRuleSchema as Z, asDesignBoundaryId as Zn, surfaceCardRoleValues as Zt, evaluateSiteCommandBatchExposure as _, paletteColorsFromEntries as _n, linkSchema as _r, mediaSchema as _t, classifySdkEventSchedule as a, buttonEffectApplicationSchema as an, RichTextDocSchema as ar, deleteEnvSpecificKeys as at, eventManagementTiming as b, paletteTokenNameSchema as bn, require_dist as br, videoMediaSchema as bt, isEventVisibility as c, buttonVariantIdSchema as cn, sanitizeHref as cr, normalizeWidthCandidates as ct, sortRecord as d, parseOpaqueButtonColourToken as dn, entryLinkSchema as dr, resolveMediaTransformForAspect as dt, editorialLinkParametersSchema as en, asLayoutVariantKey as er, boxBackgroundSchema as et, stableStringify as f, PALETTE_TOKEN_NAMES as fn, externalLinkSchema as fr, getDirectImageUrlForRelativePath as ft, mapEventCommandContent as g, paletteColorEntries as gn, isResolvedInternalLinkEntityType as gr, imageMediaSchema as gt, resolveEventSeriesWaitlistMapping as h, normalizePaletteHex as hn, internalRouteOnlyLinkSchema as hr, isSiteScopedDirectImageStoragePath as ht, sdkEventUpsertOptionalFieldSchemas as i, squareOutlineParametersSchema as in, changeBookingQuestionsInputSchema as ir, walkAndCollectImageAttrs as it, bookingPaymentTermsSchema as j, footerLookIdValues as jn, createNavigationRef as jr, slugifyMediaIdentifier as jt, eventBookingOfferIntentSchema as k, asHeaderStyleId as kn, createFooterRef as kr, parseMediaIdentifier as kt, resolvePageUpsertSeo as l, buttonVisualStatesSchema as ln, RESOLVED_INTERNAL_LINK_ENTITY_TYPES as lr, isExplicitRectCrop as lt, parseAndPlanCommandBatchForTypes as m, hexColorSchema as mn, internalResolvedLinkSchema as mr, getImageUrl as mt, sdkCourseBookingSettingsSchema as n, flatInkParametersSchema as nn, asSiteStyleId as nr, collectPortableMediaReferencesFromContent as nt, classifySdkEventBookingOffer as o, buttonPressOffsetSchema as on, createRichTextDoc as or, looksLikeUuid as ot, createDryRunReport as p, blockColorTokenNames as pn, internalLinkSchema as pr, getDirectImageUrlForSiteScopedPath as pt, skinBookingBarSchema as q, asBlockContentVersionId as qn, cardRoleValues as qt, sdkEventOccurrenceInputSchema as r, quietArrowParametersSchema as rn, makeBoundaryId as rr, summarizePortableMediaReferences as rt, eventVisibilitySchema as s, buttonSystemSchema as sn, isRichTextDoc as sr, rotateNormalizedPoint as st, classifySdkEventTiming as t, flatInkHoverTreatmentSchema as tn, asPageFlowPresetId as tr, runtimeBoxBackgroundSchema as tt, venueManagementFields as u, opaqueButtonColourTokenSchema as un, customLinkSchema as ur, parseAspectRatioValue as ut, evaluateSiteCommandExposure as v, paletteColorsSchema as vn, normalizeLinkValue as vr, persistableMediaSchema as vt, pageIdentifierForBlockCommand as w, gradientPresetIdValues as wn, createBlocksRef as wr, isDisplayMediaKind as wt, blockIdentifierForCommand as x, parseColorTokenParts as xn, bookingQuestionAttachmentSchema as xr, buildRenderableMediaAssetIndex as xt, getSiteCommandMetadata as y, paletteModeSchema as yn, pageLinkSchema as yr, runtimeMediaSchema as yt, defaultHeaderBrandPresentation as z, arrangementModes as zn, FILE_SIZE_LIMITS as zt };
|