@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,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entry = void 0;
|
|
4
|
+
const content_domain_1 = require("@orthacms/content-domain");
|
|
5
|
+
const entry_events_1 = require("./events/entry-events");
|
|
6
|
+
const entry_publish_blocked_error_1 = require("./entry-publish-blocked.error");
|
|
7
|
+
/**
|
|
8
|
+
* The **focused domain model** for an entry's publish lifecycle. The entries
|
|
9
|
+
* engine is generic and registry-driven — one service backs every content type,
|
|
10
|
+
* with no per-aggregate table or fixed field set — so a full row⇄aggregate
|
|
11
|
+
* aggregate would fight the metamodel (ADR-0003: DDD where it pays). This models
|
|
12
|
+
* only the part with real invariants: the `draft ↔ published` state machine and
|
|
13
|
+
* the publish gate. It owns no columns; the application loads its status,
|
|
14
|
+
* applies a transition here (raising the domain event), and the infrastructure
|
|
15
|
+
* persists the new status.
|
|
16
|
+
*
|
|
17
|
+
* Framework-free: imports only `@orthacms/content-domain` (the pure kernel) and
|
|
18
|
+
* `@orthacms/database`'s framework-free `createDomainEvent`/`DomainEvent` —
|
|
19
|
+
* nothing from `@nestjs/*`, `drizzle-orm`, `class-validator`, or the
|
|
20
|
+
* infrastructure layer (ADR-0003's one hard rule).
|
|
21
|
+
*/
|
|
22
|
+
class Entry {
|
|
23
|
+
_id;
|
|
24
|
+
_contentType;
|
|
25
|
+
_status;
|
|
26
|
+
events = [];
|
|
27
|
+
constructor(_id, _contentType, _status) {
|
|
28
|
+
this._id = _id;
|
|
29
|
+
this._contentType = _contentType;
|
|
30
|
+
this._status = _status;
|
|
31
|
+
}
|
|
32
|
+
/** Reconstructs an entry from its persisted lifecycle state. */
|
|
33
|
+
static rehydrate(state) {
|
|
34
|
+
return new Entry(state.id, state.contentType, state.status);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Publish the entry. Rejects with {@link EntryPublishBlockedError} when the
|
|
38
|
+
* gate fails (mapped to 422 by the use-case) — checked first, so an
|
|
39
|
+
* already-published row whose stored values went invalid is still blocked,
|
|
40
|
+
* matching the original service. A `draft` transitions to `published` via
|
|
41
|
+
* {@link assertTransition} and raises `entry.published`; an already-published
|
|
42
|
+
* row is an idempotent re-publish that raises no event (the use-case still
|
|
43
|
+
* re-stamps `published_at`).
|
|
44
|
+
*/
|
|
45
|
+
publish(gate) {
|
|
46
|
+
if (!gate.valid) {
|
|
47
|
+
throw new entry_publish_blocked_error_1.EntryPublishBlockedError(gate.issues);
|
|
48
|
+
}
|
|
49
|
+
if (this._status === content_domain_1.ENTRY_STATUS.Published) {
|
|
50
|
+
return; // idempotent re-publish
|
|
51
|
+
}
|
|
52
|
+
(0, content_domain_1.assertTransition)(this._status, content_domain_1.ENTRY_STATUS.Published);
|
|
53
|
+
this._status = content_domain_1.ENTRY_STATUS.Published;
|
|
54
|
+
this.raise(entry_events_1.ENTRY_EVENT_KINDS.PUBLISHED, {
|
|
55
|
+
contentType: this._contentType
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Revert the entry to draft. A `published` row transitions to `draft` via
|
|
60
|
+
* {@link assertTransition} and raises `entry.unpublished`; an already-draft
|
|
61
|
+
* row is an idempotent no-op that raises no event (the use-case still
|
|
62
|
+
* performs the write, preserving the original unconditional behavior).
|
|
63
|
+
*/
|
|
64
|
+
unpublish() {
|
|
65
|
+
if (this._status === content_domain_1.ENTRY_STATUS.Draft) {
|
|
66
|
+
return; // idempotent
|
|
67
|
+
}
|
|
68
|
+
(0, content_domain_1.assertTransition)(this._status, content_domain_1.ENTRY_STATUS.Draft);
|
|
69
|
+
this._status = content_domain_1.ENTRY_STATUS.Draft;
|
|
70
|
+
this.raise(entry_events_1.ENTRY_EVENT_KINDS.UNPUBLISHED, {
|
|
71
|
+
contentType: this._contentType
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** The entry id. */
|
|
75
|
+
get id() {
|
|
76
|
+
return this._id;
|
|
77
|
+
}
|
|
78
|
+
/** The current publish status. */
|
|
79
|
+
get status() {
|
|
80
|
+
return this._status;
|
|
81
|
+
}
|
|
82
|
+
/** Drains and returns the events raised since the last pull. */
|
|
83
|
+
pullEvents() {
|
|
84
|
+
return this.events.splice(0, this.events.length);
|
|
85
|
+
}
|
|
86
|
+
raise(kind, payload) {
|
|
87
|
+
this.events.push((0, entry_events_1.entryEvent)(kind, this._id, payload));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Entry = Entry;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type DomainEvent } from '@orthacms/database';
|
|
2
|
+
/**
|
|
3
|
+
* The domain-event kinds an entry's lifecycle raises, as dotted names.
|
|
4
|
+
*
|
|
5
|
+
* Two of them — `entry.published` / `entry.unpublished` — are **status
|
|
6
|
+
* transitions** and are raised by the {@link Entry} model, which owns the
|
|
7
|
+
* `draft ↔ published` invariants. The rest are the ordinary editing lifecycle:
|
|
8
|
+
* a row appearing, its values changing, it going to the trash, coming back, or
|
|
9
|
+
* being destroyed. Those carry no invariant of their own — nothing about
|
|
10
|
+
* "created" can be violated — so they are minted by the builders below and
|
|
11
|
+
* raised by the write path directly, rather than by fabricating an aggregate
|
|
12
|
+
* (and a publish status a non-publishable type does not have) around a fact.
|
|
13
|
+
*
|
|
14
|
+
* Until this set existed the audit log could answer "who did what, when" for
|
|
15
|
+
* accounts, workspaces, API tokens, the media library and content **publishes**
|
|
16
|
+
* — and not for the single most frequent action in a CMS. An editor could
|
|
17
|
+
* create, rewrite and delete every entry in the product and the log stayed
|
|
18
|
+
* silent, because there was nothing on the outbox for a subscriber to consume.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ENTRY_EVENT_KINDS: {
|
|
21
|
+
readonly CREATED: "entry.created";
|
|
22
|
+
readonly UPDATED: "entry.updated";
|
|
23
|
+
readonly PUBLISHED: "entry.published";
|
|
24
|
+
readonly UNPUBLISHED: "entry.unpublished";
|
|
25
|
+
readonly DELETED: "entry.deleted";
|
|
26
|
+
readonly RESTORED: "entry.restored";
|
|
27
|
+
readonly PURGED: "entry.purged";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Builds an entry {@link DomainEvent} of `kind` for `entryId`, carrying
|
|
31
|
+
* `payload`. Keeps the domain model free of the event envelope's plumbing — the
|
|
32
|
+
* model names the fact and its data; this stamps the `aggregateType`/id.
|
|
33
|
+
*/
|
|
34
|
+
export declare function entryEvent(kind: string, entryId: string, payload: Record<string, unknown>): DomainEvent;
|
|
35
|
+
/** A new entry exists. `contentType` is what lets the log name *what* was made. */
|
|
36
|
+
export declare function entryCreated(entryId: string, contentType: string): DomainEvent;
|
|
37
|
+
/**
|
|
38
|
+
* An entry's stored values changed, naming **which fields** did.
|
|
39
|
+
*
|
|
40
|
+
* The field list is the `workspace.updated` precedent (`{ fields }`), and it is
|
|
41
|
+
* what makes a row worth reading: "Ada edited Article X" is a fact, "Ada edited
|
|
42
|
+
* the title and body of Article X" is a review. It is computed by comparing the
|
|
43
|
+
* stored row against the written one, which also answers the volume question
|
|
44
|
+
* this event raises — a save that changes nothing (a re-submit, a reopened
|
|
45
|
+
* editor, a restore of the version already live) produces **no** field names
|
|
46
|
+
* and therefore no event at all, so the log records editorial changes rather
|
|
47
|
+
* than round trips.
|
|
48
|
+
*/
|
|
49
|
+
export declare function entryUpdated(entryId: string, contentType: string, fields: readonly string[]): DomainEvent;
|
|
50
|
+
/**
|
|
51
|
+
* An entry was deleted. `soft` distinguishes the two very different facts the
|
|
52
|
+
* one route produces: a **paranoid** type is tombstoned and can be restored,
|
|
53
|
+
* while any other type is gone from the table the moment this commits, and a
|
|
54
|
+
* reviewer reading the log needs to know which happened.
|
|
55
|
+
*/
|
|
56
|
+
export declare function entryDeleted(entryId: string, contentType: string, soft: boolean): DomainEvent;
|
|
57
|
+
/** A soft-deleted entry's tombstone was cleared. */
|
|
58
|
+
export declare function entryRestored(entryId: string, contentType: string): DomainEvent;
|
|
59
|
+
/**
|
|
60
|
+
* A tombstoned entry was destroyed permanently.
|
|
61
|
+
*
|
|
62
|
+
* Its own kind rather than a second `entry.deleted`: this is the one content
|
|
63
|
+
* action with nothing left behind to inspect afterwards, so it is exactly the
|
|
64
|
+
* one an audit trail has to record distinctly.
|
|
65
|
+
*/
|
|
66
|
+
export declare function entryPurged(entryId: string, contentType: string): DomainEvent;
|
|
67
|
+
//# sourceMappingURL=entry-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-events.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/domain/events/entry-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAKX;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,WAAW,CAOb;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GACpB,WAAW,CAEb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,SAAS,MAAM,EAAE,GAC1B,WAAW,CAKb;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,GACd,WAAW,CAKb;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CACzB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GACpB,WAAW,CAEb;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,CAE7E"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENTRY_EVENT_KINDS = void 0;
|
|
4
|
+
exports.entryEvent = entryEvent;
|
|
5
|
+
exports.entryCreated = entryCreated;
|
|
6
|
+
exports.entryUpdated = entryUpdated;
|
|
7
|
+
exports.entryDeleted = entryDeleted;
|
|
8
|
+
exports.entryRestored = entryRestored;
|
|
9
|
+
exports.entryPurged = entryPurged;
|
|
10
|
+
const database_1 = require("@orthacms/database");
|
|
11
|
+
/**
|
|
12
|
+
* The domain-event kinds an entry's lifecycle raises, as dotted names.
|
|
13
|
+
*
|
|
14
|
+
* Two of them — `entry.published` / `entry.unpublished` — are **status
|
|
15
|
+
* transitions** and are raised by the {@link Entry} model, which owns the
|
|
16
|
+
* `draft ↔ published` invariants. The rest are the ordinary editing lifecycle:
|
|
17
|
+
* a row appearing, its values changing, it going to the trash, coming back, or
|
|
18
|
+
* being destroyed. Those carry no invariant of their own — nothing about
|
|
19
|
+
* "created" can be violated — so they are minted by the builders below and
|
|
20
|
+
* raised by the write path directly, rather than by fabricating an aggregate
|
|
21
|
+
* (and a publish status a non-publishable type does not have) around a fact.
|
|
22
|
+
*
|
|
23
|
+
* Until this set existed the audit log could answer "who did what, when" for
|
|
24
|
+
* accounts, workspaces, API tokens, the media library and content **publishes**
|
|
25
|
+
* — and not for the single most frequent action in a CMS. An editor could
|
|
26
|
+
* create, rewrite and delete every entry in the product and the log stayed
|
|
27
|
+
* silent, because there was nothing on the outbox for a subscriber to consume.
|
|
28
|
+
*/
|
|
29
|
+
exports.ENTRY_EVENT_KINDS = {
|
|
30
|
+
CREATED: 'entry.created',
|
|
31
|
+
UPDATED: 'entry.updated',
|
|
32
|
+
PUBLISHED: 'entry.published',
|
|
33
|
+
UNPUBLISHED: 'entry.unpublished',
|
|
34
|
+
DELETED: 'entry.deleted',
|
|
35
|
+
RESTORED: 'entry.restored',
|
|
36
|
+
PURGED: 'entry.purged'
|
|
37
|
+
};
|
|
38
|
+
/** The aggregate type stamped on every entry domain event. */
|
|
39
|
+
const AGGREGATE_TYPE = 'content_entry';
|
|
40
|
+
/**
|
|
41
|
+
* Builds an entry {@link DomainEvent} of `kind` for `entryId`, carrying
|
|
42
|
+
* `payload`. Keeps the domain model free of the event envelope's plumbing — the
|
|
43
|
+
* model names the fact and its data; this stamps the `aggregateType`/id.
|
|
44
|
+
*/
|
|
45
|
+
function entryEvent(kind, entryId, payload) {
|
|
46
|
+
return (0, database_1.createDomainEvent)({
|
|
47
|
+
kind,
|
|
48
|
+
aggregateType: AGGREGATE_TYPE,
|
|
49
|
+
aggregateId: entryId,
|
|
50
|
+
payload
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** A new entry exists. `contentType` is what lets the log name *what* was made. */
|
|
54
|
+
function entryCreated(entryId, contentType) {
|
|
55
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.CREATED, entryId, { contentType });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An entry's stored values changed, naming **which fields** did.
|
|
59
|
+
*
|
|
60
|
+
* The field list is the `workspace.updated` precedent (`{ fields }`), and it is
|
|
61
|
+
* what makes a row worth reading: "Ada edited Article X" is a fact, "Ada edited
|
|
62
|
+
* the title and body of Article X" is a review. It is computed by comparing the
|
|
63
|
+
* stored row against the written one, which also answers the volume question
|
|
64
|
+
* this event raises — a save that changes nothing (a re-submit, a reopened
|
|
65
|
+
* editor, a restore of the version already live) produces **no** field names
|
|
66
|
+
* and therefore no event at all, so the log records editorial changes rather
|
|
67
|
+
* than round trips.
|
|
68
|
+
*/
|
|
69
|
+
function entryUpdated(entryId, contentType, fields) {
|
|
70
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.UPDATED, entryId, {
|
|
71
|
+
contentType,
|
|
72
|
+
fields: [...fields]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* An entry was deleted. `soft` distinguishes the two very different facts the
|
|
77
|
+
* one route produces: a **paranoid** type is tombstoned and can be restored,
|
|
78
|
+
* while any other type is gone from the table the moment this commits, and a
|
|
79
|
+
* reviewer reading the log needs to know which happened.
|
|
80
|
+
*/
|
|
81
|
+
function entryDeleted(entryId, contentType, soft) {
|
|
82
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.DELETED, entryId, {
|
|
83
|
+
contentType,
|
|
84
|
+
soft
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** A soft-deleted entry's tombstone was cleared. */
|
|
88
|
+
function entryRestored(entryId, contentType) {
|
|
89
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.RESTORED, entryId, { contentType });
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A tombstoned entry was destroyed permanently.
|
|
93
|
+
*
|
|
94
|
+
* Its own kind rather than a second `entry.deleted`: this is the one content
|
|
95
|
+
* action with nothing left behind to inspect afterwards, so it is exactly the
|
|
96
|
+
* one an audit trail has to record distinctly.
|
|
97
|
+
*/
|
|
98
|
+
function entryPurged(entryId, contentType) {
|
|
99
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.PURGED, entryId, { contentType });
|
|
100
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body for the bulk endpoints (`/bulk/publish`, `/bulk/unpublish`,
|
|
3
|
+
* `/bulk/delete`, `/bulk/restore`, and the publish dry run): the set of entry
|
|
4
|
+
* ids to act on. Non-empty, uuid-typed, and capped at {@link BULK_MAX_IDS} so a
|
|
5
|
+
* single request can't fan out unbounded work.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BulkIdsDto {
|
|
8
|
+
/** Entry ids to act on. */
|
|
9
|
+
ids: string[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=bulk-ids.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-ids.dto.d.ts","sourceRoot":"","sources":["../../../../src/lib/entries/dto/bulk-ids.dto.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,UAAU;IACnB,2BAA2B;IAK3B,GAAG,EAAG,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** `?deleted=only` flips the list to the trash view (soft-deleted rows). */
|
|
2
|
+
export declare const DELETED_ONLY = "only";
|
|
3
|
+
/**
|
|
4
|
+
* Query parameters for `GET /api/content/:typeName`. Pagination is 1-based; the
|
|
5
|
+
* service applies the defaults (page 1, {@link DEFAULT_PAGE_SIZE}) so the
|
|
6
|
+
* contract has one source of truth. `@Type` coerces the raw query strings — the
|
|
7
|
+
* host's global `ValidationPipe` transforms but does not implicitly convert.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ListEntriesQueryDto {
|
|
10
|
+
/** Free-text search across the type's text-like columns (text/richtext/select). */
|
|
11
|
+
search?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Structured filter tree as a JSON string (`?filter=<json>`), produced by
|
|
14
|
+
* the admin query builder and validated against the type's derived filter
|
|
15
|
+
* schema by `parseFilterTree`. Length-capped here as a first line of
|
|
16
|
+
* defence; the engine's node/depth caps bound the parsed shape.
|
|
17
|
+
*/
|
|
18
|
+
filter?: string;
|
|
19
|
+
/** Sort spec: a column id (ascending) or `-`-prefixed (descending). */
|
|
20
|
+
sort?: string;
|
|
21
|
+
/** 1-based page number. */
|
|
22
|
+
page?: number;
|
|
23
|
+
/** Rows per page, capped at {@link MAX_PAGE_SIZE}. */
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
/**
|
|
26
|
+
* `only` lists soft-deleted rows (the trash view) instead of live ones.
|
|
27
|
+
* Meaningful only for paranoid types; ignored otherwise. Absent (the
|
|
28
|
+
* default) lists live rows.
|
|
29
|
+
*/
|
|
30
|
+
deleted?: typeof DELETED_ONLY;
|
|
31
|
+
/**
|
|
32
|
+
* Locale slug the list targets — an **extension-owned** param this package
|
|
33
|
+
* declares (the strict ValidationPipe rejects undeclared keys) but never
|
|
34
|
+
* interprets: it's forwarded to the bound `CONTENT_ENTRY_EXTENSION`, which
|
|
35
|
+
* validates and applies it. Ignored when no extension is bound or the type
|
|
36
|
+
* isn't localized.
|
|
37
|
+
*/
|
|
38
|
+
locale?: string;
|
|
39
|
+
/**
|
|
40
|
+
* `default` widens the locale scope to fall back to the default locale
|
|
41
|
+
* where the requested one is missing (the relation picker's mode).
|
|
42
|
+
* Extension-owned, like {@link locale}.
|
|
43
|
+
*/
|
|
44
|
+
localeFallback?: string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=list-entries-query.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-entries-query.dto.d.ts","sourceRoot":"","sources":["../../../../src/lib/entries/dto/list-entries-query.dto.ts"],"names":[],"mappings":"AAYA,4EAA4E;AAC5E,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC;;;;;GAKG;AACH,qBAAa,mBAAmB;IAC5B,mFAAmF;IAInF,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IAIH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uEAAuE;IAIvE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,2BAA2B;IAK3B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,sDAAsD;IAMtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IAGH,OAAO,CAAC,EAAE,OAAO,YAAY,CAAC;IAE9B;;;;;;OAMG;IAIH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IAGH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ValidationOptions, type ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the `relations` bag of {@link SaveEntryDto}: a map from field name to
|
|
4
|
+
* `{ link?, unlink?, order? }`, each an array of uuid strings. class-validator
|
|
5
|
+
* can't decorate a `Record`'s dynamic keys, so this constraint checks the shape
|
|
6
|
+
* of every value — turning a malformed delta (a non-array `unlink`, a non-uuid
|
|
7
|
+
* id, an unknown inner key, or an over-large array) into a clean **400** instead
|
|
8
|
+
* of letting it reach `inArray(...)` against a `uuid` column and surface as a
|
|
9
|
+
* 500. Unknown inner keys are rejected so the nested `Record` can't slip past
|
|
10
|
+
* the app's `forbidNonWhitelisted` posture, and the id arrays and the map itself
|
|
11
|
+
* are size-bounded so a single request can't carry an unbounded payload.
|
|
12
|
+
*/
|
|
13
|
+
export declare class RelationDeltaMapConstraint implements ValidatorConstraintInterface {
|
|
14
|
+
validate(value: unknown): boolean;
|
|
15
|
+
defaultMessage(): string;
|
|
16
|
+
}
|
|
17
|
+
/** Property decorator applying {@link RelationDeltaMapConstraint}. */
|
|
18
|
+
export declare function IsRelationDeltaMap(options?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
19
|
+
//# sourceMappingURL=relation-delta-map.validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-delta-map.validator.d.ts","sourceRoot":"","sources":["../../../../src/lib/entries/dto/relation-delta-map.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACpC,MAAM,iBAAiB,CAAC;AAmCzB;;;;;;;;;;GAUG;AACH,qBACa,0BACT,YAAW,4BAA4B;IAEvC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAwBjC,cAAc,IAAI,MAAM;CAG3B;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,iBAAiB,IAClD,QAAQ,MAAM,EAAE,cAAc,MAAM,KAAG,IAAI,CAOtD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RelationDelta } from '../types/entry-list-view';
|
|
2
|
+
/**
|
|
3
|
+
* Body for `POST /api/content/:typeName` (create) and
|
|
4
|
+
* `PATCH /api/content/:typeName/:id` (update). The field `values` bag crosses the
|
|
5
|
+
* wire, plus optional per-field relation **deltas** (`relations`) — the editor
|
|
6
|
+
* stages its many-to-many / inverse link changes locally and sends them here
|
|
7
|
+
* with the rest of the document, so a save persists everything in **one
|
|
8
|
+
* transaction** without ever transmitting a huge relation whole.
|
|
9
|
+
*
|
|
10
|
+
* Reserved envelope columns (`status`/`published_at`/`deleted_at`) are owned by
|
|
11
|
+
* the service and can't be set from here: `toColumns` projects only keys
|
|
12
|
+
* declared on the type, so a reserved (or otherwise unknown) key in the bag is
|
|
13
|
+
* silently dropped before storage; on a non-publishable type
|
|
14
|
+
* `EntryValidationService` additionally flags unknown keys as a 422. The bag's
|
|
15
|
+
* *contents* are validated against the type's field specs by that same service
|
|
16
|
+
* (a dynamic, per-type contract class-validator can't express); the relation
|
|
17
|
+
* deltas' ids are validated as existing workspace entries by
|
|
18
|
+
* `RelationLinkService`. `values` is structurally only "an object" (its contents
|
|
19
|
+
* are the per-type contract); the `relations` bag's *shape* — each value a
|
|
20
|
+
* `{ link?, unlink?, order? }` of uuid arrays — is enforced here so a malformed
|
|
21
|
+
* delta is a clean 400, not a 500 from a bad id hitting the query.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SaveEntryDto {
|
|
24
|
+
/** Field values keyed by field name. */
|
|
25
|
+
values: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Per-field relation deltas (`{ <field>: { link?, unlink?, order? } }`) —
|
|
28
|
+
* many/inverse relations only; a single relation is set through `values`.
|
|
29
|
+
*/
|
|
30
|
+
relations?: Record<string, RelationDelta>;
|
|
31
|
+
/**
|
|
32
|
+
* Locale slug the entry is created in — an **extension-owned** param this
|
|
33
|
+
* package declares but never interprets (forwarded to the bound
|
|
34
|
+
* `CONTENT_ENTRY_EXTENSION`, which validates it and stamps the envelope
|
|
35
|
+
* column). Read on create only; an update never re-homes a row's locale.
|
|
36
|
+
*/
|
|
37
|
+
locale?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The existing translation group a created row joins (making it a sibling)
|
|
40
|
+
* — an **extension-owned**, opaque param, like {@link locale}. Absent → the
|
|
41
|
+
* row starts its own fresh group. The bound extension validates it against
|
|
42
|
+
* the workspace. Read on create only.
|
|
43
|
+
*/
|
|
44
|
+
localeGroupId?: string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=save-entry.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-entry.dto.d.ts","sourceRoot":"","sources":["../../../../src/lib/entries/dto/save-entry.dto.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACrB,wCAAwC;IAExC,MAAM,EAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC;;;OAGG;IAIH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE1C;;;;;OAKG;IAIH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IAGH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Pagination + filter limits for the entries list endpoint. */
|
|
2
|
+
/** Default rows per page when the client omits `pageSize`. */
|
|
3
|
+
export declare const DEFAULT_PAGE_SIZE = 25;
|
|
4
|
+
/** Hard cap on rows per page — bounds a single query's cost. */
|
|
5
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
6
|
+
/** Max length of the raw `?filter=` JSON (first line of defence before parsing). */
|
|
7
|
+
export declare const FILTER_MAX_LENGTH = 4096;
|
|
8
|
+
/** Max ids a single bulk action (`{ ids }`) may target — bounds the statement. */
|
|
9
|
+
export declare const BULK_MAX_IDS = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Max items a single bulk **save** may carry.
|
|
12
|
+
*
|
|
13
|
+
* Lower than {@link BULK_MAX_IDS} on purpose: a bulk action ships a list of
|
|
14
|
+
* uuids, while a bulk save ships whole documents — rich-text bodies included —
|
|
15
|
+
* and then performs one write transaction per item. The cap bounds the request
|
|
16
|
+
* body and the time a single call can hold the workspace's content lock.
|
|
17
|
+
*/
|
|
18
|
+
export declare const BULK_MAX_SAVE_ITEMS = 50;
|
|
19
|
+
//# sourceMappingURL=entries.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entries.constants.d.ts","sourceRoot":"","sources":["../../../src/lib/entries/entries.constants.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,gEAAgE;AAChE,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,kFAAkF;AAClF,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Pagination + filter limits for the entries list endpoint. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BULK_MAX_SAVE_ITEMS = exports.BULK_MAX_IDS = exports.FILTER_MAX_LENGTH = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = void 0;
|
|
5
|
+
/** Default rows per page when the client omits `pageSize`. */
|
|
6
|
+
exports.DEFAULT_PAGE_SIZE = 25;
|
|
7
|
+
/** Hard cap on rows per page — bounds a single query's cost. */
|
|
8
|
+
exports.MAX_PAGE_SIZE = 100;
|
|
9
|
+
/** Max length of the raw `?filter=` JSON (first line of defence before parsing). */
|
|
10
|
+
exports.FILTER_MAX_LENGTH = 4096;
|
|
11
|
+
/** Max ids a single bulk action (`{ ids }`) may target — bounds the statement. */
|
|
12
|
+
exports.BULK_MAX_IDS = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Max items a single bulk **save** may carry.
|
|
15
|
+
*
|
|
16
|
+
* Lower than {@link BULK_MAX_IDS} on purpose: a bulk action ships a list of
|
|
17
|
+
* uuids, while a bulk save ships whole documents — rich-text bodies included —
|
|
18
|
+
* and then performs one write transaction per item. The cap bounds the request
|
|
19
|
+
* body and the time a single call can hold the workspace's content lock.
|
|
20
|
+
*/
|
|
21
|
+
exports.BULK_MAX_SAVE_ITEMS = 50;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type PublicUser } from '@orthacms/identity-server';
|
|
2
|
+
import type { ContentTypeRegistry } from '../../../registry/content-type-registry';
|
|
3
|
+
import { EntryWriterService } from '../../infrastructure/persistence/entry-writer.service';
|
|
4
|
+
import { BulkPublishPreviewQuery } from '../../infrastructure/queries/bulk-publish-preview.query';
|
|
5
|
+
import { BulkPublishEntriesUseCase } from '../../application/use-cases/bulk-publish-entries.use-case';
|
|
6
|
+
import { BulkUnpublishEntriesUseCase } from '../../application/use-cases/bulk-unpublish-entries.use-case';
|
|
7
|
+
import { BulkIdsDto } from '../dto/bulk-ids.dto';
|
|
8
|
+
import type { BulkActionResult, BulkPublishPreview, BulkPublishResult } from '../../types/bulk-publish';
|
|
9
|
+
/**
|
|
10
|
+
* Bulk entry actions over a set of `{ ids }`. **Registered before the
|
|
11
|
+
* single-item controllers** (see `content.module.ts`): the literal `bulk`
|
|
12
|
+
* segment sits in the same slot as those controllers' `:id`, so it must match
|
|
13
|
+
* first — otherwise `/bulk/publish` would resolve as `:id='bulk'` (and trip the
|
|
14
|
+
* single-item `ParseUUIDPipe`). `WorkspaceGuard` scopes every action to a
|
|
15
|
+
* workspace the caller belongs to. Per-route permissions: publish/unpublish need
|
|
16
|
+
* `content:publish`, delete/restore need `content:delete`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class BulkEntriesController {
|
|
19
|
+
private readonly registry;
|
|
20
|
+
private readonly writer;
|
|
21
|
+
private readonly bulkPublishPreview;
|
|
22
|
+
private readonly bulkPublishEntries;
|
|
23
|
+
private readonly bulkUnpublishEntries;
|
|
24
|
+
constructor(registry: ContentTypeRegistry, writer: EntryWriterService, bulkPublishPreview: BulkPublishPreviewQuery, bulkPublishEntries: BulkPublishEntriesUseCase, bulkUnpublishEntries: BulkUnpublishEntriesUseCase);
|
|
25
|
+
/** Dry run: validate each id and report a per-entry verdict. Writes nothing. */
|
|
26
|
+
previewPublish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkPublishPreview>;
|
|
27
|
+
publish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkPublishResult>;
|
|
28
|
+
unpublish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkActionResult>;
|
|
29
|
+
remove(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
30
|
+
restore(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
31
|
+
purge(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=bulk-entries.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-entries.controller.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/http/controllers/bulk-entries.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAKH,KAAK,UAAU,EAElB,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;GAQG;AACH,qBAEa,qBAAqB;IAG1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAJpB,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,kBAAkB,EAAE,uBAAuB,EAC3C,kBAAkB,EAAE,yBAAyB,EAC7C,oBAAoB,EAAE,2BAA2B;IAGtE,gFAAgF;IAIhF,cAAc,CACS,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,GACxC,OAAO,CAAC,kBAAkB,CAAC;IAQ9B,OAAO,CACgB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,GACxC,OAAO,CAAC,iBAAiB,CAAC;IAQ7B,SAAS,CACc,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,GACxC,OAAO,CAAC,gBAAgB,CAAC;IAQ5B,MAAM,CACiB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;IAa5B,OAAO,CACgB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;IAa5B,KAAK,CACkB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;CAS/B"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulkEntriesController = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const identity_server_1 = require("@orthacms/identity-server");
|
|
7
|
+
const workspaces_server_1 = require("@orthacms/workspaces-server");
|
|
8
|
+
const content_grant_guard_1 = require("../guards/content-grant.guard");
|
|
9
|
+
const content_tokens_1 = require("../../../content.tokens");
|
|
10
|
+
const entry_writer_service_1 = require("../../infrastructure/persistence/entry-writer.service");
|
|
11
|
+
const bulk_publish_preview_query_1 = require("../../infrastructure/queries/bulk-publish-preview.query");
|
|
12
|
+
const bulk_publish_entries_use_case_1 = require("../../application/use-cases/bulk-publish-entries.use-case");
|
|
13
|
+
const bulk_unpublish_entries_use_case_1 = require("../../application/use-cases/bulk-unpublish-entries.use-case");
|
|
14
|
+
const bulk_ids_dto_1 = require("../dto/bulk-ids.dto");
|
|
15
|
+
const resolve_type_1 = require("./resolve-type");
|
|
16
|
+
const to_actor_1 = require("./to-actor");
|
|
17
|
+
/**
|
|
18
|
+
* Bulk entry actions over a set of `{ ids }`. **Registered before the
|
|
19
|
+
* single-item controllers** (see `content.module.ts`): the literal `bulk`
|
|
20
|
+
* segment sits in the same slot as those controllers' `:id`, so it must match
|
|
21
|
+
* first — otherwise `/bulk/publish` would resolve as `:id='bulk'` (and trip the
|
|
22
|
+
* single-item `ParseUUIDPipe`). `WorkspaceGuard` scopes every action to a
|
|
23
|
+
* workspace the caller belongs to. Per-route permissions: publish/unpublish need
|
|
24
|
+
* `content:publish`, delete/restore need `content:delete`.
|
|
25
|
+
*/
|
|
26
|
+
let BulkEntriesController = class BulkEntriesController {
|
|
27
|
+
registry;
|
|
28
|
+
writer;
|
|
29
|
+
bulkPublishPreview;
|
|
30
|
+
bulkPublishEntries;
|
|
31
|
+
bulkUnpublishEntries;
|
|
32
|
+
constructor(registry, writer, bulkPublishPreview, bulkPublishEntries, bulkUnpublishEntries) {
|
|
33
|
+
this.registry = registry;
|
|
34
|
+
this.writer = writer;
|
|
35
|
+
this.bulkPublishPreview = bulkPublishPreview;
|
|
36
|
+
this.bulkPublishEntries = bulkPublishEntries;
|
|
37
|
+
this.bulkUnpublishEntries = bulkUnpublishEntries;
|
|
38
|
+
}
|
|
39
|
+
/** Dry run: validate each id and report a per-entry verdict. Writes nothing. */
|
|
40
|
+
previewPublish(typeName, body, workspaceId) {
|
|
41
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
42
|
+
return this.bulkPublishPreview.preview(type, body.ids, workspaceId);
|
|
43
|
+
}
|
|
44
|
+
publish(typeName, body, workspaceId) {
|
|
45
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
46
|
+
return this.bulkPublishEntries.execute(type, body.ids, workspaceId);
|
|
47
|
+
}
|
|
48
|
+
unpublish(typeName, body, workspaceId) {
|
|
49
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
50
|
+
return this.bulkUnpublishEntries.execute(type, body.ids, workspaceId);
|
|
51
|
+
}
|
|
52
|
+
remove(typeName, body, workspaceId, user) {
|
|
53
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
54
|
+
return this.writer.bulkRemove(type, body.ids, workspaceId, (0, to_actor_1.toActor)(user));
|
|
55
|
+
}
|
|
56
|
+
restore(typeName, body, workspaceId, user) {
|
|
57
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
58
|
+
return this.writer.bulkRestore(type, body.ids, workspaceId, (0, to_actor_1.toActor)(user));
|
|
59
|
+
}
|
|
60
|
+
purge(typeName, body, workspaceId, user) {
|
|
61
|
+
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
62
|
+
return this.writer.bulkPurge(type, body.ids, workspaceId, (0, to_actor_1.toActor)(user));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.BulkEntriesController = BulkEntriesController;
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, common_1.Post)(':typeName/bulk/publish/preview'),
|
|
68
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
69
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
70
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
71
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
72
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
73
|
+
tslib_1.__metadata("design:type", Function),
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String]),
|
|
75
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
76
|
+
], BulkEntriesController.prototype, "previewPublish", null);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, common_1.Post)(':typeName/bulk/publish'),
|
|
79
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
80
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
81
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
82
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
83
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
84
|
+
tslib_1.__metadata("design:type", Function),
|
|
85
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String]),
|
|
86
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
87
|
+
], BulkEntriesController.prototype, "publish", null);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
(0, common_1.Post)(':typeName/bulk/unpublish'),
|
|
90
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
91
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
92
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
93
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
94
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
95
|
+
tslib_1.__metadata("design:type", Function),
|
|
96
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String]),
|
|
97
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
98
|
+
], BulkEntriesController.prototype, "unpublish", null);
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, common_1.Post)(':typeName/bulk/delete'),
|
|
101
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
102
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
103
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
104
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
105
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
106
|
+
tslib_1.__param(3, (0, identity_server_1.CurrentUser)()),
|
|
107
|
+
tslib_1.__metadata("design:type", Function),
|
|
108
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String, Object]),
|
|
109
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
110
|
+
], BulkEntriesController.prototype, "remove", null);
|
|
111
|
+
tslib_1.__decorate([
|
|
112
|
+
(0, common_1.Post)(':typeName/bulk/restore'),
|
|
113
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
114
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
115
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
116
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
117
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
118
|
+
tslib_1.__param(3, (0, identity_server_1.CurrentUser)()),
|
|
119
|
+
tslib_1.__metadata("design:type", Function),
|
|
120
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String, Object]),
|
|
121
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
122
|
+
], BulkEntriesController.prototype, "restore", null);
|
|
123
|
+
tslib_1.__decorate([
|
|
124
|
+
(0, common_1.Post)(':typeName/bulk/purge'),
|
|
125
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
126
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
127
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
128
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
129
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
130
|
+
tslib_1.__param(3, (0, identity_server_1.CurrentUser)()),
|
|
131
|
+
tslib_1.__metadata("design:type", Function),
|
|
132
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String, Object]),
|
|
133
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
134
|
+
], BulkEntriesController.prototype, "purge", null);
|
|
135
|
+
exports.BulkEntriesController = BulkEntriesController = tslib_1.__decorate([
|
|
136
|
+
(0, common_1.UseGuards)(identity_server_1.OriginGuard, identity_server_1.PermissionsGuard, workspaces_server_1.WorkspaceGuard, content_grant_guard_1.ContentGrantGuard),
|
|
137
|
+
(0, common_1.Controller)('content'),
|
|
138
|
+
tslib_1.__param(0, (0, content_tokens_1.InjectContentRegistry)()),
|
|
139
|
+
tslib_1.__metadata("design:paramtypes", [Function, entry_writer_service_1.EntryWriterService,
|
|
140
|
+
bulk_publish_preview_query_1.BulkPublishPreviewQuery,
|
|
141
|
+
bulk_publish_entries_use_case_1.BulkPublishEntriesUseCase,
|
|
142
|
+
bulk_unpublish_entries_use_case_1.BulkUnpublishEntriesUseCase])
|
|
143
|
+
], BulkEntriesController);
|