@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,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentToolProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const identity_server_1 = require("@orthacms/identity-server");
|
|
7
|
+
const tools_server_1 = require("@orthacms/tools-server");
|
|
8
|
+
const content_tokens_1 = require("../content.tokens");
|
|
9
|
+
const workspace_grants_query_1 = require("../content-types/queries/workspace-grants.query");
|
|
10
|
+
const resolve_granted_type_1 = require("../public-api/http/controllers/resolve-granted-type");
|
|
11
|
+
const public_entries_query_1 = require("../public-api/infrastructure/public-entries.query");
|
|
12
|
+
const public_entry_writes_service_1 = require("../public-api/infrastructure/public-entry-writes.service");
|
|
13
|
+
const public_list_entries_query_dto_1 = require("../public-api/http/dto/public-list-entries-query.dto");
|
|
14
|
+
const public_save_entry_dto_1 = require("../public-api/http/dto/public-save-entry.dto");
|
|
15
|
+
const public_bulk_dto_1 = require("../public-api/http/dto/public-bulk.dto");
|
|
16
|
+
const relation_link_service_1 = require("../entries/infrastructure/persistence/relation-link.service");
|
|
17
|
+
const field_schema_1 = require("../docs/field-schema");
|
|
18
|
+
const tool_input_1 = require("./tool-input");
|
|
19
|
+
const tool_schemas_1 = require("./tool-schemas");
|
|
20
|
+
/** URI prefix for the per-content-type schema resources. */
|
|
21
|
+
const TYPE_RESOURCE_PREFIX = 'ortha://content-type/';
|
|
22
|
+
/**
|
|
23
|
+
* The content plugin's contribution to the shared agent tool registry — the
|
|
24
|
+
* same CRUD the public HTTP API serves, reachable by an MCP client or the
|
|
25
|
+
* copilot's tool loop.
|
|
26
|
+
*
|
|
27
|
+
* **Every handler delegates to the objects the HTTP controllers call**:
|
|
28
|
+
* `resolveGrantedType` for the grant gate, `PublicEntriesQuery` for reads,
|
|
29
|
+
* `PublicEntryWritesService` for writes. That is the whole design. The rules
|
|
30
|
+
* that make the public API safe — published-only by default, soft-deleted rows
|
|
31
|
+
* invisible, an ungranted type indistinguishable from an unknown one, relations
|
|
32
|
+
* that may not cross locales, validation at publish time, revision numbering
|
|
33
|
+
* under an advisory lock, the outbox — are not restated here and therefore
|
|
34
|
+
* cannot drift from the HTTP surface. This class contributes the tool
|
|
35
|
+
* descriptions, argument validation, and the mapping from arguments to those
|
|
36
|
+
* calls, and nothing else.
|
|
37
|
+
*
|
|
38
|
+
* **Authorization is declared, not implemented.** Each tool names the
|
|
39
|
+
* permissions it needs in `requires`, and `ToolRegistry.call` enforces them
|
|
40
|
+
* before dispatch — the analogue of `@RequirePermissions(...)` on a route. A
|
|
41
|
+
* `read`-scoped token cannot reach a write tool, and no handler below contains
|
|
42
|
+
* a line of code saying so. The one authorization decision a handler *does*
|
|
43
|
+
* make is the draft-visibility widening, because it is a rule about an argument
|
|
44
|
+
* rather than about the operation.
|
|
45
|
+
*
|
|
46
|
+
* Registration is `@Optional()`: MCP is a plugin, so a deployment that omits it
|
|
47
|
+
* must still boot. The tools simply go unregistered.
|
|
48
|
+
*/
|
|
49
|
+
let ContentToolProvider = class ContentToolProvider {
|
|
50
|
+
registry;
|
|
51
|
+
grants;
|
|
52
|
+
entries;
|
|
53
|
+
writes;
|
|
54
|
+
toolRegistry;
|
|
55
|
+
constructor(registry, grants, entries, writes, toolRegistry) {
|
|
56
|
+
this.registry = registry;
|
|
57
|
+
this.grants = grants;
|
|
58
|
+
this.entries = entries;
|
|
59
|
+
this.writes = writes;
|
|
60
|
+
this.toolRegistry = toolRegistry;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Register with the tool registry once the DI graph is built. A call rather
|
|
64
|
+
* than a DI binding because Nest has no multi-provider token — see
|
|
65
|
+
* `ToolProvider`.
|
|
66
|
+
*/
|
|
67
|
+
onModuleInit() {
|
|
68
|
+
this.toolRegistry?.register(this);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The sixteen content tools. @see ToolProvider.tools
|
|
72
|
+
*
|
|
73
|
+
* Every one is stamped `surfaces: ['mcp']` below rather than tool by tool:
|
|
74
|
+
* they are uniformly the **public-API** set — published-only reads through
|
|
75
|
+
* `PublicEntriesQuery`, writes through `PublicEntryWritesService` attributed
|
|
76
|
+
* to a token. The copilot's content tools are the admin-scoped counterpart
|
|
77
|
+
* (a viewer must see drafts; a write records the accepting human), so the
|
|
78
|
+
* two sets share the registry and not each other's callers.
|
|
79
|
+
*/
|
|
80
|
+
tools() {
|
|
81
|
+
return this.mcpTools().map((tool) => ({
|
|
82
|
+
...tool,
|
|
83
|
+
surfaces: ['mcp']
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
/** The tool definitions themselves, before the surface stamp. */
|
|
87
|
+
mcpTools() {
|
|
88
|
+
return [
|
|
89
|
+
// ---- discovery ------------------------------------------------
|
|
90
|
+
// A model cannot type a `values` bag it has not seen, so discovery
|
|
91
|
+
// is the entry point of every authoring conversation, not a
|
|
92
|
+
// nicety. These two are why the write tools can take an open
|
|
93
|
+
// object and still be usable.
|
|
94
|
+
{
|
|
95
|
+
name: 'content_types_list',
|
|
96
|
+
title: 'List content types',
|
|
97
|
+
description: 'List the content types available in this workspace: machine name, label, kind (collection or single), and whether each is publishable, localized, or soft-deleting. Start here — the names it returns are exactly the ones the other tools accept.',
|
|
98
|
+
inputSchema: tool_schemas_1.LIST_TYPES_SCHEMA,
|
|
99
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
100
|
+
readOnly: true,
|
|
101
|
+
handler: async (_input, context) => ({
|
|
102
|
+
items: await this.grantedSummaries(context)
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'content_type_get',
|
|
107
|
+
title: 'Get a content type’s schema',
|
|
108
|
+
description: 'The full field schema of one content type — every field with its type, validation rules and options, as JSON Schema. Call this before `content_create` or `content_update` so the `values` you send match the type.',
|
|
109
|
+
inputSchema: tool_schemas_1.GET_TYPE_SCHEMA,
|
|
110
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
111
|
+
readOnly: true,
|
|
112
|
+
handler: async (input, context) => {
|
|
113
|
+
const typeName = (0, tool_input_1.requireTypeName)(input);
|
|
114
|
+
await this.resolve(typeName, context);
|
|
115
|
+
return this.describeType(typeName);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
// ---- reads ----------------------------------------------------
|
|
119
|
+
{
|
|
120
|
+
name: 'content_list',
|
|
121
|
+
title: 'List entries',
|
|
122
|
+
description: 'One page of a content type’s entries — published only unless you pass `status`. Supports free-text `search`, a structured `filter`, `sort`, and paging. Serves single/page types too: take `items[0]`. Prefer naming `fields` to keep the result small.',
|
|
123
|
+
inputSchema: tool_schemas_1.LIST_ENTRIES_SCHEMA,
|
|
124
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
125
|
+
readOnly: true,
|
|
126
|
+
handler: async (input, context) => {
|
|
127
|
+
(0, tool_input_1.assertDraftVisibility)(input, context);
|
|
128
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
129
|
+
const query = await (0, tool_input_1.validateToolInput)(public_list_entries_query_dto_1.PublicListEntriesQueryDto, input);
|
|
130
|
+
return this.entries.list(type, query, context.workspaceId, granted);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'content_get',
|
|
135
|
+
title: 'Get one entry',
|
|
136
|
+
description: 'Read a single entry by `id`, or by `localeGroupId` plus `locale`. Optionally expands relations, media, and sibling translations. A draft, a deleted entry, one in another workspace, and an unknown id all read the same: not found.',
|
|
137
|
+
inputSchema: tool_schemas_1.GET_ENTRY_SCHEMA,
|
|
138
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
139
|
+
readOnly: true,
|
|
140
|
+
handler: async (input, context) => {
|
|
141
|
+
(0, tool_input_1.assertDraftVisibility)(input, context);
|
|
142
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
143
|
+
const query = await (0, tool_input_1.validateToolInput)(public_list_entries_query_dto_1.PublicEntryQueryDto, input);
|
|
144
|
+
return this.entries.getOne(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, query, granted);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'content_relations',
|
|
149
|
+
title: 'Page one relation field',
|
|
150
|
+
description: 'One ordered page of a single relation field’s links — the way past the cap that `content_get`’s relation preview applies. Only published targets are shown or counted.',
|
|
151
|
+
inputSchema: tool_schemas_1.RELATIONS_SCHEMA,
|
|
152
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
153
|
+
readOnly: true,
|
|
154
|
+
handler: async (input, context) => {
|
|
155
|
+
(0, tool_input_1.assertDraftVisibility)(input, context);
|
|
156
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
157
|
+
const query = await (0, tool_input_1.validateToolInput)(public_list_entries_query_dto_1.PublicListEntriesQueryDto, input);
|
|
158
|
+
return this.entries.relationField(type, (0, tool_input_1.requireLocator)(input), requireField(input), query.page ?? 1, query.pageSize ?? relation_link_service_1.RELATION_PAGE_SIZE, context.workspaceId, granted, query.locale, query.status);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'content_media',
|
|
163
|
+
title: 'Get an entry’s media',
|
|
164
|
+
description: 'Every media field of one entry, keyed by field name and resolved to asset metadata (name, kind, MIME type, alt) and URLs.',
|
|
165
|
+
inputSchema: tool_schemas_1.MEDIA_SCHEMA,
|
|
166
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ, identity_server_1.PERMISSIONS.MEDIA_READ],
|
|
167
|
+
readOnly: true,
|
|
168
|
+
handler: async (input, context) => {
|
|
169
|
+
(0, tool_input_1.assertDraftVisibility)(input, context);
|
|
170
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
171
|
+
const query = await (0, tool_input_1.validateToolInput)(public_list_entries_query_dto_1.PublicEntryQueryDto, input);
|
|
172
|
+
return {
|
|
173
|
+
media: await this.entries.mediaOf(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, query.locale, query.mediaLimit, query.status)
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'content_translations',
|
|
179
|
+
title: 'Get an entry’s translations',
|
|
180
|
+
description: 'The entry’s other locale rows — the rest of its translation group, ordered by locale slug. The entry itself is not repeated. An error on a type that is not localized.',
|
|
181
|
+
inputSchema: tool_schemas_1.TRANSLATIONS_SCHEMA,
|
|
182
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_READ],
|
|
183
|
+
readOnly: true,
|
|
184
|
+
handler: async (input, context) => {
|
|
185
|
+
(0, tool_input_1.assertDraftVisibility)(input, context);
|
|
186
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
187
|
+
const query = await (0, tool_input_1.validateToolInput)(public_list_entries_query_dto_1.PublicEntryQueryDto, input);
|
|
188
|
+
return {
|
|
189
|
+
translations: await this.entries.translationsOf(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, query)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
// ---- writes ---------------------------------------------------
|
|
194
|
+
{
|
|
195
|
+
name: 'content_create',
|
|
196
|
+
title: 'Create an entry',
|
|
197
|
+
description: 'Create an entry. On a publishable type it lands as a **draft** — publishing is a separate call (`content_publish`), so every create has a reviewable state. Required fields are required *to publish*, not to create, so a draft may be incomplete. Read it back with `status: "any"`; the published-only default will not find it.',
|
|
198
|
+
inputSchema: tool_schemas_1.CREATE_SCHEMA,
|
|
199
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_CREATE],
|
|
200
|
+
readOnly: false,
|
|
201
|
+
handler: async (input, context) => {
|
|
202
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
203
|
+
const body = await (0, tool_input_1.validateToolInput)(public_save_entry_dto_1.PublicSaveEntryDto, input);
|
|
204
|
+
return this.writes.create(type, body, context.workspaceId, granted);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'content_update',
|
|
209
|
+
title: 'Update an entry',
|
|
210
|
+
description: 'A **partial** update — the `values` you send are merged over the stored ones, so omitting a field leaves it alone and an explicit `null` clears it. You never need to send the whole record. On a publishable type this returns a published entry to draft while its published version stays live; call `content_publish` to ship the change.',
|
|
211
|
+
inputSchema: tool_schemas_1.UPDATE_SCHEMA,
|
|
212
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_UPDATE],
|
|
213
|
+
readOnly: false,
|
|
214
|
+
handler: async (input, context) => {
|
|
215
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
216
|
+
// The save body carries only `values` + `relations`: the
|
|
217
|
+
// addressing locale is a separate argument, exactly as the
|
|
218
|
+
// HTTP route keeps it in the query string. Folding them
|
|
219
|
+
// together is how a group-addressed update to the German
|
|
220
|
+
// row silently retargets the English one.
|
|
221
|
+
const body = await (0, tool_input_1.validateToolInput)(public_save_entry_dto_1.PublicSaveEntryDto, {
|
|
222
|
+
values: input['values'],
|
|
223
|
+
...(input['relations'] === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { relations: input['relations'] })
|
|
226
|
+
});
|
|
227
|
+
return this.writes.update(type, (0, tool_input_1.requireLocator)(input), body, context.workspaceId, granted, localeArg(input));
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'content_publish',
|
|
232
|
+
title: 'Publish an entry',
|
|
233
|
+
description: 'Re-validate the stored entry and take it live. A draft that does not pass the type’s validation rules fails here with the offending fields named — that is the moment `required` bites.',
|
|
234
|
+
inputSchema: tool_schemas_1.ENTRY_ACTION_SCHEMA,
|
|
235
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_PUBLISH],
|
|
236
|
+
readOnly: false,
|
|
237
|
+
handler: async (input, context) => {
|
|
238
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
239
|
+
return this.writes.publish(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, granted, localeArg(input));
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'content_unpublish',
|
|
244
|
+
title: 'Unpublish an entry',
|
|
245
|
+
description: 'Revert an entry to a draft. It leaves the published reads immediately; a write-scoped caller can still see it with `status: "draft"`.',
|
|
246
|
+
inputSchema: tool_schemas_1.ENTRY_ACTION_SCHEMA,
|
|
247
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_PUBLISH],
|
|
248
|
+
readOnly: false,
|
|
249
|
+
handler: async (input, context) => {
|
|
250
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
251
|
+
return this.writes.unpublish(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, granted, localeArg(input));
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'content_delete',
|
|
256
|
+
title: 'Delete an entry',
|
|
257
|
+
description: 'Remove an entry — recoverable from the admin’s trash on a soft-deleting type, permanent otherwise. Deletes exactly one row: on a localized type the other translations stay live.',
|
|
258
|
+
inputSchema: tool_schemas_1.ENTRY_ACTION_SCHEMA,
|
|
259
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_DELETE],
|
|
260
|
+
readOnly: false,
|
|
261
|
+
destructive: true,
|
|
262
|
+
handler: async (input, context) => {
|
|
263
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
264
|
+
await this.writes.remove(type, (0, tool_input_1.requireLocator)(input), context.workspaceId, localeArg(input));
|
|
265
|
+
return { deleted: true };
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
// ---- batches ---------------------------------------------------
|
|
269
|
+
//
|
|
270
|
+
// The single-entry writes above stay exactly as they are; these are
|
|
271
|
+
// for the case a model has a *list*. Without them, "publish these
|
|
272
|
+
// twelve drafts" is twelve tool calls — twelve round trips through
|
|
273
|
+
// the model, each spending context on a result nobody reads, and on
|
|
274
|
+
// the copilot's side twelve steps against a bounded run. Each one
|
|
275
|
+
// runs the same use-case its single-entry sibling does.
|
|
276
|
+
{
|
|
277
|
+
name: 'content_bulk_save',
|
|
278
|
+
title: 'Save many entries',
|
|
279
|
+
description: 'Create and/or update many entries of one type in a single call. An item with an `id` updates that entry (a **partial** update, exactly like `content_update`); an item without one creates a draft. Always succeeds as a call: each item gets its own verdict in the same position, and a failure carries the reason that item would have failed with on its own — so read `failed` and the per-item `error`, and do not report the batch as saved without checking them.',
|
|
280
|
+
inputSchema: tool_schemas_1.BULK_SAVE_SCHEMA,
|
|
281
|
+
requires: [
|
|
282
|
+
identity_server_1.PERMISSIONS.CONTENT_CREATE,
|
|
283
|
+
identity_server_1.PERMISSIONS.CONTENT_UPDATE
|
|
284
|
+
],
|
|
285
|
+
readOnly: false,
|
|
286
|
+
handler: async (input, context) => {
|
|
287
|
+
const { type, granted } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
288
|
+
const body = await (0, tool_input_1.validateToolInput)(public_bulk_dto_1.PublicBulkSaveDto, {
|
|
289
|
+
items: input['items']
|
|
290
|
+
});
|
|
291
|
+
return this.writes.bulkSave(type, body.items, context.workspaceId, granted);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'content_bulk_publish',
|
|
296
|
+
title: 'Publish many entries',
|
|
297
|
+
description: 'Re-validate and publish many drafts at once. Publishes the ones that pass and reports the rest in `skipped` with why — `already-published`, `blocked` (it fails the type’s validation rules), or `not-found`. A partly-skipped batch is the normal outcome, so say what actually went live rather than assuming all of it did.',
|
|
298
|
+
inputSchema: tool_schemas_1.BULK_IDS_SCHEMA,
|
|
299
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_PUBLISH],
|
|
300
|
+
readOnly: false,
|
|
301
|
+
handler: async (input, context) => {
|
|
302
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
303
|
+
const body = await (0, tool_input_1.validateToolInput)(public_bulk_dto_1.PublicBulkIdsDto, {
|
|
304
|
+
ids: input['ids']
|
|
305
|
+
});
|
|
306
|
+
return this.writes.bulkPublish(type, body.ids, context.workspaceId);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'content_bulk_unpublish',
|
|
311
|
+
title: 'Unpublish many entries',
|
|
312
|
+
description: 'Revert many entries to drafts. `count` is how many actually changed — an id that was not a live published entry here changes nothing and is not counted.',
|
|
313
|
+
inputSchema: tool_schemas_1.BULK_IDS_SCHEMA,
|
|
314
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_PUBLISH],
|
|
315
|
+
readOnly: false,
|
|
316
|
+
handler: async (input, context) => {
|
|
317
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
318
|
+
const body = await (0, tool_input_1.validateToolInput)(public_bulk_dto_1.PublicBulkIdsDto, {
|
|
319
|
+
ids: input['ids']
|
|
320
|
+
});
|
|
321
|
+
return this.writes.bulkUnpublish(type, body.ids, context.workspaceId);
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: 'content_bulk_delete',
|
|
326
|
+
title: 'Delete many entries',
|
|
327
|
+
description: 'Remove many entries — recoverable from the admin’s trash on a soft-deleting type, permanent otherwise. Deletes exactly the listed rows: on a localized type the other translations stay live. `count` is how many were removed.',
|
|
328
|
+
inputSchema: tool_schemas_1.BULK_IDS_SCHEMA,
|
|
329
|
+
requires: [identity_server_1.PERMISSIONS.CONTENT_DELETE],
|
|
330
|
+
readOnly: false,
|
|
331
|
+
destructive: true,
|
|
332
|
+
handler: async (input, context) => {
|
|
333
|
+
const { type } = await this.resolve((0, tool_input_1.requireTypeName)(input), context);
|
|
334
|
+
const body = await (0, tool_input_1.validateToolInput)(public_bulk_dto_1.PublicBulkIdsDto, {
|
|
335
|
+
ids: input['ids']
|
|
336
|
+
});
|
|
337
|
+
return this.writes.bulkRemove(type, body.ids, context.workspaceId);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
];
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Each readable content type as a resource, so a client that supports them
|
|
344
|
+
* can pull a schema into context without spending a tool call. Pruned to
|
|
345
|
+
* the workspace's grants, exactly like `content_types_list`.
|
|
346
|
+
*/
|
|
347
|
+
async resources(context) {
|
|
348
|
+
const summaries = await this.grantedSummaries(context);
|
|
349
|
+
return summaries.map((summary) => ({
|
|
350
|
+
uri: `${TYPE_RESOURCE_PREFIX}${summary.name}`,
|
|
351
|
+
name: `${summary.label} schema`,
|
|
352
|
+
description: `Field schema of the \`${summary.name}\` content type.`,
|
|
353
|
+
mimeType: 'application/json'
|
|
354
|
+
}));
|
|
355
|
+
}
|
|
356
|
+
/** @see ToolProvider.readResource */
|
|
357
|
+
async readResource(uri, context) {
|
|
358
|
+
if (!uri.startsWith(TYPE_RESOURCE_PREFIX)) {
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
const typeName = uri.slice(TYPE_RESOURCE_PREFIX.length);
|
|
362
|
+
// Through the same grant gate as the tools, so an ungranted type is a
|
|
363
|
+
// 404 here exactly as it is there — a resource read must not be a way
|
|
364
|
+
// around the gate that guards the equivalent tool call.
|
|
365
|
+
await this.resolve(typeName, context);
|
|
366
|
+
return {
|
|
367
|
+
uri,
|
|
368
|
+
mimeType: 'application/json',
|
|
369
|
+
text: JSON.stringify(this.describeType(typeName), null, 2)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/** The workspace's granted type summaries. */
|
|
373
|
+
async grantedSummaries(context) {
|
|
374
|
+
const granted = await this.grants.grantedSlugs(context.workspaceId);
|
|
375
|
+
return this.registry
|
|
376
|
+
.summaries()
|
|
377
|
+
.filter((summary) => granted.has(summary.name));
|
|
378
|
+
}
|
|
379
|
+
/** Resolve a type through the shared registry + grant gate. */
|
|
380
|
+
resolve(typeName, context) {
|
|
381
|
+
return (0, resolve_granted_type_1.resolveGrantedType)(this.registry, this.grants, typeName, context.workspaceId);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* One type's serialized schema, plus a JSON Schema for its `values` bag.
|
|
385
|
+
*
|
|
386
|
+
* Both, because they answer different questions: the serialized fields
|
|
387
|
+
* carry the CMS's own vocabulary (which field is a relation, what a select's
|
|
388
|
+
* options are), while the JSON Schema is what a model needs to construct a
|
|
389
|
+
* valid `values` object. `fieldSchema` is the same generator the OpenAPI
|
|
390
|
+
* document uses, so the two descriptions of a type cannot disagree.
|
|
391
|
+
*/
|
|
392
|
+
describeType(typeName) {
|
|
393
|
+
const type = this.registry.serialize(typeName);
|
|
394
|
+
const properties = {};
|
|
395
|
+
for (const field of type.fields.filter(field_schema_1.isValueField)) {
|
|
396
|
+
properties[field.name] = (0, field_schema_1.fieldSchema)(field);
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
...type,
|
|
400
|
+
valuesSchema: {
|
|
401
|
+
type: 'object',
|
|
402
|
+
properties,
|
|
403
|
+
// Required fields are listed only on a type that is always
|
|
404
|
+
// live: on a publishable one they are required *to publish*,
|
|
405
|
+
// and declaring them required here would tell a model it
|
|
406
|
+
// cannot save the incomplete draft it is allowed to save.
|
|
407
|
+
...(type.publishable
|
|
408
|
+
? {}
|
|
409
|
+
: {
|
|
410
|
+
required: type.fields
|
|
411
|
+
.filter((field) => (0, field_schema_1.isValueField)(field) && field.required)
|
|
412
|
+
.map((field) => field.name)
|
|
413
|
+
}),
|
|
414
|
+
additionalProperties: false
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
exports.ContentToolProvider = ContentToolProvider;
|
|
420
|
+
exports.ContentToolProvider = ContentToolProvider = tslib_1.__decorate([
|
|
421
|
+
(0, common_1.Injectable)(),
|
|
422
|
+
tslib_1.__param(0, (0, content_tokens_1.InjectContentRegistry)()),
|
|
423
|
+
tslib_1.__param(4, (0, common_1.Optional)()),
|
|
424
|
+
tslib_1.__metadata("design:paramtypes", [Function, workspace_grants_query_1.WorkspaceGrantsQuery,
|
|
425
|
+
public_entries_query_1.PublicEntriesQuery,
|
|
426
|
+
public_entry_writes_service_1.PublicEntryWritesService,
|
|
427
|
+
tools_server_1.ToolRegistry])
|
|
428
|
+
], ContentToolProvider);
|
|
429
|
+
/** The `field` argument, required by `content_relations`. */
|
|
430
|
+
function requireField(input) {
|
|
431
|
+
const field = input['field'];
|
|
432
|
+
if (typeof field !== 'string' || field.length === 0) {
|
|
433
|
+
throw new common_1.BadRequestException('`field` is required — the relation field to page, e.g. `tags`.');
|
|
434
|
+
}
|
|
435
|
+
return field;
|
|
436
|
+
}
|
|
437
|
+
/** The addressing `locale` argument, when present. */
|
|
438
|
+
function localeArg(input) {
|
|
439
|
+
const locale = input['locale'];
|
|
440
|
+
return typeof locale === 'string' ? locale : undefined;
|
|
441
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ClassConstructor } from 'class-transformer';
|
|
2
|
+
import type { ToolContext } from '@orthacms/tools-server';
|
|
3
|
+
import type { EntryLocator } from '../public-api/infrastructure/public-entries.query';
|
|
4
|
+
/**
|
|
5
|
+
* Validate a tool's arguments through the **same DTO class the HTTP route
|
|
6
|
+
* uses**.
|
|
7
|
+
*
|
|
8
|
+
* The alternative — hand-checking each tool's arguments — would fork the
|
|
9
|
+
* accepted contract the first time a bound moved: `pageSize` would cap at 100
|
|
10
|
+
* on `GET /v1/content/:typeName` and at whatever this file said on
|
|
11
|
+
* `content_list`. Running the real DTO means a rule is written once, in the
|
|
12
|
+
* place that documents it, and both callers get it.
|
|
13
|
+
*
|
|
14
|
+
* The options mirror the host's global `ValidationPipe` exactly
|
|
15
|
+
* (`whitelist` + `forbidNonWhitelisted` + `transform`), so an unknown argument
|
|
16
|
+
* is an error rather than being silently ignored. That matters more for a model
|
|
17
|
+
* than for a developer: a typo'd argument that is quietly dropped produces a
|
|
18
|
+
* plausible-looking wrong answer, which is the failure mode hardest to notice.
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateToolInput<T extends object>(dto: ClassConstructor<T>, raw: Record<string, unknown>): Promise<T>;
|
|
21
|
+
/** The required `typeName` argument. */
|
|
22
|
+
export declare function requireTypeName(raw: Record<string, unknown>): string;
|
|
23
|
+
/**
|
|
24
|
+
* The entry locator: **exactly one** of `id` or `localeGroupId`.
|
|
25
|
+
*
|
|
26
|
+
* Both spellings exist for the same reason they do on the HTTP routes — a
|
|
27
|
+
* localized front-end holds one stable group id per story rather than one id
|
|
28
|
+
* per language — and requiring exactly one keeps a call from silently
|
|
29
|
+
* preferring whichever the implementation happened to check first.
|
|
30
|
+
*/
|
|
31
|
+
export declare function requireLocator(raw: Record<string, unknown>): EntryLocator;
|
|
32
|
+
/**
|
|
33
|
+
* Enforce the draft-visibility rule for a tool call — the job
|
|
34
|
+
* `DraftVisibilityGuard` does for the HTTP routes.
|
|
35
|
+
*
|
|
36
|
+
* Restated here rather than reused because a guard gates a *route*, and every
|
|
37
|
+
* tool arrives through one route. The rule is identical and deliberately so:
|
|
38
|
+
* a read defaults to published-only, and only a caller that could have
|
|
39
|
+
* published the row may widen it. `content:update` is the probe rather than
|
|
40
|
+
* `content:read`, because read is exactly what both scopes hold.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assertDraftVisibility(raw: Record<string, unknown>, context: ToolContext): void;
|
|
43
|
+
//# sourceMappingURL=tool-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-input.d.ts","sourceRoot":"","sources":["../../../src/lib/mcp/tool-input.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAUtF;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EACpD,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAaD,wCAAwC;AACxC,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQpE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAqBzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,OAAO,EAAE,WAAW,GACrB,IAAI,CAiBN"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateToolInput = validateToolInput;
|
|
4
|
+
exports.requireTypeName = requireTypeName;
|
|
5
|
+
exports.requireLocator = requireLocator;
|
|
6
|
+
exports.assertDraftVisibility = assertDraftVisibility;
|
|
7
|
+
const common_1 = require("@nestjs/common");
|
|
8
|
+
const class_transformer_1 = require("class-transformer");
|
|
9
|
+
const class_validator_1 = require("class-validator");
|
|
10
|
+
const identity_server_1 = require("@orthacms/identity-server");
|
|
11
|
+
const public_list_entries_query_dto_1 = require("../public-api/http/dto/public-list-entries-query.dto");
|
|
12
|
+
/**
|
|
13
|
+
* Keys that address *which* record a tool acts on rather than *how*. Stripped
|
|
14
|
+
* before DTO validation, because they are the tool's own parameters and the
|
|
15
|
+
* query DTOs — which describe an HTTP query string — know nothing about them.
|
|
16
|
+
*/
|
|
17
|
+
const LOCATOR_KEYS = ['typeName', 'id', 'localeGroupId', 'field'];
|
|
18
|
+
/**
|
|
19
|
+
* Validate a tool's arguments through the **same DTO class the HTTP route
|
|
20
|
+
* uses**.
|
|
21
|
+
*
|
|
22
|
+
* The alternative — hand-checking each tool's arguments — would fork the
|
|
23
|
+
* accepted contract the first time a bound moved: `pageSize` would cap at 100
|
|
24
|
+
* on `GET /v1/content/:typeName` and at whatever this file said on
|
|
25
|
+
* `content_list`. Running the real DTO means a rule is written once, in the
|
|
26
|
+
* place that documents it, and both callers get it.
|
|
27
|
+
*
|
|
28
|
+
* The options mirror the host's global `ValidationPipe` exactly
|
|
29
|
+
* (`whitelist` + `forbidNonWhitelisted` + `transform`), so an unknown argument
|
|
30
|
+
* is an error rather than being silently ignored. That matters more for a model
|
|
31
|
+
* than for a developer: a typo'd argument that is quietly dropped produces a
|
|
32
|
+
* plausible-looking wrong answer, which is the failure mode hardest to notice.
|
|
33
|
+
*/
|
|
34
|
+
async function validateToolInput(dto, raw) {
|
|
35
|
+
const instance = (0, class_transformer_1.plainToInstance)(dto, withoutLocatorKeys(raw), {
|
|
36
|
+
enableImplicitConversion: false
|
|
37
|
+
});
|
|
38
|
+
const errors = await (0, class_validator_1.validate)(instance, {
|
|
39
|
+
whitelist: true,
|
|
40
|
+
forbidNonWhitelisted: true,
|
|
41
|
+
forbidUnknownValues: true
|
|
42
|
+
});
|
|
43
|
+
if (errors.length > 0) {
|
|
44
|
+
throw new common_1.BadRequestException({
|
|
45
|
+
message: 'Invalid arguments.',
|
|
46
|
+
issues: errors.map((error) => ({
|
|
47
|
+
field: error.property,
|
|
48
|
+
problems: Object.values(error.constraints ?? {})
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return instance;
|
|
53
|
+
}
|
|
54
|
+
/** The argument bag minus the addressing keys. */
|
|
55
|
+
function withoutLocatorKeys(raw) {
|
|
56
|
+
const rest = { ...raw };
|
|
57
|
+
for (const key of LOCATOR_KEYS) {
|
|
58
|
+
delete rest[key];
|
|
59
|
+
}
|
|
60
|
+
return rest;
|
|
61
|
+
}
|
|
62
|
+
/** The required `typeName` argument. */
|
|
63
|
+
function requireTypeName(raw) {
|
|
64
|
+
const typeName = raw['typeName'];
|
|
65
|
+
if (typeof typeName !== 'string' || typeName.length === 0) {
|
|
66
|
+
throw new common_1.BadRequestException('`typeName` is required. Call `content_types_list` to see the readable types.');
|
|
67
|
+
}
|
|
68
|
+
return typeName;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The entry locator: **exactly one** of `id` or `localeGroupId`.
|
|
72
|
+
*
|
|
73
|
+
* Both spellings exist for the same reason they do on the HTTP routes — a
|
|
74
|
+
* localized front-end holds one stable group id per story rather than one id
|
|
75
|
+
* per language — and requiring exactly one keeps a call from silently
|
|
76
|
+
* preferring whichever the implementation happened to check first.
|
|
77
|
+
*/
|
|
78
|
+
function requireLocator(raw) {
|
|
79
|
+
const id = raw['id'];
|
|
80
|
+
const localeGroupId = raw['localeGroupId'];
|
|
81
|
+
const hasId = typeof id === 'string' && id.length > 0;
|
|
82
|
+
const hasGroup = typeof localeGroupId === 'string' && localeGroupId.length > 0;
|
|
83
|
+
if (hasId && hasGroup) {
|
|
84
|
+
throw new common_1.BadRequestException('Pass either `id` or `localeGroupId`, not both — they are two ways of naming the same row.');
|
|
85
|
+
}
|
|
86
|
+
if (hasId) {
|
|
87
|
+
return { id: id };
|
|
88
|
+
}
|
|
89
|
+
if (hasGroup) {
|
|
90
|
+
return { localeGroupId: localeGroupId };
|
|
91
|
+
}
|
|
92
|
+
throw new common_1.BadRequestException('Pass either `id` (one entry) or `localeGroupId` (the entry’s translation group, with `locale`).');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Enforce the draft-visibility rule for a tool call — the job
|
|
96
|
+
* `DraftVisibilityGuard` does for the HTTP routes.
|
|
97
|
+
*
|
|
98
|
+
* Restated here rather than reused because a guard gates a *route*, and every
|
|
99
|
+
* tool arrives through one route. The rule is identical and deliberately so:
|
|
100
|
+
* a read defaults to published-only, and only a caller that could have
|
|
101
|
+
* published the row may widen it. `content:update` is the probe rather than
|
|
102
|
+
* `content:read`, because read is exactly what both scopes hold.
|
|
103
|
+
*/
|
|
104
|
+
function assertDraftVisibility(raw, context) {
|
|
105
|
+
const requested = raw['status'];
|
|
106
|
+
if (typeof requested !== 'string' ||
|
|
107
|
+
requested === 'published' ||
|
|
108
|
+
!public_list_entries_query_dto_1.ENTRY_VISIBILITY.includes(requested)) {
|
|
109
|
+
// Absent, the default, or unrecognised. The last is left alone on
|
|
110
|
+
// purpose: the DTO's `@IsIn` turns it into a clear 400, and refusing
|
|
111
|
+
// it here first would report the wrong problem.
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!context.can(identity_server_1.PERMISSIONS.CONTENT_UPDATE)) {
|
|
115
|
+
throw new common_1.ForbiddenException(`status=${requested} requires a token with write scope; this one may only read published content.`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JsonSchema } from '@orthacms/tools-server';
|
|
2
|
+
/** `content_types_list` — no arguments. */
|
|
3
|
+
export declare const LIST_TYPES_SCHEMA: JsonSchema;
|
|
4
|
+
/** `content_type_get` */
|
|
5
|
+
export declare const GET_TYPE_SCHEMA: JsonSchema;
|
|
6
|
+
/** `content_list` */
|
|
7
|
+
export declare const LIST_ENTRIES_SCHEMA: JsonSchema;
|
|
8
|
+
/** `content_get` */
|
|
9
|
+
export declare const GET_ENTRY_SCHEMA: JsonSchema;
|
|
10
|
+
/** `content_relations` */
|
|
11
|
+
export declare const RELATIONS_SCHEMA: JsonSchema;
|
|
12
|
+
/** `content_media` */
|
|
13
|
+
export declare const MEDIA_SCHEMA: JsonSchema;
|
|
14
|
+
/** `content_translations` */
|
|
15
|
+
export declare const TRANSLATIONS_SCHEMA: JsonSchema;
|
|
16
|
+
/** `content_create` */
|
|
17
|
+
export declare const CREATE_SCHEMA: JsonSchema;
|
|
18
|
+
/** `content_update` */
|
|
19
|
+
export declare const UPDATE_SCHEMA: JsonSchema;
|
|
20
|
+
/** `content_publish` / `content_unpublish` / `content_delete` */
|
|
21
|
+
export declare const ENTRY_ACTION_SCHEMA: JsonSchema;
|
|
22
|
+
/**
|
|
23
|
+
* `content_bulk_save` — the batch form of create + update.
|
|
24
|
+
*
|
|
25
|
+
* One `items` array rather than a `creates` and an `updates` list: a model
|
|
26
|
+
* working from a list of records knows which ones it read an id for and which
|
|
27
|
+
* it did not, and asking it to partition them first is a step it can get wrong
|
|
28
|
+
* for no benefit. The addressing inside an item is the same addressing the
|
|
29
|
+
* single-entry tools take as top-level arguments.
|
|
30
|
+
*/
|
|
31
|
+
export declare const BULK_SAVE_SCHEMA: JsonSchema;
|
|
32
|
+
/** `content_bulk_publish` / `content_bulk_unpublish` / `content_bulk_delete`. */
|
|
33
|
+
export declare const BULK_IDS_SCHEMA: JsonSchema;
|
|
34
|
+
//# sourceMappingURL=tool-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/mcp/tool-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAsIzD,2CAA2C;AAC3C,eAAO,MAAM,iBAAiB,EAAE,UAAuB,CAAC;AAExD,yBAAyB;AACzB,eAAO,MAAM,eAAe,EAAE,UAE5B,CAAC;AAEH,qBAAqB;AACrB,eAAO,MAAM,mBAAmB,EAAE,UAoCjC,CAAC;AAEF,oBAAoB;AACpB,eAAO,MAAM,gBAAgB,EAAE,UAU9B,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,gBAAgB,EAAE,UAmB9B,CAAC;AAEF,sBAAsB;AACtB,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,mBAAmB,EAAE,UASjC,CAAC;AAkBF,uBAAuB;AACvB,eAAO,MAAM,aAAa,EAAE,UAkB3B,CAAC;AAEF,uBAAuB;AACvB,eAAO,MAAM,aAAa,EAAE,UAa3B,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,EAAE,UAOjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAkC9B,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,eAAe,EAAE,UAY7B,CAAC"}
|