@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.
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/define.d.ts +17 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +28 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/lib/collection/define.d.ts +35 -0
- package/dist/lib/collection/define.d.ts.map +1 -0
- package/dist/lib/collection/define.js +217 -0
- package/dist/lib/collection/table-builder.d.ts +28 -0
- package/dist/lib/collection/table-builder.d.ts.map +1 -0
- package/dist/lib/collection/table-builder.js +306 -0
- package/dist/lib/content-types/controllers/get-content-schema.controller.d.ts +24 -0
- package/dist/lib/content-types/controllers/get-content-schema.controller.d.ts.map +1 -0
- package/dist/lib/content-types/controllers/get-content-schema.controller.js +58 -0
- package/dist/lib/content-types/controllers/get-filter-fields.controller.d.ts +35 -0
- package/dist/lib/content-types/controllers/get-filter-fields.controller.d.ts.map +1 -0
- package/dist/lib/content-types/controllers/get-filter-fields.controller.js +74 -0
- package/dist/lib/content-types/controllers/list-content-schema.controller.d.ts +15 -0
- package/dist/lib/content-types/controllers/list-content-schema.controller.d.ts.map +1 -0
- package/dist/lib/content-types/controllers/list-content-schema.controller.js +38 -0
- package/dist/lib/content-types/queries/workspace-grants.query.d.ts +25 -0
- package/dist/lib/content-types/queries/workspace-grants.query.d.ts.map +1 -0
- package/dist/lib/content-types/queries/workspace-grants.query.js +45 -0
- package/dist/lib/content.module.d.ts +21 -0
- package/dist/lib/content.module.d.ts.map +1 -0
- package/dist/lib/content.module.js +264 -0
- package/dist/lib/content.tokens.d.ts +5 -0
- package/dist/lib/content.tokens.d.ts.map +1 -0
- package/dist/lib/content.tokens.js +9 -0
- package/dist/lib/copilot/content-tool.provider.d.ts +64 -0
- package/dist/lib/copilot/content-tool.provider.d.ts.map +1 -0
- package/dist/lib/copilot/content-tool.provider.js +309 -0
- package/dist/lib/copilot/diff-snapshots.d.ts +42 -0
- package/dist/lib/copilot/diff-snapshots.d.ts.map +1 -0
- package/dist/lib/copilot/diff-snapshots.js +77 -0
- package/dist/lib/copilot/entry-proposal.applier.d.ts +89 -0
- package/dist/lib/copilot/entry-proposal.applier.d.ts.map +1 -0
- package/dist/lib/copilot/entry-proposal.applier.js +245 -0
- package/dist/lib/copilot/entry-proposal.provider.d.ts +157 -0
- package/dist/lib/copilot/entry-proposal.provider.d.ts.map +1 -0
- package/dist/lib/copilot/entry-proposal.provider.js +619 -0
- package/dist/lib/copilot/filter-schema.d.ts +61 -0
- package/dist/lib/copilot/filter-schema.d.ts.map +1 -0
- package/dist/lib/copilot/filter-schema.js +139 -0
- package/dist/lib/copilot/project-entry.d.ts +23 -0
- package/dist/lib/copilot/project-entry.d.ts.map +1 -0
- package/dist/lib/copilot/project-entry.js +36 -0
- package/dist/lib/copilot/proposal-kinds.d.ts +30 -0
- package/dist/lib/copilot/proposal-kinds.d.ts.map +1 -0
- package/dist/lib/copilot/proposal-kinds.js +32 -0
- package/dist/lib/copilot/revision-tool.provider.d.ts +56 -0
- package/dist/lib/copilot/revision-tool.provider.d.ts.map +1 -0
- package/dist/lib/copilot/revision-tool.provider.js +215 -0
- package/dist/lib/docs/content-schemas.d.ts +34 -0
- package/dist/lib/docs/content-schemas.d.ts.map +1 -0
- package/dist/lib/docs/content-schemas.js +617 -0
- package/dist/lib/docs/describe-content-api.d.ts +22 -0
- package/dist/lib/docs/describe-content-api.d.ts.map +1 -0
- package/dist/lib/docs/describe-content-api.js +173 -0
- package/dist/lib/docs/field-schema.d.ts +28 -0
- package/dist/lib/docs/field-schema.d.ts.map +1 -0
- package/dist/lib/docs/field-schema.js +214 -0
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts +23 -0
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts.map +1 -0
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.js +77 -0
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts +23 -0
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts.map +1 -0
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.js +66 -0
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts +43 -0
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts.map +1 -0
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.js +106 -0
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts +30 -0
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts.map +1 -0
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.js +70 -0
- package/dist/lib/entries/controllers/bulk-entries.controller.d.ts +26 -0
- package/dist/lib/entries/controllers/bulk-entries.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/create-entry.controller.d.ts +20 -0
- package/dist/lib/entries/controllers/create-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/delete-entry.controller.d.ts +24 -0
- package/dist/lib/entries/controllers/delete-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/get-entry.controller.d.ts +34 -0
- package/dist/lib/entries/controllers/get-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/list-entries.controller.d.ts +20 -0
- package/dist/lib/entries/controllers/list-entries.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/publish-entry.controller.d.ts +19 -0
- package/dist/lib/entries/controllers/publish-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/controllers/resolve-type.d.ts +9 -0
- package/dist/lib/entries/controllers/resolve-type.d.ts.map +1 -0
- package/dist/lib/entries/controllers/update-entry.controller.d.ts +18 -0
- package/dist/lib/entries/controllers/update-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/domain/entry-publish-blocked.error.d.ts +13 -0
- package/dist/lib/entries/domain/entry-publish-blocked.error.d.ts.map +1 -0
- package/dist/lib/entries/domain/entry-publish-blocked.error.js +19 -0
- package/dist/lib/entries/domain/entry.d.ts +71 -0
- package/dist/lib/entries/domain/entry.d.ts.map +1 -0
- package/dist/lib/entries/domain/entry.js +90 -0
- package/dist/lib/entries/domain/events/entry-events.d.ts +67 -0
- package/dist/lib/entries/domain/events/entry-events.d.ts.map +1 -0
- package/dist/lib/entries/domain/events/entry-events.js +100 -0
- package/dist/lib/entries/dto/bulk-ids.dto.d.ts +11 -0
- package/dist/lib/entries/dto/bulk-ids.dto.d.ts.map +1 -0
- package/dist/lib/entries/dto/list-entries-query.dto.d.ts +46 -0
- package/dist/lib/entries/dto/list-entries-query.dto.d.ts.map +1 -0
- package/dist/lib/entries/dto/relation-delta-map.validator.d.ts +19 -0
- package/dist/lib/entries/dto/relation-delta-map.validator.d.ts.map +1 -0
- package/dist/lib/entries/dto/save-entry.dto.d.ts +46 -0
- package/dist/lib/entries/dto/save-entry.dto.d.ts.map +1 -0
- package/dist/lib/entries/entries.constants.d.ts +19 -0
- package/dist/lib/entries/entries.constants.d.ts.map +1 -0
- package/dist/lib/entries/entries.constants.js +21 -0
- package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts +33 -0
- package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/bulk-entries.controller.js +143 -0
- package/dist/lib/entries/http/controllers/create-entry.controller.d.ts +21 -0
- package/dist/lib/entries/http/controllers/create-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/create-entry.controller.js +52 -0
- package/dist/lib/entries/http/controllers/delete-entry.controller.d.ts +25 -0
- package/dist/lib/entries/http/controllers/delete-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/delete-entry.controller.js +84 -0
- package/dist/lib/entries/http/controllers/get-entry.controller.d.ts +44 -0
- package/dist/lib/entries/http/controllers/get-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/get-entry.controller.js +124 -0
- package/dist/lib/entries/http/controllers/list-entries.controller.d.ts +20 -0
- package/dist/lib/entries/http/controllers/list-entries.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/list-entries.controller.js +52 -0
- package/dist/lib/entries/http/controllers/publish-entry.controller.d.ts +22 -0
- package/dist/lib/entries/http/controllers/publish-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/publish-entry.controller.js +68 -0
- package/dist/lib/entries/http/controllers/resolve-type.d.ts +9 -0
- package/dist/lib/entries/http/controllers/resolve-type.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/resolve-type.js +16 -0
- package/dist/lib/entries/http/controllers/to-actor.d.ts +13 -0
- package/dist/lib/entries/http/controllers/to-actor.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/to-actor.js +15 -0
- package/dist/lib/entries/http/controllers/update-entry.controller.d.ts +19 -0
- package/dist/lib/entries/http/controllers/update-entry.controller.d.ts.map +1 -0
- package/dist/lib/entries/http/controllers/update-entry.controller.js +51 -0
- package/dist/lib/entries/http/dto/bulk-ids.dto.d.ts +11 -0
- package/dist/lib/entries/http/dto/bulk-ids.dto.d.ts.map +1 -0
- package/dist/lib/entries/http/dto/bulk-ids.dto.js +33 -0
- package/dist/lib/entries/http/dto/list-entries-query.dto.d.ts +66 -0
- package/dist/lib/entries/http/dto/list-entries-query.dto.d.ts.map +1 -0
- package/dist/lib/entries/http/dto/list-entries-query.dto.js +192 -0
- package/dist/lib/entries/http/dto/relation-delta-map.validator.d.ts +30 -0
- package/dist/lib/entries/http/dto/relation-delta-map.validator.d.ts.map +1 -0
- package/dist/lib/entries/http/dto/relation-delta-map.validator.js +102 -0
- package/dist/lib/entries/http/dto/save-entry.dto.d.ts +48 -0
- package/dist/lib/entries/http/dto/save-entry.dto.d.ts.map +1 -0
- package/dist/lib/entries/http/dto/save-entry.dto.js +120 -0
- package/dist/lib/entries/http/guards/content-grant.guard.d.ts +37 -0
- package/dist/lib/entries/http/guards/content-grant.guard.d.ts.map +1 -0
- package/dist/lib/entries/http/guards/content-grant.guard.js +67 -0
- package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.d.ts +22 -0
- package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/bulk-publish-verdicts.js +81 -0
- package/dist/lib/entries/infrastructure/persistence/entry-counter.service.d.ts +42 -0
- package/dist/lib/entries/infrastructure/persistence/entry-counter.service.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/entry-counter.service.js +73 -0
- package/dist/lib/entries/infrastructure/persistence/entry-row.d.ts +56 -0
- package/dist/lib/entries/infrastructure/persistence/entry-row.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/entry-row.js +185 -0
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts +392 -0
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.js +1223 -0
- package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts +24 -0
- package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/media-accept.d.ts +23 -0
- package/dist/lib/entries/infrastructure/persistence/media-accept.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/media-accept.js +55 -0
- package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts +327 -0
- package/dist/lib/entries/infrastructure/persistence/relation-link.service.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/persistence/relation-link.service.js +1008 -0
- package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.d.ts +19 -0
- package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/bulk-publish-preview.query.js +39 -0
- package/dist/lib/entries/infrastructure/queries/entries.service.d.ts +64 -0
- package/dist/lib/entries/infrastructure/queries/entries.service.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/entries.service.js +202 -0
- package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts +40 -0
- package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/entry-filter-surface.d.ts +38 -0
- package/dist/lib/entries/infrastructure/queries/entry-filter-surface.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/entry-filter-surface.js +310 -0
- package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.d.ts +25 -0
- package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/entry-scalar-fields.js +51 -0
- package/dist/lib/entries/infrastructure/queries/entry-search.d.ts +19 -0
- package/dist/lib/entries/infrastructure/queries/entry-search.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/entry-search.js +52 -0
- package/dist/lib/entries/infrastructure/queries/media-refs.query.d.ts +21 -0
- package/dist/lib/entries/infrastructure/queries/media-refs.query.d.ts.map +1 -0
- package/dist/lib/entries/infrastructure/queries/media-refs.query.js +117 -0
- package/dist/lib/entries/services/entries.service.d.ts +59 -0
- package/dist/lib/entries/services/entries.service.d.ts.map +1 -0
- package/dist/lib/entries/services/entry-counter.service.d.ts +31 -0
- package/dist/lib/entries/services/entry-counter.service.d.ts.map +1 -0
- package/dist/lib/entries/services/entry-filter-schema.d.ts +32 -0
- package/dist/lib/entries/services/entry-filter-schema.d.ts.map +1 -0
- package/dist/lib/entries/services/entry-row.d.ts +56 -0
- package/dist/lib/entries/services/entry-row.d.ts.map +1 -0
- package/dist/lib/entries/services/entry-writer.service.d.ts +193 -0
- package/dist/lib/entries/services/entry-writer.service.d.ts.map +1 -0
- package/dist/lib/entries/services/relation-link.service.d.ts +115 -0
- package/dist/lib/entries/services/relation-link.service.d.ts.map +1 -0
- package/dist/lib/entries/types/bulk-publish.d.ts +75 -0
- package/dist/lib/entries/types/bulk-publish.d.ts.map +1 -0
- package/dist/lib/entries/types/bulk-publish.js +22 -0
- package/dist/lib/entries/types/entry-list-view.d.ts +205 -0
- package/dist/lib/entries/types/entry-list-view.d.ts.map +1 -0
- package/dist/lib/entries/types/entry-list-view.js +5 -0
- package/dist/lib/entries/types/filter-surface.d.ts +35 -0
- package/dist/lib/entries/types/filter-surface.d.ts.map +1 -0
- package/dist/lib/entries/types/filter-surface.js +2 -0
- package/dist/lib/extension/entry-extension-boot-check.d.ts +16 -0
- package/dist/lib/extension/entry-extension-boot-check.d.ts.map +1 -0
- package/dist/lib/extension/entry-extension-boot-check.js +42 -0
- package/dist/lib/extension/entry-extension.d.ts +225 -0
- package/dist/lib/extension/entry-extension.d.ts.map +1 -0
- package/dist/lib/extension/entry-extension.js +27 -0
- package/dist/lib/extension/media-asset-resolver.d.ts +85 -0
- package/dist/lib/extension/media-asset-resolver.d.ts.map +1 -0
- package/dist/lib/extension/media-asset-resolver.js +26 -0
- package/dist/lib/extension/per-locale-relation.d.ts +18 -0
- package/dist/lib/extension/per-locale-relation.d.ts.map +1 -0
- package/dist/lib/extension/relation-locale-sync.d.ts +62 -0
- package/dist/lib/extension/relation-locale-sync.d.ts.map +1 -0
- package/dist/lib/extension/relation-locale-sync.js +88 -0
- package/dist/lib/fields/index.d.ts +94 -0
- package/dist/lib/fields/index.d.ts.map +1 -0
- package/dist/lib/fields/index.js +203 -0
- package/dist/lib/insights/http/controllers/content-pipeline.controller.d.ts +16 -0
- package/dist/lib/insights/http/controllers/content-pipeline.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-pipeline.controller.js +39 -0
- package/dist/lib/insights/http/controllers/content-punchcard.controller.d.ts +18 -0
- package/dist/lib/insights/http/controllers/content-punchcard.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-punchcard.controller.js +42 -0
- package/dist/lib/insights/http/controllers/content-stale.controller.d.ts +17 -0
- package/dist/lib/insights/http/controllers/content-stale.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-stale.controller.js +40 -0
- package/dist/lib/insights/http/controllers/content-totals.controller.d.ts +18 -0
- package/dist/lib/insights/http/controllers/content-totals.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-totals.controller.js +42 -0
- package/dist/lib/insights/http/controllers/content-unshipped.controller.d.ts +17 -0
- package/dist/lib/insights/http/controllers/content-unshipped.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-unshipped.controller.js +40 -0
- package/dist/lib/insights/http/controllers/content-velocity.controller.d.ts +17 -0
- package/dist/lib/insights/http/controllers/content-velocity.controller.d.ts.map +1 -0
- package/dist/lib/insights/http/controllers/content-velocity.controller.js +41 -0
- package/dist/lib/insights/http/dto/insights-range-query.dto.d.ts +15 -0
- package/dist/lib/insights/http/dto/insights-range-query.dto.d.ts.map +1 -0
- package/dist/lib/insights/http/dto/insights-range-query.dto.js +38 -0
- package/dist/lib/insights/infrastructure/queries/content-insights.query.d.ts +77 -0
- package/dist/lib/insights/infrastructure/queries/content-insights.query.d.ts.map +1 -0
- package/dist/lib/insights/infrastructure/queries/content-insights.query.js +380 -0
- package/dist/lib/insights/types/content-insights-view.d.ts +134 -0
- package/dist/lib/insights/types/content-insights-view.d.ts.map +1 -0
- package/dist/lib/insights/types/content-insights-view.js +10 -0
- package/dist/lib/mcp/content-tools.provider.d.ts +83 -0
- package/dist/lib/mcp/content-tools.provider.d.ts.map +1 -0
- package/dist/lib/mcp/content-tools.provider.js +441 -0
- package/dist/lib/mcp/tool-input.d.ts +43 -0
- package/dist/lib/mcp/tool-input.d.ts.map +1 -0
- package/dist/lib/mcp/tool-input.js +117 -0
- package/dist/lib/mcp/tool-schemas.d.ts +34 -0
- package/dist/lib/mcp/tool-schemas.d.ts.map +1 -0
- package/dist/lib/mcp/tool-schemas.js +282 -0
- package/dist/lib/public/controllers/get-public-entry.controller.d.ts +26 -0
- package/dist/lib/public/controllers/get-public-entry.controller.d.ts.map +1 -0
- package/dist/lib/public/controllers/list-public-entries.controller.d.ts +24 -0
- package/dist/lib/public/controllers/list-public-entries.controller.d.ts.map +1 -0
- package/dist/lib/public/controllers/public-schema.controller.d.ts +18 -0
- package/dist/lib/public/controllers/public-schema.controller.d.ts.map +1 -0
- package/dist/lib/public-api/http/api-token-request.d.ts +41 -0
- package/dist/lib/public-api/http/api-token-request.d.ts.map +1 -0
- package/dist/lib/public-api/http/api-token-request.js +2 -0
- package/dist/lib/public-api/http/controllers/public-content-types.controller.d.ts +31 -0
- package/dist/lib/public-api/http/controllers/public-content-types.controller.d.ts.map +1 -0
- package/dist/lib/public-api/http/controllers/public-content-types.controller.js +93 -0
- package/dist/lib/public-api/http/controllers/public-entries.controller.d.ts +101 -0
- package/dist/lib/public-api/http/controllers/public-entries.controller.d.ts.map +1 -0
- package/dist/lib/public-api/http/controllers/public-entries.controller.js +307 -0
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts +76 -0
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts.map +1 -0
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.js +353 -0
- package/dist/lib/public-api/http/controllers/resolve-granted-type.d.ts +42 -0
- package/dist/lib/public-api/http/controllers/resolve-granted-type.d.ts.map +1 -0
- package/dist/lib/public-api/http/controllers/resolve-granted-type.js +25 -0
- package/dist/lib/public-api/http/decorators/current-api-token.decorator.d.ts +8 -0
- package/dist/lib/public-api/http/decorators/current-api-token.decorator.d.ts.map +1 -0
- package/dist/lib/public-api/http/decorators/current-api-token.decorator.js +17 -0
- package/dist/lib/public-api/http/dto/public-bulk.dto.d.ts +58 -0
- package/dist/lib/public-api/http/dto/public-bulk.dto.d.ts.map +1 -0
- package/dist/lib/public-api/http/dto/public-bulk.dto.js +118 -0
- package/dist/lib/public-api/http/dto/public-list-entries-query.dto.d.ts +106 -0
- package/dist/lib/public-api/http/dto/public-list-entries-query.dto.d.ts.map +1 -0
- package/dist/lib/public-api/http/dto/public-list-entries-query.dto.js +297 -0
- package/dist/lib/public-api/http/dto/public-save-entry.dto.d.ts +39 -0
- package/dist/lib/public-api/http/dto/public-save-entry.dto.d.ts.map +1 -0
- package/dist/lib/public-api/http/dto/public-save-entry.dto.js +112 -0
- package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts +25 -0
- package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts.map +1 -0
- package/dist/lib/public-api/http/guards/api-token-workspace.guard.js +58 -0
- package/dist/lib/public-api/http/guards/api-token.guard.d.ts +32 -0
- package/dist/lib/public-api/http/guards/api-token.guard.d.ts.map +1 -0
- package/dist/lib/public-api/http/guards/api-token.guard.js +92 -0
- package/dist/lib/public-api/http/guards/draft-visibility.guard.d.ts +25 -0
- package/dist/lib/public-api/http/guards/draft-visibility.guard.d.ts.map +1 -0
- package/dist/lib/public-api/http/guards/draft-visibility.guard.js +56 -0
- package/dist/lib/public-api/infrastructure/bulk-save-op.d.ts +55 -0
- package/dist/lib/public-api/infrastructure/bulk-save-op.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/bulk-save-op.js +61 -0
- package/dist/lib/public-api/infrastructure/field-selection.d.ts +21 -0
- package/dist/lib/public-api/infrastructure/field-selection.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/field-selection.js +72 -0
- package/dist/lib/public-api/infrastructure/public-entries.query.d.ts +248 -0
- package/dist/lib/public-api/infrastructure/public-entries.query.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/public-entries.query.js +557 -0
- package/dist/lib/public-api/infrastructure/public-entry-row.d.ts +31 -0
- package/dist/lib/public-api/infrastructure/public-entry-row.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/public-entry-row.js +76 -0
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts +188 -0
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.js +321 -0
- package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts +98 -0
- package/dist/lib/public-api/infrastructure/public-expansion.query.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/public-expansion.query.js +384 -0
- package/dist/lib/public-api/types/public-bulk.d.ts +77 -0
- package/dist/lib/public-api/types/public-bulk.d.ts.map +1 -0
- package/dist/lib/public-api/types/public-bulk.js +23 -0
- package/dist/lib/public-api/types/public-entry.d.ts +97 -0
- package/dist/lib/public-api/types/public-entry.d.ts.map +1 -0
- package/dist/lib/public-api/types/public-entry.js +8 -0
- package/dist/lib/public-api/types/public-expansion.d.ts +92 -0
- package/dist/lib/public-api/types/public-expansion.d.ts.map +1 -0
- package/dist/lib/public-api/types/public-expansion.js +2 -0
- package/dist/lib/registry/content-type-registry.d.ts +103 -0
- package/dist/lib/registry/content-type-registry.d.ts.map +1 -0
- package/dist/lib/registry/content-type-registry.js +155 -0
- package/dist/lib/revisions/application/ports/revision-store.d.ts +71 -0
- package/dist/lib/revisions/application/ports/revision-store.d.ts.map +1 -0
- package/dist/lib/revisions/application/ports/revision-store.js +9 -0
- package/dist/lib/revisions/application/use-cases/publish-revision.use-case.d.ts +40 -0
- package/dist/lib/revisions/application/use-cases/publish-revision.use-case.d.ts.map +1 -0
- package/dist/lib/revisions/application/use-cases/publish-revision.use-case.js +66 -0
- package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts +36 -0
- package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts.map +1 -0
- package/dist/lib/revisions/application/use-cases/restore-revision.use-case.js +57 -0
- package/dist/lib/revisions/domain/revision-status.d.ts +18 -0
- package/dist/lib/revisions/domain/revision-status.d.ts.map +1 -0
- package/dist/lib/revisions/domain/revision-status.js +18 -0
- package/dist/lib/revisions/domain/revision.d.ts +80 -0
- package/dist/lib/revisions/domain/revision.d.ts.map +1 -0
- package/dist/lib/revisions/domain/revision.js +84 -0
- package/dist/lib/revisions/http/controllers/publish-revision.controller.d.ts +19 -0
- package/dist/lib/revisions/http/controllers/publish-revision.controller.d.ts.map +1 -0
- package/dist/lib/revisions/http/controllers/publish-revision.controller.js +51 -0
- package/dist/lib/revisions/http/controllers/restore-revision.controller.d.ts +17 -0
- package/dist/lib/revisions/http/controllers/restore-revision.controller.d.ts.map +1 -0
- package/dist/lib/revisions/http/controllers/restore-revision.controller.js +49 -0
- package/dist/lib/revisions/http/controllers/revisions.controller.d.ts +20 -0
- package/dist/lib/revisions/http/controllers/revisions.controller.d.ts.map +1 -0
- package/dist/lib/revisions/http/controllers/revisions.controller.js +76 -0
- package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.d.ts +33 -0
- package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.d.ts.map +1 -0
- package/dist/lib/revisions/infrastructure/persistence/drizzle-revision.store.js +174 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts +17 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.d.ts.map +1 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-snapshot.js +20 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-table.d.ts +228 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-table.d.ts.map +1 -0
- package/dist/lib/revisions/infrastructure/persistence/revision-table.js +57 -0
- package/dist/lib/revisions/infrastructure/queries/revision-refs.query.d.ts +22 -0
- package/dist/lib/revisions/infrastructure/queries/revision-refs.query.d.ts.map +1 -0
- package/dist/lib/revisions/infrastructure/queries/revision-refs.query.js +66 -0
- package/dist/lib/revisions/revisions.constants.d.ts +10 -0
- package/dist/lib/revisions/revisions.constants.d.ts.map +1 -0
- package/dist/lib/revisions/revisions.constants.js +12 -0
- package/dist/lib/revisions/types/revision-view.d.ts +74 -0
- package/dist/lib/revisions/types/revision-view.d.ts.map +1 -0
- package/dist/lib/revisions/types/revision-view.js +2 -0
- package/dist/lib/types/content-type.d.ts +131 -0
- package/dist/lib/types/content-type.d.ts.map +1 -0
- package/dist/lib/types/content-type.js +28 -0
- package/dist/lib/types/fields.d.ts +303 -0
- package/dist/lib/types/fields.d.ts.map +1 -0
- package/dist/lib/types/fields.js +52 -0
- package/dist/lib/utils/content-plugin.d.ts +35 -0
- package/dist/lib/utils/content-plugin.d.ts.map +1 -0
- package/dist/lib/utils/content-plugin.js +35 -0
- package/dist/lib/validation/services/entry-validation.service.d.ts +24 -0
- package/dist/lib/validation/services/entry-validation.service.d.ts.map +1 -0
- package/dist/lib/validation/services/entry-validation.service.js +35 -0
- package/package.json +54 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { PublicEntry } from './public-entry';
|
|
2
|
+
/**
|
|
3
|
+
* Wire contracts for the public API's **relation** and **media** expansions.
|
|
4
|
+
* Separate from the admin's `RelationRef` / `MediaRef` for the same reason
|
|
5
|
+
* `PublicEntry` is separate from `EntryRecord`: this is a published contract,
|
|
6
|
+
* and it deliberately carries less.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* One relation field's links: a capped page of the linked entries, plus the
|
|
10
|
+
* true total.
|
|
11
|
+
*
|
|
12
|
+
* Each item is a **full {@link PublicEntry}** — the same shape the entry routes
|
|
13
|
+
* return, envelope and `values` alike — so a consumer renders a linked record
|
|
14
|
+
* with the code it already has instead of a second, ref-shaped model. Linked
|
|
15
|
+
* entries are **not themselves expanded**: their `relations` and `media` are
|
|
16
|
+
* absent, which is what stops one request walking the whole graph.
|
|
17
|
+
*
|
|
18
|
+
* Only published, non-deleted targets in the workspace appear. A target the
|
|
19
|
+
* caller may not see is **omitted and not counted**, rather than advertised as
|
|
20
|
+
* an unavailable record, so `total` is the number of links actually reachable.
|
|
21
|
+
*/
|
|
22
|
+
export interface PublicRelationFieldView {
|
|
23
|
+
items: PublicEntry[];
|
|
24
|
+
/** Visible links for this field, ignoring the page cap. */
|
|
25
|
+
total: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One media asset attached to an entry.
|
|
29
|
+
*
|
|
30
|
+
* The URLs point at `/api/v1/media/assets/:id/raw`, which takes the **same
|
|
31
|
+
* bearer token** as the read that produced them — so a server-side consumer can
|
|
32
|
+
* fetch the bytes with the credential it already has. They are still not public:
|
|
33
|
+
* a browser `<img src>` sends no `Authorization` header, so an anonymous visitor
|
|
34
|
+
* will not load one. Proxy them, or fetch and re-serve them, from whatever is
|
|
35
|
+
* holding the token. (Genuinely public, unauthenticated URLs would need signed
|
|
36
|
+
* links with an expiry, which do not exist yet.)
|
|
37
|
+
*/
|
|
38
|
+
export interface PublicMediaRef {
|
|
39
|
+
/** Asset id. */
|
|
40
|
+
id: string;
|
|
41
|
+
/** Display name — the original file name. */
|
|
42
|
+
name: string;
|
|
43
|
+
/** Route the bytes stream from. See the caveat above. */
|
|
44
|
+
url: string;
|
|
45
|
+
/** Route for the ~320px derivative, when one was generated. */
|
|
46
|
+
thumbUrl?: string;
|
|
47
|
+
/** Route for the ~1280px derivative, when one was generated. */
|
|
48
|
+
previewUrl?: string;
|
|
49
|
+
/** Coarse kind — image / video / audio / document / archive. */
|
|
50
|
+
kind: string;
|
|
51
|
+
/** MIME type, e.g. `image/png`. */
|
|
52
|
+
mimeType: string;
|
|
53
|
+
/**
|
|
54
|
+
* The text alternative for **this usage** — the entry value's own `alt`
|
|
55
|
+
* where it has one, the asset row's default otherwise, and `''` when the
|
|
56
|
+
* usage is {@link decorative}.
|
|
57
|
+
*
|
|
58
|
+
* `''` and `null` mean different things and a consumer should treat them
|
|
59
|
+
* differently: `''` is "render `alt=\"\"`, this image says nothing", while
|
|
60
|
+
* `null` is "nobody has supplied one" — which is a gap to report, not an
|
|
61
|
+
* instruction to hide the image from assistive tech (`ORT-83`).
|
|
62
|
+
*/
|
|
63
|
+
alt: string | null;
|
|
64
|
+
/** The author marked this usage purely presentational. */
|
|
65
|
+
decorative?: true;
|
|
66
|
+
/**
|
|
67
|
+
* Timed-text tracks for a video or audio asset — everything a consumer
|
|
68
|
+
* needs to emit `<track>` elements. Empty for an image, and for a video
|
|
69
|
+
* nobody has captioned (`ORT-92`).
|
|
70
|
+
*/
|
|
71
|
+
tracks: PublicMediaTrack[];
|
|
72
|
+
}
|
|
73
|
+
/** One timed-text track on a published video or audio asset. */
|
|
74
|
+
export interface PublicMediaTrack {
|
|
75
|
+
/** `captions` / `subtitles` / `descriptions` / `chapters`. */
|
|
76
|
+
kind: string;
|
|
77
|
+
/** BCP-47 tag of the track's language. */
|
|
78
|
+
srclang: string;
|
|
79
|
+
/** The label a player shows in its track menu. */
|
|
80
|
+
label: string;
|
|
81
|
+
/** Route the WebVTT bytes stream from — same bearer token as the query. */
|
|
82
|
+
src: string;
|
|
83
|
+
/** Whether a player should enable this one by default. */
|
|
84
|
+
default?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** One media field's assets, in their stored order. */
|
|
87
|
+
export interface PublicMediaFieldView {
|
|
88
|
+
items: PublicMediaRef[];
|
|
89
|
+
/** Assets attached to this field. */
|
|
90
|
+
total: number;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=public-expansion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-expansion.d.ts","sourceRoot":"","sources":["../../../../src/lib/public-api/types/public-expansion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC3B,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;OASG;IACH,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime registry of code-defined content types. Constructed once by
|
|
3
|
+
* the plugin factory, validated eagerly (duplicate names, unresolvable
|
|
4
|
+
* relation targets fail boot — not first request), and provided via DI so
|
|
5
|
+
* controllers, services, and other plugins can introspect the schema.
|
|
6
|
+
*/
|
|
7
|
+
import type { AnyContentType, ContentTypeKind } from '../types/content-type';
|
|
8
|
+
import { type RelationLocaleSync } from '../extension/relation-locale-sync';
|
|
9
|
+
/** Wire shape of a field, as served to the admin / frontends. */
|
|
10
|
+
export interface SerializedField {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
/** Value differs per locale — present only when true (i18n types). */
|
|
15
|
+
localized?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* BCP-47 tag naming the language this field's content is written in, when
|
|
18
|
+
* it is not the entry's own (WCAG 3.1.2). Present only when the field
|
|
19
|
+
* declares one; the admin renders the control with it so the value is
|
|
20
|
+
* announced in the right language, and the kernel validates it.
|
|
21
|
+
*/
|
|
22
|
+
lang?: string;
|
|
23
|
+
validation: Record<string, unknown>;
|
|
24
|
+
admin: Record<string, unknown>;
|
|
25
|
+
options?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* `onDelete` and `unique` describe the FK column of a single relation —
|
|
28
|
+
* meaningful only when `many` is false. For a many-relation the link lives
|
|
29
|
+
* in a join table whose rows always cascade and have no column to make
|
|
30
|
+
* unique, so both are omitted rather than reported as (inert) spec values.
|
|
31
|
+
*/
|
|
32
|
+
relation?: {
|
|
33
|
+
to: string;
|
|
34
|
+
many: boolean;
|
|
35
|
+
onDelete?: string;
|
|
36
|
+
unique?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* How this link behaves across the record's locales — `shared` (one
|
|
39
|
+
* target for the whole group), `mirrored` (each locale links the
|
|
40
|
+
* target's own translation), or `none` (each locale keeps its own).
|
|
41
|
+
* Present only on a localized owner, where it is the difference between
|
|
42
|
+
* "editing this changes every language" and "this is yours alone".
|
|
43
|
+
*/
|
|
44
|
+
localeSync?: RelationLocaleSync;
|
|
45
|
+
/** Present when this field is the inverse side of a two-way relation. */
|
|
46
|
+
inverse?: {
|
|
47
|
+
field: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** Holds an ordered list of asset ids — present only on media fields. */
|
|
51
|
+
multiple?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Accepted-asset restriction (kinds / MIME patterns) — media fields only,
|
|
54
|
+
* present only when the field sets one. The admin picker filters by it.
|
|
55
|
+
*/
|
|
56
|
+
accept?: {
|
|
57
|
+
kinds?: readonly string[];
|
|
58
|
+
mimeTypes?: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Wire shape of a content type (summary, wizard-compatible). */
|
|
62
|
+
export interface SerializedContentTypeSummary {
|
|
63
|
+
name: string;
|
|
64
|
+
kind: ContentTypeKind;
|
|
65
|
+
label: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
path?: string;
|
|
68
|
+
/** Tracks publish time via a `publishedAt` envelope column. */
|
|
69
|
+
publishable: boolean;
|
|
70
|
+
/** Soft-deletes via a `deletedAt` envelope column. */
|
|
71
|
+
paranoid: boolean;
|
|
72
|
+
/** Row-per-locale via `locale` + `localeGroupId` envelope columns. */
|
|
73
|
+
i18n: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** Wire shape of a content type with its full field schema. */
|
|
76
|
+
export interface SerializedContentType extends SerializedContentTypeSummary {
|
|
77
|
+
fields: SerializedField[];
|
|
78
|
+
}
|
|
79
|
+
export declare class ContentTypeRegistry {
|
|
80
|
+
private readonly byName;
|
|
81
|
+
constructor(types: readonly AnyContentType[]);
|
|
82
|
+
/** All registered types, in registration order. */
|
|
83
|
+
all(): AnyContentType[];
|
|
84
|
+
/** A type by machine name, or undefined. */
|
|
85
|
+
get(name: string): AnyContentType | undefined;
|
|
86
|
+
/** The wizard-compatible summary of one type. */
|
|
87
|
+
private summaryOf;
|
|
88
|
+
/** The wire shape of one field spec. */
|
|
89
|
+
private serializeField;
|
|
90
|
+
/** Wizard-compatible summaries (matches `ContentTypeDescriptor`). */
|
|
91
|
+
summaries(): SerializedContentTypeSummary[];
|
|
92
|
+
/** Full serialized schema for one type, or undefined. */
|
|
93
|
+
serialize(name: string): SerializedContentType | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Full serialized schema for **every** registered type, in registration
|
|
96
|
+
* order — the whole model in one read, for a consumer describing the model
|
|
97
|
+
* itself rather than answering a request (e.g. the OpenAPI pass).
|
|
98
|
+
*/
|
|
99
|
+
serializeAll(): SerializedContentType[];
|
|
100
|
+
/** Summary + fields of an already-resolved type. */
|
|
101
|
+
private serializeType;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=content-type-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-type-registry.d.ts","sourceRoot":"","sources":["../../../src/lib/registry/content-type-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,mCAAmC,CAAC;AAE3C,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,OAAO,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;QAChC,yEAAyE;QACzE,OAAO,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/B,CAAC;IACF,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CACzE;AAED,iEAAiE;AACjE,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,WAAW,EAAE,OAAO,CAAC;IACrB,sDAAsD;IACtD,QAAQ,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACvE,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;gBAEhD,KAAK,EAAE,SAAS,cAAc,EAAE;IAoD5C,mDAAmD;IACnD,GAAG,IAAI,cAAc,EAAE;IAIvB,4CAA4C;IAC5C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C,iDAAiD;IACjD,OAAO,CAAC,SAAS;IAajB,wCAAwC;IACxC,OAAO,CAAC,cAAc;IAyDtB,qEAAqE;IACrE,SAAS,IAAI,4BAA4B,EAAE;IAI3C,yDAAyD;IACzD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAM1D;;;;OAIG;IACH,YAAY,IAAI,qBAAqB,EAAE;IAIvC,oDAAoD;IACpD,OAAO,CAAC,aAAa;CAQxB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The runtime registry of code-defined content types. Constructed once by
|
|
4
|
+
* the plugin factory, validated eagerly (duplicate names, unresolvable
|
|
5
|
+
* relation targets fail boot — not first request), and provided via DI so
|
|
6
|
+
* controllers, services, and other plugins can introspect the schema.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ContentTypeRegistry = void 0;
|
|
10
|
+
const fields_1 = require("../types/fields");
|
|
11
|
+
const relation_locale_sync_1 = require("../extension/relation-locale-sync");
|
|
12
|
+
class ContentTypeRegistry {
|
|
13
|
+
byName = new Map();
|
|
14
|
+
constructor(types) {
|
|
15
|
+
for (const type of types) {
|
|
16
|
+
if (this.byName.has(type.name)) {
|
|
17
|
+
throw new Error(`Duplicate content type "${type.name}" — names must be unique.`);
|
|
18
|
+
}
|
|
19
|
+
this.byName.set(type.name, type);
|
|
20
|
+
}
|
|
21
|
+
// Resolve every relation thunk now: a typo'd target or a type
|
|
22
|
+
// missing from `ContentPlugin({ types })` should fail boot.
|
|
23
|
+
for (const type of types) {
|
|
24
|
+
for (const [fieldName, spec] of Object.entries(type.fields)) {
|
|
25
|
+
if (spec.type !== fields_1.CONTENT_FIELD_TYPE.Relation || !spec.relation)
|
|
26
|
+
continue;
|
|
27
|
+
const target = spec.relation.to();
|
|
28
|
+
if (!this.byName.has(target.name)) {
|
|
29
|
+
throw new Error(`Relation "${type.name}.${fieldName}" targets ` +
|
|
30
|
+
`"${target.name}", which is not registered with ContentPlugin.`);
|
|
31
|
+
}
|
|
32
|
+
// An inverse must point at a real relation on the owning type
|
|
33
|
+
// (`target`) that in turn points back here — else the two sides
|
|
34
|
+
// would edit different links. Fail boot on a mismatch.
|
|
35
|
+
if (spec.relation.inverse) {
|
|
36
|
+
const owningField = target.fields[spec.relation.inverse.field];
|
|
37
|
+
if (!owningField ||
|
|
38
|
+
owningField.type !== fields_1.CONTENT_FIELD_TYPE.Relation ||
|
|
39
|
+
!owningField.relation ||
|
|
40
|
+
owningField.relation.inverse) {
|
|
41
|
+
throw new Error(`Inverse relation "${type.name}.${fieldName}" references ` +
|
|
42
|
+
`"${target.name}.${spec.relation.inverse.field}", which is not ` +
|
|
43
|
+
`a storage-owning relation field.`);
|
|
44
|
+
}
|
|
45
|
+
if (owningField.relation.to().name !== type.name) {
|
|
46
|
+
throw new Error(`Inverse relation "${type.name}.${fieldName}" mirrors ` +
|
|
47
|
+
`"${target.name}.${spec.relation.inverse.field}", but that field ` +
|
|
48
|
+
`targets "${owningField.relation.to().name}", not "${type.name}".`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** All registered types, in registration order. */
|
|
55
|
+
all() {
|
|
56
|
+
return [...this.byName.values()];
|
|
57
|
+
}
|
|
58
|
+
/** A type by machine name, or undefined. */
|
|
59
|
+
get(name) {
|
|
60
|
+
return this.byName.get(name);
|
|
61
|
+
}
|
|
62
|
+
/** The wizard-compatible summary of one type. */
|
|
63
|
+
summaryOf(type) {
|
|
64
|
+
return {
|
|
65
|
+
name: type.name,
|
|
66
|
+
kind: type.kind,
|
|
67
|
+
label: type.label,
|
|
68
|
+
...(type.description ? { description: type.description } : {}),
|
|
69
|
+
...(type.path ? { path: type.path } : {}),
|
|
70
|
+
publishable: type.publishable,
|
|
71
|
+
paranoid: type.paranoid,
|
|
72
|
+
i18n: type.i18n
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** The wire shape of one field spec. */
|
|
76
|
+
serializeField(type, fieldName, spec) {
|
|
77
|
+
// A relation whose stored id differs per locale row — mirrored (each
|
|
78
|
+
// sibling points at the target's own translation) or unsynced —
|
|
79
|
+
// serializes as `localized`, so the admin treats it like any other
|
|
80
|
+
// per-locale field. A *shared* relation does not: every sibling
|
|
81
|
+
// genuinely holds the same id.
|
|
82
|
+
const localized = (0, relation_locale_sync_1.isPerLocaleField)(type, spec);
|
|
83
|
+
return {
|
|
84
|
+
name: fieldName,
|
|
85
|
+
type: spec.type,
|
|
86
|
+
required: spec.required,
|
|
87
|
+
...(localized ? { localized: true } : {}),
|
|
88
|
+
...(spec.lang ? { lang: spec.lang } : {}),
|
|
89
|
+
validation: { ...spec.validation },
|
|
90
|
+
admin: { ...spec.admin },
|
|
91
|
+
...(spec.options ? { options: spec.options } : {}),
|
|
92
|
+
...(spec.type === fields_1.CONTENT_FIELD_TYPE.Media
|
|
93
|
+
? {
|
|
94
|
+
multiple: !!spec.multiple,
|
|
95
|
+
...(spec.accept ? { accept: spec.accept } : {})
|
|
96
|
+
}
|
|
97
|
+
: {}),
|
|
98
|
+
...(spec.relation
|
|
99
|
+
? {
|
|
100
|
+
relation: {
|
|
101
|
+
to: spec.relation.to().name,
|
|
102
|
+
many: spec.relation.many,
|
|
103
|
+
// Omitted off a localized type, where every relation
|
|
104
|
+
// would report the inert `none` and the admin has no
|
|
105
|
+
// locales to say anything about.
|
|
106
|
+
...(type.i18n
|
|
107
|
+
? { localeSync: (0, relation_locale_sync_1.relationLocaleSync)(type, spec) }
|
|
108
|
+
: {}),
|
|
109
|
+
// An inverse owns no column/table, so onDelete/unique
|
|
110
|
+
// are inert — report the back-reference instead.
|
|
111
|
+
...(spec.relation.inverse
|
|
112
|
+
? {
|
|
113
|
+
inverse: {
|
|
114
|
+
field: spec.relation.inverse.field
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
: spec.relation.many
|
|
118
|
+
? {}
|
|
119
|
+
: {
|
|
120
|
+
onDelete: spec.relation.onDelete,
|
|
121
|
+
unique: spec.relation.unique
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
: {})
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/** Wizard-compatible summaries (matches `ContentTypeDescriptor`). */
|
|
129
|
+
summaries() {
|
|
130
|
+
return this.all().map((type) => this.summaryOf(type));
|
|
131
|
+
}
|
|
132
|
+
/** Full serialized schema for one type, or undefined. */
|
|
133
|
+
serialize(name) {
|
|
134
|
+
const type = this.get(name);
|
|
135
|
+
if (!type)
|
|
136
|
+
return undefined;
|
|
137
|
+
return this.serializeType(type);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Full serialized schema for **every** registered type, in registration
|
|
141
|
+
* order — the whole model in one read, for a consumer describing the model
|
|
142
|
+
* itself rather than answering a request (e.g. the OpenAPI pass).
|
|
143
|
+
*/
|
|
144
|
+
serializeAll() {
|
|
145
|
+
return this.all().map((type) => this.serializeType(type));
|
|
146
|
+
}
|
|
147
|
+
/** Summary + fields of an already-resolved type. */
|
|
148
|
+
serializeType(type) {
|
|
149
|
+
return {
|
|
150
|
+
...this.summaryOf(type),
|
|
151
|
+
fields: Object.entries(type.fields).map(([fieldName, spec]) => this.serializeField(type, fieldName, spec))
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.ContentTypeRegistry = ContentTypeRegistry;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Database } from '@orthacms/database';
|
|
2
|
+
import type { DbTransaction } from '../../../entries/infrastructure/persistence/relation-link.service';
|
|
3
|
+
import type { Revision } from '../../domain/revision';
|
|
4
|
+
import type { RevisionDetail, RevisionListView, RevisionSummary } from '../../types/revision-view';
|
|
5
|
+
/** An executor that may be the base connection or an ambient transaction. */
|
|
6
|
+
export type RevisionExecutor = Database | DbTransaction;
|
|
7
|
+
/**
|
|
8
|
+
* The persistence port for entry revisions. Write primitives are
|
|
9
|
+
* **executor-parameterized** so `EntryWriterService` can append a revision on
|
|
10
|
+
* its own save transaction (atomic with the row + relation writes); reads run on
|
|
11
|
+
* the base connection.
|
|
12
|
+
*/
|
|
13
|
+
export interface RevisionStore {
|
|
14
|
+
/**
|
|
15
|
+
* The next version number for an entry: `max(revision_number) + 1`, else 1.
|
|
16
|
+
* Runs on the write executor so it sees the entry's own uncommitted rows.
|
|
17
|
+
* The caller serializes concurrent savers with an advisory lock so two
|
|
18
|
+
* appends can't allocate the same number.
|
|
19
|
+
*/
|
|
20
|
+
nextNumber(exec: RevisionExecutor, entryId: string): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Take the entry's transaction-scoped append lock, so concurrent saves of the
|
|
23
|
+
* same entry allocate distinct version numbers instead of colliding.
|
|
24
|
+
*/
|
|
25
|
+
lockEntry(exec: RevisionExecutor, entryId: string): Promise<void>;
|
|
26
|
+
/** Insert a revision on `exec`, returning its summary view. */
|
|
27
|
+
append(exec: RevisionExecutor, revision: Revision): Promise<RevisionSummary>;
|
|
28
|
+
/**
|
|
29
|
+
* Promote one revision to `published` (stamping `published_at`) and demote
|
|
30
|
+
* any previously-published revision to `superseded`, on `exec`. This is the
|
|
31
|
+
* publish transition the snapshot-on-save defers — every revision is born a
|
|
32
|
+
* `draft`, so without it the timeline never shows a version as live.
|
|
33
|
+
* Idempotent, and a no-op for an entry with no revisions.
|
|
34
|
+
*
|
|
35
|
+
* `revisionNumber` names the version to promote; omitted, it targets the
|
|
36
|
+
* **latest**, which is exactly the just-published live row (every save
|
|
37
|
+
* appends one). It is passed only when publishing a *specific* earlier
|
|
38
|
+
* version, whose content the caller has already re-applied to the live row —
|
|
39
|
+
* that version becomes live in place instead of being copied to a new one.
|
|
40
|
+
*/
|
|
41
|
+
markPublished(exec: RevisionExecutor, entryId: string, workspaceId: string, revisionNumber?: number): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Demote the entry's currently-published revision back to `draft` (clearing
|
|
44
|
+
* `published_at`) on `exec` — the unpublish counterpart. At most one
|
|
45
|
+
* revision is published, so this transitions exactly that one; a no-op if
|
|
46
|
+
* none is.
|
|
47
|
+
*/
|
|
48
|
+
markUnpublished(exec: RevisionExecutor, entryId: string, workspaceId: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* One page of an entry's revisions, newest first, scoped to the content
|
|
51
|
+
* type + entry + workspace.
|
|
52
|
+
*
|
|
53
|
+
* `contentType` is part of the key, not decoration: every content type's
|
|
54
|
+
* rows live in one shared `content_entry_revisions` table, so without it a
|
|
55
|
+
* caller who names a *different* registered type in the route
|
|
56
|
+
* (`GET /api/content/author/:articleId/revisions`) reads the entry's real
|
|
57
|
+
* history anyway — the route param would be checked against nothing.
|
|
58
|
+
*/
|
|
59
|
+
list(contentType: string, entryId: string, workspaceId: string, page: number, pageSize: number): Promise<RevisionListView>;
|
|
60
|
+
/**
|
|
61
|
+
* One revision (with its snapshot) by version number, scoped to the content
|
|
62
|
+
* type + entry + workspace — or undefined if absent. See {@link list} for
|
|
63
|
+
* why `contentType` is part of the key.
|
|
64
|
+
*/
|
|
65
|
+
get(contentType: string, entryId: string, workspaceId: string, number: number): Promise<RevisionDetail | undefined>;
|
|
66
|
+
}
|
|
67
|
+
/** DI token the {@link RevisionStore} is bound under. */
|
|
68
|
+
export declare const REVISION_STORE: unique symbol;
|
|
69
|
+
/** Injects the {@link RevisionStore}. */
|
|
70
|
+
export declare const InjectRevisionStore: () => ParameterDecorator;
|
|
71
|
+
//# sourceMappingURL=revision-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-store.d.ts","sourceRoot":"","sources":["../../../../../src/lib/revisions/application/ports/revision-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mEAAmE,CAAC;AACvG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EACR,cAAc,EACd,gBAAgB,EAChB,eAAe,EAClB,MAAM,2BAA2B,CAAC;AAEnC,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,aAAa,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC1B;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAErE;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE,+DAA+D;IAC/D,MAAM,CACF,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5B;;;;;;;;;;;;OAYG;IACH,aAAa,CACT,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;OAKG;IACH,eAAe,CACX,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;;;;OASG;IACH,IAAI,CACA,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE7B;;;;OAIG;IACH,GAAG,CACC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,yDAAyD;AACzD,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,yCAAyC;AACzC,eAAO,MAAM,mBAAmB,QAAO,kBACb,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InjectRevisionStore = exports.REVISION_STORE = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
/** DI token the {@link RevisionStore} is bound under. */
|
|
6
|
+
exports.REVISION_STORE = Symbol('REVISION_STORE');
|
|
7
|
+
/** Injects the {@link RevisionStore}. */
|
|
8
|
+
const InjectRevisionStore = () => (0, common_1.Inject)(exports.REVISION_STORE);
|
|
9
|
+
exports.InjectRevisionStore = InjectRevisionStore;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { EventActor } from '@orthacms/database';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { PublishEntryUseCase } from '../../../entries/application/use-cases/publish-entry.use-case';
|
|
4
|
+
import type { EntryRecord } from '../../../entries/types/entry-list-view';
|
|
5
|
+
import { type RevisionStore } from '../ports/revision-store';
|
|
6
|
+
import { RestoreRevisionUseCase } from './restore-revision.use-case';
|
|
7
|
+
/**
|
|
8
|
+
* **Publish a specific version** — make any version the entry's live one, so an
|
|
9
|
+
* editor can switch back to an earlier version and publish it (not only the
|
|
10
|
+
* newest draft).
|
|
11
|
+
*
|
|
12
|
+
* Publishing marks the **chosen version itself** live: it is flipped to
|
|
13
|
+
* `published` in place and the previously-published one to `superseded` (via
|
|
14
|
+
* {@link PublishEntryUseCase}). Publishing an **earlier** version first
|
|
15
|
+
* re-applies its content onto the live row (through
|
|
16
|
+
* {@link RestoreRevisionUseCase}, with `appendRevision: false`) so the live
|
|
17
|
+
* document matches what is published — but records **no new version** for it.
|
|
18
|
+
* Publishing v2 therefore leaves the timeline at its existing length with v2
|
|
19
|
+
* marked live, rather than minting a v6 copy of v2 on every publish.
|
|
20
|
+
*
|
|
21
|
+
* History is still never rewritten or deleted — only version *statuses* move,
|
|
22
|
+
* which is what publish means. One consequence to know: after publishing an
|
|
23
|
+
* earlier version the **latest** version is no longer the live content (it is a
|
|
24
|
+
* newer draft that was not published). The timeline distinguishes the two —
|
|
25
|
+
* "Live" marks the published version, "Current" the newest one — and the next
|
|
26
|
+
* save appends a version equal to the live row again.
|
|
27
|
+
*
|
|
28
|
+
* Publishing re-validates through the publish gate, so an incomplete old version
|
|
29
|
+
* surfaces the same `422 { issues }` a normal publish would (the content has
|
|
30
|
+
* already been re-applied in that case, leaving it live as a draft — a
|
|
31
|
+
* deliberate, recoverable state, not a rewrite of history).
|
|
32
|
+
*/
|
|
33
|
+
export declare class PublishRevisionUseCase {
|
|
34
|
+
private readonly restoreRevision;
|
|
35
|
+
private readonly publishEntry;
|
|
36
|
+
private readonly store;
|
|
37
|
+
constructor(restoreRevision: RestoreRevisionUseCase, publishEntry: PublishEntryUseCase, store: RevisionStore);
|
|
38
|
+
execute(type: AnyContentType, id: string, number: number, workspaceId: string, actor: EventActor | null): Promise<EntryRecord>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=publish-revision.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-revision.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/lib/revisions/application/use-cases/publish-revision.use-case.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAEH,KAAK,aAAa,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,sBAAsB;IAE3B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY;IACN,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAF5B,eAAe,EAAE,sBAAsB,EACvC,YAAY,EAAE,mBAAmB,EACV,KAAK,EAAE,aAAa;IAG1D,OAAO,CACT,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,UAAU,GAAG,IAAI,GACzB,OAAO,CAAC,WAAW,CAAC;CA8B1B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublishRevisionUseCase = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const publish_entry_use_case_1 = require("../../../entries/application/use-cases/publish-entry.use-case");
|
|
7
|
+
const revision_store_1 = require("../ports/revision-store");
|
|
8
|
+
const restore_revision_use_case_1 = require("./restore-revision.use-case");
|
|
9
|
+
/**
|
|
10
|
+
* **Publish a specific version** — make any version the entry's live one, so an
|
|
11
|
+
* editor can switch back to an earlier version and publish it (not only the
|
|
12
|
+
* newest draft).
|
|
13
|
+
*
|
|
14
|
+
* Publishing marks the **chosen version itself** live: it is flipped to
|
|
15
|
+
* `published` in place and the previously-published one to `superseded` (via
|
|
16
|
+
* {@link PublishEntryUseCase}). Publishing an **earlier** version first
|
|
17
|
+
* re-applies its content onto the live row (through
|
|
18
|
+
* {@link RestoreRevisionUseCase}, with `appendRevision: false`) so the live
|
|
19
|
+
* document matches what is published — but records **no new version** for it.
|
|
20
|
+
* Publishing v2 therefore leaves the timeline at its existing length with v2
|
|
21
|
+
* marked live, rather than minting a v6 copy of v2 on every publish.
|
|
22
|
+
*
|
|
23
|
+
* History is still never rewritten or deleted — only version *statuses* move,
|
|
24
|
+
* which is what publish means. One consequence to know: after publishing an
|
|
25
|
+
* earlier version the **latest** version is no longer the live content (it is a
|
|
26
|
+
* newer draft that was not published). The timeline distinguishes the two —
|
|
27
|
+
* "Live" marks the published version, "Current" the newest one — and the next
|
|
28
|
+
* save appends a version equal to the live row again.
|
|
29
|
+
*
|
|
30
|
+
* Publishing re-validates through the publish gate, so an incomplete old version
|
|
31
|
+
* surfaces the same `422 { issues }` a normal publish would (the content has
|
|
32
|
+
* already been re-applied in that case, leaving it live as a draft — a
|
|
33
|
+
* deliberate, recoverable state, not a rewrite of history).
|
|
34
|
+
*/
|
|
35
|
+
let PublishRevisionUseCase = class PublishRevisionUseCase {
|
|
36
|
+
restoreRevision;
|
|
37
|
+
publishEntry;
|
|
38
|
+
store;
|
|
39
|
+
constructor(restoreRevision, publishEntry, store) {
|
|
40
|
+
this.restoreRevision = restoreRevision;
|
|
41
|
+
this.publishEntry = publishEntry;
|
|
42
|
+
this.store = store;
|
|
43
|
+
}
|
|
44
|
+
async execute(type, id, number, workspaceId, actor) {
|
|
45
|
+
const detail = await this.store.get(type.name, id, workspaceId, number);
|
|
46
|
+
if (!detail) {
|
|
47
|
+
throw new common_1.NotFoundException(`No revision #${number} for entry "${id}" on "${type.name}".`);
|
|
48
|
+
}
|
|
49
|
+
// Only re-apply an *earlier* version; the latest is already the live row.
|
|
50
|
+
// `appendRevision: false` — this version already exists in the timeline
|
|
51
|
+
// and is about to be marked live, so a copy of it would be noise.
|
|
52
|
+
if (!detail.isLatest) {
|
|
53
|
+
await this.restoreRevision.execute(type, id, number, workspaceId, actor, { appendRevision: false });
|
|
54
|
+
}
|
|
55
|
+
// Mark *this* version live (not merely "the latest"), now that the live
|
|
56
|
+
// row carries its content.
|
|
57
|
+
return this.publishEntry.execute(type, id, workspaceId, actor ?? undefined, number);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.PublishRevisionUseCase = PublishRevisionUseCase;
|
|
61
|
+
exports.PublishRevisionUseCase = PublishRevisionUseCase = tslib_1.__decorate([
|
|
62
|
+
(0, common_1.Injectable)(),
|
|
63
|
+
tslib_1.__param(2, (0, revision_store_1.InjectRevisionStore)()),
|
|
64
|
+
tslib_1.__metadata("design:paramtypes", [restore_revision_use_case_1.RestoreRevisionUseCase,
|
|
65
|
+
publish_entry_use_case_1.PublishEntryUseCase, Object])
|
|
66
|
+
], PublishRevisionUseCase);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EventActor } from '@orthacms/database';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { EntryWriterService } from '../../../entries/infrastructure/persistence/entry-writer.service';
|
|
4
|
+
import type { EntryRecord } from '../../../entries/types/entry-list-view';
|
|
5
|
+
import { type RevisionStore } from '../ports/revision-store';
|
|
6
|
+
/**
|
|
7
|
+
* Restore an entry to an earlier revision. History is **append-only** — a
|
|
8
|
+
* restore never rewrites or deletes past versions: it applies the chosen
|
|
9
|
+
* snapshot back onto the live row through the normal save path, which in turn
|
|
10
|
+
* records the restore as a **new** draft revision (so v5 restoring v2 yields a
|
|
11
|
+
* fresh v6 equal to v2). The snapshot's `values` (scalars, localized + shared
|
|
12
|
+
* fields, single-relation FKs) and its owning many-to-many link sets are
|
|
13
|
+
* re-applied; inverse relations mirror their owning side and aren't written from
|
|
14
|
+
* here.
|
|
15
|
+
*/
|
|
16
|
+
export declare class RestoreRevisionUseCase {
|
|
17
|
+
private readonly writer;
|
|
18
|
+
private readonly store;
|
|
19
|
+
constructor(writer: EntryWriterService, store: RevisionStore);
|
|
20
|
+
execute(type: AnyContentType, id: string, number: number, workspaceId: string,
|
|
21
|
+
/**
|
|
22
|
+
* The acting user — stamped on the new revision and on the
|
|
23
|
+
* `entry.updated` event the underlying save raises, so a restore is
|
|
24
|
+
* attributable in the audit log like any other edit.
|
|
25
|
+
*/
|
|
26
|
+
actor: EventActor | null, options?: {
|
|
27
|
+
/**
|
|
28
|
+
* Whether this restore records a new version (default `true` — the
|
|
29
|
+
* append-only Restore action). {@link PublishRevisionUseCase} passes
|
|
30
|
+
* `false`: it re-applies the snapshot only so the chosen version's
|
|
31
|
+
* content is live, then marks *that* version published in place.
|
|
32
|
+
*/
|
|
33
|
+
appendRevision?: boolean;
|
|
34
|
+
}): Promise<EntryRecord>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=restore-revision.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-revision.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/lib/revisions/application/use-cases/restore-revision.use-case.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kEAAkE,CAAC;AACtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAEH,KAAK,aAAa,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;GASG;AACH,qBACa,sBAAsB;IAE3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACA,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAD5B,MAAM,EAAE,kBAAkB,EACH,KAAK,EAAE,aAAa;IAG1D,OAAO,CACT,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM;IACnB;;;;OAIG;IACH,KAAK,EAAE,UAAU,GAAG,IAAI,EACxB,OAAO,CAAC,EAAE;QACN;;;;;WAKG;QACH,cAAc,CAAC,EAAE,OAAO,CAAC;KAC5B,GACF,OAAO,CAAC,WAAW,CAAC;CA+B1B"}
|