@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ortha CMS contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/define.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator-free entry point: just the definition DSL and its types.
|
|
3
|
+
*
|
|
4
|
+
* Collection files (and the host's drizzle-kit schema entry that imports
|
|
5
|
+
* them) MUST import from `@orthacms/content-server/define`, not the main
|
|
6
|
+
* barrel — drizzle-kit bundles the schema's whole import graph with plain
|
|
7
|
+
* esbuild, which rejects the NestJS decorators the main barrel pulls in
|
|
8
|
+
* via its controllers.
|
|
9
|
+
*/
|
|
10
|
+
export { collection, single, joinTableOf } from './lib/collection/define';
|
|
11
|
+
export { field } from './lib/fields';
|
|
12
|
+
export { contentEntryRevisions } from './lib/revisions/infrastructure/persistence/revision-table';
|
|
13
|
+
export { CONTENT_TYPE_KIND } from './lib/types/content-type';
|
|
14
|
+
export type { AnyContentType, ContentType, ContentTypeKind, ContentTypeOptions, EntryEnvelope, InferEntry, InferValues, SingleOptions } from './lib/types/content-type';
|
|
15
|
+
export { CONTENT_FIELD_TYPE } from './lib/types/fields';
|
|
16
|
+
export type { AdminProps, AnyFieldSpec, BaseFieldOptions, FieldSpec, FieldType, FieldValidation, FieldValue, RelationFieldOptions, RelationOnDelete, RelationSpec } from './lib/types/fields';
|
|
17
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAMrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2DAA2D,CAAC;AAElG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACX,aAAa,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EACR,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACf,MAAM,oBAAoB,CAAC"}
|
package/dist/define.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator-free entry point: just the definition DSL and its types.
|
|
4
|
+
*
|
|
5
|
+
* Collection files (and the host's drizzle-kit schema entry that imports
|
|
6
|
+
* them) MUST import from `@orthacms/content-server/define`, not the main
|
|
7
|
+
* barrel — drizzle-kit bundles the schema's whole import graph with plain
|
|
8
|
+
* esbuild, which rejects the NestJS decorators the main barrel pulls in
|
|
9
|
+
* via its controllers.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CONTENT_FIELD_TYPE = exports.CONTENT_TYPE_KIND = exports.contentEntryRevisions = exports.field = exports.joinTableOf = exports.single = exports.collection = void 0;
|
|
13
|
+
var define_1 = require("./lib/collection/define");
|
|
14
|
+
Object.defineProperty(exports, "collection", { enumerable: true, get: function () { return define_1.collection; } });
|
|
15
|
+
Object.defineProperty(exports, "single", { enumerable: true, get: function () { return define_1.single; } });
|
|
16
|
+
Object.defineProperty(exports, "joinTableOf", { enumerable: true, get: function () { return define_1.joinTableOf; } });
|
|
17
|
+
var fields_1 = require("./lib/fields");
|
|
18
|
+
Object.defineProperty(exports, "field", { enumerable: true, get: function () { return fields_1.field; } });
|
|
19
|
+
// The one fixed (non per-type) content table: the generic revision store. It is
|
|
20
|
+
// HOST-owned like every generated `content_<name>` table — surfaced here (the
|
|
21
|
+
// decorator-free barrel) so the host's drizzle-kit schema entry can re-export it
|
|
22
|
+
// into the migration diff without pulling in the NestJS main barrel.
|
|
23
|
+
var revision_table_1 = require("./lib/revisions/infrastructure/persistence/revision-table");
|
|
24
|
+
Object.defineProperty(exports, "contentEntryRevisions", { enumerable: true, get: function () { return revision_table_1.contentEntryRevisions; } });
|
|
25
|
+
var content_type_1 = require("./lib/types/content-type");
|
|
26
|
+
Object.defineProperty(exports, "CONTENT_TYPE_KIND", { enumerable: true, get: function () { return content_type_1.CONTENT_TYPE_KIND; } });
|
|
27
|
+
var fields_2 = require("./lib/types/fields");
|
|
28
|
+
Object.defineProperty(exports, "CONTENT_FIELD_TYPE", { enumerable: true, get: function () { return fields_2.CONTENT_FIELD_TYPE; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Public API of @orthacms/content-server. */
|
|
2
|
+
export { ContentPlugin } from './lib/utils/content-plugin';
|
|
3
|
+
export type { ContentPluginOptions, ContentServerPlugin } from './lib/utils/content-plugin';
|
|
4
|
+
export { collection, single, joinTableOf } from './lib/collection/define';
|
|
5
|
+
export { field } from './lib/fields';
|
|
6
|
+
export { ContentModule } from './lib/content.module';
|
|
7
|
+
export { CONTENT_REGISTRY, InjectContentRegistry } from './lib/content.tokens';
|
|
8
|
+
export { WorkspaceGrantsQuery } from './lib/content-types/queries/workspace-grants.query';
|
|
9
|
+
export { EntryWriterService } from './lib/entries/infrastructure/persistence/entry-writer.service';
|
|
10
|
+
export { RelationLinkService } from './lib/entries/infrastructure/persistence/relation-link.service';
|
|
11
|
+
export { CONTENT_ENTRY_EXTENSION } from './lib/extension/entry-extension';
|
|
12
|
+
export type { ContentEntryExtension, EntryFilterContext, EntryFilterExtension, EntryScopeParams, EntryTransaction, EntryWriteContext, EntryWriteFanout } from './lib/extension/entry-extension';
|
|
13
|
+
export { RELATION_LOCALE_SYNC, relationLocaleSync, isPerLocaleField, isJoinBackedRelation, type RelationLocaleSync } from './lib/extension/relation-locale-sync';
|
|
14
|
+
export { MEDIA_ASSET_RESOLVER, InjectMediaAssetResolver } from './lib/extension/media-asset-resolver';
|
|
15
|
+
export type { MediaAssetResolver, ResolvedMediaAsset } from './lib/extension/media-asset-resolver';
|
|
16
|
+
export { toColumns, toRecord } from './lib/entries/infrastructure/persistence/entry-row';
|
|
17
|
+
export type { EntryListView, EntryMediaView, EntryRecord, MediaRef } from './lib/entries/types/entry-list-view';
|
|
18
|
+
export { ContentTypeRegistry } from './lib/registry/content-type-registry';
|
|
19
|
+
export type { SerializedContentType, SerializedContentTypeSummary, SerializedField } from './lib/registry/content-type-registry';
|
|
20
|
+
export { EntryValidationService } from './lib/validation/services/entry-validation.service';
|
|
21
|
+
export type { ValidationIssue, ValidationResult } from './lib/validation/services/entry-validation.service';
|
|
22
|
+
export { CONTENT_TYPE_KIND, ENTRY_STATUS } from './lib/types/content-type';
|
|
23
|
+
export type { AnyContentType, ContentType, ContentTypeKind, EntryStatus, ContentTypeOptions, EntryEnvelope, InferEntry, InferValues, SingleOptions } from './lib/types/content-type';
|
|
24
|
+
export { CONTENT_FIELD_TYPE } from './lib/types/fields';
|
|
25
|
+
export { MEDIA_KIND_VALUES } from './lib/types/fields';
|
|
26
|
+
export type { AdminProps, AnyFieldSpec, BaseFieldOptions, FieldSpec, FieldType, FieldValidation, FieldValue, MediaAccept, MediaFieldOptions, MediaKindValue, RelationFieldOptions, RelationOnDelete, RelationSpec } from './lib/types/fields';
|
|
27
|
+
export type { PublicEntry, PublicEntryListView } from './lib/public-api/types/public-entry';
|
|
28
|
+
export type { PublicContentTypeListView } from './lib/public-api/http/controllers/public-content-types.controller';
|
|
29
|
+
export { ApiTokenGuard } from './lib/public-api/http/guards/api-token.guard';
|
|
30
|
+
export { ApiTokenWorkspaceGuard } from './lib/public-api/http/guards/api-token-workspace.guard';
|
|
31
|
+
export { CurrentApiToken } from './lib/public-api/http/decorators/current-api-token.decorator';
|
|
32
|
+
export type { ApiTokenRequest, PublicApiToken } from './lib/public-api/http/api-token-request';
|
|
33
|
+
export { PublicEntriesQuery } from './lib/public-api/infrastructure/public-entries.query';
|
|
34
|
+
export type { EntryLocator } from './lib/public-api/infrastructure/public-entries.query';
|
|
35
|
+
export { PublicEntryWritesService } from './lib/public-api/infrastructure/public-entry-writes.service';
|
|
36
|
+
export { resolveGrantedType } from './lib/public-api/http/controllers/resolve-granted-type';
|
|
37
|
+
export type { ContentGrantsSource, GrantedType } from './lib/public-api/http/controllers/resolve-granted-type';
|
|
38
|
+
export { PublicEntryQueryDto, PublicListEntriesQueryDto, ENTRY_VISIBILITY, PREVIEW, DEFAULT_EXPANSION_LIMIT } from './lib/public-api/http/dto/public-list-entries-query.dto';
|
|
39
|
+
export type { EntryVisibility } from './lib/public-api/http/dto/public-list-entries-query.dto';
|
|
40
|
+
export { PublicSaveEntryDto } from './lib/public-api/http/dto/public-save-entry.dto';
|
|
41
|
+
export { PublicBulkIdsDto, PublicBulkSaveDto, PublicBulkSaveItemDto } from './lib/public-api/http/dto/public-bulk.dto';
|
|
42
|
+
export { BULK_SAVE_OP } from './lib/public-api/types/public-bulk';
|
|
43
|
+
export type { BulkSaveOp, PublicBulkError, PublicBulkSaveItemResult, PublicBulkSaveResult } from './lib/public-api/types/public-bulk';
|
|
44
|
+
export type { PublicMediaFieldView, PublicMediaRef, PublicRelationFieldView } from './lib/public-api/types/public-expansion';
|
|
45
|
+
export { DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE, BULK_MAX_SAVE_ITEMS } from './lib/entries/entries.constants';
|
|
46
|
+
export { RELATION_DELTA_ADDRESSING } from './lib/entries/types/entry-list-view';
|
|
47
|
+
export type { RelationDelta, RelationDeltaAddressing } from './lib/entries/types/entry-list-view';
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EACR,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAO/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAO1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AAInG,OAAO,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC;AAErG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,YAAY,EACR,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,kBAAkB,EAC1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EAC3B,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACR,kBAAkB,EAClB,kBAAkB,EACrB,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EACH,SAAS,EACT,QAAQ,EACX,MAAM,oDAAoD,CAAC;AAC5D,YAAY,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,QAAQ,EACX,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,YAAY,EACR,qBAAqB,EACrB,4BAA4B,EAC5B,eAAe,EAClB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,YAAY,EACR,eAAe,EACf,gBAAgB,EACnB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC3E,YAAY,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACX,aAAa,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EACR,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACf,MAAM,oBAAoB,CAAC;AAO5B,YAAY,EACR,WAAW,EACX,mBAAmB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAC/F,YAAY,EACR,eAAe,EACf,cAAc,EACjB,MAAM,yCAAyC,CAAC;AAQjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,YAAY,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC;AAGvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,YAAY,EACR,mBAAmB,EACnB,WAAW,EACd,MAAM,wDAAwD,CAAC;AAChE,OAAO,EACH,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,OAAO,EACP,uBAAuB,EAC1B,MAAM,yDAAyD,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAKrF,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,YAAY,EACR,UAAU,EACV,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACR,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACH,iBAAiB,EACjB,aAAa,EAIb,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,YAAY,EACR,aAAa,EACb,uBAAuB,EAC1B,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Public API of @orthacms/content-server. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RELATION_DELTA_ADDRESSING = exports.BULK_MAX_SAVE_ITEMS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.BULK_SAVE_OP = exports.PublicBulkSaveItemDto = exports.PublicBulkSaveDto = exports.PublicBulkIdsDto = exports.PublicSaveEntryDto = exports.DEFAULT_EXPANSION_LIMIT = exports.PREVIEW = exports.ENTRY_VISIBILITY = exports.PublicListEntriesQueryDto = exports.PublicEntryQueryDto = exports.resolveGrantedType = exports.PublicEntryWritesService = exports.PublicEntriesQuery = exports.CurrentApiToken = exports.ApiTokenWorkspaceGuard = exports.ApiTokenGuard = exports.MEDIA_KIND_VALUES = exports.CONTENT_FIELD_TYPE = exports.ENTRY_STATUS = exports.CONTENT_TYPE_KIND = exports.EntryValidationService = exports.ContentTypeRegistry = exports.toRecord = exports.toColumns = exports.InjectMediaAssetResolver = exports.MEDIA_ASSET_RESOLVER = exports.isJoinBackedRelation = exports.isPerLocaleField = exports.relationLocaleSync = exports.RELATION_LOCALE_SYNC = exports.CONTENT_ENTRY_EXTENSION = exports.RelationLinkService = exports.EntryWriterService = exports.WorkspaceGrantsQuery = exports.InjectContentRegistry = exports.CONTENT_REGISTRY = exports.ContentModule = exports.field = exports.joinTableOf = exports.single = exports.collection = exports.ContentPlugin = void 0;
|
|
5
|
+
var content_plugin_1 = require("./lib/utils/content-plugin");
|
|
6
|
+
Object.defineProperty(exports, "ContentPlugin", { enumerable: true, get: function () { return content_plugin_1.ContentPlugin; } });
|
|
7
|
+
var define_1 = require("./lib/collection/define");
|
|
8
|
+
Object.defineProperty(exports, "collection", { enumerable: true, get: function () { return define_1.collection; } });
|
|
9
|
+
Object.defineProperty(exports, "single", { enumerable: true, get: function () { return define_1.single; } });
|
|
10
|
+
Object.defineProperty(exports, "joinTableOf", { enumerable: true, get: function () { return define_1.joinTableOf; } });
|
|
11
|
+
var fields_1 = require("./lib/fields");
|
|
12
|
+
Object.defineProperty(exports, "field", { enumerable: true, get: function () { return fields_1.field; } });
|
|
13
|
+
var content_module_1 = require("./lib/content.module");
|
|
14
|
+
Object.defineProperty(exports, "ContentModule", { enumerable: true, get: function () { return content_module_1.ContentModule; } });
|
|
15
|
+
var content_tokens_1 = require("./lib/content.tokens");
|
|
16
|
+
Object.defineProperty(exports, "CONTENT_REGISTRY", { enumerable: true, get: function () { return content_tokens_1.CONTENT_REGISTRY; } });
|
|
17
|
+
Object.defineProperty(exports, "InjectContentRegistry", { enumerable: true, get: function () { return content_tokens_1.InjectContentRegistry; } });
|
|
18
|
+
// The workspace's content grants. Exported (and exported from the global
|
|
19
|
+
// module) for plugins that bind their own copilot tools over content-scoped
|
|
20
|
+
// data — i18n's translations, media's assets. Every such tool takes its type
|
|
21
|
+
// name from the *model*, so each has to re-check the grants, and that check
|
|
22
|
+
// needs exactly one implementation rather than one per binder.
|
|
23
|
+
var workspace_grants_query_1 = require("./lib/content-types/queries/workspace-grants.query");
|
|
24
|
+
Object.defineProperty(exports, "WorkspaceGrantsQuery", { enumerable: true, get: function () { return workspace_grants_query_1.WorkspaceGrantsQuery; } });
|
|
25
|
+
// The entry write engine, exported for the plugins that apply the copilot's
|
|
26
|
+
// proposals over content. Deliberately the *same* service the HTTP controllers
|
|
27
|
+
// call — ADR-0005 §5 requires an applied proposal to run the ordinary
|
|
28
|
+
// use-case, so an applier reaching for anything else is the bug the port
|
|
29
|
+
// exists to prevent.
|
|
30
|
+
var entry_writer_service_1 = require("./lib/entries/infrastructure/persistence/entry-writer.service");
|
|
31
|
+
Object.defineProperty(exports, "EntryWriterService", { enumerable: true, get: function () { return entry_writer_service_1.EntryWriterService; } });
|
|
32
|
+
// Exported for the bound CONTENT_ENTRY_EXTENSION, which syncs relation links
|
|
33
|
+
// across locale siblings and must write them through the same service the
|
|
34
|
+
// entries pipeline does.
|
|
35
|
+
var relation_link_service_1 = require("./lib/entries/infrastructure/persistence/relation-link.service");
|
|
36
|
+
Object.defineProperty(exports, "RelationLinkService", { enumerable: true, get: function () { return relation_link_service_1.RelationLinkService; } });
|
|
37
|
+
var entry_extension_1 = require("./lib/extension/entry-extension");
|
|
38
|
+
Object.defineProperty(exports, "CONTENT_ENTRY_EXTENSION", { enumerable: true, get: function () { return entry_extension_1.CONTENT_ENTRY_EXTENSION; } });
|
|
39
|
+
var relation_locale_sync_1 = require("./lib/extension/relation-locale-sync");
|
|
40
|
+
Object.defineProperty(exports, "RELATION_LOCALE_SYNC", { enumerable: true, get: function () { return relation_locale_sync_1.RELATION_LOCALE_SYNC; } });
|
|
41
|
+
Object.defineProperty(exports, "relationLocaleSync", { enumerable: true, get: function () { return relation_locale_sync_1.relationLocaleSync; } });
|
|
42
|
+
Object.defineProperty(exports, "isPerLocaleField", { enumerable: true, get: function () { return relation_locale_sync_1.isPerLocaleField; } });
|
|
43
|
+
Object.defineProperty(exports, "isJoinBackedRelation", { enumerable: true, get: function () { return relation_locale_sync_1.isJoinBackedRelation; } });
|
|
44
|
+
var media_asset_resolver_1 = require("./lib/extension/media-asset-resolver");
|
|
45
|
+
Object.defineProperty(exports, "MEDIA_ASSET_RESOLVER", { enumerable: true, get: function () { return media_asset_resolver_1.MEDIA_ASSET_RESOLVER; } });
|
|
46
|
+
Object.defineProperty(exports, "InjectMediaAssetResolver", { enumerable: true, get: function () { return media_asset_resolver_1.InjectMediaAssetResolver; } });
|
|
47
|
+
// Row ↔ record mappers, exported for extension plugins (e.g. i18n's
|
|
48
|
+
// translation copy) so their wire shapes can't drift from the pipeline's.
|
|
49
|
+
var entry_row_1 = require("./lib/entries/infrastructure/persistence/entry-row");
|
|
50
|
+
Object.defineProperty(exports, "toColumns", { enumerable: true, get: function () { return entry_row_1.toColumns; } });
|
|
51
|
+
Object.defineProperty(exports, "toRecord", { enumerable: true, get: function () { return entry_row_1.toRecord; } });
|
|
52
|
+
var content_type_registry_1 = require("./lib/registry/content-type-registry");
|
|
53
|
+
Object.defineProperty(exports, "ContentTypeRegistry", { enumerable: true, get: function () { return content_type_registry_1.ContentTypeRegistry; } });
|
|
54
|
+
var entry_validation_service_1 = require("./lib/validation/services/entry-validation.service");
|
|
55
|
+
Object.defineProperty(exports, "EntryValidationService", { enumerable: true, get: function () { return entry_validation_service_1.EntryValidationService; } });
|
|
56
|
+
var content_type_1 = require("./lib/types/content-type");
|
|
57
|
+
Object.defineProperty(exports, "CONTENT_TYPE_KIND", { enumerable: true, get: function () { return content_type_1.CONTENT_TYPE_KIND; } });
|
|
58
|
+
Object.defineProperty(exports, "ENTRY_STATUS", { enumerable: true, get: function () { return content_type_1.ENTRY_STATUS; } });
|
|
59
|
+
var fields_2 = require("./lib/types/fields");
|
|
60
|
+
Object.defineProperty(exports, "CONTENT_FIELD_TYPE", { enumerable: true, get: function () { return fields_2.CONTENT_FIELD_TYPE; } });
|
|
61
|
+
var fields_3 = require("./lib/types/fields");
|
|
62
|
+
Object.defineProperty(exports, "MEDIA_KIND_VALUES", { enumerable: true, get: function () { return fields_3.MEDIA_KIND_VALUES; } });
|
|
63
|
+
var api_token_guard_1 = require("./lib/public-api/http/guards/api-token.guard");
|
|
64
|
+
Object.defineProperty(exports, "ApiTokenGuard", { enumerable: true, get: function () { return api_token_guard_1.ApiTokenGuard; } });
|
|
65
|
+
var api_token_workspace_guard_1 = require("./lib/public-api/http/guards/api-token-workspace.guard");
|
|
66
|
+
Object.defineProperty(exports, "ApiTokenWorkspaceGuard", { enumerable: true, get: function () { return api_token_workspace_guard_1.ApiTokenWorkspaceGuard; } });
|
|
67
|
+
var current_api_token_decorator_1 = require("./lib/public-api/http/decorators/current-api-token.decorator");
|
|
68
|
+
Object.defineProperty(exports, "CurrentApiToken", { enumerable: true, get: function () { return current_api_token_decorator_1.CurrentApiToken; } });
|
|
69
|
+
// --- The public API's engine, for a second protocol over the same surface ---
|
|
70
|
+
// `@orthacms/content-graphql` serves `/v1/graphql` by assembling these exact
|
|
71
|
+
// DTOs and calling these exact services, so GraphQL and REST cannot drift on
|
|
72
|
+
// what a token may see or write. Everything below is the *implementation* of
|
|
73
|
+
// the public API rather than its wire contract: it is exported for that reuse,
|
|
74
|
+
// and a change here is a change to both protocols at once.
|
|
75
|
+
var public_entries_query_1 = require("./lib/public-api/infrastructure/public-entries.query");
|
|
76
|
+
Object.defineProperty(exports, "PublicEntriesQuery", { enumerable: true, get: function () { return public_entries_query_1.PublicEntriesQuery; } });
|
|
77
|
+
var public_entry_writes_service_1 = require("./lib/public-api/infrastructure/public-entry-writes.service");
|
|
78
|
+
Object.defineProperty(exports, "PublicEntryWritesService", { enumerable: true, get: function () { return public_entry_writes_service_1.PublicEntryWritesService; } });
|
|
79
|
+
// `WorkspaceGrantsQuery` is exported above — the grant gate is shared with the
|
|
80
|
+
// copilot tool binders, which is the same one-implementation argument.
|
|
81
|
+
var resolve_granted_type_1 = require("./lib/public-api/http/controllers/resolve-granted-type");
|
|
82
|
+
Object.defineProperty(exports, "resolveGrantedType", { enumerable: true, get: function () { return resolve_granted_type_1.resolveGrantedType; } });
|
|
83
|
+
var public_list_entries_query_dto_1 = require("./lib/public-api/http/dto/public-list-entries-query.dto");
|
|
84
|
+
Object.defineProperty(exports, "PublicEntryQueryDto", { enumerable: true, get: function () { return public_list_entries_query_dto_1.PublicEntryQueryDto; } });
|
|
85
|
+
Object.defineProperty(exports, "PublicListEntriesQueryDto", { enumerable: true, get: function () { return public_list_entries_query_dto_1.PublicListEntriesQueryDto; } });
|
|
86
|
+
Object.defineProperty(exports, "ENTRY_VISIBILITY", { enumerable: true, get: function () { return public_list_entries_query_dto_1.ENTRY_VISIBILITY; } });
|
|
87
|
+
Object.defineProperty(exports, "PREVIEW", { enumerable: true, get: function () { return public_list_entries_query_dto_1.PREVIEW; } });
|
|
88
|
+
Object.defineProperty(exports, "DEFAULT_EXPANSION_LIMIT", { enumerable: true, get: function () { return public_list_entries_query_dto_1.DEFAULT_EXPANSION_LIMIT; } });
|
|
89
|
+
var public_save_entry_dto_1 = require("./lib/public-api/http/dto/public-save-entry.dto");
|
|
90
|
+
Object.defineProperty(exports, "PublicSaveEntryDto", { enumerable: true, get: function () { return public_save_entry_dto_1.PublicSaveEntryDto; } });
|
|
91
|
+
// The batch write contracts, exported for the same reason as the single-entry
|
|
92
|
+
// ones: a second protocol adapter over this surface (GraphQL does exactly that
|
|
93
|
+
// for the singles) must be able to reach the DTOs and the result shape rather
|
|
94
|
+
// than invent its own.
|
|
95
|
+
var public_bulk_dto_1 = require("./lib/public-api/http/dto/public-bulk.dto");
|
|
96
|
+
Object.defineProperty(exports, "PublicBulkIdsDto", { enumerable: true, get: function () { return public_bulk_dto_1.PublicBulkIdsDto; } });
|
|
97
|
+
Object.defineProperty(exports, "PublicBulkSaveDto", { enumerable: true, get: function () { return public_bulk_dto_1.PublicBulkSaveDto; } });
|
|
98
|
+
Object.defineProperty(exports, "PublicBulkSaveItemDto", { enumerable: true, get: function () { return public_bulk_dto_1.PublicBulkSaveItemDto; } });
|
|
99
|
+
var public_bulk_1 = require("./lib/public-api/types/public-bulk");
|
|
100
|
+
Object.defineProperty(exports, "BULK_SAVE_OP", { enumerable: true, get: function () { return public_bulk_1.BULK_SAVE_OP; } });
|
|
101
|
+
var entries_constants_1 = require("./lib/entries/entries.constants");
|
|
102
|
+
Object.defineProperty(exports, "DEFAULT_PAGE_SIZE", { enumerable: true, get: function () { return entries_constants_1.DEFAULT_PAGE_SIZE; } });
|
|
103
|
+
Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: function () { return entries_constants_1.MAX_PAGE_SIZE; } });
|
|
104
|
+
// Exported for the other plugins' batch tools (i18n's bulk translation),
|
|
105
|
+
// so "how many writes may one call start" is one number rather than a
|
|
106
|
+
// second cap that drifts from this one.
|
|
107
|
+
Object.defineProperty(exports, "BULK_MAX_SAVE_ITEMS", { enumerable: true, get: function () { return entries_constants_1.BULK_MAX_SAVE_ITEMS; } });
|
|
108
|
+
var entry_list_view_1 = require("./lib/entries/types/entry-list-view");
|
|
109
|
+
Object.defineProperty(exports, "RELATION_DELTA_ADDRESSING", { enumerable: true, get: function () { return entry_list_view_1.RELATION_DELTA_ADDRESSING; } });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `collection()` / `single()` — the two entry points of the content DSL.
|
|
3
|
+
* Both normalize options, build the physical tables, and return a typed
|
|
4
|
+
* {@link ContentType} the host registers via `ContentPlugin({ types })`
|
|
5
|
+
* and re-exports (the tables) for drizzle-kit.
|
|
6
|
+
*/
|
|
7
|
+
import type { PgTable } from 'drizzle-orm/pg-core';
|
|
8
|
+
import { type AnyFieldSpec } from '../types/fields';
|
|
9
|
+
import { type AnyContentType, type ContentType, type ContentTypeOptions, type SingleOptions } from '../types/content-type';
|
|
10
|
+
/**
|
|
11
|
+
* The generated join table for a many-relation field, or throw. Use this in
|
|
12
|
+
* the host's drizzle-kit schema entry (`re-export`) so a renamed or removed
|
|
13
|
+
* many-relation fails loudly at load instead of silently resolving to
|
|
14
|
+
* `undefined` and dropping the join table from the generated migration.
|
|
15
|
+
*/
|
|
16
|
+
export declare function joinTableOf(type: AnyContentType, field: string): PgTable;
|
|
17
|
+
/**
|
|
18
|
+
* Defines a multi-entry collection.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* export const post = collection('post', {
|
|
22
|
+
* label: 'Blog posts',
|
|
23
|
+
* fields: {
|
|
24
|
+
* title: field.text({ required: true }),
|
|
25
|
+
* author: field.relation({ to: () => author })
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export declare function collection<TFields extends Record<string, AnyFieldSpec>>(name: string, options: ContentTypeOptions<TFields>): ContentType<TFields>;
|
|
30
|
+
/**
|
|
31
|
+
* Defines a single (a standalone page with a route path). Same storage
|
|
32
|
+
* model as a collection — the admin just treats it as one entry.
|
|
33
|
+
*/
|
|
34
|
+
export declare function single<TFields extends Record<string, AnyFieldSpec>>(name: string, options: SingleOptions<TFields>): ContentType<TFields>;
|
|
35
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/lib/collection/define.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACrB,MAAM,uBAAuB,CAAC;AAkK/B;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CASxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACnE,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACrC,WAAW,CAAC,OAAO,CAAC,CAuBtB;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/D,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAChC,WAAW,CAAC,OAAO,CAAC,CA6BtB"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `collection()` / `single()` — the two entry points of the content DSL.
|
|
4
|
+
* Both normalize options, build the physical tables, and return a typed
|
|
5
|
+
* {@link ContentType} the host registers via `ContentPlugin({ types })`
|
|
6
|
+
* and re-exports (the tables) for drizzle-kit.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.joinTableOf = joinTableOf;
|
|
10
|
+
exports.collection = collection;
|
|
11
|
+
exports.single = single;
|
|
12
|
+
const fields_1 = require("../types/fields");
|
|
13
|
+
const content_type_1 = require("../types/content-type");
|
|
14
|
+
const table_builder_1 = require("./table-builder");
|
|
15
|
+
/** Valid machine names: snake_case, starting with a letter. */
|
|
16
|
+
const NAME_RE = /^[a-z][a-z0-9_]*$/;
|
|
17
|
+
function assertName(name) {
|
|
18
|
+
if (!NAME_RE.test(name)) {
|
|
19
|
+
throw new Error(`Content type name "${name}" must be snake_case ` +
|
|
20
|
+
`(letters, digits, underscores; starting with a letter).`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Envelope columns the platform owns (see {@link buildTables}). Reserved
|
|
25
|
+
* unconditionally — even the metadata-gated `published_at` / `deleted_at`, so a
|
|
26
|
+
* field name can never collide with a column we might add, and the meaning of
|
|
27
|
+
* these names stays fixed across the codebase.
|
|
28
|
+
*/
|
|
29
|
+
const RESERVED_COLUMNS = new Set([
|
|
30
|
+
'id',
|
|
31
|
+
'workspace_id',
|
|
32
|
+
'status',
|
|
33
|
+
'created_at',
|
|
34
|
+
'updated_at',
|
|
35
|
+
'published_at',
|
|
36
|
+
'deleted_at',
|
|
37
|
+
'locale',
|
|
38
|
+
'locale_group_id'
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* The physical main-table column a field maps to, or `null` for a
|
|
42
|
+
* many-relation (which lives in its own join table, not a column). A
|
|
43
|
+
* single relation becomes a `<field>_id` FK column — mirror that here so
|
|
44
|
+
* collision detection sees the real column name, not the bare field name.
|
|
45
|
+
*/
|
|
46
|
+
function mainColumnName(fieldName, spec) {
|
|
47
|
+
if (spec.type === fields_1.CONTENT_FIELD_TYPE.Relation) {
|
|
48
|
+
// Inverse (virtual) and many-relations have no main-table column.
|
|
49
|
+
if (spec.relation?.inverse || spec.relation?.many)
|
|
50
|
+
return null;
|
|
51
|
+
return `${(0, table_builder_1.snakeCase)(fieldName)}_id`;
|
|
52
|
+
}
|
|
53
|
+
return (0, table_builder_1.snakeCase)(fieldName);
|
|
54
|
+
}
|
|
55
|
+
function assertFields(typeName, fields, i18n) {
|
|
56
|
+
const names = Object.keys(fields);
|
|
57
|
+
if (names.length === 0) {
|
|
58
|
+
throw new Error(`Content type "${typeName}" defines no fields.`);
|
|
59
|
+
}
|
|
60
|
+
const seen = new Map();
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
const spec = fields[name];
|
|
63
|
+
// `localized` only means something on a row-per-locale type; on any
|
|
64
|
+
// other type the flag would silently do nothing — fail loudly instead.
|
|
65
|
+
if (spec.localized && !i18n) {
|
|
66
|
+
throw new Error(`Field "${name}" on "${typeName}" is localized, but the type ` +
|
|
67
|
+
`does not set i18n: true.`);
|
|
68
|
+
}
|
|
69
|
+
// `unique` enforces one-to-one via a UNIQUE constraint on the single
|
|
70
|
+
// FK column. A many-relation has no such column (its links live in a
|
|
71
|
+
// join table), so `unique` is meaningless there — reject it rather
|
|
72
|
+
// than silently ignore it.
|
|
73
|
+
if (spec.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
74
|
+
spec.relation?.many &&
|
|
75
|
+
spec.relation.unique) {
|
|
76
|
+
throw new Error(`Relation "${typeName}.${name}" sets unique: true with ` +
|
|
77
|
+
`many: true — a many-relation has no FK column to constrain. ` +
|
|
78
|
+
`Drop one of them.`);
|
|
79
|
+
}
|
|
80
|
+
// `syncAcrossLocales` describes propagation across a translation
|
|
81
|
+
// group, so on a type with no locale siblings it can only mislead —
|
|
82
|
+
// an author setting it there believes something is happening. The
|
|
83
|
+
// builder defaults it to `true`, so only an explicit `false` (which
|
|
84
|
+
// an author can only have written deliberately) is detectable here.
|
|
85
|
+
if (spec.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
86
|
+
spec.relation &&
|
|
87
|
+
!spec.relation.inverse &&
|
|
88
|
+
!spec.relation.syncAcrossLocales &&
|
|
89
|
+
!spec.localized &&
|
|
90
|
+
!i18n) {
|
|
91
|
+
throw new Error(`Relation "${typeName}.${name}" sets syncAcrossLocales, but ` +
|
|
92
|
+
`"${typeName}" does not set i18n: true — it has no locale ` +
|
|
93
|
+
`siblings to propagate to.`);
|
|
94
|
+
}
|
|
95
|
+
// `localized: true` on a relation IS `syncAcrossLocales: false` (the
|
|
96
|
+
// builder reads it as the default), so declaring both in contradiction
|
|
97
|
+
// asks for two opposite things and one would have to win silently.
|
|
98
|
+
if (spec.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
99
|
+
spec.relation &&
|
|
100
|
+
!spec.relation.inverse &&
|
|
101
|
+
spec.localized &&
|
|
102
|
+
spec.relation.syncAcrossLocales) {
|
|
103
|
+
throw new Error(`Relation "${typeName}.${name}" sets localized: true with ` +
|
|
104
|
+
`syncAcrossLocales: true — localized means each locale keeps ` +
|
|
105
|
+
`its own links, which is the opposite. Drop one of them.`);
|
|
106
|
+
}
|
|
107
|
+
// A required single relation with ON DELETE SET NULL is a
|
|
108
|
+
// contradiction: the FK column is NOT NULL, so nulling it on a
|
|
109
|
+
// parent delete always fails — the delete can never succeed. (An
|
|
110
|
+
// inverse field has no FK column, so the rule doesn't apply.)
|
|
111
|
+
if (spec.type === fields_1.CONTENT_FIELD_TYPE.Relation &&
|
|
112
|
+
spec.relation &&
|
|
113
|
+
!spec.relation.inverse &&
|
|
114
|
+
!spec.relation.many &&
|
|
115
|
+
spec.required &&
|
|
116
|
+
spec.relation.onDelete === 'set null') {
|
|
117
|
+
throw new Error(`Relation "${typeName}.${name}" is required but its onDelete is ` +
|
|
118
|
+
`'set null' — a NOT NULL foreign key cannot be nulled on delete. ` +
|
|
119
|
+
`Use 'cascade' or 'restrict'.`);
|
|
120
|
+
}
|
|
121
|
+
const column = mainColumnName(name, spec);
|
|
122
|
+
if (column === null)
|
|
123
|
+
continue; // many-relation: no main-table column
|
|
124
|
+
if (RESERVED_COLUMNS.has(column)) {
|
|
125
|
+
throw new Error(`Field "${name}" on "${typeName}" maps to column "${column}", ` +
|
|
126
|
+
`which collides with an envelope column.`);
|
|
127
|
+
}
|
|
128
|
+
const existing = seen.get(column);
|
|
129
|
+
if (existing) {
|
|
130
|
+
throw new Error(`Fields "${existing}" and "${name}" on "${typeName}" both map to ` +
|
|
131
|
+
`column "${column}".`);
|
|
132
|
+
}
|
|
133
|
+
seen.set(column, name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The generated join table for a many-relation field, or throw. Use this in
|
|
138
|
+
* the host's drizzle-kit schema entry (`re-export`) so a renamed or removed
|
|
139
|
+
* many-relation fails loudly at load instead of silently resolving to
|
|
140
|
+
* `undefined` and dropping the join table from the generated migration.
|
|
141
|
+
*/
|
|
142
|
+
function joinTableOf(type, field) {
|
|
143
|
+
const table = type.joinTables[field];
|
|
144
|
+
if (!table) {
|
|
145
|
+
throw new Error(`Content type "${type.name}" has no join table for ` +
|
|
146
|
+
`many-relation "${field}".`);
|
|
147
|
+
}
|
|
148
|
+
return table;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Defines a multi-entry collection.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* export const post = collection('post', {
|
|
155
|
+
* label: 'Blog posts',
|
|
156
|
+
* fields: {
|
|
157
|
+
* title: field.text({ required: true }),
|
|
158
|
+
* author: field.relation({ to: () => author })
|
|
159
|
+
* }
|
|
160
|
+
* });
|
|
161
|
+
*/
|
|
162
|
+
function collection(name, options) {
|
|
163
|
+
assertName(name);
|
|
164
|
+
const publishable = options.publishable ?? false;
|
|
165
|
+
const paranoid = options.paranoid ?? false;
|
|
166
|
+
const i18n = options.i18n ?? false;
|
|
167
|
+
assertFields(name, options.fields, i18n);
|
|
168
|
+
const { table, joinTables } = (0, table_builder_1.buildTables)(name, options.fields, {
|
|
169
|
+
publishable,
|
|
170
|
+
paranoid,
|
|
171
|
+
i18n
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
name,
|
|
175
|
+
kind: content_type_1.CONTENT_TYPE_KIND.Collection,
|
|
176
|
+
label: options.label ?? name,
|
|
177
|
+
description: options.description,
|
|
178
|
+
publishable,
|
|
179
|
+
paranoid,
|
|
180
|
+
i18n,
|
|
181
|
+
fields: options.fields,
|
|
182
|
+
table,
|
|
183
|
+
joinTables
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Defines a single (a standalone page with a route path). Same storage
|
|
188
|
+
* model as a collection — the admin just treats it as one entry.
|
|
189
|
+
*/
|
|
190
|
+
function single(name, options) {
|
|
191
|
+
assertName(name);
|
|
192
|
+
if (!options.path.startsWith('/')) {
|
|
193
|
+
throw new Error(`Single "${name}" path must start with "/" (got "${options.path}").`);
|
|
194
|
+
}
|
|
195
|
+
const publishable = options.publishable ?? false;
|
|
196
|
+
const paranoid = options.paranoid ?? false;
|
|
197
|
+
const i18n = options.i18n ?? false;
|
|
198
|
+
assertFields(name, options.fields, i18n);
|
|
199
|
+
const { table, joinTables } = (0, table_builder_1.buildTables)(name, options.fields, {
|
|
200
|
+
publishable,
|
|
201
|
+
paranoid,
|
|
202
|
+
i18n
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
name,
|
|
206
|
+
kind: content_type_1.CONTENT_TYPE_KIND.Single,
|
|
207
|
+
label: options.label ?? name,
|
|
208
|
+
description: options.description,
|
|
209
|
+
path: options.path,
|
|
210
|
+
publishable,
|
|
211
|
+
paranoid,
|
|
212
|
+
i18n,
|
|
213
|
+
fields: options.fields,
|
|
214
|
+
table,
|
|
215
|
+
joinTables
|
|
216
|
+
};
|
|
217
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a field map into physical Drizzle tables. One table per content
|
|
3
|
+
* type (`content_<name>`), plus one join table per many-relation
|
|
4
|
+
* (`content_<name>_<field>`). The HOST re-exports these from its
|
|
5
|
+
* drizzle-kit schema entry, so collection changes become ordinary
|
|
6
|
+
* committed migrations — exactly like any plugin-owned schema.
|
|
7
|
+
*/
|
|
8
|
+
import { type PgTable } from 'drizzle-orm/pg-core';
|
|
9
|
+
import { type AnyFieldSpec } from '../types/fields';
|
|
10
|
+
/** camelCase / kebab-case → snake_case column-safe identifier. */
|
|
11
|
+
export declare function snakeCase(value: string): string;
|
|
12
|
+
/** Result of building a content type's physical schema. */
|
|
13
|
+
export interface BuiltTables {
|
|
14
|
+
table: PgTable;
|
|
15
|
+
joinTables: Record<string, PgTable>;
|
|
16
|
+
}
|
|
17
|
+
/** Platform-owned envelope columns toggled by content-type metadata flags. */
|
|
18
|
+
export interface TableMeta {
|
|
19
|
+
/** Add a nullable `published_at` column. */
|
|
20
|
+
publishable?: boolean;
|
|
21
|
+
/** Add a nullable `deleted_at` column (soft delete). */
|
|
22
|
+
paranoid?: boolean;
|
|
23
|
+
/** Add NOT NULL `locale` + `locale_group_id` columns (row-per-locale). */
|
|
24
|
+
i18n?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Builds the main table + join tables for a content type. */
|
|
27
|
+
export declare function buildTables(typeName: string, fields: Record<string, AnyFieldSpec>, meta?: TableMeta): BuiltTables;
|
|
28
|
+
//# sourceMappingURL=table-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-builder.d.ts","sourceRoot":"","sources":["../../../src/lib/collection/table-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAeH,KAAK,OAAO,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGxE,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AA0GD,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACtB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACpC,IAAI,GAAE,SAAc,GACrB,WAAW,CAqNb"}
|