@voltro/cms 0.86.0 → 0.88.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 +5484 -0
- package/README.md +138 -0
- package/THIRD-PARTY-NOTICES.md +1511 -276
- package/dist/ContentForm.js +1 -2
- package/dist/RichDocumentEditor.js +1 -2
- package/dist/RichDocumentView.js +82 -38
- package/dist/RichTextSurface.js +1 -2
- package/dist/aiCandidates.js +4 -5
- package/dist/aiOperations.js +1 -2
- package/dist/applicationBuildSnapshotService.js +100 -0
- package/dist/assetRenditions.js +101 -0
- package/dist/assetRevision.js +45 -0
- package/dist/assetUseRights.js +71 -0
- package/dist/audiences.js +1 -2
- package/dist/availability.js +20 -18
- package/dist/blueprint.js +76 -77
- package/dist/build.d.ts +3063 -0
- package/dist/build.js +37 -0
- package/dist/buildApplicationAdmission.js +15 -0
- package/dist/buildApplicationCatalog.js +135 -0
- package/dist/buildApplicationCatalogTable.js +23 -0
- package/dist/buildApplicationRest.js +98 -0
- package/dist/buildApplicationUpload.js +110 -0
- package/dist/buildSnapshot.js +400 -0
- package/dist/buildSnapshotApplicationPin.js +31 -0
- package/dist/buildSnapshotRest.js +209 -0
- package/dist/buildSnapshotService.js +264 -0
- package/dist/buildSnapshotTables.js +24 -0
- package/dist/bulk.js +72 -72
- package/dist/cacheIdentity.js +1 -2
- package/dist/changes.js +280 -64
- package/dist/cmsContext.js +1 -2
- package/dist/collections.js +1 -2
- package/dist/consent.js +6 -7
- package/dist/contentLocations.js +52 -0
- package/dist/contentProjection.js +82 -0
- package/dist/contentRouteIdentity.js +12 -0
- package/dist/contentRouteMaterializer.js +96 -0
- package/dist/contentRouteTypes.js +38 -0
- package/dist/contentSeo.js +188 -0
- package/dist/contentTreePath.js +59 -0
- package/dist/contentType.js +121 -105
- package/dist/contentValues.js +17 -0
- package/dist/contentfulImport.js +1 -2
- package/dist/copies.js +4 -5
- package/dist/cutover.js +1 -2
- package/dist/deliveryChecks.js +1 -2
- package/dist/domainHost.js +6 -0
- package/dist/domains.js +82 -89
- package/dist/draftTexts.js +38 -39
- package/dist/duplicates.js +24 -25
- package/dist/edgePurge.js +1 -2
- package/dist/editHistory.js +1 -2
- package/dist/effectForm.js +1 -2
- package/dist/environmentAliases.js +137 -0
- package/dist/environments.js +108 -71
- package/dist/errors.js +55 -16
- package/dist/experiments.js +8 -9
- package/dist/exposure.js +1 -2
- package/dist/extensionManifest.js +2 -3
- package/dist/extensions.js +1 -2
- package/dist/fieldSchema.js +1 -2
- package/dist/formStrings.js +1 -2
- package/dist/frontendBindings.js +98 -0
- package/dist/frontendMedia.js +17 -0
- package/dist/glossary.js +1 -2
- package/dist/history.js +1 -2
- package/dist/htmlImport.js +1 -2
- package/dist/index.d.ts +760 -47
- package/dist/index.js +89 -73
- package/dist/initializePublicRoutes.js +27 -0
- package/dist/liveContentRouteView.js +75 -0
- package/dist/media.js +1 -2
- package/dist/metrics.js +1 -2
- package/dist/migration.js +1 -2
- package/dist/migrationStages.js +1 -2
- package/dist/nativeOutputDeploymentService.js +204 -0
- package/dist/outputActivation.js +233 -0
- package/dist/outputActivationOrigin.js +50 -0
- package/dist/outputActivationStore.js +410 -0
- package/dist/outputActivationTables.js +10 -0
- package/dist/outputActivationTarget.js +80 -0
- package/dist/outputActivationTargetTable.js +24 -0
- package/dist/outputDeployment.js +173 -0
- package/dist/outputDeploymentRest.js +167 -0
- package/dist/outputDeploymentService.js +240 -0
- package/dist/outputRouteGraph.js +176 -0
- package/dist/outputSafetyArtifact.js +146 -0
- package/dist/outputTargetRest.js +61 -0
- package/dist/pathSegmentEncoding.js +3 -0
- package/dist/presenceAnchors.js +1 -2
- package/dist/preview.js +1 -2
- package/dist/privateCmsTransport.js +75 -0
- package/dist/privateNativeRouteReservation.js +9 -0
- package/dist/promotion.js +69 -61
- package/dist/publicBuild.js +89 -0
- package/dist/publicBuildRest.js +97 -0
- package/dist/publicBuildService.js +62 -0
- package/dist/publicOutputHttp.js +128 -0
- package/dist/publicOutputService.js +286 -0
- package/dist/publicPresentation.js +16 -0
- package/dist/publicRouteDispositionAdmission.js +37 -0
- package/dist/publicRouteHistoryStore.js +11 -0
- package/dist/publicRouteHistoryView.js +33 -0
- package/dist/publicRouteIntegrity.js +4 -0
- package/dist/publicRouteMutation.js +5 -0
- package/dist/publicRouteNamespace.js +133 -0
- package/dist/publicRoutePublication.js +35 -0
- package/dist/publicRouteRegistry.js +16 -0
- package/dist/publicRouteRegistryBinding.js +193 -0
- package/dist/publicRouteRegistryDefinition.js +75 -0
- package/dist/publicRouteSitePublication.js +39 -0
- package/dist/publicRouteTables.js +12 -0
- package/dist/publicRouteUrl.js +17 -0
- package/dist/publicationSeo.js +51 -0
- package/dist/publicationState.js +295 -0
- package/dist/quality.js +9 -10
- package/dist/reconfigurePublicRoutes.js +40 -0
- package/dist/recurrence.js +1 -2
- package/dist/redirects.js +105 -75
- package/dist/referenceGraph.js +16 -16
- package/dist/references.js +3 -4
- package/dist/release.js +178 -143
- package/dist/renderReadAuthority.js +42 -0
- package/dist/renderReadGrant.js +136 -0
- package/dist/rest.js +1 -2
- package/dist/review.js +29 -30
- package/dist/richDocument.js +56 -27
- package/dist/richInline.js +1 -2
- package/dist/routeDispositionGraph.js +43 -0
- package/dist/routeDispositionRest.js +50 -0
- package/dist/routeDispositionService.js +72 -0
- package/dist/routeDispositionStore.js +288 -0
- package/dist/routeDispositionTables.js +4 -0
- package/dist/routeDispositions.js +90 -0
- package/dist/routeHistoryStorage.js +319 -0
- package/dist/routeHistoryStore.js +11 -0
- package/dist/schedule.js +37 -38
- package/dist/search.js +1 -2
- package/dist/selectionIntent.js +1 -2
- package/dist/seo.js +2 -3
- package/dist/series.js +12 -13
- package/dist/share.js +14 -15
- package/dist/siteBindings.js +158 -0
- package/dist/siteBuildCandidate.js +103 -0
- package/dist/siteDelivery.js +114 -0
- package/dist/siteState.js +46 -0
- package/dist/snapshotAddressGraph.js +54 -0
- package/dist/snapshotAddressRead.js +72 -0
- package/dist/snapshotAppConsumer.js +70 -0
- package/dist/snapshotAppExecution.js +101 -0
- package/dist/snapshotApplication.js +74 -0
- package/dist/snapshotApprovedRouteDispositions.js +43 -0
- package/dist/snapshotAssetAssembly.js +69 -0
- package/dist/snapshotAssetAssemblyRest.js +49 -0
- package/dist/snapshotBindingRead.js +60 -0
- package/dist/snapshotCodeSeo.js +28 -0
- package/dist/snapshotComponent.js +33 -0
- package/dist/snapshotComponentSource.js +23 -0
- package/dist/snapshotConsumer.js +86 -0
- package/dist/snapshotContentIdentity.js +9 -0
- package/dist/snapshotDefinitions.js +263 -0
- package/dist/snapshotDocumentAssembly.js +192 -0
- package/dist/snapshotDocumentAssemblyRest.js +83 -0
- package/dist/snapshotDocumentProjection.js +201 -0
- package/dist/snapshotDocumentTransfer.js +34 -0
- package/dist/snapshotDocumentTransferRest.js +79 -0
- package/dist/snapshotDomains.js +55 -0
- package/dist/snapshotEnvironment.js +30 -0
- package/dist/snapshotFieldPlan.js +84 -0
- package/dist/snapshotFrontend.js +102 -0
- package/dist/snapshotLink.js +7 -0
- package/dist/snapshotMedia.js +110 -0
- package/dist/snapshotMediaCapture.js +245 -0
- package/dist/snapshotMediaFields.js +224 -0
- package/dist/snapshotMediaRead.js +184 -0
- package/dist/snapshotMediaReader.js +12 -0
- package/dist/snapshotObservation.js +15 -0
- package/dist/snapshotObservedRouteHistory.js +33 -0
- package/dist/snapshotOutputTransfer.js +77 -0
- package/dist/snapshotPageLoader.js +6 -0
- package/dist/snapshotPageSeo.js +58 -0
- package/dist/snapshotPathLocale.js +14 -0
- package/dist/snapshotPresentation.js +85 -0
- package/dist/snapshotPresentationPolicy.js +11 -0
- package/dist/snapshotProjection.js +118 -0
- package/dist/snapshotPublicAccess.js +160 -0
- package/dist/snapshotPublicRouteHistory.js +39 -0
- package/dist/snapshotReadAdmission.js +37 -0
- package/dist/snapshotRedirectOutput.js +150 -0
- package/dist/snapshotRedirectTargets.js +23 -0
- package/dist/snapshotRedirects.js +131 -0
- package/dist/snapshotReference.js +7 -0
- package/dist/snapshotReferenceAddress.js +9 -0
- package/dist/snapshotReferenceGraph.js +78 -0
- package/dist/snapshotReferenceRead.js +64 -0
- package/dist/snapshotRelease.js +98 -0
- package/dist/snapshotRender.js +360 -0
- package/dist/snapshotRenderDependencies.js +177 -0
- package/dist/snapshotRenditions.js +87 -0
- package/dist/snapshotRichDocument.js +61 -0
- package/dist/snapshotRoleTransfer.js +105 -0
- package/dist/snapshotRoleTransferRest.js +98 -0
- package/dist/snapshotRouteAdmission.js +70 -0
- package/dist/snapshotRouteDispatch.js +110 -0
- package/dist/snapshotRouteDispositionPlan.js +72 -0
- package/dist/snapshotRouteRead.js +42 -0
- package/dist/snapshotRoutes.js +78 -0
- package/dist/snapshotRouting.js +112 -0
- package/dist/snapshotSeo.js +178 -0
- package/dist/snapshotSeoControls.js +100 -0
- package/dist/snapshotSeoDocumentInventory.js +114 -0
- package/dist/snapshotSeoDocuments.js +128 -0
- package/dist/snapshotSeoMerge.js +84 -0
- package/dist/snapshotSeoMetadata.js +136 -0
- package/dist/snapshotSeoOutput.js +172 -0
- package/dist/snapshotSeoPathSets.js +104 -0
- package/dist/snapshotSeoRead.js +87 -0
- package/dist/snapshotSite.js +127 -0
- package/dist/snapshotSitemapFiles.js +35 -0
- package/dist/snapshotTreeDependencies.js +57 -0
- package/dist/snapshotTreeLoader.js +9 -0
- package/dist/snapshotTreeRead.js +157 -0
- package/dist/staticPathSet.js +176 -0
- package/dist/staticPathSetRest.js +128 -0
- package/dist/staticPathSetService.js +248 -0
- package/dist/staticPathSetStore.js +337 -0
- package/dist/stewardship.js +2 -3
- package/dist/taxonomy.js +1 -2
- package/dist/team.js +1 -2
- package/dist/templates.js +2 -3
- package/dist/trackChanges.js +1 -2
- package/dist/translation.js +1 -2
- package/dist/tree.js +10 -11
- package/dist/usage.js +1 -2
- package/dist/validation.js +54 -55
- package/dist/visualEditing.js +1 -2
- package/dist/web.d.ts +709 -7
- package/dist/web.js +50 -33
- package/dist/workflow.js +9 -10
- package/dist/write.js +251 -227
- package/dist/xliff.js +1 -2
- package/package.json +21 -7
package/dist/ContentForm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { newInstanceId as e } from "./validation.js";
|
|
|
2
2
|
import { contentFormStrings as t } from "./formStrings.js";
|
|
3
3
|
import { RichDocumentEditor as n } from "./RichDocumentEditor.js";
|
|
4
4
|
import { createElement as r, useId as i, useRef as a, useState as o } from "react";
|
|
5
|
-
|
|
5
|
+
// src/ContentForm.tsx
|
|
6
6
|
var s = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("input", {
|
|
7
7
|
type: "text",
|
|
8
8
|
id: e,
|
|
@@ -278,5 +278,4 @@ var s = ({ id: e, name: t, field: n, value: i, onChange: a }) => r("input", {
|
|
|
278
278
|
});
|
|
279
279
|
return r("div", { "data-cms-form": !0 }, ...w);
|
|
280
280
|
};
|
|
281
|
-
//#endregion
|
|
282
281
|
export { y as ContentForm, v as widgetFor };
|
|
@@ -6,7 +6,7 @@ import { RichDocumentView as f } from "./RichDocumentView.js";
|
|
|
6
6
|
import { RichTextSurface as p } from "./RichTextSurface.js";
|
|
7
7
|
import { useId as m, useMemo as h, useState as g } from "react";
|
|
8
8
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/RichDocumentEditor.tsx
|
|
10
10
|
var b = (e) => {
|
|
11
11
|
let t = i(e ?? ""), n = t.blocks;
|
|
12
12
|
return Array.isArray(n) ? t : {
|
|
@@ -546,5 +546,4 @@ var b = (e) => {
|
|
|
546
546
|
})]
|
|
547
547
|
});
|
|
548
548
|
};
|
|
549
|
-
//#endregion
|
|
550
549
|
export { w as RichDocumentEditor };
|
package/dist/RichDocumentView.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { contactLiteralHref as e, listNumberedAt as t, normalizeRichDocument as n, richDocumentProblems as r } from "./richDocument.js";
|
|
2
2
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
var s = ({ content: t, resolve: n }) => t.map((t,
|
|
3
|
+
// src/RichDocumentView.tsx
|
|
4
|
+
var s = ({ content: t, resolve: n, fieldPath: r }) => t.map((t, i) => {
|
|
5
5
|
if (t.type === "link" || t.type === "contact") {
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let o = t.type === "link" ? n.hrefOf(t.target, { fieldPath: [
|
|
7
|
+
...r,
|
|
8
|
+
i,
|
|
9
|
+
"target"
|
|
10
|
+
] }) : "target" in t.contact ? n.contactHrefOf(t.contact.target, { fieldPath: [
|
|
11
|
+
...r,
|
|
12
|
+
i,
|
|
13
|
+
"contact",
|
|
14
|
+
"target"
|
|
15
|
+
] }) : e(t.contact.channel, t.contact.value);
|
|
16
|
+
return o === void 0 ? /* @__PURE__ */ a("span", { children: t.text }, i) : /* @__PURE__ */ a("a", {
|
|
17
|
+
href: o,
|
|
9
18
|
children: t.text
|
|
10
|
-
},
|
|
19
|
+
}, i);
|
|
11
20
|
}
|
|
12
|
-
let
|
|
13
|
-
return
|
|
21
|
+
let o = t.marks ?? [], s = t.text;
|
|
22
|
+
return o.includes("underline") && (s = /* @__PURE__ */ a("u", { children: s })), o.includes("italic") && (s = /* @__PURE__ */ a("em", { children: s })), o.includes("bold") && (s = /* @__PURE__ */ a("strong", { children: s })), /* @__PURE__ */ a("span", {
|
|
14
23
|
...t.style === void 0 ? {} : { "data-style": t.style },
|
|
15
|
-
children:
|
|
16
|
-
},
|
|
24
|
+
children: s
|
|
25
|
+
}, i);
|
|
17
26
|
}).map((e, n) => {
|
|
18
27
|
let r = t[n]?.change;
|
|
19
28
|
if (r === void 0) return e;
|
|
@@ -23,14 +32,19 @@ var s = ({ content: t, resolve: n }) => t.map((t, r) => {
|
|
|
23
32
|
title: r.by,
|
|
24
33
|
children: e
|
|
25
34
|
}, n);
|
|
26
|
-
}), c = (e) => "style" in e && e.style !== void 0 ? { "data-style": e.style } : {}, l = ({ block: e,
|
|
35
|
+
}), c = (e) => "style" in e && e.style !== void 0 ? { "data-style": e.style } : {}, l = ({ block: e, index: n, resolve: r, renderImage: i, renderComponent: l, fileHrefOf: u }) => {
|
|
27
36
|
switch (e.type) {
|
|
28
37
|
case "paragraph": return /* @__PURE__ */ a("p", {
|
|
29
38
|
"data-block-id": e.id,
|
|
30
39
|
...c(e),
|
|
31
40
|
children: /* @__PURE__ */ a(s, {
|
|
32
41
|
content: e.content,
|
|
33
|
-
resolve:
|
|
42
|
+
resolve: r,
|
|
43
|
+
fieldPath: [
|
|
44
|
+
"blocks",
|
|
45
|
+
n,
|
|
46
|
+
"content"
|
|
47
|
+
]
|
|
34
48
|
})
|
|
35
49
|
});
|
|
36
50
|
case "heading": return e.level === 2 ? /* @__PURE__ */ a("h2", {
|
|
@@ -38,56 +52,86 @@ var s = ({ content: t, resolve: n }) => t.map((t, r) => {
|
|
|
38
52
|
...c(e),
|
|
39
53
|
children: /* @__PURE__ */ a(s, {
|
|
40
54
|
content: e.content,
|
|
41
|
-
resolve:
|
|
55
|
+
resolve: r,
|
|
56
|
+
fieldPath: [
|
|
57
|
+
"blocks",
|
|
58
|
+
n,
|
|
59
|
+
"content"
|
|
60
|
+
]
|
|
42
61
|
})
|
|
43
62
|
}) : /* @__PURE__ */ a("h3", {
|
|
44
63
|
"data-block-id": e.id,
|
|
45
64
|
...c(e),
|
|
46
65
|
children: /* @__PURE__ */ a(s, {
|
|
47
66
|
content: e.content,
|
|
48
|
-
resolve:
|
|
67
|
+
resolve: r,
|
|
68
|
+
fieldPath: [
|
|
69
|
+
"blocks",
|
|
70
|
+
n,
|
|
71
|
+
"content"
|
|
72
|
+
]
|
|
49
73
|
})
|
|
50
74
|
});
|
|
51
75
|
case "list": {
|
|
52
|
-
let
|
|
53
|
-
let
|
|
54
|
-
for (;
|
|
55
|
-
let t =
|
|
56
|
-
|
|
76
|
+
let i = e.levels ?? e.items.map(() => 0), l = (n) => t(e, n) ? "ol" : "ul", u = (t, c) => {
|
|
77
|
+
let d = [], f = t;
|
|
78
|
+
for (; f < e.items.length && i[f] >= c;) {
|
|
79
|
+
let t = f, [i, p] = u(f + 1, c + 1), m = l(c + 1);
|
|
80
|
+
d.push(/* @__PURE__ */ o("li", { children: [/* @__PURE__ */ a(s, {
|
|
57
81
|
content: e.items[t],
|
|
58
|
-
resolve:
|
|
59
|
-
|
|
82
|
+
resolve: r,
|
|
83
|
+
fieldPath: [
|
|
84
|
+
"blocks",
|
|
85
|
+
n,
|
|
86
|
+
"items",
|
|
87
|
+
t
|
|
88
|
+
]
|
|
89
|
+
}), i.length > 0 ? /* @__PURE__ */ a(m, { children: i }) : null] }, t)), f = p;
|
|
60
90
|
}
|
|
61
|
-
return [
|
|
62
|
-
},
|
|
63
|
-
return /* @__PURE__ */ a(
|
|
91
|
+
return [d, f];
|
|
92
|
+
}, d = l(0);
|
|
93
|
+
return /* @__PURE__ */ a(d, {
|
|
64
94
|
"data-block-id": e.id,
|
|
65
95
|
...c(e),
|
|
66
|
-
children:
|
|
96
|
+
children: u(0, 0)[0]
|
|
67
97
|
});
|
|
68
98
|
}
|
|
69
99
|
case "table": {
|
|
70
|
-
let [t, ...
|
|
100
|
+
let [t, ...i] = e.header ? e.rows : [void 0, ...e.rows];
|
|
71
101
|
return /* @__PURE__ */ o("table", {
|
|
72
102
|
"data-block-id": e.id,
|
|
73
103
|
children: [t === void 0 ? null : /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: t.map((e, t) => /* @__PURE__ */ a("th", {
|
|
74
104
|
scope: "col",
|
|
75
105
|
children: /* @__PURE__ */ a(s, {
|
|
76
106
|
content: e,
|
|
77
|
-
resolve:
|
|
107
|
+
resolve: r,
|
|
108
|
+
fieldPath: [
|
|
109
|
+
"blocks",
|
|
110
|
+
n,
|
|
111
|
+
"rows",
|
|
112
|
+
0,
|
|
113
|
+
t
|
|
114
|
+
]
|
|
78
115
|
})
|
|
79
|
-
}, t)) }) }), /* @__PURE__ */ a("tbody", { children:
|
|
80
|
-
content:
|
|
81
|
-
resolve:
|
|
82
|
-
|
|
116
|
+
}, t)) }) }), /* @__PURE__ */ a("tbody", { children: i.map((t, i) => /* @__PURE__ */ a("tr", { children: (t ?? []).map((t, o) => /* @__PURE__ */ a("td", { children: /* @__PURE__ */ a(s, {
|
|
117
|
+
content: t,
|
|
118
|
+
resolve: r,
|
|
119
|
+
fieldPath: [
|
|
120
|
+
"blocks",
|
|
121
|
+
n,
|
|
122
|
+
"rows",
|
|
123
|
+
i + +!!e.header,
|
|
124
|
+
o
|
|
125
|
+
]
|
|
126
|
+
}) }, o)) }, i)) })]
|
|
83
127
|
});
|
|
84
128
|
}
|
|
85
|
-
case "image": return
|
|
129
|
+
case "image": return i === void 0 ? null : /* @__PURE__ */ a("div", {
|
|
86
130
|
"data-block-id": e.id,
|
|
87
|
-
children:
|
|
131
|
+
children: i(e, { index: n })
|
|
88
132
|
});
|
|
89
133
|
case "file": {
|
|
90
|
-
let t =
|
|
134
|
+
let t = u(e.asset, { index: n });
|
|
91
135
|
return t === void 0 ? null : /* @__PURE__ */ a("p", {
|
|
92
136
|
"data-block-id": e.id,
|
|
93
137
|
"data-file": !0,
|
|
@@ -98,10 +142,10 @@ var s = ({ content: t, resolve: n }) => t.map((t, r) => {
|
|
|
98
142
|
})
|
|
99
143
|
});
|
|
100
144
|
}
|
|
101
|
-
case "component": return
|
|
145
|
+
case "component": return l === void 0 ? null : /* @__PURE__ */ a("div", {
|
|
102
146
|
"data-block-id": e.id,
|
|
103
147
|
"data-component": e.componentId,
|
|
104
|
-
children:
|
|
148
|
+
children: l(e, { index: n })
|
|
105
149
|
});
|
|
106
150
|
}
|
|
107
151
|
}, u = ({ block: e, children: t }) => e.change === void 0 || t === null ? t : /* @__PURE__ */ a("div", {
|
|
@@ -117,10 +161,11 @@ var s = ({ content: t, resolve: n }) => t.map((t, r) => {
|
|
|
117
161
|
return r("", p, {
|
|
118
162
|
images: "*",
|
|
119
163
|
links: "*"
|
|
120
|
-
}).some((e) => e.rule === "type" || e.rule === "unknown") ? null : /* @__PURE__ */ a(i, { children: p.blocks.map((e) => /* @__PURE__ */ a(u, {
|
|
164
|
+
}).some((e) => e.rule === "type" || e.rule === "unknown") ? null : /* @__PURE__ */ a(i, { children: p.blocks.map((e, t) => /* @__PURE__ */ a(u, {
|
|
121
165
|
block: e,
|
|
122
166
|
children: /* @__PURE__ */ a(l, {
|
|
123
167
|
block: e,
|
|
168
|
+
index: t,
|
|
124
169
|
resolve: f,
|
|
125
170
|
renderImage: o,
|
|
126
171
|
renderComponent: c,
|
|
@@ -128,5 +173,4 @@ var s = ({ content: t, resolve: n }) => t.map((t, r) => {
|
|
|
128
173
|
})
|
|
129
174
|
}, e.id)) });
|
|
130
175
|
};
|
|
131
|
-
//#endregion
|
|
132
176
|
export { d as RichDocumentView };
|
package/dist/RichTextSurface.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasMark as e, inlineFromDom as t, inlineHtml as n, replaceText as r, toggleMark as i } from "./richInline.js";
|
|
2
2
|
import { createElement as a, useEffect as o, useRef as s } from "react";
|
|
3
|
-
|
|
3
|
+
// src/RichTextSurface.tsx
|
|
4
4
|
var c = (e, t, n) => {
|
|
5
5
|
let r = 0, i = null, a = (e) => {
|
|
6
6
|
if (i === null) {
|
|
@@ -131,5 +131,4 @@ var c = (e, t, n) => {
|
|
|
131
131
|
"data-cms-rich-text": !0
|
|
132
132
|
}));
|
|
133
133
|
};
|
|
134
|
-
//#endregion
|
|
135
134
|
export { p as RichTextSurface, d as selectionIn };
|
package/dist/aiCandidates.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ContentIdConflict as e, ContentNotFound as t, ContentValidationFailed as n, RevisionMismatch as r } from "./errors.js";
|
|
2
|
+
import { asTyped as i } from "./effectForm.js";
|
|
3
3
|
import { saveDraft as a } from "./write.js";
|
|
4
4
|
import { settleAiOperation as o } from "./aiOperations.js";
|
|
5
5
|
import { and as s, eq as c, id as l, json as u, table as d, text as f, timestamp as p } from "@voltro/database";
|
|
6
6
|
import { tenant as m } from "@voltro/plugin-multitenancy/mixin";
|
|
7
|
-
|
|
7
|
+
// src/aiCandidates.ts
|
|
8
8
|
var h = "cms_ai_candidates", g = d(h, {
|
|
9
9
|
id: l({ prefix: "caic" }),
|
|
10
10
|
contentType: f().maxLength(64),
|
|
@@ -194,6 +194,5 @@ var h = "cms_ai_candidates", g = d(h, {
|
|
|
194
194
|
take: 20,
|
|
195
195
|
skip: void 0,
|
|
196
196
|
projection: void 0
|
|
197
|
-
})).map(x), D = (...
|
|
198
|
-
//#endregion
|
|
197
|
+
})).map(x), D = (...e) => i(() => C(...e)), O = (...a) => i(() => w(...a), n, t, e, r), k = (...e) => i(() => T(...e)), A = (...e) => i(() => E(...e));
|
|
199
198
|
export { h as CMS_AI_CANDIDATES_TABLE, w as adoptCandidate, O as adoptCandidateEffect, v as candidateUnits, E as candidatesFor, A as candidatesForEffect, g as cmsAiCandidatesTable, T as discardCandidate, k as discardCandidateEffect, C as proposeCandidate, D as proposeCandidateEffect };
|
package/dist/aiOperations.js
CHANGED
|
@@ -2,7 +2,7 @@ import { asTyped as e } from "./effectForm.js";
|
|
|
2
2
|
import { and as t, eq as n, gte as r, id as i, integer as a, table as o, text as s } from "@voltro/database";
|
|
3
3
|
import { tenant as c } from "@voltro/plugin-multitenancy/mixin";
|
|
4
4
|
import { createHash as l } from "node:crypto";
|
|
5
|
-
|
|
5
|
+
// src/aiOperations.ts
|
|
6
6
|
var u = "cms_ai_operations", d = "cms_ai_settings", f = [
|
|
7
7
|
"suggested",
|
|
8
8
|
"failed",
|
|
@@ -148,5 +148,4 @@ var u = "cms_ai_operations", d = "cms_ai_settings", f = [
|
|
|
148
148
|
tenantId: t
|
|
149
149
|
}) : r === null && i.provider === "" ? await e.delete(d, String(i.id)) : await e.update(d, String(i.id), { monthlyTokens: r });
|
|
150
150
|
}, E = (...t) => e(() => C(...t)), D = (...t) => e(() => y(...t)), O = (...t) => e(() => b(...t)), k = (...t) => e(() => S(...t)), A = (...t) => e(() => T(...t)), j = (...t) => e(() => g(...t)), M = (...t) => e(() => w(...t)), N = (...t) => e(() => _(...t));
|
|
151
|
-
//#endregion
|
|
152
151
|
export { f as AI_OUTCOMES, u as CMS_AI_OPERATIONS_TABLE, d as CMS_AI_SETTINGS_TABLE, C as aiBudgetLeft, E as aiBudgetLeftEffect, y as aiOperationsFor, D as aiOperationsForEffect, b as aiSettings, O as aiSettingsEffect, S as aiTokensUsed, k as aiTokensUsedEffect, p as cmsAiOperationsTable, m as cmsAiSettingsTable, x as monthStart, h as promptHash, g as recordAiOperation, j as recordAiOperationEffect, T as setAiBudget, A as setAiBudgetEffect, w as setAiSettings, M as setAiSettingsEffect, _ as settleAiOperation, N as settleAiOperationEffect };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { copySiteScope as e } from "./siteState.js";
|
|
2
|
+
import { readRenderReadCredential as t } from "./renderReadAuthority.js";
|
|
3
|
+
import { readAdmittedBuildSnapshot as n, resolveSnapshotReadBinding as r } from "./snapshotReadAdmission.js";
|
|
4
|
+
import { readSnapshotAppExecution as i } from "./snapshotAppExecution.js";
|
|
5
|
+
import { verifyRenderReadGrant as a } from "./renderReadGrant.js";
|
|
6
|
+
import { copySnapshotConsumer as o } from "./snapshotConsumer.js";
|
|
7
|
+
import { CmsBuildSnapshotUnavailable as s, createCmsBuildSnapshots as c } from "./buildSnapshotService.js";
|
|
8
|
+
import { copyBuildSnapshotApplicationPin as l } from "./buildSnapshotApplicationPin.js";
|
|
9
|
+
import { Effect as u } from "effect";
|
|
10
|
+
import { canonicalJson as d } from "@voltro/protocol";
|
|
11
|
+
// src/applicationBuildSnapshotService.ts
|
|
12
|
+
var f = (e) => {
|
|
13
|
+
throw new s({ reason: e });
|
|
14
|
+
}, p = (e, t) => d(e) === d(t), m = (d) => {
|
|
15
|
+
let m = d.store, h = {
|
|
16
|
+
...e(d.scope),
|
|
17
|
+
environment: d.scope.environment
|
|
18
|
+
}, g = d.now ?? Date.now, _ = d.resolveApplication.bind(d), v = [d.key, ...d.verificationKeys ?? []].map((e) => ({
|
|
19
|
+
id: e.id,
|
|
20
|
+
material: new Uint8Array(e.material)
|
|
21
|
+
})), y = d.requiredScope, b = (e) => m.transactional(async (n) => {
|
|
22
|
+
let r = await t(n, h, e.apiKey, g());
|
|
23
|
+
return r === null || !r.scopes.includes(y) ? f("credential") : e.expectedApplication === void 0 ? f("configuration") : {
|
|
24
|
+
application: l(e.expectedApplication),
|
|
25
|
+
authority: r.id
|
|
26
|
+
};
|
|
27
|
+
}), x = (e) => m.transactional(async (r) => {
|
|
28
|
+
let a = g(), s = await t(r, h, e.apiKey, a);
|
|
29
|
+
if (s === null) return f("credential");
|
|
30
|
+
let c = await n(r, h, e.snapshot, a), u = await i(r, h, c), d = o(u.declaration.value, a);
|
|
31
|
+
return s.scopes.includes(d.requiredScope) ? {
|
|
32
|
+
application: l({
|
|
33
|
+
inputsId: u.inputsId,
|
|
34
|
+
executionId: u.executionId,
|
|
35
|
+
code: u.app
|
|
36
|
+
}),
|
|
37
|
+
authority: s.id
|
|
38
|
+
} : f("credential");
|
|
39
|
+
}), S = (e) => m.transactional(async (t) => {
|
|
40
|
+
let n = g(), { snapshot: o, binding: s } = await r(t, h, e.snapshot, e, n);
|
|
41
|
+
await a(t, e.token, s, {
|
|
42
|
+
keys: v,
|
|
43
|
+
now: n
|
|
44
|
+
});
|
|
45
|
+
let c = await i(t, h, o);
|
|
46
|
+
return {
|
|
47
|
+
application: l({
|
|
48
|
+
inputsId: c.inputsId,
|
|
49
|
+
executionId: c.executionId,
|
|
50
|
+
code: c.app
|
|
51
|
+
}),
|
|
52
|
+
authority: s.buildId
|
|
53
|
+
};
|
|
54
|
+
}), C = (e, t) => u.tryPromise({
|
|
55
|
+
try: async () => {
|
|
56
|
+
let n = structuredClone(e), r = await t(n), i = await _(l(r.application)), a = l({
|
|
57
|
+
inputsId: i.inputsId,
|
|
58
|
+
executionId: i.executionId,
|
|
59
|
+
code: i.code
|
|
60
|
+
});
|
|
61
|
+
if (!p(a, r.application)) return f("configuration");
|
|
62
|
+
let o = {
|
|
63
|
+
...i,
|
|
64
|
+
code: a.code,
|
|
65
|
+
app: {
|
|
66
|
+
format: i.app.format,
|
|
67
|
+
entries: i.app.entries.bind(i.app)
|
|
68
|
+
},
|
|
69
|
+
execution: { run: i.execution.run.bind(i.execution) },
|
|
70
|
+
routeDiscovery: structuredClone(i.routeDiscovery)
|
|
71
|
+
};
|
|
72
|
+
return p(r, await t(n)) ? {
|
|
73
|
+
input: n,
|
|
74
|
+
service: c({
|
|
75
|
+
...d,
|
|
76
|
+
scope: h,
|
|
77
|
+
...o,
|
|
78
|
+
key: v[0],
|
|
79
|
+
verificationKeys: v.slice(1)
|
|
80
|
+
})
|
|
81
|
+
} : f("credential");
|
|
82
|
+
},
|
|
83
|
+
catch: (e) => e instanceof s ? e : new s({ reason: "configuration" })
|
|
84
|
+
}), w = (e) => C(e, (e) => S({
|
|
85
|
+
...e,
|
|
86
|
+
path: "path" in e ? String(e.path) : "/"
|
|
87
|
+
}));
|
|
88
|
+
return {
|
|
89
|
+
capture: (e) => C(e, b).pipe(u.flatMap(({ input: e, service: t }) => t.capture(e))),
|
|
90
|
+
open: (e) => C(e, x).pipe(u.flatMap(({ input: e, service: t }) => t.open(e))),
|
|
91
|
+
read: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.read(e))),
|
|
92
|
+
readBinding: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.readBinding(e))),
|
|
93
|
+
readTree: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.readTree(e))),
|
|
94
|
+
render: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.render(e))),
|
|
95
|
+
renderSafety: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.renderSafety(e))),
|
|
96
|
+
renderRedirects: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.renderRedirects(e))),
|
|
97
|
+
renderSeo: (e) => w(e).pipe(u.flatMap(({ input: e, service: t }) => t.renderSeo(e)))
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export { m as createCmsApplicationBuildSnapshots };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
import { and as t, eq as n, json as r, table as i, text as a } from "@voltro/database";
|
|
3
|
+
import { createHash as o } from "node:crypto";
|
|
4
|
+
import { canonicalJson as s } from "@voltro/runtime";
|
|
5
|
+
// src/assetRenditions.ts
|
|
6
|
+
var c = "_voltro_cms_asset_renditions", l = "_voltro_cms_asset_rendition_selections", u = "_voltro_cms_asset_rendition_history";
|
|
7
|
+
i(c, {
|
|
8
|
+
id: a().maxLength(64),
|
|
9
|
+
tenantId: a().maxLength(64),
|
|
10
|
+
site: a().maxLength(64),
|
|
11
|
+
environment: a().maxLength(64),
|
|
12
|
+
versionId: a().maxLength(64),
|
|
13
|
+
requestDigest: a().maxLength(64),
|
|
14
|
+
digest: a().maxLength(64),
|
|
15
|
+
payload: r()
|
|
16
|
+
}).primaryKey(["id"]).index("cms_renditions_by_version", [
|
|
17
|
+
"tenantId",
|
|
18
|
+
"site",
|
|
19
|
+
"environment",
|
|
20
|
+
"versionId"
|
|
21
|
+
]).nonReactive(), i(l, {
|
|
22
|
+
id: a().maxLength(64),
|
|
23
|
+
tenantId: a().maxLength(64),
|
|
24
|
+
site: a().maxLength(64),
|
|
25
|
+
environment: a().maxLength(64),
|
|
26
|
+
versionId: a().maxLength(64),
|
|
27
|
+
slot: a().maxLength(64),
|
|
28
|
+
revisionId: a().maxLength(64).nullable(),
|
|
29
|
+
renditionId: a().maxLength(64).nullable()
|
|
30
|
+
}).primaryKey(["id"]).nonReactive(), i(u, {
|
|
31
|
+
id: a().maxLength(64),
|
|
32
|
+
tenantId: a().maxLength(64),
|
|
33
|
+
site: a().maxLength(64),
|
|
34
|
+
environment: a().maxLength(64),
|
|
35
|
+
selectionId: a().maxLength(64),
|
|
36
|
+
requestDigest: a().maxLength(64),
|
|
37
|
+
previousRevisionId: a().maxLength(64).nullable(),
|
|
38
|
+
versionId: a().maxLength(64),
|
|
39
|
+
slot: a().maxLength(64),
|
|
40
|
+
renditionId: a().maxLength(64).nullable()
|
|
41
|
+
}).primaryKey(["id"]).index("cms_rendition_history_by_selection", ["selectionId", "id"]).nonReactive();
|
|
42
|
+
var d = class extends e.TaggedError()("AssetRenditionUnavailable", { reason: e.Literals([
|
|
43
|
+
"scope",
|
|
44
|
+
"identity",
|
|
45
|
+
"publication",
|
|
46
|
+
"source",
|
|
47
|
+
"proof",
|
|
48
|
+
"missing",
|
|
49
|
+
"conflict",
|
|
50
|
+
"integrity"
|
|
51
|
+
]) }) {}, f = (e) => {
|
|
52
|
+
throw new d({ reason: e });
|
|
53
|
+
}, p = (e) => o("sha256").update(s(e)).digest("hex"), m = (e) => typeof e == "string" && e.length > 0 && e.length <= 64 && e.trim() === e, h = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), g = (e) => {
|
|
54
|
+
let t = {
|
|
55
|
+
tenantId: e.tenantId,
|
|
56
|
+
site: e.site,
|
|
57
|
+
environment: e.environment
|
|
58
|
+
};
|
|
59
|
+
return Object.values(t).every(m) ? t : f("scope");
|
|
60
|
+
}, _ = (e) => t(n("tenantId", e.tenantId), n("site", e.site), n("environment", e.environment)), v = async (e, r, i, a) => (await e.query({
|
|
61
|
+
table: r,
|
|
62
|
+
predicate: t(_(i), n("id", a)),
|
|
63
|
+
lock: "update",
|
|
64
|
+
order: [],
|
|
65
|
+
take: 1,
|
|
66
|
+
skip: void 0,
|
|
67
|
+
projection: void 0
|
|
68
|
+
}))[0], y = (e) => JSON.parse(s(e)), b = (e, t) => {
|
|
69
|
+
let n = e.payload;
|
|
70
|
+
return typeof n != "object" || !n || n.version !== 1 || n.id !== e.id || !h(e.id) || !h(e.requestDigest) || !h(e.digest) || e.digest !== p(n) || n.tenantId !== t.tenantId || n.site !== t.site || n.environment !== t.environment || !n.asset || n.asset.versionId !== e.versionId || !h(n.asset.versionId) || !n.source || !n.output || n.source.id !== n.asset.fileRefId ? f("integrity") : (x(n.source, n.output), y({
|
|
71
|
+
...n,
|
|
72
|
+
digest: String(e.digest)
|
|
73
|
+
}));
|
|
74
|
+
}, x = (e, t) => {
|
|
75
|
+
let n = t.renditionProof;
|
|
76
|
+
if (e.version !== 1 || t.version !== 1 || e.tenantId !== t.tenantId || e.instance !== t.instance || e.bucket !== t.bucket || e.id === t.id || t.derivedFrom !== e.id || n == null || n.version !== 1 || !n.source || !n.output || n.source.id !== e.id || n.source.metadataDigest !== e.sourceDigest || n.source.size !== e.size || n.source.contentType !== e.contentType || n.output.checksum !== t.checksum || n.output.size !== t.size || n.output.contentType !== t.contentType || h(e.checksum) && e.checksum !== n.source.checksum) return f("proof");
|
|
77
|
+
}, S = async (e, t, n) => {
|
|
78
|
+
let r = g(t);
|
|
79
|
+
if (!h(n)) return f("identity");
|
|
80
|
+
let i = await v(e, c, r, n);
|
|
81
|
+
return i === void 0 ? f("missing") : b(i, r);
|
|
82
|
+
}, C = (e, t, n) => p([
|
|
83
|
+
"cms-asset-rendition-selection/v1",
|
|
84
|
+
e,
|
|
85
|
+
t,
|
|
86
|
+
n
|
|
87
|
+
]), w = (e, t) => !h(e.versionId) || !m(e.slot) || !h(e.revisionId) || e.id !== C(t, e.versionId, e.slot) || e.renditionId !== null && !h(e.renditionId) ? f("integrity") : {
|
|
88
|
+
id: String(e.id),
|
|
89
|
+
versionId: e.versionId,
|
|
90
|
+
slot: e.slot,
|
|
91
|
+
revisionId: e.revisionId,
|
|
92
|
+
renditionId: e.renditionId
|
|
93
|
+
}, T = async (e, t, n, r) => {
|
|
94
|
+
let i = g(t);
|
|
95
|
+
if (!h(n) || !m(r)) return f("identity");
|
|
96
|
+
let a = await v(e, l, i, C(i, n, r));
|
|
97
|
+
if (a === void 0) return null;
|
|
98
|
+
let o = w(a, i), s = await v(e, u, i, o.revisionId);
|
|
99
|
+
return s === void 0 || s.selectionId !== o.id || s.versionId !== o.versionId || s.slot !== o.slot || s.renditionId !== o.renditionId ? f("integrity") : o;
|
|
100
|
+
};
|
|
101
|
+
export { c as ASSET_RENDITIONS, u as ASSET_RENDITION_HISTORY, l as ASSET_RENDITION_SELECTIONS, d as AssetRenditionUnavailable, S as readAssetRendition, T as readAssetRenditionSelection };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
import { createHash as t } from "node:crypto";
|
|
3
|
+
import { canonicalJson as n } from "@voltro/runtime";
|
|
4
|
+
// src/assetRevision.ts
|
|
5
|
+
var r = class extends e.TaggedError()("AssetRevisionUnavailable", { reason: e.Literals(["definition", "publication"]) }) {}, i = (e) => {
|
|
6
|
+
throw new r({ reason: e });
|
|
7
|
+
}, a = (e) => t("sha256").update(n(e)).digest("hex"), o = (e) => typeof e == "string" && e.length > 0 && e.length <= 64, s = (e) => typeof e == "string" && /^[a-f0-9]{64}$/.test(e), c = (e) => typeof e != "object" || !e || Array.isArray(e) ? i("definition") : e, l = (e, t, n, r) => {
|
|
8
|
+
let l = t.name, u = c(t.asset), d = c(t.fields), f = u.file;
|
|
9
|
+
if (!o(l) || !o(f) || Object.keys(u).some((e) => e !== "file") || !Object.hasOwn(d, f) || c(d[f]).kind !== "media" || c(d[f]).isOptional === !0 || !s(n)) return i("definition");
|
|
10
|
+
if (!Object.values(e).every(o) || r.tenantId !== e.tenantId || r.site !== e.site || r.environment !== e.environment || r.status !== "published" || ![
|
|
11
|
+
r.id,
|
|
12
|
+
r.documentId,
|
|
13
|
+
r.revisionId,
|
|
14
|
+
r.locale,
|
|
15
|
+
r[f]
|
|
16
|
+
].every(o) || !Number.isSafeInteger(r.revision) || Number(r.revision) < 1) return i("publication");
|
|
17
|
+
let p = String(r.documentId), m = String(r.locale), h = String(r.revisionId), g = a([
|
|
18
|
+
"cms-asset/v1",
|
|
19
|
+
e.tenantId,
|
|
20
|
+
e.site,
|
|
21
|
+
l,
|
|
22
|
+
p
|
|
23
|
+
]), _ = Object.fromEntries(Object.keys(d).filter((e) => Object.hasOwn(r, e)).map((e) => [e, r[e]]));
|
|
24
|
+
return {
|
|
25
|
+
version: 1,
|
|
26
|
+
assetId: g,
|
|
27
|
+
versionId: a([
|
|
28
|
+
"cms-asset-version/v1",
|
|
29
|
+
g,
|
|
30
|
+
m,
|
|
31
|
+
h
|
|
32
|
+
]),
|
|
33
|
+
contentType: l,
|
|
34
|
+
documentId: p,
|
|
35
|
+
variantId: String(r.id),
|
|
36
|
+
revisionId: h,
|
|
37
|
+
revision: Number(r.revision),
|
|
38
|
+
locale: m,
|
|
39
|
+
fileField: f,
|
|
40
|
+
fileRefId: String(r[f]),
|
|
41
|
+
definitionDigest: n,
|
|
42
|
+
metadataDigest: a(_)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export { r as AssetRevisionUnavailable, l as pinAssetRevision };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CMS_AVAILABILITY_TABLE as e, availabilityReason as t } from "./availability.js";
|
|
2
|
+
import { Schema as n } from "effect";
|
|
3
|
+
import { and as r, eq as i } from "@voltro/database";
|
|
4
|
+
// src/assetUseRights.ts
|
|
5
|
+
var a = class extends n.TaggedError()("AssetUseRightsUnavailable", { reason: n.Literals(["input", "rights"]) }) {}, o = (e) => {
|
|
6
|
+
throw new a({ reason: e });
|
|
7
|
+
}, s = {
|
|
8
|
+
from: "availableFrom",
|
|
9
|
+
until: "availableUntil",
|
|
10
|
+
blocked: "blocked",
|
|
11
|
+
territories: "territories",
|
|
12
|
+
channels: "channels",
|
|
13
|
+
purposes: "purposes"
|
|
14
|
+
}, c = (e, n, r) => {
|
|
15
|
+
if (!Number.isSafeInteger(r) || !Number.isFinite(new Date(r).getTime())) return o("input");
|
|
16
|
+
if (e.blocked !== void 0 && e.blocked !== null && typeof e.blocked != "boolean") return o("rights");
|
|
17
|
+
for (let t of ["availableFrom", "availableUntil"]) {
|
|
18
|
+
let n = e[t];
|
|
19
|
+
if (n != null && (!(n instanceof Date) && typeof n != "string" || !Number.isFinite(n instanceof Date ? n.getTime() : Date.parse(String(n))))) return o("rights");
|
|
20
|
+
}
|
|
21
|
+
for (let [t, r] of [
|
|
22
|
+
["territories", n.territory],
|
|
23
|
+
["channels", n.channel],
|
|
24
|
+
["purposes", n.purpose]
|
|
25
|
+
]) {
|
|
26
|
+
let n = e[t];
|
|
27
|
+
if (n != null && (!Array.isArray(n) || !n.every((e) => typeof e == "string") || n.some((e) => e.trim() !== "") && r === null)) return o("rights");
|
|
28
|
+
}
|
|
29
|
+
if (t(e, new Date(r), n) !== null) return o("rights");
|
|
30
|
+
}, l = async (t, n, a, l, u, d, f) => {
|
|
31
|
+
l = structuredClone(l), d = { ...d }, c(l, d, f);
|
|
32
|
+
let p = await t.query({
|
|
33
|
+
table: e,
|
|
34
|
+
lock: "share",
|
|
35
|
+
predicate: r(i("tenantId", n.tenantId), i("site", n.site), i("environment", n.environment), i("contentType", a.contentType), i("documentId", a.documentId)),
|
|
36
|
+
order: [],
|
|
37
|
+
take: 2,
|
|
38
|
+
skip: void 0,
|
|
39
|
+
projection: void 0
|
|
40
|
+
});
|
|
41
|
+
if (p.length > 1 || u && p.length !== 1) return o("rights");
|
|
42
|
+
let m = p[0];
|
|
43
|
+
if (m !== void 0) {
|
|
44
|
+
if (m.tenantId !== n.tenantId || m.site !== n.site || m.environment !== n.environment || m.contentType !== a.contentType || m.documentId !== a.documentId || typeof m.blocked != "boolean" || Object.values(s).some((e) => !Object.hasOwn(m, e))) return o("rights");
|
|
45
|
+
c(m, d, f);
|
|
46
|
+
}
|
|
47
|
+
let h = m === void 0 ? void 0 : Object.fromEntries(Object.values(s).map((e) => [e, structuredClone(m[e])]));
|
|
48
|
+
return (e) => {
|
|
49
|
+
c(l, d, e), h !== void 0 && c(h, d, e);
|
|
50
|
+
};
|
|
51
|
+
}, u = async (e, t, n, r, i, a, o) => {
|
|
52
|
+
await l(e, t, n, r, i, a, o);
|
|
53
|
+
}, d = (e) => typeof e != "object" || !e || Array.isArray(e) ? o("rights") : e, f = (e, t) => Object.keys(e).sort().join(",") === t, p = (e) => typeof e == "string" && e.length > 0 && e.length <= 128 && !/[\x00-\x1f\x7f]/.test(e), m = async (e, t, n, r, i) => {
|
|
54
|
+
let a = d(n), u = d(a.use), m = d(a.captured);
|
|
55
|
+
if (!f(a, "asset,captured,requireRecord,use,version") || a.version !== 1 || typeof a.requireRecord != "boolean" || !f(u, "channel,purpose,territory") || !Object.values(u).every((e) => e === null || p(e) && e.trim() === e) || u.territory !== null && !/^[A-Za-z]{2}$/.test(String(u.territory)) || Object.keys(m).some((e) => !Object.values(s).includes(e))) return o("rights");
|
|
56
|
+
let h = {
|
|
57
|
+
territory: u.territory,
|
|
58
|
+
channel: u.channel,
|
|
59
|
+
purpose: u.purpose
|
|
60
|
+
};
|
|
61
|
+
if (i.territory !== h.territory || i.channel !== h.channel || i.purpose !== h.purpose) return o("rights");
|
|
62
|
+
if (c(m, h, r), a.asset === null) return a.requireRecord || Object.keys(m).length > 0 ? o("rights") : (e) => c({}, h, e);
|
|
63
|
+
let g = d(a.asset);
|
|
64
|
+
return !f(g, "contentType,documentId,versionId") || !p(g.contentType) || !p(g.documentId) || !p(g.versionId) ? o("rights") : l(e, t, {
|
|
65
|
+
contentType: g.contentType,
|
|
66
|
+
documentId: g.documentId
|
|
67
|
+
}, m, a.requireRecord, h, r);
|
|
68
|
+
}, h = async (e, t, n, r, i) => {
|
|
69
|
+
await m(e, t, n, r, i);
|
|
70
|
+
};
|
|
71
|
+
export { a as AssetUseRightsUnavailable, h as admitCapturedAssetUseRights, u as assertCurrentAssetUseRights, s as assetRightsFields, m as retainCapturedAssetUseRights };
|
package/dist/audiences.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/audiences.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
let { languages: t, countries: n, returning: r } = e.rule;
|
|
4
4
|
if ((t?.length ?? 0) === 0 && (n?.length ?? 0) === 0 && r === void 0) throw Error(`defineAudience('${e.id}'): the rule has no condition, so it would match every reader.`);
|
|
@@ -27,5 +27,4 @@ var e = (e) => {
|
|
|
27
27
|
i: t
|
|
28
28
|
};
|
|
29
29
|
}).filter((e) => e.tag !== "" && e.tag !== "*" && e.q > 0).sort((e, t) => t.q - e.q || e.i - t.i).map((e) => e.tag);
|
|
30
|
-
//#endregion
|
|
31
30
|
export { e as defineAudience, r as languagesOf, t as matchesAudience, n as pickVariant };
|