@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,74 @@
|
|
|
1
|
+
import type { RevisionStatus } from '../domain/revision-status';
|
|
2
|
+
import type { MediaRef, RelationRef } from '../../entries/types/entry-list-view';
|
|
3
|
+
/**
|
|
4
|
+
* The immutable document a revision captures — everything the editor submits,
|
|
5
|
+
* plus the link sets that don't travel in the values bag. Reconstructs a version
|
|
6
|
+
* independently of the live row.
|
|
7
|
+
*/
|
|
8
|
+
export interface RevisionSnapshot {
|
|
9
|
+
/**
|
|
10
|
+
* Every field value keyed by field name: scalars, localized + shared fields,
|
|
11
|
+
* and single-relation FK ids (which the editor carries in `values`).
|
|
12
|
+
*/
|
|
13
|
+
values: Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* The ordered target-id list of each **join-backed** relation field (owning
|
|
16
|
+
* many-to-many and the inverse of one) keyed by field name — the links that
|
|
17
|
+
* never travel in {@link values}.
|
|
18
|
+
*/
|
|
19
|
+
relations: Record<string, string[]>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One revision as served to the admin timeline — the metadata, without the
|
|
23
|
+
* (potentially large) snapshot body. `author` is resolved from `created_by`.
|
|
24
|
+
*/
|
|
25
|
+
export interface RevisionSummary {
|
|
26
|
+
/** Revision id. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Monotonic version number within the entry (1-based). */
|
|
29
|
+
number: number;
|
|
30
|
+
/** Lifecycle state. */
|
|
31
|
+
status: RevisionStatus;
|
|
32
|
+
/** Whether this is the entry's current live version. */
|
|
33
|
+
isPublished: boolean;
|
|
34
|
+
/** Whether this is the newest revision (the only one publishable). */
|
|
35
|
+
isLatest: boolean;
|
|
36
|
+
/** ISO capture timestamp. */
|
|
37
|
+
createdAt: string;
|
|
38
|
+
/** ISO publish timestamp, when published. */
|
|
39
|
+
publishedAt?: string;
|
|
40
|
+
/** The acting user's id, when known. */
|
|
41
|
+
authorId?: string;
|
|
42
|
+
}
|
|
43
|
+
/** One revision with its full snapshot body — for preview / restore. */
|
|
44
|
+
export interface RevisionDetail extends RevisionSummary {
|
|
45
|
+
/** The captured document. */
|
|
46
|
+
snapshot: RevisionSnapshot;
|
|
47
|
+
/**
|
|
48
|
+
* Each relation field's snapshot ids resolved to display refs (title / slug /
|
|
49
|
+
* status), keyed by field name — so the preview shows the actual linked
|
|
50
|
+
* records, not raw uuids. Owning-single fields resolve their FK id from
|
|
51
|
+
* `snapshot.values`; join-backed fields resolve their id list from
|
|
52
|
+
* `snapshot.relations`. **Capped per field** (`relationTotals` carries the
|
|
53
|
+
* true count for a "+N more"), and present only on this detail read — the
|
|
54
|
+
* timeline summaries stay lean.
|
|
55
|
+
*/
|
|
56
|
+
relationRefs?: Record<string, RelationRef[]>;
|
|
57
|
+
/** The true link count per relation field (may exceed the capped refs). */
|
|
58
|
+
relationTotals?: Record<string, number>;
|
|
59
|
+
/**
|
|
60
|
+
* Each media field's snapshot asset ids resolved to display refs (name /
|
|
61
|
+
* thumbnail url / kind), keyed by field name — so the preview shows the
|
|
62
|
+
* actual assets, not raw uuids. A single field resolves its id from
|
|
63
|
+
* `snapshot.values`; a `multiple` field its ordered id list. An asset that
|
|
64
|
+
* can't be resolved (deleted / out of workspace) is an id-only `missing` ref.
|
|
65
|
+
* Present only when a media resolver is bound.
|
|
66
|
+
*/
|
|
67
|
+
mediaRefs?: Record<string, MediaRef[]>;
|
|
68
|
+
}
|
|
69
|
+
/** The paginated timeline envelope, matching the list-page convention. */
|
|
70
|
+
export interface RevisionListView {
|
|
71
|
+
items: RevisionSummary[];
|
|
72
|
+
total: number;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=revision-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-view.d.ts","sourceRoot":"","sources":["../../../../src/lib/revisions/types/revision-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EACR,QAAQ,EACR,WAAW,EACd,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAe,SAAQ,eAAe;IACnD,6BAA6B;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7C,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;CAC1C;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-type contracts: a code-defined collection (multi-entry) or
|
|
3
|
+
* single (standalone page). Definitions live in the HOST app (it owns
|
|
4
|
+
* their migrations, like any schema owner); this plugin owns the
|
|
5
|
+
* registry, serialization, and validation machinery around them.
|
|
6
|
+
*/
|
|
7
|
+
import type { PgTable } from 'drizzle-orm/pg-core';
|
|
8
|
+
import type { AnyFieldSpec, FieldValue } from './fields';
|
|
9
|
+
/**
|
|
10
|
+
* Multi-entry collection vs. standalone page — mirrors the established
|
|
11
|
+
* `ContentTypeDescriptor` contract. The runtime object is the source of truth;
|
|
12
|
+
* the {@link ContentTypeKind} union is derived from it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CONTENT_TYPE_KIND: {
|
|
15
|
+
readonly Collection: "collection";
|
|
16
|
+
readonly Single: "single";
|
|
17
|
+
};
|
|
18
|
+
/** Multi-entry collection vs. standalone page. */
|
|
19
|
+
export type ContentTypeKind = (typeof CONTENT_TYPE_KIND)[keyof typeof CONTENT_TYPE_KIND];
|
|
20
|
+
/**
|
|
21
|
+
* Publish-state values carried by the `status` envelope column of a
|
|
22
|
+
* `publishable` type. The runtime object is the source of truth for the
|
|
23
|
+
* generated column enum, the filter schema, and the admin — so the set can't
|
|
24
|
+
* drift across them.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ENTRY_STATUS: {
|
|
27
|
+
readonly Draft: "draft";
|
|
28
|
+
readonly Published: "published";
|
|
29
|
+
};
|
|
30
|
+
/** Publish state of an entry on a publishable type. */
|
|
31
|
+
export type EntryStatus = (typeof ENTRY_STATUS)[keyof typeof ENTRY_STATUS];
|
|
32
|
+
/** Options accepted by `collection()` / `single()`. */
|
|
33
|
+
export interface ContentTypeOptions<TFields extends Record<string, AnyFieldSpec>> {
|
|
34
|
+
/** Human label; falls back to the name. */
|
|
35
|
+
label?: string;
|
|
36
|
+
/** Short description shown in pickers (workspace wizard, admin). */
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Track when an entry was published: adds a reserved, nullable
|
|
40
|
+
* `published_at` envelope column the platform owns. Authors cannot define
|
|
41
|
+
* it as a field, and clients cannot set it directly.
|
|
42
|
+
*/
|
|
43
|
+
publishable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Soft-delete: adds a reserved, nullable `deleted_at` envelope column. A
|
|
46
|
+
* deleted entry is tombstoned (its `deleted_at` set) rather than removed.
|
|
47
|
+
* Authors cannot define it as a field, and clients cannot set it directly.
|
|
48
|
+
*/
|
|
49
|
+
paranoid?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Row-per-locale localization: adds reserved `locale` + `locale_group_id`
|
|
52
|
+
* envelope columns the platform owns. Each locale of an entry is a full
|
|
53
|
+
* row; sibling rows share a `locale_group_id`. What a locale *means*
|
|
54
|
+
* (available slugs, the default, scoping, sync) is owned by the bound
|
|
55
|
+
* localization plugin via the `CONTENT_ENTRY_EXTENSION` port — this
|
|
56
|
+
* package only provides the storage shape.
|
|
57
|
+
*/
|
|
58
|
+
i18n?: boolean;
|
|
59
|
+
/** The field map — keys become column names (snake_cased). */
|
|
60
|
+
fields: TFields;
|
|
61
|
+
}
|
|
62
|
+
/** Extra options for `single()` (pages). */
|
|
63
|
+
export interface SingleOptions<TFields extends Record<string, AnyFieldSpec>> extends ContentTypeOptions<TFields> {
|
|
64
|
+
/** Route path the page renders at, e.g. '/about'. */
|
|
65
|
+
path: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A defined content type: the serializable spec plus the physical
|
|
69
|
+
* Drizzle tables generated from it. `table` (and any `joinTables`) are
|
|
70
|
+
* what the host re-exports for drizzle-kit to diff into migrations.
|
|
71
|
+
*/
|
|
72
|
+
export interface ContentType<TFields extends Record<string, AnyFieldSpec> = Record<string, AnyFieldSpec>> {
|
|
73
|
+
/** Stable machine name / slug (snake_case). */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly kind: ContentTypeKind;
|
|
76
|
+
readonly label: string;
|
|
77
|
+
readonly description?: string;
|
|
78
|
+
/** Route path — singles only. */
|
|
79
|
+
readonly path?: string;
|
|
80
|
+
/** Tracks publish time via a `published_at` envelope column. */
|
|
81
|
+
readonly publishable: boolean;
|
|
82
|
+
/** Soft-deletes via a `deleted_at` envelope column. */
|
|
83
|
+
readonly paranoid: boolean;
|
|
84
|
+
/** Row-per-locale via `locale` + `locale_group_id` envelope columns. */
|
|
85
|
+
readonly i18n: boolean;
|
|
86
|
+
readonly fields: TFields;
|
|
87
|
+
/** The generated Postgres table (`content_<name>`). */
|
|
88
|
+
readonly table: PgTable;
|
|
89
|
+
/** Generated join tables, keyed by the many-relation field name. */
|
|
90
|
+
readonly joinTables: Record<string, PgTable>;
|
|
91
|
+
}
|
|
92
|
+
/** Any content type, regardless of its field map. */
|
|
93
|
+
export type AnyContentType = ContentType<Record<string, AnyFieldSpec>>;
|
|
94
|
+
/**
|
|
95
|
+
* Envelope columns an entry row carries. `id`/`workspaceId`/`createdAt`/
|
|
96
|
+
* `updatedAt` are always present; `status`/`publishedAt` exist only on
|
|
97
|
+
* `publishable` types, `deletedAt` only on `paranoid` types — hence optional.
|
|
98
|
+
* A fully type-level guarantee ("`status` ⟺ `publishable`") would require the
|
|
99
|
+
* flags to be literal-typed generics on the content type, a larger refactor.
|
|
100
|
+
*/
|
|
101
|
+
export interface EntryEnvelope {
|
|
102
|
+
/** Primary key. */
|
|
103
|
+
id: string;
|
|
104
|
+
/** Owning workspace (plain uuid until workspace scoping lands). */
|
|
105
|
+
workspaceId: string | null;
|
|
106
|
+
createdAt: Date;
|
|
107
|
+
updatedAt: Date;
|
|
108
|
+
/** Publish state — present only on `publishable` types. */
|
|
109
|
+
status?: 'draft' | 'published';
|
|
110
|
+
/** Publish timestamp — present (nullable) only on `publishable` types. */
|
|
111
|
+
publishedAt?: Date | null;
|
|
112
|
+
/** Soft-delete tombstone — present (nullable) only on `paranoid` types. */
|
|
113
|
+
deletedAt?: Date | null;
|
|
114
|
+
/** Locale slug of this row — present only on `i18n` types. */
|
|
115
|
+
locale?: string;
|
|
116
|
+
/** Shared id across a translation group — present only on `i18n` types. */
|
|
117
|
+
localeGroupId?: string;
|
|
118
|
+
}
|
|
119
|
+
/** The field values of a content type, null-aware via each field's `required`. */
|
|
120
|
+
export type InferValues<C extends AnyContentType> = {
|
|
121
|
+
[K in keyof C['fields']]: FieldValue<C['fields'][K]>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The full row type of a content type — envelope plus typed values.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* export const post = collection('post', { fields: { … } });
|
|
128
|
+
* type Post = InferEntry<typeof post>; // { id, status, …, title: string, … }
|
|
129
|
+
*/
|
|
130
|
+
export type InferEntry<C extends AnyContentType> = EntryEnvelope & InferValues<C>;
|
|
131
|
+
//# sourceMappingURL=content-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-type.d.ts","sourceRoot":"","sources":["../../../src/lib/types/content-type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,kDAAkD;AAClD,MAAM,MAAM,eAAe,GACvB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,OAA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live in the HOST app (it owns
|
|
5
|
+
* their migrations, like any schema owner); this plugin owns the
|
|
6
|
+
* registry, serialization, and validation machinery around them.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ENTRY_STATUS = exports.CONTENT_TYPE_KIND = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Multi-entry collection vs. standalone page — mirrors the established
|
|
12
|
+
* `ContentTypeDescriptor` contract. The runtime object is the source of truth;
|
|
13
|
+
* the {@link ContentTypeKind} union is derived from it.
|
|
14
|
+
*/
|
|
15
|
+
exports.CONTENT_TYPE_KIND = {
|
|
16
|
+
Collection: 'collection',
|
|
17
|
+
Single: 'single'
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Publish-state values carried by the `status` envelope column of a
|
|
21
|
+
* `publishable` type. The runtime object is the source of truth for the
|
|
22
|
+
* generated column enum, the filter schema, and the admin — so the set can't
|
|
23
|
+
* drift across them.
|
|
24
|
+
*/
|
|
25
|
+
exports.ENTRY_STATUS = {
|
|
26
|
+
Draft: 'draft',
|
|
27
|
+
Published: 'published'
|
|
28
|
+
};
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-spec contracts for code-defined content types. A field spec is a
|
|
3
|
+
* plain, JSON-serializable description (plus a lazy relation thunk) that
|
|
4
|
+
* drives three things at once: the generated Postgres column, server-side
|
|
5
|
+
* validation, and the admin's dynamic form rendering.
|
|
6
|
+
*/
|
|
7
|
+
import type { RichTextStructureMode } from '@orthacms/content-domain';
|
|
8
|
+
import type { AnyContentType } from './content-type';
|
|
9
|
+
/**
|
|
10
|
+
* Built-in field type identifiers. The runtime object is the single source of
|
|
11
|
+
* truth; the {@link FieldType} union is derived from it so the two can never
|
|
12
|
+
* drift, and every `switch`/comparison references `CONTENT_FIELD_TYPE.*`
|
|
13
|
+
* instead of a bare string literal.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CONTENT_FIELD_TYPE: {
|
|
16
|
+
readonly Text: "text";
|
|
17
|
+
readonly RichText: "richtext";
|
|
18
|
+
readonly Number: "number";
|
|
19
|
+
readonly Money: "money";
|
|
20
|
+
readonly Boolean: "boolean";
|
|
21
|
+
readonly Date: "date";
|
|
22
|
+
readonly Datetime: "datetime";
|
|
23
|
+
readonly Select: "select";
|
|
24
|
+
readonly Multiselect: "multiselect";
|
|
25
|
+
readonly Json: "json";
|
|
26
|
+
readonly Relation: "relation";
|
|
27
|
+
readonly Media: "media";
|
|
28
|
+
};
|
|
29
|
+
/** Built-in field type identifiers. */
|
|
30
|
+
export type FieldType = (typeof CONTENT_FIELD_TYPE)[keyof typeof CONTENT_FIELD_TYPE];
|
|
31
|
+
/**
|
|
32
|
+
* The canonical "no value" test for a field value — null/undefined, a blank
|
|
33
|
+
* (whitespace-only) string, or an empty array. The single definition shared by
|
|
34
|
+
* the validation service (where an empty value either trips `required` or is
|
|
35
|
+
* skipped) and the row mappers (where the admin seeds every untouched field with
|
|
36
|
+
* `''`/`[]`, which storage must collapse to `null` rather than coerce, e.g.
|
|
37
|
+
* `new Date('')` → Invalid Date). One authority so the two can't drift.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isEmptyFieldValue(value: unknown): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Presentation props forwarded verbatim to the admin (and any other
|
|
42
|
+
* frontend) via `GET /api/content-schema`. The known keys are what the
|
|
43
|
+
* stock admin reads; everything else passes through untouched, so a
|
|
44
|
+
* project can attach its own hints. Must stay JSON-serializable.
|
|
45
|
+
*/
|
|
46
|
+
export interface AdminProps {
|
|
47
|
+
/** Human label; falls back to the field name. */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Help text rendered under the input. */
|
|
50
|
+
description?: string;
|
|
51
|
+
/** Input placeholder. */
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
/** Render hint, e.g. 'textarea', 'slug', 'color'. */
|
|
54
|
+
widget?: string;
|
|
55
|
+
/** Hide from the default form (still served by the API). */
|
|
56
|
+
hidden?: boolean;
|
|
57
|
+
/** Project-specific extras — passed through untouched. */
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validation rules, serialized to the admin so the same constraints
|
|
62
|
+
* render client-side. The server's EntryValidationService is the
|
|
63
|
+
* authority; the admin copy is a courtesy.
|
|
64
|
+
*/
|
|
65
|
+
export interface FieldValidation {
|
|
66
|
+
/**
|
|
67
|
+
* Minimum length (text/richtext). On a `richtext` field this counts the
|
|
68
|
+
* body's **text**, not its markup.
|
|
69
|
+
*/
|
|
70
|
+
minLength?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Maximum length (text/richtext). On a `richtext` field this counts the
|
|
73
|
+
* body's **text**, not its markup.
|
|
74
|
+
*/
|
|
75
|
+
maxLength?: number;
|
|
76
|
+
/** ECMAScript regex source the value must match (text/richtext). */
|
|
77
|
+
pattern?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Structural checking of a `richtext` body — heading order, table headers,
|
|
80
|
+
* link text, language markers. Defaults to `'on'`; `'off'` is the opt-out
|
|
81
|
+
* for a body that is not a document.
|
|
82
|
+
* @see RichTextStructureMode
|
|
83
|
+
*/
|
|
84
|
+
structure?: RichTextStructureMode;
|
|
85
|
+
/** Minimum numeric value (number/money). */
|
|
86
|
+
min?: number;
|
|
87
|
+
/** Maximum numeric value (number/money). */
|
|
88
|
+
max?: number;
|
|
89
|
+
/** Restrict to whole numbers (number). */
|
|
90
|
+
integer?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Referential action when a related row is deleted. */
|
|
93
|
+
export type RelationOnDelete = 'cascade' | 'set null' | 'restrict';
|
|
94
|
+
/**
|
|
95
|
+
* Marks a relation field as the **inverse** (back-reference) of a
|
|
96
|
+
* storage-backed relation owned by another type — the read/write "other side"
|
|
97
|
+
* of a two-way relation. An inverse field generates **no storage of its own**:
|
|
98
|
+
* it reuses the owning relation's FK column / join table, so editing either side
|
|
99
|
+
* mutates the same links and the two can never drift.
|
|
100
|
+
*/
|
|
101
|
+
export interface RelationInverseSpec {
|
|
102
|
+
/** The field name on the owning type ({@link RelationSpec.to}) that backs the link. */
|
|
103
|
+
field: string;
|
|
104
|
+
}
|
|
105
|
+
/** Runtime relation config carried by a relation field spec. */
|
|
106
|
+
export interface RelationSpec {
|
|
107
|
+
/** Lazy target — a thunk so mutually-referencing files can import each other. */
|
|
108
|
+
to: () => AnyContentType;
|
|
109
|
+
/** Many-to-many (via a generated join table) vs a single FK column. */
|
|
110
|
+
many: boolean;
|
|
111
|
+
/** FK referential action; ignored for `many` (join rows just disappear). */
|
|
112
|
+
onDelete: RelationOnDelete;
|
|
113
|
+
/**
|
|
114
|
+
* Enforce a one-to-one relation: a `UNIQUE` constraint on the single FK
|
|
115
|
+
* column so at most one owner can point at a given target. Nullable-unique,
|
|
116
|
+
* so any number of owners may have no relation (Postgres permits many NULLs
|
|
117
|
+
* in a UNIQUE column). Meaningless — and rejected at define time — for a
|
|
118
|
+
* `many` relation, whose links live in a join table.
|
|
119
|
+
*/
|
|
120
|
+
unique: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether an edit in one locale propagates this link to the record's other
|
|
123
|
+
* locale rows. Inert unless the **owner** is `i18n` (a type with no locale
|
|
124
|
+
* siblings has nothing to propagate to) and on an inverse field (which owns
|
|
125
|
+
* no storage of its own — it reuses the owning side's).
|
|
126
|
+
*
|
|
127
|
+
* `true` (the default) says the link belongs to the **record**, not to the
|
|
128
|
+
* language, which is what most relations mean: tagging the English article
|
|
129
|
+
* tags the German one too. *How* that is stored depends on the target — see
|
|
130
|
+
* `relationLocaleSync` in `extension/relation-locale-sync.ts`, which is the
|
|
131
|
+
* one place the rule lives.
|
|
132
|
+
*
|
|
133
|
+
* `false` gives each locale its own independent links. `localized: true` on
|
|
134
|
+
* a relation field is an alias for it; setting both in contradiction is
|
|
135
|
+
* rejected at define time.
|
|
136
|
+
*/
|
|
137
|
+
syncAcrossLocales: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Present only on an **inverse** field: it owns no column/table and reads the
|
|
140
|
+
* link from {@link to}'s `field` (with source/target swapped). `to` is the
|
|
141
|
+
* owning type; `onDelete`/`unique`/`syncAcrossLocales` are inert.
|
|
142
|
+
*/
|
|
143
|
+
inverse?: RelationInverseSpec;
|
|
144
|
+
}
|
|
145
|
+
/** Options shared by every field builder. */
|
|
146
|
+
export interface BaseFieldOptions {
|
|
147
|
+
/** Reject empty values; the column becomes NOT NULL. */
|
|
148
|
+
required?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* BCP-47 tag naming the language this field's content is written in, when
|
|
151
|
+
* it is not the entry's own (WCAG 3.1.2 — language of parts). For the case
|
|
152
|
+
* where the *whole* field is in another language: an `originalTitle`, a
|
|
153
|
+
* `motto`. Inside a `richtext` body a passage carries its own `lang`, so
|
|
154
|
+
* this is not how a quotation is marked.
|
|
155
|
+
*
|
|
156
|
+
* Checked for well-formedness at define time — a POSIX locale (`en_US`) or
|
|
157
|
+
* a language name (`english`… well, that one is merely unregistered) is
|
|
158
|
+
* ignored outright by assistive tech, so it is caught at boot rather than
|
|
159
|
+
* shipped.
|
|
160
|
+
*/
|
|
161
|
+
lang?: string;
|
|
162
|
+
/**
|
|
163
|
+
* The value differs per locale (valid only on an `i18n` content type —
|
|
164
|
+
* rejected at define time otherwise). A field without the flag is
|
|
165
|
+
* **shared** across a translation group: the bound localization plugin
|
|
166
|
+
* syncs its value to every sibling row on update and copies it when a
|
|
167
|
+
* translation is created.
|
|
168
|
+
*/
|
|
169
|
+
localized?: boolean;
|
|
170
|
+
/** Presentation props forwarded to the admin. */
|
|
171
|
+
admin?: AdminProps;
|
|
172
|
+
}
|
|
173
|
+
export interface TextFieldOptions extends BaseFieldOptions {
|
|
174
|
+
minLength?: number;
|
|
175
|
+
maxLength?: number;
|
|
176
|
+
/** Regex source the value must match. */
|
|
177
|
+
pattern?: string;
|
|
178
|
+
}
|
|
179
|
+
/** Options for `field.richtext()` — a structured long-form body. */
|
|
180
|
+
export interface RichTextFieldOptions extends BaseFieldOptions {
|
|
181
|
+
/** Minimum length, counted over the body's text (not its markup). */
|
|
182
|
+
minLength?: number;
|
|
183
|
+
/** Maximum length, counted over the body's text (not its markup). */
|
|
184
|
+
maxLength?: number;
|
|
185
|
+
/**
|
|
186
|
+
* Structural checking — heading order, table headers, link text, language
|
|
187
|
+
* markers. Defaults to `'on'`. Turn it `'off'` for a body that is not a
|
|
188
|
+
* document (a hand-maintained fragment, an email template), where the rules
|
|
189
|
+
* would be measuring the wrong thing.
|
|
190
|
+
*/
|
|
191
|
+
structure?: RichTextStructureMode;
|
|
192
|
+
}
|
|
193
|
+
export interface NumberFieldOptions extends BaseFieldOptions {
|
|
194
|
+
min?: number;
|
|
195
|
+
max?: number;
|
|
196
|
+
/** Restrict to whole numbers. */
|
|
197
|
+
integer?: boolean;
|
|
198
|
+
}
|
|
199
|
+
/** Money is stored as integer minor units (cents) — exact, no float drift. */
|
|
200
|
+
export interface MoneyFieldOptions extends BaseFieldOptions {
|
|
201
|
+
/** Minimum amount in minor units. */
|
|
202
|
+
min?: number;
|
|
203
|
+
/** Maximum amount in minor units. */
|
|
204
|
+
max?: number;
|
|
205
|
+
}
|
|
206
|
+
export interface SelectFieldOptions<TOptions extends readonly string[] = readonly string[]> extends BaseFieldOptions {
|
|
207
|
+
/** Allowed values. */
|
|
208
|
+
options: TOptions;
|
|
209
|
+
}
|
|
210
|
+
/** The coarse media categories the library groups assets by. */
|
|
211
|
+
export type MediaKindValue = 'image' | 'video' | 'audio' | 'document' | 'archive';
|
|
212
|
+
/** The valid {@link MediaKindValue}s, for define-time validation of `accept`. */
|
|
213
|
+
export declare const MEDIA_KIND_VALUES: readonly MediaKindValue[];
|
|
214
|
+
/**
|
|
215
|
+
* Restricts which assets a media field accepts. Both filters are optional and
|
|
216
|
+
* combine as OR within each list; an asset passes when it matches **any** listed
|
|
217
|
+
* kind **or** any listed MIME pattern (an absent `accept`, or one with neither
|
|
218
|
+
* list, accepts anything). A MIME pattern is either exact (`image/png`) or a
|
|
219
|
+
* `type/*` wildcard (`image/*`). Enforced server-side on save.
|
|
220
|
+
*/
|
|
221
|
+
export interface MediaAccept {
|
|
222
|
+
/** Allowed coarse kinds (image/video/audio/document/archive). */
|
|
223
|
+
kinds?: readonly MediaKindValue[];
|
|
224
|
+
/** Allowed MIME types — exact (`application/pdf`) or wildcard (`image/*`). */
|
|
225
|
+
mimeTypes?: readonly string[];
|
|
226
|
+
}
|
|
227
|
+
/** Options for `field.media()` — attach one or more Media Library assets. */
|
|
228
|
+
export interface MediaFieldOptions extends BaseFieldOptions {
|
|
229
|
+
/** Hold an ordered list of assets rather than a single one. Defaults false. */
|
|
230
|
+
multiple?: boolean;
|
|
231
|
+
/** Restrict the accepted assets by kind and/or MIME. Defaults to any asset. */
|
|
232
|
+
accept?: MediaAccept;
|
|
233
|
+
}
|
|
234
|
+
export interface RelationFieldOptions extends BaseFieldOptions {
|
|
235
|
+
/** Lazy target content type. */
|
|
236
|
+
to: () => AnyContentType;
|
|
237
|
+
/** Many-to-many via a generated join table. Defaults to false. */
|
|
238
|
+
many?: boolean;
|
|
239
|
+
/** FK referential action. Defaults to 'set null' (or 'cascade' when required). */
|
|
240
|
+
onDelete?: RelationOnDelete;
|
|
241
|
+
/**
|
|
242
|
+
* One-to-one: add a `UNIQUE` constraint to the single FK column. Defaults
|
|
243
|
+
* to false. Invalid with `many: true` (rejected at define time).
|
|
244
|
+
*/
|
|
245
|
+
unique?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Propagate this link to the record's other locale rows when it is edited
|
|
248
|
+
* in one of them. Defaults to `true` (to `false` when `localized: true`).
|
|
249
|
+
* Meaningful only on an `i18n` type — rejected at define time otherwise.
|
|
250
|
+
* @see RelationSpec.syncAcrossLocales
|
|
251
|
+
*/
|
|
252
|
+
syncAcrossLocales?: boolean;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Options for `field.relationInverse()` — the back-reference side of a two-way
|
|
256
|
+
* relation. It stores nothing: it mirrors the link owned by `of`'s `field`.
|
|
257
|
+
*/
|
|
258
|
+
export interface RelationInverseFieldOptions extends BaseFieldOptions {
|
|
259
|
+
/** Lazy owning content type — the side that declares the storage-backed relation. */
|
|
260
|
+
of: () => AnyContentType;
|
|
261
|
+
/** The relation field name on `of` whose link this side mirrors. */
|
|
262
|
+
field: string;
|
|
263
|
+
/**
|
|
264
|
+
* Whether this side is to-many. Defaults to `true` (the common inverse — the
|
|
265
|
+
* "one"/"far" side of a to-many or many-to-many owns many back-references).
|
|
266
|
+
*/
|
|
267
|
+
many?: boolean;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The normalized field description every builder returns.
|
|
271
|
+
*
|
|
272
|
+
* `TValue` is a phantom type — it exists only so `InferEntry` can derive
|
|
273
|
+
* the row type of a collection; nothing is stored in it at runtime.
|
|
274
|
+
*/
|
|
275
|
+
export interface FieldSpec<TType extends FieldType = FieldType, TValue = unknown> {
|
|
276
|
+
readonly type: TType;
|
|
277
|
+
readonly required: boolean;
|
|
278
|
+
/** Value differs per locale — set only on fields of `i18n` types. */
|
|
279
|
+
readonly localized?: boolean;
|
|
280
|
+
/** BCP-47 language of this field's content, when it has its own. */
|
|
281
|
+
readonly lang?: string;
|
|
282
|
+
readonly validation: FieldValidation;
|
|
283
|
+
readonly admin: AdminProps;
|
|
284
|
+
/** Allowed values — select fields only. */
|
|
285
|
+
readonly options?: readonly string[];
|
|
286
|
+
/** Relation config — relation fields only. */
|
|
287
|
+
readonly relation?: RelationSpec;
|
|
288
|
+
/** Holds an ordered list of asset ids — media fields only. */
|
|
289
|
+
readonly multiple?: boolean;
|
|
290
|
+
/** Accepted-asset restriction — media fields only. */
|
|
291
|
+
readonly accept?: MediaAccept;
|
|
292
|
+
/** Phantom compile-time value type. Never assigned. */
|
|
293
|
+
readonly _value?: TValue;
|
|
294
|
+
}
|
|
295
|
+
/** Any field spec, regardless of type/value. */
|
|
296
|
+
export type AnyFieldSpec = FieldSpec<FieldType, unknown>;
|
|
297
|
+
/** Value type of a field spec (null-aware via `required`). */
|
|
298
|
+
export type FieldValue<F> = F extends FieldSpec<FieldType, infer V> ? V : never;
|
|
299
|
+
/** Maps an options object to `V` when `required: true`, else `V | null`. */
|
|
300
|
+
export type WithRequired<O, V> = O extends {
|
|
301
|
+
required: true;
|
|
302
|
+
} ? V : V | null;
|
|
303
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/lib/types/fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAarB,CAAC;AAEX,uCAAuC;AACvC,MAAM,MAAM,SAAS,GACjB,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOzD;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACvB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM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uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAEzD,8DAA8D;AAC9D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEhF,4EAA4E;AAC5E,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Field-spec contracts for code-defined content types. A field spec is a
|
|
4
|
+
* plain, JSON-serializable description (plus a lazy relation thunk) that
|
|
5
|
+
* drives three things at once: the generated Postgres column, server-side
|
|
6
|
+
* validation, and the admin's dynamic form rendering.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MEDIA_KIND_VALUES = exports.CONTENT_FIELD_TYPE = void 0;
|
|
10
|
+
exports.isEmptyFieldValue = isEmptyFieldValue;
|
|
11
|
+
/**
|
|
12
|
+
* Built-in field type identifiers. The runtime object is the single source of
|
|
13
|
+
* truth; the {@link FieldType} union is derived from it so the two can never
|
|
14
|
+
* drift, and every `switch`/comparison references `CONTENT_FIELD_TYPE.*`
|
|
15
|
+
* instead of a bare string literal.
|
|
16
|
+
*/
|
|
17
|
+
exports.CONTENT_FIELD_TYPE = {
|
|
18
|
+
Text: 'text',
|
|
19
|
+
RichText: 'richtext',
|
|
20
|
+
Number: 'number',
|
|
21
|
+
Money: 'money',
|
|
22
|
+
Boolean: 'boolean',
|
|
23
|
+
Date: 'date',
|
|
24
|
+
Datetime: 'datetime',
|
|
25
|
+
Select: 'select',
|
|
26
|
+
Multiselect: 'multiselect',
|
|
27
|
+
Json: 'json',
|
|
28
|
+
Relation: 'relation',
|
|
29
|
+
Media: 'media'
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The canonical "no value" test for a field value — null/undefined, a blank
|
|
33
|
+
* (whitespace-only) string, or an empty array. The single definition shared by
|
|
34
|
+
* the validation service (where an empty value either trips `required` or is
|
|
35
|
+
* skipped) and the row mappers (where the admin seeds every untouched field with
|
|
36
|
+
* `''`/`[]`, which storage must collapse to `null` rather than coerce, e.g.
|
|
37
|
+
* `new Date('')` → Invalid Date). One authority so the two can't drift.
|
|
38
|
+
*/
|
|
39
|
+
function isEmptyFieldValue(value) {
|
|
40
|
+
return (value === undefined ||
|
|
41
|
+
value === null ||
|
|
42
|
+
(typeof value === 'string' && value.trim() === '') ||
|
|
43
|
+
(Array.isArray(value) && value.length === 0));
|
|
44
|
+
}
|
|
45
|
+
/** The valid {@link MediaKindValue}s, for define-time validation of `accept`. */
|
|
46
|
+
exports.MEDIA_KIND_VALUES = [
|
|
47
|
+
'image',
|
|
48
|
+
'video',
|
|
49
|
+
'audio',
|
|
50
|
+
'document',
|
|
51
|
+
'archive'
|
|
52
|
+
];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ServerPlugin } from '@orthacms/bootstrap-server';
|
|
2
|
+
import { ContentTypeRegistry } from '../registry/content-type-registry';
|
|
3
|
+
import type { AnyContentType } from '../types/content-type';
|
|
4
|
+
/** Options for {@link ContentPlugin}. */
|
|
5
|
+
export interface ContentPluginOptions {
|
|
6
|
+
/** Every code-defined content type (collections and singles). */
|
|
7
|
+
types: readonly AnyContentType[];
|
|
8
|
+
/**
|
|
9
|
+
* The HOST's migrations for the generated collection tables. The host
|
|
10
|
+
* owns this schema (its drizzle.config.ts diffs the re-exported
|
|
11
|
+
* tables), but routing the descriptor through the plugin lets the
|
|
12
|
+
* standard `db:migrate` machinery apply it with everything else.
|
|
13
|
+
*/
|
|
14
|
+
migrations?: ServerPlugin['migrations'];
|
|
15
|
+
}
|
|
16
|
+
/** The content plugin's `ServerPlugin`, exposing its registry. */
|
|
17
|
+
export interface ContentServerPlugin extends ServerPlugin {
|
|
18
|
+
registry: ContentTypeRegistry;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Content plugin factory. Builds the registry eagerly — duplicate names
|
|
22
|
+
* or unresolvable relation targets throw here, failing boot rather than
|
|
23
|
+
* the first request.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ContentPlugin({
|
|
27
|
+
* types: [post, author, home],
|
|
28
|
+
* migrations: {
|
|
29
|
+
* dir: () => join(__dirname, '../migrations'),
|
|
30
|
+
* table: '__drizzle_migrations_content'
|
|
31
|
+
* }
|
|
32
|
+
* })
|
|
33
|
+
*/
|
|
34
|
+
export declare function ContentPlugin(options: ContentPluginOptions): ContentServerPlugin;
|
|
35
|
+
//# sourceMappingURL=content-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/content-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACjC,iEAAiE;IACjE,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;CAC3C;AAED,kEAAkE;AAClE,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACrD,QAAQ,EAAE,mBAAmB,CAAC;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CACzB,OAAO,EAAE,oBAAoB,GAC9B,mBAAmB,CAerB"}
|