@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,164 @@
|
|
|
1
|
+
import { normalizeRichDocument as e } from "./richDocument.js";
|
|
2
|
+
import { inlineText as t, mergeInline as n, sliceInline as r } from "./richInline.js";
|
|
3
|
+
//#region src/selectionIntent.ts
|
|
4
|
+
var i = /^[A-Za-z0-9_.:-]{1,120}$/, a = (e) => typeof e == "object" && !!e && !Array.isArray(e), o = (e) => typeof e == "string" && i.test(e), s = (e) => Number.isInteger(e) && e >= 0 && e <= 1e6, c = (e) => typeof e == "string" && /^\/(?![/\\])[^\s]*$/.test(e) && e.length <= 2e3, l = (e) => {
|
|
5
|
+
if (!a(e) || !o(e.id) || !o(e.pick) || !c(e.returnTo) || !a(e.target)) return null;
|
|
6
|
+
let t = e.target;
|
|
7
|
+
if (!o(t.type) || !o(t.field)) return null;
|
|
8
|
+
let n = t.documentId !== void 0 || t.revisionId !== void 0;
|
|
9
|
+
if ((n ? !(o(t.documentId) && o(t.revisionId)) || t.formId !== void 0 : !o(t.formId)) || t.instanceId !== void 0 != (t.prop !== void 0) || t.instanceId !== void 0 && (!o(t.instanceId) || !o(t.prop) || t.blockId !== void 0) || t.locale !== void 0 && !o(t.locale) || t.blockId !== void 0 && !o(t.blockId)) return null;
|
|
10
|
+
let r = t.selection;
|
|
11
|
+
return r !== void 0 && !(a(r) && s(r.start) && s(r.end) && r.end > r.start && t.blockId !== void 0) || e.label !== void 0 && (typeof e.label != "string" || e.label.length > 200) || e.kind !== void 0 && !o(e.kind) ? null : {
|
|
12
|
+
id: e.id,
|
|
13
|
+
pick: e.pick,
|
|
14
|
+
returnTo: e.returnTo,
|
|
15
|
+
...typeof e.label == "string" ? { label: e.label } : {},
|
|
16
|
+
...typeof e.kind == "string" ? { kind: e.kind } : {},
|
|
17
|
+
target: {
|
|
18
|
+
type: t.type,
|
|
19
|
+
field: t.field,
|
|
20
|
+
...n ? {
|
|
21
|
+
documentId: t.documentId,
|
|
22
|
+
revisionId: t.revisionId
|
|
23
|
+
} : { formId: t.formId },
|
|
24
|
+
...t.instanceId === void 0 ? {} : {
|
|
25
|
+
instanceId: t.instanceId,
|
|
26
|
+
prop: t.prop
|
|
27
|
+
},
|
|
28
|
+
...t.locale === void 0 ? {} : { locale: t.locale },
|
|
29
|
+
...t.blockId === void 0 ? {} : { blockId: t.blockId },
|
|
30
|
+
...a(r) ? { selection: {
|
|
31
|
+
start: r.start,
|
|
32
|
+
end: r.end
|
|
33
|
+
} } : {}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, u = (e) => {
|
|
37
|
+
let t = new TextEncoder().encode(e), n = "";
|
|
38
|
+
for (let e of t) n += String.fromCharCode(e);
|
|
39
|
+
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
40
|
+
}, d = (e) => {
|
|
41
|
+
try {
|
|
42
|
+
let t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
|
|
43
|
+
return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(t, (e) => e.charCodeAt(0)));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}, f = (e) => u(JSON.stringify(e)), p = (e) => {
|
|
48
|
+
if (e == null || e === "" || e.length > 6e3) return null;
|
|
49
|
+
let t = d(e);
|
|
50
|
+
if (t === null) return null;
|
|
51
|
+
try {
|
|
52
|
+
return l(JSON.parse(t));
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}, m = (e, i, a, o) => {
|
|
57
|
+
if (e.type !== "paragraph" && e.type !== "heading") return null;
|
|
58
|
+
let s = e.content, c = t(s).length;
|
|
59
|
+
if (a === void 0 || a.end > c) {
|
|
60
|
+
if (o === void 0 || o === "") return null;
|
|
61
|
+
let r = c === 0 || /\s$/.test(t(s)) ? [] : [{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: " "
|
|
64
|
+
}];
|
|
65
|
+
return {
|
|
66
|
+
...e,
|
|
67
|
+
content: n([
|
|
68
|
+
...s,
|
|
69
|
+
...r,
|
|
70
|
+
{
|
|
71
|
+
type: "link",
|
|
72
|
+
target: i,
|
|
73
|
+
text: o
|
|
74
|
+
}
|
|
75
|
+
])
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
let l = t(s).slice(a.start, a.end);
|
|
79
|
+
return {
|
|
80
|
+
...e,
|
|
81
|
+
content: n([
|
|
82
|
+
...r(s, 0, a.start),
|
|
83
|
+
{
|
|
84
|
+
type: "link",
|
|
85
|
+
target: i,
|
|
86
|
+
text: l
|
|
87
|
+
},
|
|
88
|
+
...r(s, a.end, c)
|
|
89
|
+
])
|
|
90
|
+
};
|
|
91
|
+
}, h = (t, n, r, i) => {
|
|
92
|
+
if (r.intentId !== n.id) return {
|
|
93
|
+
ok: !1,
|
|
94
|
+
reason: "otherIntent"
|
|
95
|
+
};
|
|
96
|
+
let { target: a } = n;
|
|
97
|
+
if (a.formId !== void 0) {
|
|
98
|
+
if (i.formId !== a.formId) return {
|
|
99
|
+
ok: !1,
|
|
100
|
+
reason: "otherDocument"
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
if (i.documentId !== a.documentId) return {
|
|
104
|
+
ok: !1,
|
|
105
|
+
reason: "otherDocument"
|
|
106
|
+
};
|
|
107
|
+
if (i.revisionId !== a.revisionId) return {
|
|
108
|
+
ok: !1,
|
|
109
|
+
reason: "revisionMoved"
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (a.instanceId !== void 0 && a.prop !== void 0) {
|
|
113
|
+
let e = Array.isArray(t[a.field]) ? t[a.field] : [], n = e.findIndex((e) => e.instanceId === a.instanceId);
|
|
114
|
+
if (n < 0) return {
|
|
115
|
+
ok: !1,
|
|
116
|
+
reason: "targetGone"
|
|
117
|
+
};
|
|
118
|
+
let i = a.prop;
|
|
119
|
+
return {
|
|
120
|
+
ok: !0,
|
|
121
|
+
values: {
|
|
122
|
+
...t,
|
|
123
|
+
[a.field]: e.map((e, t) => t === n ? {
|
|
124
|
+
...e,
|
|
125
|
+
props: {
|
|
126
|
+
...e.props,
|
|
127
|
+
[i]: r.documentId
|
|
128
|
+
}
|
|
129
|
+
} : e)
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (a.blockId === void 0) return {
|
|
134
|
+
ok: !0,
|
|
135
|
+
values: {
|
|
136
|
+
...t,
|
|
137
|
+
[a.field]: r.documentId
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
let o = e(t[a.field] ?? ""), s = Array.isArray(o.blocks) ? o.blocks.findIndex((e) => e.id === a.blockId) : -1;
|
|
141
|
+
if (s < 0) return {
|
|
142
|
+
ok: !1,
|
|
143
|
+
reason: "targetGone"
|
|
144
|
+
};
|
|
145
|
+
let c = o.blocks[s], l = c.type === "image" || c.type === "file" ? {
|
|
146
|
+
...c,
|
|
147
|
+
asset: r.documentId
|
|
148
|
+
} : m(c, r.documentId, a.selection, r.title);
|
|
149
|
+
return l === null ? {
|
|
150
|
+
ok: !1,
|
|
151
|
+
reason: "targetGone"
|
|
152
|
+
} : {
|
|
153
|
+
ok: !0,
|
|
154
|
+
values: {
|
|
155
|
+
...t,
|
|
156
|
+
[a.field]: {
|
|
157
|
+
...o,
|
|
158
|
+
blocks: o.blocks.map((e, t) => t === s ? l : e)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
export { h as applySelection, p as decodeSelectionIntent, f as encodeSelectionIntent, l as parseSelectionIntent };
|
package/dist/seo.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/seo.ts
|
|
2
|
+
var e = (e, t) => e.nodes.find((e) => e.documentId === t && !e.fallback), t = (t, n) => t.flatMap((t) => {
|
|
3
|
+
let r = e(t.tree, n);
|
|
4
|
+
return r === void 0 ? [] : [{
|
|
5
|
+
locale: t.locale,
|
|
6
|
+
path: r.path
|
|
7
|
+
}];
|
|
8
|
+
}), n = (e) => {
|
|
9
|
+
let t = e instanceof Date ? e : typeof e == "string" || typeof e == "number" ? new Date(e) : null;
|
|
10
|
+
return t === null || Number.isNaN(t.getTime()) ? null : t.toISOString();
|
|
11
|
+
}, r = (e, r = () => !0) => e.flatMap((i) => i.tree.nodes.filter((e) => !e.fallback && r(e)).map((a) => ({
|
|
12
|
+
locale: i.locale,
|
|
13
|
+
path: a.path,
|
|
14
|
+
documentId: a.documentId,
|
|
15
|
+
lastmod: n(a.row.updatedAt),
|
|
16
|
+
alternates: t(e, a.documentId).filter((t) => {
|
|
17
|
+
let n = e.find((e) => e.locale === t.locale)?.tree.nodes.find((e) => e.documentId === a.documentId);
|
|
18
|
+
return n !== void 0 && r(n);
|
|
19
|
+
})
|
|
20
|
+
}))), i = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), a = (e, t, n) => `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">\n${e.map((e) => {
|
|
21
|
+
let r = e.alternates.length > 1 || e.alternates.some((e) => e.locale === "x-default") ? [...e.alternates.map((e) => ` <xhtml:link rel="alternate" hreflang="${i(e.locale)}" href="${i(t(e.locale, e.path))}" />`), ...e.alternates.filter((t) => t.locale === n && !e.alternates.some((e) => e.locale === "x-default")).map((e) => ` <xhtml:link rel="alternate" hreflang="x-default" href="${i(t(e.locale, e.path))}" />`)] : [], a = e.lastmod === null ? [] : [` <lastmod>${e.lastmod}</lastmod>`];
|
|
22
|
+
return [
|
|
23
|
+
" <url>",
|
|
24
|
+
` <loc>${i(t(e.locale, e.path))}</loc>`,
|
|
25
|
+
...a,
|
|
26
|
+
...r,
|
|
27
|
+
" </url>"
|
|
28
|
+
].join("\n");
|
|
29
|
+
}).join("\n")}\n</urlset>\n`;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { t as alternatesOf, r as sitemapUrls, a as sitemapXml };
|
package/dist/series.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ContentNotFound as e, ContentValidationFailed as t } from "./errors.js";
|
|
2
|
+
import { asTyped as n } from "./effectForm.js";
|
|
3
|
+
import { scopeColumns as r } from "./write.js";
|
|
4
|
+
import { occurrencesOf as i, recurrenceProblems as a } from "./recurrence.js";
|
|
5
|
+
import { and as o, eq as s, id as c, integer as l, json as u, table as d, text as f } from "@voltro/database";
|
|
6
|
+
import { tenant as p } from "@voltro/plugin-multitenancy/mixin";
|
|
7
|
+
//#region src/series.ts
|
|
8
|
+
var m = "cms_publish_series", h = d(m, {
|
|
9
|
+
id: c({ prefix: "cser" }),
|
|
10
|
+
contentType: f().maxLength(64),
|
|
11
|
+
draftId: f(),
|
|
12
|
+
rule: u(),
|
|
13
|
+
armed: l().default(-1),
|
|
14
|
+
state: f().oneOf(["running", "done"]).default("running")
|
|
15
|
+
}).with(p()).unique("cms_publish_series_uq_draft", ["tenantId", "draftId"]), g = (e, t, n) => e.query({
|
|
16
|
+
table: t,
|
|
17
|
+
predicate: n,
|
|
18
|
+
order: [],
|
|
19
|
+
take: void 0,
|
|
20
|
+
skip: void 0,
|
|
21
|
+
projection: void 0
|
|
22
|
+
}), _ = (e) => `${e.name}_drafts`, v = (e) => {
|
|
23
|
+
let t = e.rule;
|
|
24
|
+
return {
|
|
25
|
+
id: String(e.id),
|
|
26
|
+
rule: t,
|
|
27
|
+
occurrences: i(t),
|
|
28
|
+
armed: Number(e.armed),
|
|
29
|
+
state: e.state === "done" ? "done" : "running"
|
|
30
|
+
};
|
|
31
|
+
}, y = async (e, t) => {
|
|
32
|
+
let [n] = await g(e, m, s("draftId", t));
|
|
33
|
+
return n === void 0 ? null : v(n);
|
|
34
|
+
}, b = async (e, t, n, r, i, a) => {
|
|
35
|
+
let o = r.findIndex((e, t) => t > i && e.endsAt.getTime() > a.getTime());
|
|
36
|
+
if (o === -1) return -1;
|
|
37
|
+
let s = r[o];
|
|
38
|
+
return await e.update(_(t), n, {
|
|
39
|
+
publishAt: s.startsAt,
|
|
40
|
+
unpublishAt: s.endsAt
|
|
41
|
+
}), o;
|
|
42
|
+
}, x = async (n, c, l, u, d, f = /* @__PURE__ */ new Date()) => {
|
|
43
|
+
let p = a(d);
|
|
44
|
+
if (p.length > 0) throw new t({
|
|
45
|
+
contentType: c.name,
|
|
46
|
+
violations: p.map((e) => ({
|
|
47
|
+
field: "repeat",
|
|
48
|
+
rule: "recurrence",
|
|
49
|
+
message: e
|
|
50
|
+
}))
|
|
51
|
+
});
|
|
52
|
+
let [h] = await g(n, _(c), o(s("id", l), ...Object.entries(r(u)).map(([e, t]) => s(e, t))));
|
|
53
|
+
if (h === void 0) throw new e({
|
|
54
|
+
contentType: c.name,
|
|
55
|
+
id: l,
|
|
56
|
+
stage: "draft"
|
|
57
|
+
});
|
|
58
|
+
let y = await b(n, c, l, i(d), -1, f);
|
|
59
|
+
if (y === -1) throw new t({
|
|
60
|
+
contentType: c.name,
|
|
61
|
+
violations: [{
|
|
62
|
+
field: "repeat",
|
|
63
|
+
rule: "recurrence",
|
|
64
|
+
message: "every occurrence of this series is over"
|
|
65
|
+
}]
|
|
66
|
+
});
|
|
67
|
+
for (let e of await g(n, m, s("draftId", l))) await n.delete(m, String(e.id));
|
|
68
|
+
let x = h.tenantId !== void 0 && h.tenantId !== null ? { tenantId: h.tenantId } : {};
|
|
69
|
+
return v(await n.insert(m, {
|
|
70
|
+
contentType: c.name,
|
|
71
|
+
draftId: l,
|
|
72
|
+
rule: d,
|
|
73
|
+
armed: y,
|
|
74
|
+
state: "running",
|
|
75
|
+
...x
|
|
76
|
+
}));
|
|
77
|
+
}, S = async (e, t, n) => {
|
|
78
|
+
let r = await g(e, m, s("draftId", n));
|
|
79
|
+
if (r.length === 0) return !1;
|
|
80
|
+
for (let t of r) await e.delete(m, String(t.id));
|
|
81
|
+
let [i] = await g(e, _(t), s("id", n));
|
|
82
|
+
return i !== void 0 && await e.update(_(t), n, {
|
|
83
|
+
publishAt: null,
|
|
84
|
+
unpublishAt: null
|
|
85
|
+
}), !0;
|
|
86
|
+
}, C = async (e, t, n = /* @__PURE__ */ new Date()) => {
|
|
87
|
+
let r = [];
|
|
88
|
+
for (let a of await g(e, m, o(s("contentType", t.name), s("state", "running")))) {
|
|
89
|
+
let o = String(a.draftId);
|
|
90
|
+
await e.transactional(async (e) => {
|
|
91
|
+
let [c] = await g(e, _(t), s("id", o));
|
|
92
|
+
if (c === void 0) {
|
|
93
|
+
await e.delete(m, String(a.id));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let l = (e) => e != null;
|
|
97
|
+
if (l(c.publishAt) || l(c.unpublishAt)) return;
|
|
98
|
+
let u = await b(e, t, o, i(a.rule), Number(a.armed), n);
|
|
99
|
+
await e.update(m, String(a.id), u === -1 ? { state: "done" } : { armed: u }), u !== -1 && r.push(o);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return r;
|
|
103
|
+
}, w = [e, t], T = (...e) => n(() => C(...e), ...w), E = (...e) => n(() => S(...e), ...w), D = (...e) => n(() => x(...e), ...w), O = (...e) => n(() => y(...e), ...w);
|
|
104
|
+
//#endregion
|
|
105
|
+
export { m as CMS_PUBLISH_SERIES_TABLE, C as advanceSeries, T as advanceSeriesEffect, S as cancelSeries, E as cancelSeriesEffect, h as cmsPublishSeriesTable, x as scheduleSeries, D as scheduleSeriesEffect, y as seriesOf, O as seriesOfEffect };
|
package/dist/share.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ContentNotFound as e, PreviewShareRejected as t } from "./errors.js";
|
|
2
|
+
import { asTyped as n } from "./effectForm.js";
|
|
3
|
+
import { CMS_REVISIONS_TABLE as r } from "./contentType.js";
|
|
4
|
+
import { and as i, eq as a, id as o, table as s, text as c, timestamp as l } from "@voltro/database";
|
|
5
|
+
import { tenant as u } from "@voltro/plugin-multitenancy/mixin";
|
|
6
|
+
import { createHash as d, randomBytes as f } from "node:crypto";
|
|
7
|
+
//#region src/share.ts
|
|
8
|
+
var p = "cms_preview_shares", m = 30, h = s(p, {
|
|
9
|
+
id: o({ prefix: "cshr" }),
|
|
10
|
+
contentType: c().maxLength(64),
|
|
11
|
+
variantId: c().maxLength(64),
|
|
12
|
+
documentId: c().maxLength(64),
|
|
13
|
+
site: c().maxLength(64),
|
|
14
|
+
environment: c().maxLength(64),
|
|
15
|
+
locale: c().maxLength(64),
|
|
16
|
+
revisionId: c().nullable(),
|
|
17
|
+
tokenHash: c().unique(),
|
|
18
|
+
label: c().nullable(),
|
|
19
|
+
expiresAt: l(),
|
|
20
|
+
revokedAt: l().nullable()
|
|
21
|
+
}).with(u()), g = (e) => d("sha256").update(e, "utf8").digest("hex"), _ = async (e, t, n, r = !1) => (await e.query({
|
|
22
|
+
table: t,
|
|
23
|
+
predicate: n,
|
|
24
|
+
order: [],
|
|
25
|
+
take: 1,
|
|
26
|
+
skip: void 0,
|
|
27
|
+
projection: void 0,
|
|
28
|
+
...r ? { crossTenant: !0 } : {}
|
|
29
|
+
}))[0], v = async (n, r, o, s, c) => {
|
|
30
|
+
let l = c.now ?? /* @__PURE__ */ new Date();
|
|
31
|
+
if (c.expiresAt.getTime() <= l.getTime()) throw new t({ reason: "expiryInPast" });
|
|
32
|
+
if (c.expiresAt.getTime() > l.getTime() + 2592e6) throw new t({ reason: "expiryTooFar" });
|
|
33
|
+
let u = await _(n, `${r.name}_drafts`, i(a("id", o), a("site", s.site), a("environment", s.environment), a("locale", s.locale)));
|
|
34
|
+
if (u === void 0) throw new e({
|
|
35
|
+
contentType: r.name,
|
|
36
|
+
id: o,
|
|
37
|
+
stage: "draft"
|
|
38
|
+
});
|
|
39
|
+
let d = f(32).toString("base64url");
|
|
40
|
+
return {
|
|
41
|
+
share: await n.insert(p, {
|
|
42
|
+
contentType: r.name,
|
|
43
|
+
variantId: o,
|
|
44
|
+
documentId: u.documentId,
|
|
45
|
+
site: s.site,
|
|
46
|
+
environment: s.environment,
|
|
47
|
+
locale: s.locale,
|
|
48
|
+
revisionId: c.revision === "pinned" ? u.revisionId : null,
|
|
49
|
+
tokenHash: g(d),
|
|
50
|
+
label: c.label ?? null,
|
|
51
|
+
expiresAt: c.expiresAt,
|
|
52
|
+
revokedAt: null
|
|
53
|
+
}),
|
|
54
|
+
token: d
|
|
55
|
+
};
|
|
56
|
+
}, y = async (e, t, n = /* @__PURE__ */ new Date()) => {
|
|
57
|
+
let o = await _(e, p, a("tokenHash", g(t)), !0);
|
|
58
|
+
if (o === void 0) return {
|
|
59
|
+
ok: !1,
|
|
60
|
+
reason: "unknown"
|
|
61
|
+
};
|
|
62
|
+
if (o.revokedAt !== null && o.revokedAt !== void 0) return {
|
|
63
|
+
ok: !1,
|
|
64
|
+
reason: "revoked"
|
|
65
|
+
};
|
|
66
|
+
if (new Date(o.expiresAt).getTime() <= n.getTime()) return {
|
|
67
|
+
ok: !1,
|
|
68
|
+
reason: "expired"
|
|
69
|
+
};
|
|
70
|
+
let s = o.tenantId, c = (e, t) => i(a(e, t), a("tenantId", s)), l = o.revisionId;
|
|
71
|
+
if (l === null) {
|
|
72
|
+
let t = await _(e, `${String(o.contentType)}_drafts`, c("id", o.variantId), !0);
|
|
73
|
+
if (t === void 0) return {
|
|
74
|
+
ok: !1,
|
|
75
|
+
reason: "unknown"
|
|
76
|
+
};
|
|
77
|
+
l = t.revisionId;
|
|
78
|
+
}
|
|
79
|
+
let u = await _(e, r, i(c("id", l), a("documentId", o.documentId), a("contentType", o.contentType)), !0);
|
|
80
|
+
return u === void 0 ? {
|
|
81
|
+
ok: !1,
|
|
82
|
+
reason: "unknown"
|
|
83
|
+
} : {
|
|
84
|
+
ok: !0,
|
|
85
|
+
share: o,
|
|
86
|
+
contentType: o.contentType,
|
|
87
|
+
locale: o.locale,
|
|
88
|
+
revisionId: l,
|
|
89
|
+
revision: u.number,
|
|
90
|
+
values: u.values ?? {}
|
|
91
|
+
};
|
|
92
|
+
}, b = async (t, n, r = /* @__PURE__ */ new Date()) => {
|
|
93
|
+
let i = await _(t, p, a("id", n));
|
|
94
|
+
if (i === void 0) throw new e({
|
|
95
|
+
contentType: p,
|
|
96
|
+
id: n,
|
|
97
|
+
stage: "share"
|
|
98
|
+
});
|
|
99
|
+
(i.revokedAt === null || i.revokedAt === void 0) && await t.update(p, n, { revokedAt: r });
|
|
100
|
+
}, x = (e, t, n) => e.query({
|
|
101
|
+
table: p,
|
|
102
|
+
predicate: i(a("contentType", t.name), a("documentId", n)),
|
|
103
|
+
order: [{
|
|
104
|
+
column: "createdAt",
|
|
105
|
+
direction: "desc"
|
|
106
|
+
}],
|
|
107
|
+
take: void 0,
|
|
108
|
+
skip: void 0,
|
|
109
|
+
projection: void 0
|
|
110
|
+
}), S = [e, t], C = (...e) => n(() => v(...e), ...S), w = (...e) => n(() => x(...e), ...S), T = (...e) => n(() => y(...e), ...S), E = (...e) => n(() => b(...e), ...S);
|
|
111
|
+
//#endregion
|
|
112
|
+
export { p as CMS_PREVIEW_SHARES_TABLE, m as MAX_PREVIEW_SHARE_DAYS, h as cmsPreviewSharesTable, v as createPreviewShare, C as createPreviewShareEffect, x as listPreviewShares, w as listPreviewSharesEffect, y as resolvePreviewShare, T as resolvePreviewShareEffect, b as revokePreviewShare, E as revokePreviewShareEffect };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { ChangeFeedUnavailable as e, SiteBindingUnavailable as t } from "./errors.js";
|
|
2
|
+
import { asTyped as n } from "./effectForm.js";
|
|
3
|
+
import { invalidatePublicationRelease as r, lockPublicationStream as i } from "./changes.js";
|
|
4
|
+
import { and as a, eq as o, generateId as s, id as c, table as l, text as u } from "@voltro/database";
|
|
5
|
+
import { tenant as d } from "@voltro/plugin-multitenancy/mixin";
|
|
6
|
+
//#region src/siteBindings.ts
|
|
7
|
+
var f = "cms_site_bindings", p = "cms_site_binding_revisions", m = l(f, {
|
|
8
|
+
id: c({ prefix: "csbi" }),
|
|
9
|
+
site: u().maxLength(64),
|
|
10
|
+
environment: u().maxLength(64),
|
|
11
|
+
name: u().maxLength(64),
|
|
12
|
+
contentType: u().maxLength(64),
|
|
13
|
+
documentId: u().maxLength(64),
|
|
14
|
+
revisionId: u().maxLength(64)
|
|
15
|
+
}).with(d()).unique("cms_site_binding_scope", [
|
|
16
|
+
"tenantId",
|
|
17
|
+
"site",
|
|
18
|
+
"environment",
|
|
19
|
+
"name"
|
|
20
|
+
]), h = l(p, {
|
|
21
|
+
id: c({ prefix: "csbr" }),
|
|
22
|
+
site: u().maxLength(64),
|
|
23
|
+
environment: u().maxLength(64),
|
|
24
|
+
bindingId: u().maxLength(64),
|
|
25
|
+
contentType: u().maxLength(64),
|
|
26
|
+
documentId: u().maxLength(64),
|
|
27
|
+
previousRevisionId: u().maxLength(64).nullable(),
|
|
28
|
+
sourceRevisionId: u().maxLength(64).nullable()
|
|
29
|
+
}).with(d()), g = (e) => {
|
|
30
|
+
throw new t({ reason: e });
|
|
31
|
+
}, _ = (e) => typeof e == "string" && e.length > 0 && e.length <= 64 && e.trim() === e, v = (e) => typeof e == "string" && /^[a-z][a-z0-9_-]{0,63}$/.test(e), y = (e) => e === null || _(e), b = (e) => [
|
|
32
|
+
e.tenantId,
|
|
33
|
+
e.site,
|
|
34
|
+
e.environment
|
|
35
|
+
].every(_) ? {
|
|
36
|
+
tenantId: e.tenantId,
|
|
37
|
+
site: e.site,
|
|
38
|
+
environment: e.environment
|
|
39
|
+
} : g("scope"), x = (e) => a(o("tenantId", e.tenantId), o("site", e.site), o("environment", e.environment)), S = (e, t) => {
|
|
40
|
+
let n = s({
|
|
41
|
+
kind: "typeid",
|
|
42
|
+
prefix: e
|
|
43
|
+
}, t);
|
|
44
|
+
return n === null ? g("state") : String(n);
|
|
45
|
+
}, C = (e) => ![
|
|
46
|
+
e.id,
|
|
47
|
+
e.contentType,
|
|
48
|
+
e.documentId,
|
|
49
|
+
e.revisionId
|
|
50
|
+
].every(_) || !v(e.name) ? g("state") : {
|
|
51
|
+
id: String(e.id),
|
|
52
|
+
name: e.name,
|
|
53
|
+
contentType: String(e.contentType),
|
|
54
|
+
documentId: String(e.documentId),
|
|
55
|
+
revisionId: String(e.revisionId)
|
|
56
|
+
}, w = async (e, t, n, r) => {
|
|
57
|
+
let i = b(t);
|
|
58
|
+
if (!v(n)) return g("name");
|
|
59
|
+
let [s] = await e.query({
|
|
60
|
+
table: f,
|
|
61
|
+
predicate: a(x(i), o("name", n)),
|
|
62
|
+
...r === void 0 ? {} : { lock: r },
|
|
63
|
+
order: [],
|
|
64
|
+
take: 1,
|
|
65
|
+
skip: void 0,
|
|
66
|
+
projection: void 0
|
|
67
|
+
});
|
|
68
|
+
return s;
|
|
69
|
+
}, T = async (e, t, n) => {
|
|
70
|
+
let r = await w(e, t, n);
|
|
71
|
+
return r === void 0 ? null : C(r);
|
|
72
|
+
}, E = async (e, t, n) => {
|
|
73
|
+
let r = b(t);
|
|
74
|
+
await i(e, r);
|
|
75
|
+
let a = await w(e, r, n, "update");
|
|
76
|
+
return a === void 0 ? g("missing") : C(a);
|
|
77
|
+
}, D = async (e, t, n, r, i) => {
|
|
78
|
+
let s = t.filter((e) => e.name === r);
|
|
79
|
+
if (s.length !== 1 || !_(r) || !_(i)) return g("target");
|
|
80
|
+
let [c] = await e.query({
|
|
81
|
+
table: `${s[0].name}_published`,
|
|
82
|
+
predicate: a(x(n), o("documentId", i), o("status", "published")),
|
|
83
|
+
lock: "update",
|
|
84
|
+
order: [],
|
|
85
|
+
take: 1,
|
|
86
|
+
skip: void 0,
|
|
87
|
+
projection: ["id"]
|
|
88
|
+
});
|
|
89
|
+
if (c === void 0) return g("target");
|
|
90
|
+
}, O = async (e, t, n, i, a, o) => {
|
|
91
|
+
let s = {
|
|
92
|
+
id: i?.id ?? S("csbi", "cms_site_bindings"),
|
|
93
|
+
name: n,
|
|
94
|
+
contentType: a.contentType,
|
|
95
|
+
documentId: a.documentId,
|
|
96
|
+
revisionId: S("csbr", p)
|
|
97
|
+
};
|
|
98
|
+
return await e.insert(p, {
|
|
99
|
+
id: s.revisionId,
|
|
100
|
+
...t,
|
|
101
|
+
bindingId: s.id,
|
|
102
|
+
contentType: s.contentType,
|
|
103
|
+
documentId: s.documentId,
|
|
104
|
+
previousRevisionId: i?.revisionId ?? null,
|
|
105
|
+
sourceRevisionId: o
|
|
106
|
+
}), i === null ? await e.insert(f, {
|
|
107
|
+
...t,
|
|
108
|
+
...s
|
|
109
|
+
}) : await e.update(f, i.id, {
|
|
110
|
+
contentType: s.contentType,
|
|
111
|
+
documentId: s.documentId,
|
|
112
|
+
revisionId: s.revisionId
|
|
113
|
+
}), await r(e, t), s;
|
|
114
|
+
}, k = async (e, t, n, r, a) => {
|
|
115
|
+
let o = b(n), s = a.expectedRevisionId, c = {
|
|
116
|
+
contentType: a.contentType,
|
|
117
|
+
documentId: a.documentId
|
|
118
|
+
};
|
|
119
|
+
if (!y(s)) return g("conflict");
|
|
120
|
+
await i(e, o);
|
|
121
|
+
let l = await w(e, o, r, "update"), u = l === void 0 ? null : C(l);
|
|
122
|
+
return (u?.revisionId ?? null) === s ? (await D(e, t, o, c.contentType, c.documentId), u?.contentType === c.contentType && u.documentId === c.documentId ? u : O(e, o, r, u, c, null)) : g("conflict");
|
|
123
|
+
}, A = async (e, t, n, r) => {
|
|
124
|
+
let i = b(t);
|
|
125
|
+
if (!_(r)) return g("revision");
|
|
126
|
+
let s = await w(e, i, n);
|
|
127
|
+
if (s === void 0) return g("missing");
|
|
128
|
+
let [c] = await e.query({
|
|
129
|
+
table: p,
|
|
130
|
+
predicate: a(x(i), o("bindingId", String(s.id)), o("id", r)),
|
|
131
|
+
lock: "update",
|
|
132
|
+
order: [],
|
|
133
|
+
take: 1,
|
|
134
|
+
skip: void 0,
|
|
135
|
+
projection: void 0
|
|
136
|
+
});
|
|
137
|
+
return c === void 0 ? g("revision") : ![
|
|
138
|
+
c.id,
|
|
139
|
+
c.bindingId,
|
|
140
|
+
c.contentType,
|
|
141
|
+
c.documentId
|
|
142
|
+
].every(_) || !y(c.previousRevisionId) || !y(c.sourceRevisionId) ? g("state") : {
|
|
143
|
+
id: String(c.id),
|
|
144
|
+
bindingId: String(c.bindingId),
|
|
145
|
+
contentType: String(c.contentType),
|
|
146
|
+
documentId: String(c.documentId),
|
|
147
|
+
previousRevisionId: c.previousRevisionId,
|
|
148
|
+
sourceRevisionId: c.sourceRevisionId
|
|
149
|
+
};
|
|
150
|
+
}, j = async (e, t, n, r, a) => {
|
|
151
|
+
let o = b(n), s = a.expectedRevisionId, c = a.revisionId;
|
|
152
|
+
await i(e, o);
|
|
153
|
+
let l = await w(e, o, r, "update"), u = l === void 0 ? g("missing") : C(l);
|
|
154
|
+
if (!_(s) || u.revisionId !== s) return g("conflict");
|
|
155
|
+
let d = await A(e, o, r, c);
|
|
156
|
+
return await D(e, t, o, d.contentType, d.documentId), O(e, o, r, u, d, d.id);
|
|
157
|
+
}, M = (...e) => n(() => T(...e), t), N = (...r) => n(() => k(...r), t, e), P = (...e) => n(() => A(...e), t), F = (...r) => n(() => j(...r), t, e);
|
|
158
|
+
//#endregion
|
|
159
|
+
export { f as CMS_SITE_BINDINGS_TABLE, p as CMS_SITE_BINDING_REVISIONS_TABLE, k as bindSiteContent, N as bindSiteContentEffect, h as cmsSiteBindingRevisionsTable, m as cmsSiteBindingsTable, E as lockSiteContentBinding, j as rollbackSiteContentBinding, F as rollbackSiteContentBindingEffect, T as siteContentBinding, M as siteContentBindingEffect, A as siteContentBindingRevision, P as siteContentBindingRevisionEffect };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { compileSiteDelivery as e } from "./siteDelivery.js";
|
|
2
|
+
import { copySiteScope as t, lockSiteState as n } from "./siteState.js";
|
|
3
|
+
import { captureBuildSnapshot as r, copySnapshotResource as i } from "./buildSnapshot.js";
|
|
4
|
+
import { compileSnapshotRouting as a } from "./snapshotRouting.js";
|
|
5
|
+
import { copySnapshotAppCodePin as o, snapshotDefinitionSources as s } from "./snapshotDefinitions.js";
|
|
6
|
+
import { snapshotPublicAccessSource as c } from "./snapshotPublicAccess.js";
|
|
7
|
+
import { snapshotProjectionSource as l } from "./snapshotProjection.js";
|
|
8
|
+
import { snapshotRenditionsSource as u } from "./snapshotRenditions.js";
|
|
9
|
+
import { snapshotSiteSources as d } from "./snapshotSite.js";
|
|
10
|
+
import { snapshotCaptureApplicationPins as f } from "./snapshotApplication.js";
|
|
11
|
+
import { snapshotEnvironmentSource as p } from "./snapshotEnvironment.js";
|
|
12
|
+
import { snapshotDomainSource as m } from "./snapshotDomains.js";
|
|
13
|
+
import { snapshotReleaseSource as h } from "./snapshotRelease.js";
|
|
14
|
+
import { snapshotContentRoutesSource as g } from "./snapshotRoutes.js";
|
|
15
|
+
import { lockOutputRouteHistoryCapture as _ } from "./outputActivationStore.js";
|
|
16
|
+
import { snapshotRedirectSource as v } from "./snapshotRedirects.js";
|
|
17
|
+
import { snapshotMediaUsesSource as y } from "./snapshotMedia.js";
|
|
18
|
+
import { snapshotMediaSelectionSource as b } from "./snapshotMediaCapture.js";
|
|
19
|
+
import { deriveSnapshotSeoMetadata as x } from "./snapshotSeoMetadata.js";
|
|
20
|
+
import { Schema as S } from "effect";
|
|
21
|
+
import { canonicalJson as C } from "@voltro/runtime";
|
|
22
|
+
//#region src/siteBuildCandidate.ts
|
|
23
|
+
var w = class extends S.TaggedError()("SiteBuildCandidateUnavailable", { reason: S.Literals(["scope", "app"]) }) {}, T = (e) => {
|
|
24
|
+
throw new w({ reason: e });
|
|
25
|
+
}, E = (e, t, n, r) => {
|
|
26
|
+
if (e.format !== "voltro.app.build-inputs/v1") return T("app");
|
|
27
|
+
let a = e.entries;
|
|
28
|
+
return {
|
|
29
|
+
format: e.format,
|
|
30
|
+
entries: async function* (e) {
|
|
31
|
+
let o, s = 0;
|
|
32
|
+
for await (let c of a(e)) {
|
|
33
|
+
let e = i(c);
|
|
34
|
+
if (o === void 0) {
|
|
35
|
+
if (e.key !== "configuration" || e.value.version !== 1 || C(e.value.app) !== C(t) || typeof e.value.inputsId != "string" || !/^[a-f0-9]{64}$/.test(e.value.inputsId) || !Number.isSafeInteger(e.value.files) || Number(e.value.files) < 0) return T("app");
|
|
36
|
+
o = Number(e.value.files);
|
|
37
|
+
let i = e.value.execution, a = i?.definitions;
|
|
38
|
+
if (a !== void 0 && (typeof a != "object" || !a || Array.isArray(a) || !("value" in a) || C(a.value) !== C(n))) return T("app");
|
|
39
|
+
let s = i?.routes;
|
|
40
|
+
if (s !== void 0 && (typeof s != "object" || !s || Array.isArray(s) || !("value" in s) || C(s.value) !== C(r)) || r !== null && s === void 0) return T("app");
|
|
41
|
+
} else if (!/^file:[a-f0-9]{64}$/.test(e.key) || ++s > o) return T("app");
|
|
42
|
+
yield e;
|
|
43
|
+
}
|
|
44
|
+
if (o === void 0 || s !== o) return T("app");
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, D = async (i, S) => {
|
|
48
|
+
let C = {
|
|
49
|
+
...t(S.scope),
|
|
50
|
+
environment: S.scope.environment
|
|
51
|
+
}, w = e(S.site), D = o(S.code), O = S.now ?? Date.now(), { alias: k, releaseId: A, expiresAt: j, xDefault: M, custody: N } = S;
|
|
52
|
+
if (C.site !== w.definition.id || !w.definition.environments.includes(C.environment)) return T("scope");
|
|
53
|
+
let P = S.types.map((e) => ({
|
|
54
|
+
...e,
|
|
55
|
+
fields: { ...e.fields }
|
|
56
|
+
})), F = s(P, D), I = l(P, D, S.projection), L = c(P, D, S.access, S.consentPurposes), R = a(S.routing, S.routeDiscovery, D), z = E(S.app, D, f({
|
|
57
|
+
...S,
|
|
58
|
+
types: P,
|
|
59
|
+
site: w.definition
|
|
60
|
+
}, D, S.frontendManifest), R.discovery), B = h(i, C, A, O), V = d(i, C, w.definition, D, O), H = g(i, C, P, w.definition, D, O, R), U = b(i, N, C, u(i, C, y(i, C, P, D, O), S.renditions)), W = await _(i, C);
|
|
61
|
+
await n(i, C);
|
|
62
|
+
let G = await p(i, C, w.definition.environments, k, O);
|
|
63
|
+
if (G.scope.environment !== C.environment) return T("scope");
|
|
64
|
+
let K = await m(i, C, O), q = await r(i, P, C, {
|
|
65
|
+
now: O,
|
|
66
|
+
expiresAt: j,
|
|
67
|
+
locales: w.contentLocales,
|
|
68
|
+
sources: {
|
|
69
|
+
release: B,
|
|
70
|
+
environment: G.source,
|
|
71
|
+
...V,
|
|
72
|
+
domains: K,
|
|
73
|
+
routes: H,
|
|
74
|
+
...F,
|
|
75
|
+
assets: U,
|
|
76
|
+
redirects: v(i, C, W, {
|
|
77
|
+
types: P,
|
|
78
|
+
site: w.definition,
|
|
79
|
+
code: D,
|
|
80
|
+
routing: S.routing,
|
|
81
|
+
routeDiscovery: S.routeDiscovery
|
|
82
|
+
}, O),
|
|
83
|
+
policies: L,
|
|
84
|
+
projection: I,
|
|
85
|
+
app: z,
|
|
86
|
+
seo: {
|
|
87
|
+
format: "voltro.cms.seo-pending/v1",
|
|
88
|
+
entries: () => [{
|
|
89
|
+
key: "configuration",
|
|
90
|
+
value: {
|
|
91
|
+
version: 1,
|
|
92
|
+
state: "pending"
|
|
93
|
+
}
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return x(i, C, q, {
|
|
99
|
+
now: O,
|
|
100
|
+
xDefault: M
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { w as SiteBuildCandidateUnavailable, D as captureSiteBuildCandidate };
|