@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,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicEntryWritesController = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
7
|
+
const identity_server_1 = require("@orthacms/identity-server");
|
|
8
|
+
const workspaces_server_1 = require("@orthacms/workspaces-server");
|
|
9
|
+
const content_tokens_1 = require("../../../content.tokens");
|
|
10
|
+
const workspace_grants_query_1 = require("../../../content-types/queries/workspace-grants.query");
|
|
11
|
+
const public_entry_writes_service_1 = require("../../infrastructure/public-entry-writes.service");
|
|
12
|
+
const api_token_guard_1 = require("../guards/api-token.guard");
|
|
13
|
+
const api_token_workspace_guard_1 = require("../guards/api-token-workspace.guard");
|
|
14
|
+
const public_save_entry_dto_1 = require("../dto/public-save-entry.dto");
|
|
15
|
+
const public_bulk_dto_1 = require("../dto/public-bulk.dto");
|
|
16
|
+
const entries_constants_1 = require("../../../entries/entries.constants");
|
|
17
|
+
const public_list_entries_query_dto_1 = require("../dto/public-list-entries-query.dto");
|
|
18
|
+
const resolve_granted_type_1 = require("./resolve-granted-type");
|
|
19
|
+
/**
|
|
20
|
+
* `POST|PATCH|DELETE /api/v1/content/...` — the **write half** of the public,
|
|
21
|
+
* token-authenticated content API. A `full`-scope token can author content from
|
|
22
|
+
* outside the admin: create drafts, edit them, assign and unassign relations,
|
|
23
|
+
* add translations, publish, and remove.
|
|
24
|
+
*
|
|
25
|
+
* Every route is gated by its own permission (`content:create` / `update` /
|
|
26
|
+
* `publish` / `delete`), which `ApiTokenGuard` evaluates against the token's
|
|
27
|
+
* scope through the same `AccessPolicy` the session routes use. A `read` token
|
|
28
|
+
* therefore gets a **403** on all of them without a line of code here saying so.
|
|
29
|
+
*
|
|
30
|
+
* **Batches sit alongside the single-entry writes, not instead of them**
|
|
31
|
+
* (`/bulk`, `/bulk/publish`, `/bulk/unpublish`, `/bulk/delete`). They exist
|
|
32
|
+
* because an external client is usually syncing a list — an import, a scheduled
|
|
33
|
+
* republish — and doing that one HTTP round trip per record is the difference
|
|
34
|
+
* between a job that finishes and one that times out. Every one of them runs the
|
|
35
|
+
* same use-case its single-entry sibling does, so a batch is a way of *asking*,
|
|
36
|
+
* never a second set of rules.
|
|
37
|
+
*
|
|
38
|
+
* Like the reads, every single-entry write exists in **both addressing forms** —
|
|
39
|
+
* `:id` and `group/:localeGroupId` — so a localized client that holds group ids
|
|
40
|
+
* can edit, publish, and delete without ever learning a per-locale id.
|
|
41
|
+
*
|
|
42
|
+
* **No `OriginGuard`**, unlike the admin's write controllers: those are
|
|
43
|
+
* cookie-authenticated and so CSRF-able, while a bearer token is never sent
|
|
44
|
+
* ambiently by a browser. Requiring an `Origin` header here would reject every
|
|
45
|
+
* server-side client instead of protecting anything.
|
|
46
|
+
*/
|
|
47
|
+
let PublicEntryWritesController = class PublicEntryWritesController {
|
|
48
|
+
registry;
|
|
49
|
+
grants;
|
|
50
|
+
writes;
|
|
51
|
+
constructor(registry, grants, writes) {
|
|
52
|
+
this.registry = registry;
|
|
53
|
+
this.grants = grants;
|
|
54
|
+
this.writes = writes;
|
|
55
|
+
}
|
|
56
|
+
/** `POST /api/v1/content/:typeName` — create a draft entry. */
|
|
57
|
+
async create(typeName, body, workspaceId) {
|
|
58
|
+
const { type, granted } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
59
|
+
return this.writes.create(type, body, workspaceId, granted);
|
|
60
|
+
}
|
|
61
|
+
// ---- batches -----------------------------------------------------------
|
|
62
|
+
//
|
|
63
|
+
// **Declared before the `:id` routes**, because `bulk/publish` and
|
|
64
|
+
// `:id/publish` are the same shape to the router and Express matches in
|
|
65
|
+
// declaration order — the single-entry routes' `ParseUUIDPipe` is a backstop
|
|
66
|
+
// that turns a mis-ordered match into a 400, not a substitute for the order.
|
|
67
|
+
// Same arrangement, same reason, as the admin's `BulkEntriesController`.
|
|
68
|
+
/** `POST /api/v1/content/:typeName/bulk` — create and/or update many entries. */
|
|
69
|
+
async bulkSave(typeName, body, workspaceId) {
|
|
70
|
+
const { type, granted } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
71
|
+
return this.writes.bulkSave(type, body.items, workspaceId, granted);
|
|
72
|
+
}
|
|
73
|
+
/** `POST /api/v1/content/:typeName/bulk/publish` — take many entries live. */
|
|
74
|
+
async bulkPublish(typeName, body, workspaceId) {
|
|
75
|
+
const { type } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
76
|
+
return this.writes.bulkPublish(type, body.ids, workspaceId);
|
|
77
|
+
}
|
|
78
|
+
/** `POST /api/v1/content/:typeName/bulk/unpublish` — take many off the air. */
|
|
79
|
+
async bulkUnpublish(typeName, body, workspaceId) {
|
|
80
|
+
const { type } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
81
|
+
return this.writes.bulkUnpublish(type, body.ids, workspaceId);
|
|
82
|
+
}
|
|
83
|
+
/** `POST /api/v1/content/:typeName/bulk/delete` — remove many entries. */
|
|
84
|
+
async bulkRemove(typeName, body, workspaceId) {
|
|
85
|
+
const { type } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
86
|
+
return this.writes.bulkRemove(type, body.ids, workspaceId);
|
|
87
|
+
}
|
|
88
|
+
// ---- addressed by translation group -----------------------------------
|
|
89
|
+
//
|
|
90
|
+
// Declared before the `:id` forms for the same reason as the reads: they
|
|
91
|
+
// cannot collide on segment count, but Express matches in declaration order
|
|
92
|
+
// and literal-prefixed routes belong ahead of wildcards.
|
|
93
|
+
/** `PATCH /api/v1/content/:typeName/group/:localeGroupId` */
|
|
94
|
+
updateByGroup(typeName, localeGroupId, body, query, workspaceId) {
|
|
95
|
+
return this.applyUpdate(typeName, { localeGroupId }, body, workspaceId, query.locale);
|
|
96
|
+
}
|
|
97
|
+
/** `POST /api/v1/content/:typeName/group/:localeGroupId/publish` */
|
|
98
|
+
publishByGroup(typeName, localeGroupId, query, workspaceId) {
|
|
99
|
+
return this.applyPublish(typeName, { localeGroupId }, workspaceId, query.locale, true);
|
|
100
|
+
}
|
|
101
|
+
/** `POST /api/v1/content/:typeName/group/:localeGroupId/unpublish` */
|
|
102
|
+
unpublishByGroup(typeName, localeGroupId, query, workspaceId) {
|
|
103
|
+
return this.applyPublish(typeName, { localeGroupId }, workspaceId, query.locale, false);
|
|
104
|
+
}
|
|
105
|
+
/** `DELETE /api/v1/content/:typeName/group/:localeGroupId` */
|
|
106
|
+
removeByGroup(typeName, localeGroupId, query, workspaceId) {
|
|
107
|
+
return this.applyRemove(typeName, { localeGroupId }, workspaceId, query.locale);
|
|
108
|
+
}
|
|
109
|
+
// ---- addressed by entry id ---------------------------------------------
|
|
110
|
+
/** `PATCH /api/v1/content/:typeName/:id` — replace an entry's values. */
|
|
111
|
+
update(typeName, id, body, workspaceId) {
|
|
112
|
+
// No locale: an entry id already names exactly one row, in whatever
|
|
113
|
+
// locale it happens to be.
|
|
114
|
+
return this.applyUpdate(typeName, { id }, body, workspaceId, undefined);
|
|
115
|
+
}
|
|
116
|
+
/** `POST /api/v1/content/:typeName/:id/publish` — take an entry live. */
|
|
117
|
+
publish(typeName, id, workspaceId) {
|
|
118
|
+
return this.applyPublish(typeName, { id }, workspaceId, undefined, true);
|
|
119
|
+
}
|
|
120
|
+
/** `POST /api/v1/content/:typeName/:id/unpublish` — take it off the air. */
|
|
121
|
+
unpublish(typeName, id, workspaceId) {
|
|
122
|
+
return this.applyPublish(typeName, { id }, workspaceId, undefined, false);
|
|
123
|
+
}
|
|
124
|
+
/** `DELETE /api/v1/content/:typeName/:id` — remove an entry. */
|
|
125
|
+
remove(typeName, id, workspaceId) {
|
|
126
|
+
return this.applyRemove(typeName, { id }, workspaceId, undefined);
|
|
127
|
+
}
|
|
128
|
+
// ---- the shared handlers, one per write --------------------------------
|
|
129
|
+
//
|
|
130
|
+
// Each is called by both addressing forms, so the pair stays a routing
|
|
131
|
+
// detail and never a behavioural fork — the same arrangement as the reads.
|
|
132
|
+
/** @see update */
|
|
133
|
+
async applyUpdate(typeName, locator, body, workspaceId, locale) {
|
|
134
|
+
const { type, granted } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
135
|
+
return this.writes.update(type, locator, body, workspaceId, granted, locale);
|
|
136
|
+
}
|
|
137
|
+
/** @see publish */
|
|
138
|
+
async applyPublish(typeName, locator, workspaceId, locale, live) {
|
|
139
|
+
const { type, granted } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
140
|
+
return live
|
|
141
|
+
? this.writes.publish(type, locator, workspaceId, granted, locale)
|
|
142
|
+
: this.writes.unpublish(type, locator, workspaceId, granted, locale);
|
|
143
|
+
}
|
|
144
|
+
/** @see remove */
|
|
145
|
+
async applyRemove(typeName, locator, workspaceId, locale) {
|
|
146
|
+
const { type } = await (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, workspaceId);
|
|
147
|
+
await this.writes.remove(type, locator, workspaceId, locale);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
exports.PublicEntryWritesController = PublicEntryWritesController;
|
|
151
|
+
tslib_1.__decorate([
|
|
152
|
+
(0, common_1.Post)(':typeName'),
|
|
153
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_CREATE),
|
|
154
|
+
(0, swagger_1.ApiOperation)({
|
|
155
|
+
summary: 'Create an entry',
|
|
156
|
+
description: 'Creates the entry as a **draft** on publishable types — publish is a separate call, so a create always has a reviewable state. `values` is validated against the type’s field specs (422 with per-field issues). Pass `localeGroupId` with a different `locale` to add a translation to an existing record. 404 when the type is unknown or the workspace was not granted it.'
|
|
157
|
+
}),
|
|
158
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
159
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
160
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
161
|
+
tslib_1.__metadata("design:type", Function),
|
|
162
|
+
tslib_1.__metadata("design:paramtypes", [String, public_save_entry_dto_1.PublicSaveEntryDto, String]),
|
|
163
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
164
|
+
], PublicEntryWritesController.prototype, "create", null);
|
|
165
|
+
tslib_1.__decorate([
|
|
166
|
+
(0, common_1.Post)(':typeName/bulk'),
|
|
167
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
168
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_CREATE, identity_server_1.PERMISSIONS.CONTENT_UPDATE),
|
|
169
|
+
(0, swagger_1.ApiOperation)({
|
|
170
|
+
summary: 'Save many entries',
|
|
171
|
+
description: `Creates and/or updates up to ${entries_constants_1.BULK_MAX_SAVE_ITEMS} entries of one type in a single request — an item with an \`id\` updates that entry, one without creates a new draft, and an item naming only a \`localeGroupId\` must say which with \`op\`. Each item means exactly what the equivalent \`POST\` / \`PATCH\` means, merge semantics and all.\n\n**Always 200, even when items fail.** Items are written one transaction at a time, so a batch cannot be rolled back as a unit and one bad row does not reject the rest: the response carries a verdict per item in request order, with failures reporting the status and message the single-entry call would have returned (a 422 keeps its per-field \`issues\`). Retry the failures you can fix. Both \`content:create\` and \`content:update\` are required, since one request may do either.`
|
|
172
|
+
}),
|
|
173
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
174
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
175
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
176
|
+
tslib_1.__metadata("design:type", Function),
|
|
177
|
+
tslib_1.__metadata("design:paramtypes", [String, public_bulk_dto_1.PublicBulkSaveDto, String]),
|
|
178
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
179
|
+
], PublicEntryWritesController.prototype, "bulkSave", null);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
(0, common_1.Post)(':typeName/bulk/publish'),
|
|
182
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
183
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
184
|
+
(0, swagger_1.ApiOperation)({
|
|
185
|
+
summary: 'Publish many entries',
|
|
186
|
+
description: 'Re-validates the listed drafts inside **one locked transaction** and publishes those that pass, reporting the rest in `skipped` with why — `already-published`, `blocked` (validation), or `not-found` (unknown, soft-deleted, or in another workspace). Partial success is the normal outcome, not an error. 400 on a type that is not publishable.'
|
|
187
|
+
}),
|
|
188
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
189
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
190
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
191
|
+
tslib_1.__metadata("design:type", Function),
|
|
192
|
+
tslib_1.__metadata("design:paramtypes", [String, public_bulk_dto_1.PublicBulkIdsDto, String]),
|
|
193
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
194
|
+
], PublicEntryWritesController.prototype, "bulkPublish", null);
|
|
195
|
+
tslib_1.__decorate([
|
|
196
|
+
(0, common_1.Post)(':typeName/bulk/unpublish'),
|
|
197
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
198
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
199
|
+
(0, swagger_1.ApiOperation)({
|
|
200
|
+
summary: 'Unpublish many entries',
|
|
201
|
+
description: 'Reverts the listed entries to drafts. `count` is how many actually transitioned — an id that was not a live published row of this workspace changes nothing and is not counted, which is the only way this call can "fail" for an id.'
|
|
202
|
+
}),
|
|
203
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
204
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
205
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
206
|
+
tslib_1.__metadata("design:type", Function),
|
|
207
|
+
tslib_1.__metadata("design:paramtypes", [String, public_bulk_dto_1.PublicBulkIdsDto, String]),
|
|
208
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
209
|
+
], PublicEntryWritesController.prototype, "bulkUnpublish", null);
|
|
210
|
+
tslib_1.__decorate([
|
|
211
|
+
(0, common_1.Post)(':typeName/bulk/delete'),
|
|
212
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
213
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
214
|
+
(0, swagger_1.ApiOperation)({
|
|
215
|
+
summary: 'Delete many entries',
|
|
216
|
+
description: 'Soft-deletes on a `paranoid` type (recoverable from the admin’s trash) and hard-deletes otherwise. `count` is how many rows were removed. Deletes exactly the listed rows: on a localized type the other translations stay live.\n\nA `POST`, not a `DELETE`, because the ids travel in a body — the one thing a `DELETE` cannot reliably carry through proxies and client libraries.'
|
|
217
|
+
}),
|
|
218
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
219
|
+
tslib_1.__param(1, (0, common_1.Body)()),
|
|
220
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
221
|
+
tslib_1.__metadata("design:type", Function),
|
|
222
|
+
tslib_1.__metadata("design:paramtypes", [String, public_bulk_dto_1.PublicBulkIdsDto, String]),
|
|
223
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
224
|
+
], PublicEntryWritesController.prototype, "bulkRemove", null);
|
|
225
|
+
tslib_1.__decorate([
|
|
226
|
+
(0, common_1.Patch)(':typeName/group/:localeGroupId'),
|
|
227
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_UPDATE),
|
|
228
|
+
(0, swagger_1.ApiOperation)({
|
|
229
|
+
summary: 'Update the group’s entry for a locale',
|
|
230
|
+
description: 'As the `:id` form, for the group’s row in the requested `?locale=`.'
|
|
231
|
+
}),
|
|
232
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
233
|
+
tslib_1.__param(1, (0, common_1.Param)('localeGroupId', common_1.ParseUUIDPipe)),
|
|
234
|
+
tslib_1.__param(2, (0, common_1.Body)()),
|
|
235
|
+
tslib_1.__param(3, (0, common_1.Query)()),
|
|
236
|
+
tslib_1.__param(4, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
237
|
+
tslib_1.__metadata("design:type", Function),
|
|
238
|
+
tslib_1.__metadata("design:paramtypes", [String, String, public_save_entry_dto_1.PublicSaveEntryDto,
|
|
239
|
+
public_list_entries_query_dto_1.PublicEntryQueryDto, String]),
|
|
240
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
241
|
+
], PublicEntryWritesController.prototype, "updateByGroup", null);
|
|
242
|
+
tslib_1.__decorate([
|
|
243
|
+
(0, common_1.Post)(':typeName/group/:localeGroupId/publish'),
|
|
244
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
245
|
+
(0, swagger_1.ApiOperation)({ summary: 'Publish the group’s entry for a locale' }),
|
|
246
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
247
|
+
tslib_1.__param(1, (0, common_1.Param)('localeGroupId', common_1.ParseUUIDPipe)),
|
|
248
|
+
tslib_1.__param(2, (0, common_1.Query)()),
|
|
249
|
+
tslib_1.__param(3, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
250
|
+
tslib_1.__metadata("design:type", Function),
|
|
251
|
+
tslib_1.__metadata("design:paramtypes", [String, String, public_list_entries_query_dto_1.PublicEntryQueryDto, String]),
|
|
252
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
253
|
+
], PublicEntryWritesController.prototype, "publishByGroup", null);
|
|
254
|
+
tslib_1.__decorate([
|
|
255
|
+
(0, common_1.Post)(':typeName/group/:localeGroupId/unpublish'),
|
|
256
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
257
|
+
(0, swagger_1.ApiOperation)({ summary: 'Unpublish the group’s entry for a locale' }),
|
|
258
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
259
|
+
tslib_1.__param(1, (0, common_1.Param)('localeGroupId', common_1.ParseUUIDPipe)),
|
|
260
|
+
tslib_1.__param(2, (0, common_1.Query)()),
|
|
261
|
+
tslib_1.__param(3, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
262
|
+
tslib_1.__metadata("design:type", Function),
|
|
263
|
+
tslib_1.__metadata("design:paramtypes", [String, String, public_list_entries_query_dto_1.PublicEntryQueryDto, String]),
|
|
264
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
265
|
+
], PublicEntryWritesController.prototype, "unpublishByGroup", null);
|
|
266
|
+
tslib_1.__decorate([
|
|
267
|
+
(0, common_1.Delete)(':typeName/group/:localeGroupId'),
|
|
268
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
269
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
270
|
+
(0, swagger_1.ApiOperation)({
|
|
271
|
+
summary: 'Delete the group’s entry for a locale',
|
|
272
|
+
description: 'Removes **one** translation — the group’s row in the requested `?locale=`. The other locales stay live.'
|
|
273
|
+
}),
|
|
274
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
275
|
+
tslib_1.__param(1, (0, common_1.Param)('localeGroupId', common_1.ParseUUIDPipe)),
|
|
276
|
+
tslib_1.__param(2, (0, common_1.Query)()),
|
|
277
|
+
tslib_1.__param(3, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
278
|
+
tslib_1.__metadata("design:type", Function),
|
|
279
|
+
tslib_1.__metadata("design:paramtypes", [String, String, public_list_entries_query_dto_1.PublicEntryQueryDto, String]),
|
|
280
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
281
|
+
], PublicEntryWritesController.prototype, "removeByGroup", null);
|
|
282
|
+
tslib_1.__decorate([
|
|
283
|
+
(0, common_1.Patch)(':typeName/:id'),
|
|
284
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_UPDATE),
|
|
285
|
+
(0, swagger_1.ApiOperation)({
|
|
286
|
+
summary: 'Update an entry',
|
|
287
|
+
description: 'A **partial** update: the `values` you send are merged over the stored ones, so omitting a field leaves it alone and sending `null` clears it. (The admin’s own PATCH replaces the whole bag — the editor always submits the full document — but an API client sends the two fields it changed, and silently nulling the rest would be invisible until a later publish failed.) `relations` deltas apply in the same transaction. On a publishable type a published entry moves back to **draft** while its published version stays live, so an edit never silently changes what the world is reading — publish again to ship it. 404 when no such entry exists in this workspace.'
|
|
288
|
+
}),
|
|
289
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
290
|
+
tslib_1.__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
291
|
+
tslib_1.__param(2, (0, common_1.Body)()),
|
|
292
|
+
tslib_1.__param(3, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
293
|
+
tslib_1.__metadata("design:type", Function),
|
|
294
|
+
tslib_1.__metadata("design:paramtypes", [String, String, public_save_entry_dto_1.PublicSaveEntryDto, String]),
|
|
295
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
296
|
+
], PublicEntryWritesController.prototype, "update", null);
|
|
297
|
+
tslib_1.__decorate([
|
|
298
|
+
(0, common_1.Post)(':typeName/:id/publish'),
|
|
299
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
300
|
+
(0, swagger_1.ApiOperation)({
|
|
301
|
+
summary: 'Publish an entry',
|
|
302
|
+
description: 'Re-validates the stored row and takes it live. A draft that no longer passes validation is a 422 — `required` means required *to publish*, so an incomplete draft is legal right up until this call. 400 on a type that is not publishable.'
|
|
303
|
+
}),
|
|
304
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
305
|
+
tslib_1.__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
306
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
307
|
+
tslib_1.__metadata("design:type", Function),
|
|
308
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String]),
|
|
309
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
310
|
+
], PublicEntryWritesController.prototype, "publish", null);
|
|
311
|
+
tslib_1.__decorate([
|
|
312
|
+
(0, common_1.Post)(':typeName/:id/unpublish'),
|
|
313
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_PUBLISH),
|
|
314
|
+
(0, swagger_1.ApiOperation)({
|
|
315
|
+
summary: 'Unpublish an entry',
|
|
316
|
+
description: 'Reverts the entry to a draft. It leaves the published reads immediately; a write-scoped token can still see it with `?status=draft`.'
|
|
317
|
+
}),
|
|
318
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
319
|
+
tslib_1.__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
320
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
321
|
+
tslib_1.__metadata("design:type", Function),
|
|
322
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String]),
|
|
323
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
324
|
+
], PublicEntryWritesController.prototype, "unpublish", null);
|
|
325
|
+
tslib_1.__decorate([
|
|
326
|
+
(0, common_1.Delete)(':typeName/:id'),
|
|
327
|
+
(0, identity_server_1.RequirePermissions)(identity_server_1.PERMISSIONS.CONTENT_DELETE),
|
|
328
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
329
|
+
(0, swagger_1.ApiOperation)({
|
|
330
|
+
summary: 'Delete an entry',
|
|
331
|
+
description: 'Soft-deletes on a `paranoid` type (recoverable from the admin’s trash, invisible here either way) and hard-deletes otherwise. Deletes exactly this row: on a localized type the other translations of the group stay live.'
|
|
332
|
+
}),
|
|
333
|
+
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
334
|
+
tslib_1.__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
335
|
+
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
336
|
+
tslib_1.__metadata("design:type", Function),
|
|
337
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String]),
|
|
338
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
339
|
+
], PublicEntryWritesController.prototype, "remove", null);
|
|
340
|
+
exports.PublicEntryWritesController = PublicEntryWritesController = tslib_1.__decorate([
|
|
341
|
+
(0, identity_server_1.Public)(),
|
|
342
|
+
(0, common_1.UseGuards)(api_token_guard_1.ApiTokenGuard, api_token_workspace_guard_1.ApiTokenWorkspaceGuard),
|
|
343
|
+
(0, swagger_1.ApiSecurity)('apiToken'),
|
|
344
|
+
(0, swagger_1.ApiHeader)({
|
|
345
|
+
name: 'X-Workspace-Id',
|
|
346
|
+
required: false,
|
|
347
|
+
description: "The workspace to write in. Required when the token covers more than one workspace; optional when it covers exactly one. A workspace outside the token's bucket is a 403."
|
|
348
|
+
}),
|
|
349
|
+
(0, common_1.Controller)('v1/content'),
|
|
350
|
+
tslib_1.__param(0, (0, content_tokens_1.InjectContentRegistry)()),
|
|
351
|
+
tslib_1.__metadata("design:paramtypes", [Function, workspace_grants_query_1.WorkspaceGrantsQuery,
|
|
352
|
+
public_entry_writes_service_1.PublicEntryWritesService])
|
|
353
|
+
], PublicEntryWritesController);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ContentTypeRegistry } from '../../../registry/content-type-registry';
|
|
2
|
+
import type { AnyContentType } from '../../../types/content-type';
|
|
3
|
+
/**
|
|
4
|
+
* Where this resolver reads a workspace's content grants from.
|
|
5
|
+
*
|
|
6
|
+
* A structural port rather than `WorkspaceGrantsQuery` itself, so a caller that
|
|
7
|
+
* has **already** read the grant set for the current request can supply it
|
|
8
|
+
* instead of provoking one query per resolved type. `WorkspaceGrantsQuery`
|
|
9
|
+
* satisfies it as-is; the GraphQL endpoint passes a cache over it, because a
|
|
10
|
+
* single document resolves many types and they must all see one consistent
|
|
11
|
+
* grant set anyway.
|
|
12
|
+
*/
|
|
13
|
+
export interface ContentGrantsSource {
|
|
14
|
+
/** Every content slug granted to `workspaceId`. */
|
|
15
|
+
grantedSlugs(workspaceId: string): Promise<ReadonlySet<string>>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A resolved type plus the workspace's full grant set. The grants are returned
|
|
19
|
+
* alongside because the filter surface needs them to prune relation traversals
|
|
20
|
+
* into ungranted types — reading them once per request rather than twice.
|
|
21
|
+
*/
|
|
22
|
+
export interface GrantedType {
|
|
23
|
+
/** The registered, granted content type the route targets. */
|
|
24
|
+
type: AnyContentType;
|
|
25
|
+
/** Every content slug the workspace was granted. */
|
|
26
|
+
granted: ReadonlySet<string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a `:typeName` for a public-API request: it must be a registered
|
|
30
|
+
* content type **and** one the target workspace has been granted
|
|
31
|
+
* (`workspace_content`). Anything else — unknown name, or a real type this
|
|
32
|
+
* workspace was never granted — is the same 404, so a token can't enumerate
|
|
33
|
+
* the content model beyond what its workspace actually exposes.
|
|
34
|
+
*
|
|
35
|
+
* Grants are enforced here even though the admin's own entries list doesn't
|
|
36
|
+
* check them: the admin caller is a member of the workspace looking at its own
|
|
37
|
+
* CMS, while a token is an external credential, and the grant set is exactly
|
|
38
|
+
* the workspace's declared content surface. `GET /api/v1/content-types` lists
|
|
39
|
+
* that same set, so a consumer never has to guess which names will 404.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveGrantedType(registry: ContentTypeRegistry, grants: ContentGrantsSource, typeName: string, workspaceId: string): Promise<GrantedType>;
|
|
42
|
+
//# sourceMappingURL=resolve-granted-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-granted-type.d.ts","sourceRoot":"","sources":["../../../../../src/lib/public-api/http/controllers/resolve-granted-type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAChC,mDAAmD;IACnD,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;CACnE;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,8DAA8D;IAC9D,IAAI,EAAE,cAAc,CAAC;IACrB,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACpC,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,CAAC,CAOtB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveGrantedType = resolveGrantedType;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a `:typeName` for a public-API request: it must be a registered
|
|
7
|
+
* content type **and** one the target workspace has been granted
|
|
8
|
+
* (`workspace_content`). Anything else — unknown name, or a real type this
|
|
9
|
+
* workspace was never granted — is the same 404, so a token can't enumerate
|
|
10
|
+
* the content model beyond what its workspace actually exposes.
|
|
11
|
+
*
|
|
12
|
+
* Grants are enforced here even though the admin's own entries list doesn't
|
|
13
|
+
* check them: the admin caller is a member of the workspace looking at its own
|
|
14
|
+
* CMS, while a token is an external credential, and the grant set is exactly
|
|
15
|
+
* the workspace's declared content surface. `GET /api/v1/content-types` lists
|
|
16
|
+
* that same set, so a consumer never has to guess which names will 404.
|
|
17
|
+
*/
|
|
18
|
+
async function resolveGrantedType(registry, grants, typeName, workspaceId) {
|
|
19
|
+
const type = registry.get(typeName);
|
|
20
|
+
const granted = await grants.grantedSlugs(workspaceId);
|
|
21
|
+
if (!type || !granted.has(typeName)) {
|
|
22
|
+
throw new common_1.NotFoundException(`Unknown content type "${typeName}".`);
|
|
23
|
+
}
|
|
24
|
+
return { type, granted };
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter decorator returning the {@link PublicApiToken} that
|
|
3
|
+
* {@link ApiTokenGuard} verified and attached. Use it only on routes carrying
|
|
4
|
+
* that guard — without it the request carries no token, so this throws rather
|
|
5
|
+
* than handing a handler an `undefined` caller identity.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CurrentApiToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
8
|
+
//# sourceMappingURL=current-api-token.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-api-token.decorator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/public-api/http/decorators/current-api-token.decorator.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,mDAU3B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrentApiToken = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
/**
|
|
6
|
+
* Parameter decorator returning the {@link PublicApiToken} that
|
|
7
|
+
* {@link ApiTokenGuard} verified and attached. Use it only on routes carrying
|
|
8
|
+
* that guard — without it the request carries no token, so this throws rather
|
|
9
|
+
* than handing a handler an `undefined` caller identity.
|
|
10
|
+
*/
|
|
11
|
+
exports.CurrentApiToken = (0, common_1.createParamDecorator)((_data, context) => {
|
|
12
|
+
const request = context.switchToHttp().getRequest();
|
|
13
|
+
if (!request.apiToken) {
|
|
14
|
+
throw new common_1.InternalServerErrorException('@CurrentApiToken() used on a route without ApiTokenGuard.');
|
|
15
|
+
}
|
|
16
|
+
return request.apiToken;
|
|
17
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type BulkSaveOp } from '../../types/public-bulk';
|
|
2
|
+
import { PublicSaveEntryDto } from './public-save-entry.dto';
|
|
3
|
+
/**
|
|
4
|
+
* One entry in a bulk save — a {@link PublicSaveEntryDto} plus the addressing a
|
|
5
|
+
* single-entry write takes from its URL.
|
|
6
|
+
*
|
|
7
|
+
* **It extends the single-entry body rather than restating it**, so `values`,
|
|
8
|
+
* `relations`, `locale` and `localeGroupId` mean exactly what they mean on
|
|
9
|
+
* `POST`/`PATCH` and cannot drift from them — including the delta caps, which a
|
|
10
|
+
* hand-rolled item schema would have quietly dropped.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PublicBulkSaveItemDto extends PublicSaveEntryDto {
|
|
13
|
+
/**
|
|
14
|
+
* The entry to update — the `:id` of the single-entry `PATCH`. Absent on a
|
|
15
|
+
* create.
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* What this item does, when the addressing alone does not say.
|
|
20
|
+
*
|
|
21
|
+
* Only ever **required** for the one genuinely ambiguous shape: a
|
|
22
|
+
* `localeGroupId` with no `id`, which is either "create this record's row in
|
|
23
|
+
* another language" or "update the row this group already has in `locale`".
|
|
24
|
+
* Every other item infers it (see `resolveBulkSaveOp`), because making a
|
|
25
|
+
* plain list of new entries carry `op: "create"` on every element is noise
|
|
26
|
+
* for a rule that has exactly one exception.
|
|
27
|
+
*/
|
|
28
|
+
op?: BulkSaveOp;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Body of `POST /v1/content/:typeName/bulk` — the entries to save.
|
|
32
|
+
*
|
|
33
|
+
* Capped at {@link BULK_MAX_SAVE_ITEMS}, which is deliberately lower than the
|
|
34
|
+
* id-only bulk actions' cap: every item here carries a whole document and
|
|
35
|
+
* provokes its own write transaction.
|
|
36
|
+
*/
|
|
37
|
+
export declare class PublicBulkSaveDto {
|
|
38
|
+
/** The entries to create and/or update, in the order they should be tried. */
|
|
39
|
+
items: PublicBulkSaveItemDto[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Body of the public bulk **actions** — `bulk/publish`, `bulk/unpublish`,
|
|
43
|
+
* `bulk/delete`: the entry ids to act on.
|
|
44
|
+
*
|
|
45
|
+
* `{ ids }` rather than the save endpoint's `{ items }`, because these carry no
|
|
46
|
+
* document — and because it is the shape the admin's bulk routes have always
|
|
47
|
+
* taken, so a consumer moving between the two surfaces learns one body, not
|
|
48
|
+
* two. Capped at {@link BULK_MAX_IDS}, the same bound those routes apply.
|
|
49
|
+
*
|
|
50
|
+
* Entry **ids**, not translation groups: a group names a record across
|
|
51
|
+
* languages, and publishing "the record" would mean publishing translations the
|
|
52
|
+
* caller never listed. Address the rows themselves, one locale at a time.
|
|
53
|
+
*/
|
|
54
|
+
export declare class PublicBulkIdsDto {
|
|
55
|
+
/** Entry ids to act on. */
|
|
56
|
+
ids: string[];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=public-bulk.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-bulk.dto.d.ts","sourceRoot":"","sources":["../../../../../src/lib/public-api/http/dto/public-bulk.dto.ts"],"names":[],"mappings":"AAeA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,kBAAkB;IACzD;;;OAGG;IASH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;;;;;OASG;IAQH,EAAE,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAC1B,8EAA8E;IAY9E,KAAK,EAAG,qBAAqB,EAAE,CAAC;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IACzB,2BAA2B;IAa3B,GAAG,EAAG,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicBulkIdsDto = exports.PublicBulkSaveDto = exports.PublicBulkSaveItemDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
const entries_constants_1 = require("../../../entries/entries.constants");
|
|
9
|
+
const public_bulk_1 = require("../../types/public-bulk");
|
|
10
|
+
const public_save_entry_dto_1 = require("./public-save-entry.dto");
|
|
11
|
+
/** The two operations a bulk-save item may name explicitly. */
|
|
12
|
+
const BULK_SAVE_OPS = Object.values(public_bulk_1.BULK_SAVE_OP);
|
|
13
|
+
/**
|
|
14
|
+
* One entry in a bulk save — a {@link PublicSaveEntryDto} plus the addressing a
|
|
15
|
+
* single-entry write takes from its URL.
|
|
16
|
+
*
|
|
17
|
+
* **It extends the single-entry body rather than restating it**, so `values`,
|
|
18
|
+
* `relations`, `locale` and `localeGroupId` mean exactly what they mean on
|
|
19
|
+
* `POST`/`PATCH` and cannot drift from them — including the delta caps, which a
|
|
20
|
+
* hand-rolled item schema would have quietly dropped.
|
|
21
|
+
*/
|
|
22
|
+
class PublicBulkSaveItemDto extends public_save_entry_dto_1.PublicSaveEntryDto {
|
|
23
|
+
/**
|
|
24
|
+
* The entry to update — the `:id` of the single-entry `PATCH`. Absent on a
|
|
25
|
+
* create.
|
|
26
|
+
*/
|
|
27
|
+
id;
|
|
28
|
+
/**
|
|
29
|
+
* What this item does, when the addressing alone does not say.
|
|
30
|
+
*
|
|
31
|
+
* Only ever **required** for the one genuinely ambiguous shape: a
|
|
32
|
+
* `localeGroupId` with no `id`, which is either "create this record's row in
|
|
33
|
+
* another language" or "update the row this group already has in `locale`".
|
|
34
|
+
* Every other item infers it (see `resolveBulkSaveOp`), because making a
|
|
35
|
+
* plain list of new entries carry `op: "create"` on every element is noise
|
|
36
|
+
* for a rule that has exactly one exception.
|
|
37
|
+
*/
|
|
38
|
+
op;
|
|
39
|
+
}
|
|
40
|
+
exports.PublicBulkSaveItemDto = PublicBulkSaveItemDto;
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
43
|
+
type: String,
|
|
44
|
+
format: 'uuid',
|
|
45
|
+
description: 'The entry to update — what you would put in the `PATCH` path. Absent means this item creates an entry.'
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
(0, class_validator_1.IsUUID)(),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], PublicBulkSaveItemDto.prototype, "id", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
53
|
+
enum: BULK_SAVE_OPS,
|
|
54
|
+
description: 'What this item does. Inferred when the item is unambiguous — an `id` means update, neither `id` nor `localeGroupId` means create — and **required** when only `localeGroupId` is given, which could be either creating that record’s row in a new locale or updating the row it already has there.'
|
|
55
|
+
}),
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
(0, class_validator_1.IsIn)(BULK_SAVE_OPS),
|
|
58
|
+
tslib_1.__metadata("design:type", String)
|
|
59
|
+
], PublicBulkSaveItemDto.prototype, "op", void 0);
|
|
60
|
+
/**
|
|
61
|
+
* Body of `POST /v1/content/:typeName/bulk` — the entries to save.
|
|
62
|
+
*
|
|
63
|
+
* Capped at {@link BULK_MAX_SAVE_ITEMS}, which is deliberately lower than the
|
|
64
|
+
* id-only bulk actions' cap: every item here carries a whole document and
|
|
65
|
+
* provokes its own write transaction.
|
|
66
|
+
*/
|
|
67
|
+
class PublicBulkSaveDto {
|
|
68
|
+
/** The entries to create and/or update, in the order they should be tried. */
|
|
69
|
+
items;
|
|
70
|
+
}
|
|
71
|
+
exports.PublicBulkSaveDto = PublicBulkSaveDto;
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, swagger_1.ApiProperty)({
|
|
74
|
+
type: [PublicBulkSaveItemDto],
|
|
75
|
+
minItems: 1,
|
|
76
|
+
maxItems: entries_constants_1.BULK_MAX_SAVE_ITEMS,
|
|
77
|
+
description: `The entries to save, applied in order and reported back positionally. Non-empty and capped at ${entries_constants_1.BULK_MAX_SAVE_ITEMS} — each item is a full document and its own write, so the cap bounds both the body and the work one request can start.`
|
|
78
|
+
}),
|
|
79
|
+
(0, class_validator_1.IsArray)(),
|
|
80
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
81
|
+
(0, class_validator_1.ArrayMaxSize)(entries_constants_1.BULK_MAX_SAVE_ITEMS),
|
|
82
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
83
|
+
(0, class_transformer_1.Type)(() => PublicBulkSaveItemDto),
|
|
84
|
+
tslib_1.__metadata("design:type", Array)
|
|
85
|
+
], PublicBulkSaveDto.prototype, "items", void 0);
|
|
86
|
+
/**
|
|
87
|
+
* Body of the public bulk **actions** — `bulk/publish`, `bulk/unpublish`,
|
|
88
|
+
* `bulk/delete`: the entry ids to act on.
|
|
89
|
+
*
|
|
90
|
+
* `{ ids }` rather than the save endpoint's `{ items }`, because these carry no
|
|
91
|
+
* document — and because it is the shape the admin's bulk routes have always
|
|
92
|
+
* taken, so a consumer moving between the two surfaces learns one body, not
|
|
93
|
+
* two. Capped at {@link BULK_MAX_IDS}, the same bound those routes apply.
|
|
94
|
+
*
|
|
95
|
+
* Entry **ids**, not translation groups: a group names a record across
|
|
96
|
+
* languages, and publishing "the record" would mean publishing translations the
|
|
97
|
+
* caller never listed. Address the rows themselves, one locale at a time.
|
|
98
|
+
*/
|
|
99
|
+
class PublicBulkIdsDto {
|
|
100
|
+
/** Entry ids to act on. */
|
|
101
|
+
ids;
|
|
102
|
+
}
|
|
103
|
+
exports.PublicBulkIdsDto = PublicBulkIdsDto;
|
|
104
|
+
tslib_1.__decorate([
|
|
105
|
+
(0, swagger_1.ApiProperty)({
|
|
106
|
+
type: [String],
|
|
107
|
+
format: 'uuid',
|
|
108
|
+
minItems: 1,
|
|
109
|
+
maxItems: entries_constants_1.BULK_MAX_IDS,
|
|
110
|
+
example: ['3f1a7c1e-9d2b-4a6f-8c11-5b8e2f0d7a91'],
|
|
111
|
+
description: `Entry ids to act on — non-empty and capped at ${entries_constants_1.BULK_MAX_IDS}. Ids outside this workspace simply do not match; nothing distinguishes them from ids that never existed.`
|
|
112
|
+
}),
|
|
113
|
+
(0, class_validator_1.IsArray)(),
|
|
114
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
115
|
+
(0, class_validator_1.ArrayMaxSize)(entries_constants_1.BULK_MAX_IDS),
|
|
116
|
+
(0, class_validator_1.IsUUID)('4', { each: true }),
|
|
117
|
+
tslib_1.__metadata("design:type", Array)
|
|
118
|
+
], PublicBulkIdsDto.prototype, "ids", void 0);
|