@orthacms/content-server 0.4.2 → 0.5.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 (246) hide show
  1. package/dist/index.d.ts +16 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +41 -1
  4. package/dist/lib/content.module.d.ts.map +1 -1
  5. package/dist/lib/content.module.js +31 -1
  6. package/dist/lib/copilot/entry-proposal.applier.d.ts.map +1 -1
  7. package/dist/lib/copilot/entry-proposal.applier.js +5 -4
  8. package/dist/lib/docs/describe-content-api.d.ts +7 -0
  9. package/dist/lib/docs/describe-content-api.d.ts.map +1 -1
  10. package/dist/lib/docs/describe-content-api.js +177 -53
  11. package/dist/lib/docs/describe-views-api.d.ts +19 -0
  12. package/dist/lib/docs/describe-views-api.d.ts.map +1 -0
  13. package/dist/lib/docs/describe-views-api.js +76 -0
  14. package/dist/lib/docs/field-schema.d.ts.map +1 -1
  15. package/dist/lib/docs/field-schema.js +36 -2
  16. package/dist/lib/docs/openapi-writer.d.ts +49 -0
  17. package/dist/lib/docs/openapi-writer.d.ts.map +1 -0
  18. package/dist/lib/docs/openapi-writer.js +76 -0
  19. package/dist/lib/docs/public-api-schemas.d.ts +45 -0
  20. package/dist/lib/docs/public-api-schemas.d.ts.map +1 -0
  21. package/dist/lib/docs/public-api-schemas.js +377 -0
  22. package/dist/lib/docs/views-schemas.d.ts +22 -0
  23. package/dist/lib/docs/views-schemas.d.ts.map +1 -0
  24. package/dist/lib/docs/views-schemas.js +156 -0
  25. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts +8 -2
  26. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts.map +1 -1
  27. package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.js +19 -4
  28. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts +2 -2
  29. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts.map +1 -1
  30. package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.js +14 -4
  31. package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts +6 -8
  32. package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts.map +1 -1
  33. package/dist/lib/entries/application/use-cases/publish-entry.use-case.js +10 -4
  34. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts +2 -5
  35. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts.map +1 -1
  36. package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.js +6 -1
  37. package/dist/lib/entries/domain/entry.d.ts +8 -1
  38. package/dist/lib/entries/domain/entry.d.ts.map +1 -1
  39. package/dist/lib/entries/domain/entry.js +12 -12
  40. package/dist/lib/entries/domain/events/entry-events.d.ts +47 -5
  41. package/dist/lib/entries/domain/events/entry-events.d.ts.map +1 -1
  42. package/dist/lib/entries/domain/events/entry-events.js +26 -10
  43. package/dist/lib/entries/entries.constants.d.ts +10 -2
  44. package/dist/lib/entries/entries.constants.d.ts.map +1 -1
  45. package/dist/lib/entries/entries.constants.js +11 -2
  46. package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts +2 -2
  47. package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts.map +1 -1
  48. package/dist/lib/entries/http/controllers/bulk-entries.controller.js +8 -6
  49. package/dist/lib/entries/http/controllers/create-entry.controller.d.ts.map +1 -1
  50. package/dist/lib/entries/http/controllers/create-entry.controller.js +1 -1
  51. package/dist/lib/entries/http/controllers/update-entry.controller.d.ts.map +1 -1
  52. package/dist/lib/entries/http/controllers/update-entry.controller.js +1 -1
  53. package/dist/lib/entries/http/dto/extension-bag.validator.d.ts +14 -0
  54. package/dist/lib/entries/http/dto/extension-bag.validator.d.ts.map +1 -0
  55. package/dist/lib/entries/http/dto/extension-bag.validator.js +42 -0
  56. package/dist/lib/entries/http/dto/save-entry.dto.d.ts +16 -0
  57. package/dist/lib/entries/http/dto/save-entry.dto.d.ts.map +1 -1
  58. package/dist/lib/entries/http/dto/save-entry.dto.js +30 -0
  59. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts +50 -8
  60. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts.map +1 -1
  61. package/dist/lib/entries/infrastructure/persistence/entry-writer.service.js +183 -32
  62. package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts +38 -5
  63. package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts.map +1 -1
  64. package/dist/lib/entries/infrastructure/persistence/relation-link.service.js +38 -6
  65. package/dist/lib/entries/infrastructure/queries/entries.service.d.ts +3 -1
  66. package/dist/lib/entries/infrastructure/queries/entries.service.d.ts.map +1 -1
  67. package/dist/lib/entries/infrastructure/queries/entries.service.js +17 -5
  68. package/dist/lib/entries/infrastructure/queries/entry-match.query.d.ts +82 -0
  69. package/dist/lib/entries/infrastructure/queries/entry-match.query.d.ts.map +1 -0
  70. package/dist/lib/entries/infrastructure/queries/entry-match.query.js +152 -0
  71. package/dist/lib/extension/entry-filter-provider.d.ts +79 -0
  72. package/dist/lib/extension/entry-filter-provider.d.ts.map +1 -0
  73. package/dist/lib/extension/entry-filter-provider.js +149 -0
  74. package/dist/lib/extension/entry-write-extension.d.ts +185 -0
  75. package/dist/lib/extension/entry-write-extension.d.ts.map +1 -0
  76. package/dist/lib/extension/entry-write-extension.js +182 -0
  77. package/dist/lib/extension/read-scope.d.ts +107 -0
  78. package/dist/lib/extension/read-scope.d.ts.map +1 -0
  79. package/dist/lib/extension/read-scope.js +131 -0
  80. package/dist/lib/insights/docs/describe-content-insights-api.d.ts +23 -0
  81. package/dist/lib/insights/docs/describe-content-insights-api.d.ts.map +1 -0
  82. package/dist/lib/insights/docs/describe-content-insights-api.js +329 -0
  83. package/dist/lib/mcp/content-tools.provider.d.ts.map +1 -1
  84. package/dist/lib/mcp/content-tools.provider.js +10 -9
  85. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts +14 -13
  86. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts.map +1 -1
  87. package/dist/lib/public-api/http/controllers/public-entry-writes.controller.js +62 -46
  88. package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts.map +1 -1
  89. package/dist/lib/public-api/http/guards/api-token-workspace.guard.js +8 -0
  90. package/dist/lib/public-api/infrastructure/public-entries.query.d.ts +14 -1
  91. package/dist/lib/public-api/infrastructure/public-entries.query.d.ts.map +1 -1
  92. package/dist/lib/public-api/infrastructure/public-entries.query.js +20 -3
  93. package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts +10 -9
  94. package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts.map +1 -1
  95. package/dist/lib/public-api/infrastructure/public-entry-writes.service.js +23 -24
  96. package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts +16 -4
  97. package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts.map +1 -1
  98. package/dist/lib/public-api/infrastructure/public-expansion.query.js +29 -9
  99. package/dist/lib/public-api/infrastructure/token-actor.d.ts +37 -0
  100. package/dist/lib/public-api/infrastructure/token-actor.d.ts.map +1 -0
  101. package/dist/lib/public-api/infrastructure/token-actor.js +58 -0
  102. package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts.map +1 -1
  103. package/dist/lib/revisions/application/use-cases/restore-revision.use-case.js +23 -1
  104. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts +7 -1
  105. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts.map +1 -1
  106. package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.js +9 -2
  107. package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.d.ts +28 -0
  108. package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.d.ts.map +1 -0
  109. package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.js +52 -0
  110. package/dist/lib/revisions/types/revision-view.d.ts +11 -0
  111. package/dist/lib/revisions/types/revision-view.d.ts.map +1 -1
  112. package/dist/lib/utils/content-plugin.d.ts.map +1 -1
  113. package/dist/lib/utils/content-plugin.js +10 -1
  114. package/dist/lib/utils/content-views-plugin.d.ts +28 -0
  115. package/dist/lib/utils/content-views-plugin.d.ts.map +1 -0
  116. package/dist/lib/utils/content-views-plugin.js +37 -0
  117. package/dist/lib/views/application/queries/saved-views.query.d.ts +16 -0
  118. package/dist/lib/views/application/queries/saved-views.query.d.ts.map +1 -0
  119. package/dist/lib/views/application/queries/saved-views.query.js +46 -0
  120. package/dist/lib/views/application/saved-view-access.service.d.ts +30 -0
  121. package/dist/lib/views/application/saved-view-access.service.d.ts.map +1 -0
  122. package/dist/lib/views/application/saved-view-access.service.js +55 -0
  123. package/dist/lib/views/application/use-cases/create-saved-view.use-case.d.ts +30 -0
  124. package/dist/lib/views/application/use-cases/create-saved-view.use-case.d.ts.map +1 -0
  125. package/dist/lib/views/application/use-cases/create-saved-view.use-case.js +81 -0
  126. package/dist/lib/views/application/use-cases/delete-saved-view.use-case.d.ts +18 -0
  127. package/dist/lib/views/application/use-cases/delete-saved-view.use-case.d.ts.map +1 -0
  128. package/dist/lib/views/application/use-cases/delete-saved-view.use-case.js +56 -0
  129. package/dist/lib/views/application/use-cases/set-default-view.use-case.d.ts +23 -0
  130. package/dist/lib/views/application/use-cases/set-default-view.use-case.d.ts.map +1 -0
  131. package/dist/lib/views/application/use-cases/set-default-view.use-case.js +51 -0
  132. package/dist/lib/views/application/use-cases/update-saved-view.use-case.d.ts +24 -0
  133. package/dist/lib/views/application/use-cases/update-saved-view.use-case.d.ts.map +1 -0
  134. package/dist/lib/views/application/use-cases/update-saved-view.use-case.js +90 -0
  135. package/dist/lib/views/application/view-scope.service.d.ts +25 -0
  136. package/dist/lib/views/application/view-scope.service.d.ts.map +1 -0
  137. package/dist/lib/views/application/view-scope.service.js +45 -0
  138. package/dist/lib/views/content-views.module.d.ts +22 -0
  139. package/dist/lib/views/content-views.module.d.ts.map +1 -0
  140. package/dist/lib/views/content-views.module.js +63 -0
  141. package/dist/lib/views/domain/errors/index.d.ts +6 -0
  142. package/dist/lib/views/domain/errors/index.d.ts.map +1 -0
  143. package/dist/lib/views/domain/errors/index.js +12 -0
  144. package/dist/lib/views/domain/errors/saved-view-forbidden.error.d.ts +10 -0
  145. package/dist/lib/views/domain/errors/saved-view-forbidden.error.d.ts.map +1 -0
  146. package/dist/lib/views/domain/errors/saved-view-forbidden.error.js +16 -0
  147. package/dist/lib/views/domain/errors/saved-view-limit-error.d.ts +9 -0
  148. package/dist/lib/views/domain/errors/saved-view-limit-error.d.ts.map +1 -0
  149. package/dist/lib/views/domain/errors/saved-view-limit-error.js +16 -0
  150. package/dist/lib/views/domain/errors/saved-view-name-taken.error.d.ts +5 -0
  151. package/dist/lib/views/domain/errors/saved-view-name-taken.error.d.ts.map +1 -0
  152. package/dist/lib/views/domain/errors/saved-view-name-taken.error.js +11 -0
  153. package/dist/lib/views/domain/errors/saved-view-not-found.error.d.ts +9 -0
  154. package/dist/lib/views/domain/errors/saved-view-not-found.error.d.ts.map +1 -0
  155. package/dist/lib/views/domain/errors/saved-view-not-found.error.js +15 -0
  156. package/dist/lib/views/domain/events/saved-view-events.d.ts +28 -0
  157. package/dist/lib/views/domain/events/saved-view-events.d.ts.map +1 -0
  158. package/dist/lib/views/domain/events/saved-view-events.js +38 -0
  159. package/dist/lib/views/domain/saved-view.d.ts +66 -0
  160. package/dist/lib/views/domain/saved-view.d.ts.map +1 -0
  161. package/dist/lib/views/domain/saved-view.js +18 -0
  162. package/dist/lib/views/domain/saved-view.repository.d.ts +77 -0
  163. package/dist/lib/views/domain/saved-view.repository.d.ts.map +1 -0
  164. package/dist/lib/views/domain/saved-view.repository.js +5 -0
  165. package/dist/lib/views/http/controllers/saved-views.controller.d.ts +45 -0
  166. package/dist/lib/views/http/controllers/saved-views.controller.d.ts.map +1 -0
  167. package/dist/lib/views/http/controllers/saved-views.controller.js +216 -0
  168. package/dist/lib/views/http/controllers/to-http-error.d.ts +10 -0
  169. package/dist/lib/views/http/controllers/to-http-error.d.ts.map +1 -0
  170. package/dist/lib/views/http/controllers/to-http-error.js +26 -0
  171. package/dist/lib/views/http/dto/save-view.dto.d.ts +54 -0
  172. package/dist/lib/views/http/dto/save-view.dto.d.ts.map +1 -0
  173. package/dist/lib/views/http/dto/save-view.dto.js +230 -0
  174. package/dist/lib/views/http/dto/view-payload.validator.d.ts +20 -0
  175. package/dist/lib/views/http/dto/view-payload.validator.d.ts.map +1 -0
  176. package/dist/lib/views/http/dto/view-payload.validator.js +52 -0
  177. package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.d.ts +26 -0
  178. package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.d.ts.map +1 -0
  179. package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.js +135 -0
  180. package/dist/lib/views/infrastructure/schema/external-refs.d.ts +68 -0
  181. package/dist/lib/views/infrastructure/schema/external-refs.d.ts.map +1 -0
  182. package/dist/lib/views/infrastructure/schema/external-refs.js +29 -0
  183. package/dist/lib/views/infrastructure/schema/index.d.ts +8 -0
  184. package/dist/lib/views/infrastructure/schema/index.d.ts.map +1 -0
  185. package/dist/lib/views/infrastructure/schema/index.js +13 -0
  186. package/dist/lib/views/infrastructure/schema/saved-views.d.ts +275 -0
  187. package/dist/lib/views/infrastructure/schema/saved-views.d.ts.map +1 -0
  188. package/dist/lib/views/infrastructure/schema/saved-views.js +87 -0
  189. package/dist/lib/views/views.constants.d.ts +26 -0
  190. package/dist/lib/views/views.constants.d.ts.map +1 -0
  191. package/dist/lib/views/views.constants.js +28 -0
  192. package/dist/lib/views/views.tokens.d.ts +17 -0
  193. package/dist/lib/views/views.tokens.d.ts.map +1 -0
  194. package/dist/lib/views/views.tokens.js +21 -0
  195. package/migrations/0000_saved_views.sql +29 -0
  196. package/migrations/meta/0000_snapshot.json +256 -0
  197. package/migrations/meta/_journal.json +13 -0
  198. package/package.json +13 -12
  199. package/dist/lib/entries/controllers/bulk-entries.controller.d.ts +0 -26
  200. package/dist/lib/entries/controllers/bulk-entries.controller.d.ts.map +0 -1
  201. package/dist/lib/entries/controllers/create-entry.controller.d.ts +0 -20
  202. package/dist/lib/entries/controllers/create-entry.controller.d.ts.map +0 -1
  203. package/dist/lib/entries/controllers/delete-entry.controller.d.ts +0 -24
  204. package/dist/lib/entries/controllers/delete-entry.controller.d.ts.map +0 -1
  205. package/dist/lib/entries/controllers/get-entry.controller.d.ts +0 -34
  206. package/dist/lib/entries/controllers/get-entry.controller.d.ts.map +0 -1
  207. package/dist/lib/entries/controllers/list-entries.controller.d.ts +0 -20
  208. package/dist/lib/entries/controllers/list-entries.controller.d.ts.map +0 -1
  209. package/dist/lib/entries/controllers/publish-entry.controller.d.ts +0 -19
  210. package/dist/lib/entries/controllers/publish-entry.controller.d.ts.map +0 -1
  211. package/dist/lib/entries/controllers/resolve-type.d.ts +0 -9
  212. package/dist/lib/entries/controllers/resolve-type.d.ts.map +0 -1
  213. package/dist/lib/entries/controllers/update-entry.controller.d.ts +0 -18
  214. package/dist/lib/entries/controllers/update-entry.controller.d.ts.map +0 -1
  215. package/dist/lib/entries/dto/bulk-ids.dto.d.ts +0 -11
  216. package/dist/lib/entries/dto/bulk-ids.dto.d.ts.map +0 -1
  217. package/dist/lib/entries/dto/list-entries-query.dto.d.ts +0 -46
  218. package/dist/lib/entries/dto/list-entries-query.dto.d.ts.map +0 -1
  219. package/dist/lib/entries/dto/relation-delta-map.validator.d.ts +0 -19
  220. package/dist/lib/entries/dto/relation-delta-map.validator.d.ts.map +0 -1
  221. package/dist/lib/entries/dto/save-entry.dto.d.ts +0 -46
  222. package/dist/lib/entries/dto/save-entry.dto.d.ts.map +0 -1
  223. package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts +0 -24
  224. package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts.map +0 -1
  225. package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts +0 -40
  226. package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts.map +0 -1
  227. package/dist/lib/entries/services/entries.service.d.ts +0 -59
  228. package/dist/lib/entries/services/entries.service.d.ts.map +0 -1
  229. package/dist/lib/entries/services/entry-counter.service.d.ts +0 -31
  230. package/dist/lib/entries/services/entry-counter.service.d.ts.map +0 -1
  231. package/dist/lib/entries/services/entry-filter-schema.d.ts +0 -32
  232. package/dist/lib/entries/services/entry-filter-schema.d.ts.map +0 -1
  233. package/dist/lib/entries/services/entry-row.d.ts +0 -56
  234. package/dist/lib/entries/services/entry-row.d.ts.map +0 -1
  235. package/dist/lib/entries/services/entry-writer.service.d.ts +0 -193
  236. package/dist/lib/entries/services/entry-writer.service.d.ts.map +0 -1
  237. package/dist/lib/entries/services/relation-link.service.d.ts +0 -115
  238. package/dist/lib/entries/services/relation-link.service.d.ts.map +0 -1
  239. package/dist/lib/extension/per-locale-relation.d.ts +0 -18
  240. package/dist/lib/extension/per-locale-relation.d.ts.map +0 -1
  241. package/dist/lib/public/controllers/get-public-entry.controller.d.ts +0 -26
  242. package/dist/lib/public/controllers/get-public-entry.controller.d.ts.map +0 -1
  243. package/dist/lib/public/controllers/list-public-entries.controller.d.ts +0 -24
  244. package/dist/lib/public/controllers/list-public-entries.controller.d.ts.map +0 -1
  245. package/dist/lib/public/controllers/public-schema.controller.d.ts +0 -18
  246. package/dist/lib/public/controllers/public-schema.controller.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  /** Public API of @orthacms/content-server. */
2
2
  export { ContentPlugin } from './lib/utils/content-plugin';
3
3
  export type { ContentPluginOptions, ContentServerPlugin } from './lib/utils/content-plugin';
4
+ export { ContentViewsPlugin } from './lib/utils/content-views-plugin';
5
+ export type { ContentViewsPluginOptions } from './lib/utils/content-views-plugin';
6
+ export { ContentViewsModule } from './lib/views/content-views.module';
7
+ export { savedViews, savedViewDefaults, viewVisibility } from './lib/views/infrastructure/schema';
8
+ export { VIEW_VISIBILITY, VIEW_VISIBILITY_VALUES } from './lib/views/domain/saved-view';
9
+ export type { SavedView, SavedViewPayload, ViewVisibility } from './lib/views/domain/saved-view';
4
10
  export { collection, single, joinTableOf } from './lib/collection/define';
5
11
  export { field } from './lib/fields';
6
12
  export { ContentModule } from './lib/content.module';
@@ -12,12 +18,21 @@ export { ContentGrantGuard } from './lib/entries/http/guards/content-grant.guard
12
18
  export { CONTENT_ENTRY_EXTENSION } from './lib/extension/entry-extension';
13
19
  export type { ContentEntryExtension, EntryFilterContext, EntryFilterExtension, EntryScopeParams, EntryTransaction, EntryWriteContext, EntryWriteFanout } from './lib/extension/entry-extension';
14
20
  export { RELATION_LOCALE_SYNC, relationLocaleSync, isPerLocaleField, isJoinBackedRelation, type RelationLocaleSync } from './lib/extension/relation-locale-sync';
21
+ export { ContentReadScopeRegistry, contentReadScopeRegistrar } from './lib/extension/read-scope';
22
+ export type { ContentReadScope, ContentReadScopeContext } from './lib/extension/read-scope';
23
+ export { EntryWriteExtensionRegistry, entryWriteExtensionRegistrar } from './lib/extension/entry-write-extension';
24
+ export type { EntryWriteExtension, EntryWriteExtensionInput, EntryWriteExtensionTarget } from './lib/extension/entry-write-extension';
25
+ export { EntryFilterProviderRegistry, entryFilterProviderRegistrar } from './lib/extension/entry-filter-provider';
26
+ export type { EntryFilterProvider } from './lib/extension/entry-filter-provider';
27
+ export type { DbTransaction } from './lib/entries/infrastructure/persistence/relation-link.service';
15
28
  export { MEDIA_ASSET_RESOLVER, InjectMediaAssetResolver } from './lib/extension/media-asset-resolver';
16
29
  export type { MediaAssetResolver, ResolvedMediaAsset } from './lib/extension/media-asset-resolver';
17
30
  export { toColumns, toRecord } from './lib/entries/infrastructure/persistence/entry-row';
18
31
  export type { EntryListView, EntryMediaView, EntryRecord, MediaRef } from './lib/entries/types/entry-list-view';
19
32
  export { ContentTypeRegistry } from './lib/registry/content-type-registry';
20
33
  export type { SerializedContentType, SerializedContentTypeSummary, SerializedField } from './lib/registry/content-type-registry';
34
+ export { EntryMatchQuery } from './lib/entries/infrastructure/queries/entry-match.query';
35
+ export type { EntryMatchOptions } from './lib/entries/infrastructure/queries/entry-match.query';
21
36
  export { EntryValidationService } from './lib/validation/services/entry-validation.service';
22
37
  export type { ValidationIssue, ValidationResult } from './lib/validation/services/entry-validation.service';
23
38
  export { CONTENT_TYPE_KIND, ENTRY_STATUS } from './lib/types/content-type';
@@ -46,4 +61,5 @@ export type { PublicMediaFieldView, PublicMediaRef, PublicRelationFieldView } fr
46
61
  export { DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE, BULK_MAX_SAVE_ITEMS } from './lib/entries/entries.constants';
47
62
  export { RELATION_DELTA_ADDRESSING } from './lib/entries/types/entry-list-view';
48
63
  export type { RelationDelta, RelationDeltaAddressing } from './lib/entries/types/entry-list-view';
64
+ export { toTokenActor, toToolEventActor } from './lib/public-api/infrastructure/token-actor';
49
65
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EACR,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAO/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAO1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AAInG,OAAO,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC;AAOrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EA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,EACR,mBAAmB,EACnB,WAAW,EACd,MAAM,wDAAwD,CAAC;AAChE,OAAO,EACH,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,OAAO,EACP,uBAAuB,EAC1B,MAAM,yDAAyD,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAKrF,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,YAAY,EACR,UAAU,EACV,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACR,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACH,iBAAiB,EACjB,aAAa,EAIb,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,YAAY,EACR,aAAa,EACb,uBAAuB,EAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,YAAY,EACZ,gBAAgB,EACnB,MAAM,6CAA6C,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,24 @@
1
1
  "use strict";
2
2
  /** Public API of @orthacms/content-server. */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RELATION_DELTA_ADDRESSING = exports.BULK_MAX_SAVE_ITEMS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.BULK_SAVE_OP = exports.PublicBulkSaveItemDto = exports.PublicBulkSaveDto = exports.PublicBulkIdsDto = exports.PublicSaveEntryDto = exports.DEFAULT_EXPANSION_LIMIT = exports.PREVIEW = exports.ENTRY_VISIBILITY = exports.PublicListEntriesQueryDto = exports.PublicEntryQueryDto = exports.resolveGrantedType = exports.PublicEntryWritesService = exports.PublicEntriesQuery = exports.CurrentApiToken = exports.ApiTokenWorkspaceGuard = exports.ApiTokenGuard = exports.MEDIA_KIND_VALUES = exports.CONTENT_FIELD_TYPE = exports.ENTRY_STATUS = exports.CONTENT_TYPE_KIND = exports.EntryValidationService = exports.ContentTypeRegistry = exports.toRecord = exports.toColumns = exports.InjectMediaAssetResolver = exports.MEDIA_ASSET_RESOLVER = exports.isJoinBackedRelation = exports.isPerLocaleField = exports.relationLocaleSync = exports.RELATION_LOCALE_SYNC = exports.CONTENT_ENTRY_EXTENSION = exports.ContentGrantGuard = exports.RelationLinkService = exports.EntryWriterService = exports.WorkspaceGrantsQuery = exports.InjectContentRegistry = exports.CONTENT_REGISTRY = exports.ContentModule = exports.field = exports.joinTableOf = exports.single = exports.collection = exports.ContentPlugin = void 0;
4
+ exports.ENTRY_VISIBILITY = exports.PublicListEntriesQueryDto = exports.PublicEntryQueryDto = exports.resolveGrantedType = exports.PublicEntryWritesService = exports.PublicEntriesQuery = exports.CurrentApiToken = exports.ApiTokenWorkspaceGuard = exports.ApiTokenGuard = exports.MEDIA_KIND_VALUES = exports.CONTENT_FIELD_TYPE = exports.ENTRY_STATUS = exports.CONTENT_TYPE_KIND = exports.EntryValidationService = exports.EntryMatchQuery = exports.ContentTypeRegistry = exports.toRecord = exports.toColumns = exports.InjectMediaAssetResolver = exports.MEDIA_ASSET_RESOLVER = exports.entryFilterProviderRegistrar = exports.EntryFilterProviderRegistry = exports.entryWriteExtensionRegistrar = exports.EntryWriteExtensionRegistry = exports.contentReadScopeRegistrar = exports.ContentReadScopeRegistry = exports.isJoinBackedRelation = exports.isPerLocaleField = exports.relationLocaleSync = exports.RELATION_LOCALE_SYNC = exports.CONTENT_ENTRY_EXTENSION = exports.ContentGrantGuard = exports.RelationLinkService = exports.EntryWriterService = exports.WorkspaceGrantsQuery = exports.InjectContentRegistry = exports.CONTENT_REGISTRY = exports.ContentModule = exports.field = exports.joinTableOf = exports.single = exports.collection = exports.VIEW_VISIBILITY_VALUES = exports.VIEW_VISIBILITY = exports.viewVisibility = exports.savedViewDefaults = exports.savedViews = exports.ContentViewsModule = exports.ContentViewsPlugin = exports.ContentPlugin = void 0;
5
+ exports.toToolEventActor = exports.toTokenActor = exports.RELATION_DELTA_ADDRESSING = exports.BULK_MAX_SAVE_ITEMS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.BULK_SAVE_OP = exports.PublicBulkSaveItemDto = exports.PublicBulkSaveDto = exports.PublicBulkIdsDto = exports.PublicSaveEntryDto = exports.DEFAULT_EXPANSION_LIMIT = exports.PREVIEW = void 0;
5
6
  var content_plugin_1 = require("./lib/utils/content-plugin");
6
7
  Object.defineProperty(exports, "ContentPlugin", { enumerable: true, get: function () { return content_plugin_1.ContentPlugin; } });
8
+ // Saved list views. A second `ServerPlugin` entry from this package because
9
+ // `ServerPlugin.migrations` holds one descriptor and content's is already the
10
+ // HOST's generated collection tables — see `content-views-plugin.ts`.
11
+ var content_views_plugin_1 = require("./lib/utils/content-views-plugin");
12
+ Object.defineProperty(exports, "ContentViewsPlugin", { enumerable: true, get: function () { return content_views_plugin_1.ContentViewsPlugin; } });
13
+ var content_views_module_1 = require("./lib/views/content-views.module");
14
+ Object.defineProperty(exports, "ContentViewsModule", { enumerable: true, get: function () { return content_views_module_1.ContentViewsModule; } });
15
+ var schema_1 = require("./lib/views/infrastructure/schema");
16
+ Object.defineProperty(exports, "savedViews", { enumerable: true, get: function () { return schema_1.savedViews; } });
17
+ Object.defineProperty(exports, "savedViewDefaults", { enumerable: true, get: function () { return schema_1.savedViewDefaults; } });
18
+ Object.defineProperty(exports, "viewVisibility", { enumerable: true, get: function () { return schema_1.viewVisibility; } });
19
+ var saved_view_1 = require("./lib/views/domain/saved-view");
20
+ Object.defineProperty(exports, "VIEW_VISIBILITY", { enumerable: true, get: function () { return saved_view_1.VIEW_VISIBILITY; } });
21
+ Object.defineProperty(exports, "VIEW_VISIBILITY_VALUES", { enumerable: true, get: function () { return saved_view_1.VIEW_VISIBILITY_VALUES; } });
7
22
  var define_1 = require("./lib/collection/define");
8
23
  Object.defineProperty(exports, "collection", { enumerable: true, get: function () { return define_1.collection; } });
9
24
  Object.defineProperty(exports, "single", { enumerable: true, get: function () { return define_1.single; } });
@@ -48,6 +63,23 @@ Object.defineProperty(exports, "RELATION_LOCALE_SYNC", { enumerable: true, get:
48
63
  Object.defineProperty(exports, "relationLocaleSync", { enumerable: true, get: function () { return relation_locale_sync_1.relationLocaleSync; } });
49
64
  Object.defineProperty(exports, "isPerLocaleField", { enumerable: true, get: function () { return relation_locale_sync_1.isPerLocaleField; } });
50
65
  Object.defineProperty(exports, "isJoinBackedRelation", { enumerable: true, get: function () { return relation_locale_sync_1.isJoinBackedRelation; } });
66
+ // The read-scope port. Separate from CONTENT_ENTRY_EXTENSION on purpose — that
67
+ // one is single-binding and i18n holds it; see the file header for why a
68
+ // composite was the wrong shape here.
69
+ var read_scope_1 = require("./lib/extension/read-scope");
70
+ Object.defineProperty(exports, "ContentReadScopeRegistry", { enumerable: true, get: function () { return read_scope_1.ContentReadScopeRegistry; } });
71
+ Object.defineProperty(exports, "contentReadScopeRegistrar", { enumerable: true, get: function () { return read_scope_1.contentReadScopeRegistrar; } });
72
+ // The entry-write extension port — how a plugin stores state *about* an entry
73
+ // inside the entry's own write transaction, and has it captured by (and restored
74
+ // from) the entry's own version history.
75
+ var entry_write_extension_1 = require("./lib/extension/entry-write-extension");
76
+ Object.defineProperty(exports, "EntryWriteExtensionRegistry", { enumerable: true, get: function () { return entry_write_extension_1.EntryWriteExtensionRegistry; } });
77
+ Object.defineProperty(exports, "entryWriteExtensionRegistrar", { enumerable: true, get: function () { return entry_write_extension_1.entryWriteExtensionRegistrar; } });
78
+ // The virtual filter-field registry — how a plugin other than the single bound
79
+ // `CONTENT_ENTRY_EXTENSION` adds fields to a type's `?filter=` surface.
80
+ var entry_filter_provider_1 = require("./lib/extension/entry-filter-provider");
81
+ Object.defineProperty(exports, "EntryFilterProviderRegistry", { enumerable: true, get: function () { return entry_filter_provider_1.EntryFilterProviderRegistry; } });
82
+ Object.defineProperty(exports, "entryFilterProviderRegistrar", { enumerable: true, get: function () { return entry_filter_provider_1.entryFilterProviderRegistrar; } });
51
83
  var media_asset_resolver_1 = require("./lib/extension/media-asset-resolver");
52
84
  Object.defineProperty(exports, "MEDIA_ASSET_RESOLVER", { enumerable: true, get: function () { return media_asset_resolver_1.MEDIA_ASSET_RESOLVER; } });
53
85
  Object.defineProperty(exports, "InjectMediaAssetResolver", { enumerable: true, get: function () { return media_asset_resolver_1.InjectMediaAssetResolver; } });
@@ -58,6 +90,11 @@ Object.defineProperty(exports, "toColumns", { enumerable: true, get: function ()
58
90
  Object.defineProperty(exports, "toRecord", { enumerable: true, get: function () { return entry_row_1.toRecord; } });
59
91
  var content_type_registry_1 = require("./lib/registry/content-type-registry");
60
92
  Object.defineProperty(exports, "ContentTypeRegistry", { enumerable: true, get: function () { return content_type_registry_1.ContentTypeRegistry; } });
93
+ // Filter evaluation over a content type, exported for `@orthacms/alarms-server`:
94
+ // an alarm rule IS a records-list filter, so it must be parsed and translated
95
+ // by the same surface the list uses rather than by a second implementation.
96
+ var entry_match_query_1 = require("./lib/entries/infrastructure/queries/entry-match.query");
97
+ Object.defineProperty(exports, "EntryMatchQuery", { enumerable: true, get: function () { return entry_match_query_1.EntryMatchQuery; } });
61
98
  var entry_validation_service_1 = require("./lib/validation/services/entry-validation.service");
62
99
  Object.defineProperty(exports, "EntryValidationService", { enumerable: true, get: function () { return entry_validation_service_1.EntryValidationService; } });
63
100
  var content_type_1 = require("./lib/types/content-type");
@@ -114,3 +151,6 @@ Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: functio
114
151
  Object.defineProperty(exports, "BULK_MAX_SAVE_ITEMS", { enumerable: true, get: function () { return entries_constants_1.BULK_MAX_SAVE_ITEMS; } });
115
152
  var entry_list_view_1 = require("./lib/entries/types/entry-list-view");
116
153
  Object.defineProperty(exports, "RELATION_DELTA_ADDRESSING", { enumerable: true, get: function () { return entry_list_view_1.RELATION_DELTA_ADDRESSING; } });
154
+ var token_actor_1 = require("./lib/public-api/infrastructure/token-actor");
155
+ Object.defineProperty(exports, "toTokenActor", { enumerable: true, get: function () { return token_actor_1.toTokenActor; } });
156
+ Object.defineProperty(exports, "toToolEventActor", { enumerable: true, get: function () { return token_actor_1.toToolEventActor; } });
@@ -1 +1 @@
1
- {"version":3,"file":"content.module.d.ts","sourceRoot":"","sources":["../../src/lib/content.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAOvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AA4D5E;;;;;;;;;;;;;GAaG;AACH,qBACa,aAAa;IACtB,qEAAqE;IACrE,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,GAAG,aAAa;CA0L/D"}
1
+ {"version":3,"file":"content.module.d.ts","sourceRoot":"","sources":["../../src/lib/content.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAOvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAiE5E;;;;;;;;;;;;;GAaG;AACH,qBACa,aAAa;IACtB,qEAAqE;IACrE,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,GAAG,aAAa;CAmN/D"}
@@ -10,6 +10,9 @@ const list_content_schema_controller_1 = require("./content-types/controllers/li
10
10
  const get_content_schema_controller_1 = require("./content-types/controllers/get-content-schema.controller");
11
11
  const get_filter_fields_controller_1 = require("./content-types/controllers/get-filter-fields.controller");
12
12
  const workspace_grants_query_1 = require("./content-types/queries/workspace-grants.query");
13
+ const read_scope_1 = require("./extension/read-scope");
14
+ const entry_write_extension_1 = require("./extension/entry-write-extension");
15
+ const entry_filter_provider_1 = require("./extension/entry-filter-provider");
13
16
  const content_grant_guard_1 = require("./entries/http/guards/content-grant.guard");
14
17
  const list_entries_controller_1 = require("./entries/http/controllers/list-entries.controller");
15
18
  const bulk_entries_controller_1 = require("./entries/http/controllers/bulk-entries.controller");
@@ -26,6 +29,7 @@ const entry_proposal_provider_1 = require("./copilot/entry-proposal.provider");
26
29
  const entry_proposal_applier_1 = require("./copilot/entry-proposal.applier");
27
30
  const entry_validation_service_1 = require("./validation/services/entry-validation.service");
28
31
  const entries_service_1 = require("./entries/infrastructure/queries/entries.service");
32
+ const entry_match_query_1 = require("./entries/infrastructure/queries/entry-match.query");
29
33
  const media_refs_query_1 = require("./entries/infrastructure/queries/media-refs.query");
30
34
  const entry_writer_service_1 = require("./entries/infrastructure/persistence/entry-writer.service");
31
35
  const entry_counter_service_1 = require("./entries/infrastructure/persistence/entry-counter.service");
@@ -40,6 +44,7 @@ const drizzle_revision_store_1 = require("./revisions/infrastructure/persistence
40
44
  const restore_revision_use_case_1 = require("./revisions/application/use-cases/restore-revision.use-case");
41
45
  const publish_revision_use_case_1 = require("./revisions/application/use-cases/publish-revision.use-case");
42
46
  const revision_refs_query_1 = require("./revisions/infrastructure/queries/revision-refs.query");
47
+ const revisions_workspace_purger_1 = require("./revisions/infrastructure/purge/revisions-workspace.purger");
43
48
  const revisions_controller_1 = require("./revisions/http/controllers/revisions.controller");
44
49
  const restore_revision_controller_1 = require("./revisions/http/controllers/restore-revision.controller");
45
50
  const publish_revision_controller_1 = require("./revisions/http/controllers/publish-revision.controller");
@@ -150,10 +155,20 @@ let ContentModule = ContentModule_1 = class ContentModule {
150
155
  },
151
156
  entry_validation_service_1.EntryValidationService,
152
157
  workspace_grants_query_1.WorkspaceGrantsQuery,
158
+ // Holds the read scopes a downstream plugin registers. Provided
159
+ // (and exported) unconditionally: an empty registry is what an
160
+ // installation with no scoping plugin has, and it costs a
161
+ // length check per read.
162
+ read_scope_1.ContentReadScopeRegistry,
163
+ entry_write_extension_1.EntryWriteExtensionRegistry,
164
+ entry_filter_provider_1.EntryFilterProviderRegistry,
153
165
  // Every registry-driven `content/:typeName` route is guarded by
154
166
  // it, so it is resolved from this module's context.
155
167
  content_grant_guard_1.ContentGrantGuard,
156
168
  entries_service_1.EntriesService,
169
+ // Filter evaluation as a reusable question ('which entries match
170
+ // this tree?'), exported for `@orthacms/alarms-server`.
171
+ entry_match_query_1.EntryMatchQuery,
157
172
  content_insights_query_1.ContentInsightsQuery,
158
173
  // Resolves media field ids → display refs (thumbnails); injected
159
174
  // by the entry-media read endpoint and the revision refs query.
@@ -170,6 +185,13 @@ let ContentModule = ContentModule_1 = class ContentModule {
170
185
  // Resolves a previewed revision's relation ids to display refs
171
186
  // (the "exact linked records" the diff shows).
172
187
  revision_refs_query_1.RevisionRefsQuery,
188
+ // Removes a deleted workspace's revision history. Content
189
+ // otherwise refuses rather than purges, but revisions escape
190
+ // that protection in both directions: no FK to `workspaces`,
191
+ // and `countWorkspaceEntries` sums live entry tables only — so
192
+ // a workspace whose entries were all deleted counts as empty,
193
+ // deletes cleanly, and strands its whole version timeline.
194
+ revisions_workspace_purger_1.RevisionsWorkspacePurger,
173
195
  entry_writer_service_1.EntryWriterService,
174
196
  relation_link_service_1.RelationLinkService,
175
197
  // Entries feature, layered per ADR-0003: the publish-lifecycle
@@ -239,6 +261,9 @@ let ContentModule = ContentModule_1 = class ContentModule {
239
261
  // workspace's grants — and there must be exactly one
240
262
  // implementation of that check, not one per binder.
241
263
  workspace_grants_query_1.WorkspaceGrantsQuery,
264
+ read_scope_1.ContentReadScopeRegistry,
265
+ entry_write_extension_1.EntryWriteExtensionRegistry,
266
+ entry_filter_provider_1.EntryFilterProviderRegistry,
242
267
  public_entries_query_1.PublicEntriesQuery,
243
268
  public_entry_writes_service_1.PublicEntryWritesService,
244
269
  api_token_guard_1.ApiTokenGuard,
@@ -253,7 +278,12 @@ let ContentModule = ContentModule_1 = class ContentModule {
253
278
  // and it has to be through the same service the entries
254
279
  // pipeline writes with — a second implementation of the join
255
280
  // table's ordering and de-duplication is how the two drift.
256
- relation_link_service_1.RelationLinkService
281
+ relation_link_service_1.RelationLinkService,
282
+ // Filter evaluation, for the alarms plugin: a stored rule is a
283
+ // records-list filter, and it has to keep meaning exactly what
284
+ // the list showed when it was saved. Sharing the query is what
285
+ // makes that structural instead of aspirational.
286
+ entry_match_query_1.EntryMatchQuery
257
287
  ]
258
288
  };
259
289
  }
@@ -1 +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,O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AAK,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"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BulkSaveEntriesProposalApplier = exports.UpdateEntryProposalApplier = exports.CreateEntryProposalApplier = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const copilot_server_1 = require("@orthacms/copilot-server");
5
6
  const common_1 = require("@nestjs/common");
6
7
  const content_tokens_1 = require("../content.tokens");
7
8
  const entry_writer_service_1 = require("../entries/infrastructure/persistence/entry-writer.service");
@@ -83,7 +84,7 @@ let CreateEntryProposalApplier = class CreateEntryProposalApplier {
83
84
  // The human who accepted is the actor on the write, on its revision
84
85
  // and on the domain event it raises — never a copilot identity,
85
86
  // which does not exist.
86
- { id: actor.userId, email: actor.actorEmail });
87
+ (0, copilot_server_1.proposalEventActor)(actor));
87
88
  return {
88
89
  entityId: entry.id,
89
90
  detail: { typeName: type.name, status: entry.status ?? 'draft' }
@@ -134,7 +135,7 @@ let UpdateEntryProposalApplier = class UpdateEntryProposalApplier {
134
135
  const current = await this.writer.getOne(type, entryId, actor.workspaceId);
135
136
  const patch = (input.patch['values'] ?? {});
136
137
  const merged = { ...(current.values ?? {}), ...patch };
137
- const entry = await this.writer.update(type, entryId, merged, actor.workspaceId, undefined, { id: actor.userId, email: actor.actorEmail });
138
+ const entry = await this.writer.update(type, entryId, merged, actor.workspaceId, undefined, (0, copilot_server_1.proposalEventActor)(actor));
138
139
  return {
139
140
  entityId: entry.id,
140
141
  detail: {
@@ -201,7 +202,7 @@ let BulkSaveEntriesProposalApplier = class BulkSaveEntriesProposalApplier {
201
202
  // become — the same merge rule the single-entry applier
202
203
  // states at length.
203
204
  const current = await this.writer.getOne(type, id, actor.workspaceId);
204
- const entry = await this.writer.update(type, id, { ...(current.values ?? {}), ...values }, actor.workspaceId, undefined, { id: actor.userId, email: actor.actorEmail });
205
+ const entry = await this.writer.update(type, id, { ...(current.values ?? {}), ...values }, actor.workspaceId, undefined, (0, copilot_server_1.proposalEventActor)(actor));
205
206
  updated.push(entry.id);
206
207
  }
207
208
  else {
@@ -210,7 +211,7 @@ let BulkSaveEntriesProposalApplier = class BulkSaveEntriesProposalApplier {
210
211
  ? item.locale
211
212
  : undefined,
212
213
  // No group to join — see `assertStartsItsOwnGroup`.
213
- undefined, { id: actor.userId, email: actor.actorEmail });
214
+ undefined, (0, copilot_server_1.proposalEventActor)(actor));
214
215
  created.push(entry.id);
215
216
  }
216
217
  }
@@ -11,6 +11,13 @@
11
11
  *
12
12
  * Pure: it takes the document and the serialized types, and mutates only the
13
13
  * paths this plugin owns.
14
+ *
15
+ * Two surfaces, described separately. `/api/content/...` is the admin's and
16
+ * `/api/v1/content/...` is the published one, and they answer in different
17
+ * shapes where their spellings agree — a public relation preview carries whole
18
+ * entries, the admin's carries refs. Describing both from one table is not a
19
+ * shortcut but a bug, and was one: the public routes were reported with the
20
+ * admin's schemas until {@link PUBLIC_ENTRY_ROUTES} existed.
14
21
  */
15
22
  import type { OpenApiDocument } from '@orthacms/bootstrap-server';
16
23
  import type { SerializedContentType } from '../registry/content-type-registry';
@@ -1 +1 @@
1
- {"version":3,"file":"describe-content-api.d.ts","sourceRoot":"","sources":["../../../src/lib/docs/describe-content-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAuJ/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,SAAS,qBAAqB,EAAE,GACxC,IAAI,CA2EN"}
1
+ {"version":3,"file":"describe-content-api.d.ts","sourceRoot":"","sources":["../../../src/lib/docs/describe-content-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAqP/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,SAAS,qBAAqB,EAAE,GACxC,IAAI,CAgIN"}
@@ -12,10 +12,19 @@
12
12
  *
13
13
  * Pure: it takes the document and the serialized types, and mutates only the
14
14
  * paths this plugin owns.
15
+ *
16
+ * Two surfaces, described separately. `/api/content/...` is the admin's and
17
+ * `/api/v1/content/...` is the published one, and they answer in different
18
+ * shapes where their spellings agree — a public relation preview carries whole
19
+ * entries, the admin's carries refs. Describing both from one table is not a
20
+ * shortcut but a bug, and was one: the public routes were reported with the
21
+ * admin's schemas until {@link PUBLIC_ENTRY_ROUTES} existed.
15
22
  */
16
23
  Object.defineProperty(exports, "__esModule", { value: true });
17
24
  exports.describeContentApi = describeContentApi;
18
25
  const content_schemas_1 = require("./content-schemas");
26
+ const public_api_schemas_1 = require("./public-api-schemas");
27
+ const openapi_writer_1 = require("./openapi-writer");
19
28
  /** The entry read/write shorthands, since most operations return one. */
20
29
  const ENTRY = { response: { kind: 'entry' } };
21
30
  const VALIDATED_ENTRY = {
@@ -23,6 +32,25 @@ const VALIDATED_ENTRY = {
23
32
  validated: true
24
33
  };
25
34
  const EMPTY = { response: { kind: 'empty' } };
35
+ /**
36
+ * A route another plugin mounts under one of this plugin's `{typeName}`
37
+ * prefixes — transfer's export/import, segments' `/access`.
38
+ *
39
+ * Listed so the `typeName` parameter still gets the registered-name enum: which
40
+ * names are valid there is *this* plugin's contract, and the registry is the
41
+ * only thing that knows them, so leaving the parameter an opaque string would
42
+ * be leaving a gap nothing else can fill.
43
+ *
44
+ * Nothing else is touched. The response body and the failure codes belong to
45
+ * whichever plugin serves the route, and they genuinely differ — transfer 404s
46
+ * an unknown type, the public `/access` route answers 400 — so writing this
47
+ * plugin's usual 404 onto them from here would publish something the API does
48
+ * not do.
49
+ */
50
+ const FOREIGN = {
51
+ response: { kind: 'empty' },
52
+ ownedElsewhere: true
53
+ };
26
54
  /** An operation returning one of the fixed shared schemas. */
27
55
  function shared(name) {
28
56
  return { response: { kind: 'schema', name } };
@@ -50,7 +78,14 @@ const ENTRY_ROUTES = {
50
78
  '/bulk/unpublish': { post: shared('BulkActionResult') },
51
79
  '/bulk/delete': { post: shared('BulkActionResult') },
52
80
  '/bulk/restore': { post: shared('BulkActionResult') },
53
- '/bulk/purge': { post: shared('BulkActionResult') }
81
+ '/bulk/purge': { post: shared('BulkActionResult') },
82
+ // Mounted here by `@orthacms/transfer-server`, which describes their
83
+ // bodies; see {@link FOREIGN}.
84
+ '/export': { post: FOREIGN },
85
+ '/export/preview': { post: FOREIGN },
86
+ '/import': { post: FOREIGN },
87
+ '/import/preview': { post: FOREIGN },
88
+ '/import/template': { get: FOREIGN }
54
89
  };
55
90
  /** Schema routes, keyed by what follows `/content-schema`. */
56
91
  const SCHEMA_ROUTES = {
@@ -58,58 +93,107 @@ const SCHEMA_ROUTES = {
58
93
  '/{name}': { get: shared('ContentTypeSchema') },
59
94
  '/{name}/filter-fields': { get: shared('FilterFields') }
60
95
  };
61
- /** Matches `<prefix>/content/{typeName}<rest>`. */
96
+ /**
97
+ * Public entry routes, keyed by what follows `/v1/content/{typeName}`.
98
+ *
99
+ * A separate table from {@link ENTRY_ROUTES} rather than an extension of it,
100
+ * because the two surfaces answer in **different shapes** on the paths they
101
+ * spell the same way: a public relation page carries whole entries where the
102
+ * admin's carries `RelationRef`s, and a public media read is keyed to
103
+ * `{ items, total }` where the admin's is keyed to a bare array. One table
104
+ * matching both spellings is what put the admin's answer on the public routes
105
+ * in the first place.
106
+ *
107
+ * Every read exists twice — once under `/{id}`, once under
108
+ * `/group/{localeGroupId}` — because a localized front-end carries the stable
109
+ * group id and a `?locale=`, not a per-locale id map. The two spellings funnel
110
+ * into one handler, so they are listed with one shape apiece and cannot drift.
111
+ */
112
+ const PUBLIC_ENTRY_ROUTES = {
113
+ '': { get: { response: { kind: 'listPage' } }, post: VALIDATED_ENTRY },
114
+ '/{id}': { get: ENTRY, patch: VALIDATED_ENTRY, delete: EMPTY },
115
+ '/{id}/media': { get: shared('PublicEntryMedia') },
116
+ '/{id}/relations/{field}': { get: shared('PublicRelationFieldPage') },
117
+ '/{id}/translations': { get: shared('PublicEntryTranslations') },
118
+ '/{id}/publish': { post: VALIDATED_ENTRY },
119
+ '/{id}/unpublish': { post: ENTRY },
120
+ '/group/{localeGroupId}': {
121
+ get: ENTRY,
122
+ patch: VALIDATED_ENTRY,
123
+ delete: EMPTY
124
+ },
125
+ '/group/{localeGroupId}/media': { get: shared('PublicEntryMedia') },
126
+ '/group/{localeGroupId}/relations/{field}': {
127
+ get: shared('PublicRelationFieldPage')
128
+ },
129
+ '/group/{localeGroupId}/translations': {
130
+ get: shared('PublicEntryTranslations')
131
+ },
132
+ '/group/{localeGroupId}/publish': { post: VALIDATED_ENTRY },
133
+ '/group/{localeGroupId}/unpublish': { post: ENTRY },
134
+ '/bulk': { post: shared('PublicBulkSaveResult') },
135
+ // The batch publish/unpublish/delete run the very same use-cases the
136
+ // admin's do, so they answer in the admin's shapes — deliberately, and
137
+ // documented as such in `types/public-bulk.ts`.
138
+ '/bulk/publish': { post: shared('BulkPublishResult') },
139
+ '/bulk/unpublish': { post: shared('BulkActionResult') },
140
+ '/bulk/delete': { post: shared('BulkActionResult') },
141
+ // Mounted here by `@orthacms/segments-server`, which describes its bodies;
142
+ // see {@link FOREIGN}.
143
+ '/{id}/access': { get: FOREIGN, put: FOREIGN }
144
+ };
145
+ /** Public discovery routes, keyed by what follows `/v1/content-types`. */
146
+ const PUBLIC_TYPES_ROUTES = {
147
+ '': { get: shared('PublicContentTypeList') },
148
+ '/{name}': { get: shared('ContentTypeSchema') }
149
+ };
150
+ /** Matches `<prefix>/v1/content/{typeName}<rest>`. */
151
+ const PUBLIC_ENTRY_ROUTE_RE = /\/v1\/content\/\{typeName\}(.*)$/;
152
+ /** Matches `<prefix>/v1/content-types<rest>`. */
153
+ const PUBLIC_TYPES_ROUTE_RE = /\/v1\/content-types(.*)$/;
154
+ /**
155
+ * Matches `<prefix>/content/{typeName}<rest>`.
156
+ *
157
+ * It matches the `/v1/` spelling too, which is why the public patterns are
158
+ * tried **first** and win: this pattern silently claiming the public routes is
159
+ * exactly how the admin's schemas ended up on the published contract.
160
+ */
62
161
  const ENTRY_ROUTE_RE = /\/content\/\{typeName\}(.*)$/;
63
162
  /** Matches `<prefix>/content-schema<rest>`. */
64
163
  const SCHEMA_ROUTE_RE = /\/content-schema(.*)$/;
65
164
  /**
66
- * Writes a success response's schema onto whichever 2xx key the scanner already
67
- * emitted (Nest's default is 201 for `@Post`, 200 elsewhere, and a `@HttpCode`
68
- * moves it), so this never invents a status code the API doesn't return.
165
+ * Constrains the `typeName` path param to the registered type names.
166
+ *
167
+ * The note about what an unknown name answers is only added for this plugin's
168
+ * own routes: on a {@link FOREIGN} one the owning plugin decides, and two of
169
+ * them do not agree with each other, let alone with this one.
69
170
  */
70
- function setSuccessResponse(operation, schema, description) {
71
- const responses = operation.responses ?? {};
72
- const key = Object.keys(responses).find((code) => /^2\d\d$/.test(code));
73
- if (!key || key === '204') {
74
- return;
75
- }
76
- responses[key] = {
77
- description,
78
- content: { 'application/json': { schema } }
79
- };
80
- operation.responses = responses;
81
- }
82
- /** Adds a documented failure response, leaving any existing one alone. */
83
- function addErrorResponse(operation, code, description, schema) {
84
- const responses = operation.responses ?? {};
85
- if (responses[code]) {
86
- return;
87
- }
88
- responses[code] = {
89
- description,
90
- ...(schema ? { content: { 'application/json': { schema } } } : {})
91
- };
92
- operation.responses = responses;
93
- }
94
- /** Constrains the `typeName` path param to the registered type names. */
95
- function describeTypeNameParam(operation, typeNames) {
171
+ function describeTypeNameParam(operation, typeNames, ownedElsewhere = false) {
96
172
  const parameter = operation.parameters?.find((candidate) => candidate.name === 'typeName' && candidate.in === 'path');
97
173
  if (!parameter) {
98
174
  return;
99
175
  }
100
176
  parameter.schema = { type: 'string', enum: typeNames };
101
- parameter.description =
102
- 'Machine name of the content type. Unknown (or not granted to the workspace) is a 404.';
177
+ parameter.description = ownedElsewhere
178
+ ? 'Machine name of the content type, resolved through the same registry the content routes use.'
179
+ : 'Machine name of the content type. Unknown (or not granted to the workspace) is a 404.';
103
180
  }
104
181
  /**
105
- * `oneOf` the per-type schemas — the response shape depends on `typeName`,
106
- * which OpenAPI can't express as a dependency, so the alternatives are listed.
182
+ * The per-type schemas as alternatives — the response shape depends on
183
+ * `typeName`, which OpenAPI cannot express as a dependency, so they are listed.
107
184
  * A single registered type needs no union.
185
+ *
186
+ * `anyOf`, **not** `oneOf`: the alternatives are not mutually exclusive. Two
187
+ * content types with compatible envelopes both validate the same page (an empty
188
+ * `items` array matches every list schema there is), and `oneOf` means *exactly
189
+ * one*, so the honest-looking operator turns a correct response into a
190
+ * validation failure. Measured: `GET /api/v1/content/home_page` matched two
191
+ * branches and was therefore rejected by its own document.
108
192
  */
109
193
  function unionOf(names) {
110
194
  return names.length === 1
111
195
  ? (0, content_schemas_1.ref)(names[0])
112
- : { oneOf: names.map((name) => (0, content_schemas_1.ref)(name)) };
196
+ : { anyOf: names.map((name) => (0, content_schemas_1.ref)(name)) };
113
197
  }
114
198
  /**
115
199
  * Adds this plugin's schemas to `document` and describes its own operations:
@@ -119,18 +203,49 @@ function describeContentApi(document, types) {
119
203
  document.components ??= {};
120
204
  document.components.schemas ??= {};
121
205
  Object.assign(document.components.schemas, (0, content_schemas_1.buildContentSchemas)(types));
206
+ Object.assign(document.components.schemas, (0, public_api_schemas_1.buildPublicApiSchemas)(types));
122
207
  const typeNames = types.map((type) => type.name);
123
- const entryUnion = unionOf(types.map((type) => (0, content_schemas_1.schemaNamesOf)(type).entry));
124
- const listUnion = unionOf(types.map((type) => (0, content_schemas_1.schemaNamesOf)(type).listPage));
208
+ /** The admin surface's per-type unions. */
209
+ const admin = {
210
+ routes: ENTRY_ROUTES,
211
+ entryUnion: unionOf(types.map((type) => (0, content_schemas_1.schemaNamesOf)(type).entry)),
212
+ listUnion: unionOf(types.map((type) => (0, content_schemas_1.schemaNamesOf)(type).listPage)),
213
+ typed: true
214
+ };
215
+ /** The public surface's, which are a different set of schemas entirely. */
216
+ const publicEntries = {
217
+ routes: PUBLIC_ENTRY_ROUTES,
218
+ entryUnion: (0, public_api_schemas_1.publicUnionOf)(types.map((type) => (0, public_api_schemas_1.publicSchemaNamesOf)(type).entry)),
219
+ listUnion: (0, public_api_schemas_1.publicUnionOf)(types.map((type) => (0, public_api_schemas_1.publicSchemaNamesOf)(type).listPage)),
220
+ typed: true
221
+ };
222
+ const adminSchema = { routes: SCHEMA_ROUTES, typed: false };
223
+ const publicSchema = { routes: PUBLIC_TYPES_ROUTES, typed: false };
224
+ // Order matters: the public patterns are tried first because
225
+ // `ENTRY_ROUTE_RE` also matches the `/v1/` spelling, and letting it win
226
+ // there is what used to write the admin's relation and media shapes onto
227
+ // the published contract.
228
+ const surfaces = [
229
+ [PUBLIC_ENTRY_ROUTE_RE, publicEntries],
230
+ [PUBLIC_TYPES_ROUTE_RE, publicSchema],
231
+ [ENTRY_ROUTE_RE, admin],
232
+ [SCHEMA_ROUTE_RE, adminSchema]
233
+ ];
125
234
  for (const [route, item] of Object.entries(document.paths)) {
126
- const entryMatch = ENTRY_ROUTE_RE.exec(route);
127
- const schemaMatch = SCHEMA_ROUTE_RE.exec(route);
128
- const rest = (entryMatch ?? schemaMatch)?.[1];
129
- if (rest === undefined) {
235
+ let rest;
236
+ let surface;
237
+ for (const [pattern, candidate] of surfaces) {
238
+ const match = pattern.exec(route);
239
+ if (match) {
240
+ rest = match[1];
241
+ surface = candidate;
242
+ break;
243
+ }
244
+ }
245
+ if (rest === undefined || !surface) {
130
246
  continue;
131
247
  }
132
- const routes = entryMatch ? ENTRY_ROUTES : SCHEMA_ROUTES;
133
- const byMethod = routes[rest];
248
+ const byMethod = surface.routes[rest];
134
249
  if (!byMethod) {
135
250
  continue;
136
251
  }
@@ -139,11 +254,16 @@ function describeContentApi(document, types) {
139
254
  if (!spec || !operation || typeof operation !== 'object') {
140
255
  continue;
141
256
  }
142
- if (entryMatch) {
143
- describeTypeNameParam(operation, typeNames);
144
- addErrorResponse(operation, '404', 'Unknown content type, or no entry with this id in the workspace.');
257
+ if (surface.typed) {
258
+ describeTypeNameParam(operation, typeNames, spec.ownedElsewhere);
259
+ }
260
+ if (spec.ownedElsewhere) {
261
+ continue;
262
+ }
263
+ if (surface.typed) {
264
+ (0, openapi_writer_1.addErrorResponse)(operation, '404', 'Unknown content type, or no entry with this id in the workspace.');
145
265
  if (spec.validated) {
146
- addErrorResponse(operation, '422', 'The values failed the content type’s field validation.', {
266
+ (0, openapi_writer_1.addErrorResponse)(operation, '422', 'The values failed the content type’s field validation.', {
147
267
  type: 'object',
148
268
  properties: {
149
269
  message: { type: 'string' },
@@ -159,14 +279,18 @@ function describeContentApi(document, types) {
159
279
  // With no registered types there is no entry shape to describe —
160
280
  // and every one of these routes 404s anyway.
161
281
  const { response } = spec;
162
- if (response.kind === 'entry' && typeNames.length) {
163
- setSuccessResponse(operation, entryUnion, 'The entry.');
282
+ if (response.kind === 'entry' &&
283
+ typeNames.length &&
284
+ surface.entryUnion) {
285
+ (0, openapi_writer_1.setSuccessResponse)(operation, surface.entryUnion, 'The entry.');
164
286
  }
165
- else if (response.kind === 'listPage' && typeNames.length) {
166
- setSuccessResponse(operation, listUnion, 'One page of entries.');
287
+ else if (response.kind === 'listPage' &&
288
+ typeNames.length &&
289
+ surface.listUnion) {
290
+ (0, openapi_writer_1.setSuccessResponse)(operation, surface.listUnion, 'One page of entries.');
167
291
  }
168
292
  else if (response.kind === 'schema') {
169
- setSuccessResponse(operation, (0, content_schemas_1.ref)(response.name), 'OK.');
293
+ (0, openapi_writer_1.setSuccessResponse)(operation, (0, content_schemas_1.ref)(response.name), 'OK.');
170
294
  }
171
295
  }
172
296
  }