@voltro/cms 0.85.0 → 0.87.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/CHANGELOG.md +5987 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +864 -253
- package/dist/ContentForm.js +282 -0
- package/dist/RichDocumentEditor.js +550 -0
- package/dist/RichDocumentView.js +177 -0
- package/dist/RichTextSurface.js +135 -0
- package/dist/aiCandidates.js +199 -0
- package/dist/aiOperations.js +152 -0
- package/dist/applicationBuildSnapshotService.js +101 -0
- package/dist/assetRenditions.js +102 -0
- package/dist/assetRevision.js +46 -0
- package/dist/assetUseRights.js +72 -0
- package/dist/audiences.js +31 -0
- package/dist/availability.js +124 -0
- package/dist/blueprint.js +166 -0
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +16 -0
- package/dist/buildApplicationCatalog.js +136 -0
- package/dist/buildApplicationCatalogTable.js +24 -0
- package/dist/buildApplicationRest.js +99 -0
- package/dist/buildApplicationUpload.js +111 -0
- package/dist/buildSnapshot.js +401 -0
- package/dist/buildSnapshotApplicationPin.js +32 -0
- package/dist/buildSnapshotRest.js +210 -0
- package/dist/buildSnapshotService.js +265 -0
- package/dist/buildSnapshotTables.js +25 -0
- package/dist/bulk.js +282 -0
- package/dist/cacheIdentity.js +152 -0
- package/dist/changes.js +307 -0
- package/dist/cmsContext.js +229 -0
- package/dist/collections.js +224 -0
- package/dist/consent.js +29 -0
- package/dist/contentLocations.js +53 -0
- package/dist/contentProjection.js +83 -0
- package/dist/contentRouteIdentity.js +13 -0
- package/dist/contentRouteMaterializer.js +97 -0
- package/dist/contentRouteTypes.js +39 -0
- package/dist/contentSeo.js +189 -0
- package/dist/contentTreePath.js +60 -0
- package/dist/contentType.js +208 -0
- package/dist/contentValues.js +18 -0
- package/dist/contentfulImport.js +162 -0
- package/dist/copies.js +89 -0
- package/dist/cutover.js +202 -0
- package/dist/deliveryChecks.js +138 -0
- package/dist/domainHost.js +7 -0
- package/dist/domains.js +139 -0
- package/dist/draftTexts.js +164 -0
- package/dist/duplicates.js +78 -0
- package/dist/edgePurge.js +69 -0
- package/dist/editHistory.js +113 -0
- package/dist/effectForm.js +11 -0
- package/dist/environmentAliases.js +138 -0
- package/dist/environments.js +147 -0
- package/dist/errors.js +107 -0
- package/dist/experiments.js +528 -0
- package/dist/exposure.js +28 -0
- package/dist/extensionManifest.js +81 -0
- package/dist/extensions.js +314 -0
- package/dist/fieldSchema.js +199 -0
- package/dist/formStrings.js +74 -0
- package/dist/frontendBindings.js +99 -0
- package/dist/frontendMedia.js +18 -0
- package/dist/glossary.js +73 -0
- package/dist/history.js +54 -0
- package/dist/htmlImport.js +297 -0
- package/dist/index.d.ts +771 -54
- package/dist/index.js +89 -6082
- package/dist/initializePublicRoutes.js +28 -0
- package/dist/liveContentRouteView.js +76 -0
- package/dist/media.js +29 -0
- package/dist/metrics.js +46 -0
- package/dist/migration.js +193 -0
- package/dist/migrationStages.js +13 -0
- package/dist/nativeOutputDeploymentService.js +205 -0
- package/dist/outputActivation.js +234 -0
- package/dist/outputActivationOrigin.js +51 -0
- package/dist/outputActivationStore.js +411 -0
- package/dist/outputActivationTables.js +11 -0
- package/dist/outputActivationTarget.js +81 -0
- package/dist/outputActivationTargetTable.js +25 -0
- package/dist/outputDeployment.js +174 -0
- package/dist/outputDeploymentRest.js +168 -0
- package/dist/outputDeploymentService.js +241 -0
- package/dist/outputRouteGraph.js +177 -0
- package/dist/outputSafetyArtifact.js +147 -0
- package/dist/outputTargetRest.js +62 -0
- package/dist/pathSegmentEncoding.js +4 -0
- package/dist/presenceAnchors.js +68 -0
- package/dist/preview.js +31 -0
- package/dist/privateCmsTransport.js +76 -0
- package/dist/privateNativeRouteReservation.js +10 -0
- package/dist/promotion.js +116 -0
- package/dist/publicBuild.js +90 -0
- package/dist/publicBuildRest.js +98 -0
- package/dist/publicBuildService.js +63 -0
- package/dist/publicOutputHttp.js +129 -0
- package/dist/publicOutputService.js +287 -0
- package/dist/publicPresentation.js +17 -0
- package/dist/publicRouteDispositionAdmission.js +38 -0
- package/dist/publicRouteHistoryStore.js +12 -0
- package/dist/publicRouteHistoryView.js +34 -0
- package/dist/publicRouteIntegrity.js +5 -0
- package/dist/publicRouteMutation.js +6 -0
- package/dist/publicRouteNamespace.js +134 -0
- package/dist/publicRoutePublication.js +36 -0
- package/dist/publicRouteRegistry.js +17 -0
- package/dist/publicRouteRegistryBinding.js +194 -0
- package/dist/publicRouteRegistryDefinition.js +76 -0
- package/dist/publicRouteSitePublication.js +40 -0
- package/dist/publicRouteTables.js +13 -0
- package/dist/publicRouteUrl.js +18 -0
- package/dist/publicationSeo.js +52 -0
- package/dist/publicationState.js +296 -0
- package/dist/quality.js +188 -0
- package/dist/reconfigurePublicRoutes.js +41 -0
- package/dist/recurrence.js +78 -0
- package/dist/redirects.js +130 -0
- package/dist/referenceGraph.js +224 -0
- package/dist/references.js +173 -0
- package/dist/release.js +241 -0
- package/dist/renderReadAuthority.js +43 -0
- package/dist/renderReadGrant.js +137 -0
- package/dist/rest.js +52 -0
- package/dist/review.js +160 -0
- package/dist/richDocument.js +521 -0
- package/dist/richInline.js +100 -0
- package/dist/routeDispositionGraph.js +44 -0
- package/dist/routeDispositionRest.js +51 -0
- package/dist/routeDispositionService.js +73 -0
- package/dist/routeDispositionStore.js +289 -0
- package/dist/routeDispositionTables.js +5 -0
- package/dist/routeDispositions.js +91 -0
- package/dist/routeHistoryStorage.js +320 -0
- package/dist/routeHistoryStore.js +12 -0
- package/dist/schedule.js +80 -0
- package/dist/search.js +148 -0
- package/dist/selectionIntent.js +164 -0
- package/dist/seo.js +31 -0
- package/dist/series.js +105 -0
- package/dist/share.js +112 -0
- package/dist/siteBindings.js +159 -0
- package/dist/siteBuildCandidate.js +104 -0
- package/dist/siteDelivery.js +115 -0
- package/dist/siteState.js +47 -0
- package/dist/snapshotAddressGraph.js +55 -0
- package/dist/snapshotAddressRead.js +73 -0
- package/dist/snapshotAppConsumer.js +71 -0
- package/dist/snapshotAppExecution.js +102 -0
- package/dist/snapshotApplication.js +75 -0
- package/dist/snapshotApprovedRouteDispositions.js +44 -0
- package/dist/snapshotAssetAssembly.js +70 -0
- package/dist/snapshotAssetAssemblyRest.js +50 -0
- package/dist/snapshotBindingRead.js +61 -0
- package/dist/snapshotCodeSeo.js +29 -0
- package/dist/snapshotComponent.js +34 -0
- package/dist/snapshotComponentSource.js +24 -0
- package/dist/snapshotConsumer.js +87 -0
- package/dist/snapshotContentIdentity.js +10 -0
- package/dist/snapshotDefinitions.js +264 -0
- package/dist/snapshotDocumentAssembly.js +193 -0
- package/dist/snapshotDocumentAssemblyRest.js +84 -0
- package/dist/snapshotDocumentProjection.js +202 -0
- package/dist/snapshotDocumentTransfer.js +35 -0
- package/dist/snapshotDocumentTransferRest.js +80 -0
- package/dist/snapshotDomains.js +56 -0
- package/dist/snapshotEnvironment.js +31 -0
- package/dist/snapshotFieldPlan.js +85 -0
- package/dist/snapshotFrontend.js +103 -0
- package/dist/snapshotLink.js +8 -0
- package/dist/snapshotMedia.js +111 -0
- package/dist/snapshotMediaCapture.js +246 -0
- package/dist/snapshotMediaFields.js +225 -0
- package/dist/snapshotMediaRead.js +185 -0
- package/dist/snapshotMediaReader.js +13 -0
- package/dist/snapshotObservation.js +16 -0
- package/dist/snapshotObservedRouteHistory.js +34 -0
- package/dist/snapshotOutputTransfer.js +78 -0
- package/dist/snapshotPageLoader.js +7 -0
- package/dist/snapshotPageSeo.js +59 -0
- package/dist/snapshotPathLocale.js +15 -0
- package/dist/snapshotPresentation.js +86 -0
- package/dist/snapshotPresentationPolicy.js +12 -0
- package/dist/snapshotProjection.js +119 -0
- package/dist/snapshotPublicAccess.js +161 -0
- package/dist/snapshotPublicRouteHistory.js +40 -0
- package/dist/snapshotReadAdmission.js +38 -0
- package/dist/snapshotRedirectOutput.js +151 -0
- package/dist/snapshotRedirectTargets.js +24 -0
- package/dist/snapshotRedirects.js +132 -0
- package/dist/snapshotReference.js +8 -0
- package/dist/snapshotReferenceAddress.js +10 -0
- package/dist/snapshotReferenceGraph.js +79 -0
- package/dist/snapshotReferenceRead.js +65 -0
- package/dist/snapshotRelease.js +99 -0
- package/dist/snapshotRender.js +361 -0
- package/dist/snapshotRenderDependencies.js +178 -0
- package/dist/snapshotRenditions.js +88 -0
- package/dist/snapshotRichDocument.js +62 -0
- package/dist/snapshotRoleTransfer.js +106 -0
- package/dist/snapshotRoleTransferRest.js +99 -0
- package/dist/snapshotRouteAdmission.js +71 -0
- package/dist/snapshotRouteDispatch.js +111 -0
- package/dist/snapshotRouteDispositionPlan.js +73 -0
- package/dist/snapshotRouteRead.js +43 -0
- package/dist/snapshotRoutes.js +79 -0
- package/dist/snapshotRouting.js +113 -0
- package/dist/snapshotSeo.js +179 -0
- package/dist/snapshotSeoControls.js +101 -0
- package/dist/snapshotSeoDocumentInventory.js +115 -0
- package/dist/snapshotSeoDocuments.js +129 -0
- package/dist/snapshotSeoMerge.js +85 -0
- package/dist/snapshotSeoMetadata.js +137 -0
- package/dist/snapshotSeoOutput.js +173 -0
- package/dist/snapshotSeoPathSets.js +105 -0
- package/dist/snapshotSeoRead.js +88 -0
- package/dist/snapshotSite.js +128 -0
- package/dist/snapshotSitemapFiles.js +36 -0
- package/dist/snapshotTreeDependencies.js +58 -0
- package/dist/snapshotTreeLoader.js +10 -0
- package/dist/snapshotTreeRead.js +158 -0
- package/dist/staticPathSet.js +177 -0
- package/dist/staticPathSetRest.js +129 -0
- package/dist/staticPathSetService.js +249 -0
- package/dist/staticPathSetStore.js +338 -0
- package/dist/stewardship.js +146 -0
- package/dist/taxonomy.js +36 -0
- package/dist/team.js +103 -0
- package/dist/templates.js +106 -0
- package/dist/trackChanges.js +197 -0
- package/dist/translation.js +64 -0
- package/dist/tree.js +87 -0
- package/dist/usage.js +50 -0
- package/dist/validation.js +192 -0
- package/dist/visualEditing.js +60 -0
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -2
- package/dist/workflow.js +322 -0
- package/dist/write.js +419 -0
- package/dist/xliff.js +325 -0
- package/package.json +20 -6
- package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { cmsPublicBuildMeta as e, encodeCmsPublicBuildIdentity as t } from "./publicBuild.js";
|
|
2
|
+
import { copySnapshotPresentationValue as n } from "./snapshotPresentation.js";
|
|
3
|
+
import { copySnapshotContentIdentity as r } from "./snapshotContentIdentity.js";
|
|
4
|
+
import { verifyRetainedSnapshotRoutes as i, verifySnapshotAppExecution as a } from "./snapshotAppExecution.js";
|
|
5
|
+
import { copySnapshotCodeSeo as o } from "./snapshotCodeSeo.js";
|
|
6
|
+
import { readSnapshotBindingMediaBatch as s, readSnapshotReferenceMediaBatch as c, readSnapshotRouteMediaBatch as ee } from "./snapshotMediaRead.js";
|
|
7
|
+
import { readSnapshotRenderRoute as l } from "./snapshotRouteDispatch.js";
|
|
8
|
+
import { snapshotRenderDependencies as te } from "./snapshotRenderDependencies.js";
|
|
9
|
+
import { snapshotTreeDependencies as ne } from "./snapshotTreeDependencies.js";
|
|
10
|
+
import { Effect as re, Schema as u, Stream as d } from "effect";
|
|
11
|
+
import { createHash as f } from "node:crypto";
|
|
12
|
+
import { canonicalJson as p } from "@voltro/runtime";
|
|
13
|
+
import { encodeNativeFormCapture as ie } from "@voltro/protocol";
|
|
14
|
+
//#region src/snapshotRender.ts
|
|
15
|
+
var m = class extends u.TaggedError()("SnapshotRenderUnavailable", { reason: u.Literals(["output", "changed"]) }) {}, h = (e) => {
|
|
16
|
+
throw new m({ reason: e });
|
|
17
|
+
}, g = (e) => f("sha256").update(p(e)).digest("hex"), _ = async (u, m, _, v, y) => {
|
|
18
|
+
let b = { ...m }, x = {
|
|
19
|
+
id: _.id,
|
|
20
|
+
digest: _.digest
|
|
21
|
+
}, S = {
|
|
22
|
+
...v,
|
|
23
|
+
presentation: n(v.presentation)
|
|
24
|
+
}, C = y.keys.map((e) => ({
|
|
25
|
+
id: e.id,
|
|
26
|
+
material: new Uint8Array(e.material)
|
|
27
|
+
})), w = y.output === void 0 ? void 0 : {
|
|
28
|
+
...y.output,
|
|
29
|
+
use: { ...y.output.use }
|
|
30
|
+
}, T = y.execution.run.bind(y.execution), E = y.now ?? Date.now, D = () => u.transactional((e) => l(e, b, x, S, {
|
|
31
|
+
keys: C,
|
|
32
|
+
now: E()
|
|
33
|
+
})), O = await D();
|
|
34
|
+
if (O === null) return null;
|
|
35
|
+
if (await i(O, T), O.context === void 0) return h("output");
|
|
36
|
+
let k = O.definitions.value.consentPurposes, A = w === void 0 ? null : await w.provider.begin();
|
|
37
|
+
try {
|
|
38
|
+
let n = [], i = O.owner === "cms" ? O.seo : null, l = [], m = Object.create(null), _ = Object.create(null), v = [];
|
|
39
|
+
if (O.owner === "cms") {
|
|
40
|
+
v.push({
|
|
41
|
+
source: null,
|
|
42
|
+
selections: O.media,
|
|
43
|
+
media: l
|
|
44
|
+
});
|
|
45
|
+
for (let [e, t] of Object.entries(O.bindings)) {
|
|
46
|
+
if (t === null) {
|
|
47
|
+
m[e] = null;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
let n = [];
|
|
51
|
+
m[e] = {
|
|
52
|
+
content: r(t.content),
|
|
53
|
+
context: O.context,
|
|
54
|
+
sourceLocale: t.output.sourceLocale,
|
|
55
|
+
fallback: t.output.fallback,
|
|
56
|
+
values: t.output.values,
|
|
57
|
+
media: n,
|
|
58
|
+
presentation: t.output.presentation,
|
|
59
|
+
consentPurposes: k
|
|
60
|
+
}, v.push({
|
|
61
|
+
source: e,
|
|
62
|
+
selections: t.media,
|
|
63
|
+
media: n
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
for (let [e, t] of Object.entries(O.referenceGraph.nodes)) {
|
|
67
|
+
let n = [];
|
|
68
|
+
_[e] = {
|
|
69
|
+
content: r(t.fields.content),
|
|
70
|
+
context: O.context,
|
|
71
|
+
sourceLocale: t.output.sourceLocale,
|
|
72
|
+
fallback: t.output.fallback,
|
|
73
|
+
values: t.output.values,
|
|
74
|
+
media: n,
|
|
75
|
+
presentation: t.output.presentation,
|
|
76
|
+
consentPurposes: k
|
|
77
|
+
}, v.push({
|
|
78
|
+
source: e,
|
|
79
|
+
reference: t.selection,
|
|
80
|
+
selections: t.fields.media,
|
|
81
|
+
media: n
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
let y = [], j = [], M = /* @__PURE__ */ new Set();
|
|
86
|
+
if (v.some((e) => e.selections.length > 0)) {
|
|
87
|
+
if (A === null || w === void 0 || w.use.channel !== O.context.channel) return h("output");
|
|
88
|
+
let e = {
|
|
89
|
+
keys: C,
|
|
90
|
+
now: E,
|
|
91
|
+
maxBytes: w.maxBytes,
|
|
92
|
+
use: w.use
|
|
93
|
+
};
|
|
94
|
+
for (let t of v) {
|
|
95
|
+
if (t.selections.length === 0) continue;
|
|
96
|
+
let r = () => t.reference === void 0 ? t.source === null ? ee(u, w.custody, b, x, S, t.selections, e) : s(u, w.custody, b, x, {
|
|
97
|
+
...S,
|
|
98
|
+
binding: t.source
|
|
99
|
+
}, t.selections, e) : c(u, w.custody, b, x, {
|
|
100
|
+
...S,
|
|
101
|
+
...t.reference
|
|
102
|
+
}, t.selections, e), i = await r();
|
|
103
|
+
if (i.length !== t.selections.length) return h("output");
|
|
104
|
+
let a = i.map(({ stream: e, ...t }) => t);
|
|
105
|
+
for (let e = 0; e < i.length; e++) {
|
|
106
|
+
let r = t.selections[e], { stream: a, ...o } = i[e];
|
|
107
|
+
y.push({
|
|
108
|
+
...o,
|
|
109
|
+
source: t.source,
|
|
110
|
+
selection: r,
|
|
111
|
+
use: w.use
|
|
112
|
+
});
|
|
113
|
+
let s = `__voltro/media/${x.digest}/${g(O.route.routeId)}/${o.binaryId}`, c = {
|
|
114
|
+
path: s,
|
|
115
|
+
digest: o.checksum,
|
|
116
|
+
size: o.size,
|
|
117
|
+
contentType: o.contentType
|
|
118
|
+
};
|
|
119
|
+
M.has(s) ? await re.runPromise(d.runDrain(a)) : (await A.write(c, d.toAsyncIterable(a)), n.push(c), M.add(s)), t.media.push({
|
|
120
|
+
...r,
|
|
121
|
+
url: "/" + s,
|
|
122
|
+
contentType: o.contentType
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
j.push(async () => {
|
|
126
|
+
let e = (await r()).map(({ stream: e, ...t }) => t);
|
|
127
|
+
if (p(e) !== p(a)) return h("changed");
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (O.owner === "cms" && O.image !== null) {
|
|
132
|
+
let e = l.find((e) => e.output.kind === "original" && p(e.fieldPath) === p(O.image.fieldPath));
|
|
133
|
+
if (e === void 0 || i === null || ![
|
|
134
|
+
"image/png",
|
|
135
|
+
"image/jpeg",
|
|
136
|
+
"image/webp",
|
|
137
|
+
"image/avif",
|
|
138
|
+
"image/gif"
|
|
139
|
+
].includes(e.contentType)) return h("output");
|
|
140
|
+
i = {
|
|
141
|
+
...i,
|
|
142
|
+
social: {
|
|
143
|
+
...i.social,
|
|
144
|
+
image: {
|
|
145
|
+
url: new URL(e.url, O.image.origin).href,
|
|
146
|
+
contentType: e.contentType
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
let N = async () => {
|
|
152
|
+
for (let e of j) await e();
|
|
153
|
+
}, P = O.owner === "code" ? O.route.code : O.page, F = O.owner === "cms" ? {
|
|
154
|
+
version: P === null ? 2 : 6,
|
|
155
|
+
context: O.context,
|
|
156
|
+
presentation: O.presentation,
|
|
157
|
+
consentPurposes: k,
|
|
158
|
+
sourceLocale: O.route.sourceLocale,
|
|
159
|
+
fallback: O.route.fallback,
|
|
160
|
+
path: O.route.path,
|
|
161
|
+
values: O.route.values,
|
|
162
|
+
...P === null ? {} : {
|
|
163
|
+
content: r(O.content ?? h("output")),
|
|
164
|
+
seo: i,
|
|
165
|
+
media: l,
|
|
166
|
+
bindings: m
|
|
167
|
+
}
|
|
168
|
+
} : null, I = {
|
|
169
|
+
version: 4,
|
|
170
|
+
addresses: O.owner === "cms" ? O.addressGraph.map((e) => ({
|
|
171
|
+
source: e.source,
|
|
172
|
+
fieldPath: e.fieldPath,
|
|
173
|
+
path: e.target?.output.path ?? null
|
|
174
|
+
})) : [],
|
|
175
|
+
nodes: _,
|
|
176
|
+
edges: O.owner === "cms" ? O.referenceGraph.edges : []
|
|
177
|
+
}, L = P !== null && O.web !== void 0 && (O.owner === "cms" || O.publicCode), R = P === null ? F : {
|
|
178
|
+
version: O.owner === "cms" ? L ? 9 : 7 : L ? 5 : 3,
|
|
179
|
+
file: P.file,
|
|
180
|
+
path: O.route.path,
|
|
181
|
+
locale: O.context.languageTag,
|
|
182
|
+
trees: O.trees,
|
|
183
|
+
...F === null ? {
|
|
184
|
+
context: O.context,
|
|
185
|
+
presentation: O.presentation,
|
|
186
|
+
consentPurposes: k
|
|
187
|
+
} : {
|
|
188
|
+
delivery: F,
|
|
189
|
+
references: I
|
|
190
|
+
},
|
|
191
|
+
...L ? { web: {
|
|
192
|
+
...O.web,
|
|
193
|
+
renderedAt: O.capturedAt,
|
|
194
|
+
source: ie(t({
|
|
195
|
+
version: 1,
|
|
196
|
+
snapshotDigest: x.digest,
|
|
197
|
+
inputsId: O.inputsId,
|
|
198
|
+
executionId: O.executionId
|
|
199
|
+
}), g(O.presentation))
|
|
200
|
+
} } : {}
|
|
201
|
+
}, z = P === null ? "render" : O.owner === "code" ? "__voltro_renderPage" : "__voltro_renderCmsPage", B = P !== null && O.owner === "cms" ? [{
|
|
202
|
+
tag: "cms.snapshot.route",
|
|
203
|
+
inputDigest: g({ path: O.route.path }),
|
|
204
|
+
valueDigest: g(F)
|
|
205
|
+
}] : [], V = await T({
|
|
206
|
+
inputsId: O.inputsId,
|
|
207
|
+
executionId: O.executionId,
|
|
208
|
+
exportName: z,
|
|
209
|
+
inputJson: p(R)
|
|
210
|
+
}), H, U, W = null, G = null, K = null, q = null;
|
|
211
|
+
if (P !== null) {
|
|
212
|
+
if (V.value === null || typeof V.value != "object" || Array.isArray(V.value)) return h("output");
|
|
213
|
+
let e = V.value, t = O.owner === "cms" ? (L ? "document," : "") + "file,head,html,locale,observations,path,pattern,reads,version" + (L ? ",web" : "") : (L ? "document," : "") + "file,head,html,locale,path,pattern,reads," + (L ? "seo," : "") + "version" + (L ? ",web" : "");
|
|
214
|
+
if (Object.keys(e).sort().join(",") !== t || e.version !== (O.owner === "cms" ? L ? 9 : 7 : L ? 5 : 3) || e.file !== P.file || e.path !== O.route.path || e.pattern !== P.pattern || e.locale !== O.context.languageTag || typeof e.html != "string" || typeof e.head != "string") return h("output");
|
|
215
|
+
if (L) {
|
|
216
|
+
if (typeof e.document != "string" || p(e.web) !== p(O.web)) return h("output");
|
|
217
|
+
if (W = e.document, O.owner === "code") try {
|
|
218
|
+
G = o(e.seo);
|
|
219
|
+
} catch {
|
|
220
|
+
return h("output");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!Array.isArray(e.reads) || O.owner === "cms" && p(e.reads.slice(0, 1)) !== p(B)) return h("output");
|
|
224
|
+
let n;
|
|
225
|
+
try {
|
|
226
|
+
let t = ne({
|
|
227
|
+
reads: O.owner === "cms" ? e.reads.slice(1) : e.reads,
|
|
228
|
+
trees: O.trees,
|
|
229
|
+
owner: O.owner,
|
|
230
|
+
snapshotDigest: x.digest,
|
|
231
|
+
inputsId: O.inputsId,
|
|
232
|
+
executionId: O.executionId,
|
|
233
|
+
routeId: O.route.routeId,
|
|
234
|
+
path: O.route.path,
|
|
235
|
+
context: O.context
|
|
236
|
+
});
|
|
237
|
+
q = t.graph, n = t.references;
|
|
238
|
+
} catch {
|
|
239
|
+
return h("output");
|
|
240
|
+
}
|
|
241
|
+
if (O.owner === "cms") {
|
|
242
|
+
if (O.content === null) return h("output");
|
|
243
|
+
try {
|
|
244
|
+
K = te({
|
|
245
|
+
referenceReads: n,
|
|
246
|
+
references: I,
|
|
247
|
+
referenceGraph: O.referenceGraph,
|
|
248
|
+
addressGraph: O.addressGraph,
|
|
249
|
+
observations: e.observations,
|
|
250
|
+
data: F,
|
|
251
|
+
fields: O.dependencies,
|
|
252
|
+
frontend: O.definitions.value.frontend,
|
|
253
|
+
snapshotDigest: x.digest,
|
|
254
|
+
inputsId: O.inputsId,
|
|
255
|
+
executionId: O.executionId,
|
|
256
|
+
routeId: O.route.routeId,
|
|
257
|
+
content: O.content,
|
|
258
|
+
bindings: O.bindings,
|
|
259
|
+
assets: y
|
|
260
|
+
});
|
|
261
|
+
} catch {
|
|
262
|
+
return h("output");
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
B = e.reads, H = e.html, U = e.head;
|
|
266
|
+
} else {
|
|
267
|
+
if (typeof V.value != "string") return h("output");
|
|
268
|
+
H = V.value, U = "";
|
|
269
|
+
}
|
|
270
|
+
if (W !== null) {
|
|
271
|
+
let t = W.indexOf("</head>");
|
|
272
|
+
if (t < 0 || W.indexOf("</head>", t + 7) >= 0 || /<meta\b[^>]*\bname\s*=\s*["']voltro:cms-build["']/i.test(W.slice(0, t))) return h("output");
|
|
273
|
+
let n = e({
|
|
274
|
+
version: 1,
|
|
275
|
+
snapshotDigest: x.digest,
|
|
276
|
+
inputsId: O.inputsId,
|
|
277
|
+
executionId: O.executionId
|
|
278
|
+
});
|
|
279
|
+
W = W.slice(0, t) + n + W.slice(t), U += "\n" + n;
|
|
280
|
+
}
|
|
281
|
+
if (Buffer.byteLength(H) + Buffer.byteLength(U) + (W === null ? 0 : Buffer.byteLength(W)) > 4194304) return h("output");
|
|
282
|
+
let ae = a(O, z, R, V), J = await D();
|
|
283
|
+
if (J === null || p(J) !== p(O)) return h("changed");
|
|
284
|
+
await N();
|
|
285
|
+
let Y = {
|
|
286
|
+
version: L ? O.owner === "code" ? 13 : 12 : 10,
|
|
287
|
+
owner: O.owner,
|
|
288
|
+
...L ? { pageFile: P?.file ?? h("output") } : {},
|
|
289
|
+
reads: B,
|
|
290
|
+
dependencies: K,
|
|
291
|
+
queryDependencies: q,
|
|
292
|
+
web: O.web ?? null,
|
|
293
|
+
...G === null ? {} : { codeSeoDigest: g(G) },
|
|
294
|
+
presentation: O.presentation,
|
|
295
|
+
consentPurposes: k,
|
|
296
|
+
documentDigest: W === null ? null : f("sha256").update(W).digest("hex"),
|
|
297
|
+
snapshotId: x.id,
|
|
298
|
+
snapshotDigest: x.digest,
|
|
299
|
+
consumerId: S.consumerId,
|
|
300
|
+
buildId: S.buildId,
|
|
301
|
+
routeId: O.route.routeId,
|
|
302
|
+
path: O.route.path,
|
|
303
|
+
contentDigest: O.owner === "cms" ? g(O.route.values) : null,
|
|
304
|
+
inputDigest: g(R),
|
|
305
|
+
outputDigest: g({
|
|
306
|
+
html: H,
|
|
307
|
+
head: U,
|
|
308
|
+
document: W,
|
|
309
|
+
...G === null ? {} : { codeSeo: G }
|
|
310
|
+
}),
|
|
311
|
+
inputsId: O.inputsId,
|
|
312
|
+
executionId: O.executionId,
|
|
313
|
+
runnerDigest: ae.runnerDigest
|
|
314
|
+
};
|
|
315
|
+
if (A === null) return {
|
|
316
|
+
html: H,
|
|
317
|
+
head: U,
|
|
318
|
+
document: W,
|
|
319
|
+
receipt: Y
|
|
320
|
+
};
|
|
321
|
+
let X = [["body.html", H], ["head.html", U]];
|
|
322
|
+
W !== null && X.push(["document.html", W]);
|
|
323
|
+
for (let [e, t] of X) {
|
|
324
|
+
let r = Buffer.from(t), i = {
|
|
325
|
+
path: e,
|
|
326
|
+
size: r.byteLength,
|
|
327
|
+
digest: f("sha256").update(r).digest("hex"),
|
|
328
|
+
contentType: "text/html"
|
|
329
|
+
};
|
|
330
|
+
await A.write(i, (async function* () {
|
|
331
|
+
yield r;
|
|
332
|
+
})()), n.push(i);
|
|
333
|
+
}
|
|
334
|
+
let Z = await D();
|
|
335
|
+
if (Z === null || p(Z) !== p(O)) return h("changed");
|
|
336
|
+
await N();
|
|
337
|
+
let Q = {
|
|
338
|
+
receipt: Y,
|
|
339
|
+
assets: y,
|
|
340
|
+
...G === null ? {} : { codeSeo: G }
|
|
341
|
+
}, $ = await A.seal(Q), oe = g({
|
|
342
|
+
version: 1,
|
|
343
|
+
subject: Q,
|
|
344
|
+
files: n.sort((e, t) => e.path < t.path ? -1 : +(e.path > t.path))
|
|
345
|
+
});
|
|
346
|
+
if ($.id !== oe) return h("output");
|
|
347
|
+
await N();
|
|
348
|
+
let se = await D();
|
|
349
|
+
return se === null || p(se) !== p(O) ? h("changed") : {
|
|
350
|
+
html: H,
|
|
351
|
+
head: U,
|
|
352
|
+
document: W,
|
|
353
|
+
receipt: Y,
|
|
354
|
+
output: $
|
|
355
|
+
};
|
|
356
|
+
} catch (e) {
|
|
357
|
+
throw await A?.abort(), e;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
//#endregion
|
|
361
|
+
export { m as SnapshotRenderUnavailable, _ as renderSnapshotRoute };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { admitSnapshotPresentation as e, copySnapshotConsentPurposes as t } from "./snapshotPresentation.js";
|
|
2
|
+
import { copySnapshotContentIdentity as n } from "./snapshotContentIdentity.js";
|
|
3
|
+
import { snapshotProjectedValue as r } from "./snapshotObservation.js";
|
|
4
|
+
import { createHash as i } from "node:crypto";
|
|
5
|
+
import { canonicalJson as a } from "@voltro/runtime";
|
|
6
|
+
//#region src/snapshotRenderDependencies.ts
|
|
7
|
+
var o = () => {
|
|
8
|
+
throw Error("Snapshot dependencies unavailable");
|
|
9
|
+
}, s = (e) => i("sha256").update(a(e)).digest("hex"), c = (e) => typeof e != "object" || !e || Array.isArray(e) ? o() : e, l = (e, t) => a(e) === a(t), u = (e, t) => e.length > t.length && t.every((t, n) => t === e[n]), d = (i) => {
|
|
10
|
+
if (i.data.version !== 6 || i.references.version !== 4 || !l(i.data.presentation, e(i.data.consentPurposes, i.data.presentation)) || !l(i.data.consentPurposes, t(i.data.consentPurposes)) || !l(i.data.content, n(i.content)) || !l(Object.keys(i.bindings).sort(), Object.keys(i.data.bindings).sort()) || !l(Object.keys(i.references.nodes).sort(), Object.keys(i.referenceGraph.nodes).sort()) || !l(i.references.edges, i.referenceGraph.edges) || !l(i.references.addresses, i.addressGraph.map((e) => ({
|
|
11
|
+
source: e.source,
|
|
12
|
+
fieldPath: e.fieldPath,
|
|
13
|
+
path: e.target?.output.path ?? null
|
|
14
|
+
})))) return o();
|
|
15
|
+
let d = /* @__PURE__ */ new Map(), f = c(i.observations);
|
|
16
|
+
if (Object.keys(f).sort().join(",") !== "coverage,events,selectiveReuse,version" || f.version !== 5 || f.coverage !== "framework-observations" || f.selectiveReuse !== !1 || !Array.isArray(f.events) || f.events.length > 4096) return o();
|
|
17
|
+
let p = [], m = s(i.data.context), h = "";
|
|
18
|
+
for (let e of f.events) {
|
|
19
|
+
let t = c(e), n = t.kind, f = t.fieldPath, m = a(t), g = n === "component" ? "componentId,contextDigest,fieldPath,handler,kind,renderer,source,valueDigest" : n === "media" ? "contextDigest,fieldPath,kind,output,source,valueDigest" : n === "rich-document" || n === "reference" || n === "link" ? "contextDigest,fieldPath,kind,source,valueDigest" : "";
|
|
20
|
+
if (g === "" || Object.keys(t).sort().join(",") !== g || m <= h || !Array.isArray(f) || f.some((e) => typeof e == "number" ? !Number.isSafeInteger(e) || e < 0 : typeof e != "string" || e.length === 0 || e.length > 256)) return o();
|
|
21
|
+
h = m;
|
|
22
|
+
let _ = t.source;
|
|
23
|
+
if (_ !== null && (typeof _ != "string" || !Object.hasOwn(i.bindings, _) && !Object.hasOwn(i.referenceGraph.nodes, _))) return o();
|
|
24
|
+
let v = typeof _ == "string" && Object.hasOwn(i.referenceGraph.nodes, _), y = _ === null ? i.data : v ? i.references.nodes[_] : i.data.bindings[_], b = _ === null ? {
|
|
25
|
+
dependencies: i.fields,
|
|
26
|
+
content: i.content
|
|
27
|
+
} : v ? i.referenceGraph.nodes[_]?.fields : i.bindings[_];
|
|
28
|
+
if (y == null || b == null) return o();
|
|
29
|
+
let x = r(y, f);
|
|
30
|
+
if (t.valueDigest !== s(x) || t.contextDigest !== s(y.context)) return o();
|
|
31
|
+
if (n === "reference") {
|
|
32
|
+
let e = i.referenceGraph.edges.find((e) => e.source === _ && l(e.fieldPath, f));
|
|
33
|
+
if (e === void 0) return o();
|
|
34
|
+
let n = e.target === null ? null : i.references.nodes[e.target], r = e.target === null ? null : i.referenceGraph.nodes[e.target]?.fields;
|
|
35
|
+
if (n === void 0 || r === void 0) return o();
|
|
36
|
+
let c = {
|
|
37
|
+
source: _,
|
|
38
|
+
fieldPath: f
|
|
39
|
+
}, u = s(n);
|
|
40
|
+
d.set("reference:" + a(c), {
|
|
41
|
+
tag: "cms.snapshot.reference",
|
|
42
|
+
inputDigest: s(c),
|
|
43
|
+
valueDigest: u
|
|
44
|
+
}), p.push({
|
|
45
|
+
...t,
|
|
46
|
+
target: e.target,
|
|
47
|
+
targetContent: r?.content ?? null,
|
|
48
|
+
targetDigest: u
|
|
49
|
+
});
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (n === "link") {
|
|
53
|
+
let e = i.addressGraph.find((e) => e.source === _ && l(e.fieldPath, f));
|
|
54
|
+
if (e === void 0) return o();
|
|
55
|
+
let n = {
|
|
56
|
+
source: _,
|
|
57
|
+
fieldPath: f
|
|
58
|
+
}, r = s(e.target?.output.path ?? null);
|
|
59
|
+
d.set("link:" + a(n), {
|
|
60
|
+
tag: "cms.snapshot.link",
|
|
61
|
+
inputDigest: s(n),
|
|
62
|
+
valueDigest: r
|
|
63
|
+
}), p.push({
|
|
64
|
+
...t,
|
|
65
|
+
mappingId: e.mappingId,
|
|
66
|
+
targetDigest: r,
|
|
67
|
+
targetRoute: e.target?.output ?? null,
|
|
68
|
+
targetContent: e.target?.document ?? null
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (n === "media") {
|
|
73
|
+
let e = y.media.find((e) => l(e.fieldPath, f) && l(e.output, t.output)), n = i.assets.find((e) => e.source === _ && l(e.selection.fieldPath, f) && l(e.selection.output, t.output));
|
|
74
|
+
if (e === void 0 || n === void 0) return o();
|
|
75
|
+
p.push({
|
|
76
|
+
...t,
|
|
77
|
+
binaryId: n.binaryId,
|
|
78
|
+
checksum: n.checksum,
|
|
79
|
+
assetVersionId: n.assetVersionId
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
let S = b.dependencies.find((e) => e.kind === n && l(e.path, f));
|
|
84
|
+
if (S === void 0) return o();
|
|
85
|
+
if (S.kind === "rich-document") {
|
|
86
|
+
let e = b.dependencies.filter((e) => e.kind === "token" && u(e.path, f) && !b.dependencies.some((t) => t.kind === "component" && u(e.path, [...t.path, "props"])));
|
|
87
|
+
p.push({
|
|
88
|
+
...t,
|
|
89
|
+
definitionDigest: S.digest,
|
|
90
|
+
tokenInputs: e.map((e) => ({
|
|
91
|
+
...e,
|
|
92
|
+
valueDigest: s(r(y, e.path))
|
|
93
|
+
}))
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (S.kind !== "component") return o();
|
|
98
|
+
let C = i.frontend.components.find((e) => e.id === S.componentId), w = c(x), T = t.handler;
|
|
99
|
+
if (C === void 0 || C.digest !== S.digest || C.renderer !== t.renderer || S.componentId !== t.componentId || w.componentId !== S.componentId || w.fingerprint !== S.fingerprint || (S.consent !== null && !i.data.presentation.granted.some((e) => e.id === S.consent) ? T !== "restricted" || C.restricted === null || Object.keys(c(w.props)).length !== 0 : ![
|
|
100
|
+
"render",
|
|
101
|
+
"empty",
|
|
102
|
+
"loading",
|
|
103
|
+
"error"
|
|
104
|
+
].includes(String(T)))) return o();
|
|
105
|
+
let E = T === "render" ? b.dependencies.filter((e) => e.kind === "token" && u(e.path, [...f, "props"])) : [];
|
|
106
|
+
p.push({
|
|
107
|
+
...t,
|
|
108
|
+
definitionDigest: S.digest,
|
|
109
|
+
implementationDigest: s(C[T]),
|
|
110
|
+
tokenInputs: E.map((e) => ({
|
|
111
|
+
...e,
|
|
112
|
+
valueDigest: s(r(y, e.path))
|
|
113
|
+
}))
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
let g = /* @__PURE__ */ new Set([null, ...Object.keys(i.bindings)]);
|
|
117
|
+
for (let e = 0; e <= Object.keys(i.referenceGraph.nodes).length; e++) {
|
|
118
|
+
let e = !1;
|
|
119
|
+
for (let t of p) t.kind === "reference" && g.has(t.source) && typeof t.target == "string" && !g.has(t.target) && (g.add(t.target), e = !0);
|
|
120
|
+
if (!e) break;
|
|
121
|
+
}
|
|
122
|
+
if (p.some((e) => !g.has(e.source))) return o();
|
|
123
|
+
let _ = [...d].sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([, e]) => e);
|
|
124
|
+
return l(i.referenceReads, _) ? {
|
|
125
|
+
version: 6,
|
|
126
|
+
coverage: "framework-observations",
|
|
127
|
+
selectiveReuse: !1,
|
|
128
|
+
inputs: {
|
|
129
|
+
snapshotDigest: i.snapshotDigest,
|
|
130
|
+
inputsId: i.inputsId,
|
|
131
|
+
executionId: i.executionId,
|
|
132
|
+
routeId: i.routeId,
|
|
133
|
+
path: i.data.path,
|
|
134
|
+
contextDigest: m,
|
|
135
|
+
presentation: i.data.presentation,
|
|
136
|
+
consentPurposes: i.data.consentPurposes,
|
|
137
|
+
content: i.content,
|
|
138
|
+
contentDigest: s(i.data.values),
|
|
139
|
+
deliveryDigest: s(i.data),
|
|
140
|
+
addresses: i.addressGraph.map((e) => ({
|
|
141
|
+
source: e.source,
|
|
142
|
+
fieldPath: e.fieldPath,
|
|
143
|
+
mappingId: e.mappingId,
|
|
144
|
+
target: e.target === null ? null : {
|
|
145
|
+
address: e.target.output,
|
|
146
|
+
content: e.target.document,
|
|
147
|
+
ancestors: e.target.ancestors,
|
|
148
|
+
definitionDigest: s(e.target.schema),
|
|
149
|
+
routeDigest: s(e.target.route)
|
|
150
|
+
}
|
|
151
|
+
})),
|
|
152
|
+
references: {
|
|
153
|
+
deliveryDigest: s(i.references),
|
|
154
|
+
edges: i.references.edges,
|
|
155
|
+
nodes: Object.fromEntries(Object.entries(i.referenceGraph.nodes).map(([e, t]) => {
|
|
156
|
+
let r = i.references.nodes[e];
|
|
157
|
+
return r === void 0 || !l(r.content, n(t.fields.content)) || !l(r.values, t.output.values) || r.sourceLocale !== t.output.sourceLocale || r.fallback !== t.output.fallback || !l(r.context, i.data.context) || !l(r.presentation, t.output.presentation) || !l(r.presentation, i.data.presentation) || !l(r.consentPurposes, i.data.consentPurposes) ? o() : [e, {
|
|
158
|
+
content: t.fields.content,
|
|
159
|
+
contextDigest: s(r.context),
|
|
160
|
+
contentDigest: s(r.values),
|
|
161
|
+
deliveryDigest: s(r)
|
|
162
|
+
}];
|
|
163
|
+
}))
|
|
164
|
+
},
|
|
165
|
+
bindings: Object.fromEntries(Object.entries(i.bindings).map(([e, t]) => {
|
|
166
|
+
let r = i.data.bindings[e];
|
|
167
|
+
return !Object.hasOwn(i.data.bindings, e) || t === null != (r === null) || t !== null && r != null && (!l(r.content, n(t.content)) || !l(r.presentation, i.data.presentation) || !l(r.consentPurposes, i.data.consentPurposes)) ? o() : [e, r == null || t === null ? null : {
|
|
168
|
+
content: t.content,
|
|
169
|
+
contextDigest: s(r.context),
|
|
170
|
+
contentDigest: s(r.values)
|
|
171
|
+
}];
|
|
172
|
+
}))
|
|
173
|
+
},
|
|
174
|
+
events: p
|
|
175
|
+
} : o();
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
export { d as snapshotRenderDependencies };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readPublicationBoundary as e } from "./changes.js";
|
|
2
|
+
import { copySnapshotResource as t } from "./buildSnapshot.js";
|
|
3
|
+
import { readAssetRendition as n, readAssetRenditionSelection as r } from "./assetRenditions.js";
|
|
4
|
+
import { Schema as i } from "effect";
|
|
5
|
+
import { canonicalJson as a } from "@voltro/runtime";
|
|
6
|
+
//#region src/snapshotRenditions.ts
|
|
7
|
+
var o = class extends i.TaggedError()("SnapshotRenditionUnavailable", { reason: i.Literals([
|
|
8
|
+
"configuration",
|
|
9
|
+
"publication",
|
|
10
|
+
"missing",
|
|
11
|
+
"asset",
|
|
12
|
+
"recipe"
|
|
13
|
+
]) }) {}, s = (e) => {
|
|
14
|
+
throw new o({ reason: e });
|
|
15
|
+
}, c = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && e.trim() === e, l = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), u = (e, t) => {
|
|
16
|
+
let { definitionDigest: n, ...r } = e, { definitionDigest: i, ...o } = t;
|
|
17
|
+
return a(r) === a(o);
|
|
18
|
+
}, d = (e) => {
|
|
19
|
+
if (!Array.isArray(e) || e.length > 64) return s("configuration");
|
|
20
|
+
let t = e.map((e) => !e || !c(e.contentType) || e.contentType.length > 64 || !c(e.slot) || e.slot.length > 64 || !e.recipe || !c(e.recipe.format) || !l(e.recipe.digest) || !e.engine || !c(e.engine.name) || !c(e.engine.version) || !l(e.engine.digest) ? s("configuration") : {
|
|
21
|
+
contentType: e.contentType,
|
|
22
|
+
slot: e.slot,
|
|
23
|
+
recipe: {
|
|
24
|
+
format: e.recipe.format,
|
|
25
|
+
digest: e.recipe.digest
|
|
26
|
+
},
|
|
27
|
+
engine: {
|
|
28
|
+
name: e.engine.name,
|
|
29
|
+
version: e.engine.version,
|
|
30
|
+
digest: e.engine.digest
|
|
31
|
+
}
|
|
32
|
+
}).sort((e, t) => {
|
|
33
|
+
let n = a([e.contentType, e.slot]), r = a([t.contentType, t.slot]);
|
|
34
|
+
return n < r ? -1 : +(n > r);
|
|
35
|
+
});
|
|
36
|
+
return new Set(t.map((e) => a([e.contentType, e.slot]))).size === t.length ? t : s("configuration");
|
|
37
|
+
}, f = (i, o, c, l) => {
|
|
38
|
+
let f = {
|
|
39
|
+
tenantId: o.tenantId,
|
|
40
|
+
site: o.site,
|
|
41
|
+
environment: o.environment
|
|
42
|
+
};
|
|
43
|
+
if (c.format !== "voltro.cms.media-uses/v1") return s("configuration");
|
|
44
|
+
let p = d(l);
|
|
45
|
+
return {
|
|
46
|
+
format: "voltro.cms.media-renditions/v1",
|
|
47
|
+
entries: async function* (o) {
|
|
48
|
+
let l = await e(i, f);
|
|
49
|
+
if (l.generation !== o.generation || l.releaseId !== o.releaseId || l.checkpoint !== o.checkpoint) return s("publication");
|
|
50
|
+
for await (let e of c.entries(o)) {
|
|
51
|
+
if (e.key === "configuration") {
|
|
52
|
+
let n = e.value.types;
|
|
53
|
+
if (!Array.isArray(n) || p.some((e) => !n.includes(e.contentType))) return s("configuration");
|
|
54
|
+
yield t({
|
|
55
|
+
...e,
|
|
56
|
+
value: {
|
|
57
|
+
...e.value,
|
|
58
|
+
renditionRequirements: p
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
let o = e.value.assetRevision, c = [];
|
|
64
|
+
if (o !== void 0) for (let e of p.filter((e) => e.contentType === o.contentType)) {
|
|
65
|
+
let t = await r(i, f, o.versionId, e.slot);
|
|
66
|
+
if (t === null || t.renditionId === null) return s("missing");
|
|
67
|
+
let l = await n(i, f, t.renditionId);
|
|
68
|
+
if (!u(o, l.asset)) return s("asset");
|
|
69
|
+
let d = l.output.renditionProof;
|
|
70
|
+
if (a(d.recipe) !== a(e.recipe) || a(d.engine) !== a(e.engine)) return s("recipe");
|
|
71
|
+
c.push({
|
|
72
|
+
selection: t,
|
|
73
|
+
rendition: l
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
yield t({
|
|
77
|
+
...e,
|
|
78
|
+
value: {
|
|
79
|
+
...e.value,
|
|
80
|
+
renditions: c
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { o as SnapshotRenditionUnavailable, d as copySnapshotRenditionRequirements, f as snapshotRenditionsSource };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { richDocumentProblems as e } from "./richDocument.js";
|
|
2
|
+
import { createFrontendMediaReader as t } from "./frontendMedia.js";
|
|
3
|
+
import { snapshotObserver as n, snapshotProjectedValue as r } from "./snapshotObservation.js";
|
|
4
|
+
import { renderSnapshotComponent as i } from "./snapshotComponent.js";
|
|
5
|
+
//#region src/snapshotRichDocument.ts
|
|
6
|
+
var a = () => {
|
|
7
|
+
throw Error("Snapshot rich document unavailable");
|
|
8
|
+
}, o = (o, s, c) => {
|
|
9
|
+
let l = r(o, s), u = n(o), d = [...s];
|
|
10
|
+
if (typeof l != "object" || !l || Array.isArray(l)) return a();
|
|
11
|
+
let f = l;
|
|
12
|
+
if (f.type !== "doc" || !Array.isArray(f.blocks)) return a();
|
|
13
|
+
let p = f.blocks.map((e) => {
|
|
14
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return a();
|
|
15
|
+
let t = e;
|
|
16
|
+
if (t.type !== "component" || t.consentRequired === void 0) return t;
|
|
17
|
+
if (c.bindings[String(t.componentId)]?.schema.consent !== t.consentRequired || t.props === null || typeof t.props != "object" || Object.keys(t.props).length !== 0) return a();
|
|
18
|
+
let { consentRequired: n, ...r } = t;
|
|
19
|
+
return r;
|
|
20
|
+
}), m = {
|
|
21
|
+
...f,
|
|
22
|
+
blocks: p
|
|
23
|
+
};
|
|
24
|
+
if (e("", m, {
|
|
25
|
+
images: "*",
|
|
26
|
+
links: "*"
|
|
27
|
+
}).some((e) => e.rule === "type" || e.rule === "unknown")) return a();
|
|
28
|
+
u({
|
|
29
|
+
kind: "rich-document",
|
|
30
|
+
fieldPath: d
|
|
31
|
+
});
|
|
32
|
+
let h = t(o.media, d, (e) => u({
|
|
33
|
+
kind: "media",
|
|
34
|
+
...e
|
|
35
|
+
})), g = (e, t = { kind: "original" }) => h([
|
|
36
|
+
"blocks",
|
|
37
|
+
e,
|
|
38
|
+
"asset"
|
|
39
|
+
], t) ?? a();
|
|
40
|
+
return {
|
|
41
|
+
document: m,
|
|
42
|
+
hrefOf: (e, { fieldPath: t }) => c.hrefOf?.([...d, ...t]) ?? void 0,
|
|
43
|
+
contactHrefOf: (e, { fieldPath: t }) => c.contactHrefOf?.([...d, ...t]) ?? void 0,
|
|
44
|
+
renderImage: (e, { index: t }) => c.renderImage(e, g(t, c.imageOutput), {
|
|
45
|
+
index: t,
|
|
46
|
+
fieldPath: [
|
|
47
|
+
...d,
|
|
48
|
+
"blocks",
|
|
49
|
+
t,
|
|
50
|
+
"asset"
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
fileHrefOf: (e, { index: t }) => g(t).url,
|
|
54
|
+
renderComponent: (e, { index: t }) => i(o, c.bindings, [
|
|
55
|
+
...d,
|
|
56
|
+
"blocks",
|
|
57
|
+
t
|
|
58
|
+
])
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { o as snapshotRichDocumentProps };
|