@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,61 @@
1
+ import type { FieldSchema } from '@orthacms/utils-server';
2
+ import type { WireFilterField } from '../entries/types/filter-surface';
3
+ /**
4
+ * The operators the filter engine accepts, as the model sees them. Mirrors
5
+ * `FilterOperator` in `@orthacms/utils-server` — restated rather than imported
6
+ * so the descriptions can be written *for a model* instead of for a developer.
7
+ */
8
+ export declare const FILTER_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin", "like", "ilike", "nilike", "null"];
9
+ /**
10
+ * The JSON Schema for a filter tree, handed to the model as
11
+ * `admin_content_search`'s `filter` parameter.
12
+ *
13
+ * The grammar is the query builder's own — a node is either a group
14
+ * (`{and: […]}` / `{or: […]}`) or a rule (`{field, op, value}`) — so the model
15
+ * emits exactly what the admin's UI emits and the same parser validates both.
16
+ * **The model never writes SQL**: `parseFilterTree` checks every path against a
17
+ * schema derived from the content type, so an unknown field or an ungranted
18
+ * relation hop is a rejected filter, not a query.
19
+ *
20
+ * `$ref`/`$defs` are deliberately avoided — a recursive schema is exactly the
21
+ * thing small models handle worst, and our own `validateToolInput` ignores
22
+ * `$ref` anyway. Two literal levels of nesting cover every filter the admin's
23
+ * own query builder can produce, and a deeper one still *works*: the validator
24
+ * only checks what it is given, and the real depth limit is the parser's.
25
+ */
26
+ export declare function filterTreeSchema(): Record<string, unknown>;
27
+ /**
28
+ * The filterable paths, flattened for a model.
29
+ *
30
+ * `WireFilterField` carries a `group` breadcrumb for the admin's picker UI,
31
+ * which is noise here — a model wants the dotted path, the coercion type, and
32
+ * the allowed values for an enum. Trimming it also keeps `admin_content_types`
33
+ * affordable on a type with a wide relation graph.
34
+ *
35
+ * **`wire` alone is the picker's list, which is narrower than what SQL
36
+ * accepts** — and the gap is not cosmetic. `scalarWireOf` pushes `status` and
37
+ * the type's own fields; the envelope timestamps, `publishedAt` above all, are
38
+ * whitelisted for SQL and deliberately kept out of the admin UI. A person does
39
+ * not need `publishedAt` in a picker — they have a **Modified** badge in front
40
+ * of them. A model has no badge, and without this path cannot express
41
+ * "published content with unpublished changes" at all: it falls back to
42
+ * `status eq draft` and counts never-published drafts as edits, or invents
43
+ * `status eq "modified"` and gets an enum error. Both answers are confidently
44
+ * wrong, which is exactly what the filter grammar's "only paths listed by
45
+ * admin_content_types are accepted" is supposed to prevent.
46
+ *
47
+ * So `sqlFields` — the ROOT level of the very `FilterSchema` that is the
48
+ * security boundary — is unioned in. Reading the boundary is the opposite of
49
+ * a second source of truth: a field added to `scalarFieldsOf` later is offered
50
+ * here automatically, with {@link PARAMETER_BACKED_FIELDS} the one stated
51
+ * exception. Relation-level envelope paths (`author.publishedAt`) stay
52
+ * unadvertised: SQL still accepts them, and listing every hop's envelope would
53
+ * cost more prompt than it buys.
54
+ */
55
+ export declare function describeFilterFields(fields: readonly WireFilterField[], sqlFields?: FieldSchema): Array<{
56
+ path: string;
57
+ type: string;
58
+ values?: readonly string[];
59
+ relationTo?: string;
60
+ }>;
61
+ //# sourceMappingURL=filter-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-schema.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/filter-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,iGAanB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwC1D;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,SAAS,CAAC,EAAE,WAAW,GACxB,KAAK,CAAC;IACL,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CAoBD"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILTER_OPERATORS = void 0;
4
+ exports.filterTreeSchema = filterTreeSchema;
5
+ exports.describeFilterFields = describeFilterFields;
6
+ /**
7
+ * The operators the filter engine accepts, as the model sees them. Mirrors
8
+ * `FilterOperator` in `@orthacms/utils-server` — restated rather than imported
9
+ * so the descriptions can be written *for a model* instead of for a developer.
10
+ */
11
+ exports.FILTER_OPERATORS = [
12
+ 'eq',
13
+ 'ne',
14
+ 'gt',
15
+ 'gte',
16
+ 'lt',
17
+ 'lte',
18
+ 'in',
19
+ 'nin',
20
+ 'like',
21
+ 'ilike',
22
+ 'nilike',
23
+ 'null'
24
+ ];
25
+ /**
26
+ * The JSON Schema for a filter tree, handed to the model as
27
+ * `admin_content_search`'s `filter` parameter.
28
+ *
29
+ * The grammar is the query builder's own — a node is either a group
30
+ * (`{and: […]}` / `{or: […]}`) or a rule (`{field, op, value}`) — so the model
31
+ * emits exactly what the admin's UI emits and the same parser validates both.
32
+ * **The model never writes SQL**: `parseFilterTree` checks every path against a
33
+ * schema derived from the content type, so an unknown field or an ungranted
34
+ * relation hop is a rejected filter, not a query.
35
+ *
36
+ * `$ref`/`$defs` are deliberately avoided — a recursive schema is exactly the
37
+ * thing small models handle worst, and our own `validateToolInput` ignores
38
+ * `$ref` anyway. Two literal levels of nesting cover every filter the admin's
39
+ * own query builder can produce, and a deeper one still *works*: the validator
40
+ * only checks what it is given, and the real depth limit is the parser's.
41
+ */
42
+ function filterTreeSchema() {
43
+ const rule = {
44
+ type: 'object',
45
+ properties: {
46
+ field: {
47
+ type: 'string',
48
+ description: 'A filterable path from admin_content_types → filterableFields, e.g. "status" or "author.name".'
49
+ },
50
+ op: {
51
+ type: 'string',
52
+ enum: [...exports.FILTER_OPERATORS],
53
+ description: 'like/ilike/nilike match text only — they are rejected on a date, number, boolean or uuid field. Use eq/ne, the ordering operators, or in/nin there.'
54
+ },
55
+ value: {
56
+ description: 'The comparison value. An array for in/nin; a boolean for null (true = IS NULL); omitted values are rejected.'
57
+ }
58
+ },
59
+ required: ['field', 'op'],
60
+ additionalProperties: false
61
+ };
62
+ const group = (of) => ({
63
+ type: 'object',
64
+ properties: {
65
+ and: { type: 'array', items: of },
66
+ or: { type: 'array', items: of }
67
+ },
68
+ additionalProperties: false
69
+ });
70
+ return {
71
+ ...group({ anyOf: [rule, group(rule)] }),
72
+ description: 'A filter tree. Either a group — {"and":[…]} or {"or":[…]} — or, nested inside one, ' +
73
+ 'rules of the form {"field":"status","op":"eq","value":"published"}. ' +
74
+ 'Only paths listed by admin_content_types are accepted.'
75
+ };
76
+ }
77
+ /**
78
+ * Root envelope columns the SQL whitelist accepts but that must NOT be
79
+ * advertised, because each already has a dedicated tool **parameter**.
80
+ *
81
+ * `admin_content_search` takes `locale`, which the bound entry extension
82
+ * validates and scopes with; a model that filtered `locale eq "de"` instead
83
+ * would AND that onto the extension's own scope — already pinned to the
84
+ * default locale — and read zero rows from a perfectly valid query. Offering
85
+ * both spellings of one idea is how a model picks the broken one.
86
+ */
87
+ const PARAMETER_BACKED_FIELDS = new Set([
88
+ 'locale',
89
+ 'localeGroupId'
90
+ ]);
91
+ /**
92
+ * The filterable paths, flattened for a model.
93
+ *
94
+ * `WireFilterField` carries a `group` breadcrumb for the admin's picker UI,
95
+ * which is noise here — a model wants the dotted path, the coercion type, and
96
+ * the allowed values for an enum. Trimming it also keeps `admin_content_types`
97
+ * affordable on a type with a wide relation graph.
98
+ *
99
+ * **`wire` alone is the picker's list, which is narrower than what SQL
100
+ * accepts** — and the gap is not cosmetic. `scalarWireOf` pushes `status` and
101
+ * the type's own fields; the envelope timestamps, `publishedAt` above all, are
102
+ * whitelisted for SQL and deliberately kept out of the admin UI. A person does
103
+ * not need `publishedAt` in a picker — they have a **Modified** badge in front
104
+ * of them. A model has no badge, and without this path cannot express
105
+ * "published content with unpublished changes" at all: it falls back to
106
+ * `status eq draft` and counts never-published drafts as edits, or invents
107
+ * `status eq "modified"` and gets an enum error. Both answers are confidently
108
+ * wrong, which is exactly what the filter grammar's "only paths listed by
109
+ * admin_content_types are accepted" is supposed to prevent.
110
+ *
111
+ * So `sqlFields` — the ROOT level of the very `FilterSchema` that is the
112
+ * security boundary — is unioned in. Reading the boundary is the opposite of
113
+ * a second source of truth: a field added to `scalarFieldsOf` later is offered
114
+ * here automatically, with {@link PARAMETER_BACKED_FIELDS} the one stated
115
+ * exception. Relation-level envelope paths (`author.publishedAt`) stay
116
+ * unadvertised: SQL still accepts them, and listing every hop's envelope would
117
+ * cost more prompt than it buys.
118
+ */
119
+ function describeFilterFields(fields, sqlFields) {
120
+ const described = fields.map((field) => ({
121
+ path: field.path,
122
+ type: field.type,
123
+ ...(field.enumValues ? { values: field.enumValues } : {}),
124
+ ...(field.relationTarget ? { relationTo: field.relationTarget } : {})
125
+ }));
126
+ if (!sqlFields)
127
+ return described;
128
+ const advertised = new Set(described.map((field) => field.path));
129
+ for (const [name, spec] of Object.entries(sqlFields)) {
130
+ if (advertised.has(name) || PARAMETER_BACKED_FIELDS.has(name))
131
+ continue;
132
+ described.push({
133
+ path: name,
134
+ type: spec.type,
135
+ ...(spec.enumValues ? { values: spec.enumValues } : {})
136
+ });
137
+ }
138
+ return described;
139
+ }
@@ -0,0 +1,23 @@
1
+ import type { EntryRecord } from '../entries/types/entry-list-view';
2
+ /**
3
+ * Narrows an entry's `values` to the named fields, leaving the envelope alone.
4
+ *
5
+ * **This is what makes "list all the articles" possible at all.** A full
6
+ * `EntryRecord` carries every field including richtext bodies, so a page of 25
7
+ * can be tens of thousands of tokens — the run hits its token ceiling long
8
+ * before it hits the row cap. Asking for `["text","status"]` turns the same page
9
+ * into something a model can actually reason over.
10
+ *
11
+ * The envelope (`id`, `status`, `locale`, timestamps, …) is always kept: `id` is
12
+ * what makes an entry addressable for a follow-up `admin_content_get`, and a
13
+ * projection that could drop it would be a trap. Same rule the public API's
14
+ * sparse fieldsets follow.
15
+ *
16
+ * An unknown name is **ignored** rather than rejected. The public API 400s one,
17
+ * because there a typo is a developer's bug worth surfacing; here the names come
18
+ * from a model that may have mis-remembered a field, and failing the whole call
19
+ * over one bad name costs a round trip to learn something the response itself
20
+ * shows. The returned `values` say what was actually found.
21
+ */
22
+ export declare function projectEntry(entry: EntryRecord, fields: readonly string[] | undefined): EntryRecord;
23
+ //# sourceMappingURL=project-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-entry.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/project-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,WAAW,CAYb"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectEntry = projectEntry;
4
+ /**
5
+ * Narrows an entry's `values` to the named fields, leaving the envelope alone.
6
+ *
7
+ * **This is what makes "list all the articles" possible at all.** A full
8
+ * `EntryRecord` carries every field including richtext bodies, so a page of 25
9
+ * can be tens of thousands of tokens — the run hits its token ceiling long
10
+ * before it hits the row cap. Asking for `["text","status"]` turns the same page
11
+ * into something a model can actually reason over.
12
+ *
13
+ * The envelope (`id`, `status`, `locale`, timestamps, …) is always kept: `id` is
14
+ * what makes an entry addressable for a follow-up `admin_content_get`, and a
15
+ * projection that could drop it would be a trap. Same rule the public API's
16
+ * sparse fieldsets follow.
17
+ *
18
+ * An unknown name is **ignored** rather than rejected. The public API 400s one,
19
+ * because there a typo is a developer's bug worth surfacing; here the names come
20
+ * from a model that may have mis-remembered a field, and failing the whole call
21
+ * over one bad name costs a round trip to learn something the response itself
22
+ * shows. The returned `values` say what was actually found.
23
+ */
24
+ function projectEntry(entry, fields) {
25
+ if (!fields || fields.length === 0) {
26
+ return entry;
27
+ }
28
+ const wanted = new Set(fields);
29
+ const values = {};
30
+ for (const [key, value] of Object.entries(entry.values ?? {})) {
31
+ if (wanted.has(key)) {
32
+ values[key] = value;
33
+ }
34
+ }
35
+ return { ...entry, values };
36
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The proposal kinds this plugin declares and applies.
3
+ *
4
+ * Named once here rather than spelled as literals in the tool and again in the
5
+ * applier: the two halves are in different files and a typo between them
6
+ * produces a proposal nothing can carry out — which surfaces only when a human
7
+ * clicks Accept, long after the mistake.
8
+ *
9
+ * They are namespaced like tool names for the same reason MCP tools are
10
+ * (ADR-0005 §8): the registry refuses a duplicate `kind`, so a flat name like
11
+ * `update` would be a collision waiting for the second plugin that wants it.
12
+ */
13
+ export declare const CONTENT_PROPOSAL_KINDS: {
14
+ /** A new draft entry of a content type. */
15
+ readonly createEntry: "content.entry.create";
16
+ /** A change to an existing entry's field values. */
17
+ readonly updateEntry: "content.entry.update";
18
+ /**
19
+ * A batch of creates and updates on one content type, carried out as one
20
+ * change.
21
+ *
22
+ * Its own kind rather than a repeated `createEntry`/`updateEntry`, because
23
+ * a proposal row is the receipt for **one tool call**: a batch that wrote
24
+ * itself as twelve rows would be twelve cards in the transcript for a
25
+ * change the user asked for once, and no row would say what the other
26
+ * eleven were.
27
+ */
28
+ readonly bulkSaveEntries: "content.entry.bulk-save";
29
+ };
30
+ //# sourceMappingURL=proposal-kinds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-kinds.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/proposal-kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;IAC/B,2CAA2C;;IAE3C,oDAAoD;;IAEpD;;;;;;;;;OASG;;CAEG,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTENT_PROPOSAL_KINDS = void 0;
4
+ /**
5
+ * The proposal kinds this plugin declares and applies.
6
+ *
7
+ * Named once here rather than spelled as literals in the tool and again in the
8
+ * applier: the two halves are in different files and a typo between them
9
+ * produces a proposal nothing can carry out — which surfaces only when a human
10
+ * clicks Accept, long after the mistake.
11
+ *
12
+ * They are namespaced like tool names for the same reason MCP tools are
13
+ * (ADR-0005 §8): the registry refuses a duplicate `kind`, so a flat name like
14
+ * `update` would be a collision waiting for the second plugin that wants it.
15
+ */
16
+ exports.CONTENT_PROPOSAL_KINDS = {
17
+ /** A new draft entry of a content type. */
18
+ createEntry: 'content.entry.create',
19
+ /** A change to an existing entry's field values. */
20
+ updateEntry: 'content.entry.update',
21
+ /**
22
+ * A batch of creates and updates on one content type, carried out as one
23
+ * change.
24
+ *
25
+ * Its own kind rather than a repeated `createEntry`/`updateEntry`, because
26
+ * a proposal row is the receipt for **one tool call**: a batch that wrote
27
+ * itself as twelve rows would be twelve cards in the transcript for a
28
+ * change the user asked for once, and no row would say what the other
29
+ * eleven were.
30
+ */
31
+ bulkSaveEntries: 'content.entry.bulk-save'
32
+ };
@@ -0,0 +1,56 @@
1
+ import { type OnModuleInit } from '@nestjs/common';
2
+ import { ToolRegistry } from '@orthacms/tools-server';
3
+ import type { ToolDefinition, ToolProvider } from '@orthacms/tools-server';
4
+ import type { ContentTypeRegistry } from '../registry/content-type-registry';
5
+ import { WorkspaceGrantsQuery } from '../content-types/queries/workspace-grants.query';
6
+ import { type RevisionStore } from '../revisions/application/ports/revision-store';
7
+ /**
8
+ * The content plugin's **version-history** tools — `admin_content_revisions` and
9
+ * `admin_content_diff`.
10
+ *
11
+ * A second provider rather than more methods on
12
+ * {@link ContentCopilotToolProvider}: revisions are their own feature folder
13
+ * with their own port, and the registry takes any number of providers, so the
14
+ * split costs one `register(...)` call and keeps each file about one thing.
15
+ *
16
+ * Both re-check the workspace's content grants for the same reason the entry
17
+ * tools do — the type name arrives from the *model*. The revision store is
18
+ * workspace-scoped on every read besides, so an entry id from another workspace
19
+ * reads as absent rather than as a leak.
20
+ */
21
+ export declare class RevisionCopilotToolProvider implements ToolProvider, OnModuleInit {
22
+ private readonly registry;
23
+ private readonly revisions;
24
+ private readonly grants;
25
+ private readonly toolRegistry?;
26
+ constructor(registry: ContentTypeRegistry, revisions: RevisionStore, grants: WorkspaceGrantsQuery, toolRegistry?: ToolRegistry | undefined);
27
+ /**
28
+ * Register with the shared tool registry once the DI graph is built —
29
+ * the same catalogue the MCP endpoint serves, narrowed to the `copilot`
30
+ * surface by each tool's `surfaces`. `@Optional()` because a deployment
31
+ * may run neither consumer, in which case these simply go unregistered.
32
+ */
33
+ onModuleInit(): void;
34
+ /** The two history tools, in the order the model sees them. */
35
+ tools(): readonly ToolDefinition[];
36
+ /**
37
+ * Resolves a model-supplied type name to a granted, registered type, or
38
+ * throws. Same uniform message as the entry tools, for the same reason:
39
+ * distinguishing "not granted" from "does not exist" would let a run in one
40
+ * workspace enumerate the deployment's other content types.
41
+ */
42
+ private resolveGranted;
43
+ /** `admin_content_revisions` — an entry's version timeline, newest first. */
44
+ private listRevisions;
45
+ /**
46
+ * `admin_content_diff` — what changed between two versions.
47
+ *
48
+ * The tool returns **only the changed fields**, plus a count of the
49
+ * unchanged ones. A full side-by-side of every field is what the admin's
50
+ * dialog renders, because a person wants unchanged rows for context; a
51
+ * model gets nothing from them but a bigger prompt, and on a wide type the
52
+ * unchanged richtext bodies alone would dominate the run's token budget.
53
+ */
54
+ private diffRevisions;
55
+ }
56
+ //# sourceMappingURL=revision-tool.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revision-tool.provider.d.ts","sourceRoot":"","sources":["../../../src/lib/copilot/revision-tool.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAEH,KAAK,aAAa,EACrB,MAAM,+CAA+C,CAAC;AAMvD;;;;;;;;;;;;;GAaG;AACH,qBACa,2BAA4B,YAAW,YAAY,EAAE,YAAY;IAGtE,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACX,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAJzB,QAAQ,EAAE,mBAAmB,EAE7B,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,oBAAoB,EAChB,YAAY,CAAC,EAAE,YAAY,YAAA;IAG5D;;;;;OAKG;IACH,YAAY,IAAI,IAAI;IAIpB,+DAA+D;IAC/D,KAAK,IAAI,SAAS,cAAc,EAAE;IAIlC;;;;;OAKG;YACW,cAAc;IAW5B,6EAA6E;IAC7E,OAAO,CAAC,aAAa;IA2ErB;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;CA0GxB"}
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RevisionCopilotToolProvider = 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 workspace_grants_query_1 = require("../content-types/queries/workspace-grants.query");
10
+ const revision_store_1 = require("../revisions/application/ports/revision-store");
11
+ const diff_snapshots_1 = require("./diff-snapshots");
12
+ /** Revisions a single `admin_content_revisions` call may return. */
13
+ const MAX_REVISION_PAGE_SIZE = 25;
14
+ /**
15
+ * The content plugin's **version-history** tools — `admin_content_revisions` and
16
+ * `admin_content_diff`.
17
+ *
18
+ * A second provider rather than more methods on
19
+ * {@link ContentCopilotToolProvider}: revisions are their own feature folder
20
+ * with their own port, and the registry takes any number of providers, so the
21
+ * split costs one `register(...)` call and keeps each file about one thing.
22
+ *
23
+ * Both re-check the workspace's content grants for the same reason the entry
24
+ * tools do — the type name arrives from the *model*. The revision store is
25
+ * workspace-scoped on every read besides, so an entry id from another workspace
26
+ * reads as absent rather than as a leak.
27
+ */
28
+ let RevisionCopilotToolProvider = class RevisionCopilotToolProvider {
29
+ registry;
30
+ revisions;
31
+ grants;
32
+ toolRegistry;
33
+ constructor(registry, revisions, grants, toolRegistry) {
34
+ this.registry = registry;
35
+ this.revisions = revisions;
36
+ this.grants = grants;
37
+ this.toolRegistry = toolRegistry;
38
+ }
39
+ /**
40
+ * Register with the shared tool registry once the DI graph is built —
41
+ * the same catalogue the MCP endpoint serves, narrowed to the `copilot`
42
+ * surface by each tool's `surfaces`. `@Optional()` because a deployment
43
+ * may run neither consumer, in which case these simply go unregistered.
44
+ */
45
+ onModuleInit() {
46
+ this.toolRegistry?.register(this);
47
+ }
48
+ /** The two history tools, in the order the model sees them. */
49
+ tools() {
50
+ return [this.listRevisions(), this.diffRevisions()];
51
+ }
52
+ /**
53
+ * Resolves a model-supplied type name to a granted, registered type, or
54
+ * throws. Same uniform message as the entry tools, for the same reason:
55
+ * distinguishing "not granted" from "does not exist" would let a run in one
56
+ * workspace enumerate the deployment's other content types.
57
+ */
58
+ async resolveGranted(typeName, workspaceId) {
59
+ const type = this.registry.get(typeName);
60
+ const granted = await this.grants.grantedSlugs(workspaceId);
61
+ if (!type || !granted.has(type.name)) {
62
+ throw new Error(`Unknown content type "${typeName}" in this workspace.`);
63
+ }
64
+ return type;
65
+ }
66
+ /** `admin_content_revisions` — an entry's version timeline, newest first. */
67
+ listRevisions() {
68
+ return {
69
+ name: 'admin_content_revisions',
70
+ title: 'List an entry’s versions',
71
+ description: 'List an entry’s saved versions, newest first — version number, status ' +
72
+ '(draft / published / superseded), when it was captured and by whom. Use this ' +
73
+ 'to answer “when did this change?” or “what version is live?”, and to find the ' +
74
+ 'two version numbers to pass to admin_content_diff. Each locale of a ' +
75
+ 'localized entry has its own timeline, keyed by that locale’s entry id.',
76
+ inputSchema: {
77
+ type: 'object',
78
+ properties: {
79
+ typeName: {
80
+ type: 'string',
81
+ description: 'The entry’s content type.'
82
+ },
83
+ id: {
84
+ type: 'string',
85
+ description: 'The entry’s id, as returned by admin_content_search.'
86
+ },
87
+ page: {
88
+ type: 'integer',
89
+ minimum: 1,
90
+ description: '1-based page number.'
91
+ },
92
+ pageSize: {
93
+ type: 'integer',
94
+ minimum: 1,
95
+ maximum: MAX_REVISION_PAGE_SIZE,
96
+ description: `Versions per page (max ${MAX_REVISION_PAGE_SIZE}).`
97
+ }
98
+ },
99
+ required: ['typeName', 'id'],
100
+ additionalProperties: false
101
+ },
102
+ requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
103
+ readOnly: true,
104
+ effect: 'read',
105
+ surfaces: ['copilot'],
106
+ handler: async (input, ctx) => {
107
+ const args = (input ?? {});
108
+ const type = await this.resolveGranted(args.typeName, ctx.workspaceId);
109
+ // Clamped in `run` as well as declared: the schema validator is
110
+ // defence in depth, not the boundary.
111
+ const pageSize = Math.min(Math.max(args.pageSize ?? 10, 1), MAX_REVISION_PAGE_SIZE);
112
+ const result = await this.revisions.list(type.name, args.id, ctx.workspaceId, Math.max(args.page ?? 1, 1), pageSize);
113
+ return {
114
+ ...result,
115
+ page: Math.max(args.page ?? 1, 1),
116
+ pageSize
117
+ };
118
+ }
119
+ };
120
+ }
121
+ /**
122
+ * `admin_content_diff` — what changed between two versions.
123
+ *
124
+ * The tool returns **only the changed fields**, plus a count of the
125
+ * unchanged ones. A full side-by-side of every field is what the admin's
126
+ * dialog renders, because a person wants unchanged rows for context; a
127
+ * model gets nothing from them but a bigger prompt, and on a wide type the
128
+ * unchanged richtext bodies alone would dominate the run's token budget.
129
+ */
130
+ diffRevisions() {
131
+ return {
132
+ name: 'admin_content_diff',
133
+ title: 'Compare two versions',
134
+ description: 'Compare two saved versions of an entry and report which fields differ, with ' +
135
+ 'the before and after value of each. Only changed fields are returned (the ' +
136
+ 'number of unchanged ones is reported separately). Get the version numbers ' +
137
+ 'from admin_content_revisions.',
138
+ inputSchema: {
139
+ type: 'object',
140
+ properties: {
141
+ typeName: {
142
+ type: 'string',
143
+ description: 'The entry’s content type.'
144
+ },
145
+ id: { type: 'string', description: 'The entry’s id.' },
146
+ from: {
147
+ type: 'integer',
148
+ minimum: 1,
149
+ description: 'The older version number — the baseline to compare against.'
150
+ },
151
+ to: {
152
+ type: 'integer',
153
+ minimum: 1,
154
+ description: 'The newer version number.'
155
+ }
156
+ },
157
+ required: ['typeName', 'id', 'from', 'to'],
158
+ additionalProperties: false
159
+ },
160
+ requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
161
+ readOnly: true,
162
+ effect: 'read',
163
+ surfaces: ['copilot'],
164
+ handler: async (input, ctx) => {
165
+ const args = (input ?? {});
166
+ const type = await this.resolveGranted(args.typeName, ctx.workspaceId);
167
+ const [before, after] = await Promise.all([
168
+ this.revisions.get(type.name, args.id, ctx.workspaceId, args.from),
169
+ this.revisions.get(type.name, args.id, ctx.workspaceId, args.to)
170
+ ]);
171
+ // Naming the missing one matters: "version 7 does not exist"
172
+ // is recoverable by re-reading the timeline, "not found" is
173
+ // not. Neither reveals anything — the store is already
174
+ // workspace-scoped, so an entry the caller cannot reach has no
175
+ // versions to enumerate either.
176
+ const missing = [
177
+ ...(before ? [] : [args.from]),
178
+ ...(after ? [] : [args.to])
179
+ ];
180
+ if (!before || !after) {
181
+ throw new Error(`No version ${missing.join(' or ')} of this entry.`);
182
+ }
183
+ // `serialize` is `T | undefined` for an unregistered name;
184
+ // `resolveGranted` already proved this one is registered, so
185
+ // the fallback is unreachable rather than a real branch — an
186
+ // empty field list would diff to "nothing changed", which is
187
+ // why it isn't left implicit.
188
+ const schema = this.registry.serialize(type.name);
189
+ if (!schema) {
190
+ throw new Error(`Unknown content type "${args.typeName}" in this workspace.`);
191
+ }
192
+ const { changes, unchangedFields } = (0, diff_snapshots_1.diffSnapshots)(schema, before.snapshot, after.snapshot);
193
+ return {
194
+ typeName: type.name,
195
+ from: {
196
+ number: before.number,
197
+ createdAt: before.createdAt
198
+ },
199
+ to: { number: after.number, createdAt: after.createdAt },
200
+ changes,
201
+ unchangedFields
202
+ };
203
+ }
204
+ };
205
+ }
206
+ };
207
+ exports.RevisionCopilotToolProvider = RevisionCopilotToolProvider;
208
+ exports.RevisionCopilotToolProvider = RevisionCopilotToolProvider = tslib_1.__decorate([
209
+ (0, common_1.Injectable)(),
210
+ tslib_1.__param(0, (0, content_tokens_1.InjectContentRegistry)()),
211
+ tslib_1.__param(1, (0, revision_store_1.InjectRevisionStore)()),
212
+ tslib_1.__param(3, (0, common_1.Optional)()),
213
+ tslib_1.__metadata("design:paramtypes", [Function, Object, workspace_grants_query_1.WorkspaceGrantsQuery,
214
+ tools_server_1.ToolRegistry])
215
+ ], RevisionCopilotToolProvider);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The OpenAPI schemas this plugin contributes: one set **per registered content
3
+ * type** (generated from the registry) plus the fixed shapes its routes share.
4
+ *
5
+ * Content types are code-defined runtime data, not decorated classes, so
6
+ * `@nestjs/swagger` cannot see them. This module is how they become visible.
7
+ */
8
+ import type { SerializedContentType } from '../registry/content-type-registry';
9
+ import { type OpenApiSchema } from './field-schema';
10
+ /** Schema names of one content type's generated trio. */
11
+ export interface TypeSchemaNames {
12
+ /** The `values` bag — one property per column-backed field. */
13
+ values: string;
14
+ /** One entry: the storage envelope wrapping {@link values}. */
15
+ entry: string;
16
+ /** One page of entries. */
17
+ listPage: string;
18
+ }
19
+ /** `#/components/schemas/<name>`. */
20
+ export declare function ref(name: string): OpenApiSchema;
21
+ /**
22
+ * `article` → `Article`, `seo_meta` → `SeoMeta`. Content-type names are
23
+ * snake_case machine names; schema names are the PascalCase convention the rest
24
+ * of the document uses.
25
+ */
26
+ export declare function pascalCase(name: string): string;
27
+ /** The three schema names a content type contributes. */
28
+ export declare function schemaNamesOf(type: SerializedContentType): TypeSchemaNames;
29
+ /**
30
+ * Every schema this plugin contributes: the shared shapes plus, for each
31
+ * registered content type, its `Values` / `Entry` / `ListPage` trio.
32
+ */
33
+ export declare function buildContentSchemas(types: readonly SerializedContentType[]): Record<string, OpenApiSchema>;
34
+ //# sourceMappingURL=content-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/docs/content-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/E,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC5B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAKD,qCAAqC;AACrC,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,IAAI,EAAE,qBAAqB,GAAG,eAAe,CAO1E;AAomBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,SAAS,qBAAqB,EAAE,GACxC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAS/B"}