@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,309 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContentCopilotToolProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const identity_server_1 = require("@orthacms/identity-server");
7
+ const tools_server_1 = require("@orthacms/tools-server");
8
+ const content_tokens_1 = require("../content.tokens");
9
+ const entries_service_1 = require("../entries/infrastructure/queries/entries.service");
10
+ const entry_writer_service_1 = require("../entries/infrastructure/persistence/entry-writer.service");
11
+ const workspace_grants_query_1 = require("../content-types/queries/workspace-grants.query");
12
+ const entries_constants_1 = require("../entries/entries.constants");
13
+ const entry_filter_surface_1 = require("../entries/infrastructure/queries/entry-filter-surface");
14
+ const filter_schema_1 = require("./filter-schema");
15
+ const project_entry_1 = require("./project-entry");
16
+ /** Rows a single `admin_content_search` call may return. */
17
+ const MAX_TOOL_PAGE_SIZE = 25;
18
+ /**
19
+ * The content plugin's contribution to the copilot's tool catalogue — phase 1's
20
+ * three **read-only** tools.
21
+ *
22
+ * Bindings live with their owner: this package already holds `EntriesService`
23
+ * and the registry, so the tools are thin wrappers over the same services the
24
+ * HTTP controllers call, with no refactor and no duplicated query logic. The
25
+ * copilot never imports content ([`docs/design/copilot.md`](../../../../../docs/design/copilot.md) §4).
26
+ *
27
+ * **Every tool re-checks the workspace's content grants.** `WorkspaceGuard`
28
+ * proved the caller belongs to the workspace, but not that the workspace may
29
+ * reach a given type — and the type name arrives from the *model*, which is
30
+ * steerable by content it has read. `resolveGranted` is the one place that
31
+ * check lives, and every tool goes through it.
32
+ */
33
+ let ContentCopilotToolProvider = class ContentCopilotToolProvider {
34
+ registry;
35
+ entries;
36
+ writer;
37
+ grants;
38
+ toolRegistry;
39
+ constructor(registry, entries, writer, grants, toolRegistry) {
40
+ this.registry = registry;
41
+ this.entries = entries;
42
+ this.writer = writer;
43
+ this.grants = grants;
44
+ this.toolRegistry = toolRegistry;
45
+ }
46
+ /**
47
+ * Register with the shared tool registry once the DI graph is built —
48
+ * the same catalogue the MCP endpoint serves, narrowed to the `copilot`
49
+ * surface by each tool's `surfaces`. `@Optional()` because a deployment
50
+ * may run neither consumer, in which case these simply go unregistered.
51
+ */
52
+ onModuleInit() {
53
+ this.toolRegistry?.register(this);
54
+ }
55
+ /** The three read tools, in the order the model sees them. */
56
+ tools() {
57
+ return [this.listTypes(), this.searchEntries(), this.getEntry()];
58
+ }
59
+ /**
60
+ * Resolves a model-supplied type name to a registered type the workspace
61
+ * was actually granted, or throws — the error becomes a tool error the
62
+ * model can recover from.
63
+ *
64
+ * "Not granted" and "does not exist" deliberately produce the **same**
65
+ * message: a distinguishable answer would let a run in one workspace
66
+ * enumerate the deployment's other content types.
67
+ */
68
+ async resolveGranted(typeName, workspaceId) {
69
+ const type = this.registry.get(typeName);
70
+ const granted = await this.grants.grantedSlugs(workspaceId);
71
+ if (!type || !granted.has(type.name)) {
72
+ throw new Error(`Unknown content type "${typeName}" in this workspace.`);
73
+ }
74
+ return type;
75
+ }
76
+ /**
77
+ * `admin_content_types` — the workspace's types, and a named type's full
78
+ * field schema on demand.
79
+ *
80
+ * This is the other half of the "summaries in the prompt, schema on
81
+ * demand" decision (`docs/design/copilot.md` §10): the prompt lists types
82
+ * without fields, and the model calls this when it needs one type's fields,
83
+ * costing one round trip instead of a context window.
84
+ */
85
+ listTypes() {
86
+ return {
87
+ name: 'admin_content_types',
88
+ title: 'Content types (admin)',
89
+ description: 'List the content types available in this workspace. Pass a typeName to get ' +
90
+ 'that type’s full field schema (field names, types, required flags, relation ' +
91
+ 'targets) AND the paths you may filter and sort on — neither is in your system ' +
92
+ 'prompt, so call this before reasoning about a type’s fields or building a filter.',
93
+ inputSchema: {
94
+ type: 'object',
95
+ properties: {
96
+ typeName: {
97
+ type: 'string',
98
+ description: 'Return this one type with its full field schema. Omit to list all types.'
99
+ }
100
+ },
101
+ additionalProperties: false
102
+ },
103
+ requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
104
+ readOnly: true,
105
+ effect: 'read',
106
+ surfaces: ['copilot'],
107
+ handler: async (input, ctx) => {
108
+ const { typeName } = (input ?? {});
109
+ const granted = await this.grants.grantedSlugs(ctx.workspaceId);
110
+ if (typeName) {
111
+ const type = await this.resolveGranted(typeName, ctx.workspaceId);
112
+ // The filterable surface is built with `grantedTypes`, so a
113
+ // relation hop into a type this workspace was never granted
114
+ // is never advertised. The list query itself enforces a
115
+ // wider (unpruned) schema, so advertising less is safe —
116
+ // the reverse would offer paths the engine then rejects.
117
+ const { schema, fields } = (0, entry_filter_surface_1.buildEntryFilterSurface)(type, {
118
+ workspaceId: ctx.workspaceId,
119
+ grantedTypes: granted
120
+ });
121
+ return {
122
+ type: this.registry.serialize(type.name),
123
+ // `fields` is the admin PICKER's list, which omits the
124
+ // envelope timestamps a person reads off a badge —
125
+ // `publishedAt` most of all, without which a model
126
+ // cannot ask "published, with unpublished edits". The
127
+ // root of `schema` is the SQL whitelist itself, so
128
+ // unioning it advertises exactly what the engine will
129
+ // accept. See `describeFilterFields`.
130
+ filterableFields: (0, filter_schema_1.describeFilterFields)(fields, schema.fields)
131
+ };
132
+ }
133
+ return {
134
+ types: this.registry
135
+ .summaries()
136
+ .filter((summary) => granted.has(summary.name))
137
+ };
138
+ }
139
+ };
140
+ }
141
+ /** `admin_content_search` — one page of a type's entries. */
142
+ searchEntries() {
143
+ return {
144
+ name: 'admin_content_search',
145
+ title: 'Search entries (admin)',
146
+ description: 'Search a content type’s entries in this workspace. Combine free-text `search` ' +
147
+ '(across text-like fields) with a structured `filter` for precise queries, and ' +
148
+ '`fields` to return only the columns you need — a full entry includes rich-text ' +
149
+ 'bodies and a page of them is very large. Results are paginated and the response ' +
150
+ 'reports the true total, so you can state how many matched even when you have ' +
151
+ 'only read the first page. On a localized type, pass `locale` — omitting it ' +
152
+ 'searches the default locale, which is rarely what the user meant. ' +
153
+ 'Publish state is two fields, so `status` alone conflates two different ' +
154
+ 'things: entries with live content plus unpublished changes (“modified”, ' +
155
+ '“edited but not published”) are `status` eq "draft" AND `publishedAt` ' +
156
+ 'op "null" value false, while never-published ones are `status` eq "draft" ' +
157
+ 'AND `publishedAt` op "null" value true.',
158
+ inputSchema: {
159
+ type: 'object',
160
+ properties: {
161
+ typeName: {
162
+ type: 'string',
163
+ description: 'The content type to search, e.g. "article".'
164
+ },
165
+ search: {
166
+ type: 'string',
167
+ maxLength: 255,
168
+ description: 'Free-text query. Omit to list everything.'
169
+ },
170
+ sort: {
171
+ type: 'string',
172
+ maxLength: 255,
173
+ description: 'A field name, or "-" prefixed for descending, e.g. "-updatedAt".'
174
+ },
175
+ page: {
176
+ type: 'integer',
177
+ minimum: 1,
178
+ description: '1-based page number.'
179
+ },
180
+ pageSize: {
181
+ type: 'integer',
182
+ minimum: 1,
183
+ maximum: MAX_TOOL_PAGE_SIZE,
184
+ description: `Rows per page (max ${MAX_TOOL_PAGE_SIZE}).`
185
+ },
186
+ filter: (0, filter_schema_1.filterTreeSchema)(),
187
+ fields: {
188
+ type: 'array',
189
+ items: { type: 'string' },
190
+ description: 'Field names to return in `values`. Strongly recommended: omitting ' +
191
+ 'this returns every field including rich text. The envelope ' +
192
+ '(id, status, locale, timestamps) is always returned.'
193
+ },
194
+ locale: {
195
+ type: 'string',
196
+ maxLength: 35,
197
+ description: 'Locale slug to search, e.g. "de". Only meaningful on a localized ' +
198
+ 'type; omitted, the default locale is searched.'
199
+ },
200
+ localeFallback: {
201
+ type: 'string',
202
+ enum: ['default'],
203
+ description: 'Set to "default" to include the default locale where the requested ' +
204
+ 'one has no row.'
205
+ }
206
+ },
207
+ required: ['typeName'],
208
+ additionalProperties: false
209
+ },
210
+ requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
211
+ readOnly: true,
212
+ effect: 'read',
213
+ surfaces: ['copilot'],
214
+ handler: async (input, ctx) => {
215
+ const args = (input ?? {});
216
+ const type = await this.resolveGranted(args.typeName, ctx.workspaceId);
217
+ // The page size is clamped rather than trusted. The schema
218
+ // already caps it, but the validator is defence in depth, not
219
+ // the boundary — and a model that ignores `maximum` must not be
220
+ // able to pull the whole table into a prompt.
221
+ const pageSize = Math.min(Math.max(args.pageSize ?? 10, 1), Math.min(MAX_TOOL_PAGE_SIZE, entries_constants_1.MAX_PAGE_SIZE));
222
+ const result = await this.entries.list(type, {
223
+ ...(args.search ? { search: args.search } : {}),
224
+ ...(args.sort ? { sort: args.sort } : {}),
225
+ // The engine's `?filter=` is a JSON string on the wire;
226
+ // the model gets an object, which is far easier for it
227
+ // to build correctly. `parseFilterTree` accepts either,
228
+ // and validates every path against the type's schema —
229
+ // a bad path is a 400 turned into a tool error, never a
230
+ // query.
231
+ ...(args.filter
232
+ ? { filter: JSON.stringify(args.filter) }
233
+ : {}),
234
+ // Forwarded verbatim to the bound entry extension,
235
+ // which validates the slug (unknown → error) and scopes
236
+ // the rows. Content-server stays locale-agnostic.
237
+ ...(args.locale ? { locale: args.locale } : {}),
238
+ ...(args.localeFallback === 'default'
239
+ ? { localeFallback: 'default' }
240
+ : {}),
241
+ page: Math.max(args.page ?? 1, 1),
242
+ pageSize
243
+ }, ctx.workspaceId);
244
+ return {
245
+ typeName: type.name,
246
+ total: result.total,
247
+ page: result.page,
248
+ pageSize: result.pageSize,
249
+ items: result.items.map((item) => (0, project_entry_1.projectEntry)(item, args.fields))
250
+ };
251
+ }
252
+ };
253
+ }
254
+ /** `admin_content_get` — one entry in full, by id. */
255
+ getEntry() {
256
+ return {
257
+ name: 'admin_content_get',
258
+ title: 'Get an entry (admin)',
259
+ description: 'Fetch one entry of a content type by its id, with all of its field values. ' +
260
+ 'Use this after admin_content_search when you need an entry’s full contents.',
261
+ inputSchema: {
262
+ type: 'object',
263
+ properties: {
264
+ typeName: {
265
+ type: 'string',
266
+ description: 'The entry’s content type.'
267
+ },
268
+ id: {
269
+ type: 'string',
270
+ description: 'The entry’s id, as returned by admin_content_search.'
271
+ },
272
+ fields: {
273
+ type: 'array',
274
+ items: { type: 'string' },
275
+ description: 'Field names to return in `values`. Omitted, every field is ' +
276
+ 'returned including rich text.'
277
+ }
278
+ },
279
+ required: ['typeName', 'id'],
280
+ additionalProperties: false
281
+ },
282
+ requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
283
+ readOnly: true,
284
+ effect: 'read',
285
+ surfaces: ['copilot'],
286
+ handler: async (input, ctx) => {
287
+ const args = (input ?? {});
288
+ const type = await this.resolveGranted(args.typeName, ctx.workspaceId);
289
+ // `getOne` is workspace-scoped and 404s a soft-deleted row, so
290
+ // the tool inherits both without restating either. An entry id
291
+ // already names one row, including its locale, so there is no
292
+ // `locale` parameter here — ask for a sibling by searching the
293
+ // type with a `localeGroupId` filter.
294
+ const entry = await this.writer.getOne(type, args.id, ctx.workspaceId);
295
+ return (0, project_entry_1.projectEntry)(entry, args.fields);
296
+ }
297
+ };
298
+ }
299
+ };
300
+ exports.ContentCopilotToolProvider = ContentCopilotToolProvider;
301
+ exports.ContentCopilotToolProvider = ContentCopilotToolProvider = tslib_1.__decorate([
302
+ (0, common_1.Injectable)(),
303
+ tslib_1.__param(0, (0, content_tokens_1.InjectContentRegistry)()),
304
+ tslib_1.__param(4, (0, common_1.Optional)()),
305
+ tslib_1.__metadata("design:paramtypes", [Function, entries_service_1.EntriesService,
306
+ entry_writer_service_1.EntryWriterService,
307
+ workspace_grants_query_1.WorkspaceGrantsQuery,
308
+ tools_server_1.ToolRegistry])
309
+ ], ContentCopilotToolProvider);
@@ -0,0 +1,42 @@
1
+ import type { SerializedContentType } from '../registry/content-type-registry';
2
+ import type { RevisionSnapshot } from '../revisions/types/revision-view';
3
+ /** One field that differs between two revision snapshots. */
4
+ export interface SnapshotFieldChange {
5
+ /** The field's name, as the model knows it from `admin_content_types`. */
6
+ field: string;
7
+ /** The field's declared type, so a model can read the values correctly. */
8
+ type: string;
9
+ /**
10
+ * Whether the field's links live in a join table (an owning many-relation
11
+ * or any inverse). Its values are **ordered id lists**, not scalars.
12
+ */
13
+ isLinkSet: boolean;
14
+ /** The value in the older of the two revisions. */
15
+ from: unknown;
16
+ /** The value in the newer one. */
17
+ to: unknown;
18
+ }
19
+ /**
20
+ * Diffs two revision snapshots field by field, in schema order, returning
21
+ * **only what changed**.
22
+ *
23
+ * Returning only the changes is the point. The admin's dialog renders every
24
+ * field because a person scanning a table wants the unchanged rows for context;
25
+ * a model reasoning about "what did this edit do" gets nothing from forty
26
+ * `changed: false` rows except a larger prompt. The count of unchanged fields is
27
+ * reported separately, so the answer can still say "3 of 41 fields changed".
28
+ *
29
+ * The comparison rules mirror `content-admin`'s `diffRevision` exactly —
30
+ * empties collapse so `null` → `''` is not an edit, and link sets compare
31
+ * **order-sensitively** because the owning side's order is meaningful data. The
32
+ * duplication is deliberate for now: the two sides type their schema
33
+ * differently (`SerializedContentType` here, the admin's `ContentTypeDetail`
34
+ * there), so sharing this through `@orthacms/content-domain` means unifying
35
+ * those types first — a refactor, not a feature. If the rules ever disagree,
36
+ * that is the fix, not a third copy.
37
+ */
38
+ export declare function diffSnapshots(type: SerializedContentType, from: RevisionSnapshot, to: RevisionSnapshot): {
39
+ changes: SnapshotFieldChange[];
40
+ unchangedFields: number;
41
+ };
42
+ //# sourceMappingURL=diff-snapshots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-snapshots.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/diff-snapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAChC,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,kCAAkC;IAClC,EAAE,EAAE,OAAO,CAAC;CACf;AA0BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CACzB,IAAI,EAAE,qBAAqB,EAC3B,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,gBAAgB,GACrB;IAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAsC7D"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diffSnapshots = diffSnapshots;
4
+ const fields_1 = require("../types/fields");
5
+ /** A field whose links live in a join table (owning many, or any inverse). */
6
+ function isLinkSet(field) {
7
+ return (field.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
8
+ !!field.relation &&
9
+ (field.relation.many || !!field.relation.inverse));
10
+ }
11
+ /** Treat null / undefined / empty string as one "empty", so they aren't a change. */
12
+ function normalize(value) {
13
+ return value == null || value === '' ? null : value;
14
+ }
15
+ /** Structural equality for scalar / FK / json values, empties collapsed. */
16
+ function sameValue(a, b) {
17
+ return JSON.stringify(normalize(a)) === JSON.stringify(normalize(b));
18
+ }
19
+ /** Order-sensitive equality for a link set — the owning side's order is data. */
20
+ function sameLinks(a, b) {
21
+ return a.length === b.length && a.every((id, index) => id === b[index]);
22
+ }
23
+ /**
24
+ * Diffs two revision snapshots field by field, in schema order, returning
25
+ * **only what changed**.
26
+ *
27
+ * Returning only the changes is the point. The admin's dialog renders every
28
+ * field because a person scanning a table wants the unchanged rows for context;
29
+ * a model reasoning about "what did this edit do" gets nothing from forty
30
+ * `changed: false` rows except a larger prompt. The count of unchanged fields is
31
+ * reported separately, so the answer can still say "3 of 41 fields changed".
32
+ *
33
+ * The comparison rules mirror `content-admin`'s `diffRevision` exactly —
34
+ * empties collapse so `null` → `''` is not an edit, and link sets compare
35
+ * **order-sensitively** because the owning side's order is meaningful data. The
36
+ * duplication is deliberate for now: the two sides type their schema
37
+ * differently (`SerializedContentType` here, the admin's `ContentTypeDetail`
38
+ * there), so sharing this through `@orthacms/content-domain` means unifying
39
+ * those types first — a refactor, not a feature. If the rules ever disagree,
40
+ * that is the fix, not a third copy.
41
+ */
42
+ function diffSnapshots(type, from, to) {
43
+ const changes = [];
44
+ let unchanged = 0;
45
+ for (const field of type.fields) {
46
+ if (isLinkSet(field)) {
47
+ const before = from.relations?.[field.name] ?? [];
48
+ const after = to.relations?.[field.name] ?? [];
49
+ if (sameLinks(before, after)) {
50
+ unchanged++;
51
+ continue;
52
+ }
53
+ changes.push({
54
+ field: field.name,
55
+ type: field.type,
56
+ isLinkSet: true,
57
+ from: before,
58
+ to: after
59
+ });
60
+ continue;
61
+ }
62
+ const before = from.values?.[field.name];
63
+ const after = to.values?.[field.name];
64
+ if (sameValue(before, after)) {
65
+ unchanged++;
66
+ continue;
67
+ }
68
+ changes.push({
69
+ field: field.name,
70
+ type: field.type,
71
+ isLinkSet: false,
72
+ from: before ?? null,
73
+ to: after ?? null
74
+ });
75
+ }
76
+ return { changes, unchangedFields: unchanged };
77
+ }
@@ -0,0 +1,89 @@
1
+ import type { ProposalActor, ProposalApplier, ProposalApplyResult, ProposalTarget } from '@orthacms/copilot-domain';
2
+ import type { ContentTypeRegistry } from '../registry/content-type-registry';
3
+ import { EntryWriterService } from '../entries/infrastructure/persistence/entry-writer.service';
4
+ import { WorkspaceGrantsQuery } from '../content-types/queries/workspace-grants.query';
5
+ /**
6
+ * Applies `content.entry.create` — a new draft entry.
7
+ *
8
+ * **It calls `EntryWriterService.create`, the same method the POST route
9
+ * calls.** Not "similar to": the same. That is what makes an accepted proposal
10
+ * validated by `EntryValidationService`, wrapped in the workspace's shared
11
+ * advisory lock, snapshotted as revision 1, and passed through the bound i18n
12
+ * extension exactly as a hand-typed entry would be
13
+ * ([ADR-0005](../../../../../../docs/adr/0005-copilot-authority-model.md) §5).
14
+ * An applier that reimplemented the insert to "keep it simple" is the failure
15
+ * the port exists to prevent.
16
+ *
17
+ * The grants are re-checked here, not trusted from the proposal. The row was
18
+ * written when the proposal was made, and a workspace's content grants can be
19
+ * revoked in between — a stored `typeName` is an argument like any other.
20
+ */
21
+ export declare class CreateEntryProposalApplier implements ProposalApplier {
22
+ private readonly registry;
23
+ private readonly writer;
24
+ private readonly grants;
25
+ readonly kind: "content.entry.create";
26
+ constructor(registry: ContentTypeRegistry, writer: EntryWriterService, grants: WorkspaceGrantsQuery);
27
+ apply(input: {
28
+ target: ProposalTarget;
29
+ patch: Record<string, unknown>;
30
+ }, actor: ProposalActor): Promise<ProposalApplyResult>;
31
+ }
32
+ /**
33
+ * Applies `content.entry.update` — a change to an existing entry's values.
34
+ *
35
+ * **Merges rather than replaces.** The admin's `PATCH` replaces the whole
36
+ * values bag because the editor always submits the full document; a proposal
37
+ * carries only the fields a reviewer approved, so replacing would silently null
38
+ * everything they did not see. This is the same reasoning — and the same merge
39
+ * semantics — as the public API's partial update.
40
+ *
41
+ * The merge reads the entry **now**, not when the proposal was made, so a
42
+ * proposal accepted an hour later writes the approved fields onto whatever the
43
+ * entry has become instead of resurrecting a stale document. A reviewer
44
+ * approving "fix this typo" gets that typo fixed, not the rest of the entry
45
+ * rewound.
46
+ */
47
+ export declare class UpdateEntryProposalApplier implements ProposalApplier {
48
+ private readonly registry;
49
+ private readonly writer;
50
+ private readonly grants;
51
+ readonly kind: "content.entry.update";
52
+ constructor(registry: ContentTypeRegistry, writer: EntryWriterService, grants: WorkspaceGrantsQuery);
53
+ apply(input: {
54
+ target: ProposalTarget;
55
+ patch: Record<string, unknown>;
56
+ }, actor: ProposalActor): Promise<ProposalApplyResult>;
57
+ }
58
+ /**
59
+ * Applies `content.entry.bulk-save` — a batch of creates and edits, carried out
60
+ * as one change.
61
+ *
62
+ * **Item by item through the same `EntryWriterService` methods the other two
63
+ * appliers call**, for the same reason they do: validation, the advisory lock,
64
+ * the revision snapshot and the i18n sibling sync all have to happen per entry,
65
+ * and a batch-shaped shortcut around any of them would be a second write path.
66
+ * Sequentially, not concurrently — each write takes the workspace's shared
67
+ * content lock, so a fan-out would mostly contend with itself.
68
+ *
69
+ * **It stops at the first failure and throws.** There is no per-item verdict to
70
+ * show: a proposal is one row with one status, and its card says "Saved" or
71
+ * "Not saved". Carrying on after a failure would grow the number of entries
72
+ * written under a receipt that then reports failure — so the batch halts, and
73
+ * the error names exactly how many landed, which is what the model reads back
74
+ * to the user. (The public API's `bulkSave` does the opposite and keeps going,
75
+ * because there the caller gets every item's verdict and can retry the ones it
76
+ * can fix.)
77
+ */
78
+ export declare class BulkSaveEntriesProposalApplier implements ProposalApplier {
79
+ private readonly registry;
80
+ private readonly writer;
81
+ private readonly grants;
82
+ readonly kind: "content.entry.bulk-save";
83
+ constructor(registry: ContentTypeRegistry, writer: EntryWriterService, grants: WorkspaceGrantsQuery);
84
+ apply(input: {
85
+ target: ProposalTarget;
86
+ patch: Record<string, unknown>;
87
+ }, actor: ProposalActor): Promise<ProposalApplyResult>;
88
+ }
89
+ //# sourceMappingURL=entry-proposal.applier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-proposal.applier.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/entry-proposal.applier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,cAAc,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4DAA4D,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AA8CvF;;;;;;;;;;;;;;;GAeG;AACH,qBACa,0BAA2B,YAAW,eAAe;IAK1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,QAAQ,CAAC,IAAI,yBAAsC;gBAI9B,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,oBAAoB;IAG3C,KAAK,CACP,KAAK,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EACjE,KAAK,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,CAAC;CAiClC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBACa,0BAA2B,YAAW,eAAe;IAK1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,QAAQ,CAAC,IAAI,yBAAsC;gBAI9B,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,oBAAoB;IAG3C,KAAK,CACP,KAAK,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EACjE,KAAK,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,CAAC;CAwClC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,8BAA+B,YAAW,eAAe;IAK9D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,QAAQ,CAAC,IAAI,4BAA0C;gBAIlC,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,oBAAoB;IAG3C,KAAK,CACP,KAAK,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EACjE,KAAK,EAAE,aAAa,GACrB,OAAO,CAAC,mBAAmB,CAAC;CAqFlC"}