@voltro/cms 0.85.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.
Files changed (244) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/README.md +138 -0
  3. package/THIRD-PARTY-NOTICES.md +864 -253
  4. package/dist/ContentForm.js +282 -0
  5. package/dist/RichDocumentEditor.js +550 -0
  6. package/dist/RichDocumentView.js +177 -0
  7. package/dist/RichTextSurface.js +135 -0
  8. package/dist/aiCandidates.js +199 -0
  9. package/dist/aiOperations.js +152 -0
  10. package/dist/applicationBuildSnapshotService.js +101 -0
  11. package/dist/assetRenditions.js +102 -0
  12. package/dist/assetRevision.js +46 -0
  13. package/dist/assetUseRights.js +72 -0
  14. package/dist/audiences.js +31 -0
  15. package/dist/availability.js +124 -0
  16. package/dist/blueprint.js +166 -0
  17. package/dist/build.d.ts +3063 -0
  18. package/dist/build.js +37 -0
  19. package/dist/buildApplicationAdmission.js +16 -0
  20. package/dist/buildApplicationCatalog.js +136 -0
  21. package/dist/buildApplicationCatalogTable.js +24 -0
  22. package/dist/buildApplicationRest.js +99 -0
  23. package/dist/buildApplicationUpload.js +111 -0
  24. package/dist/buildSnapshot.js +401 -0
  25. package/dist/buildSnapshotApplicationPin.js +32 -0
  26. package/dist/buildSnapshotRest.js +210 -0
  27. package/dist/buildSnapshotService.js +265 -0
  28. package/dist/buildSnapshotTables.js +25 -0
  29. package/dist/bulk.js +282 -0
  30. package/dist/cacheIdentity.js +152 -0
  31. package/dist/changes.js +307 -0
  32. package/dist/cmsContext.js +229 -0
  33. package/dist/collections.js +224 -0
  34. package/dist/consent.js +29 -0
  35. package/dist/contentLocations.js +53 -0
  36. package/dist/contentProjection.js +83 -0
  37. package/dist/contentRouteIdentity.js +13 -0
  38. package/dist/contentRouteMaterializer.js +97 -0
  39. package/dist/contentRouteTypes.js +39 -0
  40. package/dist/contentSeo.js +189 -0
  41. package/dist/contentTreePath.js +60 -0
  42. package/dist/contentType.js +208 -0
  43. package/dist/contentValues.js +18 -0
  44. package/dist/contentfulImport.js +162 -0
  45. package/dist/copies.js +89 -0
  46. package/dist/cutover.js +202 -0
  47. package/dist/deliveryChecks.js +138 -0
  48. package/dist/domainHost.js +7 -0
  49. package/dist/domains.js +139 -0
  50. package/dist/draftTexts.js +164 -0
  51. package/dist/duplicates.js +78 -0
  52. package/dist/edgePurge.js +69 -0
  53. package/dist/editHistory.js +113 -0
  54. package/dist/effectForm.js +11 -0
  55. package/dist/environmentAliases.js +138 -0
  56. package/dist/environments.js +147 -0
  57. package/dist/errors.js +107 -0
  58. package/dist/experiments.js +528 -0
  59. package/dist/exposure.js +28 -0
  60. package/dist/extensionManifest.js +81 -0
  61. package/dist/extensions.js +314 -0
  62. package/dist/fieldSchema.js +199 -0
  63. package/dist/formStrings.js +74 -0
  64. package/dist/frontendBindings.js +99 -0
  65. package/dist/frontendMedia.js +18 -0
  66. package/dist/glossary.js +73 -0
  67. package/dist/history.js +54 -0
  68. package/dist/htmlImport.js +297 -0
  69. package/dist/index.d.ts +771 -54
  70. package/dist/index.js +89 -6082
  71. package/dist/initializePublicRoutes.js +28 -0
  72. package/dist/liveContentRouteView.js +76 -0
  73. package/dist/media.js +29 -0
  74. package/dist/metrics.js +46 -0
  75. package/dist/migration.js +193 -0
  76. package/dist/migrationStages.js +13 -0
  77. package/dist/nativeOutputDeploymentService.js +205 -0
  78. package/dist/outputActivation.js +234 -0
  79. package/dist/outputActivationOrigin.js +51 -0
  80. package/dist/outputActivationStore.js +411 -0
  81. package/dist/outputActivationTables.js +11 -0
  82. package/dist/outputActivationTarget.js +81 -0
  83. package/dist/outputActivationTargetTable.js +25 -0
  84. package/dist/outputDeployment.js +174 -0
  85. package/dist/outputDeploymentRest.js +168 -0
  86. package/dist/outputDeploymentService.js +241 -0
  87. package/dist/outputRouteGraph.js +177 -0
  88. package/dist/outputSafetyArtifact.js +147 -0
  89. package/dist/outputTargetRest.js +62 -0
  90. package/dist/pathSegmentEncoding.js +4 -0
  91. package/dist/presenceAnchors.js +68 -0
  92. package/dist/preview.js +31 -0
  93. package/dist/privateCmsTransport.js +76 -0
  94. package/dist/privateNativeRouteReservation.js +10 -0
  95. package/dist/promotion.js +116 -0
  96. package/dist/publicBuild.js +90 -0
  97. package/dist/publicBuildRest.js +98 -0
  98. package/dist/publicBuildService.js +63 -0
  99. package/dist/publicOutputHttp.js +129 -0
  100. package/dist/publicOutputService.js +287 -0
  101. package/dist/publicPresentation.js +17 -0
  102. package/dist/publicRouteDispositionAdmission.js +38 -0
  103. package/dist/publicRouteHistoryStore.js +12 -0
  104. package/dist/publicRouteHistoryView.js +34 -0
  105. package/dist/publicRouteIntegrity.js +5 -0
  106. package/dist/publicRouteMutation.js +6 -0
  107. package/dist/publicRouteNamespace.js +134 -0
  108. package/dist/publicRoutePublication.js +36 -0
  109. package/dist/publicRouteRegistry.js +17 -0
  110. package/dist/publicRouteRegistryBinding.js +194 -0
  111. package/dist/publicRouteRegistryDefinition.js +76 -0
  112. package/dist/publicRouteSitePublication.js +40 -0
  113. package/dist/publicRouteTables.js +13 -0
  114. package/dist/publicRouteUrl.js +18 -0
  115. package/dist/publicationSeo.js +52 -0
  116. package/dist/publicationState.js +296 -0
  117. package/dist/quality.js +188 -0
  118. package/dist/reconfigurePublicRoutes.js +41 -0
  119. package/dist/recurrence.js +78 -0
  120. package/dist/redirects.js +130 -0
  121. package/dist/referenceGraph.js +224 -0
  122. package/dist/references.js +173 -0
  123. package/dist/release.js +241 -0
  124. package/dist/renderReadAuthority.js +43 -0
  125. package/dist/renderReadGrant.js +137 -0
  126. package/dist/rest.js +52 -0
  127. package/dist/review.js +160 -0
  128. package/dist/richDocument.js +521 -0
  129. package/dist/richInline.js +100 -0
  130. package/dist/routeDispositionGraph.js +44 -0
  131. package/dist/routeDispositionRest.js +51 -0
  132. package/dist/routeDispositionService.js +73 -0
  133. package/dist/routeDispositionStore.js +289 -0
  134. package/dist/routeDispositionTables.js +5 -0
  135. package/dist/routeDispositions.js +91 -0
  136. package/dist/routeHistoryStorage.js +320 -0
  137. package/dist/routeHistoryStore.js +12 -0
  138. package/dist/schedule.js +80 -0
  139. package/dist/search.js +148 -0
  140. package/dist/selectionIntent.js +164 -0
  141. package/dist/seo.js +31 -0
  142. package/dist/series.js +105 -0
  143. package/dist/share.js +112 -0
  144. package/dist/siteBindings.js +159 -0
  145. package/dist/siteBuildCandidate.js +104 -0
  146. package/dist/siteDelivery.js +115 -0
  147. package/dist/siteState.js +47 -0
  148. package/dist/snapshotAddressGraph.js +55 -0
  149. package/dist/snapshotAddressRead.js +73 -0
  150. package/dist/snapshotAppConsumer.js +71 -0
  151. package/dist/snapshotAppExecution.js +102 -0
  152. package/dist/snapshotApplication.js +75 -0
  153. package/dist/snapshotApprovedRouteDispositions.js +44 -0
  154. package/dist/snapshotAssetAssembly.js +70 -0
  155. package/dist/snapshotAssetAssemblyRest.js +50 -0
  156. package/dist/snapshotBindingRead.js +61 -0
  157. package/dist/snapshotCodeSeo.js +29 -0
  158. package/dist/snapshotComponent.js +34 -0
  159. package/dist/snapshotComponentSource.js +24 -0
  160. package/dist/snapshotConsumer.js +87 -0
  161. package/dist/snapshotContentIdentity.js +10 -0
  162. package/dist/snapshotDefinitions.js +264 -0
  163. package/dist/snapshotDocumentAssembly.js +193 -0
  164. package/dist/snapshotDocumentAssemblyRest.js +84 -0
  165. package/dist/snapshotDocumentProjection.js +202 -0
  166. package/dist/snapshotDocumentTransfer.js +35 -0
  167. package/dist/snapshotDocumentTransferRest.js +80 -0
  168. package/dist/snapshotDomains.js +56 -0
  169. package/dist/snapshotEnvironment.js +31 -0
  170. package/dist/snapshotFieldPlan.js +85 -0
  171. package/dist/snapshotFrontend.js +103 -0
  172. package/dist/snapshotLink.js +8 -0
  173. package/dist/snapshotMedia.js +111 -0
  174. package/dist/snapshotMediaCapture.js +246 -0
  175. package/dist/snapshotMediaFields.js +225 -0
  176. package/dist/snapshotMediaRead.js +185 -0
  177. package/dist/snapshotMediaReader.js +13 -0
  178. package/dist/snapshotObservation.js +16 -0
  179. package/dist/snapshotObservedRouteHistory.js +34 -0
  180. package/dist/snapshotOutputTransfer.js +78 -0
  181. package/dist/snapshotPageLoader.js +7 -0
  182. package/dist/snapshotPageSeo.js +59 -0
  183. package/dist/snapshotPathLocale.js +15 -0
  184. package/dist/snapshotPresentation.js +86 -0
  185. package/dist/snapshotPresentationPolicy.js +12 -0
  186. package/dist/snapshotProjection.js +119 -0
  187. package/dist/snapshotPublicAccess.js +161 -0
  188. package/dist/snapshotPublicRouteHistory.js +40 -0
  189. package/dist/snapshotReadAdmission.js +38 -0
  190. package/dist/snapshotRedirectOutput.js +151 -0
  191. package/dist/snapshotRedirectTargets.js +24 -0
  192. package/dist/snapshotRedirects.js +132 -0
  193. package/dist/snapshotReference.js +8 -0
  194. package/dist/snapshotReferenceAddress.js +10 -0
  195. package/dist/snapshotReferenceGraph.js +79 -0
  196. package/dist/snapshotReferenceRead.js +65 -0
  197. package/dist/snapshotRelease.js +99 -0
  198. package/dist/snapshotRender.js +361 -0
  199. package/dist/snapshotRenderDependencies.js +178 -0
  200. package/dist/snapshotRenditions.js +88 -0
  201. package/dist/snapshotRichDocument.js +62 -0
  202. package/dist/snapshotRoleTransfer.js +106 -0
  203. package/dist/snapshotRoleTransferRest.js +99 -0
  204. package/dist/snapshotRouteAdmission.js +71 -0
  205. package/dist/snapshotRouteDispatch.js +111 -0
  206. package/dist/snapshotRouteDispositionPlan.js +73 -0
  207. package/dist/snapshotRouteRead.js +43 -0
  208. package/dist/snapshotRoutes.js +79 -0
  209. package/dist/snapshotRouting.js +113 -0
  210. package/dist/snapshotSeo.js +179 -0
  211. package/dist/snapshotSeoControls.js +101 -0
  212. package/dist/snapshotSeoDocumentInventory.js +115 -0
  213. package/dist/snapshotSeoDocuments.js +129 -0
  214. package/dist/snapshotSeoMerge.js +85 -0
  215. package/dist/snapshotSeoMetadata.js +137 -0
  216. package/dist/snapshotSeoOutput.js +173 -0
  217. package/dist/snapshotSeoPathSets.js +105 -0
  218. package/dist/snapshotSeoRead.js +88 -0
  219. package/dist/snapshotSite.js +128 -0
  220. package/dist/snapshotSitemapFiles.js +36 -0
  221. package/dist/snapshotTreeDependencies.js +58 -0
  222. package/dist/snapshotTreeLoader.js +10 -0
  223. package/dist/snapshotTreeRead.js +158 -0
  224. package/dist/staticPathSet.js +177 -0
  225. package/dist/staticPathSetRest.js +129 -0
  226. package/dist/staticPathSetService.js +249 -0
  227. package/dist/staticPathSetStore.js +338 -0
  228. package/dist/stewardship.js +146 -0
  229. package/dist/taxonomy.js +36 -0
  230. package/dist/team.js +103 -0
  231. package/dist/templates.js +106 -0
  232. package/dist/trackChanges.js +197 -0
  233. package/dist/translation.js +64 -0
  234. package/dist/tree.js +87 -0
  235. package/dist/usage.js +50 -0
  236. package/dist/validation.js +192 -0
  237. package/dist/visualEditing.js +60 -0
  238. package/dist/web.d.ts +709 -7
  239. package/dist/web.js +50 -2
  240. package/dist/workflow.js +322 -0
  241. package/dist/write.js +419 -0
  242. package/dist/xliff.js +325 -0
  243. package/package.json +20 -6
  244. package/dist/presenceAnchors-4iHAVQB3.js +0 -4367
@@ -0,0 +1,50 @@
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
+ //#region 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
+ //#endregion
50
+ export { s as cmsSnapshotAssetsRest };
@@ -0,0 +1,61 @@
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
+ //#region 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
+ //#endregion
61
+ export { u as readAdmittedSnapshotBindingContext, d as readSnapshotBinding, l as readSnapshotBindingContext };
@@ -0,0 +1,29 @@
1
+ import { copySnapshotResource as e } from "./buildSnapshot.js";
2
+ //#region 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
+ //#endregion
29
+ export { r as copySnapshotCodeSeo };
@@ -0,0 +1,34 @@
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
+ //#region 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
+ //#endregion
34
+ export { i as renderSnapshotComponent };
@@ -0,0 +1,24 @@
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
+ //#region 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
+ //#endregion
24
+ export { r as snapshotComponentSource };
@@ -0,0 +1,87 @@
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
+ //#region 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
+ //#endregion
87
+ export { u as SnapshotConsumerUnavailable, p as copySnapshotConsumer, m as issueSnapshotReadGrant };
@@ -0,0 +1,10 @@
1
+ //#region src/snapshotContentIdentity.ts
2
+ var e = ({ contentType: e, documentId: t, variantId: n, revisionId: r, revision: i }) => ({
3
+ contentType: e,
4
+ documentId: t,
5
+ variantId: n,
6
+ revisionId: r,
7
+ revision: i
8
+ });
9
+ //#endregion
10
+ export { e as copySnapshotContentIdentity };
@@ -0,0 +1,264 @@
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
+ //#region 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
+ //#endregion
264
+ export { i as SnapshotDefinitionUnavailable, c as copySnapshotAppCodePin, w as snapshotComponentDefinition, C as snapshotContentTypeDefinition, S as snapshotDefinitionSources };