@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
package/dist/environments.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { PublicRouteRegistryUnavailable as e } from "./publicRouteRegistry.js";
|
|
2
|
+
import { ChangeFeedUnavailable as t } from "./errors.js";
|
|
3
|
+
import { asTyped as n } from "./effectForm.js";
|
|
4
|
+
import { indexForSearch as r } from "./search.js";
|
|
5
|
+
import { lockPublicationStream as i, recordChange as a } from "./changes.js";
|
|
6
|
+
import { recordPublicationPaths as o } from "./redirects.js";
|
|
7
|
+
import { hasReferenceFields as s, writeReferences as c } from "./references.js";
|
|
8
|
+
import { pickDeclared as l } from "./contentValues.js";
|
|
9
|
+
import { reconcilePublishedContentRoutes as u, withPublicRoutePublicationBatch as d } from "./publicRoutePublication.js";
|
|
10
|
+
import { writeAvailability as f } from "./availability.js";
|
|
11
|
+
import { newVariantId as p, scopeColumns as m, writeRevision as h } from "./write.js";
|
|
12
|
+
import { and as g, eq as _, neq as v } from "@voltro/database";
|
|
8
13
|
//#region src/environments.ts
|
|
9
|
-
var
|
|
14
|
+
var y = (e, t, n, r) => e.query({
|
|
10
15
|
table: t,
|
|
11
|
-
predicate:
|
|
16
|
+
predicate: g(_("site", n), _("environment", r), v("status", "archived")),
|
|
12
17
|
order: [{
|
|
13
18
|
column: "id",
|
|
14
19
|
direction: "asc"
|
|
@@ -16,84 +21,117 @@ var p = (e, t, n, r) => e.query({
|
|
|
16
21
|
take: void 0,
|
|
17
22
|
skip: void 0,
|
|
18
23
|
projection: void 0
|
|
19
|
-
}),
|
|
20
|
-
|
|
24
|
+
}), b = async (e, n, r) => {
|
|
25
|
+
let a;
|
|
26
|
+
for (let i of n) for (let n of [.../* @__PURE__ */ new Set([r.from, r.to])].sort()) for (let o of [i.name + "_drafts", i.name + "_published"]) {
|
|
27
|
+
let i = await y(e, o, r.site, n);
|
|
28
|
+
for (let e of i) {
|
|
29
|
+
if (typeof e.tenantId != "string" || e.tenantId === "" || a !== void 0 && e.tenantId !== a) throw new t({ reason: "scope" });
|
|
30
|
+
a = e.tenantId;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (a === void 0) return null;
|
|
34
|
+
for (let t of [.../* @__PURE__ */ new Set([r.from, r.to])].sort()) await i(e, {
|
|
35
|
+
tenantId: a,
|
|
36
|
+
site: r.site,
|
|
37
|
+
environment: t
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
tenantId: a,
|
|
41
|
+
site: r.site,
|
|
42
|
+
environment: r.to
|
|
43
|
+
};
|
|
44
|
+
}, x = async (e, n, g) => {
|
|
45
|
+
if (g.from === g.to) return {
|
|
21
46
|
ok: !1,
|
|
22
47
|
reason: "sameEnvironment",
|
|
23
48
|
variants: 0
|
|
24
49
|
};
|
|
25
|
-
let
|
|
26
|
-
for (let t of
|
|
27
|
-
|
|
50
|
+
let _ = await b(e, n, g), v = 0;
|
|
51
|
+
for (let t of n) v += (await y(e, `${t.name}_drafts`, g.site, g.to)).length;
|
|
52
|
+
return v > 0 ? {
|
|
28
53
|
ok: !1,
|
|
29
54
|
reason: "targetNotEmpty",
|
|
30
|
-
variants:
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
revisionId:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...c(u),
|
|
58
|
-
status: "published",
|
|
59
|
-
revisionId: C.id,
|
|
60
|
-
revision: C.number,
|
|
61
|
-
...T
|
|
55
|
+
variants: v
|
|
56
|
+
} : _ === null ? {
|
|
57
|
+
ok: !0,
|
|
58
|
+
variants: 0,
|
|
59
|
+
published: 0
|
|
60
|
+
} : d(e, _, async () => {
|
|
61
|
+
let d = 0, v = 0;
|
|
62
|
+
for (let b of n) {
|
|
63
|
+
let n = await y(e, `${b.name}_drafts`, g.site, g.from), x = new Map((await y(e, `${b.name}_published`, g.site, g.from)).map((e) => [String(e.id), e])), S = /* @__PURE__ */ new Set();
|
|
64
|
+
for (let o of n) {
|
|
65
|
+
let n = {
|
|
66
|
+
site: g.site,
|
|
67
|
+
environment: g.to,
|
|
68
|
+
locale: String(o.locale)
|
|
69
|
+
}, y = String(o.documentId), C = o.tenantId;
|
|
70
|
+
if (_ === null || C !== _.tenantId) throw new t({ reason: "scope" });
|
|
71
|
+
let w = p(b), T = x.get(String(o.id)), E = l(b, o), D = 0, O;
|
|
72
|
+
T !== void 0 && (O = await h(e, b, y, ++D, l(b, T), n, C));
|
|
73
|
+
let k = T !== void 0 && T.revisionId === o.revisionId && O !== void 0 ? O : await h(e, b, y, ++D, E, n, C), A = C == null ? {} : { tenantId: C }, j = await e.insert(`${b.name}_drafts`, {
|
|
74
|
+
...E,
|
|
75
|
+
id: w,
|
|
76
|
+
documentId: y,
|
|
77
|
+
...m(n),
|
|
78
|
+
status: o.status,
|
|
79
|
+
revisionId: k.id,
|
|
80
|
+
revision: k.number,
|
|
81
|
+
...A
|
|
62
82
|
});
|
|
63
|
-
await
|
|
83
|
+
if (await r(e, b, j, n, "draft"), s(b) && await c(e, b, j, n, "draft"), d++, T !== void 0 && O !== void 0) {
|
|
84
|
+
if (typeof C != "string" || C === "") throw new t({ reason: "scope" });
|
|
85
|
+
await i(e, {
|
|
86
|
+
tenantId: C,
|
|
87
|
+
site: g.site,
|
|
88
|
+
environment: g.to
|
|
89
|
+
});
|
|
90
|
+
let o = await e.insert(`${b.name}_published`, {
|
|
91
|
+
...l(b, T),
|
|
92
|
+
id: w,
|
|
93
|
+
documentId: y,
|
|
94
|
+
...m(n),
|
|
95
|
+
status: "published",
|
|
96
|
+
revisionId: O.id,
|
|
97
|
+
revision: O.number,
|
|
98
|
+
...A
|
|
99
|
+
});
|
|
100
|
+
await a(e, b, o, n, "published"), await u(e, b, o, n), await c(e, b, o, n), await f(e, b, o, n), await r(e, b, o, n, "published"), S.add(`${n.locale}\u0000${String(C ?? "")}`), v++;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (let t of S) {
|
|
104
|
+
let [n, r] = t.split("\0");
|
|
105
|
+
await o(e, b, {
|
|
106
|
+
site: g.site,
|
|
107
|
+
environment: g.to,
|
|
108
|
+
locale: n
|
|
109
|
+
}, r === "" ? void 0 : r);
|
|
64
110
|
}
|
|
65
111
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
ok: !0,
|
|
77
|
-
variants: m,
|
|
78
|
-
published: h
|
|
79
|
-
};
|
|
80
|
-
}, h = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) && !(t instanceof Date) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)) : t), g = (e) => {
|
|
112
|
+
return {
|
|
113
|
+
ok: !0,
|
|
114
|
+
variants: d,
|
|
115
|
+
published: v
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}, S = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) && !(t instanceof Date) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)) : t), C = (e) => {
|
|
81
119
|
for (let t of [
|
|
82
120
|
"title",
|
|
83
121
|
"name",
|
|
84
122
|
"slug"
|
|
85
123
|
]) if (typeof e[t] == "string" && e[t] !== "") return e[t];
|
|
86
124
|
return String(e.documentId);
|
|
87
|
-
},
|
|
125
|
+
}, w = async (e, t, n) => {
|
|
88
126
|
let r = [];
|
|
89
127
|
for (let i of t) {
|
|
90
|
-
let t = async (t) => new Set((await
|
|
91
|
-
for (let [e, t] of
|
|
128
|
+
let t = async (t) => new Set((await y(e, `${i.name}_drafts`, n.site, t)).map((e) => String(e.documentId))), [a, o] = [await t(n.from), await t(n.to)], s = async (t) => new Map((await y(e, `${i.name}_published`, n.site, t)).map((e) => [`${String(e.documentId)}\u0000${String(e.locale)}`, e])), [c, u] = [await s(n.from), await s(n.to)], d = [];
|
|
129
|
+
for (let [e, t] of c) {
|
|
92
130
|
let n = u.get(e);
|
|
93
|
-
n !== void 0 &&
|
|
131
|
+
n !== void 0 && S(l(i, t)) !== S(l(i, n)) && d.push({
|
|
94
132
|
documentId: String(t.documentId),
|
|
95
133
|
locale: String(t.locale),
|
|
96
|
-
title:
|
|
134
|
+
title: C(n)
|
|
97
135
|
});
|
|
98
136
|
}
|
|
99
137
|
r.push({
|
|
@@ -104,6 +142,6 @@ var p = (e, t, n, r) => e.query({
|
|
|
104
142
|
});
|
|
105
143
|
}
|
|
106
144
|
return r;
|
|
107
|
-
},
|
|
145
|
+
}, T = (...e) => n(() => w(...e)), E = (...r) => n(() => x(...r), t, e);
|
|
108
146
|
//#endregion
|
|
109
|
-
export {
|
|
147
|
+
export { w as compareEnvironments, T as compareEnvironmentsEffect, x as copyEnvironment, E as copyEnvironmentEffect, b as lockEnvironmentPairForPublication };
|
package/dist/errors.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { Schema as e } from "effect";
|
|
2
2
|
//#region src/errors.ts
|
|
3
|
-
var t = e.
|
|
3
|
+
var t = class extends e.TaggedError()("EnvironmentAliasUnavailable", { reason: e.Literals([
|
|
4
|
+
"scope",
|
|
5
|
+
"name",
|
|
6
|
+
"target",
|
|
7
|
+
"missing",
|
|
8
|
+
"conflict",
|
|
9
|
+
"revision",
|
|
10
|
+
"state"
|
|
11
|
+
]) }) {}, n = e.Struct({
|
|
4
12
|
field: e.String,
|
|
5
13
|
rule: e.String,
|
|
6
14
|
message: e.String
|
|
7
|
-
}),
|
|
15
|
+
}), r = class extends e.TaggedError()("ContentValidationFailed", {
|
|
8
16
|
contentType: e.String,
|
|
9
|
-
violations: e.Array(
|
|
10
|
-
}) {},
|
|
17
|
+
violations: e.Array(n)
|
|
18
|
+
}) {}, i = class extends e.TaggedError()("ContentNotFound", {
|
|
11
19
|
contentType: e.String,
|
|
12
20
|
id: e.String,
|
|
13
21
|
stage: e.Literals([
|
|
@@ -16,25 +24,25 @@ var t = e.Struct({
|
|
|
16
24
|
"revision",
|
|
17
25
|
"share"
|
|
18
26
|
])
|
|
19
|
-
}) {},
|
|
27
|
+
}) {}, a = class extends e.TaggedError()("ContentGone", {
|
|
20
28
|
contentType: e.String,
|
|
21
29
|
path: e.String
|
|
22
|
-
}) {},
|
|
30
|
+
}) {}, o = class extends e.TaggedError()("ContentIdConflict", {
|
|
23
31
|
contentType: e.String,
|
|
24
32
|
id: e.String
|
|
25
|
-
}) {},
|
|
33
|
+
}) {}, s = class extends e.TaggedError()("RevisionMismatch", {
|
|
26
34
|
contentType: e.String,
|
|
27
35
|
id: e.String,
|
|
28
36
|
expected: e.String,
|
|
29
37
|
actual: e.String
|
|
30
|
-
}) {},
|
|
38
|
+
}) {}, c = class extends e.TaggedError()("ReleaseNotEditable", {
|
|
31
39
|
id: e.String,
|
|
32
40
|
status: e.String
|
|
33
|
-
}) {},
|
|
41
|
+
}) {}, l = class extends e.TaggedError()("PreviewShareRejected", { reason: e.Literals(["expiryInPast", "expiryTooFar"]) }) {}, u = class extends e.TaggedError()("ReviewRequired", {
|
|
34
42
|
contentType: e.String,
|
|
35
43
|
id: e.String,
|
|
36
44
|
revisionId: e.String
|
|
37
|
-
}) {},
|
|
45
|
+
}) {}, d = class extends e.TaggedError()("ReviewStepRefused", {
|
|
38
46
|
contentType: e.String,
|
|
39
47
|
id: e.String,
|
|
40
48
|
reason: e.Literals([
|
|
@@ -42,7 +50,7 @@ var t = e.Struct({
|
|
|
42
50
|
"selfApproval",
|
|
43
51
|
"ambiguousOrder"
|
|
44
52
|
])
|
|
45
|
-
}) {},
|
|
53
|
+
}) {}, f = class extends e.TaggedError()("ReferenceUnavailable", {
|
|
46
54
|
contentType: e.String,
|
|
47
55
|
id: e.String,
|
|
48
56
|
targets: e.Array(e.Struct({
|
|
@@ -58,10 +66,42 @@ var t = e.Struct({
|
|
|
58
66
|
"purpose"
|
|
59
67
|
])
|
|
60
68
|
}))
|
|
61
|
-
}) {},
|
|
69
|
+
}) {}, p = class extends e.TaggedError()("QuotaExceeded", {
|
|
62
70
|
quota: e.String,
|
|
63
71
|
limit: e.Number,
|
|
64
72
|
used: e.Number
|
|
65
|
-
}) {}
|
|
73
|
+
}) {}, m = class extends e.TaggedError()("ChangeFeedUnavailable", { reason: e.Literals([
|
|
74
|
+
"scope",
|
|
75
|
+
"cursor",
|
|
76
|
+
"migration",
|
|
77
|
+
"exhausted"
|
|
78
|
+
]) }) {}, h = class extends e.TaggedError()("SiteStateUnavailable", { reason: e.Literals(["scope", "state"]) }) {}, g = class extends e.TaggedError()("SiteBindingUnavailable", { reason: e.Literals([
|
|
79
|
+
"scope",
|
|
80
|
+
"name",
|
|
81
|
+
"target",
|
|
82
|
+
"missing",
|
|
83
|
+
"conflict",
|
|
84
|
+
"revision",
|
|
85
|
+
"state"
|
|
86
|
+
]) }) {}, _ = class extends e.TaggedError()("SiteDeliveryUnavailable", { reason: e.Literals([
|
|
87
|
+
"definition",
|
|
88
|
+
"environment",
|
|
89
|
+
"locale",
|
|
90
|
+
"fallback",
|
|
91
|
+
"prefix",
|
|
92
|
+
"binding"
|
|
93
|
+
]) }) {}, v = class extends e.TaggedError()("ContentLocationUnavailable", { reason: e.Literals([
|
|
94
|
+
"definition",
|
|
95
|
+
"field",
|
|
96
|
+
"tree",
|
|
97
|
+
"path",
|
|
98
|
+
"bounds"
|
|
99
|
+
]) }) {}, y = class extends e.TaggedError()("ContentSeoUnavailable", { reason: e.Literals([
|
|
100
|
+
"definition",
|
|
101
|
+
"field",
|
|
102
|
+
"defaults",
|
|
103
|
+
"values",
|
|
104
|
+
"scope"
|
|
105
|
+
]) }) {};
|
|
66
106
|
//#endregion
|
|
67
|
-
export {
|
|
107
|
+
export { m as ChangeFeedUnavailable, a as ContentGone, o as ContentIdConflict, v as ContentLocationUnavailable, i as ContentNotFound, y as ContentSeoUnavailable, r as ContentValidationFailed, t as EnvironmentAliasUnavailable, l as PreviewShareRejected, p as QuotaExceeded, f as ReferenceUnavailable, c as ReleaseNotEditable, u as ReviewRequired, d as ReviewStepRefused, s as RevisionMismatch, g as SiteBindingUnavailable, _ as SiteDeliveryUnavailable, h as SiteStateUnavailable };
|
package/dist/experiments.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ContentIdConflict as e, ContentNotFound as t, ContentValidationFailed as n, ReleaseNotEditable as r, RevisionMismatch as i } from "./errors.js";
|
|
2
|
+
import { asTyped as a } from "./effectForm.js";
|
|
3
3
|
import { saveDraft as o } from "./write.js";
|
|
4
4
|
import { CMS_RELEASE_ITEMS_TABLE as s, addToRelease as c, createRelease as l, releaseStatusOf as u } from "./release.js";
|
|
5
5
|
import { and as d, eq as f, id as p, integer as m, json as h, table as g, text as _, timestamp as v } from "@voltro/database";
|
|
@@ -518,11 +518,11 @@ var b = "cms_experiments", x = "cms_experiment_events", S = g(b, {
|
|
|
518
518
|
adopted: i
|
|
519
519
|
};
|
|
520
520
|
}, Y = [
|
|
521
|
-
r,
|
|
522
|
-
t,
|
|
523
521
|
n,
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
522
|
+
e,
|
|
523
|
+
t,
|
|
524
|
+
i,
|
|
525
|
+
r
|
|
526
|
+
], X = (...e) => a(() => V(...e)), Z = (...e) => a(() => K(...e)), Q = (...e) => a(() => H(...e)), $ = (...e) => a(() => U(...e)), ee = (...e) => a(() => B(...e)), te = (...e) => a(() => P(...e)), ne = (...e) => a(() => z(...e)), re = (...e) => a(() => q(...e), ...Y), ie = (...e) => a(() => L(...e)), ae = (...e) => a(() => J(...e));
|
|
527
527
|
//#endregion
|
|
528
528
|
export { b as CMS_EXPERIMENTS_TABLE, x as CMS_EXPERIMENT_EVENTS_TABLE, W as MIN_READERS, q as adoptWinner, re as adoptWinnerEffect, A as applyVariant, O as assignVariant, C as cmsExperimentEventsTable, S as cmsExperimentsTable, V as experimentById, X as experimentByIdEffect, j as experimentFields, J as experimentLineage, ae as experimentLineageEffect, M as experimentOverrideKeys, R as experimentReleaseHook, K as experimentResults, Z as experimentResultsEffect, H as listExperiments, Q as listExperimentsEffect, L as planExperiment, ie as planExperimentEffect, U as recordExperimentEvent, $ as recordExperimentEventEffect, B as runningExperiment, ee as runningExperimentEffect, P as startExperiment, te as startExperimentEffect, z as stopExperiment, ne as stopExperimentEffect };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createFrontendMediaReader as e } from "./frontendMedia.js";
|
|
2
|
+
import { admitSnapshotPresentation as t } from "./snapshotPresentation.js";
|
|
3
|
+
import { Schema as n } from "effect";
|
|
4
|
+
//#region src/frontendBindings.ts
|
|
5
|
+
var r = [
|
|
6
|
+
"empty",
|
|
7
|
+
"loading",
|
|
8
|
+
"error"
|
|
9
|
+
], i = class extends n.TaggedError()("FrontendBindingUnavailable", { reason: n.Literals([
|
|
10
|
+
"definition",
|
|
11
|
+
"missing",
|
|
12
|
+
"schema",
|
|
13
|
+
"implementation",
|
|
14
|
+
"context"
|
|
15
|
+
]) }) {}, a = (e) => {
|
|
16
|
+
throw new i({ reason: e });
|
|
17
|
+
}, o = (e) => typeof e == "string" && /^[A-Za-z][A-Za-z0-9_.:-]{0,127}$/.test(e), s = (e) => {
|
|
18
|
+
if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e)) || Object.getOwnPropertySymbols(e).length) return a("definition");
|
|
19
|
+
let t = Object.getOwnPropertyDescriptors(e);
|
|
20
|
+
return Object.values(t).some((e) => !e.enumerable || !("value" in e)) ? a("definition") : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.value]));
|
|
21
|
+
}, c = (e) => {
|
|
22
|
+
let t = s(e);
|
|
23
|
+
return Object.keys(t).length !== 2 || !o(t.channel) || !o(t.theme) ? a("definition") : Object.freeze({
|
|
24
|
+
channel: t.channel,
|
|
25
|
+
theme: t.theme
|
|
26
|
+
});
|
|
27
|
+
}, l = (e) => {
|
|
28
|
+
let t = s(e), n = c({
|
|
29
|
+
channel: t.channel,
|
|
30
|
+
theme: t.theme
|
|
31
|
+
});
|
|
32
|
+
return Object.keys(t).length !== 6 || typeof t.localeId != "string" || !/^[a-z][a-z0-9_-]{0,63}$/.test(t.localeId) || typeof t.contentLocale != "string" || t.contentLocale.length === 0 || t.contentLocale.length > 64 || t.contentLocale.trim() !== t.contentLocale || typeof t.languageTag != "string" || t.languageTag.length > 128 || !/^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)*$/.test(t.languageTag) || t.direction !== "ltr" && t.direction !== "rtl" ? a("definition") : Object.freeze({
|
|
33
|
+
...n,
|
|
34
|
+
localeId: t.localeId,
|
|
35
|
+
contentLocale: t.contentLocale,
|
|
36
|
+
languageTag: t.languageTag,
|
|
37
|
+
direction: t.direction
|
|
38
|
+
});
|
|
39
|
+
}, u = (e) => JSON.stringify(l(e)), d = (e) => {
|
|
40
|
+
if (!Array.isArray(e) || e.length === 0 || e.length > 1024 || Object.getOwnPropertySymbols(e).length || Object.keys(e).length !== e.length || Object.keys(e).some((e, t) => e !== String(t))) return a("definition");
|
|
41
|
+
let t = Object.getOwnPropertyDescriptors(e);
|
|
42
|
+
if (Object.entries(t).some(([e, t]) => e !== "length" && (!t.enumerable || !("value" in t)))) return a("definition");
|
|
43
|
+
let n = Array.from({ length: e.length }, (e, n) => l(t[String(n)].value)).map((e) => [u(e), e]).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
44
|
+
return new Set(n.map(([e]) => e)).size === n.length ? Object.freeze(n.map(([, e]) => e)) : a("definition");
|
|
45
|
+
}, f = (e, t) => e.some((e) => u(e) === u(t)), p = (e) => {
|
|
46
|
+
let t = s(e), n = /* @__PURE__ */ new Map();
|
|
47
|
+
return Object.keys(t).length > 4096 ? a("definition") : Object.freeze(Object.fromEntries(Object.keys(t).sort().map((e) => {
|
|
48
|
+
let i = s(t[e]), c = s(i.schema);
|
|
49
|
+
if (c.id !== e || !/^[a-z][a-zA-Z0-9]*$/.test(e) || Object.keys(i).some((e) => ![
|
|
50
|
+
"schema",
|
|
51
|
+
"renderer",
|
|
52
|
+
"contexts",
|
|
53
|
+
"render",
|
|
54
|
+
"restricted",
|
|
55
|
+
...r
|
|
56
|
+
].includes(e)) || !o(i.renderer)) return a("definition");
|
|
57
|
+
if (typeof i.render != "function" || r.some((e) => typeof i[e] != "function") || i.restricted !== void 0 && typeof i.restricted != "function" || c.consent !== void 0 && typeof i.restricted != "function") return a("implementation");
|
|
58
|
+
if (c.consent !== void 0 && (typeof c.consent != "string" || c.consent.length === 0)) return a("definition");
|
|
59
|
+
let l = d(i.contexts), u = [
|
|
60
|
+
"render",
|
|
61
|
+
...r,
|
|
62
|
+
"restricted"
|
|
63
|
+
].map((e) => i[e]), f = n.get(i.renderer);
|
|
64
|
+
return f !== void 0 && f.some((e, t) => e !== u[t]) ? a("implementation") : (n.set(i.renderer, u), [e, Object.freeze({
|
|
65
|
+
schema: i.schema,
|
|
66
|
+
renderer: i.renderer,
|
|
67
|
+
contexts: l,
|
|
68
|
+
render: i.render,
|
|
69
|
+
empty: i.empty,
|
|
70
|
+
loading: i.loading,
|
|
71
|
+
error: i.error,
|
|
72
|
+
...i.restricted === void 0 ? {} : { restricted: i.restricted }
|
|
73
|
+
})]);
|
|
74
|
+
})));
|
|
75
|
+
}, m = (n, i) => {
|
|
76
|
+
let o = p(n);
|
|
77
|
+
if (!Object.hasOwn(o, i.componentId)) return a("missing");
|
|
78
|
+
let s = o[i.componentId], c = l(i.context);
|
|
79
|
+
if (!f(s.contexts, c)) return a("context");
|
|
80
|
+
if (i.state !== "content" && !r.includes(i.state)) return a("definition");
|
|
81
|
+
let u = t(i.consentPurposes, i.presentation), d = s.schema.consent !== void 0 && !u.granted.some((e) => e.id === s.schema.consent), m = {
|
|
82
|
+
componentId: i.componentId,
|
|
83
|
+
context: c,
|
|
84
|
+
...i.source === void 0 ? {} : { source: i.source }
|
|
85
|
+
};
|
|
86
|
+
return i.observe?.({
|
|
87
|
+
componentId: i.componentId,
|
|
88
|
+
renderer: s.renderer,
|
|
89
|
+
handler: d ? "restricted" : i.state === "content" ? "render" : i.state
|
|
90
|
+
}), d ? s.restricted({
|
|
91
|
+
...m,
|
|
92
|
+
purpose: s.schema.consent
|
|
93
|
+
}) : i.state === "content" ? s.render(i.props, c, {
|
|
94
|
+
media: e(i.media?.entries ?? [], i.media?.fieldPath ?? [], i.media?.observe),
|
|
95
|
+
...i.source === void 0 ? {} : { source: i.source }
|
|
96
|
+
}) : s[i.state](m);
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { i as FrontendBindingUnavailable, d as copyFrontendContexts, l as copyFrontendOutputContext, c as copyFrontendOutputSelection, p as defineFrontendBindings, u as frontendContextKey, o as frontendRendererId, r as frontendStates, m as renderCapturedFrontendComponent, f as supportsFrontendContext };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/frontendMedia.ts
|
|
2
|
+
var e = (e, t = [], n) => {
|
|
3
|
+
let r = [...t];
|
|
4
|
+
return (t, i = { kind: "original" }) => {
|
|
5
|
+
let a = [...r, ...t], o = e.filter((e) => e.fieldPath.length === a.length && e.fieldPath.every((e, t) => e === a[t]) && e.output.kind === i.kind && (i.kind !== "rendition" || e.output.kind === "rendition" && e.output.slot === i.slot));
|
|
6
|
+
if (o.length > 1) throw Error("Ambiguous rendered media selection");
|
|
7
|
+
let s = o[0];
|
|
8
|
+
return s !== void 0 && n?.({
|
|
9
|
+
fieldPath: [...a],
|
|
10
|
+
output: { ...s.output }
|
|
11
|
+
}), s === void 0 ? null : {
|
|
12
|
+
url: s.url,
|
|
13
|
+
contentType: s.contentType
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as createFrontendMediaReader };
|