@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/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
3
|
//#region src/RichDocumentView.tsx
|
|
4
|
-
var s = ({ content: t, resolve: n }) => t.map((t,
|
|
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,
|
package/dist/aiCandidates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
@@ -194,6 +194,6 @@ 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 = (...
|
|
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));
|
|
198
198
|
//#endregion
|
|
199
199
|
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 };
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
//#region 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
|
+
//#endregion
|
|
101
|
+
export { m as createCmsApplicationBuildSnapshots };
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
//#region 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
|
+
//#endregion
|
|
102
|
+
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,46 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
import { createHash as t } from "node:crypto";
|
|
3
|
+
import { canonicalJson as n } from "@voltro/runtime";
|
|
4
|
+
//#region 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
|
+
//#endregion
|
|
46
|
+
export { r as AssetRevisionUnavailable, l as pinAssetRevision };
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
//#region 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
|
+
//#endregion
|
|
72
|
+
export { a as AssetUseRightsUnavailable, h as admitCapturedAssetUseRights, u as assertCurrentAssetUseRights, s as assetRightsFields, m as retainCapturedAssetUseRights };
|
package/dist/availability.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ReferenceUnavailable as e } from "./errors.js";
|
|
2
|
+
import { asTyped as t } from "./effectForm.js";
|
|
3
3
|
import { referencesOf as n } from "./references.js";
|
|
4
4
|
import { and as r, boolean as i, eq as a, gt as o, id as s, inSet as c, json as l, lte as u, table as d, text as f, timestamp as p } from "@voltro/database";
|
|
5
5
|
import { tenant as m } from "@voltro/plugin-multitenancy/mixin";
|
|
@@ -31,7 +31,13 @@ var h = "cms_availability", g = d(h, {
|
|
|
31
31
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
|
-
}, y =
|
|
34
|
+
}, y = (e, t, n = {}) => {
|
|
35
|
+
let r = (e, t, n = !1) => {
|
|
36
|
+
let r = _(e);
|
|
37
|
+
return r === null || t == null || t === "" ? !1 : !r.includes(n ? t.toUpperCase() : t);
|
|
38
|
+
}, i = v(e.availableUntil), a = v(e.availableFrom);
|
|
39
|
+
return e.blocked === !0 ? "blocked" : i !== null && i.getTime() <= t.getTime() ? "expired" : a !== null && a.getTime() > t.getTime() ? "notYet" : r(e.territories, n.territory, !0) ? "territory" : r(e.channels, n.channel) ? "channel" : r(e.purposes, n.purpose) ? "purpose" : null;
|
|
40
|
+
}, b = async (e, t, n, i) => {
|
|
35
41
|
let o = t.availability;
|
|
36
42
|
if (o === void 0) return;
|
|
37
43
|
let s = {
|
|
@@ -62,7 +68,7 @@ var h = "cms_availability", g = d(h, {
|
|
|
62
68
|
...s,
|
|
63
69
|
...l == null ? {} : { tenantId: l }
|
|
64
70
|
});
|
|
65
|
-
},
|
|
71
|
+
}, x = async (e, t, n, i = /* @__PURE__ */ new Date(), o = {}) => {
|
|
66
72
|
let s = /* @__PURE__ */ new Map(), l = [...new Set(t)];
|
|
67
73
|
if (l.length === 0) return s;
|
|
68
74
|
let u = await e.query({
|
|
@@ -72,16 +78,13 @@ var h = "cms_availability", g = d(h, {
|
|
|
72
78
|
take: void 0,
|
|
73
79
|
skip: void 0,
|
|
74
80
|
projection: void 0
|
|
75
|
-
})
|
|
76
|
-
let r = _(e);
|
|
77
|
-
return r === null || t == null || t === "" ? !1 : !r.includes(n ? t.toUpperCase() : t);
|
|
78
|
-
};
|
|
81
|
+
});
|
|
79
82
|
for (let e of u) {
|
|
80
|
-
let t = e.documentId, n =
|
|
81
|
-
|
|
83
|
+
let t = e.documentId, n = y(e, i, o);
|
|
84
|
+
n !== null && s.set(t, n);
|
|
82
85
|
}
|
|
83
86
|
return s;
|
|
84
|
-
},
|
|
87
|
+
}, S = async (e, t, n, i = /* @__PURE__ */ new Date()) => {
|
|
85
88
|
let s = new Date(i.getTime() + n * 864e5);
|
|
86
89
|
return (await e.query({
|
|
87
90
|
table: h,
|
|
@@ -102,11 +105,11 @@ var h = "cms_availability", g = d(h, {
|
|
|
102
105
|
days: Math.ceil((t.getTime() - i.getTime()) / 864e5)
|
|
103
106
|
}];
|
|
104
107
|
});
|
|
105
|
-
},
|
|
108
|
+
}, C = async (t, r, i, a, o, s = /* @__PURE__ */ new Date()) => {
|
|
106
109
|
let c = n(r, a);
|
|
107
110
|
if (c.length === 0) return;
|
|
108
|
-
let l = await
|
|
109
|
-
if (l.size !== 0) throw new
|
|
111
|
+
let l = await x(t, c.map((e) => e.targetDocumentId), o, s);
|
|
112
|
+
if (l.size !== 0) throw new e({
|
|
110
113
|
contentType: r.name,
|
|
111
114
|
id: i,
|
|
112
115
|
targets: c.filter((e) => l.has(e.targetDocumentId)).map((e) => ({
|
|
@@ -116,6 +119,6 @@ var h = "cms_availability", g = d(h, {
|
|
|
116
119
|
reason: l.get(e.targetDocumentId)
|
|
117
120
|
}))
|
|
118
121
|
});
|
|
119
|
-
},
|
|
122
|
+
}, w = [e], T = (...e) => t(() => S(...e)), E = (...e) => t(() => C(...e), ...w), D = (...e) => t(() => x(...e), ...w), O = (...e) => t(() => b(...e), ...w);
|
|
120
123
|
//#endregion
|
|
121
|
-
export { h as CMS_AVAILABILITY_TABLE,
|
|
124
|
+
export { h as CMS_AVAILABILITY_TABLE, C as assertReferencesAvailable, E as assertReferencesAvailableEffect, y as availabilityReason, g as cmsAvailabilityTable, S as expiringAmong, T as expiringAmongEffect, x as unavailableAmong, D as unavailableAmongEffect, b as writeAvailability, O as writeAvailabilityEffect };
|