@orthacms/content-server 0.0.0-reserve.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/dist/define.d.ts +17 -0
  4. package/dist/define.d.ts.map +1 -0
  5. package/dist/define.js +28 -0
  6. package/dist/index.d.ts +48 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +109 -0
  9. package/dist/lib/collection/define.d.ts +35 -0
  10. package/dist/lib/collection/define.d.ts.map +1 -0
  11. package/dist/lib/collection/define.js +217 -0
  12. package/dist/lib/collection/table-builder.d.ts +28 -0
  13. package/dist/lib/collection/table-builder.d.ts.map +1 -0
  14. package/dist/lib/collection/table-builder.js +306 -0
  15. package/dist/lib/content-types/controllers/get-content-schema.controller.d.ts +24 -0
  16. package/dist/lib/content-types/controllers/get-content-schema.controller.d.ts.map +1 -0
  17. package/dist/lib/content-types/controllers/get-content-schema.controller.js +58 -0
  18. package/dist/lib/content-types/controllers/get-filter-fields.controller.d.ts +35 -0
  19. package/dist/lib/content-types/controllers/get-filter-fields.controller.d.ts.map +1 -0
  20. package/dist/lib/content-types/controllers/get-filter-fields.controller.js +74 -0
  21. package/dist/lib/content-types/controllers/list-content-schema.controller.d.ts +15 -0
  22. package/dist/lib/content-types/controllers/list-content-schema.controller.d.ts.map +1 -0
  23. package/dist/lib/content-types/controllers/list-content-schema.controller.js +38 -0
  24. package/dist/lib/content-types/queries/workspace-grants.query.d.ts +25 -0
  25. package/dist/lib/content-types/queries/workspace-grants.query.d.ts.map +1 -0
  26. package/dist/lib/content-types/queries/workspace-grants.query.js +45 -0
  27. package/dist/lib/content.module.d.ts +21 -0
  28. package/dist/lib/content.module.d.ts.map +1 -0
  29. package/dist/lib/content.module.js +264 -0
  30. package/dist/lib/content.tokens.d.ts +5 -0
  31. package/dist/lib/content.tokens.d.ts.map +1 -0
  32. package/dist/lib/content.tokens.js +9 -0
  33. package/dist/lib/copilot/content-tool.provider.d.ts +64 -0
  34. package/dist/lib/copilot/content-tool.provider.d.ts.map +1 -0
  35. package/dist/lib/copilot/content-tool.provider.js +309 -0
  36. package/dist/lib/copilot/diff-snapshots.d.ts +42 -0
  37. package/dist/lib/copilot/diff-snapshots.d.ts.map +1 -0
  38. package/dist/lib/copilot/diff-snapshots.js +77 -0
  39. package/dist/lib/copilot/entry-proposal.applier.d.ts +89 -0
  40. package/dist/lib/copilot/entry-proposal.applier.d.ts.map +1 -0
  41. package/dist/lib/copilot/entry-proposal.applier.js +245 -0
  42. package/dist/lib/copilot/entry-proposal.provider.d.ts +157 -0
  43. package/dist/lib/copilot/entry-proposal.provider.d.ts.map +1 -0
  44. package/dist/lib/copilot/entry-proposal.provider.js +619 -0
  45. package/dist/lib/copilot/filter-schema.d.ts +61 -0
  46. package/dist/lib/copilot/filter-schema.d.ts.map +1 -0
  47. package/dist/lib/copilot/filter-schema.js +139 -0
  48. package/dist/lib/copilot/project-entry.d.ts +23 -0
  49. package/dist/lib/copilot/project-entry.d.ts.map +1 -0
  50. package/dist/lib/copilot/project-entry.js +36 -0
  51. package/dist/lib/copilot/proposal-kinds.d.ts +30 -0
  52. package/dist/lib/copilot/proposal-kinds.d.ts.map +1 -0
  53. package/dist/lib/copilot/proposal-kinds.js +32 -0
  54. package/dist/lib/copilot/revision-tool.provider.d.ts +56 -0
  55. package/dist/lib/copilot/revision-tool.provider.d.ts.map +1 -0
  56. package/dist/lib/copilot/revision-tool.provider.js +215 -0
  57. package/dist/lib/docs/content-schemas.d.ts +34 -0
  58. package/dist/lib/docs/content-schemas.d.ts.map +1 -0
  59. package/dist/lib/docs/content-schemas.js +617 -0
  60. package/dist/lib/docs/describe-content-api.d.ts +22 -0
  61. package/dist/lib/docs/describe-content-api.d.ts.map +1 -0
  62. package/dist/lib/docs/describe-content-api.js +173 -0
  63. package/dist/lib/docs/field-schema.d.ts +28 -0
  64. package/dist/lib/docs/field-schema.d.ts.map +1 -0
  65. package/dist/lib/docs/field-schema.js +214 -0
  66. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts +23 -0
  67. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts.map +1 -0
  68. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.js +77 -0
  69. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts +23 -0
  70. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts.map +1 -0
  71. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.js +66 -0
  72. package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts +43 -0
  73. package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts.map +1 -0
  74. package/dist/lib/entries/application/use-cases/publish-entry.use-case.js +106 -0
  75. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts +30 -0
  76. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts.map +1 -0
  77. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.js +70 -0
  78. package/dist/lib/entries/controllers/bulk-entries.controller.d.ts +26 -0
  79. package/dist/lib/entries/controllers/bulk-entries.controller.d.ts.map +1 -0
  80. package/dist/lib/entries/controllers/create-entry.controller.d.ts +20 -0
  81. package/dist/lib/entries/controllers/create-entry.controller.d.ts.map +1 -0
  82. package/dist/lib/entries/controllers/delete-entry.controller.d.ts +24 -0
  83. package/dist/lib/entries/controllers/delete-entry.controller.d.ts.map +1 -0
  84. package/dist/lib/entries/controllers/get-entry.controller.d.ts +34 -0
  85. package/dist/lib/entries/controllers/get-entry.controller.d.ts.map +1 -0
  86. package/dist/lib/entries/controllers/list-entries.controller.d.ts +20 -0
  87. package/dist/lib/entries/controllers/list-entries.controller.d.ts.map +1 -0
  88. package/dist/lib/entries/controllers/publish-entry.controller.d.ts +19 -0
  89. package/dist/lib/entries/controllers/publish-entry.controller.d.ts.map +1 -0
  90. package/dist/lib/entries/controllers/resolve-type.d.ts +9 -0
  91. package/dist/lib/entries/controllers/resolve-type.d.ts.map +1 -0
  92. package/dist/lib/entries/controllers/update-entry.controller.d.ts +18 -0
  93. package/dist/lib/entries/controllers/update-entry.controller.d.ts.map +1 -0
  94. package/dist/lib/entries/domain/entry-publish-blocked.error.d.ts +13 -0
  95. package/dist/lib/entries/domain/entry-publish-blocked.error.d.ts.map +1 -0
  96. package/dist/lib/entries/domain/entry-publish-blocked.error.js +19 -0
  97. package/dist/lib/entries/domain/entry.d.ts +71 -0
  98. package/dist/lib/entries/domain/entry.d.ts.map +1 -0
  99. package/dist/lib/entries/domain/entry.js +90 -0
  100. package/dist/lib/entries/domain/events/entry-events.d.ts +67 -0
  101. package/dist/lib/entries/domain/events/entry-events.d.ts.map +1 -0
  102. package/dist/lib/entries/domain/events/entry-events.js +100 -0
  103. package/dist/lib/entries/dto/bulk-ids.dto.d.ts +11 -0
  104. package/dist/lib/entries/dto/bulk-ids.dto.d.ts.map +1 -0
  105. package/dist/lib/entries/dto/list-entries-query.dto.d.ts +46 -0
  106. package/dist/lib/entries/dto/list-entries-query.dto.d.ts.map +1 -0
  107. package/dist/lib/entries/dto/relation-delta-map.validator.d.ts +19 -0
  108. package/dist/lib/entries/dto/relation-delta-map.validator.d.ts.map +1 -0
  109. package/dist/lib/entries/dto/save-entry.dto.d.ts +46 -0
  110. package/dist/lib/entries/dto/save-entry.dto.d.ts.map +1 -0
  111. package/dist/lib/entries/entries.constants.d.ts +19 -0
  112. package/dist/lib/entries/entries.constants.d.ts.map +1 -0
  113. package/dist/lib/entries/entries.constants.js +21 -0
  114. package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts +33 -0
  115. package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts.map +1 -0
  116. package/dist/lib/entries/http/controllers/bulk-entries.controller.js +143 -0
  117. package/dist/lib/entries/http/controllers/create-entry.controller.d.ts +21 -0
  118. package/dist/lib/entries/http/controllers/create-entry.controller.d.ts.map +1 -0
  119. package/dist/lib/entries/http/controllers/create-entry.controller.js +52 -0
  120. package/dist/lib/entries/http/controllers/delete-entry.controller.d.ts +25 -0
  121. package/dist/lib/entries/http/controllers/delete-entry.controller.d.ts.map +1 -0
  122. package/dist/lib/entries/http/controllers/delete-entry.controller.js +84 -0
  123. package/dist/lib/entries/http/controllers/get-entry.controller.d.ts +44 -0
  124. package/dist/lib/entries/http/controllers/get-entry.controller.d.ts.map +1 -0
  125. package/dist/lib/entries/http/controllers/get-entry.controller.js +124 -0
  126. package/dist/lib/entries/http/controllers/list-entries.controller.d.ts +20 -0
  127. package/dist/lib/entries/http/controllers/list-entries.controller.d.ts.map +1 -0
  128. package/dist/lib/entries/http/controllers/list-entries.controller.js +52 -0
  129. package/dist/lib/entries/http/controllers/publish-entry.controller.d.ts +22 -0
  130. package/dist/lib/entries/http/controllers/publish-entry.controller.d.ts.map +1 -0
  131. package/dist/lib/entries/http/controllers/publish-entry.controller.js +68 -0
  132. package/dist/lib/entries/http/controllers/resolve-type.d.ts +9 -0
  133. package/dist/lib/entries/http/controllers/resolve-type.d.ts.map +1 -0
  134. package/dist/lib/entries/http/controllers/resolve-type.js +16 -0
  135. package/dist/lib/entries/http/controllers/to-actor.d.ts +13 -0
  136. package/dist/lib/entries/http/controllers/to-actor.d.ts.map +1 -0
  137. package/dist/lib/entries/http/controllers/to-actor.js +15 -0
  138. package/dist/lib/entries/http/controllers/update-entry.controller.d.ts +19 -0
  139. package/dist/lib/entries/http/controllers/update-entry.controller.d.ts.map +1 -0
  140. package/dist/lib/entries/http/controllers/update-entry.controller.js +51 -0
  141. package/dist/lib/entries/http/dto/bulk-ids.dto.d.ts +11 -0
  142. package/dist/lib/entries/http/dto/bulk-ids.dto.d.ts.map +1 -0
  143. package/dist/lib/entries/http/dto/bulk-ids.dto.js +33 -0
  144. package/dist/lib/entries/http/dto/list-entries-query.dto.d.ts +66 -0
  145. package/dist/lib/entries/http/dto/list-entries-query.dto.d.ts.map +1 -0
  146. package/dist/lib/entries/http/dto/list-entries-query.dto.js +192 -0
  147. package/dist/lib/entries/http/dto/relation-delta-map.validator.d.ts +30 -0
  148. package/dist/lib/entries/http/dto/relation-delta-map.validator.d.ts.map +1 -0
  149. package/dist/lib/entries/http/dto/relation-delta-map.validator.js +102 -0
  150. package/dist/lib/entries/http/dto/save-entry.dto.d.ts +48 -0
  151. package/dist/lib/entries/http/dto/save-entry.dto.d.ts.map +1 -0
  152. package/dist/lib/entries/http/dto/save-entry.dto.js +120 -0
  153. package/dist/lib/entries/http/guards/content-grant.guard.d.ts +37 -0
  154. package/dist/lib/entries/http/guards/content-grant.guard.d.ts.map +1 -0
  155. package/dist/lib/entries/http/guards/content-grant.guard.js +67 -0
  156. package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.d.ts +22 -0
  157. package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.d.ts.map +1 -0
  158. package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.js +81 -0
  159. package/dist/lib/entries/infrastructure/persistence/entry-counter.service.d.ts +42 -0
  160. package/dist/lib/entries/infrastructure/persistence/entry-counter.service.d.ts.map +1 -0
  161. package/dist/lib/entries/infrastructure/persistence/entry-counter.service.js +73 -0
  162. package/dist/lib/entries/infrastructure/persistence/entry-row.d.ts +56 -0
  163. package/dist/lib/entries/infrastructure/persistence/entry-row.d.ts.map +1 -0
  164. package/dist/lib/entries/infrastructure/persistence/entry-row.js +185 -0
  165. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts +392 -0
  166. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts.map +1 -0
  167. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.js +1223 -0
  168. package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts +24 -0
  169. package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts.map +1 -0
  170. package/dist/lib/entries/infrastructure/persistence/media-accept.d.ts +23 -0
  171. package/dist/lib/entries/infrastructure/persistence/media-accept.d.ts.map +1 -0
  172. package/dist/lib/entries/infrastructure/persistence/media-accept.js +55 -0
  173. package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts +327 -0
  174. package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts.map +1 -0
  175. package/dist/lib/entries/infrastructure/persistence/relation-link.service.js +1008 -0
  176. package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.d.ts +19 -0
  177. package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.d.ts.map +1 -0
  178. package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.js +39 -0
  179. package/dist/lib/entries/infrastructure/queries/entries.service.d.ts +64 -0
  180. package/dist/lib/entries/infrastructure/queries/entries.service.d.ts.map +1 -0
  181. package/dist/lib/entries/infrastructure/queries/entries.service.js +202 -0
  182. package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts +40 -0
  183. package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts.map +1 -0
  184. package/dist/lib/entries/infrastructure/queries/entry-filter-surface.d.ts +38 -0
  185. package/dist/lib/entries/infrastructure/queries/entry-filter-surface.d.ts.map +1 -0
  186. package/dist/lib/entries/infrastructure/queries/entry-filter-surface.js +310 -0
  187. package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.d.ts +25 -0
  188. package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.d.ts.map +1 -0
  189. package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.js +51 -0
  190. package/dist/lib/entries/infrastructure/queries/entry-search.d.ts +19 -0
  191. package/dist/lib/entries/infrastructure/queries/entry-search.d.ts.map +1 -0
  192. package/dist/lib/entries/infrastructure/queries/entry-search.js +52 -0
  193. package/dist/lib/entries/infrastructure/queries/media-refs.query.d.ts +21 -0
  194. package/dist/lib/entries/infrastructure/queries/media-refs.query.d.ts.map +1 -0
  195. package/dist/lib/entries/infrastructure/queries/media-refs.query.js +117 -0
  196. package/dist/lib/entries/services/entries.service.d.ts +59 -0
  197. package/dist/lib/entries/services/entries.service.d.ts.map +1 -0
  198. package/dist/lib/entries/services/entry-counter.service.d.ts +31 -0
  199. package/dist/lib/entries/services/entry-counter.service.d.ts.map +1 -0
  200. package/dist/lib/entries/services/entry-filter-schema.d.ts +32 -0
  201. package/dist/lib/entries/services/entry-filter-schema.d.ts.map +1 -0
  202. package/dist/lib/entries/services/entry-row.d.ts +56 -0
  203. package/dist/lib/entries/services/entry-row.d.ts.map +1 -0
  204. package/dist/lib/entries/services/entry-writer.service.d.ts +193 -0
  205. package/dist/lib/entries/services/entry-writer.service.d.ts.map +1 -0
  206. package/dist/lib/entries/services/relation-link.service.d.ts +115 -0
  207. package/dist/lib/entries/services/relation-link.service.d.ts.map +1 -0
  208. package/dist/lib/entries/types/bulk-publish.d.ts +75 -0
  209. package/dist/lib/entries/types/bulk-publish.d.ts.map +1 -0
  210. package/dist/lib/entries/types/bulk-publish.js +22 -0
  211. package/dist/lib/entries/types/entry-list-view.d.ts +205 -0
  212. package/dist/lib/entries/types/entry-list-view.d.ts.map +1 -0
  213. package/dist/lib/entries/types/entry-list-view.js +5 -0
  214. package/dist/lib/entries/types/filter-surface.d.ts +35 -0
  215. package/dist/lib/entries/types/filter-surface.d.ts.map +1 -0
  216. package/dist/lib/entries/types/filter-surface.js +2 -0
  217. package/dist/lib/extension/entry-extension-boot-check.d.ts +16 -0
  218. package/dist/lib/extension/entry-extension-boot-check.d.ts.map +1 -0
  219. package/dist/lib/extension/entry-extension-boot-check.js +42 -0
  220. package/dist/lib/extension/entry-extension.d.ts +225 -0
  221. package/dist/lib/extension/entry-extension.d.ts.map +1 -0
  222. package/dist/lib/extension/entry-extension.js +27 -0
  223. package/dist/lib/extension/media-asset-resolver.d.ts +85 -0
  224. package/dist/lib/extension/media-asset-resolver.d.ts.map +1 -0
  225. package/dist/lib/extension/media-asset-resolver.js +26 -0
  226. package/dist/lib/extension/per-locale-relation.d.ts +18 -0
  227. package/dist/lib/extension/per-locale-relation.d.ts.map +1 -0
  228. package/dist/lib/extension/relation-locale-sync.d.ts +62 -0
  229. package/dist/lib/extension/relation-locale-sync.d.ts.map +1 -0
  230. package/dist/lib/extension/relation-locale-sync.js +88 -0
  231. package/dist/lib/fields/index.d.ts +94 -0
  232. package/dist/lib/fields/index.d.ts.map +1 -0
  233. package/dist/lib/fields/index.js +203 -0
  234. package/dist/lib/insights/http/controllers/content-pipeline.controller.d.ts +16 -0
  235. package/dist/lib/insights/http/controllers/content-pipeline.controller.d.ts.map +1 -0
  236. package/dist/lib/insights/http/controllers/content-pipeline.controller.js +39 -0
  237. package/dist/lib/insights/http/controllers/content-punchcard.controller.d.ts +18 -0
  238. package/dist/lib/insights/http/controllers/content-punchcard.controller.d.ts.map +1 -0
  239. package/dist/lib/insights/http/controllers/content-punchcard.controller.js +42 -0
  240. package/dist/lib/insights/http/controllers/content-stale.controller.d.ts +17 -0
  241. package/dist/lib/insights/http/controllers/content-stale.controller.d.ts.map +1 -0
  242. package/dist/lib/insights/http/controllers/content-stale.controller.js +40 -0
  243. package/dist/lib/insights/http/controllers/content-totals.controller.d.ts +18 -0
  244. package/dist/lib/insights/http/controllers/content-totals.controller.d.ts.map +1 -0
  245. package/dist/lib/insights/http/controllers/content-totals.controller.js +42 -0
  246. package/dist/lib/insights/http/controllers/content-unshipped.controller.d.ts +17 -0
  247. package/dist/lib/insights/http/controllers/content-unshipped.controller.d.ts.map +1 -0
  248. package/dist/lib/insights/http/controllers/content-unshipped.controller.js +40 -0
  249. package/dist/lib/insights/http/controllers/content-velocity.controller.d.ts +17 -0
  250. package/dist/lib/insights/http/controllers/content-velocity.controller.d.ts.map +1 -0
  251. package/dist/lib/insights/http/controllers/content-velocity.controller.js +41 -0
  252. package/dist/lib/insights/http/dto/insights-range-query.dto.d.ts +15 -0
  253. package/dist/lib/insights/http/dto/insights-range-query.dto.d.ts.map +1 -0
  254. package/dist/lib/insights/http/dto/insights-range-query.dto.js +38 -0
  255. package/dist/lib/insights/infrastructure/queries/content-insights.query.d.ts +77 -0
  256. package/dist/lib/insights/infrastructure/queries/content-insights.query.d.ts.map +1 -0
  257. package/dist/lib/insights/infrastructure/queries/content-insights.query.js +380 -0
  258. package/dist/lib/insights/types/content-insights-view.d.ts +134 -0
  259. package/dist/lib/insights/types/content-insights-view.d.ts.map +1 -0
  260. package/dist/lib/insights/types/content-insights-view.js +10 -0
  261. package/dist/lib/mcp/content-tools.provider.d.ts +83 -0
  262. package/dist/lib/mcp/content-tools.provider.d.ts.map +1 -0
  263. package/dist/lib/mcp/content-tools.provider.js +441 -0
  264. package/dist/lib/mcp/tool-input.d.ts +43 -0
  265. package/dist/lib/mcp/tool-input.d.ts.map +1 -0
  266. package/dist/lib/mcp/tool-input.js +117 -0
  267. package/dist/lib/mcp/tool-schemas.d.ts +34 -0
  268. package/dist/lib/mcp/tool-schemas.d.ts.map +1 -0
  269. package/dist/lib/mcp/tool-schemas.js +282 -0
  270. package/dist/lib/public/controllers/get-public-entry.controller.d.ts +26 -0
  271. package/dist/lib/public/controllers/get-public-entry.controller.d.ts.map +1 -0
  272. package/dist/lib/public/controllers/list-public-entries.controller.d.ts +24 -0
  273. package/dist/lib/public/controllers/list-public-entries.controller.d.ts.map +1 -0
  274. package/dist/lib/public/controllers/public-schema.controller.d.ts +18 -0
  275. package/dist/lib/public/controllers/public-schema.controller.d.ts.map +1 -0
  276. package/dist/lib/public-api/http/api-token-request.d.ts +41 -0
  277. package/dist/lib/public-api/http/api-token-request.d.ts.map +1 -0
  278. package/dist/lib/public-api/http/api-token-request.js +2 -0
  279. package/dist/lib/public-api/http/controllers/public-content-types.controller.d.ts +31 -0
  280. package/dist/lib/public-api/http/controllers/public-content-types.controller.d.ts.map +1 -0
  281. package/dist/lib/public-api/http/controllers/public-content-types.controller.js +93 -0
  282. package/dist/lib/public-api/http/controllers/public-entries.controller.d.ts +101 -0
  283. package/dist/lib/public-api/http/controllers/public-entries.controller.d.ts.map +1 -0
  284. package/dist/lib/public-api/http/controllers/public-entries.controller.js +307 -0
  285. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts +76 -0
  286. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts.map +1 -0
  287. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.js +353 -0
  288. package/dist/lib/public-api/http/controllers/resolve-granted-type.d.ts +42 -0
  289. package/dist/lib/public-api/http/controllers/resolve-granted-type.d.ts.map +1 -0
  290. package/dist/lib/public-api/http/controllers/resolve-granted-type.js +25 -0
  291. package/dist/lib/public-api/http/decorators/current-api-token.decorator.d.ts +8 -0
  292. package/dist/lib/public-api/http/decorators/current-api-token.decorator.d.ts.map +1 -0
  293. package/dist/lib/public-api/http/decorators/current-api-token.decorator.js +17 -0
  294. package/dist/lib/public-api/http/dto/public-bulk.dto.d.ts +58 -0
  295. package/dist/lib/public-api/http/dto/public-bulk.dto.d.ts.map +1 -0
  296. package/dist/lib/public-api/http/dto/public-bulk.dto.js +118 -0
  297. package/dist/lib/public-api/http/dto/public-list-entries-query.dto.d.ts +106 -0
  298. package/dist/lib/public-api/http/dto/public-list-entries-query.dto.d.ts.map +1 -0
  299. package/dist/lib/public-api/http/dto/public-list-entries-query.dto.js +297 -0
  300. package/dist/lib/public-api/http/dto/public-save-entry.dto.d.ts +39 -0
  301. package/dist/lib/public-api/http/dto/public-save-entry.dto.d.ts.map +1 -0
  302. package/dist/lib/public-api/http/dto/public-save-entry.dto.js +112 -0
  303. package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts +25 -0
  304. package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts.map +1 -0
  305. package/dist/lib/public-api/http/guards/api-token-workspace.guard.js +58 -0
  306. package/dist/lib/public-api/http/guards/api-token.guard.d.ts +32 -0
  307. package/dist/lib/public-api/http/guards/api-token.guard.d.ts.map +1 -0
  308. package/dist/lib/public-api/http/guards/api-token.guard.js +92 -0
  309. package/dist/lib/public-api/http/guards/draft-visibility.guard.d.ts +25 -0
  310. package/dist/lib/public-api/http/guards/draft-visibility.guard.d.ts.map +1 -0
  311. package/dist/lib/public-api/http/guards/draft-visibility.guard.js +56 -0
  312. package/dist/lib/public-api/infrastructure/bulk-save-op.d.ts +55 -0
  313. package/dist/lib/public-api/infrastructure/bulk-save-op.d.ts.map +1 -0
  314. package/dist/lib/public-api/infrastructure/bulk-save-op.js +61 -0
  315. package/dist/lib/public-api/infrastructure/field-selection.d.ts +21 -0
  316. package/dist/lib/public-api/infrastructure/field-selection.d.ts.map +1 -0
  317. package/dist/lib/public-api/infrastructure/field-selection.js +72 -0
  318. package/dist/lib/public-api/infrastructure/public-entries.query.d.ts +248 -0
  319. package/dist/lib/public-api/infrastructure/public-entries.query.d.ts.map +1 -0
  320. package/dist/lib/public-api/infrastructure/public-entries.query.js +557 -0
  321. package/dist/lib/public-api/infrastructure/public-entry-row.d.ts +31 -0
  322. package/dist/lib/public-api/infrastructure/public-entry-row.d.ts.map +1 -0
  323. package/dist/lib/public-api/infrastructure/public-entry-row.js +76 -0
  324. package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts +188 -0
  325. package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts.map +1 -0
  326. package/dist/lib/public-api/infrastructure/public-entry-writes.service.js +321 -0
  327. package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts +98 -0
  328. package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts.map +1 -0
  329. package/dist/lib/public-api/infrastructure/public-expansion.query.js +384 -0
  330. package/dist/lib/public-api/types/public-bulk.d.ts +77 -0
  331. package/dist/lib/public-api/types/public-bulk.d.ts.map +1 -0
  332. package/dist/lib/public-api/types/public-bulk.js +23 -0
  333. package/dist/lib/public-api/types/public-entry.d.ts +97 -0
  334. package/dist/lib/public-api/types/public-entry.d.ts.map +1 -0
  335. package/dist/lib/public-api/types/public-entry.js +8 -0
  336. package/dist/lib/public-api/types/public-expansion.d.ts +92 -0
  337. package/dist/lib/public-api/types/public-expansion.d.ts.map +1 -0
  338. package/dist/lib/public-api/types/public-expansion.js +2 -0
  339. package/dist/lib/registry/content-type-registry.d.ts +103 -0
  340. package/dist/lib/registry/content-type-registry.d.ts.map +1 -0
  341. package/dist/lib/registry/content-type-registry.js +155 -0
  342. package/dist/lib/revisions/application/ports/revision-store.d.ts +71 -0
  343. package/dist/lib/revisions/application/ports/revision-store.d.ts.map +1 -0
  344. package/dist/lib/revisions/application/ports/revision-store.js +9 -0
  345. package/dist/lib/revisions/application/use-cases/publish-revision.use-case.d.ts +40 -0
  346. package/dist/lib/revisions/application/use-cases/publish-revision.use-case.d.ts.map +1 -0
  347. package/dist/lib/revisions/application/use-cases/publish-revision.use-case.js +66 -0
  348. package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts +36 -0
  349. package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts.map +1 -0
  350. package/dist/lib/revisions/application/use-cases/restore-revision.use-case.js +57 -0
  351. package/dist/lib/revisions/domain/revision-status.d.ts +18 -0
  352. package/dist/lib/revisions/domain/revision-status.d.ts.map +1 -0
  353. package/dist/lib/revisions/domain/revision-status.js +18 -0
  354. package/dist/lib/revisions/domain/revision.d.ts +80 -0
  355. package/dist/lib/revisions/domain/revision.d.ts.map +1 -0
  356. package/dist/lib/revisions/domain/revision.js +84 -0
  357. package/dist/lib/revisions/http/controllers/publish-revision.controller.d.ts +19 -0
  358. package/dist/lib/revisions/http/controllers/publish-revision.controller.d.ts.map +1 -0
  359. package/dist/lib/revisions/http/controllers/publish-revision.controller.js +51 -0
  360. package/dist/lib/revisions/http/controllers/restore-revision.controller.d.ts +17 -0
  361. package/dist/lib/revisions/http/controllers/restore-revision.controller.d.ts.map +1 -0
  362. package/dist/lib/revisions/http/controllers/restore-revision.controller.js +49 -0
  363. package/dist/lib/revisions/http/controllers/revisions.controller.d.ts +20 -0
  364. package/dist/lib/revisions/http/controllers/revisions.controller.d.ts.map +1 -0
  365. package/dist/lib/revisions/http/controllers/revisions.controller.js +76 -0
  366. package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.d.ts +33 -0
  367. package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.d.ts.map +1 -0
  368. package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.js +174 -0
  369. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts +17 -0
  370. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts.map +1 -0
  371. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.js +20 -0
  372. package/dist/lib/revisions/infrastructure/persistence/revision-table.d.ts +228 -0
  373. package/dist/lib/revisions/infrastructure/persistence/revision-table.d.ts.map +1 -0
  374. package/dist/lib/revisions/infrastructure/persistence/revision-table.js +57 -0
  375. package/dist/lib/revisions/infrastructure/queries/revision-refs.query.d.ts +22 -0
  376. package/dist/lib/revisions/infrastructure/queries/revision-refs.query.d.ts.map +1 -0
  377. package/dist/lib/revisions/infrastructure/queries/revision-refs.query.js +66 -0
  378. package/dist/lib/revisions/revisions.constants.d.ts +10 -0
  379. package/dist/lib/revisions/revisions.constants.d.ts.map +1 -0
  380. package/dist/lib/revisions/revisions.constants.js +12 -0
  381. package/dist/lib/revisions/types/revision-view.d.ts +74 -0
  382. package/dist/lib/revisions/types/revision-view.d.ts.map +1 -0
  383. package/dist/lib/revisions/types/revision-view.js +2 -0
  384. package/dist/lib/types/content-type.d.ts +131 -0
  385. package/dist/lib/types/content-type.d.ts.map +1 -0
  386. package/dist/lib/types/content-type.js +28 -0
  387. package/dist/lib/types/fields.d.ts +303 -0
  388. package/dist/lib/types/fields.d.ts.map +1 -0
  389. package/dist/lib/types/fields.js +52 -0
  390. package/dist/lib/utils/content-plugin.d.ts +35 -0
  391. package/dist/lib/utils/content-plugin.d.ts.map +1 -0
  392. package/dist/lib/utils/content-plugin.js +35 -0
  393. package/dist/lib/validation/services/entry-validation.service.d.ts +24 -0
  394. package/dist/lib/validation/services/entry-validation.service.d.ts.map +1 -0
  395. package/dist/lib/validation/services/entry-validation.service.js +35 -0
  396. package/package.json +54 -0
@@ -0,0 +1,24 @@
1
+ import type { AnyContentType } from '../../../types/content-type';
2
+ /**
3
+ * The set of field names a `?fields=` list selects, or `undefined` when the
4
+ * caller asked for none (the default — the whole record).
5
+ */
6
+ export type FieldSelection = ReadonlySet<string> | undefined;
7
+ /**
8
+ * Parse `?fields=title,slug` into the set {@link toRecord} projects `values`
9
+ * down to. Only fields that carry a column are selectable — a many-relation or
10
+ * an inverse back-reference has no value on the row (its links live in a join
11
+ * table), so naming one is a client error, not a silently empty key.
12
+ *
13
+ * **Unknown names are rejected with a 400**, deliberately unlike
14
+ * `?relationFields=`, which drops them. That list is an internal rendering hint
15
+ * where a hidden column legitimately vanishes; this one is an external API
16
+ * contract, where silently honouring `?fields=titel` would return records with
17
+ * no fields and no explanation. Failing loudly makes the typo obvious.
18
+ *
19
+ * Envelope data (`id`, timestamps, `status`/`publishedAt`, `locale`) is **not**
20
+ * selectable and is always returned — it identifies the record rather than
21
+ * describing it, and callers can ignore what they don't need.
22
+ */
23
+ export declare function parseFieldSelection(type: AnyContentType, raw: string | undefined): FieldSelection;
24
+ //# sourceMappingURL=field-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-selection.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/persistence/field-selection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,GAAG,SAAS,GACxB,cAAc,CAiBhB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Pure matcher for a media field's `accept` restriction — shared by the write
3
+ * path's `assertMediaTargets` (and unit-tested in isolation). An asset passes
4
+ * when the field declares no restriction, or when it matches **any** allowed
5
+ * kind **or** any allowed MIME pattern. A MIME pattern is either exact
6
+ * (`application/pdf`) or a `type/*` wildcard (`image/*`).
7
+ */
8
+ import type { MediaAccept } from '../../../types/fields';
9
+ /**
10
+ * Whether an asset (its coarse `kind` + concrete `mimeType`) satisfies a media
11
+ * field's `accept`. An absent restriction, or one with neither list populated,
12
+ * accepts anything.
13
+ */
14
+ export declare function acceptsAsset(accept: MediaAccept | undefined, asset: {
15
+ kind: string;
16
+ mimeType: string;
17
+ }): boolean;
18
+ /**
19
+ * A short human description of what a field accepts, for the validation issue
20
+ * message (e.g. `an image`, `a PDF (application/pdf)`, `an allowed asset`).
21
+ */
22
+ export declare function describeAccept(accept: MediaAccept | undefined): string;
23
+ //# sourceMappingURL=media-accept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-accept.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/persistence/media-accept.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYzD;;;;GAIG;AACH,wBAAgB,YAAY,CACxB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAQT;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAQtE"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Pure matcher for a media field's `accept` restriction — shared by the write
4
+ * path's `assertMediaTargets` (and unit-tested in isolation). An asset passes
5
+ * when the field declares no restriction, or when it matches **any** allowed
6
+ * kind **or** any allowed MIME pattern. A MIME pattern is either exact
7
+ * (`application/pdf`) or a `type/*` wildcard (`image/*`).
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.acceptsAsset = acceptsAsset;
11
+ exports.describeAccept = describeAccept;
12
+ /** A MIME pattern matches a concrete MIME either exactly or as a `type/*` glob. */
13
+ function mimeMatches(pattern, mimeType) {
14
+ if (pattern === mimeType)
15
+ return true;
16
+ if (pattern.endsWith('/*')) {
17
+ const prefix = pattern.slice(0, -1); // keep the trailing slash: "image/"
18
+ return mimeType.startsWith(prefix);
19
+ }
20
+ return false;
21
+ }
22
+ /**
23
+ * Whether an asset (its coarse `kind` + concrete `mimeType`) satisfies a media
24
+ * field's `accept`. An absent restriction, or one with neither list populated,
25
+ * accepts anything.
26
+ */
27
+ function acceptsAsset(accept, asset) {
28
+ if (!accept)
29
+ return true;
30
+ const kinds = accept.kinds ?? [];
31
+ const mimeTypes = accept.mimeTypes ?? [];
32
+ if (!kinds.length && !mimeTypes.length)
33
+ return true;
34
+ if (kinds.includes(asset.kind))
35
+ return true;
36
+ if (mimeTypes.some((p) => mimeMatches(p, asset.mimeType)))
37
+ return true;
38
+ return false;
39
+ }
40
+ /**
41
+ * A short human description of what a field accepts, for the validation issue
42
+ * message (e.g. `an image`, `a PDF (application/pdf)`, `an allowed asset`).
43
+ */
44
+ function describeAccept(accept) {
45
+ if (!accept)
46
+ return 'an allowed asset';
47
+ const parts = [];
48
+ if (accept.kinds?.length)
49
+ parts.push(accept.kinds.join(' / '));
50
+ if (accept.mimeTypes?.length)
51
+ parts.push(accept.mimeTypes.join(' / '));
52
+ return parts.length
53
+ ? `an allowed asset (${parts.join(', ')})`
54
+ : 'an allowed asset';
55
+ }
@@ -0,0 +1,327 @@
1
+ import { type Database } from '@orthacms/database';
2
+ import { type AnyContentType } from '../../../types/content-type';
3
+ import { type AnyFieldSpec } from '../../../types/fields';
4
+ import type { RelationDelta, RelationFieldView, RelationRef } from '../../types/entry-list-view';
5
+ /**
6
+ * Reject any target row that lives in a different locale from the source.
7
+ *
8
+ * Two **i18n** types must link inside one locale. A cross-locale link is a
9
+ * broken model rather than a preference: the English article would render the
10
+ * German tag, and since links are per-row rather than synced across a
11
+ * translation group, nothing later repairs it. The admin has always enforced
12
+ * this by only offering same-locale candidates in its relation picker; this is
13
+ * the same rule at the layer a direct API call cannot skip.
14
+ *
15
+ * A no-op unless BOTH sides are localized — `sourceLocale` is `undefined` for a
16
+ * non-i18n owner, and a non-i18n target has no locale to disagree about.
17
+ *
18
+ * Exported so `EntryWriterService` applies the identical rule to the owning
19
+ * **single** relations it validates itself (a `<field>_id` FK never reaches the
20
+ * join-table paths), instead of the two growing their own versions of it.
21
+ */
22
+ export declare function assertSameLocale(rows: Row[], target: AnyContentType, field: string, sourceLocale: string | undefined): void;
23
+ /** A generated content row seen as a bag of values by property name. */
24
+ type Row = Record<string, unknown>;
25
+ /** Default links per page when the caller doesn't specify one. */
26
+ export declare const RELATION_PAGE_SIZE = 20;
27
+ /**
28
+ * Extra visibility applied to a relation's **targets**, on top of the workspace
29
+ * scope and soft-delete guard every read already applies.
30
+ *
31
+ * Exists for the public content API, which serves published entries only: a
32
+ * relation preview there must not surface a draft target's title, and must not
33
+ * *count* it either, or `total` would advertise links the caller can never see.
34
+ * Absent (the admin's every call site) nothing changes — an editor legitimately
35
+ * links to drafts and needs to see them.
36
+ */
37
+ export interface RelationTargetVisibility {
38
+ /** Restrict targets to entries that are currently published. */
39
+ publishedOnly?: boolean;
40
+ }
41
+ /**
42
+ * The transaction handle Drizzle hands the `db.transaction(tx => …)` callback —
43
+ * derived from {@link Database} so link writes share the exact query surface of
44
+ * the client without hard-coding the dialect's transaction type.
45
+ */
46
+ export type DbTransaction = Parameters<Parameters<Database['transaction']>[0]>[0];
47
+ /**
48
+ * Anything that can run a SELECT — the pooled client or a transaction handle.
49
+ * Lets the locale-group resolver serve both the in-transaction link writes and
50
+ * the pre-transaction single-relation resolution without duplicating itself.
51
+ */
52
+ export type QueryRunner = Pick<Database, 'select'>;
53
+ /**
54
+ * Reads and writes the relation **links** an entry owns beyond its own columns:
55
+ * many-to-many join rows and the inverse (back-reference) side of a two-way
56
+ * relation. Owning **single** relations are plain `<field>_id` FK columns —
57
+ * written by `toColumns`, read off the row — so they need no join plumbing.
58
+ *
59
+ * Everything is **paginated**: a relation can hold thousands of links, so reads
60
+ * return one ordered page + a `total` (never every id), and writes apply an
61
+ * incremental {@link RelationDelta} (link / unlink / reorder) inside a
62
+ * transaction — so a huge relation never has to be sent or held in full.
63
+ * Order is persisted in the join table's `position` column, owned by the
64
+ * **source** side; the inverse reads by it (stable) but can't reorder it.
65
+ */
66
+ export declare class RelationLinkService {
67
+ private readonly db;
68
+ constructor(db: Database);
69
+ /**
70
+ * First page (+ total) of **every** relation field of `type` for one entry,
71
+ * keyed by field name — what the editor loads on open. Each field is read
72
+ * independently (paginated), so a relation with many links contributes only
73
+ * its first page, not every id.
74
+ *
75
+ * Admin-only, hence no {@link RelationTargetVisibility}: an editor must see
76
+ * the draft targets it may be about to publish. The public API reads links
77
+ * one field at a time through {@link readField}, which takes the flag.
78
+ */
79
+ readAll(type: AnyContentType, row: Row, workspaceId: string, pageSize?: number): Promise<Record<string, RelationFieldView>>;
80
+ /**
81
+ * A capped relation preview for a whole **page** of entries — what the
82
+ * records table's relation columns render. Returns, per entry id, a
83
+ * `{ items, total }` view for each requested field.
84
+ *
85
+ * The batching is the point: this issues a constant number of queries **per
86
+ * relation field**, spanning every row on the page (`inArray(ownCol, ids)`),
87
+ * never one query per row. Contrast {@link readAll}, which is scoped to a
88
+ * single entry (`eq(ownCol, row.id)`) because the editor opens one record —
89
+ * calling it in a loop over a page would be a textbook N+1 (a 50-row page
90
+ * with two relation columns would cost 300 queries; this costs a handful).
91
+ *
92
+ * Each field contributes at most `pageSize` refs plus its true `total`, so a
93
+ * record holding thousands of links reads exactly one page here — the
94
+ * dropdown pages through the rest via {@link readField}. Only `fields` are
95
+ * resolved (the table's visible columns), so a hidden relation column costs
96
+ * nothing.
97
+ */
98
+ previewForEntries(type: AnyContentType, fields: string[], rows: Row[], workspaceId: string, pageSize?: number, visibility?: RelationTargetVisibility): Promise<Map<string, Record<string, RelationFieldView>>>;
99
+ /**
100
+ * Preview one relation field across the page, dispatched by storage form —
101
+ * the same three shapes {@link readField} handles: an owning single relation
102
+ * (FK on the row), a join-backed relation (owning many-to-many or the
103
+ * inverse of one), and an inverse-of-single (the owner's FK points back).
104
+ */
105
+ private previewField;
106
+ /**
107
+ * Owning **single** relations: the FK already rides each page row, so this
108
+ * is one batched {@link refsFor} for every row's target at once — which also
109
+ * de-duplicates, so 50 posts sharing one author resolve that title once
110
+ * instead of 50 times.
111
+ */
112
+ private previewSingle;
113
+ /**
114
+ * Join-backed relations (owning many-to-many, or the inverse of one), ranked
115
+ * in a single windowed pass: `row_number()` applies the per-source page cap
116
+ * and `count(*)` the true total, both partitioned by the owning id. That is
117
+ * what keeps a 600-link record to `pageSize` rows read instead of 600.
118
+ */
119
+ private previewJoin;
120
+ /**
121
+ * Inverse-of-single (one-to-many): the links are the owner rows whose FK
122
+ * points back at each page row. Windowed the same way, and scoped to the
123
+ * workspace with the soft-delete guard the inverse read side already applies.
124
+ */
125
+ private previewInverse;
126
+ /**
127
+ * Fold ranked window rows (already ordered by owner, then rank) into one
128
+ * `{ items, total }` view per owning id, resolving each link through the
129
+ * batched `refs`. Shared by the join-backed and inverse previews.
130
+ */
131
+ private groupPreview;
132
+ /**
133
+ * One page of a single relation field's links, ordered by `position`
134
+ * (owning) and resolved to display-ready refs (id + title). `row` is the
135
+ * editing entry (its FK columns back a single relation); pass it to avoid a
136
+ * re-read. Returns `{ items, total }`.
137
+ */
138
+ readField(type: AnyContentType, row: Row, field: string, spec: AnyFieldSpec, page: number, pageSize: number, workspaceId: string, visibility?: RelationTargetVisibility): Promise<RelationFieldView>;
139
+ /**
140
+ * The **full** ordered target-id list of every join-backed relation field
141
+ * (owning many-to-many and the inverse of one) for one entry, keyed by field
142
+ * name — the relation half of a revision snapshot. Unlike {@link readAll}
143
+ * (one page + a `total`, for the editor), this reads every link, since a
144
+ * snapshot must reconstruct the whole set. Runs on the passed executor (the
145
+ * save transaction), so it captures exactly what committed. Owning single
146
+ * relations aren't included — their FK already rides the entry's `values`.
147
+ * The join rows belong to the owning entry (scoped by `row.id`), so no
148
+ * workspace filter is needed here — the same as the join read in
149
+ * {@link readField}.
150
+ */
151
+ snapshotLinks(exec: Database | DbTransaction, type: AnyContentType, row: Row): Promise<Record<string, string[]>>;
152
+ /**
153
+ * Apply an incremental {@link RelationDelta} to one many/inverse relation
154
+ * field inside `tx`: validate the linked targets are in the workspace, unlink
155
+ * the removed pairs, append the new ones (`position = max+1` for the source,
156
+ * `ON CONFLICT DO NOTHING`), then renumber to `order` (owning side only).
157
+ * A single relation or an inverse-of-single owns no delta-writable link, so
158
+ * it's a no-op. Returns nothing — read the field back for the new state.
159
+ */
160
+ applyDelta(tx: DbTransaction, type: AnyContentType, sourceId: string, field: string, delta: RelationDelta, workspaceId: string, sourceLocale?: string): Promise<void>;
161
+ /**
162
+ * Replace a many-relation's links with exactly `values[field]` (array),
163
+ * position = array index — the **whole-set** write used only when a caller
164
+ * genuinely submits a relation **array** in the entry body (legacy / bulk).
165
+ * The editor uses {@link applyDelta} instead. Runs inside the entry's
166
+ * transaction. **Only an array counts**: a field that's absent or `null`
167
+ * (`coerceValues` stamps `null` onto every unset field) is left untouched, so
168
+ * a save that manages a relation purely through deltas can never have its
169
+ * links cleared here.
170
+ */
171
+ writeLinks(tx: DbTransaction, type: AnyContentType, sourceId: string, values: Record<string, unknown>, workspaceId: string, sourceLocale?: string): Promise<void>;
172
+ /**
173
+ * Count the links of one join-backed relation field for an entry — the
174
+ * `total` a read would report, without fetching or resolving any page. Runs
175
+ * on the passed executor (the write transaction when validating a just-saved
176
+ * entry, so it sees the delta's uncommitted rows). Returns 0 for a relation
177
+ * that owns no writable links from this side (single FK / inverse-of-single).
178
+ */
179
+ countLinks(exec: Database | DbTransaction, type: AnyContentType, row: Row, field: string, spec: AnyFieldSpec, workspaceId: string): Promise<number>;
180
+ /**
181
+ * Take the transaction-scoped advisory lock for one physical source list
182
+ * (`<join table>:<sourceId>`), serializing every appender to that list so no
183
+ * two concurrent writes read the same `max(position)`. Auto-releases at
184
+ * commit/rollback. Keyed on the table name too, so distinct join tables that
185
+ * happen to share a source id don't falsely contend.
186
+ */
187
+ private lockSource;
188
+ /** Next append position for a source: `max(position) + 1`, else 0. */
189
+ private nextPosition;
190
+ /**
191
+ * Public resolver for callers that hold **raw ids** rather than a live link
192
+ * set — the revision preview, which reads a historical snapshot's relation id
193
+ * lists and needs their display titles. Resolves the first `cap` ids (order
194
+ * preserved) via the same batched lookup as {@link refsFor}; the caller
195
+ * carries the true count separately and shows a "+N more" past the cap, so a
196
+ * relation with thousands of links is never resolved whole. A soft-deleted /
197
+ * foreign id yields a `missing` ref, never a title leak.
198
+ */
199
+ resolveRefs(target: AnyContentType, ids: readonly string[], workspaceId: string, cap: number): Promise<RelationRef[]>;
200
+ /**
201
+ * Resolve `ids` (in order) to display-ready refs via one lookup on the target
202
+ * type, scoped to the workspace. Ids with no **live** row drop to an id-only
203
+ * ref — a soft-deleted (paranoid) target is excluded here just as it is on
204
+ * the inverse read side, so a trashed record never surfaces its title on the
205
+ * owning side while it's hidden on the other.
206
+ */
207
+ private refsFor;
208
+ /**
209
+ * The visibility predicate applied to a relation's target rows: the
210
+ * workspace scope, the soft-delete guard, and — only when the caller asks
211
+ * for it — the published-only restriction. One definition, so the row read
212
+ * (`refsFor`) and the windowed link reads that must *count* correctly can't
213
+ * disagree on what a visible target is.
214
+ */
215
+ private targetVisibleWhere;
216
+ /**
217
+ * The id sub-select of a target's visible rows — how a link read that reads
218
+ * only the JOIN table (so has no target columns of its own) restricts to
219
+ * visible targets *inside* its window, keeping `total` honest. `undefined`
220
+ * when no extra restriction applies, so the predicate collapses away.
221
+ */
222
+ private visibleTargetIds;
223
+ /**
224
+ * `ref IN (visible target ids)`, or `undefined` when no restriction
225
+ * applies. Wraps {@link visibleTargetIds} for the join-table reads, whose
226
+ * only handle on the target is the id column in the join row.
227
+ */
228
+ private visibleTargetIdsPredicate;
229
+ /** Build a display ref from a full target row. */
230
+ private rowToRef;
231
+ /**
232
+ * Rewrite a delta's translation-group ids into entry ids, picking each
233
+ * group's row in the **source entry's own locale**.
234
+ *
235
+ * This is the half of the cross-locale rule that makes it usable rather than
236
+ * merely strict. A client that thinks in stories holds one group id per
237
+ * story, not one entry id per language; without this it would have to keep a
238
+ * per-locale id map and pick the right entry for every write — and picking
239
+ * wrong is exactly what the rule then rejects. Here the server picks, and it
240
+ * is the only party that knows the source row's locale for certain.
241
+ *
242
+ * A group with no row in this locale is a **422** naming the field: the
243
+ * caller asked to link a story that has not been translated into this
244
+ * language yet, which is a real content gap rather than a bad request.
245
+ */
246
+ resolveLocaleGroups(runner: QueryRunner, target: AnyContentType, groupIds: string[], workspaceId: string, field: string, sourceLocale: string | undefined): Promise<Map<string, string>>;
247
+ /**
248
+ * The **lenient** counterpart of {@link resolveLocaleGroups}: given target
249
+ * ids held by one row, find the equivalent id in each of `locales` — the
250
+ * row of the same translation group, in that language.
251
+ *
252
+ * Returns `locale → (given id → that locale's id)`. A pair with no row in a
253
+ * locale is simply **absent** rather than an error, which is the whole
254
+ * difference. `resolveLocaleGroups` answers an explicit API call naming a
255
+ * group, where a missing translation is a request to reject; this answers
256
+ * the implicit sibling sync, where it is a content gap on the *target* and
257
+ * failing would mean an English save could not be saved until somebody
258
+ * translated a tag.
259
+ *
260
+ * Two queries regardless of how many ids or locales are asked for: one to
261
+ * read the given ids' groups, one to read those groups' rows in the wanted
262
+ * locales. Soft-deleted rows are excluded from the **destination** side —
263
+ * required for determinism, since the `(locale_group_id, locale)` unique
264
+ * index is partial (`WHERE deleted_at IS NULL`) on a paranoid type, so
265
+ * trashed rows can legitimately repeat a pair. The source lookup is not
266
+ * filtered: a link to a trashed row still has a group, and dropping it
267
+ * would silently unlink siblings whenever a target went to the bin.
268
+ */
269
+ equivalentIdsByLocale(exec: QueryRunner, target: AnyContentType, ids: readonly string[], locales: readonly string[], workspaceId: string): Promise<Map<string, Map<string, string>>>;
270
+ /**
271
+ * Replace one join-backed relation field's links for `sourceId` with
272
+ * exactly `targetIds`, in order — the primitive the locale sibling sync
273
+ * writes through. Returns whether anything actually changed, so a caller
274
+ * can leave an already-correct sibling untouched (and unversioned).
275
+ *
276
+ * Deliberately **not** {@link applyDelta}: that is an incremental edit from
277
+ * a client that knows what it changed, while a sync knows only the desired
278
+ * end state. Deliberately not {@link writeLinks} either — that reads its ids
279
+ * out of a values bag and re-validates targets the caller may not have.
280
+ * Here the ids came from a sibling row that already passed those checks.
281
+ */
282
+ replaceLinks(tx: DbTransaction, type: AnyContentType, sourceId: string, field: string, targetIds: readonly string[]): Promise<boolean>;
283
+ /**
284
+ * The ordered link ids of **one** join-backed relation field, read on the
285
+ * passed executor. {@link snapshotLinks} reads every field at once for a
286
+ * revision; the sync needs one field at a time, and only the ones that
287
+ * actually propagate.
288
+ */
289
+ linkIdsOf(exec: Database | DbTransaction, type: AnyContentType, sourceId: string, field: string): Promise<string[]>;
290
+ /** {@link resolveLocaleGroups} applied to a delta's three id arrays. */
291
+ private resolveByLocaleGroup;
292
+ /**
293
+ * Verify every id to be linked exists **in the same workspace** (the join FK
294
+ * has no workspace constraint of its own). A missing or cross-workspace id is
295
+ * a uniform 422 — indistinguishable from an invalid id, so no enumeration
296
+ * signal.
297
+ *
298
+ * When `sourceLocale` is given and the target type is localized, the link is
299
+ * additionally required to stay **inside one locale**. Two i18n types linked
300
+ * across locales is a broken model, not a preference: the English article
301
+ * would render the German tag, and because join links are per-row rather
302
+ * than synced across a translation group, nothing would ever repair it. The
303
+ * admin has always enforced this in its picker (which offers same-locale
304
+ * candidates only) — this is the same rule where it cannot be bypassed by
305
+ * talking to the API directly.
306
+ *
307
+ * The caller passes the **source row's own** locale, so the rule reads off
308
+ * the row being written rather than off a request parameter that may name a
309
+ * different one. `undefined` (a non-i18n owner) disables the check.
310
+ */
311
+ private assertTargets;
312
+ /**
313
+ * The join-table plan for a relation field, or `null` when it owns no join
314
+ * table (an owning single relation, or an inverse-of-single). An owning
315
+ * many-relation uses its own join table (`source→target`); an inverse of a
316
+ * many-to-many reuses the owning side's join table with the roles swapped.
317
+ */
318
+ private joinPlanFor;
319
+ /**
320
+ * The inverse-of-single (one-to-many) plan for a relation field, or `null`:
321
+ * it reads the owner rows whose FK points back at the editing record, and
322
+ * owns no writable link from this side.
323
+ */
324
+ private inversePlanFor;
325
+ }
326
+ export {};
327
+ //# sourceMappingURL=relation-link.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-link.service.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/persistence/relation-link.service.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAEH,KAAK,cAAc,EAEtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EACR,aAAa,EACb,iBAAiB,EACjB,WAAW,EACd,MAAM,6BAA6B,CAAC;AAMrC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,GAAG,EAAE,EACX,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAcN;AASD,wEAAwE;AACxE,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACrC,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAqBD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAClC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CACzC,CAAC,CAAC,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI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