@voltro/cms 0.86.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 +5321 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +860 -221
- package/dist/RichDocumentView.js +81 -36
- package/dist/aiCandidates.js +3 -3
- 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/availability.js +19 -16
- package/dist/blueprint.js +75 -75
- 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 +71 -70
- package/dist/changes.js +279 -62
- package/dist/consent.js +5 -5
- 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 +117 -100
- package/dist/contentValues.js +18 -0
- package/dist/copies.js +3 -3
- package/dist/domainHost.js +7 -0
- package/dist/domains.js +81 -87
- package/dist/draftTexts.js +37 -37
- package/dist/duplicates.js +23 -23
- package/dist/environmentAliases.js +138 -0
- package/dist/environments.js +107 -69
- package/dist/errors.js +54 -14
- package/dist/experiments.js +7 -7
- package/dist/frontendBindings.js +99 -0
- package/dist/frontendMedia.js +18 -0
- package/dist/index.d.ts +760 -47
- package/dist/index.js +89 -73
- package/dist/initializePublicRoutes.js +28 -0
- package/dist/liveContentRouteView.js +76 -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/privateCmsTransport.js +76 -0
- package/dist/privateNativeRouteReservation.js +10 -0
- package/dist/promotion.js +68 -59
- 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 +8 -8
- package/dist/reconfigurePublicRoutes.js +41 -0
- package/dist/redirects.js +104 -73
- package/dist/referenceGraph.js +15 -14
- package/dist/references.js +2 -2
- package/dist/release.js +177 -141
- package/dist/renderReadAuthority.js +43 -0
- package/dist/renderReadGrant.js +137 -0
- package/dist/review.js +28 -28
- package/dist/richDocument.js +54 -24
- 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 +36 -36
- package/dist/seo.js +1 -1
- package/dist/series.js +11 -11
- package/dist/share.js +13 -13
- 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/tree.js +9 -9
- package/dist/validation.js +53 -53
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -33
- package/dist/workflow.js +8 -8
- package/dist/write.js +250 -225
- package/package.json +20 -6
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
|
|
2
|
+
import { CMS_REVISIONS_TABLE as t } from "./contentType.js";
|
|
3
|
+
import { lockSiteState as n } from "./siteState.js";
|
|
4
|
+
import { invalidatePublicationRelease as r, lockPublicationStream as i, readPublicationBoundary as a } from "./changes.js";
|
|
5
|
+
import { CMS_PATHS_TABLE as o, CMS_REDIRECTS_TABLE as s } from "./redirects.js";
|
|
6
|
+
import { queryPublicRouteIntegrity as c } from "./publicRouteIntegrity.js";
|
|
7
|
+
import { copyOutputActivationScope as l, outputActivationHash as u } from "./outputActivation.js";
|
|
8
|
+
import { readPublicRouteHistoryPage as d, replacePublicRouteHistory as f } from "./publicRouteHistoryStore.js";
|
|
9
|
+
import { copyPublicRouteRegistryDefinition as p } from "./publicRouteRegistryDefinition.js";
|
|
10
|
+
import { and as m, eq as h, generateId as g, id as _, integer as v, json as y, table as b, text as x, timestamp as S } from "@voltro/database";
|
|
11
|
+
import { tenant as C } from "@voltro/plugin-multitenancy/mixin";
|
|
12
|
+
import { canonicalJson as w } from "@voltro/runtime";
|
|
13
|
+
//#region src/publicRouteRegistryBinding.ts
|
|
14
|
+
var T = "_voltro_cms_public_route_registry_heads", E = "_voltro_cms_public_route_registry_bindings", D = b(T, {
|
|
15
|
+
id: _({ prefix: "crrh" }),
|
|
16
|
+
site: x().maxLength(64),
|
|
17
|
+
environment: x().maxLength(64),
|
|
18
|
+
revision: v(),
|
|
19
|
+
bindingId: x().maxLength(64)
|
|
20
|
+
}).with(C()).unique("cms_public_route_registry_scope", [
|
|
21
|
+
"tenantId",
|
|
22
|
+
"site",
|
|
23
|
+
"environment"
|
|
24
|
+
]), O = b(E, {
|
|
25
|
+
id: _({ prefix: "crrb" }),
|
|
26
|
+
site: x().maxLength(64),
|
|
27
|
+
environment: x().maxLength(64),
|
|
28
|
+
revision: v(),
|
|
29
|
+
definition: y(),
|
|
30
|
+
definitionDigest: x().maxLength(64),
|
|
31
|
+
previousBindingId: x().maxLength(64).nullable(),
|
|
32
|
+
origin: y(),
|
|
33
|
+
boundAt: S(),
|
|
34
|
+
integrityDigest: x().maxLength(64)
|
|
35
|
+
}).with(C()).unique("cms_public_route_binding_revision", [
|
|
36
|
+
"tenantId",
|
|
37
|
+
"site",
|
|
38
|
+
"environment",
|
|
39
|
+
"revision"
|
|
40
|
+
]), k = [D, O], A = (t) => {
|
|
41
|
+
try {
|
|
42
|
+
return l(t);
|
|
43
|
+
} catch {
|
|
44
|
+
return e("scope");
|
|
45
|
+
}
|
|
46
|
+
}, j = (e) => m(h("tenantId", e.tenantId), h("site", e.site), h("environment", e.environment)), M = (e) => typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e), N = (e) => Number.isInteger(e) && Number(e) >= 1 && Number(e) <= 2147483647, P = (t, n) => g({
|
|
47
|
+
kind: "typeid",
|
|
48
|
+
prefix: t
|
|
49
|
+
}, n) ?? e("state"), F = (t) => {
|
|
50
|
+
if (typeof t != "object" || !t || Array.isArray(t) || Object.getOwnPropertySymbols(t).length !== 0) return e("state");
|
|
51
|
+
let n = Object.getOwnPropertyDescriptors(t);
|
|
52
|
+
if (Object.keys(n).sort().join(",") !== "checkpoint,generation,releaseId" || Object.values(n).some((e) => !e.enumerable || !("value" in e))) return e("state");
|
|
53
|
+
let r = n.generation.value;
|
|
54
|
+
return typeof r != "string" || !/^0{20}$/.test(r) || n.releaseId.value !== null || n.checkpoint.value !== null ? e("state") : {
|
|
55
|
+
generation: r,
|
|
56
|
+
releaseId: null,
|
|
57
|
+
checkpoint: null
|
|
58
|
+
};
|
|
59
|
+
}, I = (e, t, n) => e.insert(E, {
|
|
60
|
+
id: n.id,
|
|
61
|
+
...t,
|
|
62
|
+
revision: n.revision,
|
|
63
|
+
previousBindingId: n.previousBindingId,
|
|
64
|
+
definition: n.definition,
|
|
65
|
+
definitionDigest: u(n.definition),
|
|
66
|
+
origin: n.origin,
|
|
67
|
+
boundAt: new Date(n.boundAt),
|
|
68
|
+
integrityDigest: u({
|
|
69
|
+
scope: t,
|
|
70
|
+
...n
|
|
71
|
+
})
|
|
72
|
+
}), L = async (t, n) => {
|
|
73
|
+
let r = A(n), i = await c(t, {
|
|
74
|
+
table: T,
|
|
75
|
+
predicate: j(r),
|
|
76
|
+
lock: "update",
|
|
77
|
+
order: [],
|
|
78
|
+
take: 2,
|
|
79
|
+
skip: void 0,
|
|
80
|
+
projection: void 0
|
|
81
|
+
});
|
|
82
|
+
if (i.length === 0) return (await c(t, {
|
|
83
|
+
table: "_voltro_cms_public_route_registry_bindings",
|
|
84
|
+
predicate: j(r),
|
|
85
|
+
lock: "update",
|
|
86
|
+
order: [],
|
|
87
|
+
take: 1,
|
|
88
|
+
skip: void 0,
|
|
89
|
+
projection: ["id"]
|
|
90
|
+
})).length > 0 ? e("state") : null;
|
|
91
|
+
let a = i[0];
|
|
92
|
+
if (i.length !== 1 || !M(a.id) || !M(a.bindingId) || !N(a.revision)) return e("state");
|
|
93
|
+
let o = await c(t, {
|
|
94
|
+
table: E,
|
|
95
|
+
predicate: m(j(r), h("id", a.bindingId)),
|
|
96
|
+
lock: "update",
|
|
97
|
+
order: [],
|
|
98
|
+
take: 2,
|
|
99
|
+
skip: void 0,
|
|
100
|
+
projection: void 0
|
|
101
|
+
}), s = o[0];
|
|
102
|
+
if (o.length !== 1 || s === void 0 || s.revision !== a.revision || !M(s.id) || !(s.previousBindingId === null || M(s.previousBindingId)) || s.previousBindingId === null != (s.revision === 1)) return e("state");
|
|
103
|
+
let l;
|
|
104
|
+
try {
|
|
105
|
+
l = p(s.definition);
|
|
106
|
+
} catch {
|
|
107
|
+
return e("state");
|
|
108
|
+
}
|
|
109
|
+
let d = s.boundAt instanceof Date ? s.boundAt.getTime() : NaN, f = F(s.origin);
|
|
110
|
+
if (!Number.isSafeInteger(d) || d < 0 || d > 864e13 || l.site.id !== r.site || !l.site.environments.includes(r.environment) || s.definitionDigest !== u(l)) return e("state");
|
|
111
|
+
let g = {
|
|
112
|
+
id: s.id,
|
|
113
|
+
revision: a.revision,
|
|
114
|
+
previousBindingId: s.previousBindingId,
|
|
115
|
+
definition: l,
|
|
116
|
+
origin: f,
|
|
117
|
+
boundAt: d
|
|
118
|
+
};
|
|
119
|
+
return s.integrityDigest === u({
|
|
120
|
+
scope: r,
|
|
121
|
+
...g
|
|
122
|
+
}) ? g : e("state");
|
|
123
|
+
}, R = async (l, m, h) => {
|
|
124
|
+
let g = A(m), _ = p(h.definition), v = h.expectedRevision, y = h.now;
|
|
125
|
+
if (!Number.isSafeInteger(v) || v < 0 || v > 2147483647) return e("revision");
|
|
126
|
+
if (!Number.isSafeInteger(y) || y < 0 || y > 864e13) return e("bounds");
|
|
127
|
+
if (_.site.id !== g.site || !_.site.environments.includes(g.environment)) return e("scope");
|
|
128
|
+
await n(l, g), await i(l, g);
|
|
129
|
+
let b = await L(l, g);
|
|
130
|
+
if (b !== null) return v !== 0 && v !== b.revision ? e("revision") : w(b.definition) === w(_) ? (await d(l, g, { take: 1 })).revision === 0 ? e("history") : b : e("configuration");
|
|
131
|
+
if (v !== 0) return e("revision");
|
|
132
|
+
let x = await a(l, g);
|
|
133
|
+
if (BigInt(x.generation) !== 0n || x.releaseId !== null || x.checkpoint !== null) return e("history");
|
|
134
|
+
for (let n of [
|
|
135
|
+
t,
|
|
136
|
+
o,
|
|
137
|
+
s,
|
|
138
|
+
..._.types.map((e) => e.name + "_published")
|
|
139
|
+
]) if ((await c(l, {
|
|
140
|
+
table: n,
|
|
141
|
+
predicate: j(g),
|
|
142
|
+
lock: "update",
|
|
143
|
+
order: [],
|
|
144
|
+
take: 1,
|
|
145
|
+
skip: void 0,
|
|
146
|
+
projection: ["id"]
|
|
147
|
+
})).length > 0) return e("history");
|
|
148
|
+
let S = {
|
|
149
|
+
id: P("crrb", E),
|
|
150
|
+
revision: 1,
|
|
151
|
+
previousBindingId: null,
|
|
152
|
+
definition: _,
|
|
153
|
+
origin: x,
|
|
154
|
+
boundAt: y
|
|
155
|
+
};
|
|
156
|
+
return await I(l, g, S), await l.insert(T, {
|
|
157
|
+
id: P("crrh", T),
|
|
158
|
+
...g,
|
|
159
|
+
revision: 1,
|
|
160
|
+
bindingId: S.id
|
|
161
|
+
}), await r(l, g), await f(l, g, {
|
|
162
|
+
expectedRevision: 0,
|
|
163
|
+
sourceDigest: u({
|
|
164
|
+
scope: g,
|
|
165
|
+
binding: S,
|
|
166
|
+
origin: "fresh-source-namespace"
|
|
167
|
+
}),
|
|
168
|
+
routes: []
|
|
169
|
+
}), S;
|
|
170
|
+
}, z = async (t, r, a) => {
|
|
171
|
+
let o = A(r), s = p(a.definition), c = a.expectedRevision;
|
|
172
|
+
if (!N(c) || c === 2147483647) return e("revision");
|
|
173
|
+
if (!Number.isSafeInteger(a.now) || a.now < 0 || a.now > 864e13) return e("bounds");
|
|
174
|
+
if (s.site.id !== o.site || !s.site.environments.includes(o.environment)) return e("scope");
|
|
175
|
+
await n(t, o), await i(t, o);
|
|
176
|
+
let l = await L(t, o);
|
|
177
|
+
if (l === null) return e("configuration");
|
|
178
|
+
if (l.revision !== c) return e("revision");
|
|
179
|
+
if (w(l.definition) === w(s)) return l;
|
|
180
|
+
let u = {
|
|
181
|
+
id: P("crrb", E),
|
|
182
|
+
revision: c + 1,
|
|
183
|
+
previousBindingId: l.id,
|
|
184
|
+
definition: s,
|
|
185
|
+
origin: { ...l.origin },
|
|
186
|
+
boundAt: a.now
|
|
187
|
+
};
|
|
188
|
+
return await I(t, o, u), await t.updateMany("_voltro_cms_public_route_registry_heads", {
|
|
189
|
+
revision: u.revision,
|
|
190
|
+
bindingId: u.id
|
|
191
|
+
}, { where: m(j(o), h("revision", c), h("bindingId", l.id)) }) === 1 ? u : e("revision");
|
|
192
|
+
};
|
|
193
|
+
//#endregion
|
|
194
|
+
export { E as PUBLIC_ROUTE_REGISTRY_BINDINGS, T as PUBLIC_ROUTE_REGISTRY_HEADS, z as advancePublicRouteDefinition, R as bindInitialPublicRouteDefinition, k as publicRouteRegistryBindingTables, O as publicRouteRegistryBindingsTable, D as publicRouteRegistryHeadsTable, L as readPublicRouteBinding };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { PublicRouteRegistryUnavailable as e, publicRouteRegistryFail as t } from "./publicRouteRegistry.js";
|
|
2
|
+
import { compileSiteDelivery as n } from "./siteDelivery.js";
|
|
3
|
+
import { defineContentLocations as r } from "./contentLocations.js";
|
|
4
|
+
import { outputActivationHash as i } from "./outputActivation.js";
|
|
5
|
+
import { compileContentRouteTypes as a } from "./contentRouteTypes.js";
|
|
6
|
+
import { copySnapshotResource as o } from "./buildSnapshot.js";
|
|
7
|
+
import { compileSnapshotRouting as s } from "./snapshotRouting.js";
|
|
8
|
+
import { copySnapshotAppCodePin as c } from "./snapshotDefinitions.js";
|
|
9
|
+
import { canonicalJson as l } from "@voltro/runtime";
|
|
10
|
+
//#region src/publicRouteRegistryDefinition.ts
|
|
11
|
+
var u = (e, n) => typeof e != "object" || !e || Array.isArray(e) || Object.keys(e).sort().join(",") !== n ? t("definition") : e, d = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(e), f = (e, n, r) => r === null ? e !== null || n !== null ? t("definition") : {
|
|
12
|
+
definition: null,
|
|
13
|
+
discovery: null
|
|
14
|
+
} : s(e, n, r), p = (a) => {
|
|
15
|
+
try {
|
|
16
|
+
let e = u(o({
|
|
17
|
+
key: "route-definition",
|
|
18
|
+
value: a
|
|
19
|
+
}).value, "app,definitionDigest,routing,site,types,version");
|
|
20
|
+
if (e.version !== 1 || !Array.isArray(e.types) || e.types.length === 0) return t("definition");
|
|
21
|
+
let s = e.app === null ? null : c(e.app), p = n(e.site).definition, m = u(e.routing, "definition,discovery"), h = f(m.definition, m.discovery, s), g = [], _ = "";
|
|
22
|
+
for (let n of e.types) {
|
|
23
|
+
let e = u(n, "locations,name,tree");
|
|
24
|
+
if (!d(e.name) || e.name <= _ || !Array.isArray(e.locations)) return t("definition");
|
|
25
|
+
_ = e.name;
|
|
26
|
+
let i = r(e.locations), a = null;
|
|
27
|
+
if (e.tree !== null) {
|
|
28
|
+
let n = u(e.tree, "parent,segment");
|
|
29
|
+
if (!d(n.parent) || !d(n.segment)) return t("definition");
|
|
30
|
+
a = {
|
|
31
|
+
parent: n.parent,
|
|
32
|
+
segment: n.segment
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
g.push({
|
|
36
|
+
name: e.name,
|
|
37
|
+
locations: i,
|
|
38
|
+
tree: a
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
let v = {
|
|
42
|
+
version: 1,
|
|
43
|
+
app: s,
|
|
44
|
+
site: p,
|
|
45
|
+
types: g,
|
|
46
|
+
routing: h,
|
|
47
|
+
definitionDigest: i({
|
|
48
|
+
site: p,
|
|
49
|
+
types: g,
|
|
50
|
+
routing: h
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
return l(v) === l(e) ? v : t("definition");
|
|
54
|
+
} catch (n) {
|
|
55
|
+
if (n instanceof e) throw n;
|
|
56
|
+
return t("definition");
|
|
57
|
+
}
|
|
58
|
+
}, m = (e) => {
|
|
59
|
+
let r = a(e.types);
|
|
60
|
+
if (!r.ok) return t("definition");
|
|
61
|
+
let o = e.app === null ? null : c(e.app), s = n(e.site).definition, l = f(e.routing.definition, e.routing.discovery, o), u = r.types;
|
|
62
|
+
return p({
|
|
63
|
+
version: 1,
|
|
64
|
+
app: o,
|
|
65
|
+
site: s,
|
|
66
|
+
types: u,
|
|
67
|
+
routing: l,
|
|
68
|
+
definitionDigest: i({
|
|
69
|
+
site: s,
|
|
70
|
+
types: u,
|
|
71
|
+
routing: l
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { m as compilePublicRouteRegistryDefinition, f as compilePublicRouteRouting, p as copyPublicRouteRegistryDefinition };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { publicRouteRegistryFail as e } from "./publicRouteRegistry.js";
|
|
2
|
+
import { copySiteScope as t } from "./siteState.js";
|
|
3
|
+
import { invalidatePublicationRelease as n, lockPublicationStream as r } from "./changes.js";
|
|
4
|
+
import { queryPublicRouteIntegrity as i } from "./publicRouteIntegrity.js";
|
|
5
|
+
import { PUBLIC_ROUTE_REGISTRY_HEADS as a } from "./publicRouteRegistryBinding.js";
|
|
6
|
+
import { reconcilePublicRouteNamespace as o } from "./publicRouteNamespace.js";
|
|
7
|
+
import { and as s, eq as c, gt as l } from "@voltro/database";
|
|
8
|
+
//#region src/publicRouteSitePublication.ts
|
|
9
|
+
var u = async (u, d) => {
|
|
10
|
+
let f = t(d), p = /* @__PURE__ */ new Set(), m;
|
|
11
|
+
for (;;) {
|
|
12
|
+
let t = await i(u, {
|
|
13
|
+
table: a,
|
|
14
|
+
predicate: s(c("tenantId", f.tenantId), c("site", f.site), ...m === void 0 ? [] : [l("id", m)]),
|
|
15
|
+
lock: "update",
|
|
16
|
+
order: [{
|
|
17
|
+
column: "id",
|
|
18
|
+
direction: "asc"
|
|
19
|
+
}],
|
|
20
|
+
take: 200,
|
|
21
|
+
skip: void 0,
|
|
22
|
+
projection: void 0
|
|
23
|
+
});
|
|
24
|
+
if (t.length === 0) break;
|
|
25
|
+
for (let n of t) {
|
|
26
|
+
if (typeof n.id != "string" || n.id <= (m ?? "") || typeof n.environment != "string" || !/^[a-z][a-z0-9_-]{0,63}$/.test(n.environment) || p.has(n.environment) || n.tenantId !== f.tenantId || n.site !== f.site) return e("state");
|
|
27
|
+
if (p.size >= 1e4) return e("bounds");
|
|
28
|
+
m = n.id, p.add(n.environment);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (let e of [...p].sort()) {
|
|
32
|
+
let t = {
|
|
33
|
+
...f,
|
|
34
|
+
environment: e
|
|
35
|
+
};
|
|
36
|
+
await r(u, t), await n(u, t), await o(u, t);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { u as reconcileDomainPublication };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cmsSiteStateHeadsTable as e } from "./siteState.js";
|
|
2
|
+
import { publicRouteHistoryTables as t } from "./publicRouteHistoryStore.js";
|
|
3
|
+
import { publicRouteRegistryBindingTables as n } from "./publicRouteRegistryBinding.js";
|
|
4
|
+
import { cmsSiteDomainsTable as r } from "./domains.js";
|
|
5
|
+
//#region src/publicRouteTables.ts
|
|
6
|
+
var i = [
|
|
7
|
+
e,
|
|
8
|
+
...n,
|
|
9
|
+
...t,
|
|
10
|
+
r
|
|
11
|
+
];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { i as cmsPublicRouteTables };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { normalizeHost as e } from "./domainHost.js";
|
|
2
|
+
import { CmsPublicBuildUnavailable as t, canonicalCmsPublicPath as n } from "./publicBuild.js";
|
|
3
|
+
//#region src/publicRouteUrl.ts
|
|
4
|
+
var r = (r) => {
|
|
5
|
+
let i = () => {
|
|
6
|
+
throw new t("request");
|
|
7
|
+
};
|
|
8
|
+
if (typeof r != "string" || r.length > 4400) return i();
|
|
9
|
+
try {
|
|
10
|
+
let t = new URL(r);
|
|
11
|
+
if (t.protocol !== "https:" || t.host !== e(t.host) || t.host !== t.hostname || t.origin + t.pathname !== r || n(t.pathname) !== t.pathname) return i();
|
|
12
|
+
} catch {
|
|
13
|
+
return i();
|
|
14
|
+
}
|
|
15
|
+
return r;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as copyCanonicalPublicRouteUrl };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ContentSeoUnavailable as e } from "./errors.js";
|
|
2
|
+
import { resolveContentSeo as t } from "./contentSeo.js";
|
|
3
|
+
import { defineSiteDelivery as n } from "./siteDelivery.js";
|
|
4
|
+
//#region src/publicationSeo.ts
|
|
5
|
+
var r = (t) => {
|
|
6
|
+
let r = () => {
|
|
7
|
+
throw new e({ reason: "definition" });
|
|
8
|
+
};
|
|
9
|
+
if (!Array.isArray(t) || t.length < 1 || t.length > 128 || Object.getOwnPropertySymbols(t).length || Object.getOwnPropertyNames(t).length !== t.length + 1) return r();
|
|
10
|
+
let i = Array.from({ length: t.length }, (e, i) => {
|
|
11
|
+
let a = Object.getOwnPropertyDescriptor(t, String(i));
|
|
12
|
+
return a === void 0 || !a.enumerable || !("value" in a) ? r() : n(a.value);
|
|
13
|
+
});
|
|
14
|
+
return new Set(i.map((e) => e.id)).size === i.length ? Object.freeze(i) : r();
|
|
15
|
+
}, i = (n, i, a) => {
|
|
16
|
+
if (n.seo === void 0) {
|
|
17
|
+
if (n.seoSites !== void 0) throw new e({ reason: "definition" });
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (n.seoSites === void 0) return t(n.seo, i);
|
|
21
|
+
let o = r(n.seoSites).find((e) => e.id === a.site), s = o?.locales.find((e) => e.contentLocale === a.locale);
|
|
22
|
+
if (o === void 0 || !o.environments.includes(a.environment) || s === void 0) throw new e({ reason: "scope" });
|
|
23
|
+
let c = o.seo !== void 0 && Object.hasOwn(o.seo, s.id) ? o.seo[s.id] : void 0;
|
|
24
|
+
return t(n.seo, i, c);
|
|
25
|
+
}, a = (t, n, r) => {
|
|
26
|
+
let a;
|
|
27
|
+
try {
|
|
28
|
+
a = i(t, n, r);
|
|
29
|
+
} catch (t) {
|
|
30
|
+
if (!(t instanceof e)) throw t;
|
|
31
|
+
return [{
|
|
32
|
+
field: "$seo",
|
|
33
|
+
rule: `seo.${t.reason}`,
|
|
34
|
+
message: "SEO metadata could not be resolved for this publication scope."
|
|
35
|
+
}];
|
|
36
|
+
}
|
|
37
|
+
if (a === null || t.seo === void 0) return [];
|
|
38
|
+
let o = t.seo, s = {
|
|
39
|
+
title: o.title.fields[0],
|
|
40
|
+
description: o.description?.fields[0],
|
|
41
|
+
"social.title": o.social?.title?.fields[0],
|
|
42
|
+
"social.description": o.social?.description?.fields[0],
|
|
43
|
+
"structuredData.title": o.structuredData?.title
|
|
44
|
+
};
|
|
45
|
+
return a.findings.flatMap((e) => e.kind === "recommendation" ? [] : [{
|
|
46
|
+
field: e.field ?? s[e.target] ?? "$seo",
|
|
47
|
+
rule: `seo.${e.rule}`,
|
|
48
|
+
message: e.kind === "missing" ? `SEO ${e.target} is required for publication.` : `SEO ${e.target} contains an invalid ${e.rule} value.`
|
|
49
|
+
}]);
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { r as defineContentSeoSites, i as resolveScopedContentSeo, a as seoPublishViolations };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { readPublicationBoundary as e } from "./changes.js";
|
|
2
|
+
import { pickDeclared as t, readContentModificationTime as n } from "./contentValues.js";
|
|
3
|
+
import { Schema as r } from "effect";
|
|
4
|
+
import { and as i, eq as a, gt as o, id as s, integer as c, json as l, or as u, table as d, text as f, timestamp as p } from "@voltro/database";
|
|
5
|
+
import { tenant as m } from "@voltro/plugin-multitenancy/mixin";
|
|
6
|
+
import { createHash as h } from "node:crypto";
|
|
7
|
+
import { canonicalJson as g } from "@voltro/runtime";
|
|
8
|
+
//#region src/publicationState.ts
|
|
9
|
+
var _ = class extends r.TaggedError()("PublicationStateUnavailable", { reason: r.Literals([
|
|
10
|
+
"scope",
|
|
11
|
+
"types",
|
|
12
|
+
"locales",
|
|
13
|
+
"expiry",
|
|
14
|
+
"state",
|
|
15
|
+
"expired",
|
|
16
|
+
"publication",
|
|
17
|
+
"cursor",
|
|
18
|
+
"query"
|
|
19
|
+
]) }) {}, v = "_voltro_cms_publication_states", y = "_voltro_cms_publication_state_entries", b = d(v, {
|
|
20
|
+
id: s({ prefix: "cstate" }),
|
|
21
|
+
site: f().maxLength(64),
|
|
22
|
+
environment: f().maxLength(64),
|
|
23
|
+
state: f().oneOf(["capturing", "sealed"]),
|
|
24
|
+
checkpoint: f().maxLength(64).nullable(),
|
|
25
|
+
generation: f().maxLength(20),
|
|
26
|
+
releaseId: f().maxLength(64).nullable(),
|
|
27
|
+
types: l(),
|
|
28
|
+
locales: l(),
|
|
29
|
+
capturedAt: p(),
|
|
30
|
+
expiresAt: p(),
|
|
31
|
+
entries: c().default(0),
|
|
32
|
+
digest: f().maxLength(64).default("")
|
|
33
|
+
}).with(m()), x = d(y, {
|
|
34
|
+
id: s({ prefix: "cpub" }),
|
|
35
|
+
stateId: f().maxLength(64),
|
|
36
|
+
site: f().maxLength(64),
|
|
37
|
+
environment: f().maxLength(64),
|
|
38
|
+
contentType: f().maxLength(64),
|
|
39
|
+
variantId: f().maxLength(64),
|
|
40
|
+
documentId: f().maxLength(64),
|
|
41
|
+
locale: f().maxLength(64),
|
|
42
|
+
revisionId: f().maxLength(64),
|
|
43
|
+
revision: c(),
|
|
44
|
+
values: l(),
|
|
45
|
+
modifiedAt: f().maxLength(32).nullable(),
|
|
46
|
+
digest: f().maxLength(64)
|
|
47
|
+
}).with(m()).index("cms_pubstate_entries_page", [
|
|
48
|
+
"tenantId",
|
|
49
|
+
"stateId",
|
|
50
|
+
"contentType",
|
|
51
|
+
"locale",
|
|
52
|
+
"variantId"
|
|
53
|
+
]).index("cms_pubstate_entries_document", [
|
|
54
|
+
"tenantId",
|
|
55
|
+
"stateId",
|
|
56
|
+
"contentType",
|
|
57
|
+
"locale",
|
|
58
|
+
"documentId"
|
|
59
|
+
]).unique("cms_pubstate_entries_variant", [
|
|
60
|
+
"tenantId",
|
|
61
|
+
"stateId",
|
|
62
|
+
"contentType",
|
|
63
|
+
"variantId"
|
|
64
|
+
]), S = (e) => {
|
|
65
|
+
throw new _({ reason: e });
|
|
66
|
+
}, C = (e) => typeof e == "string" && e.trim().length > 0, w = (e) => [
|
|
67
|
+
e.tenantId,
|
|
68
|
+
e.site,
|
|
69
|
+
e.environment
|
|
70
|
+
].every(C) ? i(a("tenantId", e.tenantId), a("site", e.site), a("environment", e.environment)) : S("scope"), T = (e) => Array.isArray(e) && e.every(C), E = (e) => h("sha256").update(g(e)).digest("hex"), D = (e) => {
|
|
71
|
+
let t = n(e);
|
|
72
|
+
return t.ok ? t.value : S("publication");
|
|
73
|
+
}, O = (e) => ({
|
|
74
|
+
contentType: e.contentType,
|
|
75
|
+
variantId: e.variantId,
|
|
76
|
+
documentId: e.documentId,
|
|
77
|
+
locale: e.locale,
|
|
78
|
+
revisionId: e.revisionId,
|
|
79
|
+
revision: e.revision,
|
|
80
|
+
values: e.values,
|
|
81
|
+
modifiedAt: D(e.modifiedAt)
|
|
82
|
+
}), k = async (n, r, s, c) => {
|
|
83
|
+
let l = w(s), d = r.map((e) => e.name).sort();
|
|
84
|
+
if (r.length === 0 || !d.every(C) || new Set(d).size !== d.length) return S("types");
|
|
85
|
+
if (!T(c.locales) || c.locales.length === 0 || new Set(c.locales).size !== c.locales.length) return S("locales");
|
|
86
|
+
let f = [...c.locales].sort(), p = c.now ?? Date.now();
|
|
87
|
+
if (!Number.isSafeInteger(p) || !Number.isFinite(new Date(p).getTime()) || !Number.isSafeInteger(c.expiresAt) || c.expiresAt <= p || !Number.isFinite(new Date(c.expiresAt).getTime())) return S("expiry");
|
|
88
|
+
let { checkpoint: m, generation: _, releaseId: b } = await e(n, s), x = await n.insert(v, {
|
|
89
|
+
...s,
|
|
90
|
+
state: "capturing",
|
|
91
|
+
checkpoint: m,
|
|
92
|
+
generation: _,
|
|
93
|
+
releaseId: b,
|
|
94
|
+
types: d,
|
|
95
|
+
locales: f,
|
|
96
|
+
capturedAt: new Date(p),
|
|
97
|
+
expiresAt: new Date(c.expiresAt),
|
|
98
|
+
entries: 0,
|
|
99
|
+
digest: ""
|
|
100
|
+
}), O = String(x.id), k = h("sha256").update(g({
|
|
101
|
+
version: 3,
|
|
102
|
+
scope: s,
|
|
103
|
+
types: d,
|
|
104
|
+
locales: f,
|
|
105
|
+
checkpoint: m,
|
|
106
|
+
generation: _,
|
|
107
|
+
releaseId: b
|
|
108
|
+
}) + "\n"), A = 0;
|
|
109
|
+
for (let e of [...r].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name))) {
|
|
110
|
+
let r;
|
|
111
|
+
for (;;) {
|
|
112
|
+
let c = await n.query({
|
|
113
|
+
table: `${e.name}_published`,
|
|
114
|
+
lock: "update",
|
|
115
|
+
predicate: i(l, a("status", "published"), u(...f.map((e) => a("locale", e))), ...r === void 0 ? [] : [o("id", r)]),
|
|
116
|
+
order: [{
|
|
117
|
+
column: "id",
|
|
118
|
+
direction: "asc"
|
|
119
|
+
}],
|
|
120
|
+
take: 500,
|
|
121
|
+
skip: void 0,
|
|
122
|
+
projection: void 0
|
|
123
|
+
});
|
|
124
|
+
if (c.length === 0) break;
|
|
125
|
+
let d = c.map((n) => {
|
|
126
|
+
if (![
|
|
127
|
+
n.id,
|
|
128
|
+
n.documentId,
|
|
129
|
+
n.revisionId,
|
|
130
|
+
n.locale
|
|
131
|
+
].every(C) || !Number.isSafeInteger(n.revision) || Number(n.revision) < 1) return S("publication");
|
|
132
|
+
let r = JSON.parse(JSON.stringify(t(e, n))), i = {
|
|
133
|
+
contentType: e.name,
|
|
134
|
+
variantId: n.id,
|
|
135
|
+
documentId: n.documentId,
|
|
136
|
+
locale: n.locale,
|
|
137
|
+
revisionId: n.revisionId,
|
|
138
|
+
revision: n.revision,
|
|
139
|
+
values: r,
|
|
140
|
+
modifiedAt: D(n.updatedAt)
|
|
141
|
+
}, a = E(i);
|
|
142
|
+
return k.update(a + "\n"), {
|
|
143
|
+
...s,
|
|
144
|
+
stateId: O,
|
|
145
|
+
...i,
|
|
146
|
+
digest: a
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
await n.insertMany(y, d, { returning: "none" }), A += c.length, r = String(c[c.length - 1].id);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let j = {
|
|
153
|
+
entries: A,
|
|
154
|
+
digest: k.digest("hex")
|
|
155
|
+
};
|
|
156
|
+
return await n.update(v, O, {
|
|
157
|
+
state: "sealed",
|
|
158
|
+
...j
|
|
159
|
+
}), {
|
|
160
|
+
id: O,
|
|
161
|
+
checkpoint: m,
|
|
162
|
+
generation: _,
|
|
163
|
+
releaseId: b,
|
|
164
|
+
...j
|
|
165
|
+
};
|
|
166
|
+
}, A = async (e, t, n, r, o, s) => {
|
|
167
|
+
let [c] = await e.query({
|
|
168
|
+
table: v,
|
|
169
|
+
predicate: i(w(t), a("id", n)),
|
|
170
|
+
order: [],
|
|
171
|
+
take: 1,
|
|
172
|
+
skip: void 0,
|
|
173
|
+
projection: void 0
|
|
174
|
+
});
|
|
175
|
+
if (c === void 0 || c.state !== "sealed" || !T(c.types) || !c.types.includes(r) || !T(c.locales) || !c.locales.includes(o) || typeof c.digest != "string" || !/^[0-9a-f]{64}$/.test(c.digest) || !Number.isSafeInteger(c.entries) || Number(c.entries) < 0) return S("state");
|
|
176
|
+
let l = c.expiresAt instanceof Date ? c.expiresAt.getTime() : new Date(String(c.expiresAt)).getTime();
|
|
177
|
+
if (!Number.isFinite(s) || !Number.isFinite(l)) return S("state");
|
|
178
|
+
if (l <= s) return S("expired");
|
|
179
|
+
}, j = (e) => e.digest !== E(O(e)) || e.values === null || typeof e.values != "object" || Array.isArray(e.values) ? S("publication") : structuredClone({
|
|
180
|
+
...e.values,
|
|
181
|
+
id: e.variantId,
|
|
182
|
+
documentId: e.documentId,
|
|
183
|
+
revisionId: e.revisionId,
|
|
184
|
+
revision: e.revision,
|
|
185
|
+
tenantId: e.tenantId,
|
|
186
|
+
site: e.site,
|
|
187
|
+
environment: e.environment,
|
|
188
|
+
locale: e.locale,
|
|
189
|
+
status: "published"
|
|
190
|
+
}), M = async (e, t, n, r, o, s, c = Date.now()) => {
|
|
191
|
+
await A(e, t, n, r, o, c);
|
|
192
|
+
let [l] = await e.query({
|
|
193
|
+
table: y,
|
|
194
|
+
predicate: i(w(t), a("stateId", n), a("contentType", r), a("locale", o), a("variantId", s)),
|
|
195
|
+
order: [],
|
|
196
|
+
take: 1,
|
|
197
|
+
skip: void 0,
|
|
198
|
+
projection: void 0
|
|
199
|
+
});
|
|
200
|
+
return l === void 0 ? null : j(l);
|
|
201
|
+
}, N = async (e, t, n, r, o, s, c = Date.now()) => {
|
|
202
|
+
if (!C(s)) return S("query");
|
|
203
|
+
await A(e, t, n, r, o, c);
|
|
204
|
+
let l = await e.query({
|
|
205
|
+
table: y,
|
|
206
|
+
predicate: i(w(t), a("stateId", n), a("contentType", r), a("locale", o), a("documentId", s)),
|
|
207
|
+
order: [],
|
|
208
|
+
take: 2,
|
|
209
|
+
skip: void 0,
|
|
210
|
+
projection: void 0
|
|
211
|
+
});
|
|
212
|
+
return l.length > 1 ? S("publication") : l[0] === void 0 ? null : {
|
|
213
|
+
content: j(l[0]),
|
|
214
|
+
modifiedAt: D(l[0].modifiedAt)
|
|
215
|
+
};
|
|
216
|
+
}, P = async (e, t, n, r, i, a, o = Date.now()) => (await N(e, t, n, r, i, a, o))?.content ?? null, F = async (e, t, n, r, s, c = {}) => {
|
|
217
|
+
await A(e, t, n, r, s, c.now ?? Date.now());
|
|
218
|
+
let l = c.limit ?? 100;
|
|
219
|
+
if (!Number.isSafeInteger(l) || l < 1 || l > 200) return S("query");
|
|
220
|
+
let u = i(w(t), a("stateId", n), a("contentType", r), a("locale", s)), d;
|
|
221
|
+
if (c.after !== void 0) {
|
|
222
|
+
let [t] = await e.query({
|
|
223
|
+
table: y,
|
|
224
|
+
predicate: i(u, a("id", c.after)),
|
|
225
|
+
order: [],
|
|
226
|
+
take: 1,
|
|
227
|
+
skip: void 0,
|
|
228
|
+
projection: ["variantId"]
|
|
229
|
+
});
|
|
230
|
+
if (t === void 0 || !C(t.variantId)) return S("cursor");
|
|
231
|
+
d = t.variantId;
|
|
232
|
+
}
|
|
233
|
+
let f = await e.query({
|
|
234
|
+
table: y,
|
|
235
|
+
predicate: i(u, ...d === void 0 ? [] : [o("variantId", d)]),
|
|
236
|
+
order: [{
|
|
237
|
+
column: "variantId",
|
|
238
|
+
direction: "asc"
|
|
239
|
+
}],
|
|
240
|
+
take: l + 1,
|
|
241
|
+
skip: void 0,
|
|
242
|
+
projection: void 0
|
|
243
|
+
}), p = f.slice(0, l);
|
|
244
|
+
return {
|
|
245
|
+
items: p.map(j),
|
|
246
|
+
next: f.length > l ? String(p[p.length - 1].id) : null
|
|
247
|
+
};
|
|
248
|
+
}, I = async (e, t, n, r = Date.now()) => {
|
|
249
|
+
let [s] = await e.query({
|
|
250
|
+
table: v,
|
|
251
|
+
predicate: i(w(t), a("id", n.id)),
|
|
252
|
+
order: [],
|
|
253
|
+
take: 1,
|
|
254
|
+
skip: void 0,
|
|
255
|
+
projection: void 0
|
|
256
|
+
});
|
|
257
|
+
if (s === void 0 || !T(s.types) || !T(s.locales) || s.types.length === 0 || s.locales.length === 0 || s.checkpoint !== n.checkpoint || s.generation !== n.generation || s.releaseId !== n.releaseId || !/^[0-9]{20}$/.test(n.generation) || n.releaseId !== null && !C(n.releaseId) || s.entries !== n.entries || s.digest !== n.digest) return S("state");
|
|
258
|
+
await A(e, t, n.id, s.types[0], s.locales[0], r);
|
|
259
|
+
let c = h("sha256").update(g({
|
|
260
|
+
version: 3,
|
|
261
|
+
scope: t,
|
|
262
|
+
types: s.types,
|
|
263
|
+
locales: s.locales,
|
|
264
|
+
checkpoint: s.checkpoint,
|
|
265
|
+
generation: s.generation,
|
|
266
|
+
releaseId: s.releaseId
|
|
267
|
+
}) + "\n"), l = 0;
|
|
268
|
+
for (let r of s.types) {
|
|
269
|
+
let u;
|
|
270
|
+
for (;;) {
|
|
271
|
+
let d = await e.query({
|
|
272
|
+
table: y,
|
|
273
|
+
predicate: i(w(t), a("stateId", n.id), a("contentType", r), ...u === void 0 ? [] : [o("variantId", u)]),
|
|
274
|
+
order: [{
|
|
275
|
+
column: "variantId",
|
|
276
|
+
direction: "asc"
|
|
277
|
+
}],
|
|
278
|
+
take: 500,
|
|
279
|
+
skip: void 0,
|
|
280
|
+
projection: void 0
|
|
281
|
+
});
|
|
282
|
+
if (d.length === 0) break;
|
|
283
|
+
for (let e of d) {
|
|
284
|
+
if (!C(e.variantId) || !s.locales.includes(String(e.locale))) return S("publication");
|
|
285
|
+
j(e), c.update(String(e.digest) + "\n"), l++;
|
|
286
|
+
}
|
|
287
|
+
u = String(d[d.length - 1].variantId);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return l !== n.entries || c.digest("hex") !== n.digest ? S("publication") : {
|
|
291
|
+
types: [...s.types],
|
|
292
|
+
locales: [...s.locales]
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
//#endregion
|
|
296
|
+
export { v as PUBLICATION_STATES_TABLE, y as PUBLICATION_STATE_ENTRIES_TABLE, _ as PublicationStateUnavailable, k as capturePublicationState, F as pageCapturedPublications, x as publicationStateEntriesTable, b as publicationStatesTable, P as readCapturedDocument, N as readCapturedDocumentEntry, M as readCapturedPublication, I as verifyPublicationState };
|