@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,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The content plugin's pass over the host's OpenAPI document.
|
|
4
|
+
*
|
|
5
|
+
* `@nestjs/swagger` reflects static TypeScript, and this plugin's contract is
|
|
6
|
+
* runtime data: one generic controller set serves **every** code-defined
|
|
7
|
+
* content type, so the scanner sees `/content/{typeName}` with an opaque string
|
|
8
|
+
* param and no response shape at all. This pass fills both gaps from the
|
|
9
|
+
* registry — the real type names as an enum, and a typed entry/list schema per
|
|
10
|
+
* type — so a reader of the reference sees `article` and `home_page`, not
|
|
11
|
+
* "some object".
|
|
12
|
+
*
|
|
13
|
+
* Pure: it takes the document and the serialized types, and mutates only the
|
|
14
|
+
* paths this plugin owns.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.describeContentApi = describeContentApi;
|
|
18
|
+
const content_schemas_1 = require("./content-schemas");
|
|
19
|
+
/** The entry read/write shorthands, since most operations return one. */
|
|
20
|
+
const ENTRY = { response: { kind: 'entry' } };
|
|
21
|
+
const VALIDATED_ENTRY = {
|
|
22
|
+
response: { kind: 'entry' },
|
|
23
|
+
validated: true
|
|
24
|
+
};
|
|
25
|
+
const EMPTY = { response: { kind: 'empty' } };
|
|
26
|
+
/** An operation returning one of the fixed shared schemas. */
|
|
27
|
+
function shared(name) {
|
|
28
|
+
return { response: { kind: 'schema', name } };
|
|
29
|
+
}
|
|
30
|
+
/** Entry routes, keyed by what follows `/content/{typeName}`. */
|
|
31
|
+
const ENTRY_ROUTES = {
|
|
32
|
+
'': { get: { response: { kind: 'listPage' } }, post: VALIDATED_ENTRY },
|
|
33
|
+
'/{id}': { get: ENTRY, patch: VALIDATED_ENTRY, delete: EMPTY },
|
|
34
|
+
'/{id}/media': { get: shared('EntryMedia') },
|
|
35
|
+
'/{id}/relations': { get: shared('EntryRelations') },
|
|
36
|
+
'/{id}/relations/{field}': { get: shared('RelationFieldPage') },
|
|
37
|
+
'/{id}/publish': { post: VALIDATED_ENTRY },
|
|
38
|
+
'/{id}/unpublish': { post: ENTRY },
|
|
39
|
+
'/{id}/restore': { post: ENTRY },
|
|
40
|
+
'/{id}/permanent': { delete: EMPTY },
|
|
41
|
+
'/{id}/revisions': { get: shared('RevisionList') },
|
|
42
|
+
'/{id}/revisions/{number}': { get: shared('RevisionDetail') },
|
|
43
|
+
'/{id}/revisions/{number}/restore': { post: VALIDATED_ENTRY },
|
|
44
|
+
'/{id}/revisions/{number}/publish': { post: VALIDATED_ENTRY },
|
|
45
|
+
'/bulk': { post: shared('BulkSaveResult') },
|
|
46
|
+
'/bulk/publish/preview': { post: shared('BulkPublishPreview') },
|
|
47
|
+
'/bulk/publish': {
|
|
48
|
+
post: { response: { kind: 'schema', name: 'BulkPublishResult' } }
|
|
49
|
+
},
|
|
50
|
+
'/bulk/unpublish': { post: shared('BulkActionResult') },
|
|
51
|
+
'/bulk/delete': { post: shared('BulkActionResult') },
|
|
52
|
+
'/bulk/restore': { post: shared('BulkActionResult') },
|
|
53
|
+
'/bulk/purge': { post: shared('BulkActionResult') }
|
|
54
|
+
};
|
|
55
|
+
/** Schema routes, keyed by what follows `/content-schema`. */
|
|
56
|
+
const SCHEMA_ROUTES = {
|
|
57
|
+
'': { get: shared('ContentTypeSummaryList') },
|
|
58
|
+
'/{name}': { get: shared('ContentTypeSchema') },
|
|
59
|
+
'/{name}/filter-fields': { get: shared('FilterFields') }
|
|
60
|
+
};
|
|
61
|
+
/** Matches `<prefix>/content/{typeName}<rest>`. */
|
|
62
|
+
const ENTRY_ROUTE_RE = /\/content\/\{typeName\}(.*)$/;
|
|
63
|
+
/** Matches `<prefix>/content-schema<rest>`. */
|
|
64
|
+
const SCHEMA_ROUTE_RE = /\/content-schema(.*)$/;
|
|
65
|
+
/**
|
|
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.
|
|
69
|
+
*/
|
|
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) {
|
|
96
|
+
const parameter = operation.parameters?.find((candidate) => candidate.name === 'typeName' && candidate.in === 'path');
|
|
97
|
+
if (!parameter) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
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.';
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
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.
|
|
107
|
+
* A single registered type needs no union.
|
|
108
|
+
*/
|
|
109
|
+
function unionOf(names) {
|
|
110
|
+
return names.length === 1
|
|
111
|
+
? (0, content_schemas_1.ref)(names[0])
|
|
112
|
+
: { oneOf: names.map((name) => (0, content_schemas_1.ref)(name)) };
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Adds this plugin's schemas to `document` and describes its own operations:
|
|
116
|
+
* the `typeName` enum, per-type response schemas, and the documented failures.
|
|
117
|
+
*/
|
|
118
|
+
function describeContentApi(document, types) {
|
|
119
|
+
document.components ??= {};
|
|
120
|
+
document.components.schemas ??= {};
|
|
121
|
+
Object.assign(document.components.schemas, (0, content_schemas_1.buildContentSchemas)(types));
|
|
122
|
+
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));
|
|
125
|
+
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) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const routes = entryMatch ? ENTRY_ROUTES : SCHEMA_ROUTES;
|
|
133
|
+
const byMethod = routes[rest];
|
|
134
|
+
if (!byMethod) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
for (const [method, operation] of Object.entries(item)) {
|
|
138
|
+
const spec = byMethod[method];
|
|
139
|
+
if (!spec || !operation || typeof operation !== 'object') {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (entryMatch) {
|
|
143
|
+
describeTypeNameParam(operation, typeNames);
|
|
144
|
+
addErrorResponse(operation, '404', 'Unknown content type, or no entry with this id in the workspace.');
|
|
145
|
+
if (spec.validated) {
|
|
146
|
+
addErrorResponse(operation, '422', 'The values failed the content type’s field validation.', {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
message: { type: 'string' },
|
|
150
|
+
issues: {
|
|
151
|
+
type: 'array',
|
|
152
|
+
items: (0, content_schemas_1.ref)('ValidationIssue')
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
required: ['message', 'issues']
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// With no registered types there is no entry shape to describe —
|
|
160
|
+
// and every one of these routes 404s anyway.
|
|
161
|
+
const { response } = spec;
|
|
162
|
+
if (response.kind === 'entry' && typeNames.length) {
|
|
163
|
+
setSuccessResponse(operation, entryUnion, 'The entry.');
|
|
164
|
+
}
|
|
165
|
+
else if (response.kind === 'listPage' && typeNames.length) {
|
|
166
|
+
setSuccessResponse(operation, listUnion, 'One page of entries.');
|
|
167
|
+
}
|
|
168
|
+
else if (response.kind === 'schema') {
|
|
169
|
+
setSuccessResponse(operation, (0, content_schemas_1.ref)(response.name), 'OK.');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field spec → JSON Schema. The pure half of the OpenAPI description: given one
|
|
3
|
+
* serialized field, produce the schema its value takes on the wire.
|
|
4
|
+
*
|
|
5
|
+
* No NestJS, no registry, no document — just the mapping, so the table below is
|
|
6
|
+
* unit-testable on its own.
|
|
7
|
+
*/
|
|
8
|
+
import type { SerializedField } from '../registry/content-type-registry';
|
|
9
|
+
/** A JSON Schema fragment, as it appears in the OpenAPI document. */
|
|
10
|
+
export type OpenApiSchema = Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the field's value travels in the `values` bag at all. A many-relation
|
|
13
|
+
* and an inverse back-reference own no column — their links live in join tables
|
|
14
|
+
* and are read through the relation routes — so they are absent from a record's
|
|
15
|
+
* `values`, exactly as `toRecord` builds it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isValueField(field: SerializedField): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The documented schema of one field: its value schema plus the presentation
|
|
20
|
+
* facts a reader needs — the admin label as `title`, help text and the
|
|
21
|
+
* relation/localization notes as `description`.
|
|
22
|
+
*
|
|
23
|
+
* Every property is `nullable`: an unset field reads back as `null`, and on a
|
|
24
|
+
* publishable type even a required one may legitimately be empty in a draft
|
|
25
|
+
* (required means "required *to publish*").
|
|
26
|
+
*/
|
|
27
|
+
export declare function fieldSchema(field: SerializedField): OpenApiSchema;
|
|
28
|
+
//# sourceMappingURL=field-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-schema.d.ts","sourceRoot":"","sources":["../../../src/lib/docs/field-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAyJpD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAK5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CA0DjE"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Field spec → JSON Schema. The pure half of the OpenAPI description: given one
|
|
4
|
+
* serialized field, produce the schema its value takes on the wire.
|
|
5
|
+
*
|
|
6
|
+
* No NestJS, no registry, no document — just the mapping, so the table below is
|
|
7
|
+
* unit-testable on its own.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.isValueField = isValueField;
|
|
11
|
+
exports.fieldSchema = fieldSchema;
|
|
12
|
+
const fields_1 = require("../types/fields");
|
|
13
|
+
/** The `uuid`-shaped string every id value takes. */
|
|
14
|
+
const UUID_SCHEMA = { type: 'string', format: 'uuid' };
|
|
15
|
+
/**
|
|
16
|
+
* A rich-text body: the **document** the editor produces, or — for a body
|
|
17
|
+
* written before rich text became structured, and not yet re-saved — the HTML
|
|
18
|
+
* string it is still stored as. Both are accepted on a write and either may
|
|
19
|
+
* come back on a read, which is what `oneOf` says here.
|
|
20
|
+
*
|
|
21
|
+
* The node tree is described one level deep and left open (`additionalProperties`
|
|
22
|
+
* on `attrs`, a self-`$ref`-free `content`): the node vocabulary is the
|
|
23
|
+
* editor's, not this schema's, and pinning it here would make every editor
|
|
24
|
+
* extension a change to the published API description.
|
|
25
|
+
*
|
|
26
|
+
* `minLength`/`maxLength` are deliberately **not** copied onto it. They are
|
|
27
|
+
* real rules, but they count the body's *text*, and a JSON Schema `maxLength`
|
|
28
|
+
* on this value would be read as a bound on the serialized document — a
|
|
29
|
+
* different, wrong promise. The field's description carries them in words.
|
|
30
|
+
*/
|
|
31
|
+
const RICH_TEXT_SCHEMA = {
|
|
32
|
+
oneOf: [
|
|
33
|
+
{
|
|
34
|
+
type: 'object',
|
|
35
|
+
title: 'RichTextDocument',
|
|
36
|
+
required: ['type'],
|
|
37
|
+
properties: {
|
|
38
|
+
type: { type: 'string', enum: ['doc'] },
|
|
39
|
+
content: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
items: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['type'],
|
|
44
|
+
properties: {
|
|
45
|
+
type: { type: 'string' },
|
|
46
|
+
attrs: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
additionalProperties: true
|
|
49
|
+
},
|
|
50
|
+
marks: { type: 'array', items: { type: 'object' } },
|
|
51
|
+
text: { type: 'string' },
|
|
52
|
+
content: {
|
|
53
|
+
type: 'array',
|
|
54
|
+
items: { type: 'object' }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
additionalProperties: true
|
|
62
|
+
},
|
|
63
|
+
{ type: 'string', description: 'Legacy HTML body (read-compatible).' }
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The schema of a field's **value**, before the nullability and description
|
|
68
|
+
* wrapping {@link fieldSchema} adds.
|
|
69
|
+
*
|
|
70
|
+
* A `json` field deliberately produces `{}` — "any JSON" — rather than
|
|
71
|
+
* `type: 'object'`: the column holds whatever the author stores, arrays and
|
|
72
|
+
* scalars included.
|
|
73
|
+
*/
|
|
74
|
+
function valueSchema(field) {
|
|
75
|
+
const { validation } = field;
|
|
76
|
+
switch (field.type) {
|
|
77
|
+
case fields_1.CONTENT_FIELD_TYPE.Text:
|
|
78
|
+
return {
|
|
79
|
+
type: 'string',
|
|
80
|
+
...pick(validation, ['minLength', 'maxLength']),
|
|
81
|
+
...(typeof validation['pattern'] === 'string'
|
|
82
|
+
? { pattern: validation['pattern'] }
|
|
83
|
+
: {})
|
|
84
|
+
};
|
|
85
|
+
case fields_1.CONTENT_FIELD_TYPE.RichText:
|
|
86
|
+
return RICH_TEXT_SCHEMA;
|
|
87
|
+
case fields_1.CONTENT_FIELD_TYPE.Number:
|
|
88
|
+
return {
|
|
89
|
+
type: validation['integer'] === true ? 'integer' : 'number',
|
|
90
|
+
...renameBounds(validation)
|
|
91
|
+
};
|
|
92
|
+
case fields_1.CONTENT_FIELD_TYPE.Money:
|
|
93
|
+
return { type: 'number', ...renameBounds(validation) };
|
|
94
|
+
case fields_1.CONTENT_FIELD_TYPE.Boolean:
|
|
95
|
+
return { type: 'boolean' };
|
|
96
|
+
case fields_1.CONTENT_FIELD_TYPE.Date:
|
|
97
|
+
return { type: 'string', format: 'date' };
|
|
98
|
+
case fields_1.CONTENT_FIELD_TYPE.Datetime:
|
|
99
|
+
return { type: 'string', format: 'date-time' };
|
|
100
|
+
case fields_1.CONTENT_FIELD_TYPE.Select:
|
|
101
|
+
return {
|
|
102
|
+
type: 'string',
|
|
103
|
+
...(field.options ? { enum: [...field.options] } : {})
|
|
104
|
+
};
|
|
105
|
+
case fields_1.CONTENT_FIELD_TYPE.Multiselect:
|
|
106
|
+
return {
|
|
107
|
+
type: 'array',
|
|
108
|
+
items: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
...(field.options ? { enum: [...field.options] } : {})
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
case fields_1.CONTENT_FIELD_TYPE.Json:
|
|
114
|
+
return {};
|
|
115
|
+
case fields_1.CONTENT_FIELD_TYPE.Relation:
|
|
116
|
+
// Only an owning **single** relation rides the values bag, as its
|
|
117
|
+
// raw FK; the join-backed kinds never reach here (the caller drops
|
|
118
|
+
// them, mirroring `toRecord`).
|
|
119
|
+
return UUID_SCHEMA;
|
|
120
|
+
case fields_1.CONTENT_FIELD_TYPE.Media:
|
|
121
|
+
return field.multiple
|
|
122
|
+
? { type: 'array', items: UUID_SCHEMA }
|
|
123
|
+
: UUID_SCHEMA;
|
|
124
|
+
default:
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Copies the listed numeric validation keys through, when present. */
|
|
129
|
+
function pick(validation, keys) {
|
|
130
|
+
const out = {};
|
|
131
|
+
for (const key of keys) {
|
|
132
|
+
if (typeof validation[key] === 'number') {
|
|
133
|
+
out[key] = validation[key];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
/** One numeric validation rule off a field, when it has one. */
|
|
139
|
+
function validationNumber(field, key) {
|
|
140
|
+
const value = field.validation[key];
|
|
141
|
+
return typeof value === 'number' ? value : undefined;
|
|
142
|
+
}
|
|
143
|
+
/** `min`/`max` are JSON Schema's `minimum`/`maximum`. */
|
|
144
|
+
function renameBounds(validation) {
|
|
145
|
+
const out = {};
|
|
146
|
+
if (typeof validation['min'] === 'number')
|
|
147
|
+
out['minimum'] = validation['min'];
|
|
148
|
+
if (typeof validation['max'] === 'number')
|
|
149
|
+
out['maximum'] = validation['max'];
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Whether the field's value travels in the `values` bag at all. A many-relation
|
|
154
|
+
* and an inverse back-reference own no column — their links live in join tables
|
|
155
|
+
* and are read through the relation routes — so they are absent from a record's
|
|
156
|
+
* `values`, exactly as `toRecord` builds it.
|
|
157
|
+
*/
|
|
158
|
+
function isValueField(field) {
|
|
159
|
+
return !(field.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
160
|
+
(field.relation?.many || field.relation?.inverse));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The documented schema of one field: its value schema plus the presentation
|
|
164
|
+
* facts a reader needs — the admin label as `title`, help text and the
|
|
165
|
+
* relation/localization notes as `description`.
|
|
166
|
+
*
|
|
167
|
+
* Every property is `nullable`: an unset field reads back as `null`, and on a
|
|
168
|
+
* publishable type even a required one may legitimately be empty in a draft
|
|
169
|
+
* (required means "required *to publish*").
|
|
170
|
+
*/
|
|
171
|
+
function fieldSchema(field) {
|
|
172
|
+
const notes = [];
|
|
173
|
+
if (typeof field.admin['description'] === 'string') {
|
|
174
|
+
notes.push(field.admin['description']);
|
|
175
|
+
}
|
|
176
|
+
if (field.relation) {
|
|
177
|
+
notes.push(`Id of the related \`${field.relation.to}\` entry${field.relation.unique ? ' (one-to-one)' : ''}.`);
|
|
178
|
+
}
|
|
179
|
+
if (field.type === fields_1.CONTENT_FIELD_TYPE.Media) {
|
|
180
|
+
notes.push(field.multiple
|
|
181
|
+
? 'Ordered media-asset ids.'
|
|
182
|
+
: 'Media-asset id (`GET /api/media/assets/{id}/raw` serves the bytes).');
|
|
183
|
+
}
|
|
184
|
+
if (field.localized) {
|
|
185
|
+
notes.push('Localized — varies per locale row.');
|
|
186
|
+
}
|
|
187
|
+
if (field.type === fields_1.CONTENT_FIELD_TYPE.Json) {
|
|
188
|
+
notes.push('Arbitrary JSON.');
|
|
189
|
+
}
|
|
190
|
+
if (field.type === fields_1.CONTENT_FIELD_TYPE.RichText) {
|
|
191
|
+
notes.push('Rich text as a structured document (ProseMirror/TipTap JSON); a ' +
|
|
192
|
+
'legacy HTML string is still accepted and still read back until ' +
|
|
193
|
+
'the entry is next saved from the editor.');
|
|
194
|
+
const min = validationNumber(field, 'minLength');
|
|
195
|
+
const max = validationNumber(field, 'maxLength');
|
|
196
|
+
if (min !== undefined || max !== undefined) {
|
|
197
|
+
// Said in words rather than as a JSON Schema `maxLength`, which
|
|
198
|
+
// would bound the serialized document instead of the prose.
|
|
199
|
+
notes.push(`Length rules count the body's text, not its markup${min !== undefined ? `; at least ${min} characters` : ''}${max !== undefined ? `; at most ${max} characters` : ''}.`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (field.lang) {
|
|
203
|
+
notes.push(`Written in \`${field.lang}\` (BCP-47).`);
|
|
204
|
+
}
|
|
205
|
+
const label = typeof field.admin['label'] === 'string'
|
|
206
|
+
? field.admin['label']
|
|
207
|
+
: undefined;
|
|
208
|
+
return {
|
|
209
|
+
...valueSchema(field),
|
|
210
|
+
nullable: true,
|
|
211
|
+
...(label ? { title: label } : {}),
|
|
212
|
+
...(notes.length ? { description: notes.join(' ') } : {})
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OutboxWriter, UnitOfWork } from '@orthacms/database';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { EntryValidationService } from '../../../validation/services/entry-validation.service';
|
|
4
|
+
import { EntryWriterService } from '../../infrastructure/persistence/entry-writer.service';
|
|
5
|
+
import { type BulkPublishResult } from '../../types/bulk-publish';
|
|
6
|
+
/**
|
|
7
|
+
* Commit a bulk publish. Preserves the original single **locked** transaction:
|
|
8
|
+
* the candidate rows are selected `FOR UPDATE` and re-validated inside one
|
|
9
|
+
* unit of work, so a concurrent edit can't invalidate a row between the dry run
|
|
10
|
+
* and the write (the TOCTOU window the original defended). Publishes only the
|
|
11
|
+
* `publishable` ids, reporting which were skipped and why (partial success),
|
|
12
|
+
* and appends one `entry.published` event per newly-published id to the outbox —
|
|
13
|
+
* atomically with the batch.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BulkPublishEntriesUseCase {
|
|
16
|
+
private readonly uow;
|
|
17
|
+
private readonly outbox;
|
|
18
|
+
private readonly writer;
|
|
19
|
+
private readonly validation;
|
|
20
|
+
constructor(uow: UnitOfWork, outbox: OutboxWriter, writer: EntryWriterService, validation: EntryValidationService);
|
|
21
|
+
execute(type: AnyContentType, ids: string[], workspaceId: string): Promise<BulkPublishResult>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=bulk-publish-entries.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-publish-entries.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/application/use-cases/bulk-publish-entries.use-case.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAE3F,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGhF;;;;;;;;GAQG;AACH,qBACa,yBAAyB;IAE9B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAHV,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,sBAAsB;IAGjD,OAAO,CACT,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EAAE,EACb,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC;CA6DhC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulkPublishEntriesUseCase = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const database_1 = require("@orthacms/database");
|
|
7
|
+
const content_domain_1 = require("@orthacms/content-domain");
|
|
8
|
+
const entry_validation_service_1 = require("../../../validation/services/entry-validation.service");
|
|
9
|
+
const entry_writer_service_1 = require("../../infrastructure/persistence/entry-writer.service");
|
|
10
|
+
const bulk_publish_verdicts_1 = require("../../infrastructure/persistence/bulk-publish-verdicts");
|
|
11
|
+
const bulk_publish_1 = require("../../types/bulk-publish");
|
|
12
|
+
const entry_1 = require("../../domain/entry");
|
|
13
|
+
/**
|
|
14
|
+
* Commit a bulk publish. Preserves the original single **locked** transaction:
|
|
15
|
+
* the candidate rows are selected `FOR UPDATE` and re-validated inside one
|
|
16
|
+
* unit of work, so a concurrent edit can't invalidate a row between the dry run
|
|
17
|
+
* and the write (the TOCTOU window the original defended). Publishes only the
|
|
18
|
+
* `publishable` ids, reporting which were skipped and why (partial success),
|
|
19
|
+
* and appends one `entry.published` event per newly-published id to the outbox —
|
|
20
|
+
* atomically with the batch.
|
|
21
|
+
*/
|
|
22
|
+
let BulkPublishEntriesUseCase = class BulkPublishEntriesUseCase {
|
|
23
|
+
uow;
|
|
24
|
+
outbox;
|
|
25
|
+
writer;
|
|
26
|
+
validation;
|
|
27
|
+
constructor(uow, outbox, writer, validation) {
|
|
28
|
+
this.uow = uow;
|
|
29
|
+
this.outbox = outbox;
|
|
30
|
+
this.writer = writer;
|
|
31
|
+
this.validation = validation;
|
|
32
|
+
}
|
|
33
|
+
async execute(type, ids, workspaceId) {
|
|
34
|
+
if (!type.publishable) {
|
|
35
|
+
throw new common_1.BadRequestException(`Content type "${type.name}" is not publishable.`);
|
|
36
|
+
}
|
|
37
|
+
if (!ids.length)
|
|
38
|
+
return { published: [], skipped: [] };
|
|
39
|
+
return this.uow.run(async () => {
|
|
40
|
+
const exec = this.uow.current();
|
|
41
|
+
const byId = await this.writer.loadLiveByIdsForUpdate(exec, type, ids, workspaceId);
|
|
42
|
+
const items = (0, bulk_publish_verdicts_1.computeBulkPublishVerdicts)(type, ids, byId, (t, values) => this.validation.validate(t, values));
|
|
43
|
+
const published = items
|
|
44
|
+
.filter((item) => item.verdict === bulk_publish_1.BULK_VERDICT.Publishable)
|
|
45
|
+
.map((item) => item.id);
|
|
46
|
+
if (published.length) {
|
|
47
|
+
await this.writer.markPublishedBulk(exec, type, published, workspaceId);
|
|
48
|
+
// Promote each published entry's latest revision to live, so the
|
|
49
|
+
// history timeline matches however the entry was published.
|
|
50
|
+
for (const id of published) {
|
|
51
|
+
await this.writer.markRevisionPublished(exec, id, workspaceId);
|
|
52
|
+
}
|
|
53
|
+
await this.outbox.append(published.flatMap((id) => {
|
|
54
|
+
const entry = entry_1.Entry.rehydrate({
|
|
55
|
+
id,
|
|
56
|
+
contentType: type.name,
|
|
57
|
+
status: content_domain_1.ENTRY_STATUS.Draft
|
|
58
|
+
});
|
|
59
|
+
entry.publish({ valid: true, issues: [] });
|
|
60
|
+
return entry.pullEvents();
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
const skipped = items
|
|
64
|
+
.filter((item) => item.verdict !== bulk_publish_1.BULK_VERDICT.Publishable)
|
|
65
|
+
.map((item) => ({ id: item.id, reason: item.verdict }));
|
|
66
|
+
return { published, skipped };
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.BulkPublishEntriesUseCase = BulkPublishEntriesUseCase;
|
|
71
|
+
exports.BulkPublishEntriesUseCase = BulkPublishEntriesUseCase = tslib_1.__decorate([
|
|
72
|
+
(0, common_1.Injectable)(),
|
|
73
|
+
tslib_1.__metadata("design:paramtypes", [database_1.UnitOfWork,
|
|
74
|
+
database_1.OutboxWriter,
|
|
75
|
+
entry_writer_service_1.EntryWriterService,
|
|
76
|
+
entry_validation_service_1.EntryValidationService])
|
|
77
|
+
], BulkPublishEntriesUseCase);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OutboxWriter, UnitOfWork } from '@orthacms/database';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { EntryWriterService } from '../../infrastructure/persistence/entry-writer.service';
|
|
4
|
+
import type { BulkActionResult } from '../../types/bulk-publish';
|
|
5
|
+
/**
|
|
6
|
+
* Revert a set of live entries to draft. Runs inside one {@link UnitOfWork}, and
|
|
7
|
+
* **one set of ids runs through all three effects**: the `{ count }` reported,
|
|
8
|
+
* the revisions reverted, and the `entry.unpublished` events appended are the
|
|
9
|
+
* rows that were `published` before the write and no others.
|
|
10
|
+
*
|
|
11
|
+
* The count used to be broader — every live row the id list matched, draft ones
|
|
12
|
+
* included — while the events were already per real transition. Two numbers for
|
|
13
|
+
* one operation, and the wider of them was the one the caller was shown. 400 on
|
|
14
|
+
* a non-publishable type.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BulkUnpublishEntriesUseCase {
|
|
17
|
+
private readonly uow;
|
|
18
|
+
private readonly outbox;
|
|
19
|
+
private readonly writer;
|
|
20
|
+
constructor(uow: UnitOfWork, outbox: OutboxWriter, writer: EntryWriterService);
|
|
21
|
+
execute(type: AnyContentType, ids: string[], workspaceId: string): Promise<BulkActionResult>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=bulk-unpublish-entries.use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-unpublish-entries.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE;;;;;;;;;;GAUG;AACH,qBACa,2BAA2B;IAEhC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,kBAAkB;IAGzC,OAAO,CACT,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EAAE,EACb,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,gBAAgB,CAAC;CA+C/B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulkUnpublishEntriesUseCase = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const database_1 = require("@orthacms/database");
|
|
7
|
+
const content_domain_1 = require("@orthacms/content-domain");
|
|
8
|
+
const entry_writer_service_1 = require("../../infrastructure/persistence/entry-writer.service");
|
|
9
|
+
const entry_1 = require("../../domain/entry");
|
|
10
|
+
/**
|
|
11
|
+
* Revert a set of live entries to draft. Runs inside one {@link UnitOfWork}, and
|
|
12
|
+
* **one set of ids runs through all three effects**: the `{ count }` reported,
|
|
13
|
+
* the revisions reverted, and the `entry.unpublished` events appended are the
|
|
14
|
+
* rows that were `published` before the write and no others.
|
|
15
|
+
*
|
|
16
|
+
* The count used to be broader — every live row the id list matched, draft ones
|
|
17
|
+
* included — while the events were already per real transition. Two numbers for
|
|
18
|
+
* one operation, and the wider of them was the one the caller was shown. 400 on
|
|
19
|
+
* a non-publishable type.
|
|
20
|
+
*/
|
|
21
|
+
let BulkUnpublishEntriesUseCase = class BulkUnpublishEntriesUseCase {
|
|
22
|
+
uow;
|
|
23
|
+
outbox;
|
|
24
|
+
writer;
|
|
25
|
+
constructor(uow, outbox, writer) {
|
|
26
|
+
this.uow = uow;
|
|
27
|
+
this.outbox = outbox;
|
|
28
|
+
this.writer = writer;
|
|
29
|
+
}
|
|
30
|
+
async execute(type, ids, workspaceId) {
|
|
31
|
+
if (!type.publishable) {
|
|
32
|
+
throw new common_1.BadRequestException(`Content type "${type.name}" is not publishable.`);
|
|
33
|
+
}
|
|
34
|
+
if (!ids.length)
|
|
35
|
+
return { count: 0 };
|
|
36
|
+
return this.uow.run(async () => {
|
|
37
|
+
const exec = this.uow.current();
|
|
38
|
+
// The set that actually transitions (published → draft), captured
|
|
39
|
+
// before the write so we emit one event per real change.
|
|
40
|
+
const publishedIds = await this.writer.publishedIdsAmong(exec, type, ids, workspaceId);
|
|
41
|
+
const count = await this.writer.markDraftBulk(exec, type, ids, workspaceId);
|
|
42
|
+
// Revert each really-transitioned entry's published revision back to
|
|
43
|
+
// draft — the same set the outbox emits an event for.
|
|
44
|
+
for (const id of publishedIds) {
|
|
45
|
+
await this.writer.markRevisionUnpublished(exec, id, workspaceId);
|
|
46
|
+
}
|
|
47
|
+
await this.outbox.append(publishedIds.flatMap((id) => {
|
|
48
|
+
const entry = entry_1.Entry.rehydrate({
|
|
49
|
+
id,
|
|
50
|
+
contentType: type.name,
|
|
51
|
+
status: content_domain_1.ENTRY_STATUS.Published
|
|
52
|
+
});
|
|
53
|
+
entry.unpublish();
|
|
54
|
+
return entry.pullEvents();
|
|
55
|
+
}));
|
|
56
|
+
return { count };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.BulkUnpublishEntriesUseCase = BulkUnpublishEntriesUseCase;
|
|
61
|
+
exports.BulkUnpublishEntriesUseCase = BulkUnpublishEntriesUseCase = tslib_1.__decorate([
|
|
62
|
+
(0, common_1.Injectable)(),
|
|
63
|
+
tslib_1.__metadata("design:paramtypes", [database_1.UnitOfWork,
|
|
64
|
+
database_1.OutboxWriter,
|
|
65
|
+
entry_writer_service_1.EntryWriterService])
|
|
66
|
+
], BulkUnpublishEntriesUseCase);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { OutboxWriter, UnitOfWork } from '@orthacms/database';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { EntryValidationService } from '../../../validation/services/entry-validation.service';
|
|
4
|
+
import { EntryWriterService } from '../../infrastructure/persistence/entry-writer.service';
|
|
5
|
+
import type { EntryRecord } from '../../types/entry-list-view';
|
|
6
|
+
/**
|
|
7
|
+
* Publish one entry. Runs inside a {@link UnitOfWork} so the status write and
|
|
8
|
+
* the `entry.published` outbox event commit atomically. Re-validates the stored
|
|
9
|
+
* row against the publish gate (values via the kernel + required link-managed
|
|
10
|
+
* relations via persistence), lets the {@link Entry} domain model apply the
|
|
11
|
+
* `draft → published` transition, then re-stamps `status`/`published_at`.
|
|
12
|
+
*
|
|
13
|
+
* HTTP behavior is preserved: 400 on a non-publishable type, 404 on a missing
|
|
14
|
+
* live row, and `422 { message, issues }` when the gate fails — the value issues
|
|
15
|
+
* take precedence (relations aren't even counted when the values are invalid),
|
|
16
|
+
* exactly as the original service ordered its checks.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PublishEntryUseCase {
|
|
19
|
+
private readonly uow;
|
|
20
|
+
private readonly outbox;
|
|
21
|
+
private readonly writer;
|
|
22
|
+
private readonly validation;
|
|
23
|
+
constructor(uow: UnitOfWork, outbox: OutboxWriter, writer: EntryWriterService, validation: EntryValidationService);
|
|
24
|
+
execute(type: AnyContentType, id: string, workspaceId: string,
|
|
25
|
+
/**
|
|
26
|
+
* The acting user, merged onto the outbox events so the audit log can
|
|
27
|
+
* name who did this. Without it every content row in the activity log
|
|
28
|
+
* read "System".
|
|
29
|
+
*/
|
|
30
|
+
actor?: {
|
|
31
|
+
id: string;
|
|
32
|
+
email: string | null;
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* The version to mark live, when publishing a **specific** earlier one
|
|
36
|
+
* whose content the caller already re-applied to the live row. Omitted
|
|
37
|
+
* (the entry-level publish), the latest version is promoted — it is the
|
|
38
|
+
* row that was just published.
|
|
39
|
+
*/
|
|
40
|
+
revisionNumber?: number): Promise<EntryRecord>;
|
|
41
|
+
private notFound;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=publish-entry.use-case.d.ts.map
|