@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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cmsCredential as e, privateCmsHttpRoutes as t, privateCmsOperation as n } from "./privateCmsTransport.js";
|
|
2
|
+
import { CmsBuildSnapshotUnavailable as r } from "./buildSnapshotService.js";
|
|
3
|
+
import { Effect as i, Schema as a } from "effect";
|
|
4
|
+
import { strictInput as o } from "@voltro/protocol";
|
|
5
|
+
// src/snapshotAssetAssemblyRest.ts
|
|
6
|
+
var s = (s) => {
|
|
7
|
+
let c = {
|
|
8
|
+
namespace: "cms.snapshotAssets",
|
|
9
|
+
path: "/v1/cms/snapshot-assets",
|
|
10
|
+
operationPrefix: "cmsSnapshotAssets",
|
|
11
|
+
tags: ["CMS snapshot assets"],
|
|
12
|
+
error: r,
|
|
13
|
+
errorStatus: { CmsBuildSnapshotUnavailable: 409 },
|
|
14
|
+
credentialError: "CmsBuildSnapshotUnavailable"
|
|
15
|
+
}, l = a.Struct({
|
|
16
|
+
snapshot: a.Struct({
|
|
17
|
+
id: a.String,
|
|
18
|
+
digest: a.String
|
|
19
|
+
}),
|
|
20
|
+
consumerId: a.String,
|
|
21
|
+
buildId: a.String,
|
|
22
|
+
host: a.String,
|
|
23
|
+
documents: a.Struct({
|
|
24
|
+
artifactId: a.String,
|
|
25
|
+
pathSets: a.Array(a.Struct({
|
|
26
|
+
id: a.String,
|
|
27
|
+
digest: a.String
|
|
28
|
+
}))
|
|
29
|
+
})
|
|
30
|
+
}), u = [n(c, "render", "Compose private captured web and media assets", "Render-read bearer. The server verifies complete signed paths, every document and consent class, original renderer receipts and current media rights. Its fixed retained archive supplies the exact production web bytes. All physical bytes are rehashed through EOF and authority is rechecked after composition. No caller filesystem path or web asset identity is accepted. Returned artifact IDs confer no activation or serving authority.", o(l, c.namespace + ".render", !0), a.Struct({
|
|
31
|
+
artifactId: a.String,
|
|
32
|
+
files: a.Int,
|
|
33
|
+
bytes: a.Int
|
|
34
|
+
}), (t, n) => {
|
|
35
|
+
let a = e(n, c.credentialError);
|
|
36
|
+
return i.tryPromise({
|
|
37
|
+
try: () => s.render({
|
|
38
|
+
...t,
|
|
39
|
+
token: a
|
|
40
|
+
}),
|
|
41
|
+
catch: () => new r({ reason: "render" })
|
|
42
|
+
});
|
|
43
|
+
})];
|
|
44
|
+
return {
|
|
45
|
+
routes: u,
|
|
46
|
+
httpRoutes: t(u)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export { s as cmsSnapshotAssetsRest };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { copySnapshotPresentationValue as t } from "./snapshotPresentation.js";
|
|
3
|
+
import { admitSnapshotPublicDocument as n } from "./snapshotPublicAccess.js";
|
|
4
|
+
import { SnapshotRouteReadUnavailable as r } from "./snapshotRouteAdmission.js";
|
|
5
|
+
import { projectSnapshotDocument as i } from "./snapshotDocumentProjection.js";
|
|
6
|
+
import { readSnapshotRouteContext as a } from "./snapshotRouteRead.js";
|
|
7
|
+
import { canonicalJson as o } from "@voltro/runtime";
|
|
8
|
+
// src/snapshotBindingRead.ts
|
|
9
|
+
var s = () => {
|
|
10
|
+
throw new r({ reason: "binding" });
|
|
11
|
+
}, c = (e) => typeof e != "object" || !e || Array.isArray(e) ? s() : e, l = async (e, n, r, i, o) => {
|
|
12
|
+
let s = {
|
|
13
|
+
tenantId: n.tenantId,
|
|
14
|
+
site: n.site,
|
|
15
|
+
environment: n.environment
|
|
16
|
+
}, c = {
|
|
17
|
+
...i,
|
|
18
|
+
presentation: t(i.presentation)
|
|
19
|
+
}, l = o.now ?? Date.now(), d = await a(e, s, r, c, {
|
|
20
|
+
...o,
|
|
21
|
+
now: l
|
|
22
|
+
});
|
|
23
|
+
return d === null ? null : u(e, s, d, c.binding, l);
|
|
24
|
+
}, u = async (t, r, a, l, u) => {
|
|
25
|
+
let { snapshot: d, output: f } = a;
|
|
26
|
+
if (typeof l != "string" || l.length === 0 || l.length > 256 || /[\x00-\x1f\x7f]/.test(l)) return s();
|
|
27
|
+
let p = (await e(t, r, d, "site", "configuration")).value, m = c(c(p.definition).bindings);
|
|
28
|
+
if (!Object.hasOwn(m, l)) return null;
|
|
29
|
+
let h = m[l];
|
|
30
|
+
if (typeof h != "string" || h.length === 0) return s();
|
|
31
|
+
let g = (await e(t, r, d, "site", `binding:${l}`)).value, _ = c(g.binding);
|
|
32
|
+
if (g.version !== 3 || g.definitionDigest !== p.definitionDigest || g.tenantId !== r.tenantId || g.site !== r.site || g.environment !== r.environment || _.contentType !== h || typeof _.documentId != "string") return s();
|
|
33
|
+
let v = await n(t, r, d, h, f.localeId, _.documentId, u);
|
|
34
|
+
if (v === null) return null;
|
|
35
|
+
let y = v.chain[0], b = (await e(t, r, d, "site", `binding:${l}:locale:${y.locale}`)).value, x = c(b.variant);
|
|
36
|
+
if (b.version !== 3 || b.locale !== y.locale || b.documentId !== y.documentId || x.id !== y.variantId || x.revisionId !== y.revisionId || x.revision !== y.revision) return s();
|
|
37
|
+
let S = (await e(t, r, d, "schema", `type:${h}`)).value;
|
|
38
|
+
if (o(S.app) !== o(p.app)) return s();
|
|
39
|
+
let { values: C, components: w, presentation: T } = await i(t, r, d, h, y, S, u, a.output.presentation);
|
|
40
|
+
return {
|
|
41
|
+
snapshot: d,
|
|
42
|
+
document: y,
|
|
43
|
+
binding: a.binding,
|
|
44
|
+
routeId: f.routeId,
|
|
45
|
+
components: w,
|
|
46
|
+
output: {
|
|
47
|
+
snapshotId: d.id,
|
|
48
|
+
snapshotDigest: d.digest,
|
|
49
|
+
binding: l,
|
|
50
|
+
contentType: h,
|
|
51
|
+
localeId: f.localeId,
|
|
52
|
+
requestedLocale: v.requestedLocale,
|
|
53
|
+
sourceLocale: y.locale,
|
|
54
|
+
fallback: y.locale !== v.requestedLocale,
|
|
55
|
+
values: C,
|
|
56
|
+
presentation: T
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}, d = async (...e) => (await l(...e))?.output ?? null;
|
|
60
|
+
export { u as readAdmittedSnapshotBindingContext, d as readSnapshotBinding, l as readSnapshotBindingContext };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { copySnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
// src/snapshotCodeSeo.ts
|
|
3
|
+
var t = () => {
|
|
4
|
+
throw Error("Invalid retained code SEO");
|
|
5
|
+
}, n = (e, t) => typeof e == "string" && e.length > 0 && e.length <= t && !/[\x00-\x1f\x7f]/.test(e), r = (r) => {
|
|
6
|
+
let i = e({
|
|
7
|
+
key: "native-seo",
|
|
8
|
+
value: { metadata: r }
|
|
9
|
+
}).value.metadata;
|
|
10
|
+
if (typeof i != "object" || !i || Array.isArray(i)) return t();
|
|
11
|
+
let a = i;
|
|
12
|
+
if (Object.keys(a).sort().join(",") !== "alternates,canonical,noIndex,version" || a.version !== 1 || a.canonical !== null && !n(a.canonical, 8192) || typeof a.noIndex != "boolean" || !Array.isArray(a.alternates) || a.alternates.length > 1024) return t();
|
|
13
|
+
let o = a.alternates.map((e) => {
|
|
14
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return t();
|
|
15
|
+
let r = e;
|
|
16
|
+
return Object.keys(r).sort().join(",") !== "href,locale" || !n(r.href, 8192) || !n(r.locale, 128) ? t() : {
|
|
17
|
+
href: r.href,
|
|
18
|
+
locale: r.locale
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
return new Set(o.map((e) => e.locale)).size === o.length ? {
|
|
22
|
+
version: 1,
|
|
23
|
+
canonical: a.canonical,
|
|
24
|
+
noIndex: a.noIndex,
|
|
25
|
+
alternates: o
|
|
26
|
+
} : t();
|
|
27
|
+
};
|
|
28
|
+
export { r as copySnapshotCodeSeo };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { renderCapturedFrontendComponent as e } from "./frontendBindings.js";
|
|
2
|
+
import { snapshotComponentSource as t } from "./snapshotComponentSource.js";
|
|
3
|
+
import { snapshotObserver as n, snapshotProjectedValue as r } from "./snapshotObservation.js";
|
|
4
|
+
// src/snapshotComponent.ts
|
|
5
|
+
var i = (i, a, o, s = "content") => {
|
|
6
|
+
let c = r(i, o), l = n(i), u = [...o];
|
|
7
|
+
if (typeof c != "object" || !c || Array.isArray(c)) throw Error("Snapshot component unavailable");
|
|
8
|
+
let d = c;
|
|
9
|
+
if (typeof d.componentId != "string" || d.props === null || typeof d.props != "object" || Array.isArray(d.props)) throw Error("Snapshot component unavailable");
|
|
10
|
+
return e(a, {
|
|
11
|
+
componentId: d.componentId,
|
|
12
|
+
props: d.props,
|
|
13
|
+
context: i.context,
|
|
14
|
+
state: s,
|
|
15
|
+
presentation: i.presentation,
|
|
16
|
+
consentPurposes: i.consentPurposes,
|
|
17
|
+
source: t(i, u, d),
|
|
18
|
+
observe: (e) => l({
|
|
19
|
+
kind: "component",
|
|
20
|
+
fieldPath: u,
|
|
21
|
+
...e
|
|
22
|
+
}),
|
|
23
|
+
media: {
|
|
24
|
+
entries: i.media,
|
|
25
|
+
fieldPath: [...u, "props"],
|
|
26
|
+
observe: (e) => l({
|
|
27
|
+
kind: "media",
|
|
28
|
+
...e
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export { i as renderSnapshotComponent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { snapshotReference as e } from "./snapshotReference.js";
|
|
2
|
+
import { snapshotLink as t } from "./snapshotLink.js";
|
|
3
|
+
import { copySnapshotContentIdentity as n } from "./snapshotContentIdentity.js";
|
|
4
|
+
// src/snapshotComponentSource.ts
|
|
5
|
+
var r = (r, i, a) => {
|
|
6
|
+
let o = Object.freeze([...i]), s = a.type === "component" ? a.id : a.instanceId;
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
content: Object.freeze(n(r.content)),
|
|
9
|
+
fieldPath: o,
|
|
10
|
+
instanceId: typeof s == "string" && s.length > 0 ? s : null,
|
|
11
|
+
link: (e) => t(r, [
|
|
12
|
+
...o,
|
|
13
|
+
"props",
|
|
14
|
+
...e
|
|
15
|
+
]),
|
|
16
|
+
reference: (t) => e(r, [
|
|
17
|
+
...o,
|
|
18
|
+
"props",
|
|
19
|
+
...t
|
|
20
|
+
])
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export { r as snapshotComponentSource };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { readVerifiedSnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { copyRenderReadAuthority as t, readRenderReadAuthority as n } from "./renderReadAuthority.js";
|
|
3
|
+
import { resolveSnapshotReadBinding as r } from "./snapshotReadAdmission.js";
|
|
4
|
+
import { issueRenderReadGrant as i, verifyRenderReadRenewal as a } from "./renderReadGrant.js";
|
|
5
|
+
import { Schema as o } from "effect";
|
|
6
|
+
import { generateId as s } from "@voltro/database";
|
|
7
|
+
import { dataStoreApiKeyStore as c, makeApiKeyService as l } from "@voltro/runtime";
|
|
8
|
+
// src/snapshotConsumer.ts
|
|
9
|
+
var u = class extends o.TaggedError()("SnapshotConsumerUnavailable", { reason: o.Literals([
|
|
10
|
+
"configuration",
|
|
11
|
+
"credential",
|
|
12
|
+
"projection",
|
|
13
|
+
"expiry"
|
|
14
|
+
]) }) {}, d = (e) => {
|
|
15
|
+
throw new u({ reason: e });
|
|
16
|
+
}, f = (e) => Number.isSafeInteger(e) && Number.isFinite(new Date(e).getTime()), p = (e, t) => {
|
|
17
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return d("configuration");
|
|
18
|
+
let n = e;
|
|
19
|
+
if (Object.keys(n).length !== 3 || Object.keys(n).some((e) => ![
|
|
20
|
+
"id",
|
|
21
|
+
"requiredScope",
|
|
22
|
+
"maxGrantMs"
|
|
23
|
+
].includes(e))) return d("configuration");
|
|
24
|
+
let { id: r, requiredScope: i, maxGrantMs: a } = n;
|
|
25
|
+
return !f(t) || typeof r != "string" || !/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(r) || typeof i != "string" || !/^[A-Za-z][A-Za-z0-9:_.-]{0,127}$/.test(i) || typeof a != "number" || !Number.isSafeInteger(a) || a <= 0 || !f(t + a) ? d("configuration") : {
|
|
26
|
+
id: r,
|
|
27
|
+
requiredScope: i,
|
|
28
|
+
maxGrantMs: a
|
|
29
|
+
};
|
|
30
|
+
}, m = async (o, u, m, h) => {
|
|
31
|
+
let g = {
|
|
32
|
+
tenantId: u.tenantId,
|
|
33
|
+
site: u.site,
|
|
34
|
+
environment: u.environment
|
|
35
|
+
}, _ = {
|
|
36
|
+
id: m.snapshot.id,
|
|
37
|
+
digest: m.snapshot.digest
|
|
38
|
+
}, v = m.apiKey, y = m.resume === void 0 ? void 0 : {
|
|
39
|
+
token: m.resume.token,
|
|
40
|
+
buildId: m.resume.buildId
|
|
41
|
+
}, b = h.now ?? Date.now(), x = p(h.consumer, b), S = {
|
|
42
|
+
id: h.key.id,
|
|
43
|
+
material: new Uint8Array(h.key.material)
|
|
44
|
+
}, C = (h.verificationKeys ?? []).map((e) => ({
|
|
45
|
+
id: e.id,
|
|
46
|
+
material: new Uint8Array(e.material)
|
|
47
|
+
}));
|
|
48
|
+
if (typeof v != "string" || v.length === 0 || v.length > 512) return d("credential");
|
|
49
|
+
let w = await l(c(o)).verify(v, b);
|
|
50
|
+
if (w === null) return d("credential");
|
|
51
|
+
let T = t({
|
|
52
|
+
kind: "apiKey",
|
|
53
|
+
id: w.id,
|
|
54
|
+
scope: x.requiredScope
|
|
55
|
+
});
|
|
56
|
+
if (T === null) return d("credential");
|
|
57
|
+
let E = await n(o, g, T, b);
|
|
58
|
+
if (E === null) return d("credential");
|
|
59
|
+
let D = y?.buildId ?? s({
|
|
60
|
+
kind: "typeid",
|
|
61
|
+
prefix: "cmsbuild"
|
|
62
|
+
}, "_voltro_cms_render_read_grants"), { snapshot: O, binding: k } = await r(o, g, _, {
|
|
63
|
+
consumerId: x.id,
|
|
64
|
+
buildId: D
|
|
65
|
+
}, b), A = (await e(o, g, O, "projection", "registry")).value;
|
|
66
|
+
if (A.version !== 1 || A.id !== x.id) return d("projection");
|
|
67
|
+
y !== void 0 && await a(o, y.token, k, T, {
|
|
68
|
+
keys: [S, ...C],
|
|
69
|
+
now: b
|
|
70
|
+
});
|
|
71
|
+
let j = Math.min(b + x.maxGrantMs, O.expiresAt, E.expiresAt ?? 2 ** 53 - 1);
|
|
72
|
+
return !f(j) || j <= b ? d("expiry") : {
|
|
73
|
+
...await i(o, k, {
|
|
74
|
+
key: S,
|
|
75
|
+
now: b,
|
|
76
|
+
expiresAt: j,
|
|
77
|
+
maxExpiresAt: j,
|
|
78
|
+
authority: T
|
|
79
|
+
}),
|
|
80
|
+
consumerId: x.id,
|
|
81
|
+
buildId: D,
|
|
82
|
+
snapshotId: O.id,
|
|
83
|
+
snapshotDigest: O.digest
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export { u as SnapshotConsumerUnavailable, p as copySnapshotConsumer, m as issueSnapshotReadGrant };
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { copySnapshotResource as e } from "./buildSnapshot.js";
|
|
2
|
+
import { Schema as t } from "effect";
|
|
3
|
+
import { createHash as n } from "node:crypto";
|
|
4
|
+
import { canonicalJson as r } from "@voltro/runtime";
|
|
5
|
+
// src/snapshotDefinitions.ts
|
|
6
|
+
var i = class extends t.TaggedError()("SnapshotDefinitionUnavailable", { reason: t.Literals([
|
|
7
|
+
"app",
|
|
8
|
+
"definition",
|
|
9
|
+
"duplicate",
|
|
10
|
+
"component-conflict",
|
|
11
|
+
"cycle",
|
|
12
|
+
"bounds"
|
|
13
|
+
]) }) {}, a = (e) => {
|
|
14
|
+
throw new i({ reason: e });
|
|
15
|
+
}, o = (e) => n("sha256").update(r(e)).digest("hex"), s = (e) => typeof e == "string" && e.trim().length > 0, c = (e) => !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e.commit) || ![e.artifactDigest, e.configDigest].every((e) => /^[0-9a-f]{64}$/.test(e)) ? a("app") : {
|
|
16
|
+
commit: e.commit,
|
|
17
|
+
artifactDigest: e.artifactDigest,
|
|
18
|
+
configDigest: e.configDigest
|
|
19
|
+
}, l = {
|
|
20
|
+
kind: "data",
|
|
21
|
+
editorHint: "data",
|
|
22
|
+
isOptional: "data",
|
|
23
|
+
publishRequired: "data",
|
|
24
|
+
maxLength: "data",
|
|
25
|
+
pattern: "data",
|
|
26
|
+
literals: "data",
|
|
27
|
+
literalLabels: "data",
|
|
28
|
+
token: "data",
|
|
29
|
+
action: "data",
|
|
30
|
+
fraction: "data",
|
|
31
|
+
unique: "data",
|
|
32
|
+
richText: "richText",
|
|
33
|
+
referenceType: "data",
|
|
34
|
+
element: "field",
|
|
35
|
+
struct: "fields",
|
|
36
|
+
components: "components",
|
|
37
|
+
derived: "derived"
|
|
38
|
+
}, u = {
|
|
39
|
+
id: "data",
|
|
40
|
+
displayName: "data",
|
|
41
|
+
props: "fields",
|
|
42
|
+
fingerprint: "data",
|
|
43
|
+
description: "data",
|
|
44
|
+
jobs: "data",
|
|
45
|
+
variants: "data",
|
|
46
|
+
fixtures: "data",
|
|
47
|
+
migrations: "migrations",
|
|
48
|
+
consent: "data"
|
|
49
|
+
}, d = {
|
|
50
|
+
name: "data",
|
|
51
|
+
displayName: "data",
|
|
52
|
+
pluralName: "data",
|
|
53
|
+
fields: "fields",
|
|
54
|
+
asset: "data",
|
|
55
|
+
list: "data",
|
|
56
|
+
idPrefix: "data",
|
|
57
|
+
revalidate: "data",
|
|
58
|
+
tree: "data",
|
|
59
|
+
address: "data",
|
|
60
|
+
locations: "data",
|
|
61
|
+
seo: "data",
|
|
62
|
+
seoSites: "data",
|
|
63
|
+
review: "review",
|
|
64
|
+
availability: "data",
|
|
65
|
+
lifecycle: "data",
|
|
66
|
+
templates: "templates",
|
|
67
|
+
changeFeed: "data",
|
|
68
|
+
search: "data",
|
|
69
|
+
quality: "quality",
|
|
70
|
+
taxonomy: "data",
|
|
71
|
+
derivedFields: "data",
|
|
72
|
+
uniqueFields: "data"
|
|
73
|
+
}, f = {
|
|
74
|
+
name: "data",
|
|
75
|
+
version: "data",
|
|
76
|
+
id: "data",
|
|
77
|
+
blocks: "data",
|
|
78
|
+
headings: "data",
|
|
79
|
+
marks: "data",
|
|
80
|
+
styles: "data",
|
|
81
|
+
components: "components",
|
|
82
|
+
contactPoints: "data",
|
|
83
|
+
contactLiterals: "data"
|
|
84
|
+
}, p = {
|
|
85
|
+
id: "data",
|
|
86
|
+
displayName: "data",
|
|
87
|
+
values: "data",
|
|
88
|
+
sections: "sections",
|
|
89
|
+
required: "components",
|
|
90
|
+
first: "component",
|
|
91
|
+
max: "limits",
|
|
92
|
+
regions: "regions",
|
|
93
|
+
widths: "widths",
|
|
94
|
+
maxDepth: "data"
|
|
95
|
+
}, m = {
|
|
96
|
+
id: "data",
|
|
97
|
+
label: "data",
|
|
98
|
+
approverScope: "data",
|
|
99
|
+
after: "data",
|
|
100
|
+
when: "implementation",
|
|
101
|
+
slaHours: "data",
|
|
102
|
+
evidence: "data"
|
|
103
|
+
}, h = {
|
|
104
|
+
id: "data",
|
|
105
|
+
field: "data",
|
|
106
|
+
message: "data",
|
|
107
|
+
blocking: "data",
|
|
108
|
+
pack: "data",
|
|
109
|
+
sites: "data",
|
|
110
|
+
locales: "data",
|
|
111
|
+
check: "implementation"
|
|
112
|
+
}, g = {
|
|
113
|
+
source: "data",
|
|
114
|
+
transform: "implementation"
|
|
115
|
+
}, _ = {
|
|
116
|
+
images: "data",
|
|
117
|
+
files: "data",
|
|
118
|
+
links: "data",
|
|
119
|
+
profile: "profile"
|
|
120
|
+
}, v = {
|
|
121
|
+
field: "data",
|
|
122
|
+
components: "data",
|
|
123
|
+
width: "data",
|
|
124
|
+
list: "templateList"
|
|
125
|
+
}, y = {
|
|
126
|
+
allowed: "components",
|
|
127
|
+
required: "components",
|
|
128
|
+
maxItems: "data"
|
|
129
|
+
}, b = {
|
|
130
|
+
id: "data",
|
|
131
|
+
version: "data",
|
|
132
|
+
steps: "steps"
|
|
133
|
+
}, x = (t, n, i = []) => {
|
|
134
|
+
let x = c(n);
|
|
135
|
+
if (t.length === 0 && i.length === 0 || t.some((e) => !s(e.name))) return a("definition");
|
|
136
|
+
if (new Set(t.map((e) => e.name)).size !== t.length) return a("duplicate");
|
|
137
|
+
let S = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = (e, t) => {
|
|
138
|
+
if (typeof e != "object" || !e || Array.isArray(e) || ![Object.prototype, null].includes(Object.getPrototypeOf(e))) return a("definition");
|
|
139
|
+
if (S.has(e)) return a("cycle");
|
|
140
|
+
if (S.size >= 64) return a("bounds");
|
|
141
|
+
if (Object.getOwnPropertySymbols(e).length > 0) return a("definition");
|
|
142
|
+
let n = Object.getOwnPropertyDescriptors(e);
|
|
143
|
+
if (Object.values(n).some((e) => !e.enumerable || !("value" in e))) return a("definition");
|
|
144
|
+
S.add(e);
|
|
145
|
+
try {
|
|
146
|
+
return t(Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.value])));
|
|
147
|
+
} finally {
|
|
148
|
+
S.delete(e);
|
|
149
|
+
}
|
|
150
|
+
}, E = (t) => e({
|
|
151
|
+
key: "metadata",
|
|
152
|
+
value: { data: t }
|
|
153
|
+
}).value.data, D = (e, t) => {
|
|
154
|
+
if (typeof e != "function") return a("definition");
|
|
155
|
+
let n = r(t), i = w.get(n);
|
|
156
|
+
return i !== void 0 && i !== e ? a("component-conflict") : (w.set(n, e), {
|
|
157
|
+
kind: "app-implementation",
|
|
158
|
+
app: x,
|
|
159
|
+
path: [...t]
|
|
160
|
+
});
|
|
161
|
+
}, O = (e, t, n) => {
|
|
162
|
+
if (!Array.isArray(e) || Object.getOwnPropertySymbols(e).length > 0 || Object.keys(e).length !== e.length || Object.keys(e).some((e, t) => e !== String(t))) return a("definition");
|
|
163
|
+
let r = Object.getOwnPropertyDescriptors(e);
|
|
164
|
+
return Object.entries(r).some(([e, t]) => e !== "length" && (!t.enumerable || !("value" in t))) ? a("definition") : Array.from({ length: e.length }, (e, i) => n(r[String(i)].value, [...t, String(i)]));
|
|
165
|
+
}, k = (e, t, n) => T(e, (e) => Object.fromEntries(Object.keys(e).sort().map((r) => [r, n(e[r], [...t, r])]))), A = (e, t, n, r = !1) => T(e, (e) => Object.fromEntries(Object.keys(e).sort().flatMap((i) => r && [
|
|
166
|
+
"pipe",
|
|
167
|
+
"optional",
|
|
168
|
+
"requiredToPublish"
|
|
169
|
+
].includes(i) ? typeof e[i] == "function" ? [] : a("definition") : Object.hasOwn(t, i) ? e[i] === void 0 ? [] : [[i, M(t[i], e[i], [...n, i])]] : a("definition")))), j = (t) => {
|
|
170
|
+
let n = typeof t == "object" && t ? Object.getOwnPropertyDescriptor(t, "id")?.value : void 0;
|
|
171
|
+
if (!s(n)) return a("definition");
|
|
172
|
+
let r = {
|
|
173
|
+
version: 1,
|
|
174
|
+
app: x,
|
|
175
|
+
definition: A(t, u, ["components", n])
|
|
176
|
+
}, i = e({
|
|
177
|
+
key: `component:${n}`,
|
|
178
|
+
value: r
|
|
179
|
+
}), c = o(i.value), l = C.get(n);
|
|
180
|
+
return l !== void 0 && l.digest !== c ? a("component-conflict") : (C.set(n, {
|
|
181
|
+
resource: i,
|
|
182
|
+
digest: c
|
|
183
|
+
}), {
|
|
184
|
+
id: n,
|
|
185
|
+
digest: c
|
|
186
|
+
});
|
|
187
|
+
}, M = (e, t, n) => {
|
|
188
|
+
switch (e) {
|
|
189
|
+
case "data": return E(t);
|
|
190
|
+
case "implementation": return D(t, n);
|
|
191
|
+
case "migrations": return k(t, n, D);
|
|
192
|
+
case "fields": return k(t, n, (e, t) => A(e, l, t, !0));
|
|
193
|
+
case "field": return A(t, l, n, !0);
|
|
194
|
+
case "component": return j(t);
|
|
195
|
+
case "components": return O(t, n, j);
|
|
196
|
+
case "richText": return A(t, _, n);
|
|
197
|
+
case "profile": return A(t, f, n);
|
|
198
|
+
case "derived": return A(t, g, n);
|
|
199
|
+
case "review": return A(t, {
|
|
200
|
+
required: "data",
|
|
201
|
+
workflow: "workflow"
|
|
202
|
+
}, n);
|
|
203
|
+
case "workflow": return A(t, b, n);
|
|
204
|
+
case "steps": return O(t, n, (e, t) => A(e, m, t));
|
|
205
|
+
case "quality": return O(t, n, (e, t) => A(e, h, t));
|
|
206
|
+
case "templates": return A(t, v, n);
|
|
207
|
+
case "templateList": return O(t, n, (e, t) => A(e, p, t));
|
|
208
|
+
case "sections": return O(t, n, (e, t) => A(e, {
|
|
209
|
+
component: "component",
|
|
210
|
+
props: "data"
|
|
211
|
+
}, t));
|
|
212
|
+
case "limits": return O(t, n, (e, t) => A(e, {
|
|
213
|
+
component: "component",
|
|
214
|
+
count: "data"
|
|
215
|
+
}, t));
|
|
216
|
+
case "widths": return O(t, n, (e, t) => A(e, {
|
|
217
|
+
component: "component",
|
|
218
|
+
allowed: "data"
|
|
219
|
+
}, t));
|
|
220
|
+
case "regions": return k(t, n, (e, t) => A(e, y, t));
|
|
221
|
+
}
|
|
222
|
+
}, N = [...t].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)).map((t) => e({
|
|
223
|
+
key: `type:${t.name}`,
|
|
224
|
+
value: {
|
|
225
|
+
version: 1,
|
|
226
|
+
app: x,
|
|
227
|
+
definition: A(t, d, ["types", t.name])
|
|
228
|
+
}
|
|
229
|
+
}));
|
|
230
|
+
for (let e of i) j(e);
|
|
231
|
+
let P = (t, n) => {
|
|
232
|
+
let r = [e({
|
|
233
|
+
key: "registry",
|
|
234
|
+
value: {
|
|
235
|
+
version: 1,
|
|
236
|
+
app: x,
|
|
237
|
+
count: n.length
|
|
238
|
+
}
|
|
239
|
+
}), ...n];
|
|
240
|
+
return {
|
|
241
|
+
format: `voltro.cms.${t}/v1`,
|
|
242
|
+
entries: () => structuredClone(r)
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
return {
|
|
246
|
+
schema: P("schema", N),
|
|
247
|
+
components: P("components", [...C.keys()].sort().map((e) => C.get(e).resource)),
|
|
248
|
+
definition: (t) => {
|
|
249
|
+
let n = N.find((e) => e.key === `type:${t}`);
|
|
250
|
+
return n === void 0 ? a("definition") : e(n);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}, S = (e, t) => {
|
|
254
|
+
let { schema: n, components: r } = x(e, t);
|
|
255
|
+
return {
|
|
256
|
+
schema: n,
|
|
257
|
+
components: r
|
|
258
|
+
};
|
|
259
|
+
}, C = (e, t) => x([e], t).definition(e.name), w = (e, t) => {
|
|
260
|
+
for (let n of x([], t, [e]).components.entries()) if (n.key === `component:${e.id}`) return n;
|
|
261
|
+
return a("definition");
|
|
262
|
+
};
|
|
263
|
+
export { i as SnapshotDefinitionUnavailable, c as copySnapshotAppCodePin, w as snapshotComponentDefinition, C as snapshotContentTypeDefinition, S as snapshotDefinitionSources };
|