@riverbankcms/sdk 0.92.0 → 0.94.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/{PreviewEditorSidebar-3CI5MKV3.mjs → PreviewEditorSidebar-D3PAF7NW.mjs} +3 -3
- package/dist/{PreviewEditorUI-DKEP636I.mjs → PreviewEditorUI-G5JVJEIJ.mjs} +3 -3
- package/dist/SdkPreviewModeRuntime-NHTLRNQD.mjs +8 -0
- package/dist/_dts/api/src/common/envelope.d.ts +10 -0
- package/dist/_dts/api/src/index.d.ts +2 -2
- package/dist/_dts/api/src/request.d.ts +1 -1
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +1 -0
- package/dist/_dts/content-editor/src/controller/EntryControllerProvider.d.ts +14 -14
- package/dist/_dts/content-editor/src/controller/useEntrySyncHelpers.d.ts +1 -1
- package/dist/_dts/content-editor/src/hooks/useEntryActions.d.ts +5 -15
- package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +46 -0
- package/dist/_dts/content-editor/src/ui/editorUiStore.d.ts +43 -36
- package/dist/_dts/media-core/src/fileUploadFinalization.d.ts +29 -1
- package/dist/_dts/media-core/src/index.d.ts +1 -0
- package/dist/_dts/media-core/src/legacyMediaValue.d.ts +11 -0
- package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +2 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/{chunk-UOMTCHZD.mjs → chunk-A63UXN3P.mjs} +21 -19
- package/dist/{chunk-U5YM4AWE.mjs → chunk-AJZGT6YG.mjs} +1 -1
- package/dist/{chunk-6D7PLF4M.mjs → chunk-AQ6RT6LZ.mjs} +2 -2
- package/dist/{chunk-ZA2S7H34.mjs → chunk-NT76QGIJ.mjs} +98 -1
- package/dist/{chunk-I6EOKV6B.mjs → chunk-PCNCETBI.mjs} +676 -386
- package/dist/{chunk-LERKJM3E.mjs → chunk-XIK2HYI3.mjs} +7 -7
- package/dist/cli/index.mjs +198 -87
- package/dist/client/{accordion-BUDH2G3S.mjs → accordion-RNQIPG55.mjs} +2 -2
- package/dist/client/{bookingForm-NQMCELVB.mjs → bookingForm-HYEEVRLP.mjs} +5 -5
- package/dist/client/{carousel-ONCEW6IJ.mjs → carousel-W7DQ3YPU.mjs} +3 -3
- package/dist/client/{cart-V2TCK2GI.mjs → cart-PXJ3SXXO.mjs} +6 -6
- package/dist/client/{checkout-ZI7SWNCS.mjs → checkout-X3JYSOXI.mjs} +6 -6
- package/dist/client/{chunk-R3CZQLXF.mjs → chunk-6SYGVVWA.mjs} +1 -1
- package/dist/client/{chunk-N2WJPTF7.mjs → chunk-DUOHLWLF.mjs} +3 -3
- package/dist/client/{chunk-KXYEKEV6.mjs → chunk-IXDSXF2D.mjs} +7 -7
- package/dist/client/{chunk-ZJDBOLX7.mjs → chunk-J6TMMMXW.mjs} +2 -2
- package/dist/client/{chunk-B5UC2D6X.mjs → chunk-JNE6UI6U.mjs} +1 -1
- package/dist/client/{chunk-QQNVQ62W.mjs → chunk-OLAOAZEO.mjs} +1 -1
- package/dist/client/{chunk-AUMRQ242.mjs → chunk-PICR3NTQ.mjs} +2 -2
- package/dist/client/{chunk-ERQDHUS2.mjs → chunk-Q47XGAGS.mjs} +1 -1
- package/dist/client/{chunk-HQWIJLYN.mjs → chunk-WERRJXNJ.mjs} +1 -1
- package/dist/client/{chunk-JXY6NHG6.mjs → chunk-YYVGSYBO.mjs} +5 -5
- package/dist/client/client.mjs +127 -17
- package/dist/client/{courseRegistration-JPWAQ6KM.mjs → courseRegistration-QZ67PVHO.mjs} +5 -5
- package/dist/client/{eventCalendar-QDOCHBBV.mjs → eventCalendar-V3BDHQNT.mjs} +8 -8
- package/dist/client/{eventCombined-ZS2CXSIE.mjs → eventCombined-XYFRN2RG.mjs} +8 -8
- package/dist/client/{eventDetails-5LOBMPLN.mjs → eventDetails-TFE5TWKV.mjs} +8 -8
- package/dist/client/{eventListing-SBGY4I3L.mjs → eventListing-IQ6AGWZ6.mjs} +8 -8
- package/dist/client/{eventRegistration-XGPIU3Z2.mjs → eventRegistration-WGJVFKQJ.mjs} +8 -8
- package/dist/client/{form-R7D4LZWW.mjs → form-6UZY6RUA.mjs} +2 -2
- package/dist/client/{headerSection-RRLYUCGC.mjs → headerSection-RSFXY6V3.mjs} +3 -3
- package/dist/client/hooks.mjs +35 -3
- package/dist/client/{locationMap-35ZJMRBZ.mjs → locationMap-24FH67I4.mjs} +3 -3
- package/dist/client/{newsletterForm-MJ2VCFUT.mjs → newsletterForm-QVL3MLTN.mjs} +2 -2
- package/dist/client/{productDetail-2O7YQNBX.mjs → productDetail-ZDYN3G4T.mjs} +6 -6
- package/dist/client/{productList-FDP5BH7W.mjs → productList-4BMJLQHZ.mjs} +6 -6
- package/dist/client/rendering/client.mjs +8 -0
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +69 -2
- package/dist/client/{shop-BGYJ3LDT.mjs → shop-U5C634FF.mjs} +6 -6
- package/dist/preview-next/client/runtime.mjs +5 -5
- package/dist/{sdk-runtime-B3TFXRXZ.mjs → sdk-runtime-VGV46WVB.mjs} +6 -6
- package/dist/server/components.mjs +121 -61
- package/dist/server/config-validation.mjs +35 -3
- package/dist/server/config.mjs +35 -3
- package/dist/server/data.mjs +35 -3
- package/dist/server/index.mjs +104 -29
- package/dist/server/next.mjs +183 -80
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +121 -61
- package/dist/server/rendering.mjs +121 -61
- package/dist/server/routing.mjs +102 -62
- package/dist/server/server.mjs +167 -92
- package/package.json +1 -1
- package/dist/SdkPreviewModeRuntime-BRGRDQFH.mjs +0 -8
- /package/dist/client/{chunk-GH6IIOOE.mjs → chunk-PCHACQEB.mjs} +0 -0
package/dist/server/next.mjs
CHANGED
|
@@ -7034,65 +7034,6 @@ function formatKeyAsLabel(key) {
|
|
|
7034
7034
|
// ../blocks/src/system/manifest/fieldValidation/index.ts
|
|
7035
7035
|
import { z as z6 } from "zod";
|
|
7036
7036
|
|
|
7037
|
-
// ../blocks/src/system/types/link.ts
|
|
7038
|
-
import { z as z3 } from "zod";
|
|
7039
|
-
var nullableString = z3.union([z3.string().min(1), z3.null()]);
|
|
7040
|
-
var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
|
|
7041
|
-
var internalRouteOnlyLinkSchema = z3.object({
|
|
7042
|
-
kind: z3.literal("internal"),
|
|
7043
|
-
routeId: z3.string().min(1)
|
|
7044
|
-
}).passthrough().superRefine((value, ctx) => {
|
|
7045
|
-
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
7046
|
-
if (!hasResolvedMetadata) return;
|
|
7047
|
-
ctx.addIssue({
|
|
7048
|
-
code: "custom",
|
|
7049
|
-
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
7050
|
-
});
|
|
7051
|
-
});
|
|
7052
|
-
var internalResolvedLinkSchema = z3.object({
|
|
7053
|
-
kind: z3.literal("internal"),
|
|
7054
|
-
routeId: z3.string().min(1),
|
|
7055
|
-
entityId: z3.string().min(1),
|
|
7056
|
-
entityType: z3.enum(["page", "content"]),
|
|
7057
|
-
href: z3.string().min(1),
|
|
7058
|
-
title: z3.string().min(1),
|
|
7059
|
-
typeLabel: z3.string().min(1),
|
|
7060
|
-
contentTypeKey: nullableString.optional(),
|
|
7061
|
-
contentTypeName: nullableString.optional(),
|
|
7062
|
-
updatedAt: nullableString.optional()
|
|
7063
|
-
}).passthrough();
|
|
7064
|
-
var internalLinkSchema = z3.union([
|
|
7065
|
-
internalResolvedLinkSchema,
|
|
7066
|
-
internalRouteOnlyLinkSchema
|
|
7067
|
-
]);
|
|
7068
|
-
var externalLinkSchema2 = z3.object({
|
|
7069
|
-
kind: z3.literal("external"),
|
|
7070
|
-
href: z3.string().min(1)
|
|
7071
|
-
}).passthrough();
|
|
7072
|
-
var customLinkSchema2 = z3.object({
|
|
7073
|
-
kind: z3.literal("url"),
|
|
7074
|
-
href: z3.string().min(1)
|
|
7075
|
-
}).passthrough();
|
|
7076
|
-
var pageLinkSchema2 = z3.object({
|
|
7077
|
-
kind: z3.literal("page"),
|
|
7078
|
-
identifier: z3.string().min(1)
|
|
7079
|
-
}).passthrough();
|
|
7080
|
-
var entryLinkSchema2 = z3.object({
|
|
7081
|
-
kind: z3.literal("entry"),
|
|
7082
|
-
contentType: z3.string().min(1),
|
|
7083
|
-
identifier: z3.string().min(1)
|
|
7084
|
-
}).passthrough();
|
|
7085
|
-
var linkSchema = z3.union([
|
|
7086
|
-
internalLinkSchema,
|
|
7087
|
-
externalLinkSchema2,
|
|
7088
|
-
customLinkSchema2,
|
|
7089
|
-
pageLinkSchema2,
|
|
7090
|
-
entryLinkSchema2
|
|
7091
|
-
]);
|
|
7092
|
-
|
|
7093
|
-
// ../blocks/src/system/manifest/schema.ts
|
|
7094
|
-
import { z as z5 } from "zod";
|
|
7095
|
-
|
|
7096
7037
|
// ../media-core/src/fileSafety.ts
|
|
7097
7038
|
var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
|
|
7098
7039
|
function containsUnsafePathSegmentCharacter(value) {
|
|
@@ -7439,6 +7380,82 @@ function mediaIdentifierOrFallback(current, fallback2) {
|
|
|
7439
7380
|
return fallback2 ?? (typeof current === "string" ? current : void 0);
|
|
7440
7381
|
}
|
|
7441
7382
|
|
|
7383
|
+
// ../media-core/src/legacyMediaValue.ts
|
|
7384
|
+
function legacyStringMediaTypeForField(field) {
|
|
7385
|
+
if (field.type === "file") {
|
|
7386
|
+
return field.fileKinds?.[0] ?? "document";
|
|
7387
|
+
}
|
|
7388
|
+
return field.mediaKinds?.[0] ?? "image";
|
|
7389
|
+
}
|
|
7390
|
+
function normalizeLegacyStringMediaValueForField(value, field) {
|
|
7391
|
+
if (typeof value !== "string") return value;
|
|
7392
|
+
const src = value.trim();
|
|
7393
|
+
if (!src) return value;
|
|
7394
|
+
return {
|
|
7395
|
+
type: legacyStringMediaTypeForField(field),
|
|
7396
|
+
src
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
|
|
7400
|
+
// ../blocks/src/system/types/link.ts
|
|
7401
|
+
import { z as z3 } from "zod";
|
|
7402
|
+
var nullableString = z3.union([z3.string().min(1), z3.null()]);
|
|
7403
|
+
var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
|
|
7404
|
+
var internalRouteOnlyLinkSchema = z3.object({
|
|
7405
|
+
kind: z3.literal("internal"),
|
|
7406
|
+
routeId: z3.string().min(1)
|
|
7407
|
+
}).passthrough().superRefine((value, ctx) => {
|
|
7408
|
+
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
7409
|
+
if (!hasResolvedMetadata) return;
|
|
7410
|
+
ctx.addIssue({
|
|
7411
|
+
code: "custom",
|
|
7412
|
+
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
7413
|
+
});
|
|
7414
|
+
});
|
|
7415
|
+
var internalResolvedLinkSchema = z3.object({
|
|
7416
|
+
kind: z3.literal("internal"),
|
|
7417
|
+
routeId: z3.string().min(1),
|
|
7418
|
+
entityId: z3.string().min(1),
|
|
7419
|
+
entityType: z3.enum(["page", "content"]),
|
|
7420
|
+
href: z3.string().min(1),
|
|
7421
|
+
title: z3.string().min(1),
|
|
7422
|
+
typeLabel: z3.string().min(1),
|
|
7423
|
+
contentTypeKey: nullableString.optional(),
|
|
7424
|
+
contentTypeName: nullableString.optional(),
|
|
7425
|
+
updatedAt: nullableString.optional()
|
|
7426
|
+
}).passthrough();
|
|
7427
|
+
var internalLinkSchema = z3.union([
|
|
7428
|
+
internalResolvedLinkSchema,
|
|
7429
|
+
internalRouteOnlyLinkSchema
|
|
7430
|
+
]);
|
|
7431
|
+
var externalLinkSchema2 = z3.object({
|
|
7432
|
+
kind: z3.literal("external"),
|
|
7433
|
+
href: z3.string().min(1)
|
|
7434
|
+
}).passthrough();
|
|
7435
|
+
var customLinkSchema2 = z3.object({
|
|
7436
|
+
kind: z3.literal("url"),
|
|
7437
|
+
href: z3.string().min(1)
|
|
7438
|
+
}).passthrough();
|
|
7439
|
+
var pageLinkSchema2 = z3.object({
|
|
7440
|
+
kind: z3.literal("page"),
|
|
7441
|
+
identifier: z3.string().min(1)
|
|
7442
|
+
}).passthrough();
|
|
7443
|
+
var entryLinkSchema2 = z3.object({
|
|
7444
|
+
kind: z3.literal("entry"),
|
|
7445
|
+
contentType: z3.string().min(1),
|
|
7446
|
+
identifier: z3.string().min(1)
|
|
7447
|
+
}).passthrough();
|
|
7448
|
+
var linkSchema = z3.union([
|
|
7449
|
+
internalLinkSchema,
|
|
7450
|
+
externalLinkSchema2,
|
|
7451
|
+
customLinkSchema2,
|
|
7452
|
+
pageLinkSchema2,
|
|
7453
|
+
entryLinkSchema2
|
|
7454
|
+
]);
|
|
7455
|
+
|
|
7456
|
+
// ../blocks/src/system/manifest/schema.ts
|
|
7457
|
+
import { z as z5 } from "zod";
|
|
7458
|
+
|
|
7442
7459
|
// ../blocks/src/system/node/schema.ts
|
|
7443
7460
|
import { z as z4 } from "zod";
|
|
7444
7461
|
var transformStepSchema = z4.object({
|
|
@@ -9199,7 +9216,10 @@ function deriveFieldValidationPlan(field, path = [field.id]) {
|
|
|
9199
9216
|
return makePlan("richText", "object", field, path, required, commonConstraints(required, { kind: "richTextDoc" }));
|
|
9200
9217
|
case "media":
|
|
9201
9218
|
case "file":
|
|
9202
|
-
return
|
|
9219
|
+
return {
|
|
9220
|
+
...makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" })),
|
|
9221
|
+
legacyStringType: legacyStringMediaTypeForField(field)
|
|
9222
|
+
};
|
|
9203
9223
|
case "link":
|
|
9204
9224
|
return makePlan("link", "object", field, path, required, commonConstraints(required, { kind: "linkObject" }));
|
|
9205
9225
|
case "boolean":
|
|
@@ -9384,15 +9404,23 @@ function normalizeFieldValue(plan, value, ctx) {
|
|
|
9384
9404
|
return normalizeRepeaterItems(plan, value, ctx);
|
|
9385
9405
|
case "boolean":
|
|
9386
9406
|
case "richText":
|
|
9387
|
-
case "media":
|
|
9388
9407
|
case "link":
|
|
9389
9408
|
case "select":
|
|
9390
9409
|
case "passthrough":
|
|
9391
9410
|
return value;
|
|
9411
|
+
case "media":
|
|
9412
|
+
return normalizeMediaInput(plan, value);
|
|
9392
9413
|
default:
|
|
9393
9414
|
return assertNever2(plan);
|
|
9394
9415
|
}
|
|
9395
9416
|
}
|
|
9417
|
+
function normalizeMediaInput(plan, value) {
|
|
9418
|
+
return normalizeLegacyStringMediaValueForField(value, {
|
|
9419
|
+
type: plan.fieldType,
|
|
9420
|
+
mediaKinds: plan.fieldType === "media" ? [plan.legacyStringType] : void 0,
|
|
9421
|
+
fileKinds: plan.fieldType === "file" ? [plan.legacyStringType] : void 0
|
|
9422
|
+
});
|
|
9423
|
+
}
|
|
9396
9424
|
function normalizeObjectChildren(children, value, ctx) {
|
|
9397
9425
|
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
9398
9426
|
const normalized = {
|
|
@@ -67522,12 +67550,85 @@ function resolveApiBaseUrl() {
|
|
|
67522
67550
|
}
|
|
67523
67551
|
|
|
67524
67552
|
// ../api/src/common/envelope.ts
|
|
67553
|
+
var API_ERROR_CODES = [
|
|
67554
|
+
"auth:unauthenticated",
|
|
67555
|
+
"auth:token_expired",
|
|
67556
|
+
"auth:token_invalid",
|
|
67557
|
+
"auth:forbidden",
|
|
67558
|
+
"auth:mfa_required",
|
|
67559
|
+
"auth:sudo_required",
|
|
67560
|
+
"auth:insufficient_permissions",
|
|
67561
|
+
"auth:impersonation_restricted",
|
|
67562
|
+
"validation:invalid_input",
|
|
67563
|
+
"validation:missing_field",
|
|
67564
|
+
"validation:invalid_format",
|
|
67565
|
+
"validation:payload_too_large",
|
|
67566
|
+
"resource:not_found",
|
|
67567
|
+
"resource:already_exists",
|
|
67568
|
+
"resource:conflict",
|
|
67569
|
+
"resource:gone",
|
|
67570
|
+
"rate_limit:exceeded",
|
|
67571
|
+
"billing:payment_required",
|
|
67572
|
+
"billing:plan_limit_exceeded",
|
|
67573
|
+
"billing:pass_redemption_failed",
|
|
67574
|
+
"server:internal_error",
|
|
67575
|
+
"server:unavailable",
|
|
67576
|
+
"external:service_error",
|
|
67577
|
+
"external:registrar_orphaned_contact_profile",
|
|
67578
|
+
"network:connection_error",
|
|
67579
|
+
"network:timeout",
|
|
67580
|
+
"network:dns_error"
|
|
67581
|
+
];
|
|
67582
|
+
var API_ERROR_CODE_SET = new Set(API_ERROR_CODES);
|
|
67583
|
+
function isApiErrorCode(value) {
|
|
67584
|
+
return typeof value === "string" && API_ERROR_CODE_SET.has(value);
|
|
67585
|
+
}
|
|
67525
67586
|
function isApiError(result) {
|
|
67526
67587
|
return result.success === false;
|
|
67527
67588
|
}
|
|
67528
67589
|
function isApiSuccess(result) {
|
|
67529
67590
|
return result.success === true;
|
|
67530
67591
|
}
|
|
67592
|
+
function isRecord14(value) {
|
|
67593
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
67594
|
+
}
|
|
67595
|
+
function isFieldError(value) {
|
|
67596
|
+
return isRecord14(value) && typeof value.field === "string" && typeof value.code === "string" && typeof value.message === "string";
|
|
67597
|
+
}
|
|
67598
|
+
function fieldErrorsFromUnknown(value) {
|
|
67599
|
+
if (!Array.isArray(value)) return null;
|
|
67600
|
+
return value.every(isFieldError) ? value : null;
|
|
67601
|
+
}
|
|
67602
|
+
function extractEnvelopeErrorObject(body) {
|
|
67603
|
+
if (!isRecord14(body)) return null;
|
|
67604
|
+
const error = body.error;
|
|
67605
|
+
if (!isRecord14(error)) return null;
|
|
67606
|
+
if ("success" in body && body.success !== false) {
|
|
67607
|
+
return null;
|
|
67608
|
+
}
|
|
67609
|
+
return error;
|
|
67610
|
+
}
|
|
67611
|
+
function extractApiEnvelopeErrorDetails(body) {
|
|
67612
|
+
const error = extractEnvelopeErrorObject(body);
|
|
67613
|
+
if (!error) {
|
|
67614
|
+
return {
|
|
67615
|
+
rawCode: null,
|
|
67616
|
+
code: null,
|
|
67617
|
+
message: null,
|
|
67618
|
+
status: null,
|
|
67619
|
+
fieldErrors: null
|
|
67620
|
+
};
|
|
67621
|
+
}
|
|
67622
|
+
const rawCode = typeof error.code === "string" ? error.code : null;
|
|
67623
|
+
const message = typeof error.message === "string" && error.message.trim().length > 0 ? error.message : null;
|
|
67624
|
+
return {
|
|
67625
|
+
rawCode,
|
|
67626
|
+
code: isApiErrorCode(rawCode) ? rawCode : null,
|
|
67627
|
+
message,
|
|
67628
|
+
status: typeof error.status === "number" && Number.isFinite(error.status) ? error.status : null,
|
|
67629
|
+
fieldErrors: fieldErrorsFromUnknown(error.fieldErrors)
|
|
67630
|
+
};
|
|
67631
|
+
}
|
|
67531
67632
|
var ApiEnvelopeError = class extends Error {
|
|
67532
67633
|
constructor(error) {
|
|
67533
67634
|
super(error.message);
|
|
@@ -67924,6 +68025,7 @@ function createParsedClient(rawClient) {
|
|
|
67924
68025
|
const auth = config.auth ?? "user";
|
|
67925
68026
|
if (!response.ok) {
|
|
67926
68027
|
const body = await parseErrorBody(response);
|
|
68028
|
+
const envelopeError = extractApiEnvelopeErrorDetails(body);
|
|
67927
68029
|
const requestId = response.headers.get("x-request-id") ?? void 0;
|
|
67928
68030
|
const retryAfterMs = parseRetryAfterHeader(response.headers.get("retry-after"));
|
|
67929
68031
|
throw new ApiRequestError(
|
|
@@ -67935,6 +68037,7 @@ function createParsedClient(rawClient) {
|
|
|
67935
68037
|
auth,
|
|
67936
68038
|
requestId,
|
|
67937
68039
|
body,
|
|
68040
|
+
errorCode: envelopeError.code ?? void 0,
|
|
67938
68041
|
retryAfterMs
|
|
67939
68042
|
}
|
|
67940
68043
|
);
|
|
@@ -68251,7 +68354,7 @@ function preset(id, verticalId, canonicalBehaviour, label, pluralLabel, descript
|
|
|
68251
68354
|
}
|
|
68252
68355
|
|
|
68253
68356
|
// ../api/src/utils/isRecord.ts
|
|
68254
|
-
function
|
|
68357
|
+
function isRecord15(value) {
|
|
68255
68358
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
68256
68359
|
}
|
|
68257
68360
|
|
|
@@ -68558,7 +68661,7 @@ function sanitizeMarks(marks) {
|
|
|
68558
68661
|
if (mark.type === "bold" || mark.type === "strong" || mark.type === "italic" || mark.type === "em") {
|
|
68559
68662
|
return [{ type: mark.type }];
|
|
68560
68663
|
}
|
|
68561
|
-
if (mark.type === "link" &&
|
|
68664
|
+
if (mark.type === "link" && isRecord15(mark.attrs) && typeof mark.attrs.href === "string") {
|
|
68562
68665
|
const attrs = { href: mark.attrs.href };
|
|
68563
68666
|
if (typeof mark.attrs.target === "string" && mark.attrs.target.trim().length > 0) {
|
|
68564
68667
|
attrs.target = mark.attrs.target;
|
|
@@ -68573,10 +68676,10 @@ function sanitizeMarks(marks) {
|
|
|
68573
68676
|
return sanitized.length > 0 ? sanitized : void 0;
|
|
68574
68677
|
}
|
|
68575
68678
|
function unwrapRichTextValue(value) {
|
|
68576
|
-
if (
|
|
68679
|
+
if (isRecord15(value) && isRecord15(value.doc)) {
|
|
68577
68680
|
return unwrapRichTextValue(value.doc);
|
|
68578
68681
|
}
|
|
68579
|
-
if (
|
|
68682
|
+
if (isRecord15(value) && value.type === "doc") {
|
|
68580
68683
|
return {
|
|
68581
68684
|
type: "doc",
|
|
68582
68685
|
content: Array.isArray(value.content) ? value.content.filter(isTipTapNodeLike).map(coerceTipTapNode) : []
|
|
@@ -68585,7 +68688,7 @@ function unwrapRichTextValue(value) {
|
|
|
68585
68688
|
return EMPTY_SITE_BANNER_BODY;
|
|
68586
68689
|
}
|
|
68587
68690
|
function isTipTapNodeLike(value) {
|
|
68588
|
-
return
|
|
68691
|
+
return isRecord15(value) && typeof value.type === "string";
|
|
68589
68692
|
}
|
|
68590
68693
|
function coerceTipTapNode(value) {
|
|
68591
68694
|
return {
|
|
@@ -68593,9 +68696,9 @@ function coerceTipTapNode(value) {
|
|
|
68593
68696
|
...Array.isArray(value.content) ? { content: value.content.filter(isTipTapNodeLike).map(coerceTipTapNode) } : {},
|
|
68594
68697
|
...typeof value.text === "string" ? { text: value.text } : {},
|
|
68595
68698
|
...Array.isArray(value.marks) ? {
|
|
68596
|
-
marks: value.marks.filter((mark) =>
|
|
68699
|
+
marks: value.marks.filter((mark) => isRecord15(mark) && typeof mark.type === "string").map((mark) => ({
|
|
68597
68700
|
type: mark.type,
|
|
68598
|
-
...
|
|
68701
|
+
...isRecord15(mark.attrs) ? { attrs: mark.attrs } : {}
|
|
68599
68702
|
}))
|
|
68600
68703
|
} : {}
|
|
68601
68704
|
};
|
|
@@ -68785,7 +68888,7 @@ var ENTRY_REF_KEYS = [
|
|
|
68785
68888
|
"entryId",
|
|
68786
68889
|
"slug"
|
|
68787
68890
|
];
|
|
68788
|
-
function
|
|
68891
|
+
function isRecord16(value) {
|
|
68789
68892
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
68790
68893
|
}
|
|
68791
68894
|
function extractManualEntryRef(item) {
|
|
@@ -68793,7 +68896,7 @@ function extractManualEntryRef(item) {
|
|
|
68793
68896
|
const trimmed = item.trim();
|
|
68794
68897
|
return trimmed.length > 0 ? trimmed : null;
|
|
68795
68898
|
}
|
|
68796
|
-
if (!
|
|
68899
|
+
if (!isRecord16(item)) return null;
|
|
68797
68900
|
for (const key of ENTRY_REF_KEYS) {
|
|
68798
68901
|
const raw = item[key];
|
|
68799
68902
|
if (typeof raw === "string" && raw.trim().length > 0) {
|
|
@@ -69318,7 +69421,7 @@ function collectMediaAssetSidecar(mediaAssets) {
|
|
|
69318
69421
|
return Array.isArray(mediaAssets) && mediaAssets.length > 0 ? mediaAssets : void 0;
|
|
69319
69422
|
}
|
|
69320
69423
|
function convertPageResponseBlock(block) {
|
|
69321
|
-
if (!
|
|
69424
|
+
if (!isRecord17(block)) {
|
|
69322
69425
|
throw new Error("Invalid block format in page API response");
|
|
69323
69426
|
}
|
|
69324
69427
|
if (typeof block.id !== "string" && block.id !== null) {
|
|
@@ -69349,20 +69452,20 @@ function buildPageOutline(input) {
|
|
|
69349
69452
|
blocks: input.blocks.map(convertPageResponseBlock)
|
|
69350
69453
|
};
|
|
69351
69454
|
}
|
|
69352
|
-
function
|
|
69455
|
+
function isRecord17(value) {
|
|
69353
69456
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
69354
69457
|
}
|
|
69355
69458
|
function readContentRecord(value) {
|
|
69356
|
-
return
|
|
69459
|
+
return isRecord17(value) ? value : void 0;
|
|
69357
69460
|
}
|
|
69358
69461
|
function readNestedContentRecord(value) {
|
|
69359
|
-
if (!
|
|
69462
|
+
if (!isRecord17(value)) return null;
|
|
69360
69463
|
return readContentRecord(value.data) ?? null;
|
|
69361
69464
|
}
|
|
69362
69465
|
function sanitizeSdkRuntimeBlockContent(blockKind, content) {
|
|
69363
69466
|
if (blockKind !== "block.newsletter-signup") return content;
|
|
69364
69467
|
const sanitized = sanitizeNewsletterSignupPublicContent(content);
|
|
69365
|
-
return
|
|
69468
|
+
return isRecord17(sanitized) ? sanitized : {};
|
|
69366
69469
|
}
|
|
69367
69470
|
function sanitizeNullableSdkRuntimeBlockContent(blockKind, content) {
|
|
69368
69471
|
return content ? sanitizeSdkRuntimeBlockContent(blockKind, content) : null;
|
|
@@ -69979,15 +70082,15 @@ function Page(props2) {
|
|
|
69979
70082
|
var lazyBlockOverrideSymbol = /* @__PURE__ */ Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
69980
70083
|
|
|
69981
70084
|
// src/rendering/overrideResolution.ts
|
|
69982
|
-
function
|
|
70085
|
+
function isRecord18(value) {
|
|
69983
70086
|
return typeof value === "object" && value !== null;
|
|
69984
70087
|
}
|
|
69985
70088
|
function isBlockOutlineLike(value) {
|
|
69986
70089
|
const id = value.id;
|
|
69987
|
-
return typeof value.kind === "string" && (typeof id === "string" || id === null) && (typeof value.purpose === "string" ||
|
|
70090
|
+
return typeof value.kind === "string" && (typeof id === "string" || id === null) && (typeof value.purpose === "string" || isRecord18(value.content) || isRecord18(value.draftContent) || isRecord18(value.bindings));
|
|
69988
70091
|
}
|
|
69989
70092
|
function collectBlockKindsFromValue(value, usedKinds, seen) {
|
|
69990
|
-
if (!
|
|
70093
|
+
if (!isRecord18(value)) return;
|
|
69991
70094
|
if (seen.has(value)) return;
|
|
69992
70095
|
seen.add(value);
|
|
69993
70096
|
if (isBlockOutlineLike(value)) {
|
|
@@ -70036,7 +70139,7 @@ function selectOverrideKeysForUsedKinds(usedKinds, entries) {
|
|
|
70036
70139
|
return selectedKeys;
|
|
70037
70140
|
}
|
|
70038
70141
|
function isLazyRegistration(registration) {
|
|
70039
|
-
return
|
|
70142
|
+
return isRecord18(registration) && registration[lazyBlockOverrideSymbol] === true;
|
|
70040
70143
|
}
|
|
70041
70144
|
async function resolveOverrideComponent(registration) {
|
|
70042
70145
|
if (isLazyRegistration(registration)) {
|
|
@@ -71038,7 +71141,7 @@ var CircuitOpenError = class extends Error {
|
|
|
71038
71141
|
};
|
|
71039
71142
|
|
|
71040
71143
|
// src/version.ts
|
|
71041
|
-
var SDK_VERSION = "0.
|
|
71144
|
+
var SDK_VERSION = "0.94.0";
|
|
71042
71145
|
|
|
71043
71146
|
// src/next/content-load-failure.ts
|
|
71044
71147
|
var SdkContentLoadError = RiverbankContentLoadError;
|
|
@@ -45,9 +45,6 @@ function formatKeyAsLabel(key) {
|
|
|
45
45
|
return key.replace(/([A-Z])/g, " $1").replace(/[-_]/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// ../blocks/src/system/manifest/schema.ts
|
|
49
|
-
import { z as z2 } from "zod";
|
|
50
|
-
|
|
51
48
|
// ../core/src/result.ts
|
|
52
49
|
function ok(value) {
|
|
53
50
|
return { ok: true, value };
|
|
@@ -300,6 +297,9 @@ function parseAspectRatioValue(value) {
|
|
|
300
297
|
return numeric;
|
|
301
298
|
}
|
|
302
299
|
|
|
300
|
+
// ../blocks/src/system/manifest/schema.ts
|
|
301
|
+
import { z as z2 } from "zod";
|
|
302
|
+
|
|
303
303
|
// ../blocks/src/system/node/schema.ts
|
|
304
304
|
import { z } from "zod";
|
|
305
305
|
var transformStepSchema = z.object({
|
package/dist/server/prebuild.mjs
CHANGED
|
@@ -54,65 +54,6 @@ function formatKeyAsLabel(key) {
|
|
|
54
54
|
// ../blocks/src/system/manifest/fieldValidation/index.ts
|
|
55
55
|
import { z as z4 } from "zod";
|
|
56
56
|
|
|
57
|
-
// ../blocks/src/system/types/link.ts
|
|
58
|
-
import { z } from "zod";
|
|
59
|
-
var nullableString = z.union([z.string().min(1), z.null()]);
|
|
60
|
-
var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
|
|
61
|
-
var internalRouteOnlyLinkSchema = z.object({
|
|
62
|
-
kind: z.literal("internal"),
|
|
63
|
-
routeId: z.string().min(1)
|
|
64
|
-
}).passthrough().superRefine((value, ctx) => {
|
|
65
|
-
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
66
|
-
if (!hasResolvedMetadata) return;
|
|
67
|
-
ctx.addIssue({
|
|
68
|
-
code: "custom",
|
|
69
|
-
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var internalResolvedLinkSchema = z.object({
|
|
73
|
-
kind: z.literal("internal"),
|
|
74
|
-
routeId: z.string().min(1),
|
|
75
|
-
entityId: z.string().min(1),
|
|
76
|
-
entityType: z.enum(["page", "content"]),
|
|
77
|
-
href: z.string().min(1),
|
|
78
|
-
title: z.string().min(1),
|
|
79
|
-
typeLabel: z.string().min(1),
|
|
80
|
-
contentTypeKey: nullableString.optional(),
|
|
81
|
-
contentTypeName: nullableString.optional(),
|
|
82
|
-
updatedAt: nullableString.optional()
|
|
83
|
-
}).passthrough();
|
|
84
|
-
var internalLinkSchema = z.union([
|
|
85
|
-
internalResolvedLinkSchema,
|
|
86
|
-
internalRouteOnlyLinkSchema
|
|
87
|
-
]);
|
|
88
|
-
var externalLinkSchema = z.object({
|
|
89
|
-
kind: z.literal("external"),
|
|
90
|
-
href: z.string().min(1)
|
|
91
|
-
}).passthrough();
|
|
92
|
-
var customLinkSchema = z.object({
|
|
93
|
-
kind: z.literal("url"),
|
|
94
|
-
href: z.string().min(1)
|
|
95
|
-
}).passthrough();
|
|
96
|
-
var pageLinkSchema = z.object({
|
|
97
|
-
kind: z.literal("page"),
|
|
98
|
-
identifier: z.string().min(1)
|
|
99
|
-
}).passthrough();
|
|
100
|
-
var entryLinkSchema = z.object({
|
|
101
|
-
kind: z.literal("entry"),
|
|
102
|
-
contentType: z.string().min(1),
|
|
103
|
-
identifier: z.string().min(1)
|
|
104
|
-
}).passthrough();
|
|
105
|
-
var linkSchema = z.union([
|
|
106
|
-
internalLinkSchema,
|
|
107
|
-
externalLinkSchema,
|
|
108
|
-
customLinkSchema,
|
|
109
|
-
pageLinkSchema,
|
|
110
|
-
entryLinkSchema
|
|
111
|
-
]);
|
|
112
|
-
|
|
113
|
-
// ../blocks/src/system/manifest/schema.ts
|
|
114
|
-
import { z as z3 } from "zod";
|
|
115
|
-
|
|
116
57
|
// ../core/src/result.ts
|
|
117
58
|
function ok(value) {
|
|
118
59
|
return { ok: true, value };
|
|
@@ -863,6 +804,82 @@ function mediaIdentifierOrFallback(current, fallback2) {
|
|
|
863
804
|
return fallback2 ?? (typeof current === "string" ? current : void 0);
|
|
864
805
|
}
|
|
865
806
|
|
|
807
|
+
// ../media-core/src/legacyMediaValue.ts
|
|
808
|
+
function legacyStringMediaTypeForField(field) {
|
|
809
|
+
if (field.type === "file") {
|
|
810
|
+
return field.fileKinds?.[0] ?? "document";
|
|
811
|
+
}
|
|
812
|
+
return field.mediaKinds?.[0] ?? "image";
|
|
813
|
+
}
|
|
814
|
+
function normalizeLegacyStringMediaValueForField(value, field) {
|
|
815
|
+
if (typeof value !== "string") return value;
|
|
816
|
+
const src = value.trim();
|
|
817
|
+
if (!src) return value;
|
|
818
|
+
return {
|
|
819
|
+
type: legacyStringMediaTypeForField(field),
|
|
820
|
+
src
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// ../blocks/src/system/types/link.ts
|
|
825
|
+
import { z } from "zod";
|
|
826
|
+
var nullableString = z.union([z.string().min(1), z.null()]);
|
|
827
|
+
var resolvedInternalLinkKeys = ["entityId", "entityType", "href", "title", "typeLabel"];
|
|
828
|
+
var internalRouteOnlyLinkSchema = z.object({
|
|
829
|
+
kind: z.literal("internal"),
|
|
830
|
+
routeId: z.string().min(1)
|
|
831
|
+
}).passthrough().superRefine((value, ctx) => {
|
|
832
|
+
const hasResolvedMetadata = resolvedInternalLinkKeys.some((key) => value[key] != null);
|
|
833
|
+
if (!hasResolvedMetadata) return;
|
|
834
|
+
ctx.addIssue({
|
|
835
|
+
code: "custom",
|
|
836
|
+
message: "Internal links with resolved metadata must include entityId, entityType, href, title, and typeLabel"
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
var internalResolvedLinkSchema = z.object({
|
|
840
|
+
kind: z.literal("internal"),
|
|
841
|
+
routeId: z.string().min(1),
|
|
842
|
+
entityId: z.string().min(1),
|
|
843
|
+
entityType: z.enum(["page", "content"]),
|
|
844
|
+
href: z.string().min(1),
|
|
845
|
+
title: z.string().min(1),
|
|
846
|
+
typeLabel: z.string().min(1),
|
|
847
|
+
contentTypeKey: nullableString.optional(),
|
|
848
|
+
contentTypeName: nullableString.optional(),
|
|
849
|
+
updatedAt: nullableString.optional()
|
|
850
|
+
}).passthrough();
|
|
851
|
+
var internalLinkSchema = z.union([
|
|
852
|
+
internalResolvedLinkSchema,
|
|
853
|
+
internalRouteOnlyLinkSchema
|
|
854
|
+
]);
|
|
855
|
+
var externalLinkSchema = z.object({
|
|
856
|
+
kind: z.literal("external"),
|
|
857
|
+
href: z.string().min(1)
|
|
858
|
+
}).passthrough();
|
|
859
|
+
var customLinkSchema = z.object({
|
|
860
|
+
kind: z.literal("url"),
|
|
861
|
+
href: z.string().min(1)
|
|
862
|
+
}).passthrough();
|
|
863
|
+
var pageLinkSchema = z.object({
|
|
864
|
+
kind: z.literal("page"),
|
|
865
|
+
identifier: z.string().min(1)
|
|
866
|
+
}).passthrough();
|
|
867
|
+
var entryLinkSchema = z.object({
|
|
868
|
+
kind: z.literal("entry"),
|
|
869
|
+
contentType: z.string().min(1),
|
|
870
|
+
identifier: z.string().min(1)
|
|
871
|
+
}).passthrough();
|
|
872
|
+
var linkSchema = z.union([
|
|
873
|
+
internalLinkSchema,
|
|
874
|
+
externalLinkSchema,
|
|
875
|
+
customLinkSchema,
|
|
876
|
+
pageLinkSchema,
|
|
877
|
+
entryLinkSchema
|
|
878
|
+
]);
|
|
879
|
+
|
|
880
|
+
// ../blocks/src/system/manifest/schema.ts
|
|
881
|
+
import { z as z3 } from "zod";
|
|
882
|
+
|
|
866
883
|
// ../blocks/src/system/node/schema.ts
|
|
867
884
|
import { z as z2 } from "zod";
|
|
868
885
|
var transformStepSchema = z2.object({
|
|
@@ -2623,7 +2640,10 @@ function deriveFieldValidationPlan(field, path = [field.id]) {
|
|
|
2623
2640
|
return makePlan("richText", "object", field, path, required, commonConstraints(required, { kind: "richTextDoc" }));
|
|
2624
2641
|
case "media":
|
|
2625
2642
|
case "file":
|
|
2626
|
-
return
|
|
2643
|
+
return {
|
|
2644
|
+
...makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" })),
|
|
2645
|
+
legacyStringType: legacyStringMediaTypeForField(field)
|
|
2646
|
+
};
|
|
2627
2647
|
case "link":
|
|
2628
2648
|
return makePlan("link", "object", field, path, required, commonConstraints(required, { kind: "linkObject" }));
|
|
2629
2649
|
case "boolean":
|
|
@@ -2808,15 +2828,23 @@ function normalizeFieldValue(plan, value, ctx) {
|
|
|
2808
2828
|
return normalizeRepeaterItems(plan, value, ctx);
|
|
2809
2829
|
case "boolean":
|
|
2810
2830
|
case "richText":
|
|
2811
|
-
case "media":
|
|
2812
2831
|
case "link":
|
|
2813
2832
|
case "select":
|
|
2814
2833
|
case "passthrough":
|
|
2815
2834
|
return value;
|
|
2835
|
+
case "media":
|
|
2836
|
+
return normalizeMediaInput(plan, value);
|
|
2816
2837
|
default:
|
|
2817
2838
|
return assertNever2(plan);
|
|
2818
2839
|
}
|
|
2819
2840
|
}
|
|
2841
|
+
function normalizeMediaInput(plan, value) {
|
|
2842
|
+
return normalizeLegacyStringMediaValueForField(value, {
|
|
2843
|
+
type: plan.fieldType,
|
|
2844
|
+
mediaKinds: plan.fieldType === "media" ? [plan.legacyStringType] : void 0,
|
|
2845
|
+
fileKinds: plan.fieldType === "file" ? [plan.legacyStringType] : void 0
|
|
2846
|
+
});
|
|
2847
|
+
}
|
|
2820
2848
|
function normalizeObjectChildren(children, value, ctx) {
|
|
2821
2849
|
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
2822
2850
|
const normalized = {
|
|
@@ -68321,6 +68349,38 @@ var NAMED_SURFACE_IDS = SURFACE_IDS.filter(
|
|
|
68321
68349
|
(surfaceId) => surfaceId !== DEFAULT_SURFACE_ID
|
|
68322
68350
|
);
|
|
68323
68351
|
|
|
68352
|
+
// ../api/src/common/envelope.ts
|
|
68353
|
+
var API_ERROR_CODES = [
|
|
68354
|
+
"auth:unauthenticated",
|
|
68355
|
+
"auth:token_expired",
|
|
68356
|
+
"auth:token_invalid",
|
|
68357
|
+
"auth:forbidden",
|
|
68358
|
+
"auth:mfa_required",
|
|
68359
|
+
"auth:sudo_required",
|
|
68360
|
+
"auth:insufficient_permissions",
|
|
68361
|
+
"auth:impersonation_restricted",
|
|
68362
|
+
"validation:invalid_input",
|
|
68363
|
+
"validation:missing_field",
|
|
68364
|
+
"validation:invalid_format",
|
|
68365
|
+
"validation:payload_too_large",
|
|
68366
|
+
"resource:not_found",
|
|
68367
|
+
"resource:already_exists",
|
|
68368
|
+
"resource:conflict",
|
|
68369
|
+
"resource:gone",
|
|
68370
|
+
"rate_limit:exceeded",
|
|
68371
|
+
"billing:payment_required",
|
|
68372
|
+
"billing:plan_limit_exceeded",
|
|
68373
|
+
"billing:pass_redemption_failed",
|
|
68374
|
+
"server:internal_error",
|
|
68375
|
+
"server:unavailable",
|
|
68376
|
+
"external:service_error",
|
|
68377
|
+
"external:registrar_orphaned_contact_profile",
|
|
68378
|
+
"network:connection_error",
|
|
68379
|
+
"network:timeout",
|
|
68380
|
+
"network:dns_error"
|
|
68381
|
+
];
|
|
68382
|
+
var API_ERROR_CODE_SET = new Set(API_ERROR_CODES);
|
|
68383
|
+
|
|
68324
68384
|
// ../api/src/customerMembershipOutcomes.ts
|
|
68325
68385
|
var CANONICAL_REFUND_CONFLICT_CODES = [
|
|
68326
68386
|
"already_refunded",
|