@elytracms/core 0.0.6

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 (521) hide show
  1. package/LICENSE +21 -0
  2. package/dist/clipboard/build.d.ts +77 -0
  3. package/dist/clipboard/build.js +128 -0
  4. package/dist/clipboard/build.js.map +1 -0
  5. package/dist/clipboard/clipboard.d.ts +33 -0
  6. package/dist/clipboard/clipboard.js +45 -0
  7. package/dist/clipboard/clipboard.js.map +1 -0
  8. package/dist/clipboard/fragment.d.ts +112 -0
  9. package/dist/clipboard/fragment.js +79 -0
  10. package/dist/clipboard/fragment.js.map +1 -0
  11. package/dist/clipboard/html.d.ts +26 -0
  12. package/dist/clipboard/html.js +82 -0
  13. package/dist/clipboard/html.js.map +1 -0
  14. package/dist/clipboard/index.d.ts +15 -0
  15. package/dist/clipboard/index.js +16 -0
  16. package/dist/clipboard/index.js.map +1 -0
  17. package/dist/clipboard/references.d.ts +50 -0
  18. package/dist/clipboard/references.js +0 -0
  19. package/dist/clipboard/references.js.map +1 -0
  20. package/dist/clipboard/serialize.d.ts +69 -0
  21. package/dist/clipboard/serialize.js +130 -0
  22. package/dist/clipboard/serialize.js.map +1 -0
  23. package/dist/cms-core/collections.d.ts +82 -0
  24. package/dist/cms-core/collections.js +187 -0
  25. package/dist/cms-core/collections.js.map +1 -0
  26. package/dist/cms-core/documents.d.ts +71 -0
  27. package/dist/cms-core/documents.js +67 -0
  28. package/dist/cms-core/documents.js.map +1 -0
  29. package/dist/cms-core/envelopes.d.ts +80 -0
  30. package/dist/cms-core/envelopes.js +124 -0
  31. package/dist/cms-core/envelopes.js.map +1 -0
  32. package/dist/cms-core/fields.d.ts +220 -0
  33. package/dist/cms-core/fields.js +250 -0
  34. package/dist/cms-core/fields.js.map +1 -0
  35. package/dist/cms-core/fixtures.d.ts +92 -0
  36. package/dist/cms-core/fixtures.js +357 -0
  37. package/dist/cms-core/fixtures.js.map +1 -0
  38. package/dist/cms-core/hierarchy.d.ts +113 -0
  39. package/dist/cms-core/hierarchy.js +223 -0
  40. package/dist/cms-core/hierarchy.js.map +1 -0
  41. package/dist/cms-core/index.d.ts +25 -0
  42. package/dist/cms-core/index.js +26 -0
  43. package/dist/cms-core/index.js.map +1 -0
  44. package/dist/cms-core/infer.d.ts +103 -0
  45. package/dist/cms-core/infer.js +57 -0
  46. package/dist/cms-core/infer.js.map +1 -0
  47. package/dist/cms-core/issues.d.ts +92 -0
  48. package/dist/cms-core/issues.js +74 -0
  49. package/dist/cms-core/issues.js.map +1 -0
  50. package/dist/cms-core/json-schema.d.ts +25 -0
  51. package/dist/cms-core/json-schema.js +110 -0
  52. package/dist/cms-core/json-schema.js.map +1 -0
  53. package/dist/cms-core/localization.d.ts +51 -0
  54. package/dist/cms-core/localization.js +89 -0
  55. package/dist/cms-core/localization.js.map +1 -0
  56. package/dist/cms-core/routes.d.ts +76 -0
  57. package/dist/cms-core/routes.js +220 -0
  58. package/dist/cms-core/routes.js.map +1 -0
  59. package/dist/cms-core/self-type.d.ts +41 -0
  60. package/dist/cms-core/self-type.js +191 -0
  61. package/dist/cms-core/self-type.js.map +1 -0
  62. package/dist/cms-core/url-for-document.d.ts +39 -0
  63. package/dist/cms-core/url-for-document.js +138 -0
  64. package/dist/cms-core/url-for-document.js.map +1 -0
  65. package/dist/cms-core/validate-document.d.ts +121 -0
  66. package/dist/cms-core/validate-document.js +871 -0
  67. package/dist/cms-core/validate-document.js.map +1 -0
  68. package/dist/cms-core/versions.d.ts +75 -0
  69. package/dist/cms-core/versions.js +97 -0
  70. package/dist/cms-core/versions.js.map +1 -0
  71. package/dist/collaboration/approval.d.ts +68 -0
  72. package/dist/collaboration/approval.js +104 -0
  73. package/dist/collaboration/approval.js.map +1 -0
  74. package/dist/collaboration/collaboration.d.ts +49 -0
  75. package/dist/collaboration/collaboration.js +56 -0
  76. package/dist/collaboration/collaboration.js.map +1 -0
  77. package/dist/collaboration/comments.d.ts +72 -0
  78. package/dist/collaboration/comments.js +118 -0
  79. package/dist/collaboration/comments.js.map +1 -0
  80. package/dist/collaboration/core.d.ts +25 -0
  81. package/dist/collaboration/core.js +26 -0
  82. package/dist/collaboration/core.js.map +1 -0
  83. package/dist/collaboration/index.d.ts +14 -0
  84. package/dist/collaboration/index.js +15 -0
  85. package/dist/collaboration/index.js.map +1 -0
  86. package/dist/collaboration/presence.d.ts +62 -0
  87. package/dist/collaboration/presence.js +85 -0
  88. package/dist/collaboration/presence.js.map +1 -0
  89. package/dist/collaboration/publishing.d.ts +60 -0
  90. package/dist/collaboration/publishing.js +93 -0
  91. package/dist/collaboration/publishing.js.map +1 -0
  92. package/dist/collaboration/versions.d.ts +52 -0
  93. package/dist/collaboration/versions.js +81 -0
  94. package/dist/collaboration/versions.js.map +1 -0
  95. package/dist/component-registry/index.d.ts +3 -0
  96. package/dist/component-registry/index.js +4 -0
  97. package/dist/component-registry/index.js.map +1 -0
  98. package/dist/component-registry/issues.d.ts +6 -0
  99. package/dist/component-registry/issues.js +2 -0
  100. package/dist/component-registry/issues.js.map +1 -0
  101. package/dist/component-registry/manifest.d.ts +164 -0
  102. package/dist/component-registry/manifest.js +129 -0
  103. package/dist/component-registry/manifest.js.map +1 -0
  104. package/dist/component-registry/registry.d.ts +33 -0
  105. package/dist/component-registry/registry.js +90 -0
  106. package/dist/component-registry/registry.js.map +1 -0
  107. package/dist/content/__fixtures__/filterable-collections.d.ts +14 -0
  108. package/dist/content/__fixtures__/filterable-collections.js +15 -0
  109. package/dist/content/__fixtures__/filterable-collections.js.map +1 -0
  110. package/dist/content/__fixtures__/sample-accessor-types.d.ts +56 -0
  111. package/dist/content/__fixtures__/sample-accessor-types.js +5 -0
  112. package/dist/content/__fixtures__/sample-accessor-types.js.map +1 -0
  113. package/dist/content/__fixtures__/sample-delivery-types.d.ts +122 -0
  114. package/dist/content/__fixtures__/sample-delivery-types.js +5 -0
  115. package/dist/content/__fixtures__/sample-delivery-types.js.map +1 -0
  116. package/dist/content/assets.d.ts +53 -0
  117. package/dist/content/assets.js +38 -0
  118. package/dist/content/assets.js.map +1 -0
  119. package/dist/content/binding-sources.d.ts +53 -0
  120. package/dist/content/binding-sources.js +73 -0
  121. package/dist/content/binding-sources.js.map +1 -0
  122. package/dist/content/client.d.ts +90 -0
  123. package/dist/content/client.js +383 -0
  124. package/dist/content/client.js.map +1 -0
  125. package/dist/content/codegen.d.ts +54 -0
  126. package/dist/content/codegen.js +305 -0
  127. package/dist/content/codegen.js.map +1 -0
  128. package/dist/content/context.d.ts +38 -0
  129. package/dist/content/context.js +21 -0
  130. package/dist/content/context.js.map +1 -0
  131. package/dist/content/cursor.d.ts +33 -0
  132. package/dist/content/cursor.js +104 -0
  133. package/dist/content/cursor.js.map +1 -0
  134. package/dist/content/index.d.ts +28 -0
  135. package/dist/content/index.js +29 -0
  136. package/dist/content/index.js.map +1 -0
  137. package/dist/content/locale.d.ts +30 -0
  138. package/dist/content/locale.js +26 -0
  139. package/dist/content/locale.js.map +1 -0
  140. package/dist/content/perspective.d.ts +29 -0
  141. package/dist/content/perspective.js +31 -0
  142. package/dist/content/perspective.js.map +1 -0
  143. package/dist/content/populate.d.ts +25 -0
  144. package/dist/content/populate.js +22 -0
  145. package/dist/content/populate.js.map +1 -0
  146. package/dist/content/query.d.ts +122 -0
  147. package/dist/content/query.js +257 -0
  148. package/dist/content/query.js.map +1 -0
  149. package/dist/content/raw.d.ts +13 -0
  150. package/dist/content/raw.js +14 -0
  151. package/dist/content/raw.js.map +1 -0
  152. package/dist/content/resolve.d.ts +97 -0
  153. package/dist/content/resolve.js +261 -0
  154. package/dist/content/resolve.js.map +1 -0
  155. package/dist/content/serialize.d.ts +30 -0
  156. package/dist/content/serialize.js +57 -0
  157. package/dist/content/serialize.js.map +1 -0
  158. package/dist/content/tags.d.ts +54 -0
  159. package/dist/content/tags.js +40 -0
  160. package/dist/content/tags.js.map +1 -0
  161. package/dist/data-binding/fixtures.d.ts +20 -0
  162. package/dist/data-binding/fixtures.js +47 -0
  163. package/dist/data-binding/fixtures.js.map +1 -0
  164. package/dist/data-binding/index.d.ts +14 -0
  165. package/dist/data-binding/index.js +15 -0
  166. package/dist/data-binding/index.js.map +1 -0
  167. package/dist/data-binding/issues.d.ts +45 -0
  168. package/dist/data-binding/issues.js +46 -0
  169. package/dist/data-binding/issues.js.map +1 -0
  170. package/dist/data-binding/resolve.d.ts +87 -0
  171. package/dist/data-binding/resolve.js +204 -0
  172. package/dist/data-binding/resolve.js.map +1 -0
  173. package/dist/data-binding/sample.d.ts +21 -0
  174. package/dist/data-binding/sample.js +23 -0
  175. package/dist/data-binding/sample.js.map +1 -0
  176. package/dist/data-binding/sources.d.ts +225 -0
  177. package/dist/data-binding/sources.js +154 -0
  178. package/dist/data-binding/sources.js.map +1 -0
  179. package/dist/data-binding/tokens.d.ts +62 -0
  180. package/dist/data-binding/tokens.js +150 -0
  181. package/dist/data-binding/tokens.js.map +1 -0
  182. package/dist/design-tokens/css.d.ts +34 -0
  183. package/dist/design-tokens/css.js +51 -0
  184. package/dist/design-tokens/css.js.map +1 -0
  185. package/dist/design-tokens/index.d.ts +10 -0
  186. package/dist/design-tokens/index.js +11 -0
  187. package/dist/design-tokens/index.js.map +1 -0
  188. package/dist/design-tokens/style-guide.d.ts +30 -0
  189. package/dist/design-tokens/style-guide.js +31 -0
  190. package/dist/design-tokens/style-guide.js.map +1 -0
  191. package/dist/design-tokens/tokens.d.ts +89 -0
  192. package/dist/design-tokens/tokens.js +112 -0
  193. package/dist/design-tokens/tokens.js.map +1 -0
  194. package/dist/export-sync/builder-source.d.ts +85 -0
  195. package/dist/export-sync/builder-source.js +124 -0
  196. package/dist/export-sync/builder-source.js.map +1 -0
  197. package/dist/export-sync/check.d.ts +61 -0
  198. package/dist/export-sync/check.js +126 -0
  199. package/dist/export-sync/check.js.map +1 -0
  200. package/dist/export-sync/cli.d.ts +89 -0
  201. package/dist/export-sync/cli.js +323 -0
  202. package/dist/export-sync/cli.js.map +1 -0
  203. package/dist/export-sync/core.d.ts +58 -0
  204. package/dist/export-sync/core.js +41 -0
  205. package/dist/export-sync/core.js.map +1 -0
  206. package/dist/export-sync/eject.d.ts +28 -0
  207. package/dist/export-sync/eject.js +21 -0
  208. package/dist/export-sync/eject.js.map +1 -0
  209. package/dist/export-sync/fixtures.d.ts +25 -0
  210. package/dist/export-sync/fixtures.js +87 -0
  211. package/dist/export-sync/fixtures.js.map +1 -0
  212. package/dist/export-sync/generate.d.ts +7 -0
  213. package/dist/export-sync/generate.js +505 -0
  214. package/dist/export-sync/generate.js.map +1 -0
  215. package/dist/export-sync/index.d.ts +37 -0
  216. package/dist/export-sync/index.js +39 -0
  217. package/dist/export-sync/index.js.map +1 -0
  218. package/dist/export-sync/init.d.ts +123 -0
  219. package/dist/export-sync/init.js +234 -0
  220. package/dist/export-sync/init.js.map +1 -0
  221. package/dist/export-sync/manifest-host.d.ts +48 -0
  222. package/dist/export-sync/manifest-host.js +73 -0
  223. package/dist/export-sync/manifest-host.js.map +1 -0
  224. package/dist/export-sync/node.d.ts +20 -0
  225. package/dist/export-sync/node.js +101 -0
  226. package/dist/export-sync/node.js.map +1 -0
  227. package/dist/export-sync/push.d.ts +76 -0
  228. package/dist/export-sync/push.js +197 -0
  229. package/dist/export-sync/push.js.map +1 -0
  230. package/dist/export-sync/registry-sync-client.d.ts +59 -0
  231. package/dist/export-sync/registry-sync-client.js +97 -0
  232. package/dist/export-sync/registry-sync-client.js.map +1 -0
  233. package/dist/export-sync/sync.d.ts +47 -0
  234. package/dist/export-sync/sync.js +47 -0
  235. package/dist/export-sync/sync.js.map +1 -0
  236. package/dist/export-sync/typegen.d.ts +40 -0
  237. package/dist/export-sync/typegen.js +45 -0
  238. package/dist/export-sync/typegen.js.map +1 -0
  239. package/dist/export-sync/validate.d.ts +19 -0
  240. package/dist/export-sync/validate.js +102 -0
  241. package/dist/export-sync/validate.js.map +1 -0
  242. package/dist/export-sync/watch.d.ts +66 -0
  243. package/dist/export-sync/watch.js +70 -0
  244. package/dist/export-sync/watch.js.map +1 -0
  245. package/dist/operations/assets.d.ts +198 -0
  246. package/dist/operations/assets.js +75 -0
  247. package/dist/operations/assets.js.map +1 -0
  248. package/dist/operations/authorization.d.ts +49 -0
  249. package/dist/operations/authorization.js +128 -0
  250. package/dist/operations/authorization.js.map +1 -0
  251. package/dist/operations/changesets.d.ts +160 -0
  252. package/dist/operations/changesets.js +442 -0
  253. package/dist/operations/changesets.js.map +1 -0
  254. package/dist/operations/client.d.ts +49 -0
  255. package/dist/operations/client.js +57 -0
  256. package/dist/operations/client.js.map +1 -0
  257. package/dist/operations/core.d.ts +238 -0
  258. package/dist/operations/core.js +269 -0
  259. package/dist/operations/core.js.map +1 -0
  260. package/dist/operations/documents.d.ts +432 -0
  261. package/dist/operations/documents.js +344 -0
  262. package/dist/operations/documents.js.map +1 -0
  263. package/dist/operations/graph.d.ts +138 -0
  264. package/dist/operations/graph.js +78 -0
  265. package/dist/operations/graph.js.map +1 -0
  266. package/dist/operations/index.d.ts +19 -0
  267. package/dist/operations/index.js +20 -0
  268. package/dist/operations/index.js.map +1 -0
  269. package/dist/operations/members.d.ts +87 -0
  270. package/dist/operations/members.js +56 -0
  271. package/dist/operations/members.js.map +1 -0
  272. package/dist/operations/publishing.d.ts +89 -0
  273. package/dist/operations/publishing.js +57 -0
  274. package/dist/operations/publishing.js.map +1 -0
  275. package/dist/operations/references.d.ts +222 -0
  276. package/dist/operations/references.js +177 -0
  277. package/dist/operations/references.js.map +1 -0
  278. package/dist/operations/schema.d.ts +413 -0
  279. package/dist/operations/schema.js +138 -0
  280. package/dist/operations/schema.js.map +1 -0
  281. package/dist/operations/tokens.d.ts +79 -0
  282. package/dist/operations/tokens.js +102 -0
  283. package/dist/operations/tokens.js.map +1 -0
  284. package/dist/persistence/adapter.d.ts +79 -0
  285. package/dist/persistence/adapter.js +55 -0
  286. package/dist/persistence/adapter.js.map +1 -0
  287. package/dist/persistence/assets.d.ts +120 -0
  288. package/dist/persistence/assets.js +141 -0
  289. package/dist/persistence/assets.js.map +1 -0
  290. package/dist/persistence/backend-validation.d.ts +43 -0
  291. package/dist/persistence/backend-validation.js +57 -0
  292. package/dist/persistence/backend-validation.js.map +1 -0
  293. package/dist/persistence/cli-tokens.d.ts +50 -0
  294. package/dist/persistence/cli-tokens.js +66 -0
  295. package/dist/persistence/cli-tokens.js.map +1 -0
  296. package/dist/persistence/cms.d.ts +148 -0
  297. package/dist/persistence/cms.js +232 -0
  298. package/dist/persistence/cms.js.map +1 -0
  299. package/dist/persistence/contract-scenarios.d.ts +73 -0
  300. package/dist/persistence/contract-scenarios.js +496 -0
  301. package/dist/persistence/contract-scenarios.js.map +1 -0
  302. package/dist/persistence/core.d.ts +96 -0
  303. package/dist/persistence/core.js +110 -0
  304. package/dist/persistence/core.js.map +1 -0
  305. package/dist/persistence/graph.d.ts +61 -0
  306. package/dist/persistence/graph.js +98 -0
  307. package/dist/persistence/graph.js.map +1 -0
  308. package/dist/persistence/index.d.ts +22 -0
  309. package/dist/persistence/index.js +23 -0
  310. package/dist/persistence/index.js.map +1 -0
  311. package/dist/persistence/members.d.ts +70 -0
  312. package/dist/persistence/members.js +0 -0
  313. package/dist/persistence/members.js.map +1 -0
  314. package/dist/persistence/publishing.d.ts +59 -0
  315. package/dist/persistence/publishing.js +95 -0
  316. package/dist/persistence/publishing.js.map +1 -0
  317. package/dist/persistence/reference-extraction.d.ts +44 -0
  318. package/dist/persistence/reference-extraction.js +204 -0
  319. package/dist/persistence/reference-extraction.js.map +1 -0
  320. package/dist/persistence/reference-indexing.d.ts +68 -0
  321. package/dist/persistence/reference-indexing.js +112 -0
  322. package/dist/persistence/reference-indexing.js.map +1 -0
  323. package/dist/persistence/references.d.ts +257 -0
  324. package/dist/persistence/references.js +0 -0
  325. package/dist/persistence/references.js.map +1 -0
  326. package/dist/persistence/seed.d.ts +55 -0
  327. package/dist/persistence/seed.js +102 -0
  328. package/dist/persistence/seed.js.map +1 -0
  329. package/dist/persistence/self-maintaining-adapter.d.ts +41 -0
  330. package/dist/persistence/self-maintaining-adapter.js +79 -0
  331. package/dist/persistence/self-maintaining-adapter.js.map +1 -0
  332. package/dist/plugins/asset-storage.d.ts +76 -0
  333. package/dist/plugins/asset-storage.js +104 -0
  334. package/dist/plugins/asset-storage.js.map +1 -0
  335. package/dist/plugins/component-package.d.ts +54 -0
  336. package/dist/plugins/component-package.js +92 -0
  337. package/dist/plugins/component-package.js.map +1 -0
  338. package/dist/plugins/data-sources.d.ts +78 -0
  339. package/dist/plugins/data-sources.js +99 -0
  340. package/dist/plugins/data-sources.js.map +1 -0
  341. package/dist/plugins/examples.d.ts +47 -0
  342. package/dist/plugins/examples.js +205 -0
  343. package/dist/plugins/examples.js.map +1 -0
  344. package/dist/plugins/export-targets.d.ts +47 -0
  345. package/dist/plugins/export-targets.js +78 -0
  346. package/dist/plugins/export-targets.js.map +1 -0
  347. package/dist/plugins/field-types.d.ts +86 -0
  348. package/dist/plugins/field-types.js +93 -0
  349. package/dist/plugins/field-types.js.map +1 -0
  350. package/dist/plugins/hooks.d.ts +60 -0
  351. package/dist/plugins/hooks.js +94 -0
  352. package/dist/plugins/hooks.js.map +1 -0
  353. package/dist/plugins/index.d.ts +27 -0
  354. package/dist/plugins/index.js +28 -0
  355. package/dist/plugins/index.js.map +1 -0
  356. package/dist/plugins/marketplace.d.ts +90 -0
  357. package/dist/plugins/marketplace.js +110 -0
  358. package/dist/plugins/marketplace.js.map +1 -0
  359. package/dist/plugins/plugin.d.ts +107 -0
  360. package/dist/plugins/plugin.js +122 -0
  361. package/dist/plugins/plugin.js.map +1 -0
  362. package/dist/plugins/templates.d.ts +66 -0
  363. package/dist/plugins/templates.js +74 -0
  364. package/dist/plugins/templates.js.map +1 -0
  365. package/dist/project-graph/binding.d.ts +68 -0
  366. package/dist/project-graph/binding.js +39 -0
  367. package/dist/project-graph/binding.js.map +1 -0
  368. package/dist/project-graph/container.d.ts +126 -0
  369. package/dist/project-graph/container.js +221 -0
  370. package/dist/project-graph/container.js.map +1 -0
  371. package/dist/project-graph/edit.d.ts +66 -0
  372. package/dist/project-graph/edit.js +201 -0
  373. package/dist/project-graph/edit.js.map +1 -0
  374. package/dist/project-graph/fixtures.d.ts +51 -0
  375. package/dist/project-graph/fixtures.js +224 -0
  376. package/dist/project-graph/fixtures.js.map +1 -0
  377. package/dist/project-graph/ids.d.ts +17 -0
  378. package/dist/project-graph/ids.js +19 -0
  379. package/dist/project-graph/ids.js.map +1 -0
  380. package/dist/project-graph/index.d.ts +12 -0
  381. package/dist/project-graph/index.js +13 -0
  382. package/dist/project-graph/index.js.map +1 -0
  383. package/dist/project-graph/issues.d.ts +61 -0
  384. package/dist/project-graph/issues.js +44 -0
  385. package/dist/project-graph/issues.js.map +1 -0
  386. package/dist/project-graph/json.d.ts +6 -0
  387. package/dist/project-graph/json.js +10 -0
  388. package/dist/project-graph/json.js.map +1 -0
  389. package/dist/project-graph/node.d.ts +48 -0
  390. package/dist/project-graph/node.js +42 -0
  391. package/dist/project-graph/node.js.map +1 -0
  392. package/dist/project-graph/normalize.d.ts +17 -0
  393. package/dist/project-graph/normalize.js +110 -0
  394. package/dist/project-graph/normalize.js.map +1 -0
  395. package/dist/project-graph/serialize.d.ts +36 -0
  396. package/dist/project-graph/serialize.js +51 -0
  397. package/dist/project-graph/serialize.js.map +1 -0
  398. package/dist/project-graph/structure.d.ts +40 -0
  399. package/dist/project-graph/structure.js +36 -0
  400. package/dist/project-graph/structure.js.map +1 -0
  401. package/dist/project-graph/validate.d.ts +84 -0
  402. package/dist/project-graph/validate.js +158 -0
  403. package/dist/project-graph/validate.js.map +1 -0
  404. package/dist/rich-text/adapter.d.ts +43 -0
  405. package/dist/rich-text/adapter.js +24 -0
  406. package/dist/rich-text/adapter.js.map +1 -0
  407. package/dist/rich-text/dom-editor.d.ts +101 -0
  408. package/dist/rich-text/dom-editor.js +482 -0
  409. package/dist/rich-text/dom-editor.js.map +1 -0
  410. package/dist/rich-text/embed.d.ts +70 -0
  411. package/dist/rich-text/embed.js +70 -0
  412. package/dist/rich-text/embed.js.map +1 -0
  413. package/dist/rich-text/fixtures.d.ts +25 -0
  414. package/dist/rich-text/fixtures.js +115 -0
  415. package/dist/rich-text/fixtures.js.map +1 -0
  416. package/dist/rich-text/html.d.ts +5 -0
  417. package/dist/rich-text/html.js +309 -0
  418. package/dist/rich-text/html.js.map +1 -0
  419. package/dist/rich-text/index.d.ts +19 -0
  420. package/dist/rich-text/index.js +20 -0
  421. package/dist/rich-text/index.js.map +1 -0
  422. package/dist/rich-text/markdown.d.ts +7 -0
  423. package/dist/rich-text/markdown.js +235 -0
  424. package/dist/rich-text/markdown.js.map +1 -0
  425. package/dist/rich-text/portable-text.d.ts +50 -0
  426. package/dist/rich-text/portable-text.js +223 -0
  427. package/dist/rich-text/portable-text.js.map +1 -0
  428. package/dist/rich-text/registry.d.ts +48 -0
  429. package/dist/rich-text/registry.js +16 -0
  430. package/dist/rich-text/registry.js.map +1 -0
  431. package/dist/rich-text/render.d.ts +69 -0
  432. package/dist/rich-text/render.js +205 -0
  433. package/dist/rich-text/render.js.map +1 -0
  434. package/dist/rich-text/schema.d.ts +86 -0
  435. package/dist/rich-text/schema.js +80 -0
  436. package/dist/rich-text/schema.js.map +1 -0
  437. package/dist/rich-text/test-support.d.ts +7 -0
  438. package/dist/rich-text/test-support.js +8 -0
  439. package/dist/rich-text/test-support.js.map +1 -0
  440. package/dist/runtime-renderer/client.d.ts +14 -0
  441. package/dist/runtime-renderer/client.js +15 -0
  442. package/dist/runtime-renderer/client.js.map +1 -0
  443. package/dist/runtime-renderer/condition.d.ts +8 -0
  444. package/dist/runtime-renderer/condition.js +48 -0
  445. package/dist/runtime-renderer/condition.js.map +1 -0
  446. package/dist/runtime-renderer/content-client.d.ts +62 -0
  447. package/dist/runtime-renderer/content-client.js +37 -0
  448. package/dist/runtime-renderer/content-client.js.map +1 -0
  449. package/dist/runtime-renderer/context.d.ts +185 -0
  450. package/dist/runtime-renderer/context.js +7 -0
  451. package/dist/runtime-renderer/context.js.map +1 -0
  452. package/dist/runtime-renderer/fallback.d.ts +39 -0
  453. package/dist/runtime-renderer/fallback.js +45 -0
  454. package/dist/runtime-renderer/fallback.js.map +1 -0
  455. package/dist/runtime-renderer/index.d.ts +13 -0
  456. package/dist/runtime-renderer/index.js +13 -0
  457. package/dist/runtime-renderer/index.js.map +1 -0
  458. package/dist/runtime-renderer/primitives.d.ts +85 -0
  459. package/dist/runtime-renderer/primitives.js +442 -0
  460. package/dist/runtime-renderer/primitives.js.map +1 -0
  461. package/dist/runtime-renderer/render.d.ts +138 -0
  462. package/dist/runtime-renderer/render.js +825 -0
  463. package/dist/runtime-renderer/render.js.map +1 -0
  464. package/dist/runtime-renderer/rich-text.d.ts +26 -0
  465. package/dist/runtime-renderer/rich-text.js +113 -0
  466. package/dist/runtime-renderer/rich-text.js.map +1 -0
  467. package/dist/starter-kits/index.d.ts +13 -0
  468. package/dist/starter-kits/index.js +14 -0
  469. package/dist/starter-kits/index.js.map +1 -0
  470. package/dist/starter-kits/instantiate.d.ts +29 -0
  471. package/dist/starter-kits/instantiate.js +24 -0
  472. package/dist/starter-kits/instantiate.js.map +1 -0
  473. package/dist/starter-kits/kit.d.ts +61 -0
  474. package/dist/starter-kits/kit.js +37 -0
  475. package/dist/starter-kits/kit.js.map +1 -0
  476. package/dist/starter-kits/kits.d.ts +7 -0
  477. package/dist/starter-kits/kits.js +201 -0
  478. package/dist/starter-kits/kits.js.map +1 -0
  479. package/dist/starter-kits/manifests.d.ts +7 -0
  480. package/dist/starter-kits/manifests.js +111 -0
  481. package/dist/starter-kits/manifests.js.map +1 -0
  482. package/dist/starter-kits/upgrade.d.ts +39 -0
  483. package/dist/starter-kits/upgrade.js +54 -0
  484. package/dist/starter-kits/upgrade.js.map +1 -0
  485. package/dist/starter-kits/validate.d.ts +16 -0
  486. package/dist/starter-kits/validate.js +77 -0
  487. package/dist/starter-kits/validate.js.map +1 -0
  488. package/dist/studio-core/context.d.ts +27 -0
  489. package/dist/studio-core/context.js +44 -0
  490. package/dist/studio-core/context.js.map +1 -0
  491. package/dist/studio-core/errors.d.ts +58 -0
  492. package/dist/studio-core/errors.js +74 -0
  493. package/dist/studio-core/errors.js.map +1 -0
  494. package/dist/studio-core/fixtures.d.ts +18 -0
  495. package/dist/studio-core/fixtures.js +83 -0
  496. package/dist/studio-core/fixtures.js.map +1 -0
  497. package/dist/studio-core/ids.d.ts +22 -0
  498. package/dist/studio-core/ids.js +33 -0
  499. package/dist/studio-core/ids.js.map +1 -0
  500. package/dist/studio-core/index.d.ts +11 -0
  501. package/dist/studio-core/index.js +12 -0
  502. package/dist/studio-core/index.js.map +1 -0
  503. package/dist/studio-core/issues.d.ts +50 -0
  504. package/dist/studio-core/issues.js +33 -0
  505. package/dist/studio-core/issues.js.map +1 -0
  506. package/dist/studio-core/metadata.d.ts +109 -0
  507. package/dist/studio-core/metadata.js +74 -0
  508. package/dist/studio-core/metadata.js.map +1 -0
  509. package/dist/studio-core/repository.d.ts +73 -0
  510. package/dist/studio-core/repository.js +202 -0
  511. package/dist/studio-core/repository.js.map +1 -0
  512. package/dist/studio-core/sections.d.ts +73 -0
  513. package/dist/studio-core/sections.js +68 -0
  514. package/dist/studio-core/sections.js.map +1 -0
  515. package/dist/studio-core/validate.d.ts +15 -0
  516. package/dist/studio-core/validate.js +119 -0
  517. package/dist/studio-core/validate.js.map +1 -0
  518. package/dist/studio-core/workspace-config.d.ts +587 -0
  519. package/dist/studio-core/workspace-config.js +434 -0
  520. package/dist/studio-core/workspace-config.js.map +1 -0
  521. package/package.json +104 -0
@@ -0,0 +1,257 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Reference-index substrate (EC-155, vision AD-6 / pillar 3.6).
4
+ *
5
+ * On every write the operations layer extracts *outbound* references — relation
6
+ * fields, rich-text link marks and inline refs, page-graph bindings and
7
+ * component usage, asset usages — into this index, for draft and published
8
+ * variants separately. One index powers many features: "used by" panels, safe
9
+ * unpublish (the queryable answer to Sanity's hidden-draft-reference failure),
10
+ * component/asset where-used, and broken-link audits (UX lands in Milestone B).
11
+ *
12
+ * Records are **derived data**: they carry no timestamps and are deterministic
13
+ * functions of the indexed content, so backfill is idempotent and two runs over
14
+ * the same data are byte-for-byte identical.
15
+ */
16
+ /** Which content variant an entry was extracted from (the Sanity failure-case axis). */
17
+ export declare const referenceVariantSchema: z.ZodEnum<{
18
+ draft: "draft";
19
+ published: "published";
20
+ }>;
21
+ export type ReferenceVariant = z.infer<typeof referenceVariantSchema>;
22
+ /**
23
+ * What kind of entity *holds* the reference. Documents are keyed by their
24
+ * `documentKey` (`collection:id`); pages/layouts by their graph ids.
25
+ */
26
+ export declare const referenceSourceTypeSchema: z.ZodEnum<{
27
+ document: "document";
28
+ page: "page";
29
+ layout: "layout";
30
+ }>;
31
+ export type ReferenceSourceType = z.infer<typeof referenceSourceTypeSchema>;
32
+ /** What kind of entity is *referenced*. Document targets use `collection:id` keys. */
33
+ export declare const referenceTargetTypeSchema: z.ZodEnum<{
34
+ asset: "asset";
35
+ document: "document";
36
+ component: "component";
37
+ }>;
38
+ export type ReferenceTargetType = z.infer<typeof referenceTargetTypeSchema>;
39
+ /**
40
+ * Which reference-bearing structure produced an entry. A *closed* enum so the
41
+ * extractor registry (see `reference-extraction.ts`) is exhaustive by
42
+ * construction — a new structure kind must be added here, registered, and
43
+ * covered by the checklist test before it can produce entries.
44
+ */
45
+ export declare const referenceKindSchema: z.ZodEnum<{
46
+ "relation-field": "relation-field";
47
+ "asset-field": "asset-field";
48
+ "rich-text-link": "rich-text-link";
49
+ "rich-text-node": "rich-text-node";
50
+ "component-usage": "component-usage";
51
+ "prop-binding": "prop-binding";
52
+ "condition-binding": "condition-binding";
53
+ }>;
54
+ export type ReferenceKind = z.infer<typeof referenceKindSchema>;
55
+ export declare const referenceSourceSchema: z.ZodObject<{
56
+ type: z.ZodEnum<{
57
+ document: "document";
58
+ page: "page";
59
+ layout: "layout";
60
+ }>;
61
+ id: z.ZodString;
62
+ }, z.core.$strip>;
63
+ export type ReferenceSource = z.infer<typeof referenceSourceSchema>;
64
+ export declare const referenceTargetSchema: z.ZodObject<{
65
+ type: z.ZodEnum<{
66
+ asset: "asset";
67
+ document: "document";
68
+ component: "component";
69
+ }>;
70
+ id: z.ZodString;
71
+ }, z.core.$strip>;
72
+ export type ReferenceTarget = z.infer<typeof referenceTargetSchema>;
73
+ /**
74
+ * One outbound reference found *inside* a source, before it is attributed to
75
+ * that source: the exact field/node path, the target, and which structure
76
+ * produced it. `path` is a `/`-joined token path into the stored value, e.g.
77
+ * `values/author`, `localized/en/body/doc/content/0/marks/0`,
78
+ * `root/slots/children/2/props/items/binding`.
79
+ */
80
+ export declare const outboundReferenceSchema: z.ZodObject<{
81
+ path: z.ZodString;
82
+ target: z.ZodObject<{
83
+ type: z.ZodEnum<{
84
+ asset: "asset";
85
+ document: "document";
86
+ component: "component";
87
+ }>;
88
+ id: z.ZodString;
89
+ }, z.core.$strip>;
90
+ kind: z.ZodEnum<{
91
+ "relation-field": "relation-field";
92
+ "asset-field": "asset-field";
93
+ "rich-text-link": "rich-text-link";
94
+ "rich-text-node": "rich-text-node";
95
+ "component-usage": "component-usage";
96
+ "prop-binding": "prop-binding";
97
+ "condition-binding": "condition-binding";
98
+ }>;
99
+ }, z.core.$strip>;
100
+ export type OutboundReference = z.infer<typeof outboundReferenceSchema>;
101
+ /** An outbound reference attributed to its holding source entity. */
102
+ export declare const referenceEntrySchema: z.ZodObject<{
103
+ path: z.ZodString;
104
+ target: z.ZodObject<{
105
+ type: z.ZodEnum<{
106
+ asset: "asset";
107
+ document: "document";
108
+ component: "component";
109
+ }>;
110
+ id: z.ZodString;
111
+ }, z.core.$strip>;
112
+ kind: z.ZodEnum<{
113
+ "relation-field": "relation-field";
114
+ "asset-field": "asset-field";
115
+ "rich-text-link": "rich-text-link";
116
+ "rich-text-node": "rich-text-node";
117
+ "component-usage": "component-usage";
118
+ "prop-binding": "prop-binding";
119
+ "condition-binding": "condition-binding";
120
+ }>;
121
+ source: z.ZodObject<{
122
+ type: z.ZodEnum<{
123
+ document: "document";
124
+ page: "page";
125
+ layout: "layout";
126
+ }>;
127
+ id: z.ZodString;
128
+ }, z.core.$strip>;
129
+ }, z.core.$strip>;
130
+ export type ReferenceEntry = z.infer<typeof referenceEntrySchema>;
131
+ /** The persisted index record: entry + project + variant. Derived, timestamp-free. */
132
+ export declare const referenceEntryRecordSchema: z.ZodObject<{
133
+ path: z.ZodString;
134
+ target: z.ZodObject<{
135
+ type: z.ZodEnum<{
136
+ asset: "asset";
137
+ document: "document";
138
+ component: "component";
139
+ }>;
140
+ id: z.ZodString;
141
+ }, z.core.$strip>;
142
+ kind: z.ZodEnum<{
143
+ "relation-field": "relation-field";
144
+ "asset-field": "asset-field";
145
+ "rich-text-link": "rich-text-link";
146
+ "rich-text-node": "rich-text-node";
147
+ "component-usage": "component-usage";
148
+ "prop-binding": "prop-binding";
149
+ "condition-binding": "condition-binding";
150
+ }>;
151
+ source: z.ZodObject<{
152
+ type: z.ZodEnum<{
153
+ document: "document";
154
+ page: "page";
155
+ layout: "layout";
156
+ }>;
157
+ id: z.ZodString;
158
+ }, z.core.$strip>;
159
+ projectId: z.ZodString;
160
+ variant: z.ZodEnum<{
161
+ draft: "draft";
162
+ published: "published";
163
+ }>;
164
+ }, z.core.$strip>;
165
+ export type ReferenceEntryRecord = z.infer<typeof referenceEntryRecordSchema>;
166
+ /**
167
+ * Total, deterministic order over index records:
168
+ * variant → source type → source id → path → target type → target id → kind.
169
+ * Every repository read returns records in this order.
170
+ */
171
+ export declare function compareReferenceEntries(a: ReferenceEntryRecord, b: ReferenceEntryRecord): number;
172
+ /** Stable per-project bucket key: one bucket per (variant, source). */
173
+ export declare function referenceSourceKey(variant: ReferenceVariant, source: ReferenceSource): string;
174
+ /** Identity of an entry within its source bucket (used for deduplication). */
175
+ export declare function referenceEntryKey(entry: ReferenceEntry): string;
176
+ /** Dedupe + deterministically sort records (extraction can legitimately repeat a target). */
177
+ export declare function normalizeReferenceRecords(records: readonly ReferenceEntryRecord[]): ReferenceEntryRecord[];
178
+ export interface ReferenceLookupOptions {
179
+ /** Restrict the lookup to one variant; omit for both (draft + published). */
180
+ variant?: ReferenceVariant;
181
+ }
182
+ /**
183
+ * Persisted "the index has been fully built" marker (EC-269). The index is
184
+ * derived data maintained replace-all-for-source on every write, so the
185
+ * (clear + rebuild) backfill is only needed to *seed* a never-built index. A
186
+ * completed backfill writes this marker; its presence lets the read path
187
+ * (opening the References panel) skip the backfill entirely — a single read,
188
+ * zero mutations — instead of rewriting the whole index every session. Carries
189
+ * the entry count purely as a diagnostic; presence is the only gate.
190
+ */
191
+ export interface ReferenceIndexBuildMarker {
192
+ /** Number of entries the completing backfill produced (diagnostic only). */
193
+ entryCount: number;
194
+ }
195
+ /**
196
+ * Persists the reference index (EC-155). Writes are **replace-all-for-source**:
197
+ * saving an entity recomputes every outbound reference it holds and replaces the
198
+ * previous set atomically, so edits/deletes/unpublishes can never leave stale
199
+ * entries behind. Lookups work in both directions with field/node-path
200
+ * granularity and are variant-aware.
201
+ */
202
+ export interface ReferenceIndexRepository {
203
+ /**
204
+ * Replace all entries held by `source` in `variant` with the given outbound
205
+ * references. An empty list removes the source's entries entirely.
206
+ */
207
+ replaceForSource(projectId: string, variant: ReferenceVariant, source: ReferenceSource, references: readonly OutboundReference[]): Promise<ReferenceEntryRecord[]>;
208
+ /**
209
+ * Replace all entries held by sources of the given types in `variant` (the
210
+ * graph recompute path: one revision yields entries across many pages/layouts,
211
+ * and pages removed from the graph must drop their entries too).
212
+ */
213
+ replaceForSourceTypes(projectId: string, variant: ReferenceVariant, sourceTypes: readonly ReferenceSourceType[], entries: readonly ReferenceEntry[]): Promise<ReferenceEntryRecord[]>;
214
+ /** Remove all entries held by `source` (in one variant, or both when omitted). */
215
+ removeForSource(projectId: string, source: ReferenceSource, variant?: ReferenceVariant): Promise<void>;
216
+ /** Outbound: what does `source` reference? */
217
+ outbound(projectId: string, source: ReferenceSource, options?: ReferenceLookupOptions): Promise<ReferenceEntryRecord[]>;
218
+ /** Inbound: what references `target`? (The "used by" / safe-unpublish direction.) */
219
+ inbound(projectId: string, target: ReferenceTarget, options?: ReferenceLookupOptions): Promise<ReferenceEntryRecord[]>;
220
+ /** Every entry of a project (optionally one variant), deterministically ordered. */
221
+ listEntries(projectId: string, variant?: ReferenceVariant): Promise<ReferenceEntryRecord[]>;
222
+ /**
223
+ * The persisted "index fully built" marker (EC-269), or `null` if the project's
224
+ * index has never been backfilled. A present marker means the read path can
225
+ * skip the backfill (maintained-on-write keeps it current thereafter).
226
+ */
227
+ getBuildMarker(projectId: string): Promise<ReferenceIndexBuildMarker | null>;
228
+ /** Persist the build marker after a completed backfill. */
229
+ setBuildMarker(projectId: string, marker: ReferenceIndexBuildMarker): Promise<void>;
230
+ /**
231
+ * Drop the whole index of a project AND its build marker (backfill starts from
232
+ * a clean slate; the marker is re-set only when the rebuild completes).
233
+ */
234
+ clearProject(projectId: string): Promise<void>;
235
+ }
236
+ export interface InMemoryReferenceIndexRepositoryOptions {
237
+ seed?: readonly ReferenceEntryRecord[];
238
+ }
239
+ export declare class InMemoryReferenceIndexRepository implements ReferenceIndexRepository {
240
+ /** projectId → (sourceKey → entries of that source+variant). */
241
+ private readonly byProject;
242
+ /** projectId → build marker (EC-269); absent until a backfill completes. */
243
+ private readonly markers;
244
+ constructor(options?: InMemoryReferenceIndexRepositoryOptions);
245
+ private projectMap;
246
+ private bucket;
247
+ replaceForSource(projectId: string, variant: ReferenceVariant, source: ReferenceSource, references: readonly OutboundReference[]): Promise<ReferenceEntryRecord[]>;
248
+ replaceForSourceTypes(projectId: string, variant: ReferenceVariant, sourceTypes: readonly ReferenceSourceType[], entries: readonly ReferenceEntry[]): Promise<ReferenceEntryRecord[]>;
249
+ removeForSource(projectId: string, source: ReferenceSource, variant?: ReferenceVariant): Promise<void>;
250
+ private collect;
251
+ outbound(projectId: string, source: ReferenceSource, options?: ReferenceLookupOptions): Promise<ReferenceEntryRecord[]>;
252
+ inbound(projectId: string, target: ReferenceTarget, options?: ReferenceLookupOptions): Promise<ReferenceEntryRecord[]>;
253
+ listEntries(projectId: string, variant?: ReferenceVariant): Promise<ReferenceEntryRecord[]>;
254
+ getBuildMarker(projectId: string): Promise<ReferenceIndexBuildMarker | null>;
255
+ setBuildMarker(projectId: string, marker: ReferenceIndexBuildMarker): Promise<void>;
256
+ clearProject(projectId: string): Promise<void>;
257
+ }
Binary file
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/persistence/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAE/E,wFAAwF;AACxF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;AAGpE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAG/E,sFAAsF;AACtF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;AAGnF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC;IACxC,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,mBAAmB;CACpB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,yBAAyB;IAC/B,4FAA4F;IAC5F,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACtB,CA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SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CACnE,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,OAA0B;QAE1B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;IACvF,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC1C,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB,EAAE,MAAiC;QACvE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAChC,CAAC;CACF"}
@@ -0,0 +1,55 @@
1
+ import { InMemoryPersistenceAdapter } from './adapter';
2
+ import type { PersistenceAdapter } from './adapter';
3
+ import type { ProjectRole } from './members';
4
+ /** The sample project the seed attaches graph/registry/CMS/publishing to. */
5
+ export declare const SEED_PROJECT_ID = "prj_aurora";
6
+ /**
7
+ * Deterministic dev users (EC-150). The ids are canonical here so the seeded
8
+ * memberships and the builder's local auth adapter (which maps
9
+ * `admin@example.com` etc. + fixed dev passwords onto these ids) stay aligned.
10
+ * Live Convex deployments use Convex Auth `users` ids instead.
11
+ */
12
+ export declare const DEV_USERS: {
13
+ readonly admin: {
14
+ readonly id: "user_admin";
15
+ readonly email: "admin@example.com";
16
+ readonly name: "Ada Admin";
17
+ };
18
+ readonly editor: {
19
+ readonly id: "user_editor";
20
+ readonly email: "editor@example.com";
21
+ readonly name: "Edi Editor";
22
+ };
23
+ readonly viewer: {
24
+ readonly id: "user_viewer";
25
+ readonly email: "viewer@example.com";
26
+ readonly name: "Vio Viewer";
27
+ };
28
+ };
29
+ /** Role each dev user gets on every sample project. */
30
+ export declare const DEV_USER_ROLES: ReadonlyArray<{
31
+ userId: string;
32
+ role: ProjectRole;
33
+ }>;
34
+ /** A deterministic sample asset record seeded alongside the CMS content. */
35
+ export declare const SEED_ASSET: {
36
+ readonly id: "asset_cover";
37
+ readonly filename: "cover.jpg";
38
+ readonly contentType: "image/jpeg";
39
+ readonly byteSize: 102400;
40
+ readonly width: 1200;
41
+ readonly height: 630;
42
+ readonly alt: "Cover image";
43
+ };
44
+ /**
45
+ * Populate an adapter with deterministic seed content (brief §10, EC-046):
46
+ * a graph revision, the CMS schema + documents, a sample asset, and a preview
47
+ * publish. Uses only the public repository API, so it works against any
48
+ * {@link PersistenceAdapter} implementation (in-memory or Convex).
49
+ */
50
+ export declare function seedPersistence(adapter: PersistenceAdapter): Promise<void>;
51
+ /**
52
+ * Build a fully-seeded in-memory adapter (brief §10, §11). The domains are
53
+ * seeded deterministically. Reproducible across runs.
54
+ */
55
+ export declare function createSeededPersistenceAdapter(): Promise<InMemoryPersistenceAdapter>;
@@ -0,0 +1,102 @@
1
+ import { validSampleGraph } from '@elytracms/core/project-graph';
2
+ import { documentKey, sampleDocuments, sampleFilterableCollections, samplePublishedKeys, selfTypeDocument, } from '@elytracms/core/cms-core';
3
+ import { createSequentialClock } from './core';
4
+ import { InMemoryPersistenceAdapter } from './adapter';
5
+ /** The sample project the seed attaches graph/registry/CMS/publishing to. */
6
+ export const SEED_PROJECT_ID = 'prj_aurora';
7
+ /**
8
+ * Deterministic dev users (EC-150). The ids are canonical here so the seeded
9
+ * memberships and the builder's local auth adapter (which maps
10
+ * `admin@example.com` etc. + fixed dev passwords onto these ids) stay aligned.
11
+ * Live Convex deployments use Convex Auth `users` ids instead.
12
+ */
13
+ export const DEV_USERS = {
14
+ admin: { id: 'user_admin', email: 'admin@example.com', name: 'Ada Admin' },
15
+ editor: { id: 'user_editor', email: 'editor@example.com', name: 'Edi Editor' },
16
+ viewer: { id: 'user_viewer', email: 'viewer@example.com', name: 'Vio Viewer' },
17
+ };
18
+ /** Role each dev user gets on every sample project. */
19
+ export const DEV_USER_ROLES = [
20
+ { userId: DEV_USERS.admin.id, role: 'admin' },
21
+ { userId: DEV_USERS.editor.id, role: 'editor' },
22
+ { userId: DEV_USERS.viewer.id, role: 'viewer' },
23
+ ];
24
+ /** A deterministic sample asset record seeded alongside the CMS content. */
25
+ export const SEED_ASSET = {
26
+ id: 'asset_cover',
27
+ filename: 'cover.jpg',
28
+ contentType: 'image/jpeg',
29
+ byteSize: 102400,
30
+ width: 1200,
31
+ height: 630,
32
+ alt: 'Cover image',
33
+ };
34
+ /**
35
+ * Populate an adapter with deterministic seed content (brief §10, EC-046):
36
+ * a graph revision, the CMS schema + documents, a sample asset, and a preview
37
+ * publish. Uses only the public repository API, so it works against any
38
+ * {@link PersistenceAdapter} implementation (in-memory or Convex).
39
+ */
40
+ export async function seedPersistence(adapter) {
41
+ // Graph + revision — LAYOUTS-ONLY (EC-187, schemaVersion 2). The home page is
42
+ // no longer a graph page; it is a `page`-collection document seeded below
43
+ // (`samplePageHome` rides in `sampleDocuments`), rendered into `layout.main`.
44
+ const revision = await adapter.graphs.saveGraph(SEED_PROJECT_ID, validSampleGraph, {
45
+ label: 'Initial import',
46
+ });
47
+ // CMS schema + documents (localized variants ride along; publish-ness is the
48
+ // version pointer pinned below, EC-224).
49
+ // `sampleDocuments` includes the `page/home` document (EC-187) so a routed
50
+ // page resolves to its body composition. The canonical `filterable`
51
+ // declarations ride on the seeded schema (EC-169 fix-pack) so studio
52
+ // filter/sort pickers and the delivery engine share one declaration set
53
+ // without app-side overlays.
54
+ await adapter.cms.saveSchema(SEED_PROJECT_ID, sampleFilterableCollections);
55
+ // EC-224: the live row is the continuous DRAFT (the Sanity model). A doc in
56
+ // `samplePublishedKeys` is published via the version POINTER — record a version
57
+ // snapshot and pin it — not by a flat `state` flag (B-3c retires the field).
58
+ // Resolution serves published via the pin; the live row stays a draft.
59
+ const published = new Set(samplePublishedKeys);
60
+ const collectionsById = new Map(sampleFilterableCollections.map((c) => [c.id, c]));
61
+ for (const rawDocument of sampleDocuments) {
62
+ // EC-277: seed self-typed content, exactly as the operations write lens does in
63
+ // production (the seed's compositions hold no picked relation/asset props, so no
64
+ // manifest lookup is needed here). The persistence store stays schema-agnostic.
65
+ const collection = collectionsById.get(rawDocument.collection);
66
+ const document = collection ? selfTypeDocument(rawDocument, collection) : rawDocument;
67
+ await adapter.cms.upsertDocument(SEED_PROJECT_ID, document);
68
+ if (published.has(documentKey({ collection: document.collection, id: document.id }))) {
69
+ const version = await adapter.cms.saveDocumentVersion(SEED_PROJECT_ID, document, {
70
+ label: 'published',
71
+ });
72
+ await adapter.cms.publishDocumentVersion(SEED_PROJECT_ID, { collection: document.collection, id: document.id }, version.version);
73
+ }
74
+ }
75
+ // Asset metadata.
76
+ await adapter.assets.upsertAsset(SEED_PROJECT_ID, SEED_ASSET);
77
+ // Publish the initial revision (the deployment's one environment).
78
+ await adapter.publishing.publish(SEED_PROJECT_ID, {
79
+ revisionId: revision.id,
80
+ revision: revision.revision,
81
+ });
82
+ // Memberships (EC-150): every dev user gets their role on the seeded project,
83
+ // so each role's studio experience is reproducible from fixtures.
84
+ const projectIds = [SEED_PROJECT_ID];
85
+ for (const projectId of projectIds) {
86
+ for (const { userId, role } of DEV_USER_ROLES) {
87
+ await adapter.members.setMember(projectId, userId, role);
88
+ }
89
+ }
90
+ }
91
+ /**
92
+ * Build a fully-seeded in-memory adapter (brief §10, §11). The domains are
93
+ * seeded deterministically. Reproducible across runs.
94
+ */
95
+ export async function createSeededPersistenceAdapter() {
96
+ const adapter = new InMemoryPersistenceAdapter({
97
+ clock: createSequentialClock('2026-06-07T00:00:00.000Z'),
98
+ });
99
+ await seedPersistence(adapter);
100
+ return adapter;
101
+ }
102
+ //# sourceMappingURL=seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../src/persistence/seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EACL,WAAW,EACX,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AAItD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,WAAW,EAAE;IAC1E,MAAM,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;IAC9E,MAAM,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,YAAY,EAAE;CACtE,CAAA;AAEV,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAyD;IAClF,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IAC7C,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC/C,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CAChD,CAA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OAAO,GAAG,IAAI,0BAA0B,CAAC;QAC7C,KAAK,EAAE,qBAAqB,CAAC,0BAA0B,CAAC;KACzD,CAAC,CAAA;IACF,MAAM,eAAe,CAAC,OAAO,CAAC,CAAA;IAC9B,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { PersistenceAdapter } from './adapter';
2
+ import type { CmsRepository } from './cms';
3
+ import type { GraphRepository } from './graph';
4
+ import type { PublishingRepository } from './publishing';
5
+ /**
6
+ * Self-maintaining reference index (EC-277, vision AD-6).
7
+ *
8
+ * The reference index is **maintained at the source, in the write path** — not by
9
+ * a client-side event subscriber. Every writer is caught by construction: a write
10
+ * recomputes the affected source's outbound references before it returns, so the
11
+ * index can never drift behind the content, regardless of which code path issued
12
+ * the write.
13
+ *
14
+ * {@link maintainReferenceIndex} wraps an in-process repository set (the in-memory
15
+ * provider) so each document/graph/publishing write reindexes in the same call.
16
+ * The Convex provider achieves the identical guarantee *server-side* — extraction
17
+ * runs inside the mutation handler (`convex/cms.ts`, `convex/graphs.ts`,
18
+ * `convex/publishing.ts`), so a raw `convex run` is caught too — and merely flags
19
+ * {@link PersistenceAdapter.maintainsReferenceIndex} so the studio bootstrap does
20
+ * not double-index via the `attachReferenceIndex` subscriber.
21
+ *
22
+ * Extraction is schema-free and manifest-free (self-describing content, AD-15), so
23
+ * maintenance needs nothing but the stored value — which is exactly what lets it
24
+ * live in the store rather than the client.
25
+ */
26
+ /** The write-bearing repositories whose mutations trigger a reindex. */
27
+ export interface MaintainableRepositories {
28
+ cms: CmsRepository;
29
+ graphs: GraphRepository;
30
+ publishing: PublishingRepository;
31
+ }
32
+ /**
33
+ * Wrap a repository set so each write keeps the reference index current in-process.
34
+ * `getAdapter` is read lazily on each write so the reindex routines (which need the
35
+ * full adapter for cross-repository reads) resolve against the live, fully-built
36
+ * adapter — letting the caller construct repositories and adapter in any order.
37
+ * Idempotent reindexing (replace-all-for-source) means a redundant subscriber would
38
+ * still converge, but the owning adapter should advertise
39
+ * {@link PersistenceAdapter.maintainsReferenceIndex} so the subscriber stands down.
40
+ */
41
+ export declare function maintainReferenceIndex(repos: MaintainableRepositories, getAdapter: () => PersistenceAdapter): MaintainableRepositories;
@@ -0,0 +1,79 @@
1
+ import { reindexDocumentReferences, reindexGraphDraftReferences, reindexGraphPublishedReferences, } from './reference-indexing';
2
+ /**
3
+ * Forward every method of a repository to `inner` (preserving `this`), overriding
4
+ * only the named write methods. A `Proxy` keeps the non-overridden surface — reads
5
+ * and the repository's own internal state — bound to the real instance.
6
+ */
7
+ function forwardRepository(inner, overrides) {
8
+ const overrideMap = overrides;
9
+ return new Proxy(inner, {
10
+ get(target, prop) {
11
+ if (Object.prototype.hasOwnProperty.call(overrideMap, prop))
12
+ return overrideMap[prop];
13
+ const value = Reflect.get(target, prop, target);
14
+ return typeof value === 'function'
15
+ ? value.bind(target)
16
+ : value;
17
+ },
18
+ });
19
+ }
20
+ /**
21
+ * Wrap a repository set so each write keeps the reference index current in-process.
22
+ * `getAdapter` is read lazily on each write so the reindex routines (which need the
23
+ * full adapter for cross-repository reads) resolve against the live, fully-built
24
+ * adapter — letting the caller construct repositories and adapter in any order.
25
+ * Idempotent reindexing (replace-all-for-source) means a redundant subscriber would
26
+ * still converge, but the owning adapter should advertise
27
+ * {@link PersistenceAdapter.maintainsReferenceIndex} so the subscriber stands down.
28
+ */
29
+ export function maintainReferenceIndex(repos, getAdapter) {
30
+ return {
31
+ cms: forwardRepository(repos.cms, {
32
+ upsertDocument: async (projectId, document) => {
33
+ const record = await repos.cms.upsertDocument(projectId, document);
34
+ await reindexDocumentReferences(getAdapter(), projectId, {
35
+ collection: document.collection,
36
+ id: document.id,
37
+ });
38
+ return record;
39
+ },
40
+ deleteDocument: async (projectId, ref) => {
41
+ await repos.cms.deleteDocument(projectId, ref);
42
+ // The recompute of a now-missing document drops all of its entries.
43
+ await reindexDocumentReferences(getAdapter(), projectId, ref);
44
+ },
45
+ publishDocumentVersion: async (projectId, ref, version) => {
46
+ const record = await repos.cms.publishDocumentVersion(projectId, ref, version);
47
+ // The published variant now exists — recompute both variants of this doc.
48
+ await reindexDocumentReferences(getAdapter(), projectId, ref);
49
+ return record;
50
+ },
51
+ unpublishDocument: async (projectId, ref) => {
52
+ const record = await repos.cms.unpublishDocument(projectId, ref);
53
+ // The live pin is cleared — drop this doc's published entries.
54
+ await reindexDocumentReferences(getAdapter(), projectId, ref);
55
+ return record;
56
+ },
57
+ }),
58
+ graphs: forwardRepository(repos.graphs, {
59
+ saveGraph: async (projectId, graph, options) => {
60
+ const record = await repos.graphs.saveGraph(projectId, graph, options);
61
+ await reindexGraphDraftReferences(getAdapter(), projectId);
62
+ return record;
63
+ },
64
+ }),
65
+ publishing: forwardRepository(repos.publishing, {
66
+ publish: async (projectId, input) => {
67
+ const record = await repos.publishing.publish(projectId, input);
68
+ await reindexGraphPublishedReferences(getAdapter(), projectId);
69
+ return record;
70
+ },
71
+ unpublish: async (projectId) => {
72
+ const record = await repos.publishing.unpublish(projectId);
73
+ await reindexGraphPublishedReferences(getAdapter(), projectId);
74
+ return record;
75
+ },
76
+ }),
77
+ };
78
+ }
79
+ //# sourceMappingURL=self-maintaining-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-maintaining-adapter.js","sourceRoot":"","sources":["../../src/persistence/self-maintaining-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,sBAAsB,CAAA;AA+B7B;;;;GAIG;AACH,SAAS,iBAAiB,CAAmB,KAAQ,EAAE,SAAqB;IAC1E,MAAM,WAAW,GAAG,SAAyC,CAAA;IAC7D,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;QACtB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;gBAAE,OAAO,WAAW,CAAC,IAAI,C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AE,EAAE,SAAS,CAAC,CAAA;gBAC9D,OAAO,MAAM,CAAA;YACf,CAAC;SACF,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Asset-storage adapters (EC-133). The CMS stores asset *metadata* (filename, size, content type)
3
+ * and points at bytes by an opaque storage key. A storage adapter owns where those bytes live —
4
+ * in-memory, a CDN base URL, S3, Convex file storage, etc. This interface is structurally
5
+ * compatible with `@elytracms/core/persistence`'s `BlobStorageAdapter`, so an adapter registered here can
6
+ * back the asset repository directly. Selection is pluggable and configurable.
7
+ */
8
+ /** A pluggable asset-storage backend (EC-133). */
9
+ export interface AssetStorageAdapter {
10
+ /** Backend kind, e.g. `memory`, `plugin.base-url`, `plugin.s3`. */
11
+ kind: string;
12
+ title: string;
13
+ description?: string;
14
+ /** Persist bytes under a key. */
15
+ put(key: string, data: Uint8Array, contentType?: string): Promise<void>;
16
+ /** Read bytes back (undefined when absent). */
17
+ get(key: string): Promise<Uint8Array | undefined>;
18
+ /** A resolvable locator (URL) for the stored blob. */
19
+ url(key: string): string;
20
+ has(key: string): Promise<boolean>;
21
+ delete(key: string): Promise<void>;
22
+ }
23
+ /** A structured registration issue for the storage registry. */
24
+ export interface AssetStorageRegistryIssue {
25
+ code: 'duplicate';
26
+ message: string;
27
+ ref: string;
28
+ }
29
+ /** Registry of asset-storage adapters keyed by kind, with a selectable active backend. */
30
+ export declare class AssetStorageRegistry {
31
+ private readonly byKind;
32
+ private activeKind;
33
+ readonly issues: AssetStorageRegistryIssue[];
34
+ constructor(adapters?: Iterable<AssetStorageAdapter>);
35
+ register(adapter: AssetStorageAdapter): void;
36
+ has(kind: string): boolean;
37
+ get(kind: string): AssetStorageAdapter | undefined;
38
+ list(): AssetStorageAdapter[];
39
+ /** Select the active backend (the one the asset repository writes through). */
40
+ use(kind: string): boolean;
41
+ /** The active adapter (first registered, unless changed via {@link use}). */
42
+ active(): AssetStorageAdapter | undefined;
43
+ get size(): number;
44
+ }
45
+ /**
46
+ * In-memory asset storage (the reference adapter for tests and local inspection). Bytes persist
47
+ * for the lifetime of the instance.
48
+ */
49
+ export declare class MemoryAssetStorage implements AssetStorageAdapter {
50
+ readonly kind = "memory";
51
+ readonly title = "In-memory";
52
+ readonly description = "Keeps bytes in process memory. For local development and tests.";
53
+ private readonly blobs;
54
+ put(key: string, data: Uint8Array): Promise<void>;
55
+ get(key: string): Promise<Uint8Array | undefined>;
56
+ url(key: string): string;
57
+ has(key: string): Promise<boolean>;
58
+ delete(key: string): Promise<void>;
59
+ }
60
+ /**
61
+ * A read-through CDN/base-URL adapter (example, EC-133). Bytes are served from an external base
62
+ * URL; this adapter resolves locators but does not own writes (uploads happen out of band). It
63
+ * demonstrates that a "new storage backend" is just another implementation of the interface.
64
+ */
65
+ export declare class BaseUrlAssetStorage implements AssetStorageAdapter {
66
+ readonly kind = "plugin.base-url";
67
+ readonly title = "CDN base URL";
68
+ readonly description = "Resolves asset URLs against a configured CDN/base URL. Read-through.";
69
+ private readonly base;
70
+ constructor(baseUrl: string);
71
+ put(): Promise<void>;
72
+ get(): Promise<Uint8Array | undefined>;
73
+ url(key: string): string;
74
+ has(): Promise<boolean>;
75
+ delete(): Promise<void>;
76
+ }