@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,19 @@
|
|
|
1
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
2
|
+
import { EntryValidationService } from '../../../validation/services/entry-validation.service';
|
|
3
|
+
import type { BulkPublishPreview } from '../../types/bulk-publish';
|
|
4
|
+
import { EntryWriterService } from '../persistence/entry-writer.service';
|
|
5
|
+
/**
|
|
6
|
+
* The bulk-publish **dry run** — a thin read query. Loads the workspace's live
|
|
7
|
+
* rows for the requested ids and reports a per-entry verdict (will-publish /
|
|
8
|
+
* already-published / blocked / not-found) in request order. Writes nothing;
|
|
9
|
+
* the committed publish (a use-case) re-validates under a `FOR UPDATE` lock and
|
|
10
|
+
* never trusts this advisory copy.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BulkPublishPreviewQuery {
|
|
13
|
+
private readonly writer;
|
|
14
|
+
private readonly validation;
|
|
15
|
+
constructor(writer: EntryWriterService, validation: EntryValidationService);
|
|
16
|
+
/** Dry-run a publish over `ids`; 400 on a non-publishable type. */
|
|
17
|
+
preview(type: AnyContentType, ids: string[], workspaceId: string): Promise<BulkPublishPreview>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=bulk-publish-preview.query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-publish-preview.query.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/queries/bulk-publish-preview.query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE;;;;;;GAMG;AACH,qBACa,uBAAuB;IAE5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,sBAAsB;IAGvD,mEAAmE;IAC7D,OAAO,CACT,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EAAE,EACb,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC;CAajC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulkPublishPreviewQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const entry_validation_service_1 = require("../../../validation/services/entry-validation.service");
|
|
7
|
+
const entry_writer_service_1 = require("../persistence/entry-writer.service");
|
|
8
|
+
const bulk_publish_verdicts_1 = require("../persistence/bulk-publish-verdicts");
|
|
9
|
+
/**
|
|
10
|
+
* The bulk-publish **dry run** — a thin read query. Loads the workspace's live
|
|
11
|
+
* rows for the requested ids and reports a per-entry verdict (will-publish /
|
|
12
|
+
* already-published / blocked / not-found) in request order. Writes nothing;
|
|
13
|
+
* the committed publish (a use-case) re-validates under a `FOR UPDATE` lock and
|
|
14
|
+
* never trusts this advisory copy.
|
|
15
|
+
*/
|
|
16
|
+
let BulkPublishPreviewQuery = class BulkPublishPreviewQuery {
|
|
17
|
+
writer;
|
|
18
|
+
validation;
|
|
19
|
+
constructor(writer, validation) {
|
|
20
|
+
this.writer = writer;
|
|
21
|
+
this.validation = validation;
|
|
22
|
+
}
|
|
23
|
+
/** Dry-run a publish over `ids`; 400 on a non-publishable type. */
|
|
24
|
+
async preview(type, ids, workspaceId) {
|
|
25
|
+
if (!type.publishable) {
|
|
26
|
+
throw new common_1.BadRequestException(`Content type "${type.name}" is not publishable.`);
|
|
27
|
+
}
|
|
28
|
+
const byId = await this.writer.loadLiveByIds(type, ids, workspaceId);
|
|
29
|
+
return {
|
|
30
|
+
items: (0, bulk_publish_verdicts_1.computeBulkPublishVerdicts)(type, ids, byId, (t, values) => this.validation.validate(t, values))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.BulkPublishPreviewQuery = BulkPublishPreviewQuery;
|
|
35
|
+
exports.BulkPublishPreviewQuery = BulkPublishPreviewQuery = tslib_1.__decorate([
|
|
36
|
+
(0, common_1.Injectable)(),
|
|
37
|
+
tslib_1.__metadata("design:paramtypes", [entry_writer_service_1.EntryWriterService,
|
|
38
|
+
entry_validation_service_1.EntryValidationService])
|
|
39
|
+
], BulkPublishPreviewQuery);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Database } from '@orthacms/database';
|
|
2
|
+
import { type ContentEntryExtension } from '../../../extension/entry-extension';
|
|
3
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
4
|
+
import { type ListEntriesQueryDto } from '../../http/dto/list-entries-query.dto';
|
|
5
|
+
import type { EntryListView } from '../../types/entry-list-view';
|
|
6
|
+
import { RelationLinkService } from '../persistence/relation-link.service';
|
|
7
|
+
/**
|
|
8
|
+
* Reads a collection's entries. Generic over the content type: the physical
|
|
9
|
+
* table, the filterable columns, the searchable columns, and the sort whitelist
|
|
10
|
+
* are all derived from `type` at request time, so one service backs every
|
|
11
|
+
* collection. Owns no schema of its own — it queries the HOST-owned generated
|
|
12
|
+
* `content_<name>` tables through the shared Drizzle client.
|
|
13
|
+
*/
|
|
14
|
+
export declare class EntriesService {
|
|
15
|
+
private readonly db;
|
|
16
|
+
private readonly relationLinks;
|
|
17
|
+
private readonly extension?;
|
|
18
|
+
constructor(db: Database, relationLinks: RelationLinkService, extension?: ContentEntryExtension | undefined);
|
|
19
|
+
/**
|
|
20
|
+
* One page of a collection's entries: search → filter → sort → paginate, run
|
|
21
|
+
* in SQL against the type's generated table, returned as the
|
|
22
|
+
* `{ items, total, page, pageSize }` envelope the admin records table renders.
|
|
23
|
+
* Scoped to `workspaceId` — only the calling workspace's entries are counted
|
|
24
|
+
* or listed.
|
|
25
|
+
*/
|
|
26
|
+
list(type: AnyContentType, query: ListEntriesQueryDto, workspaceId: string): Promise<EntryListView>;
|
|
27
|
+
/**
|
|
28
|
+
* The full WHERE: the workspace scope AND free-text search AND the
|
|
29
|
+
* query-builder `?filter=` tree AND (for paranoid types) the not-deleted
|
|
30
|
+
* guard. `and(undefined, …)` collapses empties, so an unfiltered list still
|
|
31
|
+
* scans the workspace's whole table. The workspace predicate is always
|
|
32
|
+
* present, so an entry never leaks across workspaces. A malformed filter
|
|
33
|
+
* throws a `FilterException` (HTTP 400).
|
|
34
|
+
*/
|
|
35
|
+
private listWhere;
|
|
36
|
+
/**
|
|
37
|
+
* Translate one `?filter=` payload against the type's filterable surface.
|
|
38
|
+
* The surface is built per request (content types are code-defined, so it
|
|
39
|
+
* is pure derivation) and produces BOTH the SQL whitelist used here and
|
|
40
|
+
* the wire list `/filter-fields` serves — one traversal, so the picker can
|
|
41
|
+
* never offer a path this rejects. A malformed filter throws a
|
|
42
|
+
* `FilterException` (HTTP 400).
|
|
43
|
+
*/
|
|
44
|
+
private filterPredicate;
|
|
45
|
+
/**
|
|
46
|
+
* The soft-delete guard for paranoid types: the default list excludes
|
|
47
|
+
* tombstoned rows (`deleted_at IS NULL`); `?deleted=only` flips to the trash
|
|
48
|
+
* view (`deleted_at IS NOT NULL`). A non-paranoid type has no `deleted_at`,
|
|
49
|
+
* so the predicate collapses to `undefined`.
|
|
50
|
+
*/
|
|
51
|
+
private deletedPredicate;
|
|
52
|
+
/**
|
|
53
|
+
* Translate the `?sort=` spec (`col` asc, `-col` desc) into an ORDER BY,
|
|
54
|
+
* always with an `id` tiebreaker so pagination is stable across requests.
|
|
55
|
+
* Sortable = the always-present envelope columns + `status` (publishable
|
|
56
|
+
* only) + the type's **scalar** fields. Non-scalar fields (`json`/
|
|
57
|
+
* `multiselect`, single/many `relation`) are excluded — a many-relation has
|
|
58
|
+
* no column on the main table at all, so ordering by it would pass
|
|
59
|
+
* `undefined` to `asc`/`desc`; the others have no meaningful order. An
|
|
60
|
+
* unknown or excluded column falls back to `updatedAt` desc.
|
|
61
|
+
*/
|
|
62
|
+
private orderBy;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=entries.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entries.service.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/queries/entries.service.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAEH,KAAK,qBAAqB,EAE7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AA+B3E;;;;;;GAMG;AACH,qBACa,cAAc;IAED,OAAO,CAAC,QAAQ,CAAC,EAAE;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAK9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBANQ,EAAE,EAAE,QAAQ,EAC9B,aAAa,EAAE,mBAAmB,EAKlC,SAAS,CAAC,EAAE,qBAAqB,YAAA;IAGtD;;;;;;OAMG;IACG,IAAI,CACN,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,mBAAmB,EAC1B,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC;IAgDzB;;;;;;;OAOG;YACW,SAAS;IA0CvB;;;;;;;OAOG;YACW,eAAe;IAyB7B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;;;;;;;;OASG;IACH,OAAO,CAAC,OAAO;CAsBlB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntriesService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
7
|
+
const database_1 = require("@orthacms/database");
|
|
8
|
+
const utils_server_1 = require("@orthacms/utils-server");
|
|
9
|
+
const entry_extension_1 = require("../../../extension/entry-extension");
|
|
10
|
+
const fields_1 = require("../../../types/fields");
|
|
11
|
+
const list_entries_query_dto_1 = require("../../http/dto/list-entries-query.dto");
|
|
12
|
+
const entries_constants_1 = require("../../entries.constants");
|
|
13
|
+
const entry_scalar_fields_1 = require("./entry-scalar-fields");
|
|
14
|
+
const entry_filter_surface_1 = require("./entry-filter-surface");
|
|
15
|
+
const entry_search_1 = require("./entry-search");
|
|
16
|
+
const entry_row_1 = require("../persistence/entry-row");
|
|
17
|
+
const relation_link_service_1 = require("../persistence/relation-link.service");
|
|
18
|
+
/**
|
|
19
|
+
* The relation fields a `?relationFields=` list actually names, intersected with
|
|
20
|
+
* the type's own relation fields. Unknown names are dropped, so a client string
|
|
21
|
+
* never reaches a query — only keys already present on `type.fields` survive.
|
|
22
|
+
*/
|
|
23
|
+
function previewFields(type, raw) {
|
|
24
|
+
if (!raw)
|
|
25
|
+
return [];
|
|
26
|
+
const wanted = new Set(raw
|
|
27
|
+
.split(',')
|
|
28
|
+
.map((name) => name.trim())
|
|
29
|
+
.filter(Boolean));
|
|
30
|
+
return Object.entries(type.fields)
|
|
31
|
+
.filter(([name, spec]) => wanted.has(name) &&
|
|
32
|
+
spec.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
33
|
+
!!spec.relation)
|
|
34
|
+
.map(([name]) => name);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reads a collection's entries. Generic over the content type: the physical
|
|
38
|
+
* table, the filterable columns, the searchable columns, and the sort whitelist
|
|
39
|
+
* are all derived from `type` at request time, so one service backs every
|
|
40
|
+
* collection. Owns no schema of its own — it queries the HOST-owned generated
|
|
41
|
+
* `content_<name>` tables through the shared Drizzle client.
|
|
42
|
+
*/
|
|
43
|
+
let EntriesService = class EntriesService {
|
|
44
|
+
db;
|
|
45
|
+
relationLinks;
|
|
46
|
+
extension;
|
|
47
|
+
constructor(db, relationLinks, extension) {
|
|
48
|
+
this.db = db;
|
|
49
|
+
this.relationLinks = relationLinks;
|
|
50
|
+
this.extension = extension;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* One page of a collection's entries: search → filter → sort → paginate, run
|
|
54
|
+
* in SQL against the type's generated table, returned as the
|
|
55
|
+
* `{ items, total, page, pageSize }` envelope the admin records table renders.
|
|
56
|
+
* Scoped to `workspaceId` — only the calling workspace's entries are counted
|
|
57
|
+
* or listed.
|
|
58
|
+
*/
|
|
59
|
+
async list(type, query, workspaceId) {
|
|
60
|
+
const page = query.page ?? 1;
|
|
61
|
+
const pageSize = query.pageSize ?? entries_constants_1.DEFAULT_PAGE_SIZE;
|
|
62
|
+
const where = await this.listWhere(type, query, workspaceId);
|
|
63
|
+
const orderBy = this.orderBy(type, query.sort);
|
|
64
|
+
// Count and page rows share the WHERE but are independent — run them
|
|
65
|
+
// concurrently so the request pays the slower of the two, not their sum.
|
|
66
|
+
const [[{ total }], rows] = await Promise.all([
|
|
67
|
+
this.db.select({ total: (0, drizzle_orm_1.count)() }).from(type.table).where(where),
|
|
68
|
+
this.db
|
|
69
|
+
.select()
|
|
70
|
+
.from(type.table)
|
|
71
|
+
.where(where)
|
|
72
|
+
.orderBy(...orderBy)
|
|
73
|
+
.limit(pageSize)
|
|
74
|
+
.offset((page - 1) * pageSize)
|
|
75
|
+
]);
|
|
76
|
+
const items = rows.map((row) => (0, entry_row_1.toRecord)(type, row));
|
|
77
|
+
// Opt-in relation preview for the records table's visible relation
|
|
78
|
+
// columns. Batched across the whole page (a constant number of queries
|
|
79
|
+
// per field), so this never becomes an N+1 over rows — see
|
|
80
|
+
// `previewForEntries`. Off by default: the relation picker reuses this
|
|
81
|
+
// endpoint for candidates and must not pay for it.
|
|
82
|
+
if (query.relations === list_entries_query_dto_1.RELATIONS_PREVIEW && items.length) {
|
|
83
|
+
const fields = previewFields(type, query.relationFields);
|
|
84
|
+
if (fields.length) {
|
|
85
|
+
const previews = await this.relationLinks.previewForEntries(type, fields, rows, workspaceId);
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
const preview = previews.get(item.id);
|
|
88
|
+
if (preview)
|
|
89
|
+
item.relations = preview;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { items, total, page, pageSize };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The full WHERE: the workspace scope AND free-text search AND the
|
|
97
|
+
* query-builder `?filter=` tree AND (for paranoid types) the not-deleted
|
|
98
|
+
* guard. `and(undefined, …)` collapses empties, so an unfiltered list still
|
|
99
|
+
* scans the workspace's whole table. The workspace predicate is always
|
|
100
|
+
* present, so an entry never leaks across workspaces. A malformed filter
|
|
101
|
+
* throws a `FilterException` (HTTP 400).
|
|
102
|
+
*/
|
|
103
|
+
async listWhere(type, query, workspaceId) {
|
|
104
|
+
// The bound extension may contribute virtual filter fields (declared
|
|
105
|
+
// into the schema, resolved to its own SQL) and an extra scope
|
|
106
|
+
// predicate (e.g. the active locale). Both are no-ops for types the
|
|
107
|
+
// extension doesn't apply to.
|
|
108
|
+
const filterExtension = this.extension?.filterExtension(type);
|
|
109
|
+
// Building the surface walks the type's whole relation graph to the
|
|
110
|
+
// hop budget, so only pay for it when there is actually a filter to
|
|
111
|
+
// translate — an unfiltered list (the common case) skips it entirely.
|
|
112
|
+
//
|
|
113
|
+
// `grantedTypes` is deliberately left unset: this is the SQL
|
|
114
|
+
// whitelist, not a visibility boundary, and pruning it by grant would
|
|
115
|
+
// make the *same* saved filter 400 or silently change meaning
|
|
116
|
+
// depending on which workspace opened it. Grant pruning belongs on
|
|
117
|
+
// the `/filter-fields` surface the picker renders, where it is
|
|
118
|
+
// applied. Every relation subquery is workspace-scoped regardless, so
|
|
119
|
+
// a traversal can never read another workspace's rows.
|
|
120
|
+
const filterSql = query.filter
|
|
121
|
+
? await this.filterPredicate(type, query.filter, workspaceId, filterExtension)
|
|
122
|
+
: undefined;
|
|
123
|
+
const table = type.table;
|
|
124
|
+
return (0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(table['workspaceId'], workspaceId), this.extension?.listScope(type, workspaceId, {
|
|
125
|
+
locale: query.locale,
|
|
126
|
+
localeFallback: query.localeFallback
|
|
127
|
+
}), (0, entry_search_1.buildSearchPredicate)(type, query.search), filterSql, this.deletedPredicate(type, query));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Translate one `?filter=` payload against the type's filterable surface.
|
|
131
|
+
* The surface is built per request (content types are code-defined, so it
|
|
132
|
+
* is pure derivation) and produces BOTH the SQL whitelist used here and
|
|
133
|
+
* the wire list `/filter-fields` serves — one traversal, so the picker can
|
|
134
|
+
* never offer a path this rejects. A malformed filter throws a
|
|
135
|
+
* `FilterException` (HTTP 400).
|
|
136
|
+
*/
|
|
137
|
+
async filterPredicate(type, filter, workspaceId, filterExtension) {
|
|
138
|
+
const { schema } = (0, entry_filter_surface_1.buildEntryFilterSurface)(type, {
|
|
139
|
+
workspaceId,
|
|
140
|
+
extensionFields: filterExtension?.fields
|
|
141
|
+
});
|
|
142
|
+
const tree = (0, utils_server_1.parseFilterTree)(filter, schema);
|
|
143
|
+
return (0, utils_server_1.applyFilterTree)(tree, schema, type.table, this.db, filterExtension
|
|
144
|
+
? {
|
|
145
|
+
resolveExtension: (rule) => filterExtension.resolve(rule, { type, workspaceId })
|
|
146
|
+
}
|
|
147
|
+
: {});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The soft-delete guard for paranoid types: the default list excludes
|
|
151
|
+
* tombstoned rows (`deleted_at IS NULL`); `?deleted=only` flips to the trash
|
|
152
|
+
* view (`deleted_at IS NOT NULL`). A non-paranoid type has no `deleted_at`,
|
|
153
|
+
* so the predicate collapses to `undefined`.
|
|
154
|
+
*/
|
|
155
|
+
deletedPredicate(type, query) {
|
|
156
|
+
if (!type.paranoid)
|
|
157
|
+
return undefined;
|
|
158
|
+
const table = type.table;
|
|
159
|
+
return query.deleted === list_entries_query_dto_1.DELETED_ONLY
|
|
160
|
+
? (0, drizzle_orm_1.isNotNull)(table['deletedAt'])
|
|
161
|
+
: (0, drizzle_orm_1.isNull)(table['deletedAt']);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Translate the `?sort=` spec (`col` asc, `-col` desc) into an ORDER BY,
|
|
165
|
+
* always with an `id` tiebreaker so pagination is stable across requests.
|
|
166
|
+
* Sortable = the always-present envelope columns + `status` (publishable
|
|
167
|
+
* only) + the type's **scalar** fields. Non-scalar fields (`json`/
|
|
168
|
+
* `multiselect`, single/many `relation`) are excluded — a many-relation has
|
|
169
|
+
* no column on the main table at all, so ordering by it would pass
|
|
170
|
+
* `undefined` to `asc`/`desc`; the others have no meaningful order. An
|
|
171
|
+
* unknown or excluded column falls back to `updatedAt` desc.
|
|
172
|
+
*/
|
|
173
|
+
orderBy(type, sort) {
|
|
174
|
+
const table = type.table;
|
|
175
|
+
const sortable = new Set([
|
|
176
|
+
'createdAt',
|
|
177
|
+
'updatedAt',
|
|
178
|
+
...(type.publishable ? ['status'] : []),
|
|
179
|
+
...(type.i18n ? ['locale'] : []),
|
|
180
|
+
...Object.entries(type.fields)
|
|
181
|
+
.filter(([, spec]) => (0, entry_scalar_fields_1.isScalarField)(spec))
|
|
182
|
+
.map(([name]) => name)
|
|
183
|
+
]);
|
|
184
|
+
const isDesc = !!sort && sort.startsWith('-');
|
|
185
|
+
const columnId = sort ? (isDesc ? sort.slice(1) : sort) : '';
|
|
186
|
+
// The whitelist only admits scalar columns, but guard against a missing
|
|
187
|
+
// column defensively so a sort key never reaches `asc(undefined)`.
|
|
188
|
+
const col = sortable.has(columnId) ? table[columnId] : undefined;
|
|
189
|
+
if (col) {
|
|
190
|
+
return [isDesc ? (0, drizzle_orm_1.desc)(col) : (0, drizzle_orm_1.asc)(col), (0, drizzle_orm_1.asc)(table['id'])];
|
|
191
|
+
}
|
|
192
|
+
return [(0, drizzle_orm_1.desc)(table['updatedAt']), (0, drizzle_orm_1.asc)(table['id'])];
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
exports.EntriesService = EntriesService;
|
|
196
|
+
exports.EntriesService = EntriesService = tslib_1.__decorate([
|
|
197
|
+
(0, common_1.Injectable)(),
|
|
198
|
+
tslib_1.__param(0, (0, database_1.InjectDatabase)()),
|
|
199
|
+
tslib_1.__param(2, (0, common_1.Optional)()),
|
|
200
|
+
tslib_1.__param(2, (0, common_1.Inject)(entry_extension_1.CONTENT_ENTRY_EXTENSION)),
|
|
201
|
+
tslib_1.__metadata("design:paramtypes", [Object, relation_link_service_1.RelationLinkService, Object])
|
|
202
|
+
], EntriesService);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type FieldSchema, type FilterSchema, type ScalarFieldSchema } from '@ortha-cms/utils-server';
|
|
2
|
+
import { type AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import { type AnyFieldSpec } from '../../../types/fields';
|
|
4
|
+
/**
|
|
5
|
+
* The filter scalar type for one content field, or `null` to leave it
|
|
6
|
+
* unfilterable. Mirrors the admin's `filterFieldsFromSchema`: text-like fields
|
|
7
|
+
* filter as strings, `select` as an enum of its options, numerics as numbers,
|
|
8
|
+
* dates as dates. `json`/`multiselect` have no scalar editor, and `relation`
|
|
9
|
+
* filtering (by raw FK uuid) has no UI yet — all skipped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function scalarTypeFor(spec: AnyFieldSpec): ScalarFieldSchema | null;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a field is backed by a comparable scalar column — the single source of
|
|
14
|
+
* truth for "can this field be filtered or sorted". `json`/`multiselect` (jsonb)
|
|
15
|
+
* and `relation` (FK uuid / join table) are not: they have no scalar editor and
|
|
16
|
+
* ordering them is meaningless. The sort whitelist and the filter schema both
|
|
17
|
+
* derive from this, so the two can't drift apart.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isScalarField(spec: AnyFieldSpec): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Build the query-builder `FilterSchema` for one content type at request time.
|
|
22
|
+
* Whitelists the always-present envelope columns (`createdAt`/`updatedAt`),
|
|
23
|
+
* plus `status`/`publishedAt` only on publishable types, plus `locale` on i18n
|
|
24
|
+
* types, plus every filterable field (those `isScalarField` admits — the same
|
|
25
|
+
* set the admin's `filterFieldsFromSchema` offers), keyed by the property
|
|
26
|
+
* names the engine resolves to table columns. (`status` has a matching admin
|
|
27
|
+
* filter; the timestamp envelopes like `publishedAt` are filterable via the
|
|
28
|
+
* API but have no UI control yet.) This is the security boundary: only listed
|
|
29
|
+
* fields/ops reach SQL, and the engine's depth/node caps bound payload
|
|
30
|
+
* blow-up.
|
|
31
|
+
*
|
|
32
|
+
* `extensionFields` are **virtual** fields contributed by the bound
|
|
33
|
+
* `CONTENT_ENTRY_EXTENSION` (e.g. locale aggregates): their declarations merge
|
|
34
|
+
* into `fields` (so the parser can coerce values) and their names are
|
|
35
|
+
* registered on the schema's `extensionFields` set, routing them to the
|
|
36
|
+
* extension's own SQL resolver instead of a table column. A field column
|
|
37
|
+
* always wins a name collision — an extension cannot shadow real data.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildEntryFilterSchema(type: AnyContentType, extensionFields?: FieldSchema): FilterSchema;
|
|
40
|
+
//# sourceMappingURL=entry-filter-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-filter-schema.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/queries/entry-filter-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,iBAAiB,GAAG,IAAI,CAsB1E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,cAAc,EACpB,eAAe,CAAC,EAAE,WAAW,GAC9B,YAAY,CAmCd"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type FieldSchema, type FilterSchema } from '@orthacms/utils-server';
|
|
2
|
+
import { type AnyContentType } from '../../../types/content-type';
|
|
3
|
+
import type { WireFilterField } from '../../types/filter-surface';
|
|
4
|
+
/** Options for {@link buildEntryFilterSurface}. */
|
|
5
|
+
export interface FilterSurfaceOptions {
|
|
6
|
+
/** Request workspace — scopes every relation subquery. */
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
/** Extension-contributed virtual filter fields (locale aggregates, …). */
|
|
9
|
+
extensionFields?: FieldSchema;
|
|
10
|
+
/**
|
|
11
|
+
* Content-type names granted to this workspace. A relation whose target
|
|
12
|
+
* is not granted is omitted entirely — mirroring the entry editor's
|
|
13
|
+
* `availableTypeNames`, so the filter picker never offers a traversal
|
|
14
|
+
* into a collection the caller cannot see. When absent, no pruning.
|
|
15
|
+
*/
|
|
16
|
+
grantedTypes?: ReadonlySet<string>;
|
|
17
|
+
/** Override the default relation-hop budget. */
|
|
18
|
+
maxRelationHops?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The filterable surface for one content type: the Drizzle `FilterSchema`
|
|
22
|
+
* (the security boundary — only listed paths reach SQL) AND the flat
|
|
23
|
+
* `WireFilterField[]` the admin's query builder renders, produced by a
|
|
24
|
+
* single traversal so they cannot drift.
|
|
25
|
+
*
|
|
26
|
+
* `extensionFields` are virtual fields contributed by the bound
|
|
27
|
+
* `CONTENT_ENTRY_EXTENSION` (locale aggregates, …): they merge into the
|
|
28
|
+
* root `fields` (so the parser can coerce their values) and their names are
|
|
29
|
+
* registered on `extensionFields` (so the translator routes them to the
|
|
30
|
+
* extension's own SQL resolver). A real column always wins a name clash.
|
|
31
|
+
* They are NOT surfaced as wire fields here — a contributing plugin adds
|
|
32
|
+
* those via the admin's `RECORDS_FILTER_FIELDS_SLOT`, as today.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildEntryFilterSurface(type: AnyContentType, opts: FilterSurfaceOptions): {
|
|
35
|
+
schema: FilterSchema;
|
|
36
|
+
fields: WireFilterField[];
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=entry-filter-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-filter-surface.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/queries/entry-filter-surface.ts"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,WAAW,EAChB,KAAK,YAAY,EAIpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAgBlE,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACjC,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAsTD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,oBAAoB,GAC3B;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CA6BrD"}
|