@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 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/content/locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AA4BvD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAuB,EACvB,UAAyB,EACzB,GAAgB,EAChB,WAAoB,EAAE;IAEtB,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,SAAS,GAA0B,EAAE,CAAA;IAE3C,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QAC3F,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS;YAAE,SAAQ;QAC1C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAA;QACnC,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC;gBAC/B,KAAK,EAAE,KAAK,CAAC,IAAI;gBACjB,eAAe,EAAE,OAAO,CAAC,MAAM;gBAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;aACpC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { CmsDocument, DocumentHistory } from '@elytracms/core/cms-core';
2
+ import type { ContentContext } from './context';
3
+ /**
4
+ * What delivery resolution accepts as a document source: either a bare stored
5
+ * row (`CmsDocument`, always a working draft — EC-224 retired the `state` flag)
6
+ * or the full draft/published history (`DocumentHistory`, EC-021) whose
7
+ * `published` field carries the pinned snapshot. Lookups hand these in;
8
+ * resolution stays pure — no fetching at this layer.
9
+ */
10
+ export type ContentDocumentSource = CmsDocument | DocumentHistory;
11
+ /** Narrow a source to a `DocumentHistory` (draft/published split, EC-021). */
12
+ export declare function isDocumentHistory(source: ContentDocumentSource): source is DocumentHistory;
13
+ /**
14
+ * Select the stored row visible under the context's perspective (EC-021):
15
+ *
16
+ * - For a `DocumentHistory`: `draft` returns the working draft, `published`
17
+ * returns the last published snapshot — or `null` if the document has never
18
+ * been published. Draft content is never leaked into `published`.
19
+ * - For a bare `CmsDocument`: `draft` sees the row as-is; `published` returns
20
+ * `null`. A bare row carries no publish signal (EC-224 retired `state`), so
21
+ * it is treated as never-published here — fail-closed. Published content
22
+ * reaches this layer ONLY as a `DocumentHistory` whose `published` field the
23
+ * feeder set (the live host wraps each published snapshot; the adapter path
24
+ * wraps a pinned record), never as a bare row.
25
+ *
26
+ * Returning `null` means "not visible in this perspective" — that is correct
27
+ * delivery behavior for unpublished content, not a validation issue.
28
+ */
29
+ export declare function selectPerspective(context: ContentContext, source: ContentDocumentSource): CmsDocument | null;
@@ -0,0 +1,31 @@
1
+ /** Narrow a source to a `DocumentHistory` (draft/published split, EC-021). */
2
+ export function isDocumentHistory(source) {
3
+ return 'draft' in source && 'versions' in source;
4
+ }
5
+ /**
6
+ * Select the stored row visible under the context's perspective (EC-021):
7
+ *
8
+ * - For a `DocumentHistory`: `draft` returns the working draft, `published`
9
+ * returns the last published snapshot — or `null` if the document has never
10
+ * been published. Draft content is never leaked into `published`.
11
+ * - For a bare `CmsDocument`: `draft` sees the row as-is; `published` returns
12
+ * `null`. A bare row carries no publish signal (EC-224 retired `state`), so
13
+ * it is treated as never-published here — fail-closed. Published content
14
+ * reaches this layer ONLY as a `DocumentHistory` whose `published` field the
15
+ * feeder set (the live host wraps each published snapshot; the adapter path
16
+ * wraps a pinned record), never as a bare row.
17
+ *
18
+ * Returning `null` means "not visible in this perspective" — that is correct
19
+ * delivery behavior for unpublished content, not a validation issue.
20
+ */
21
+ export function selectPerspective(context, source) {
22
+ if (isDocumentHistory(source)) {
23
+ if (context.perspective === 'draft')
24
+ return source.draft;
25
+ return source.published ?? null;
26
+ }
27
+ if (context.perspective === 'draft')
28
+ return source;
29
+ return null;
30
+ }
31
+ //# sourceMappingURL=perspective.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perspective.js","sourceRoot":"","sources":["../../src/content/perspective.ts"],"names":[],"mappings":"AAYA,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,OAAO,OAAO,IAAI,MAAM,IAAI,UAAU,IAAI,MAAM,CAAA;AAClD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAuB,EACvB,MAA6B;IAE7B,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,WAAW,KAAK,OAAO;YAAE,OAAO,MAAM,CAAC,KAAK,CAAA;QACxD,OAAO,MAAM,CAAC,SAAS,IAAI,IAAI,CAAA;IACjC,CAAC;IACD,IAAI,OAAO,CAAC,WAAW,KAAK,OAAO;QAAE,OAAO,MAAM,CAAA;IAClD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { DocumentRef, RelationFieldDef } from '@elytracms/core/cms-core';
2
+ /**
3
+ * The unpopulated form of a relation in delivery shape (vision AD-4): always a
4
+ * `{ id, collection }` object, never a bare id string. Returned when a field
5
+ * declares `populate: false`, and for relations *inside* a populated document
6
+ * (population never recurses past depth-1).
7
+ */
8
+ export interface DocumentStub {
9
+ id: string;
10
+ collection: string;
11
+ }
12
+ /**
13
+ * Whether delivery resolution populates this relation to depth-1 (EC-142).
14
+ * Population is the default; `populate: false` is the schema-level opt-out.
15
+ */
16
+ export declare function isPopulatedRelation(field: RelationFieldDef): boolean;
17
+ /** Build the reference stub for a relation target. */
18
+ export declare function relationStub(ref: DocumentRef): DocumentStub;
19
+ /**
20
+ * Parse a stored relation value into a `DocumentRef`, tolerating malformed data:
21
+ * anything not relation-shaped yields `undefined` so the caller can surface a
22
+ * structured issue instead of crashing. Accepts the EC-277 self-typed envelope
23
+ * (`{ type:'reference', collection, id }`) and legacy bare `{ collection, id }`.
24
+ */
25
+ export declare function parseRelationRef(value: unknown): DocumentRef | undefined;
@@ -0,0 +1,22 @@
1
+ import { readDocumentRef } from '@elytracms/core/cms-core';
2
+ /**
3
+ * Whether delivery resolution populates this relation to depth-1 (EC-142).
4
+ * Population is the default; `populate: false` is the schema-level opt-out.
5
+ */
6
+ export function isPopulatedRelation(field) {
7
+ return field.populate !== false;
8
+ }
9
+ /** Build the reference stub for a relation target. */
10
+ export function relationStub(ref) {
11
+ return { id: ref.id, collection: ref.collection };
12
+ }
13
+ /**
14
+ * Parse a stored relation value into a `DocumentRef`, tolerating malformed data:
15
+ * anything not relation-shaped yields `undefined` so the caller can surface a
16
+ * structured issue instead of crashing. Accepts the EC-277 self-typed envelope
17
+ * (`{ type:'reference', collection, id }`) and legacy bare `{ collection, id }`.
18
+ */
19
+ export function parseRelationRef(value) {
20
+ return readDocumentRef(value);
21
+ }
22
+ //# sourceMappingURL=populate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"populate.js","sourceRoot":"","sources":["../../src/content/populate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAc1D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAuB;IACzD,OAAO,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAA;AACjC,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,GAAgB;IAC3C,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAA;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,eAAe,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC"}
@@ -0,0 +1,122 @@
1
+ import type { CmsPath, CollectionDef, FieldDef } from '@elytracms/core/cms-core';
2
+ /**
3
+ * The closed v1 filter vocabulary (vision AD-3): equality, `in`, comparisons
4
+ * (lt/lte/gt/gte), AND-only composition. Multiple `where` keys AND together;
5
+ * multiple operators inside one condition AND together. There is no OR, no
6
+ * nesting, no anything else — by design, so every query is enumerable,
7
+ * cache-taggable, and honest about backend indexes.
8
+ */
9
+ export declare const FILTER_OPERATORS: readonly ["eq", "gt", "gte", "in", "lt", "lte"];
10
+ export type FilterOperator = (typeof FILTER_OPERATORS)[number];
11
+ /** A scalar a filter can compare against (relation/asset filters use the id). */
12
+ export type FilterScalar = string | number | boolean;
13
+ /** One field's filter: every present operator must hold (AND). */
14
+ export interface FilterCondition {
15
+ eq?: FilterScalar;
16
+ gt?: FilterScalar;
17
+ gte?: FilterScalar;
18
+ in?: readonly FilterScalar[];
19
+ lt?: FilterScalar;
20
+ lte?: FilterScalar;
21
+ }
22
+ /**
23
+ * The `where` input: field name → condition. A bare scalar is shorthand for
24
+ * `{ eq: value }`. Generated per-collection types (`PostWhere`) narrow the
25
+ * keys to the fields declared `filterable` in the schema.
26
+ */
27
+ export type WhereInput = Readonly<Record<string, FilterScalar | FilterCondition | undefined>>;
28
+ export type SortDirection = 'asc' | 'desc';
29
+ /** Single-field sort; ties always break by document id ascending. */
30
+ export interface SortInput {
31
+ field: string;
32
+ direction?: SortDirection;
33
+ }
34
+ /** The full `listDocuments` query envelope (vision AD-3, rung 3). */
35
+ export interface ListDocumentsQuery<TWhere extends WhereInput = WhereInput> {
36
+ where?: TWhere;
37
+ sort?: SortInput;
38
+ limit?: number;
39
+ cursor?: string;
40
+ }
41
+ /**
42
+ * Codes for structured accessor query errors (EC-143). These describe *caller*
43
+ * mistakes (bad filter, bad cursor), as opposed to `CmsValidationIssue`s which
44
+ * describe content/schema problems. Accessors never throw — invalid queries
45
+ * come back as an error result carrying these.
46
+ */
47
+ export type ContentQueryErrorCode = 'unknown-collection' | 'list-not-supported' | 'non-filterable-field' | 'invalid-filter' | 'invalid-sort' | 'invalid-limit' | 'invalid-cursor';
48
+ export interface ContentQueryError {
49
+ code: ContentQueryErrorCode;
50
+ message: string;
51
+ /** Path into the query input, e.g. ['where', 'title'] or ['sort', 'field']. */
52
+ path: CmsPath;
53
+ meta?: Record<string, unknown>;
54
+ }
55
+ export declare function queryError(code: ContentQueryErrorCode, message: string, path: CmsPath, meta?: Record<string, unknown>): ContentQueryError;
56
+ /** A condition with the `eq` shorthand expanded, operators in stable order. */
57
+ export type NormalizedCondition = Partial<Record<FilterOperator, FilterScalar | readonly FilterScalar[]>>;
58
+ export interface NormalizedWhereEntry {
59
+ field: string;
60
+ condition: NormalizedCondition;
61
+ }
62
+ /**
63
+ * Normalize a `where` input into entries sorted by field name, with the bare
64
+ * scalar shorthand expanded to `{ eq: value }` and operators in the stable
65
+ * `FILTER_OPERATORS` order. Both serialization and execution run on this
66
+ * normal form, so `{ slug: 'x' }` and `{ slug: { eq: 'x' } }` are the same
67
+ * query (and produce the same cache key).
68
+ */
69
+ export declare function normalizeWhere(where: WhereInput): NormalizedWhereEntry[];
70
+ /** The fields of a collection declared `filterable` (EC-143 schema flag). */
71
+ export declare function filterableFields(collection: CollectionDef): FieldDef[];
72
+ /**
73
+ * Validate a `where` input against a collection schema. Filters are permitted
74
+ * **only** on fields declared `filterable` — anything else is a structured
75
+ * `non-filterable-field` error. Unknown operators and malformed operator
76
+ * values are `invalid-filter` errors. All errors are collected (sorted by
77
+ * field, deterministic), never thrown.
78
+ */
79
+ export declare function validateWhere(collection: CollectionDef, where: WhereInput): ContentQueryError[];
80
+ /**
81
+ * Validate a sort input. Sorting uses the same `filterable` declaration as
82
+ * filtering (same rationale: backend indexes stay honest).
83
+ */
84
+ export declare function validateSort(collection: CollectionDef, sort: SortInput): ContentQueryError[];
85
+ /** Validate a limit: a positive integer (or absent = no pagination). */
86
+ export declare function validateLimit(limit: number): ContentQueryError[];
87
+ /**
88
+ * Reduce a stored field value to the scalar filters compare against: scalars
89
+ * pass through, relation refs compare by target id, anything else (arrays,
90
+ * rich objects, missing) is `null` and never matches a condition.
91
+ */
92
+ export declare function filterScalarOf(value: unknown): FilterScalar | null;
93
+ /**
94
+ * Does a stored field value satisfy one normalized condition? Scalars and single
95
+ * relation/asset refs reduce via {@link filterScalarOf} and match directly. An
96
+ * ARRAY field — a `many` relation/asset (EC-255) — matches with **contains**
97
+ * semantics: the condition holds if ANY element satisfies it, so
98
+ * `where: { categories: catId }` lists products whose `categories` array
99
+ * contains `catId`. An empty array matches nothing. Scalar fields keep their
100
+ * exact prior behavior (the non-array branch is the original reduce-then-match).
101
+ */
102
+ export declare function matchesFieldValue(value: unknown, condition: NormalizedCondition): boolean;
103
+ /** Does a (scalar-reduced) value satisfy one normalized condition? AND-only. */
104
+ export declare function matchesCondition(value: FilterScalar | null, condition: NormalizedCondition): boolean;
105
+ /**
106
+ * Total, deterministic order over sort values: numbers first (numeric order),
107
+ * then strings (code-unit order), then booleans (false < true), then missing
108
+ * values (`null`). `desc` flips this entire order; the id tiebreak stays
109
+ * ascending either way (see `compareListEntries`).
110
+ */
111
+ export declare function compareSortValues(a: FilterScalar | null, b: FilterScalar | null): number;
112
+ /** One row in list ordering: its id plus its (scalar-reduced) sort value. */
113
+ export interface ListPosition {
114
+ id: string;
115
+ sortValue: FilterScalar | null;
116
+ }
117
+ /**
118
+ * The canonical list order (and cursor position order): sort value in the
119
+ * requested direction, then id ascending as the unconditional tiebreak — so
120
+ * pagination is total, stable, and reproducible from fixtures.
121
+ */
122
+ export declare function compareListEntries(a: ListPosition, b: ListPosition, direction: SortDirection): number;
@@ -0,0 +1,257 @@
1
+ /**
2
+ * The closed v1 filter vocabulary (vision AD-3): equality, `in`, comparisons
3
+ * (lt/lte/gt/gte), AND-only composition. Multiple `where` keys AND together;
4
+ * multiple operators inside one condition AND together. There is no OR, no
5
+ * nesting, no anything else — by design, so every query is enumerable,
6
+ * cache-taggable, and honest about backend indexes.
7
+ */
8
+ export const FILTER_OPERATORS = ['eq', 'gt', 'gte', 'in', 'lt', 'lte'];
9
+ export function queryError(code, message, path, meta) {
10
+ return { code, message, path, ...(meta ? { meta } : {}) };
11
+ }
12
+ function isFilterScalar(value) {
13
+ return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
14
+ }
15
+ function isOperator(key) {
16
+ return FILTER_OPERATORS.includes(key);
17
+ }
18
+ /**
19
+ * Normalize a `where` input into entries sorted by field name, with the bare
20
+ * scalar shorthand expanded to `{ eq: value }` and operators in the stable
21
+ * `FILTER_OPERATORS` order. Both serialization and execution run on this
22
+ * normal form, so `{ slug: 'x' }` and `{ slug: { eq: 'x' } }` are the same
23
+ * query (and produce the same cache key).
24
+ */
25
+ export function normalizeWhere(where) {
26
+ const entries = [];
27
+ for (const field of Object.keys(where).sort()) {
28
+ const raw = where[field];
29
+ if (raw === undefined)
30
+ continue;
31
+ if (isFilterScalar(raw)) {
32
+ entries.push({ field, condition: { eq: raw } });
33
+ continue;
34
+ }
35
+ const condition = {};
36
+ for (const op of FILTER_OPERATORS) {
37
+ const value = raw[op];
38
+ if (value === undefined)
39
+ continue;
40
+ condition[op] = value;
41
+ }
42
+ entries.push({ field, condition });
43
+ }
44
+ return entries;
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // Validation (filterable-field enforcement, EC-143)
48
+ // ---------------------------------------------------------------------------
49
+ function fieldByName(collection, name) {
50
+ return collection.fields.find((f) => f.name === name);
51
+ }
52
+ /** The fields of a collection declared `filterable` (EC-143 schema flag). */
53
+ export function filterableFields(collection) {
54
+ return collection.fields.filter((f) => f.filterable === true);
55
+ }
56
+ /**
57
+ * Validate a `where` input against a collection schema. Filters are permitted
58
+ * **only** on fields declared `filterable` — anything else is a structured
59
+ * `non-filterable-field` error. Unknown operators and malformed operator
60
+ * values are `invalid-filter` errors. All errors are collected (sorted by
61
+ * field, deterministic), never thrown.
62
+ */
63
+ export function validateWhere(collection, where) {
64
+ const errors = [];
65
+ for (const field of Object.keys(where).sort()) {
66
+ const raw = where[field];
67
+ if (raw === undefined)
68
+ continue;
69
+ const path = ['where', field];
70
+ const def = fieldByName(collection, field);
71
+ if (!def || def.filterable !== true) {
72
+ errors.push(queryError('non-filterable-field', def
73
+ ? `Field "${field}" on "${collection.id}" is not declared filterable.`
74
+ : `Field "${field}" does not exist on "${collection.id}".`, path, { collection: collection.id, field }));
75
+ continue;
76
+ }
77
+ if (isFilterScalar(raw))
78
+ continue;
79
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
80
+ errors.push(queryError('invalid-filter', `Filter for "${field}" must be a scalar or an operator object.`, path));
81
+ continue;
82
+ }
83
+ const keys = Object.keys(raw).sort();
84
+ if (keys.length === 0) {
85
+ errors.push(queryError('invalid-filter', `Filter for "${field}" has no operators.`, path));
86
+ continue;
87
+ }
88
+ for (const key of keys) {
89
+ const value = raw[key];
90
+ if (value === undefined)
91
+ continue;
92
+ const opPath = ['where', field, key];
93
+ if (!isOperator(key)) {
94
+ errors.push(queryError('invalid-filter', `Unknown filter operator "${key}" on "${field}" — the vocabulary is exactly ${FILTER_OPERATORS.join(', ')}.`, opPath, { operator: key }));
95
+ continue;
96
+ }
97
+ if (key === 'in') {
98
+ if (!Array.isArray(value) || !value.every(isFilterScalar)) {
99
+ errors.push(queryError('invalid-filter', `Operator "in" on "${field}" requires an array of scalars.`, opPath));
100
+ }
101
+ continue;
102
+ }
103
+ if (!isFilterScalar(value)) {
104
+ errors.push(queryError('invalid-filter', `Operator "${key}" on "${field}" requires a scalar value.`, opPath));
105
+ }
106
+ }
107
+ }
108
+ return errors;
109
+ }
110
+ /**
111
+ * Validate a sort input. Sorting uses the same `filterable` declaration as
112
+ * filtering (same rationale: backend indexes stay honest).
113
+ */
114
+ export function validateSort(collection, sort) {
115
+ const def = fieldByName(collection, sort.field);
116
+ if (!def || def.filterable !== true) {
117
+ return [
118
+ queryError('invalid-sort', def
119
+ ? `Sort field "${sort.field}" on "${collection.id}" is not declared filterable.`
120
+ : `Sort field "${sort.field}" does not exist on "${collection.id}".`, ['sort', 'field'], { collection: collection.id, field: sort.field }),
121
+ ];
122
+ }
123
+ if (sort.direction !== undefined && sort.direction !== 'asc' && sort.direction !== 'desc') {
124
+ return [
125
+ queryError('invalid-sort', `Sort direction must be "asc" or "desc".`, ['sort', 'direction']),
126
+ ];
127
+ }
128
+ return [];
129
+ }
130
+ /** Validate a limit: a positive integer (or absent = no pagination). */
131
+ export function validateLimit(limit) {
132
+ if (!Number.isInteger(limit) || limit < 1) {
133
+ return [queryError('invalid-limit', 'Limit must be a positive integer.', ['limit'])];
134
+ }
135
+ return [];
136
+ }
137
+ // ---------------------------------------------------------------------------
138
+ // Matching & ordering (pure, deterministic)
139
+ // ---------------------------------------------------------------------------
140
+ /**
141
+ * Reduce a stored field value to the scalar filters compare against: scalars
142
+ * pass through, relation refs compare by target id, anything else (arrays,
143
+ * rich objects, missing) is `null` and never matches a condition.
144
+ */
145
+ export function filterScalarOf(value) {
146
+ if (isFilterScalar(value))
147
+ return value;
148
+ if (value !== null &&
149
+ typeof value === 'object' &&
150
+ !Array.isArray(value) &&
151
+ typeof value.id === 'string') {
152
+ return value.id;
153
+ }
154
+ return null;
155
+ }
156
+ /**
157
+ * Three-way compare, or `null` when the values are uncomparable: an UNSET field
158
+ * (`value === null`) or a type mismatch. Callers treat `null` as "does not
159
+ * match", so an unset field is EXCLUDED from every comparison operator — unset
160
+ * never satisfies a value comparison (EC-205). Pinned by query.test.ts.
161
+ */
162
+ function compares(value, bound) {
163
+ if (value === null)
164
+ return null;
165
+ if (typeof value === 'number' && typeof bound === 'number') {
166
+ return value < bound ? -1 : value > bound ? 1 : 0;
167
+ }
168
+ if (typeof value === 'string' && typeof bound === 'string') {
169
+ // Code-unit comparison: deterministic across environments (no locale tables).
170
+ return value < bound ? -1 : value > bound ? 1 : 0;
171
+ }
172
+ return null;
173
+ }
174
+ /**
175
+ * Does a stored field value satisfy one normalized condition? Scalars and single
176
+ * relation/asset refs reduce via {@link filterScalarOf} and match directly. An
177
+ * ARRAY field — a `many` relation/asset (EC-255) — matches with **contains**
178
+ * semantics: the condition holds if ANY element satisfies it, so
179
+ * `where: { categories: catId }` lists products whose `categories` array
180
+ * contains `catId`. An empty array matches nothing. Scalar fields keep their
181
+ * exact prior behavior (the non-array branch is the original reduce-then-match).
182
+ */
183
+ export function matchesFieldValue(value, condition) {
184
+ if (Array.isArray(value)) {
185
+ return value.some((element) => matchesCondition(filterScalarOf(element), condition));
186
+ }
187
+ return matchesCondition(filterScalarOf(value), condition);
188
+ }
189
+ /** Does a (scalar-reduced) value satisfy one normalized condition? AND-only. */
190
+ export function matchesCondition(value, condition) {
191
+ for (const op of FILTER_OPERATORS) {
192
+ const bound = condition[op];
193
+ if (bound === undefined)
194
+ continue;
195
+ switch (op) {
196
+ case 'eq':
197
+ if (value !== bound)
198
+ return false;
199
+ break;
200
+ case 'in':
201
+ if (value === null || !bound.includes(value))
202
+ return false;
203
+ break;
204
+ case 'lt':
205
+ case 'lte':
206
+ case 'gt':
207
+ case 'gte': {
208
+ const cmp = compares(value, bound);
209
+ if (cmp === null)
210
+ return false;
211
+ if (op === 'lt' && !(cmp < 0))
212
+ return false;
213
+ if (op === 'lte' && !(cmp <= 0))
214
+ return false;
215
+ if (op === 'gt' && !(cmp > 0))
216
+ return false;
217
+ if (op === 'gte' && !(cmp >= 0))
218
+ return false;
219
+ break;
220
+ }
221
+ }
222
+ }
223
+ return true;
224
+ }
225
+ /**
226
+ * Total, deterministic order over sort values: numbers first (numeric order),
227
+ * then strings (code-unit order), then booleans (false < true), then missing
228
+ * values (`null`). `desc` flips this entire order; the id tiebreak stays
229
+ * ascending either way (see `compareListEntries`).
230
+ */
231
+ export function compareSortValues(a, b) {
232
+ const rank = (v) => typeof v === 'number' ? 0 : typeof v === 'string' ? 1 : typeof v === 'boolean' ? 2 : 3;
233
+ const ra = rank(a);
234
+ const rb = rank(b);
235
+ if (ra !== rb)
236
+ return ra - rb;
237
+ if (typeof a === 'number' && typeof b === 'number')
238
+ return a < b ? -1 : a > b ? 1 : 0;
239
+ if (typeof a === 'string' && typeof b === 'string')
240
+ return a < b ? -1 : a > b ? 1 : 0;
241
+ if (typeof a === 'boolean' && typeof b === 'boolean')
242
+ return a === b ? 0 : a ? 1 : -1;
243
+ return 0;
244
+ }
245
+ /**
246
+ * The canonical list order (and cursor position order): sort value in the
247
+ * requested direction, then id ascending as the unconditional tiebreak — so
248
+ * pagination is total, stable, and reproducible from fixtures.
249
+ */
250
+ export function compareListEntries(a, b, direction) {
251
+ const byValue = compareSortValues(a.sortValue, b.sortValue);
252
+ const directed = direction === 'desc' ? -byValue : byValue;
253
+ if (directed !== 0)
254
+ return directed;
255
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
256
+ }
257
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/content/query.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAA;AAkE/E,MAAM,UAAU,UAAU,CACxB,IAA2B,EAC3B,OAAe,EACf,IAAa,EACb,IAA8B;IAE9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AAC3D,CAAC;AAgBD,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,CAAA;AAC7F,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAQ,gBAAsC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,MAAM,OAAO,GAA2B,EAAE,CAAA;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,C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,OAAO,QAAQ,CAAA;IACnC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { CmsDocument } from '@elytracms/core/cms-core';
2
+ import type { ContentContext } from './context';
3
+ import type { ContentDocumentSource } from './perspective';
4
+ /**
5
+ * Escape hatch (vision AD-4, `content.raw`): the stored row, untouched — no
6
+ * locale fallback, no relation population, no asset resolution. Relations stay
7
+ * `DocumentRef`s, assets stay ids, localized values stay per-locale bags.
8
+ *
9
+ * Perspective still applies: even raw access never leaks draft content into
10
+ * the published perspective. Returns `null` when the document is not visible
11
+ * under the context perspective.
12
+ */
13
+ export declare function rawDocument(context: ContentContext, source: ContentDocumentSource): CmsDocument | null;
@@ -0,0 +1,14 @@
1
+ import { selectPerspective } from './perspective';
2
+ /**
3
+ * Escape hatch (vision AD-4, `content.raw`): the stored row, untouched — no
4
+ * locale fallback, no relation population, no asset resolution. Relations stay
5
+ * `DocumentRef`s, assets stay ids, localized values stay per-locale bags.
6
+ *
7
+ * Perspective still applies: even raw access never leaks draft content into
8
+ * the published perspective. Returns `null` when the document is not visible
9
+ * under the context perspective.
10
+ */
11
+ export function rawDocument(context, source) {
12
+ return selectPerspective(context, source);
13
+ }
14
+ //# sourceMappingURL=raw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw.js","sourceRoot":"","sources":["../../src/content/raw.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,OAAuB,EACvB,MAA6B;IAE7B,OAAO,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,97 @@
1
+ import type { CmsValidationIssue, CollectionDef, DocumentRef, Locale } from '@elytracms/core/cms-core';
2
+ import type { AssetLookup } from './assets';
3
+ import type { ContentContext, Perspective } from './context';
4
+ import type { FieldLocaleFallback } from './locale';
5
+ import type { ContentDocumentSource } from './perspective';
6
+ /**
7
+ * Pure lookup boundary for delivery resolution (vision AD-4): the caller
8
+ * (content kit, export, tests) pre-fetches schema, documents, and asset
9
+ * metadata; resolution only reads through these synchronous functions. No
10
+ * fetching, no Convex, no React at this layer.
11
+ */
12
+ export interface ContentLookup extends AssetLookup {
13
+ collection(id: string): CollectionDef | undefined;
14
+ document(ref: DocumentRef): ContentDocumentSource | undefined;
15
+ /**
16
+ * All document sources of a collection (EC-143, additive). Required by
17
+ * `listDocuments` and by `getDocument`'s slug fallback; a lookup without it
18
+ * still supports plain resolution, and `listDocuments` degrades to a
19
+ * structured `list-not-supported` error.
20
+ */
21
+ documents?(collectionId: string): readonly ContentDocumentSource[];
22
+ }
23
+ /**
24
+ * A document in delivery shape: identity plus resolved field values, flat —
25
+ * `post.title`, `post.author.name`, `post.cover.url`. The precise per-collection
26
+ * shape is what `generateDeliveryTypes` emits (EC-142 codegen).
27
+ */
28
+ export type ResolvedDocument = {
29
+ id: string;
30
+ collection: string;
31
+ } & Record<string, unknown>;
32
+ /**
33
+ * The minimal structural face of any delivery-shaped document — what the typed
34
+ * accessors (EC-143) constrain their per-collection generics against. The
35
+ * generated interfaces from `generateDeliveryTypes` (e.g. `Post`) satisfy this
36
+ * where they cannot satisfy `ResolvedDocument`'s index signature.
37
+ */
38
+ export interface DeliveryDocument {
39
+ id: string;
40
+ collection: string;
41
+ }
42
+ /**
43
+ * Structured information about *how* a document was resolved — most notably
44
+ * which fields served their value via EC-018 locale fallback.
45
+ */
46
+ export interface ResolutionInfo {
47
+ locale: Locale;
48
+ perspective: Perspective;
49
+ localeFallbacks: FieldLocaleFallback[];
50
+ }
51
+ export interface ResolveDocumentResult {
52
+ /**
53
+ * The delivery-shaped document, or `null` when the source is not visible in
54
+ * the context perspective (e.g. never published) or its collection is
55
+ * unknown. `null` plus an empty issue list simply means "not available
56
+ * here" — unpublished content in the published perspective is correct
57
+ * behavior, not an error.
58
+ */
59
+ document: ResolvedDocument | null;
60
+ info: ResolutionInfo;
61
+ issues: CmsValidationIssue[];
62
+ }
63
+ /**
64
+ * Resolve one document source into delivery shape (vision AD-4): locale
65
+ * fallback applied (EC-018), draft/published perspective applied (EC-021),
66
+ * relations populated to depth-1 as declared in schema, and assets resolved to
67
+ * `{ url, width, height, alt, mimeType }` objects. Pure and total: invalid
68
+ * states surface as structured issues alongside the result — never thrown.
69
+ */
70
+ export declare function resolveDocument(context: ContentContext, lookup: ContentLookup, source: ContentDocumentSource): ResolveDocumentResult;
71
+ /** Result of populating a single relation reference (EC-254). */
72
+ export interface PopulateRelationResult {
73
+ /**
74
+ * The relation target populated to depth-1 delivery shape (`{ id, collection,
75
+ * ...fields }`), or `null` when the target's collection is unknown, the
76
+ * document is missing, or it is not visible in the context perspective — so a
77
+ * consuming block degrades cleanly rather than rendering a stub.
78
+ */
79
+ document: ResolvedDocument | null;
80
+ issues: CmsValidationIssue[];
81
+ }
82
+ /**
83
+ * Populate a single relation reference to depth-1 delivery shape — the public
84
+ * entry a renderer host wires as `RenderContext.resolveRelation` to populate a
85
+ * COMPOSITION-NODE relation PROP (EC-254). This is distinct from a document
86
+ * FIELD relation, which {@link resolveDocument} already populates inline via the
87
+ * internal `resolveRelationTarget`: a page's `blocks` field passes through as raw
88
+ * composition, so the relation props of the nodes inside it (e.g. a ProductGrid's
89
+ * picked `product`s) are never touched by document resolution and need this.
90
+ *
91
+ * Mirrors `resolveRelationTarget`'s populated branch exactly — perspective gated
92
+ * (EC-021), relations inside the target stay stubs (depth-1), assets inside it
93
+ * resolve to objects — but returns `null` (not the `{ id, collection }` stub) on
94
+ * a miss, the cleaner "populated or nothing" contract a prop wants. Pure and
95
+ * total: never throws; the reason for a miss is collected as a structured issue.
96
+ */
97
+ export declare function populateRelationRef(context: ContentContext, lookup: ContentLookup, ref: DocumentRef): PopulateRelationResult;