@webiny/api-headless-cms 6.6.0-alpha.0 → 6.6.0-alpha.10
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/HeadlessCmsFeature.js +17 -38
- package/HeadlessCmsFeature.js.map +1 -1
- package/createCmsRoute.d.ts +13 -10
- package/createCmsRoute.js +40 -18
- package/createCmsRoute.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.js +44 -11
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentModel/defaultFields.js +3 -2
- package/crud/contentModel/defaultFields.js.map +1 -1
- package/crud/contentModel/validate/endingAllowed.js +1 -1
- package/crud/contentModel/validate/endingAllowed.js.map +1 -1
- package/crud/contentModel/validate/pluralApiName.js +1 -1
- package/crud/contentModel/validate/pluralApiName.js.map +1 -1
- package/crud/contentModel/validate/singularApiName.js +1 -1
- package/crud/contentModel/validate/singularApiName.js.map +1 -1
- package/crud/contentModel/validation.js +2 -2
- package/crud/contentModel/validation.js.map +1 -1
- package/domain/contentModel/schemas.d.ts +10 -6
- package/domain/contentModel/schemas.js +6 -3
- package/domain/contentModel/schemas.js.map +1 -1
- package/domain/contentModel/validation/dateExpressions.d.ts +6 -0
- package/domain/contentModel/validation/dateExpressions.js +27 -0
- package/domain/contentModel/validation/dateExpressions.js.map +1 -0
- package/domain/contentModel/validation/endingAllowed.js +1 -1
- package/domain/contentModel/validation/endingAllowed.js.map +1 -1
- package/domain/contentModel/validation/modelFields.js +4 -2
- package/domain/contentModel/validation/modelFields.js.map +1 -1
- package/domain/contentModel/validation/pluralApiName.js +1 -1
- package/domain/contentModel/validation/pluralApiName.js.map +1 -1
- package/domain/contentModel/validation/singularApiName.js +1 -1
- package/domain/contentModel/validation/singularApiName.js.map +1 -1
- package/export/crud/exporting.js +2 -2
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/imports/importGroups.js +1 -2
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/validateModels.js +1 -1
- package/export/crud/imports/validateModels.js.map +1 -1
- package/exports/api/cms/entry.d.ts +5 -0
- package/exports/api/cms/entry.js +5 -0
- package/exports/api/cms/model.d.ts +4 -1
- package/exports/api/cms/model.js +2 -0
- package/features/ai/DescribeContentModelTool.d.ts +60 -0
- package/features/ai/DescribeContentModelTool.js +69 -0
- package/features/ai/DescribeContentModelTool.js.map +1 -0
- package/features/ai/ListContentModelsTool.d.ts +46 -0
- package/features/ai/ListContentModelsTool.js +53 -0
- package/features/ai/ListContentModelsTool.js.map +1 -0
- package/features/ai/QueryEntriesTool.d.ts +80 -0
- package/features/ai/QueryEntriesTool.js +99 -0
- package/features/ai/QueryEntriesTool.js.map +1 -0
- package/features/ai/feature.d.ts +8 -0
- package/features/ai/feature.js +15 -0
- package/features/ai/feature.js.map +1 -0
- package/features/ai/index.d.ts +4 -0
- package/features/ai/index.js +4 -0
- package/features/contentEntry/ContentEntriesFeature.js +8 -0
- package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +4 -2
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js +8 -3
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +2 -2
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +3 -4
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.d.ts +4 -2
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +8 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +2 -4
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +6 -14
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.d.ts +4 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +8 -3
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +2 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.d.ts +3 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +7 -3
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js +2 -2
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.d.ts +3 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +9 -3
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +2 -2
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.d.ts +4 -2
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +7 -3
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +11 -10
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.d.ts +17 -0
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js +83 -0
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/abstractions.d.ts +47 -0
- package/features/contentEntry/DuplicateEntry/abstractions.js +5 -0
- package/features/contentEntry/DuplicateEntry/abstractions.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/events.d.ts +41 -0
- package/features/contentEntry/DuplicateEntry/events.js +32 -0
- package/features/contentEntry/DuplicateEntry/events.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/feature.d.ts +4 -0
- package/features/contentEntry/DuplicateEntry/feature.js +11 -0
- package/features/contentEntry/DuplicateEntry/feature.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/index.d.ts +2 -0
- package/features/contentEntry/DuplicateEntry/index.js +2 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.d.ts +7 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js +12 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.d.ts +10 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js +25 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.d.ts +16 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.js +5 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/feature.d.ts +4 -0
- package/features/contentEntry/EntryEventPublisher/feature.js +11 -0
- package/features/contentEntry/EntryEventPublisher/feature.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/index.d.ts +2 -0
- package/features/contentEntry/EntryEventPublisher/index.js +2 -0
- package/features/contentEntry/EntrySystemField/abstractions.d.ts +14 -0
- package/features/contentEntry/EntrySystemField/abstractions.js +5 -0
- package/features/contentEntry/EntrySystemField/abstractions.js.map +1 -0
- package/features/contentEntry/EntrySystemField/index.d.ts +1 -0
- package/features/contentEntry/EntrySystemField/index.js +1 -0
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.d.ts +4 -4
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +8 -11
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.d.ts +4 -2
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +7 -3
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.d.ts +4 -2
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +7 -3
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.d.ts +4 -2
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +7 -3
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.d.ts +4 -2
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +7 -3
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +3 -0
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListEntriesRepository.d.ts +4 -2
- package/features/contentEntry/ListEntries/ListEntriesRepository.js +7 -3
- package/features/contentEntry/ListEntries/ListEntriesRepository.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryRepository.d.ts +4 -2
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js +7 -3
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +2 -2
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +11 -4
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js +8 -3
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +4 -6
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +11 -13
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/abstractions.d.ts +8 -1
- package/features/contentEntry/PublishEntry/abstractions.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +8 -3
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +5 -3
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.d.ts +4 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +8 -3
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.d.ts +2 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js +2 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +8 -3
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +5 -3
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.d.ts +4 -2
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +8 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +2 -2
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +5 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.d.ts +19 -0
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js +70 -0
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.d.ts +24 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.js +5 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/events.d.ts +29 -0
- package/features/contentEntry/UpdateEntrySystem/events.js +23 -0
- package/features/contentEntry/UpdateEntrySystem/events.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/feature.d.ts +4 -0
- package/features/contentEntry/UpdateEntrySystem/feature.js +11 -0
- package/features/contentEntry/UpdateEntrySystem/feature.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/index.d.ts +2 -0
- package/features/contentEntry/UpdateEntrySystem/index.js +2 -0
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
- package/features/contentEntry/ensureItemIds.d.ts +13 -0
- package/features/contentEntry/ensureItemIds.js +22 -0
- package/features/contentEntry/ensureItemIds.js.map +1 -0
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +8 -2
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +7 -3
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +46 -13
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +22 -15
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +17 -12
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +6 -6
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +17 -17
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +7 -3
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +72 -28
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/expiresAt.js +2 -2
- package/features/contentEntry/entryDataFactories/expiresAt.js.map +1 -1
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
- package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
- package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
- package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
- package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
- package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
- package/features/contentModel/ComponentMapGenerator/index.js +2 -0
- package/features/contentModel/ContentModelFeature.js +4 -0
- package/features/contentModel/ContentModelFeature.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.js +1 -2
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +1 -2
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +4 -2
- package/features/contentModel/DeleteModel/DeleteModelRepository.js +7 -3
- package/features/contentModel/DeleteModel/DeleteModelRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.d.ts +9 -4
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js +36 -21
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js.map +1 -1
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.d.ts +1 -1
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js.map +1 -1
- package/features/contentModel/ModelToAstConverter/abstractions.d.ts +1 -1
- package/features/contentModel/ModelToAstConverter/abstractions.js.map +1 -1
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
- package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
- package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
- package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
- package/features/contentModel/RefModelsGenerator/feature.js +11 -0
- package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
- package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
- package/features/contentModel/RefModelsGenerator/index.js +2 -0
- package/features/contentModel/UpdateModel/UpdateModelRepository.d.ts +4 -2
- package/features/contentModel/UpdateModel/UpdateModelRepository.js +8 -4
- package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js +2 -2
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
- package/features/contentModel/UpdateModel/abstractions.d.ts +1 -1
- package/features/contentModel/UpdateModel/abstractions.js.map +1 -1
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +5 -2
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -1
- package/features/contentModel/shared/ModelsFetcher.d.ts +6 -5
- package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
- package/features/contentModel/shared/PluginModelsProvider.d.ts +6 -3
- package/features/contentModel/shared/PluginModelsProvider.js +2 -9
- package/features/contentModel/shared/PluginModelsProvider.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +3 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +6 -4
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +4 -2
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +7 -3
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.d.ts +4 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +8 -4
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +2 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/abstractions.d.ts +1 -1
- package/features/contentModelGroup/UpdateGroup/abstractions.js.map +1 -1
- package/features/graphql/feature.js +2 -0
- package/features/graphql/feature.js.map +1 -1
- package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/AssetToGraphQL.js +153 -0
- package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js +12 -2
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/ObjectToGraphQL.js +8 -5
- package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/RefToGraphQL.js +24 -10
- package/features/graphql/fields/base/RefToGraphQL.js.map +1 -1
- package/features/modelBuilder/abstractions.d.ts +13 -0
- package/features/modelBuilder/abstractions.js.map +1 -1
- package/features/modelBuilder/feature.js +3 -8
- package/features/modelBuilder/feature.js.map +1 -1
- package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
- package/features/modelBuilder/fields/AssetFieldType.js +46 -0
- package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
- package/features/modelBuilder/fields/BaseFieldBuilder.d.ts +3 -1
- package/features/modelBuilder/fields/BaseFieldBuilder.js +4 -0
- package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DataFieldBuilder.d.ts +59 -0
- package/features/modelBuilder/fields/DataFieldBuilder.js +11 -1
- package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DateTimeFieldType.js +27 -12
- package/features/modelBuilder/fields/DateTimeFieldType.js.map +1 -1
- package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
- package/features/modelBuilder/fields/DynamicZoneFieldType.js +10 -9
- package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
- package/features/modelBuilder/fields/UiAlertFieldType.js +2 -1
- package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -1
- package/features/modelBuilder/fields/UiSeparatorFieldType.js +2 -1
- package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -1
- package/features/modelBuilder/fields/UiTabsFieldType.d.ts +2 -1
- package/features/modelBuilder/fields/UiTabsFieldType.js +6 -3
- package/features/modelBuilder/fields/UiTabsFieldType.js.map +1 -1
- package/features/modelBuilder/fields/fieldTypeValidator.d.ts +5 -3
- package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
- package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
- package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
- package/features/modelBuilder/index.d.ts +1 -1
- package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
- package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
- package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/ModelBuilder.d.ts +8 -0
- package/features/modelBuilder/models/ModelBuilder.js +1 -0
- package/features/modelBuilder/models/ModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/ModelsProvider.d.ts +1 -3
- package/features/modelBuilder/models/ModelsProvider.js +2 -7
- package/features/modelBuilder/models/ModelsProvider.js.map +1 -1
- package/features/modelBuilder/models/PrivateModelBuilder.d.ts +5 -0
- package/features/modelBuilder/models/PrivateModelBuilder.js +13 -1
- package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
- package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
- package/features/modelStorageSync/ModelStorageSyncTask.d.ts +31 -0
- package/features/modelStorageSync/ModelStorageSyncTask.js +66 -0
- package/features/modelStorageSync/ModelStorageSyncTask.js.map +1 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.d.ts +23 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.js +51 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.js.map +1 -0
- package/features/modelStorageSync/abstractions.d.ts +34 -0
- package/features/modelStorageSync/abstractions.js +6 -0
- package/features/modelStorageSync/abstractions.js.map +1 -0
- package/features/modelStorageSync/feature.d.ts +8 -0
- package/features/modelStorageSync/feature.js +13 -0
- package/features/modelStorageSync/feature.js.map +1 -0
- package/features/modelStorageSync/index.d.ts +2 -0
- package/features/modelStorageSync/index.js +2 -0
- package/features/runtimeTenant/RuntimeTenant.d.ts +13 -0
- package/features/runtimeTenant/RuntimeTenant.js +22 -0
- package/features/runtimeTenant/RuntimeTenant.js.map +1 -0
- package/features/runtimeTenant/abstractions.d.ts +11 -0
- package/features/runtimeTenant/abstractions.js +5 -0
- package/features/runtimeTenant/abstractions.js.map +1 -0
- package/features/runtimeTenant/index.d.ts +2 -0
- package/features/runtimeTenant/index.js +2 -0
- package/features/shared/abstractions.d.ts +1 -5
- package/features/shared/abstractions.js +1 -2
- package/features/shared/abstractions.js.map +1 -1
- package/features/sortMapper/SortMapper.js +2 -5
- package/features/sortMapper/SortMapper.js.map +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js.map +1 -1
- package/features/storage/fields/DateStorageTransform.js +3 -4
- package/features/storage/fields/DateStorageTransform.js.map +1 -1
- package/features/storage/fields/DynamicZoneStorageTransform.js +2 -2
- package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -1
- package/features/storage/fields/JsonStorageTransform.js +1 -1
- package/features/storage/fields/JsonStorageTransform.js.map +1 -1
- package/features/storage/fields/LongTextStorageTransform.js +1 -1
- package/features/storage/fields/LongTextStorageTransform.js.map +1 -1
- package/features/storage/fields/ObjectStorageTransform.js +27 -7
- package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
- package/features/storage/fields/RichTextStorageTransform.js +1 -1
- package/features/storage/fields/RichTextStorageTransform.js.map +1 -1
- package/features/validation/abstractions/CmsModelFieldValidator.d.ts +5 -0
- package/features/validation/abstractions/CmsModelFieldValidator.js.map +1 -1
- package/features/validation/validators/DateGteValidator.d.ts +2 -0
- package/features/validation/validators/DateGteValidator.js +12 -2
- package/features/validation/validators/DateGteValidator.js.map +1 -1
- package/features/validation/validators/DateLteValidator.d.ts +2 -0
- package/features/validation/validators/DateLteValidator.js +12 -2
- package/features/validation/validators/DateLteValidator.js.map +1 -1
- package/features/validation/validators/PatternValidator.js +1 -1
- package/features/validation/validators/PatternValidator.js.map +1 -1
- package/features/validation/validators/dateLimit.d.ts +9 -0
- package/features/validation/validators/dateLimit.js +18 -0
- package/features/validation/validators/dateLimit.js.map +1 -0
- package/features/whereMapper/WhereMapper.js +8 -8
- package/features/whereMapper/WhereMapper.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +15 -5
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/graphql/checkEndpointAccess.d.ts +7 -2
- package/graphql/checkEndpointAccess.js +2 -4
- package/graphql/checkEndpointAccess.js.map +1 -1
- package/graphql/getSchema/generateCacheKey.js +1 -1
- package/graphql/getSchema/generateCacheKey.js.map +1 -1
- package/graphql/scalars/RevisionId.js +1 -1
- package/graphql/scalars/RevisionId.js.map +1 -1
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.d.ts +1 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js +4 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js.map +1 -1
- package/graphql/schema/cms/getEntryResolver.js +3 -2
- package/graphql/schema/cms/getEntryResolver.js.map +1 -1
- package/graphql/schema/cms/getModelResolver.d.ts +35 -0
- package/graphql/schema/cms/getModelResolver.js +49 -0
- package/graphql/schema/cms/getModelResolver.js.map +1 -0
- package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
- package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
- package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
- package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
- package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
- package/graphql/schema/cms/helpers/index.d.ts +1 -0
- package/graphql/schema/cms/helpers/index.js +1 -0
- package/graphql/schema/cms/helpers/transformWhereToNested.js +39 -17
- package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -1
- package/graphql/schema/cms/helpers.d.ts +1 -0
- package/graphql/schema/cms/helpers.js +1 -0
- package/graphql/schema/cms/listEntriesResolver.js +3 -2
- package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
- package/graphql/schema/cms/resolvers/createEntry.d.ts +1 -0
- package/graphql/schema/cms/resolvers/createEntry.js +4 -0
- package/graphql/schema/cms/resolvers/createEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/getEntry.d.ts +1 -0
- package/graphql/schema/cms/resolvers/getEntry.js +4 -0
- package/graphql/schema/cms/resolvers/getEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/getModel.d.ts +9 -0
- package/graphql/schema/cms/resolvers/getModel.js +22 -0
- package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
- package/graphql/schema/cms/resolvers/index.d.ts +1 -0
- package/graphql/schema/cms/resolvers/index.js +1 -0
- package/graphql/schema/cms/resolvers/listEntries.d.ts +1 -0
- package/graphql/schema/cms/resolvers/listEntries.js +4 -0
- package/graphql/schema/cms/resolvers/listEntries.js.map +1 -1
- package/graphql/schema/cms/resolvers/mutationCms.d.ts +1 -0
- package/graphql/schema/cms/resolvers/mutationCms.js +4 -0
- package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/publishEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/queryCms.d.ts +1 -0
- package/graphql/schema/cms/resolvers/queryCms.js +4 -0
- package/graphql/schema/cms/resolvers/queryCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/updateEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -1
- package/graphql/schema/cms/typeDefs/mutation.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/mutation.js +4 -0
- package/graphql/schema/cms/typeDefs/mutation.js.map +1 -1
- package/graphql/schema/cms/typeDefs/query.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/query.js +5 -0
- package/graphql/schema/cms/typeDefs/query.js.map +1 -1
- package/graphql/schema/cms/typeDefs/responses.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/responses.js +9 -0
- package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
- package/graphql/schema/contentEntries.js +19 -4
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModels.js +33 -0
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.js +1 -1
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageResolvers.js +3 -1
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +2 -0
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDuplicate.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDuplicate.js +11 -0
- package/graphql/schema/resolvers/manage/resolveDuplicate.js.map +1 -0
- package/package.json +24 -25
- package/plugins/CmsModelPlugin.js +11 -11
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/types/fields/dynamicZoneField.d.ts +3 -2
- package/types/index.d.ts +0 -1
- package/types/model.d.ts +6 -0
- package/types/modelField.d.ts +14 -1
- package/types/types.d.ts +14 -109
- package/types/types.js.map +1 -1
- package/utils/caching/Cache.js +1 -1
- package/utils/caching/Cache.js.map +1 -1
- package/utils/createModelField.js +2 -1
- package/utils/createModelField.js.map +1 -1
- package/utils/createModelSchemaKey.d.ts +8 -0
- package/utils/createModelSchemaKey.js +18 -0
- package/utils/createModelSchemaKey.js.map +1 -0
- package/utils/date.js +1 -1
- package/utils/date.js.map +1 -1
- package/utils/entryStorage.js +1 -1
- package/utils/entryStorage.js.map +1 -1
- package/utils/renderFields.js +1 -1
- package/utils/renderFields.js.map +1 -1
- package/HeadlessCmsContextualSchema.d.ts +0 -16
- package/HeadlessCmsContextualSchema.js +0 -32
- package/HeadlessCmsContextualSchema.js.map +0 -1
- package/crud/contentEntry.crud.d.ts +0 -6
- package/crud/contentEntry.crud.js +0 -336
- package/crud/contentEntry.crud.js.map +0 -1
- package/crud/contentModel.crud.d.ts +0 -5
- package/crud/contentModel.crud.js +0 -79
- package/crud/contentModel.crud.js.map +0 -1
- package/crud/contentModelGroup.crud.d.ts +0 -5
- package/crud/contentModelGroup.crud.js +0 -76
- package/crud/contentModelGroup.crud.js.map +0 -1
- package/types/context.d.ts +0 -110
- package/types/context.js +0 -0
|
@@ -6,6 +6,7 @@ const rendererNameMap = {
|
|
|
6
6
|
checkboxes: "checkboxes",
|
|
7
7
|
dateTimeInput: "date-time-input",
|
|
8
8
|
dateTimeInputs: "date-time-inputs",
|
|
9
|
+
birthdayInput: "birthday-input",
|
|
9
10
|
dynamicZone: "dynamicZone",
|
|
10
11
|
hidden: "hidden",
|
|
11
12
|
lexicalEditor: "lexical-text-input",
|
|
@@ -24,12 +25,15 @@ const rendererNameMap = {
|
|
|
24
25
|
refAutocompleteMultiple: "ref-inputs",
|
|
25
26
|
refCheckboxes: "ref-simple-multiple",
|
|
26
27
|
refRadioButtons: "ref-simple-single",
|
|
28
|
+
select: "select-box",
|
|
27
29
|
dropdown: "select-box",
|
|
28
30
|
tags: "tags",
|
|
29
31
|
textInput: "text-input",
|
|
30
32
|
textInputs: "text-inputs",
|
|
31
33
|
file: "file-input",
|
|
32
34
|
files: "file-inputs",
|
|
35
|
+
assetField: "asset-input",
|
|
36
|
+
assetFields: "asset-inputs",
|
|
33
37
|
uiSeparator: "uiSeparator",
|
|
34
38
|
uiAlert: "uiAlert",
|
|
35
39
|
uiTabs: "uiTabs"
|
|
@@ -77,6 +81,10 @@ class DataFieldBuilder extends BaseFieldBuilder {
|
|
|
77
81
|
this.config.list = true;
|
|
78
82
|
return this;
|
|
79
83
|
}
|
|
84
|
+
disabled(value = true) {
|
|
85
|
+
this.config.disabled = value;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
80
88
|
tags(tags) {
|
|
81
89
|
this.config.tags = tags;
|
|
82
90
|
return this;
|
|
@@ -147,6 +155,7 @@ class DataFieldBuilder extends BaseFieldBuilder {
|
|
|
147
155
|
validation: this.config.validation || [],
|
|
148
156
|
listValidation: this.config.listValidation || [],
|
|
149
157
|
list: this.config.list || false,
|
|
158
|
+
disabled: this.config.disabled || false,
|
|
150
159
|
predefinedValues: this.config.predefinedValues || {
|
|
151
160
|
enabled: false,
|
|
152
161
|
values: []
|
|
@@ -157,7 +166,8 @@ class DataFieldBuilder extends BaseFieldBuilder {
|
|
|
157
166
|
note: this.config.note || null,
|
|
158
167
|
renderer: this.config.renderer || null,
|
|
159
168
|
settings: this.config.settings || {},
|
|
160
|
-
tags: this.config.tags || []
|
|
169
|
+
tags: this.config.tags || [],
|
|
170
|
+
rules: this.config.rules
|
|
161
171
|
}
|
|
162
172
|
};
|
|
163
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/DataFieldBuilder.js","sources":["../../../../src/features/modelBuilder/fields/DataFieldBuilder.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase.js\";\nimport type {\n CmsModelField,\n CmsModelFieldPredefinedValues,\n CmsModelFieldValidation\n} from \"~/types/index.js\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport { BaseFieldBuilder, type DataFieldBuildResult } from \"./BaseFieldBuilder.js\";\n\nexport interface FieldBuilderConfig extends Omit<\n CmsModelField,\n \"id\" | \"fieldId\" | \"storageId\" | \"type\"\n> {\n _storageId?: string;\n _fieldId?: string;\n description?: string | null;\n note?: string | null;\n}\n\n/**\n * Augmentable renderer registry. Each entry maps a renderer name to its applicable field type(s) and settings.\n */\nexport interface IFieldRendererRegistry {\n switch: {\n fieldType: \"boolean\";\n settings: undefined;\n };\n checkboxes: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n dateTimeInput: {\n fieldType: \"datetime\";\n settings: undefined;\n };\n dateTimeInputs: {\n fieldType: \"datetime\";\n settings?: {\n addItemLabel?: string;\n };\n };\n dynamicZone: {\n fieldType: \"dynamicZone\";\n settings?: {\n open?: boolean;\n };\n };\n hidden: {\n fieldType: string;\n settings: undefined;\n };\n lexicalEditor: {\n fieldType: \"rich-text\";\n settings: undefined;\n };\n lexicalEditors: {\n fieldType: \"rich-text\";\n settings?: {\n addItemLabel?: string;\n };\n };\n textarea: {\n fieldType: \"long-text\";\n settings: undefined;\n };\n textareas: {\n fieldType: \"long-text\";\n settings: {\n addItemLabel?: string;\n };\n };\n numberInput: {\n fieldType: \"number\";\n settings: undefined;\n };\n numberInputs: {\n fieldType: \"number\";\n settings?: {\n addItemLabel?: string;\n };\n };\n objectAccordionSingle: {\n fieldType: \"object\";\n settings?: {\n open?: boolean;\n container?: boolean;\n itemTitle?: string;\n itemDescription?: string;\n };\n };\n objectAccordionMultiple: {\n fieldType: \"object\";\n settings?: {\n open?: boolean;\n container?: boolean;\n itemTitle?: string;\n itemDescription?: string;\n addItemLabel?: string;\n };\n };\n passthrough: {\n fieldType: string;\n settings: undefined;\n };\n radioButtons: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n refDialogSingle: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refDialogMultiple: {\n fieldType: \"ref\";\n settings?: {\n newItemPosition?: \"first\" | \"last\";\n };\n };\n refAutocompleteSingle: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refAutocompleteMultiple: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refCheckboxes: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refRadioButtons: {\n fieldType: \"ref\";\n settings: undefined;\n };\n dropdown: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n tags: {\n fieldType: \"text\";\n settings: undefined;\n };\n textInput: {\n fieldType: \"text\";\n settings: undefined;\n };\n textInputs: {\n fieldType: \"text\";\n settings?: {\n addItemLabel?: string;\n };\n };\n file: {\n fieldType: \"file\";\n settings?: {\n imagesOnly?: boolean;\n };\n };\n files: {\n fieldType: \"file\";\n settings?: {\n imagesOnly?: boolean;\n };\n };\n uiSeparator: {\n fieldType: \"ui\";\n settings: undefined;\n };\n uiAlert: {\n fieldType: \"ui\";\n settings: {\n type: \"info\" | \"success\" | \"warning\" | \"danger\";\n };\n };\n uiTabs: {\n fieldType: \"ui\";\n settings: undefined;\n };\n}\n\n/**\n * Maps camelCase renderer names (used in the builder API) to the\n * kebab-case names expected by the frontend renderer registry.\n */\nconst rendererNameMap: Record<keyof IFieldRendererRegistry, string> = {\n switch: \"boolean-input\",\n checkboxes: \"checkboxes\",\n dateTimeInput: \"date-time-input\",\n dateTimeInputs: \"date-time-inputs\",\n dynamicZone: \"dynamicZone\",\n hidden: \"hidden\",\n lexicalEditor: \"lexical-text-input\",\n lexicalEditors: \"lexical-text-inputs\",\n textarea: \"long-text-text-area\",\n textareas: \"long-text-inputs\",\n numberInput: \"number-input\",\n numberInputs: \"number-inputs\",\n objectAccordionSingle: \"object-accordion\",\n objectAccordionMultiple: \"objects-accordion\",\n passthrough: \"passthrough\",\n radioButtons: \"radio-buttons\",\n refDialogSingle: \"ref-advanced-single\",\n refDialogMultiple: \"ref-advanced-multiple\",\n refAutocompleteSingle: \"ref-input\",\n refAutocompleteMultiple: \"ref-inputs\",\n refCheckboxes: \"ref-simple-multiple\",\n refRadioButtons: \"ref-simple-single\",\n dropdown: \"select-box\",\n tags: \"tags\",\n textInput: \"text-input\",\n textInputs: \"text-inputs\",\n file: \"file-input\",\n files: \"file-inputs\",\n uiSeparator: \"uiSeparator\",\n uiAlert: \"uiAlert\",\n uiTabs: \"uiTabs\"\n};\n\n/**\n * Resolves a camelCase renderer name to the kebab-case name used by the frontend.\n */\nfunction resolveRendererName(name: string): string {\n return rendererNameMap[name as keyof IFieldRendererRegistry] ?? name;\n}\n\n/**\n * Extracts renderer names valid for the given field type.\n * When TType is a broad `string`, all renderer names are returned.\n */\nexport type FieldRendererName<TType extends string = string> = string extends TType\n ? keyof IFieldRendererRegistry & string\n : {\n [K in keyof IFieldRendererRegistry]: TType extends IFieldRendererRegistry[K][\"fieldType\"]\n ? K\n : never;\n }[keyof IFieldRendererRegistry] &\n string;\n\nexport type FieldRendererSettings<TName extends string> = TName extends keyof IFieldRendererRegistry\n ? IFieldRendererRegistry[TName][\"settings\"]\n : Record<string, any> | undefined;\n\n/**\n * DataFieldBuilder class for data fields that produce CmsModelField instances.\n * Provides storageId, list, validation, renderer, and other data-field methods.\n */\nexport class DataFieldBuilder<TType extends string = string> extends BaseFieldBuilder<TType> {\n protected override config: FieldBuilderConfig;\n\n public constructor(type: TType, label?: string) {\n super(type, label);\n this.config = {\n label: label || \"\",\n validation: [],\n listValidation: [],\n list: false,\n predefinedValues: {\n enabled: false,\n values: []\n },\n help: null,\n placeholder: null,\n description: null,\n note: null,\n renderer: null,\n settings: {},\n tags: []\n };\n }\n\n placeholder(text: string): this {\n this.config.placeholder = text;\n return this;\n }\n\n storageId(id: string): this {\n // We do not allow developers to specify the field type!\n this.config._storageId = id.split(\"@\").pop();\n return this;\n }\n\n defaultValue(value: any): this {\n this.config.settings = { ...this.config.settings, defaultValue: value };\n return this;\n }\n\n list(): this {\n this.config.list = true;\n return this as this;\n }\n\n tags(tags: string[]): this {\n this.config.tags = tags;\n return this;\n }\n\n /**\n * List validators - these methods are available after calling list()\n */\n listMinLength(value: number, message?: string): this {\n return this.listValidation({\n name: \"minLength\",\n message: message || `At least ${value} item(s) required.`,\n settings: { value }\n });\n }\n\n listMaxLength(value: number, message?: string): this {\n return this.listValidation({\n name: \"maxLength\",\n message: message || `At most ${value} item(s) allowed.`,\n settings: { value }\n });\n }\n\n /**\n * Add a validation rule to this field.\n * This method is protected and should only be used by field-specific validator methods.\n * @internal\n */\n protected validation(validation: CmsModelFieldValidation): this {\n this.config.validation = this.config.validation || [];\n this.config.validation.push(validation);\n return this;\n }\n\n /**\n * Add a list validation rule to this field (for list fields).\n * This method is protected and should only be used by field-specific validator methods.\n * @internal\n */\n protected listValidation(validation: CmsModelFieldValidation): this {\n this.config.listValidation = this.config.listValidation || [];\n this.config.listValidation.push(validation);\n return this;\n }\n\n predefinedValues(values: CmsModelFieldPredefinedValues[\"values\"]): this {\n this.config.predefinedValues = {\n enabled: true,\n values\n };\n return this;\n }\n\n renderer<TName extends FieldRendererName<TType>>(\n name: TName,\n ...args: undefined extends FieldRendererSettings<TName>\n ? [settings?: FieldRendererSettings<TName>]\n : FieldRendererSettings<TName> extends undefined\n ? []\n : [settings: FieldRendererSettings<TName>]\n ): this {\n this.config.renderer = {\n name: resolveRendererName(name),\n settings: args[0] ?? null\n };\n return this;\n }\n\n settings(settings: Record<string, any>): this {\n this.config.settings = { ...this.config.settings, ...settings };\n return this;\n }\n\n /**\n * Build the final CmsModelField\n * @internal\n */\n build(): DataFieldBuildResult {\n const fieldId = this.config._fieldId || camelCase(this.config.label);\n const baseType = getBaseFieldType({\n type: this.type\n });\n const storageId = `${baseType}@${this.config._storageId ?? fieldId}`;\n\n return {\n type: \"data\",\n field: {\n id: fieldId,\n fieldId,\n storageId,\n type: this.getFieldType(),\n label: this.config.label,\n validation: this.config.validation || [],\n listValidation: this.config.listValidation || [],\n list: this.config.list || false,\n predefinedValues: this.config.predefinedValues || {\n enabled: false,\n values: []\n },\n help: this.config.help || null,\n placeholder: this.config.placeholder || null,\n description: this.config.description || null,\n note: this.config.note || null,\n renderer: this.config.renderer || null,\n settings: this.config.settings || {},\n tags: this.config.tags || []\n }\n };\n }\n\n private getFieldType(): string {\n if (!this.subType?.length) {\n return this.type;\n }\n return `${this.type}:${this.subType}`;\n }\n}\n"],"names":["rendererNameMap","resolveRendererName","name","DataFieldBuilder","BaseFieldBuilder","type","label","text","id","value","tags","message","validation","values","args","settings","fieldId","camelCase","baseType","getBaseFieldType","storageId"],"mappings":";;;AAwLA,MAAMA,kBAAgE;IAClE,QAAQ;IACR,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,QAAQ;IACR,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,aAAa;IACb,cAAc;IACd,uBAAuB;IACvB,yBAAyB;IACzB,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,uBAAuB;IACvB,yBAAyB;IACzB,eAAe;IACf,iBAAiB;IACjB,UAAU;IACV,MAAM;IACN,WAAW;IACX,YAAY;IACZ,MAAM;IACN,OAAO;IACP,aAAa;IACb,SAAS;IACT,QAAQ;AACZ;AAKA,SAASC,oBAAoBC,IAAY;IACrC,OAAOF,eAAe,CAACE,KAAqC,IAAIA;AACpE;AAuBO,MAAMC,yBAAwDC;IAGjE,YAAmBC,IAAW,EAAEC,KAAc,CAAE;QAC5C,KAAK,CAACD,MAAMC;QACZ,IAAI,CAAC,MAAM,GAAG;YACV,OAAOA,SAAS;YAChB,YAAY,EAAE;YACd,gBAAgB,EAAE;YAClB,MAAM;YACN,kBAAkB;gBACd,SAAS;gBACT,QAAQ,EAAE;YACd;YACA,MAAM;YACN,aAAa;YACb,aAAa;YACb,MAAM;YACN,UAAU;YACV,UAAU,CAAC;YACX,MAAM,EAAE;QACZ;IACJ;IAEA,YAAYC,IAAY,EAAQ;QAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,GAAGA;QAC1B,OAAO,IAAI;IACf;IAEA,UAAUC,EAAU,EAAQ;QAExB,IAAI,CAAC,MAAM,CAAC,UAAU,GAAGA,GAAG,KAAK,CAAC,KAAK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Q,IAAI;gBAClC,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC;gBACnC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;YAChC;QACJ;IACJ;IAEQ,eAAuB;QAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QACf,OAAO,IAAI,CAAC,IAAI;QAEpB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE;IACzC;AACJ"}
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/DataFieldBuilder.js","sources":["../../../../src/features/modelBuilder/fields/DataFieldBuilder.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase.js\";\nimport type {\n CmsModelField,\n CmsModelFieldPredefinedValues,\n CmsModelFieldValidation\n} from \"~/types/index.js\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport { BaseFieldBuilder, type DataFieldBuildResult } from \"./BaseFieldBuilder.js\";\n\nexport interface FieldBuilderConfig extends Omit<\n CmsModelField,\n \"id\" | \"fieldId\" | \"storageId\" | \"type\"\n> {\n _storageId?: string;\n _fieldId?: string;\n description?: string | null;\n note?: string | null;\n}\n\n/**\n * Augmentable renderer registry. Each entry maps a renderer name to its applicable field type(s) and settings.\n */\nexport interface IFieldRendererRegistry {\n switch: {\n fieldType: \"boolean\";\n settings: undefined;\n };\n checkboxes: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n dateTimeInput: {\n fieldType: \"datetime\";\n settings: undefined;\n };\n /**\n * Picks a day, then a month, then a year. For date-only fields (`dateOnly()`); single-value\n * only, not for `.list()`. It offers only the dates the field's `dateGte`/`dateLte` limits\n * allow; without limits, years run from this year back 120 years.\n */\n birthdayInput: {\n fieldType: \"datetime\";\n settings: undefined;\n };\n dateTimeInputs: {\n fieldType: \"datetime\";\n settings?: {\n addItemLabel?: string;\n };\n };\n dynamicZone: {\n fieldType: \"dynamicZone\";\n settings?: {\n /** Whether the accordion is expanded by default. */\n open?: boolean;\n /** Wrap the zone in a container panel. Set to `false` for a flat inline layout. */\n container?: boolean;\n /** Label for the \"add item\" button (defaults to \"Add Item\"). */\n addItemLabel?: string;\n };\n };\n hidden: {\n fieldType: string;\n settings: undefined;\n };\n lexicalEditor: {\n fieldType: \"rich-text\";\n settings: undefined;\n };\n lexicalEditors: {\n fieldType: \"rich-text\";\n settings?: {\n addItemLabel?: string;\n };\n };\n textarea: {\n fieldType: \"long-text\";\n settings: undefined;\n };\n textareas: {\n fieldType: \"long-text\";\n settings: {\n addItemLabel?: string;\n };\n };\n numberInput: {\n fieldType: \"number\";\n settings: undefined;\n };\n numberInputs: {\n fieldType: \"number\";\n settings?: {\n addItemLabel?: string;\n };\n };\n objectAccordionSingle: {\n fieldType: \"object\";\n settings?: {\n /** Whether the accordion is expanded by default. */\n open?: boolean;\n /** Wrap the object in a container panel. Set to `false` for a flat inline layout. */\n container?: boolean;\n /** Field ID whose value is used as the accordion title, or a function receiving the object data. */\n itemTitle?: string;\n /** Field ID whose value is used as the accordion description, or a function receiving the object data. */\n itemDescription?: string;\n };\n };\n objectAccordionMultiple: {\n fieldType: \"object\";\n settings?: {\n /** Whether each accordion item is expanded by default. */\n open?: boolean;\n /** Wrap the list in a container panel. Set to `false` for a flat inline layout. */\n container?: boolean;\n /** Field ID whose value is used as each item's accordion title. */\n itemTitle?: string;\n /** Field ID whose value is used as each item's accordion description. */\n itemDescription?: string;\n /** Label for the \"add item\" button (defaults to \"Add {fieldLabel}\"). */\n addItemLabel?: string;\n };\n };\n passthrough: {\n fieldType: string;\n settings: undefined;\n };\n radioButtons: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n refDialogSingle: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refDialogMultiple: {\n fieldType: \"ref\";\n settings?: {\n /** Where newly picked references are inserted: `\"first\"` (top) or `\"last\"` (bottom, default). */\n newItemPosition?: \"first\" | \"last\";\n };\n };\n refAutocompleteSingle: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refAutocompleteMultiple: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refCheckboxes: {\n fieldType: \"ref\";\n settings: undefined;\n };\n refRadioButtons: {\n fieldType: \"ref\";\n settings: undefined;\n };\n select: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n /** @deprecated Use \"select\" instead. */\n dropdown: {\n fieldType: \"text\" | \"number\";\n settings: undefined;\n };\n tags: {\n fieldType: \"text\";\n settings: undefined;\n };\n textInput: {\n fieldType: \"text\";\n settings: undefined;\n };\n textInputs: {\n fieldType: \"text\";\n settings?: {\n addItemLabel?: string;\n };\n };\n /** @deprecated Use `assetField` instead. */\n file: {\n fieldType: \"file\";\n settings?: {\n /** Only allow image files to be selected. */\n imagesOnly?: boolean;\n };\n };\n /** @deprecated Use `assetFields` instead. */\n files: {\n fieldType: \"file\";\n settings?: {\n /** Only allow image files to be selected. */\n imagesOnly?: boolean;\n };\n };\n assetField: {\n fieldType: \"asset\";\n settings?: {\n /** Only allow image files to be selected. */\n imagesOnly?: boolean;\n /** MIME types or extensions to allow (e.g. `[\"image/png\", \"application/pdf\"]`). Leave empty to allow all. */\n accept?: string[];\n };\n };\n assetFields: {\n fieldType: \"asset\";\n settings?: {\n /** Only allow image files to be selected. */\n imagesOnly?: boolean;\n /** MIME types or extensions to allow (e.g. `[\"image/png\", \"application/pdf\"]`). Leave empty to allow all. */\n accept?: string[];\n };\n };\n uiSeparator: {\n fieldType: \"ui\";\n settings: undefined;\n };\n uiAlert: {\n fieldType: \"ui\";\n settings: {\n type: \"info\" | \"success\" | \"warning\" | \"danger\";\n };\n };\n uiTabs: {\n fieldType: \"ui\";\n settings: undefined;\n };\n}\n\n/**\n * Maps camelCase renderer names (used in the builder API) to the\n * kebab-case names expected by the frontend renderer registry.\n */\nconst rendererNameMap: Record<keyof IFieldRendererRegistry, string> = {\n switch: \"boolean-input\",\n checkboxes: \"checkboxes\",\n dateTimeInput: \"date-time-input\",\n dateTimeInputs: \"date-time-inputs\",\n birthdayInput: \"birthday-input\",\n dynamicZone: \"dynamicZone\",\n hidden: \"hidden\",\n lexicalEditor: \"lexical-text-input\",\n lexicalEditors: \"lexical-text-inputs\",\n textarea: \"long-text-text-area\",\n textareas: \"long-text-inputs\",\n numberInput: \"number-input\",\n numberInputs: \"number-inputs\",\n objectAccordionSingle: \"object-accordion\",\n objectAccordionMultiple: \"objects-accordion\",\n passthrough: \"passthrough\",\n radioButtons: \"radio-buttons\",\n refDialogSingle: \"ref-advanced-single\",\n refDialogMultiple: \"ref-advanced-multiple\",\n refAutocompleteSingle: \"ref-input\",\n refAutocompleteMultiple: \"ref-inputs\",\n refCheckboxes: \"ref-simple-multiple\",\n refRadioButtons: \"ref-simple-single\",\n select: \"select-box\",\n dropdown: \"select-box\",\n tags: \"tags\",\n textInput: \"text-input\",\n textInputs: \"text-inputs\",\n file: \"file-input\",\n files: \"file-inputs\",\n assetField: \"asset-input\",\n assetFields: \"asset-inputs\",\n uiSeparator: \"uiSeparator\",\n uiAlert: \"uiAlert\",\n uiTabs: \"uiTabs\"\n};\n\n/**\n * Resolves a camelCase renderer name to the kebab-case name used by the frontend.\n */\nfunction resolveRendererName(name: string): string {\n return rendererNameMap[name as keyof IFieldRendererRegistry] ?? name;\n}\n\n/**\n * Extracts renderer names valid for the given field type.\n * When TType is a broad `string`, all renderer names are returned.\n */\nexport type FieldRendererName<TType extends string = string> = string extends TType\n ? keyof IFieldRendererRegistry & string\n : {\n [K in keyof IFieldRendererRegistry]: TType extends IFieldRendererRegistry[K][\"fieldType\"]\n ? K\n : never;\n }[keyof IFieldRendererRegistry] &\n string;\n\nexport type FieldRendererSettings<TName extends string> = TName extends keyof IFieldRendererRegistry\n ? IFieldRendererRegistry[TName][\"settings\"]\n : Record<string, any> | undefined;\n\n/**\n * DataFieldBuilder class for data fields that produce CmsModelField instances.\n * Provides storageId, list, validation, renderer, and other data-field methods.\n */\nexport class DataFieldBuilder<TType extends string = string> extends BaseFieldBuilder<TType> {\n protected override config: FieldBuilderConfig;\n\n public constructor(type: TType, label?: string) {\n super(type, label);\n this.config = {\n label: label || \"\",\n validation: [],\n listValidation: [],\n list: false,\n predefinedValues: {\n enabled: false,\n values: []\n },\n help: null,\n placeholder: null,\n description: null,\n note: null,\n renderer: null,\n settings: {},\n tags: []\n };\n }\n\n placeholder(text: string): this {\n this.config.placeholder = text;\n return this;\n }\n\n storageId(id: string): this {\n // We do not allow developers to specify the field type!\n this.config._storageId = id.split(\"@\").pop();\n return this;\n }\n\n defaultValue(value: any): this {\n this.config.settings = { ...this.config.settings, defaultValue: value };\n return this;\n }\n\n list(): this {\n this.config.list = true;\n return this as this;\n }\n\n /**\n * Renders the field in the admin app, but doesn't let anyone edit its value.\n * Handy for values your own code owns, like an external ID or a generated slug.\n *\n * Only the admin app honours this. The API doesn't check it, so the field can\n * still be written to over GraphQL.\n */\n disabled(value = true): this {\n this.config.disabled = value;\n return this;\n }\n\n tags(tags: string[]): this {\n this.config.tags = tags;\n return this;\n }\n\n /**\n * List validators - these methods are available after calling list()\n */\n listMinLength(value: number, message?: string): this {\n return this.listValidation({\n name: \"minLength\",\n message: message || `At least ${value} item(s) required.`,\n settings: { value }\n });\n }\n\n listMaxLength(value: number, message?: string): this {\n return this.listValidation({\n name: \"maxLength\",\n message: message || `At most ${value} item(s) allowed.`,\n settings: { value }\n });\n }\n\n /**\n * Add a validation rule to this field.\n * This method is protected and should only be used by field-specific validator methods.\n * @internal\n */\n protected validation(validation: CmsModelFieldValidation): this {\n this.config.validation = this.config.validation || [];\n this.config.validation.push(validation);\n return this;\n }\n\n /**\n * Add a list validation rule to this field (for list fields).\n * This method is protected and should only be used by field-specific validator methods.\n * @internal\n */\n protected listValidation(validation: CmsModelFieldValidation): this {\n this.config.listValidation = this.config.listValidation || [];\n this.config.listValidation.push(validation);\n return this;\n }\n\n predefinedValues(values: CmsModelFieldPredefinedValues[\"values\"]): this {\n this.config.predefinedValues = {\n enabled: true,\n values\n };\n return this;\n }\n\n renderer<TName extends FieldRendererName<TType>>(\n name: TName,\n ...args: undefined extends FieldRendererSettings<TName>\n ? [settings?: FieldRendererSettings<TName>]\n : FieldRendererSettings<TName> extends undefined\n ? []\n : [settings: FieldRendererSettings<TName>]\n ): this {\n this.config.renderer = {\n name: resolveRendererName(name),\n settings: args[0] ?? null\n };\n return this;\n }\n\n settings(settings: Record<string, any>): this {\n this.config.settings = { ...this.config.settings, ...settings };\n return this;\n }\n\n /**\n * Build the final CmsModelField\n * @internal\n */\n build(): DataFieldBuildResult {\n const fieldId = this.config._fieldId || camelCase(this.config.label);\n const baseType = getBaseFieldType({\n type: this.type\n });\n const storageId = `${baseType}@${this.config._storageId ?? fieldId}`;\n\n return {\n type: \"data\",\n field: {\n id: fieldId,\n fieldId,\n storageId,\n type: this.getFieldType(),\n label: this.config.label,\n validation: this.config.validation || [],\n listValidation: this.config.listValidation || [],\n list: this.config.list || false,\n disabled: this.config.disabled || false,\n predefinedValues: this.config.predefinedValues || {\n enabled: false,\n values: []\n },\n help: this.config.help || null,\n placeholder: this.config.placeholder || null,\n description: this.config.description || null,\n note: this.config.note || null,\n renderer: this.config.renderer || null,\n settings: this.config.settings || {},\n tags: this.config.tags || [],\n rules: this.config.rules\n }\n };\n }\n\n private getFieldType(): string {\n if (!this.subType?.length) {\n return this.type;\n }\n return `${this.type}:${this.subType}`;\n }\n}\n"],"names":["rendererNameMap","resolveRendererName","name","DataFieldBuilder","BaseFieldBuilder","type","label","text","id","value","tags","message","validation","values","args","settings","fieldId","camelCase","baseType","getBaseFieldType","storageId"],"mappings":";;;AA2OA,MAAMA,kBAAgE;IAClE,QAAQ;IACR,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,QAAQ;IACR,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,aAAa;IACb,cAAc;IACd,uBAAuB;IACvB,yBAAyB;IACzB,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,mBAA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,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE;IACzC;AACJ"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { isDateExpression } from "@webiny/utils";
|
|
3
|
+
import { validateDateExpressions } from "../../../domain/contentModel/validation/dateExpressions.js";
|
|
1
4
|
import { FieldType } from "./abstractions.js";
|
|
2
5
|
import { DataFieldBuilder } from "./FieldBuilder.js";
|
|
3
6
|
class DateTimeFieldBuilder extends DataFieldBuilder {
|
|
4
7
|
constructor(){
|
|
5
8
|
super("datetime");
|
|
9
|
+
this.withTimezone();
|
|
6
10
|
}
|
|
7
11
|
required(message) {
|
|
8
12
|
return this.validation({
|
|
@@ -29,26 +33,37 @@ class DateTimeFieldBuilder extends DataFieldBuilder {
|
|
|
29
33
|
return this.dateTimeType("dateTimeWithoutTimezone");
|
|
30
34
|
}
|
|
31
35
|
dateGte(value, message) {
|
|
32
|
-
const type = this.config.settings?.type || "date";
|
|
33
36
|
return this.validation({
|
|
34
37
|
name: "dateGte",
|
|
35
|
-
message: message || "
|
|
36
|
-
settings:
|
|
37
|
-
value,
|
|
38
|
-
type
|
|
39
|
-
}
|
|
38
|
+
message: message || "Must be on or after {date}.",
|
|
39
|
+
settings: this.dateLimitSettings(value)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
dateLte(value, message) {
|
|
43
|
-
const type = this.config.settings?.type || "date";
|
|
44
43
|
return this.validation({
|
|
45
44
|
name: "dateLte",
|
|
46
|
-
message: message || "
|
|
47
|
-
settings:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
message: message || "Must be on or before {date}.",
|
|
46
|
+
settings: this.dateLimitSettings(value)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
build() {
|
|
50
|
+
const result = super.build();
|
|
51
|
+
validateDateExpressions(result.field);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
dateLimitSettings(value) {
|
|
55
|
+
const type = this.config.settings?.type || "date";
|
|
56
|
+
if ("string" == typeof value) return {
|
|
57
|
+
value,
|
|
58
|
+
type
|
|
59
|
+
};
|
|
60
|
+
if (!isDateExpression(value.expression)) throw new error(`Invalid date expression "${value.expression}". Use "today", or "today" plus or minus a number of days, months or years, like "today-18y".`, "INVALID_DATE_EXPRESSION", {
|
|
61
|
+
expression: value.expression
|
|
51
62
|
});
|
|
63
|
+
return {
|
|
64
|
+
expression: value.expression,
|
|
65
|
+
type
|
|
66
|
+
};
|
|
52
67
|
}
|
|
53
68
|
}
|
|
54
69
|
class DateTimeFieldTypeFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/DateTimeFieldType.js","sources":["../../../../src/features/modelBuilder/fields/DateTimeFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { DataFieldBuilder } from \"./FieldBuilder.js\";\nimport { RequiredValidator, DateGteValidator, DateLteValidator } from \"./fieldTypeValidator.js\";\n\nexport type DateTimeType = \"date\" | \"time\" | \"dateTimeWithTimezone\" | \"dateTimeWithoutTimezone\";\n\nexport interface IDateTimeFieldBuilder\n extends DataFieldBuilder<\"datetime\">, RequiredValidator, DateGteValidator, DateLteValidator {\n dateTimeType(type: DateTimeType): this;\n dateOnly(): this;\n timeOnly(): this;\n withTimezone(): this;\n withoutTimezone(): this;\n}\n\nclass DateTimeFieldBuilder extends DataFieldBuilder<\"datetime\"> implements IDateTimeFieldBuilder {\n public constructor() {\n super(\"datetime\");\n }\n\n required(message?: string): this {\n return this.validation({\n name: \"required\",\n message: message || \"Value is required.\",\n settings: {}\n });\n }\n\n dateTimeType(type: DateTimeType): this {\n this.config.settings = this.config.settings || {};\n this.config.settings.type = type;\n return this;\n }\n\n /**\n * Just a calendar date, no time, no timezone. Useful for things like birthdays, holidays, or due dates where the time of day doesn't matter.\n * Example: 2026-04-30\n */\n dateOnly(): this {\n return this.dateTimeType(\"date\");\n }\n\n /**\n * Time in 24-hours format.\n * Example: 19:35\n */\n timeOnly(): this {\n return this.dateTimeType(\"time\");\n }\n\n /**\n * This is an ISO 8601 datetime with an explicit timezone offset.\n * Example: 2026-04-29T13:25:00+02:00\n */\n withTimezone(): this {\n return this.dateTimeType(\"dateTimeWithTimezone\");\n }\n\n /**\n * This is an ISO 8601 datetime in UTC (Zulu time). \"Z\" means \"this is UTC, no offset.\"\n * Example: 2026-04-30T13:25:00.000Z\n */\n withoutTimezone(): this {\n return this.dateTimeType(\"dateTimeWithoutTimezone\");\n }\n\n dateGte(value:
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/DateTimeFieldType.js","sources":["../../../../src/features/modelBuilder/fields/DateTimeFieldType.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { isDateExpression, type DateBound } from \"@webiny/utils\";\nimport { validateDateExpressions } from \"~/domain/contentModel/validation/dateExpressions.js\";\nimport { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { DataFieldBuilder } from \"./FieldBuilder.js\";\nimport { RequiredValidator, DateGteValidator, DateLteValidator } from \"./fieldTypeValidator.js\";\n\nexport type DateTimeType = \"date\" | \"time\" | \"dateTimeWithTimezone\" | \"dateTimeWithoutTimezone\";\n\nexport interface IDateTimeFieldBuilder\n extends DataFieldBuilder<\"datetime\">, RequiredValidator, DateGteValidator, DateLteValidator {\n dateTimeType(type: DateTimeType): this;\n dateOnly(): this;\n timeOnly(): this;\n withTimezone(): this;\n withoutTimezone(): this;\n}\n\nclass DateTimeFieldBuilder extends DataFieldBuilder<\"datetime\"> implements IDateTimeFieldBuilder {\n public constructor() {\n super(\"datetime\");\n /**\n * Without a subtype the GraphQL, storage and admin layers each assume a different\n * format. Default to an ISO datetime with timezone; subtype methods override it.\n */\n this.withTimezone();\n }\n\n required(message?: string): this {\n return this.validation({\n name: \"required\",\n message: message || \"Value is required.\",\n settings: {}\n });\n }\n\n dateTimeType(type: DateTimeType): this {\n this.config.settings = this.config.settings || {};\n this.config.settings.type = type;\n return this;\n }\n\n /**\n * Just a calendar date, no time, no timezone. Useful for things like birthdays, holidays, or due dates where the time of day doesn't matter.\n * Example: 2026-04-30\n *\n * @example\n * fields.datetime().dateOnly()\n * // day, then month, then year; single values only, not for `.list()`.\n * // The picker offers only the dates the `dateGte`/`dateLte` limits allow.\n * fields\n * .datetime()\n * .dateOnly()\n * .dateGte({ expression: \"today-100y\" })\n * .dateLte({ expression: \"today-18y\" }, \"You must be 18 or older.\")\n * .renderer(\"birthdayInput\")\n */\n dateOnly(): this {\n return this.dateTimeType(\"date\");\n }\n\n /**\n * Time in 24-hours format.\n * Example: 19:35\n */\n timeOnly(): this {\n return this.dateTimeType(\"time\");\n }\n\n /**\n * This is an ISO 8601 datetime with an explicit timezone offset.\n * Example: 2026-04-29T13:25:00+02:00\n */\n withTimezone(): this {\n return this.dateTimeType(\"dateTimeWithTimezone\");\n }\n\n /**\n * This is an ISO 8601 datetime in UTC (Zulu time). \"Z\" means \"this is UTC, no offset.\"\n * Example: 2026-04-30T13:25:00.000Z\n */\n withoutTimezone(): this {\n return this.dateTimeType(\"dateTimeWithoutTimezone\");\n }\n\n /**\n * The value must be on or after the given one: a fixed value, or, on a date-only field, an\n * expression worked out from today's date every time the value is checked.\n *\n * Expressions: `today`, or `today` plus or minus a number of days (`d`), months (`m`) or\n * years (`y`). The birthday picker reads these limits, so dates outside them can't be picked.\n *\n * In `message`, `{date}` is the limit as it was worked out. Without a message, the field\n * says \"Must be on or after {date}.\" (`dateLte`: \"Must be on or before {date}.\").\n *\n * @example\n * fields.datetime().dateOnly().dateGte(\"1900-01-01\")\n * // not older than 100 years\n * fields.datetime().dateOnly().dateGte({ expression: \"today-100y\" })\n */\n dateGte(value: DateBound, message?: string): this {\n return this.validation({\n name: \"dateGte\",\n message: message || \"Must be on or after {date}.\",\n settings: this.dateLimitSettings(value)\n });\n }\n\n /**\n * The value must be on or before the given one: a fixed value, or, on a date-only field, an\n * expression worked out from today's date every time the value is checked.\n *\n * @example\n * fields.datetime().dateOnly().dateLte(\"2026-12-31\")\n * // 18 or older\n * fields\n * .datetime()\n * .dateOnly()\n * .dateLte({ expression: \"today-18y\" }, \"You must be 18 or older.\")\n * .renderer(\"birthdayInput\")\n */\n dateLte(value: DateBound, message?: string): this {\n return this.validation({\n name: \"dateLte\",\n message: message || \"Must be on or before {date}.\",\n settings: this.dateLimitSettings(value)\n });\n }\n\n override build() {\n const result = super.build();\n validateDateExpressions(result.field);\n return result;\n }\n\n private dateLimitSettings(value: DateBound): Record<string, string> {\n const type = this.config.settings?.type || \"date\";\n if (typeof value === \"string\") {\n return { value, type };\n }\n if (!isDateExpression(value.expression)) {\n throw new WebinyError(\n `Invalid date expression \"${value.expression}\". Use \"today\", or \"today\" plus or minus a number of days, months or years, like \"today-18y\".`,\n \"INVALID_DATE_EXPRESSION\",\n { expression: value.expression }\n );\n }\n return { expression: value.expression, type };\n }\n}\n\nclass DateTimeFieldTypeFactory implements IFieldTypeFactory {\n readonly type = \"datetime\";\n\n create(): IDateTimeFieldBuilder {\n return new DateTimeFieldBuilder();\n }\n}\n\nexport const DateTimeFieldType = FieldType.createImplementation({\n implementation: DateTimeFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n datetime(): IDateTimeFieldBuilder;\n }\n}\n"],"names":["DateTimeFieldBuilder","DataFieldBuilder","message","type","value","result","validateDateExpressions","isDateExpression","WebinyError","DateTimeFieldTypeFactory","DateTimeFieldType","FieldType"],"mappings":";;;;;AAkBA,MAAMA,6BAA6BC;IAC/B,aAAqB;QACjB,KAAK,CAAC;QAKN,IAAI,CAAC,YAAY;IACrB;IAEA,SAASC,OAAgB,EAAQ;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU,CAAC;QACf;IACJ;IAEA,aAAaC,IAAkB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AAO,IAAIT;IACf;;aAJS,IAAI,GAAG;;AAKpB;AAEO,MAAMU,oBAAoBC,UAAU,oBAAoB,CAAC;IAC5D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -9,6 +9,7 @@ export interface IDynamicZoneFieldBuilder extends DataFieldBuilder<"dynamicZone"
|
|
|
9
9
|
gqlTypeName: string;
|
|
10
10
|
icon?: CmsIcon;
|
|
11
11
|
description?: string;
|
|
12
|
+
componentName?: string;
|
|
12
13
|
fields: (registry: IFieldBuilderRegistry) => Record<string, BaseFieldBuilder<any>>;
|
|
13
14
|
layout?: string[][];
|
|
14
15
|
}): this;
|
|
@@ -14,20 +14,26 @@ class DynamicZoneFieldBuilder extends DataFieldBuilder {
|
|
|
14
14
|
template(id, config) {
|
|
15
15
|
const fieldBuilders = config.fields(this.registry);
|
|
16
16
|
const fields = [];
|
|
17
|
+
const layoutReplacements = new Map();
|
|
17
18
|
for (const [key, fieldBuilder] of Object.entries(fieldBuilders)){
|
|
18
19
|
fieldBuilder.fieldId(key);
|
|
19
20
|
const result = fieldBuilder.build();
|
|
20
|
-
if ("
|
|
21
|
-
|
|
21
|
+
if ("layout" === result.type) {
|
|
22
|
+
layoutReplacements.set(key, result.layoutCell);
|
|
23
|
+
if (result.fields) fields.push(...result.fields);
|
|
24
|
+
} else fields.push(result.field);
|
|
22
25
|
}
|
|
26
|
+
const rawLayout = config.layout || [];
|
|
27
|
+
const layout = rawLayout.map((row)=>row.map((cell)=>layoutReplacements.get(cell) ?? cell));
|
|
23
28
|
this.templates.push({
|
|
24
29
|
id,
|
|
25
30
|
name: config.name,
|
|
26
31
|
gqlTypeName: config.gqlTypeName,
|
|
27
32
|
icon: config.icon,
|
|
28
33
|
description: config.description || "",
|
|
34
|
+
componentName: config.componentName,
|
|
29
35
|
fields,
|
|
30
|
-
layout
|
|
36
|
+
layout,
|
|
31
37
|
validation: []
|
|
32
38
|
});
|
|
33
39
|
return this;
|
|
@@ -35,12 +41,7 @@ class DynamicZoneFieldBuilder extends DataFieldBuilder {
|
|
|
35
41
|
build() {
|
|
36
42
|
this.config.settings = this.config.settings || {};
|
|
37
43
|
this.config.settings.templates = this.templates;
|
|
38
|
-
this.config.listValidation = [
|
|
39
|
-
{
|
|
40
|
-
name: "dynamicZone",
|
|
41
|
-
message: ""
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
+
this.config.listValidation = [];
|
|
44
45
|
return super.build();
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/DynamicZoneFieldType.js","sources":["../../../../src/features/modelBuilder/fields/DynamicZoneFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type FieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { DataFieldBuilder, type BaseFieldBuilder } from \"./FieldBuilder.js\";\nimport { type IFieldBuilderRegistry } from \"../abstractions.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/DynamicZoneFieldType.js","sources":["../../../../src/features/modelBuilder/fields/DynamicZoneFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type FieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { DataFieldBuilder, type BaseFieldBuilder } from \"./FieldBuilder.js\";\nimport { type IFieldBuilderRegistry } from \"../abstractions.js\";\nimport type {\n CmsIcon,\n CmsModelField,\n CmsModelFieldValidation,\n CmsModelLayoutCell\n} from \"~/types/index.js\";\n\ninterface IDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n icon: CmsIcon | undefined;\n description: string;\n componentName?: string;\n fields: any[];\n layout: CmsModelLayoutCell[][];\n validation: CmsModelFieldValidation[];\n}\n\nexport interface IDynamicZoneFieldBuilder extends DataFieldBuilder<\"dynamicZone\"> {\n required(message?: string): this;\n\n template(\n id: string,\n config: {\n name: string;\n gqlTypeName: string;\n icon?: CmsIcon;\n description?: string;\n componentName?: string;\n fields: (registry: IFieldBuilderRegistry) => Record<string, BaseFieldBuilder<any>>;\n layout?: string[][];\n }\n ): this;\n}\n\ninterface IDynamicZoneFieldBuilderTemplateConfig {\n name: string;\n gqlTypeName: string;\n icon?: CmsIcon;\n description?: string;\n componentName?: string;\n fields: (registry: IFieldBuilderRegistry) => Record<string, BaseFieldBuilder<any>>;\n layout?: string[][];\n}\n\nclass DynamicZoneFieldBuilder\n extends DataFieldBuilder<\"dynamicZone\">\n implements IDynamicZoneFieldBuilder\n{\n private readonly templates: IDynamicZoneTemplate[] = [];\n\n public constructor(private registry: IFieldBuilderRegistry) {\n super(\"dynamicZone\");\n }\n\n public required(message?: string): this {\n return this.validation({\n name: \"required\",\n message: message || \"Field is required\",\n settings: {}\n });\n }\n\n public template(id: string, config: IDynamicZoneFieldBuilderTemplateConfig): this {\n const fieldBuilders = config.fields(this.registry);\n const fields: CmsModelField[] = [];\n const layoutReplacements = new Map<string, CmsModelLayoutCell>();\n\n for (const [key, fieldBuilder] of Object.entries(fieldBuilders)) {\n fieldBuilder.fieldId(key);\n const result: FieldBuildResult = (fieldBuilder as any).build();\n if (result.type === \"layout\") {\n layoutReplacements.set(key, result.layoutCell);\n if (result.fields) {\n fields.push(...result.fields);\n }\n } else {\n fields.push(result.field);\n }\n }\n\n const rawLayout: string[][] = config.layout || [];\n const layout = rawLayout.map(row => row.map(cell => layoutReplacements.get(cell) ?? cell));\n\n this.templates.push({\n id,\n name: config.name,\n gqlTypeName: config.gqlTypeName,\n icon: config.icon,\n description: config.description || \"\",\n componentName: config.componentName,\n fields,\n layout,\n validation: []\n });\n\n return this;\n }\n\n public override build() {\n // Set templates in settings before building\n this.config.settings = this.config.settings || {};\n this.config.settings.templates = this.templates;\n this.config.listValidation = [];\n return super.build();\n }\n}\n\nclass DynamicZoneFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"dynamicZone\";\n\n public create(registry: IFieldBuilderRegistry): IDynamicZoneFieldBuilder {\n return new DynamicZoneFieldBuilder(registry);\n }\n}\n\nexport const DynamicZoneFieldType = FieldType.createImplementation({\n implementation: DynamicZoneFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n dynamicZone(): IDynamicZoneFieldBuilder;\n }\n}\n"],"names":["DynamicZoneFieldBuilder","DataFieldBuilder","registry","message","id","config","fieldBuilders","fields","layoutReplacements","Map","key","fieldBuilder","Object","result","rawLayout","layout","row","cell","DynamicZoneFieldTypeFactory","DynamicZoneFieldType","FieldType"],"mappings":";;AAkDA,MAAMA,gCACMC;IAKR,YAA2BC,QAA+B,CAAE;QACxD,KAAK,CAAC,qBADiBA,QAAQ,GAARA,UAAAA,IAAAA,CAFV,SAAS,GAA2B,EAAE;IAIvD;IAEO,SAASC,OAAgB,EAAQ;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU,CAAC;QACf;IACJ;IAEO,SAASC,EAAU,EAAEC,MAA8C,EAAQ;QAC9E,MAAMC,gBAAgBD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ;QACjD,MAAME,SAA0B,EAAE;QAClC,MAAMC,qBAAqB,IAAIC;QAE/B,KAAK,MAAM,CAACC,KAAKC,aAAa,IAAIC,OAAO,OAAO,CAACN,eAAgB;YAC7DK,aAAa,OAAO,CAACD;YACrB,MAAMG,SAA4BF,aAAqB,KAAK;YAC5D,IAAIE,AAAgB,aAAhBA,OAAO,IAAI,EAAe;gBAC1BL,mBAAmB,GAAG,CAACE,KAAKG,OAAO,UAAU;gBAC7C,IAAIA,OAAO,MAAM,EACbN,OAAO,IAAI,IAAIM,OAAO,MAAM;YAEpC,OACIN,OAAO,IAAI,CAACM,OAAO,KAAK;QAEhC;QAEA,MAAMC,YAAwBT,OAAO,MAAM,IAAI,EAAE;QACjD,MAAMU,SAASD,UAAU,GAAG,CAACE,CAAAA,MAAOA,IAAI,GAAG,CAACC,CAAAA,OAAQT,mBAAmB,GAAG,CAACS,SAASA;QAEpF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAChBb;YACA,MAAMC,OAAO,IAAI;YACjB,aAAaA,OAAO,WAAW;YAC/B,MAAMA,OAAO,IAAI;YACjB,aAAaA,OAAO,WAAW,IAAI;YACnC,eAAeA,OAAO,aAAa;YACnCE;YACAQ;YACA,YAAY,EAAE;QAClB;QAEA,OAAO,IAAI;IACf;IAEgB,QAAQ;QAEpB,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS;QAC/C,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,EAAE;QAC/B,OAAO,KAAK,CAAC;IACjB;AACJ;AAEA,MAAMG;IAGK,OAAOhB,QAA+B,EAA4B;QACrE,OAAO,IAAIF,wBAAwBE;IACvC;;aAJgB,IAAI,GAAG;;AAK3B;AAEO,MAAMiB,uBAAuBC,UAAU,oBAAoB,CAAC;IAC/D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/UiAlertFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiAlertFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type LayoutFieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\n\ntype AlertType = \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface IUiAlertFieldBuilder extends LayoutFieldBuilder<\"uiAlert\"> {\n alertType(type: AlertType): this;\n}\n\nclass AlertFieldBuilder extends LayoutFieldBuilder<\"uiAlert\"> implements IUiAlertFieldBuilder {\n private _alertType: AlertType = \"warning\";\n\n public constructor() {\n super(\"uiAlert\");\n }\n\n public alertType(type: AlertType): this {\n this._alertType = type;\n return this;\n }\n\n public override build(): LayoutFieldBuildResult {\n return {\n type: \"layout\",\n layoutCell: {\n type: \"alert\",\n label: this.config.label,\n alertType: this._alertType\n }\n };\n }\n}\n\nclass UiAlertFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"uiAlert\";\n\n public create(): IUiAlertFieldBuilder {\n return new AlertFieldBuilder();\n }\n}\n\nexport const UiAlertFieldType = FieldType.createImplementation({\n implementation: UiAlertFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n uiAlert(): IUiAlertFieldBuilder;\n }\n}\n"],"names":["AlertFieldBuilder","LayoutFieldBuilder","type","UiAlertFieldTypeFactory","UiAlertFieldType","FieldType"],"mappings":";;AAUA,MAAMA,0BAA0BC;IAG5B,aAAqB;QACjB,KAAK,CAAC,iBAHF,UAAU,GAAc;IAIhC;IAEO,UAAUC,IAAe,EAAQ;QACpC,IAAI,CAAC,UAAU,GAAGA;QAClB,OAAO,IAAI;IACf;IAEgB,QAAgC;QAC5C,OAAO;YACH,MAAM;YACN,YAAY;gBACR,MAAM;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,WAAW,IAAI,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/UiAlertFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiAlertFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type LayoutFieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\n\ntype AlertType = \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface IUiAlertFieldBuilder extends LayoutFieldBuilder<\"uiAlert\"> {\n alertType(type: AlertType): this;\n}\n\nclass AlertFieldBuilder extends LayoutFieldBuilder<\"uiAlert\"> implements IUiAlertFieldBuilder {\n private _alertType: AlertType = \"warning\";\n\n public constructor() {\n super(\"uiAlert\");\n }\n\n public alertType(type: AlertType): this {\n this._alertType = type;\n return this;\n }\n\n public override build(): LayoutFieldBuildResult {\n return {\n type: \"layout\",\n layoutCell: {\n type: \"alert\",\n label: this.config.label,\n alertType: this._alertType,\n rules: this.config.rules\n }\n };\n }\n}\n\nclass UiAlertFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"uiAlert\";\n\n public create(): IUiAlertFieldBuilder {\n return new AlertFieldBuilder();\n }\n}\n\nexport const UiAlertFieldType = FieldType.createImplementation({\n implementation: UiAlertFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n uiAlert(): IUiAlertFieldBuilder;\n }\n}\n"],"names":["AlertFieldBuilder","LayoutFieldBuilder","type","UiAlertFieldTypeFactory","UiAlertFieldType","FieldType"],"mappings":";;AAUA,MAAMA,0BAA0BC;IAG5B,aAAqB;QACjB,KAAK,CAAC,iBAHF,UAAU,GAAc;IAIhC;IAEO,UAAUC,IAAe,EAAQ;QACpC,IAAI,CAAC,UAAU,GAAGA;QAClB,OAAO,IAAI;IACf;IAEgB,QAAgC;QAC5C,OAAO;YACH,MAAM;YACN,YAAY;gBACR,MAAM;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,WAAW,IAAI,CAAC,UAAU;gBAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;YAC5B;QACJ;IACJ;AACJ;AAEA,MAAMC;IAGK,SAA+B;QAClC,OAAO,IAAIH;IACf;;aAJgB,IAAI,GAAG;;AAK3B;AAEO,MAAMI,mBAAmBC,UAAU,oBAAoB,CAAC;IAC3D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/UiSeparatorFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiSeparatorFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type LayoutFieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\n\nexport interface IUiSeparatorFieldBuilder extends LayoutFieldBuilder<\"uiSeparator\"> {}\n\nclass SeparatorFieldBuilder\n extends LayoutFieldBuilder<\"uiSeparator\">\n implements IUiSeparatorFieldBuilder\n{\n public constructor() {\n super(\"uiSeparator\");\n }\n\n public override build(): LayoutFieldBuildResult {\n return {\n type: \"layout\",\n layoutCell: {\n type: \"separator\",\n label: this.config.label,\n description: this.config.description\n }\n };\n }\n}\n\nclass UiSeparatorFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"uiSeparator\";\n\n public create(): IUiSeparatorFieldBuilder {\n return new SeparatorFieldBuilder();\n }\n}\n\nexport const UiSeparatorFieldType = FieldType.createImplementation({\n implementation: UiSeparatorFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n uiSeparator(): IUiSeparatorFieldBuilder;\n }\n}\n"],"names":["SeparatorFieldBuilder","LayoutFieldBuilder","UiSeparatorFieldTypeFactory","UiSeparatorFieldType","FieldType"],"mappings":";;AAMA,MAAMA,8BACMC;IAGR,aAAqB;QACjB,KAAK,CAAC;IACV;IAEgB,QAAgC;QAC5C,OAAO;YACH,MAAM;YACN,YAAY;gBACR,MAAM;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,aAAa,IAAI,CAAC,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/UiSeparatorFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiSeparatorFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { type LayoutFieldBuildResult } from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\n\nexport interface IUiSeparatorFieldBuilder extends LayoutFieldBuilder<\"uiSeparator\"> {}\n\nclass SeparatorFieldBuilder\n extends LayoutFieldBuilder<\"uiSeparator\">\n implements IUiSeparatorFieldBuilder\n{\n public constructor() {\n super(\"uiSeparator\");\n }\n\n public override build(): LayoutFieldBuildResult {\n return {\n type: \"layout\",\n layoutCell: {\n type: \"separator\",\n label: this.config.label,\n description: this.config.description,\n rules: this.config.rules\n }\n };\n }\n}\n\nclass UiSeparatorFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"uiSeparator\";\n\n public create(): IUiSeparatorFieldBuilder {\n return new SeparatorFieldBuilder();\n }\n}\n\nexport const UiSeparatorFieldType = FieldType.createImplementation({\n implementation: UiSeparatorFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n uiSeparator(): IUiSeparatorFieldBuilder;\n }\n}\n"],"names":["SeparatorFieldBuilder","LayoutFieldBuilder","UiSeparatorFieldTypeFactory","UiSeparatorFieldType","FieldType"],"mappings":";;AAMA,MAAMA,8BACMC;IAGR,aAAqB;QACjB,KAAK,CAAC;IACV;IAEgB,QAAgC;QAC5C,OAAO;YACH,MAAM;YACN,YAAY;gBACR,MAAM;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,aAAa,IAAI,CAAC,MAAM,CAAC,WAAW;gBACpC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;YAC5B;QACJ;IACJ;AACJ;AAEA,MAAMC;IAGK,SAAmC;QACtC,OAAO,IAAIF;IACf;;aAJgB,IAAI,GAAG;;AAK3B;AAEO,MAAMG,uBAAuBC,UAAU,oBAAoB,CAAC;IAC/D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -2,13 +2,14 @@ import { type IFieldTypeFactory } from "./abstractions.js";
|
|
|
2
2
|
import { BaseFieldBuilder } from "./BaseFieldBuilder.js";
|
|
3
3
|
import { LayoutFieldBuilder } from "./LayoutFieldBuilder.js";
|
|
4
4
|
import { type IFieldBuilderRegistry } from "../abstractions.js";
|
|
5
|
-
import type { CmsIcon } from "../../../types/index.js";
|
|
5
|
+
import type { CmsIcon, FieldRule } from "../../../types/index.js";
|
|
6
6
|
interface ITabConfig {
|
|
7
7
|
label: string;
|
|
8
8
|
icon?: CmsIcon;
|
|
9
9
|
description?: string;
|
|
10
10
|
fields: (registry: IFieldBuilderRegistry) => Record<string, BaseFieldBuilder<any>>;
|
|
11
11
|
layout?: string[][];
|
|
12
|
+
rules?: FieldRule[];
|
|
12
13
|
}
|
|
13
14
|
export interface IUiTabsFieldBuilder extends LayoutFieldBuilder<"uiTabs"> {
|
|
14
15
|
tab(id: string, config: ITabConfig): this;
|
|
@@ -24,7 +24,8 @@ class TabsFieldBuilder extends LayoutFieldBuilder {
|
|
|
24
24
|
icon: config.icon,
|
|
25
25
|
description: config.description || "",
|
|
26
26
|
fields,
|
|
27
|
-
layout
|
|
27
|
+
layout,
|
|
28
|
+
rules: config.rules
|
|
28
29
|
});
|
|
29
30
|
return this;
|
|
30
31
|
}
|
|
@@ -37,7 +38,8 @@ class TabsFieldBuilder extends LayoutFieldBuilder {
|
|
|
37
38
|
id: tab.id,
|
|
38
39
|
label: tab.label,
|
|
39
40
|
icon: tab.icon || null,
|
|
40
|
-
layout: tab.layout
|
|
41
|
+
layout: tab.layout,
|
|
42
|
+
rules: tab.rules
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
return {
|
|
@@ -47,7 +49,8 @@ class TabsFieldBuilder extends LayoutFieldBuilder {
|
|
|
47
49
|
label: this.config.label,
|
|
48
50
|
description: this.config.description || null,
|
|
49
51
|
help: this.config.help || null,
|
|
50
|
-
tabs: layoutTabs
|
|
52
|
+
tabs: layoutTabs,
|
|
53
|
+
rules: this.config.rules
|
|
51
54
|
},
|
|
52
55
|
fields: hoistedFields
|
|
53
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/UiTabsFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiTabsFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport {\n BaseFieldBuilder,\n type FieldBuildResult,\n type LayoutFieldBuildResult\n} from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\nimport { type IFieldBuilderRegistry } from \"../abstractions.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/UiTabsFieldType.js","sources":["../../../../src/features/modelBuilder/fields/UiTabsFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport {\n BaseFieldBuilder,\n type FieldBuildResult,\n type LayoutFieldBuildResult\n} from \"./BaseFieldBuilder.js\";\nimport { LayoutFieldBuilder } from \"./LayoutFieldBuilder.js\";\nimport { type IFieldBuilderRegistry } from \"../abstractions.js\";\nimport type {\n CmsIcon,\n CmsModelField,\n CmsModelLayout,\n CmsModelLayoutCell,\n FieldRule\n} from \"~/types/index.js\";\n\ninterface ITab {\n id: string;\n label: string;\n icon: CmsIcon | undefined;\n description: string;\n fields: CmsModelField[];\n layout: CmsModelLayout;\n rules?: FieldRule[];\n}\n\ninterface ITabConfig {\n label: string;\n icon?: CmsIcon;\n description?: string;\n fields: (registry: IFieldBuilderRegistry) => Record<string, BaseFieldBuilder<any>>;\n layout?: string[][];\n rules?: FieldRule[];\n}\n\nexport interface IUiTabsFieldBuilder extends LayoutFieldBuilder<\"uiTabs\"> {\n tab(id: string, config: ITabConfig): this;\n}\n\nclass TabsFieldBuilder extends LayoutFieldBuilder<\"uiTabs\"> implements IUiTabsFieldBuilder {\n private readonly tabs: ITab[] = [];\n\n public constructor(private registry: IFieldBuilderRegistry) {\n super(\"uiTabs\");\n }\n\n public tab(id: string, config: ITabConfig): this {\n const fieldBuilders = config.fields(this.registry);\n const fields: CmsModelField[] = [];\n const layoutReplacements = new Map<string, CmsModelLayoutCell>();\n\n for (const [key, fieldBuilder] of Object.entries(fieldBuilders)) {\n fieldBuilder.fieldId(key);\n const result: FieldBuildResult = (fieldBuilder as any).build();\n if (result.type === \"layout\") {\n layoutReplacements.set(key, result.layoutCell);\n if (result.fields) {\n fields.push(...result.fields);\n }\n } else {\n fields.push(result.field);\n }\n }\n\n const rawLayout: string[][] = config.layout || [];\n const layout: CmsModelLayout = rawLayout.map(row =>\n row.map(cell => layoutReplacements.get(cell) ?? cell)\n );\n\n this.tabs.push({\n id,\n label: config.label,\n icon: config.icon,\n description: config.description || \"\",\n fields,\n layout,\n rules: config.rules\n });\n\n return this;\n }\n\n public override build(): LayoutFieldBuildResult {\n const hoistedFields: CmsModelField[] = [];\n const layoutTabs = [];\n\n for (const tab of this.tabs) {\n hoistedFields.push(...tab.fields);\n layoutTabs.push({\n id: tab.id,\n label: tab.label,\n icon: tab.icon || null,\n layout: tab.layout,\n rules: tab.rules\n });\n }\n\n return {\n type: \"layout\",\n layoutCell: {\n type: \"tabs\",\n label: this.config.label,\n description: this.config.description || null,\n help: this.config.help || null,\n tabs: layoutTabs,\n rules: this.config.rules\n },\n fields: hoistedFields\n };\n }\n}\n\nclass TabsFieldTypeFactory implements IFieldTypeFactory {\n public readonly type = \"uiTabs\";\n\n public create(registry: IFieldBuilderRegistry): IUiTabsFieldBuilder {\n return new TabsFieldBuilder(registry);\n }\n}\n\nexport const UiTabsFieldType = FieldType.createImplementation({\n implementation: TabsFieldTypeFactory,\n dependencies: []\n});\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n uiTabs(): IUiTabsFieldBuilder;\n }\n}\n"],"names":["TabsFieldBuilder","LayoutFieldBuilder","registry","id","config","fieldBuilders","fields","layoutReplacements","Map","key","fieldBuilder","Object","result","rawLayout","layout","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AW,IAAI,CAAC;gBACZ,IAAIC,IAAI,EAAE;gBACV,OAAOA,IAAI,KAAK;gBAChB,MAAMA,IAAI,IAAI,IAAI;gBAClB,QAAQA,IAAI,MAAM;gBAClB,OAAOA,IAAI,KAAK;YACpB;QACJ;QAEA,OAAO;YACH,MAAM;YACN,YAAY;gBACR,MAAM;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,aAAa,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI;gBACxC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI;gBAC1B,MAAMD;gBACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK;YAC5B;YACA,QAAQD;QACZ;IACJ;AACJ;AAEA,MAAMG;IAGK,OAAOlB,QAA+B,EAAuB;QAChE,OAAO,IAAIF,iBAAiBE;IAChC;;aAJgB,IAAI,GAAG;;AAK3B;AAEO,MAAMmB,kBAAkBC,UAAU,oBAAoB,CAAC;IAC1D,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Validator interface mixins for type-safe field validators.
|
|
3
3
|
* These interfaces provide TypeScript autocomplete and type safety for field validation methods.
|
|
4
4
|
*/
|
|
5
|
+
import type { DateBound } from "@webiny/utils";
|
|
5
6
|
export interface RequiredValidator {
|
|
6
7
|
required(message?: string): this;
|
|
7
8
|
}
|
|
@@ -50,13 +51,14 @@ export interface LteValidator {
|
|
|
50
51
|
lte(value: number, message?: string): this;
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
|
-
* Date/time comparison validators
|
|
54
|
+
* Date/time comparison validators. The limit is a fixed value, or, on a date-only field,
|
|
55
|
+
* `{ expression }` worked out from today's date every time the value is checked.
|
|
54
56
|
*/
|
|
55
57
|
export interface DateGteValidator {
|
|
56
|
-
dateGte(value:
|
|
58
|
+
dateGte(value: DateBound, message?: string): this;
|
|
57
59
|
}
|
|
58
60
|
export interface DateLteValidator {
|
|
59
|
-
dateLte(value:
|
|
61
|
+
dateLte(value: DateBound, message?: string): this;
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
64
|
* Unique value validator (ensures field value is unique across entries)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the turnkey delivery URL for a stored Asset field value.
|
|
3
|
+
*
|
|
4
|
+
* The Asset field stores `src` as the file's **base delivery URL** (the pristine
|
|
5
|
+
* original) with the per-usage crop kept beside it in `image.crop`. The delivery
|
|
6
|
+
* pipeline frames the image only when the URL carries a `?crop=` param, so a raw
|
|
7
|
+
* `src` never reflects the per-usage crop. This helper bakes that crop into the URL
|
|
8
|
+
* — it is what the generated `url` field on the Asset GraphQL type resolves to, so a
|
|
9
|
+
* headless consumer (any framework) gets a ready-to-use URL without having to know
|
|
10
|
+
* the delivery param contract.
|
|
11
|
+
*
|
|
12
|
+
* Note: only the per-usage crop is added here. Any **asset-level** crop (set in File
|
|
13
|
+
* Manager, stored on the file's metadata) is already baked in by the delivery on any
|
|
14
|
+
* GET of the base `src`, and a per-usage crop replaces — not composes with — it, so
|
|
15
|
+
* `src` + `?crop=<per-usage>` is the correct combined result.
|
|
16
|
+
*/
|
|
17
|
+
interface AssetImageCrop {
|
|
18
|
+
top?: number | null;
|
|
19
|
+
left?: number | null;
|
|
20
|
+
bottom?: number | null;
|
|
21
|
+
right?: number | null;
|
|
22
|
+
}
|
|
23
|
+
interface AssetValue {
|
|
24
|
+
src?: string | null;
|
|
25
|
+
image?: {
|
|
26
|
+
crop?: AssetImageCrop | null;
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The stored `src` with the per-usage crop baked in as a `?crop=` delivery param.
|
|
31
|
+
* Returns `src` unchanged when there is no per-usage crop, and `null` when the value
|
|
32
|
+
* has no source.
|
|
33
|
+
*/
|
|
34
|
+
export declare const resolveAssetUrl: (asset: AssetValue | null | undefined) => string | null;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const round = (n)=>Math.round(10000 * n) / 10000;
|
|
2
|
+
const cropParam = (crop)=>{
|
|
3
|
+
if (!crop) return;
|
|
4
|
+
const top = crop.top ?? 0;
|
|
5
|
+
const left = crop.left ?? 0;
|
|
6
|
+
const bottom = crop.bottom ?? 0;
|
|
7
|
+
const right = crop.right ?? 0;
|
|
8
|
+
if (0 === top && 0 === left && 0 === bottom && 0 === right) return;
|
|
9
|
+
return [
|
|
10
|
+
top,
|
|
11
|
+
left,
|
|
12
|
+
bottom,
|
|
13
|
+
right
|
|
14
|
+
].map(round).join(",");
|
|
15
|
+
};
|
|
16
|
+
const resolveAssetUrl = (asset)=>{
|
|
17
|
+
const src = asset?.src;
|
|
18
|
+
if (!src) return null;
|
|
19
|
+
const param = cropParam(asset?.image?.crop);
|
|
20
|
+
if (!param) return src;
|
|
21
|
+
const separator = src.includes("?") ? "&" : "?";
|
|
22
|
+
return `${src}${separator}crop=${param}`;
|
|
23
|
+
};
|
|
24
|
+
export { resolveAssetUrl };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=resolveAssetUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/resolveAssetUrl.js","sources":["../../../../src/features/modelBuilder/fields/resolveAssetUrl.ts"],"sourcesContent":["/**\n * Build the turnkey delivery URL for a stored Asset field value.\n *\n * The Asset field stores `src` as the file's **base delivery URL** (the pristine\n * original) with the per-usage crop kept beside it in `image.crop`. The delivery\n * pipeline frames the image only when the URL carries a `?crop=` param, so a raw\n * `src` never reflects the per-usage crop. This helper bakes that crop into the URL\n * — it is what the generated `url` field on the Asset GraphQL type resolves to, so a\n * headless consumer (any framework) gets a ready-to-use URL without having to know\n * the delivery param contract.\n *\n * Note: only the per-usage crop is added here. Any **asset-level** crop (set in File\n * Manager, stored on the file's metadata) is already baked in by the delivery on any\n * GET of the base `src`, and a per-usage crop replaces — not composes with — it, so\n * `src` + `?crop=<per-usage>` is the correct combined result.\n */\n\ninterface AssetImageCrop {\n top?: number | null;\n left?: number | null;\n bottom?: number | null;\n right?: number | null;\n}\n\ninterface AssetValue {\n src?: string | null;\n image?: { crop?: AssetImageCrop | null } | null;\n}\n\nconst round = (n: number): number => Math.round(n * 10000) / 10000;\n\n/** `top,left,bottom,right` crop param, or `undefined` for a missing/full (no-op) crop. */\nconst cropParam = (crop: AssetImageCrop | null | undefined): string | undefined => {\n if (!crop) {\n return undefined;\n }\n const top = crop.top ?? 0;\n const left = crop.left ?? 0;\n const bottom = crop.bottom ?? 0;\n const right = crop.right ?? 0;\n if (top === 0 && left === 0 && bottom === 0 && right === 0) {\n return undefined;\n }\n return [top, left, bottom, right].map(round).join(\",\");\n};\n\n/**\n * The stored `src` with the per-usage crop baked in as a `?crop=` delivery param.\n * Returns `src` unchanged when there is no per-usage crop, and `null` when the value\n * has no source.\n */\nexport const resolveAssetUrl = (asset: AssetValue | null | undefined): string | null => {\n const src = asset?.src;\n if (!src) {\n return null;\n }\n const param = cropParam(asset?.image?.crop);\n if (!param) {\n return src;\n }\n const separator = src.includes(\"?\") ? \"&\" : \"?\";\n return `${src}${separator}crop=${param}`;\n};\n"],"names":["round","n","Math","cropParam","crop","top","left","bottom","right","resolveAssetUrl","asset","src","param","separator"],"mappings":"AA6BA,MAAMA,QAAQ,CAACC,IAAsBC,KAAK,KAAK,CAACD,AAAI,QAAJA,KAAa;AAG7D,MAAME,YAAY,CAACC;IACf,IAAI,CAACA,MACD;IAEJ,MAAMC,MAAMD,KAAK,GAAG,IAAI;IACxB,MAAME,OAAOF,KAAK,IAAI,IAAI;IAC1B,MAAMG,SAASH,KAAK,MAAM,IAAI;IAC9B,MAAMI,QAAQJ,KAAK,KAAK,IAAI;IAC5B,IAAIC,AAAQ,MAARA,OAAaC,AAAS,MAATA,QAAcC,AAAW,MAAXA,UAAgBC,AAAU,MAAVA,OAC3C;IAEJ,OAAO;QAACH;QAAKC;QAAMC;QAAQC;KAAM,CAAC,GAAG,CAACR,OAAO,IAAI,CAAC;AACtD;AAOO,MAAMS,kBAAkB,CAACC;IAC5B,MAAMC,MAAMD,OAAO;IACnB,IAAI,CAACC,KACD,OAAO;IAEX,MAAMC,QAAQT,UAAUO,OAAO,OAAO;IACtC,IAAI,CAACE,OACD,OAAOD;IAEX,MAAME,YAAYF,IAAI,QAAQ,CAAC,OAAO,MAAM;IAC5C,OAAO,GAAGA,MAAME,UAAU,KAAK,EAAED,OAAO;AAC5C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseFieldBuilder } from "../../../features/modelBuilder/index.js";
|
|
2
2
|
import { CmsModelPlugin } from "../../../plugins/CmsModelPlugin.js";
|
|
3
|
-
import { FieldBuilderRegistry } from "../abstractions.js";
|
|
3
|
+
import { FieldBuilderRegistry, type IModelSettings } from "../abstractions.js";
|
|
4
4
|
import type { CmsModelField, CmsModelLayoutCell } from "../../../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Base class for all model builders, containing shared logic.
|
|
@@ -12,6 +12,7 @@ export declare abstract class BaseModelBuilder<TBuild = CmsModelPlugin> {
|
|
|
12
12
|
modelId?: string;
|
|
13
13
|
name?: string;
|
|
14
14
|
tags?: string[];
|
|
15
|
+
settings?: IModelSettings;
|
|
15
16
|
};
|
|
16
17
|
protected isSingleEntry: boolean;
|
|
17
18
|
protected fieldBuildersMap: Map<string, BaseFieldBuilder<any>>;
|
|
@@ -20,6 +21,7 @@ export declare abstract class BaseModelBuilder<TBuild = CmsModelPlugin> {
|
|
|
20
21
|
name(name: string): this;
|
|
21
22
|
singleEntry(): this;
|
|
22
23
|
tags(tags: string[]): this;
|
|
24
|
+
settings(settings: Partial<IModelSettings>): this;
|
|
23
25
|
fields(builder: (registry: FieldBuilderRegistry.Interface) => Record<string, BaseFieldBuilder<any>>): this;
|
|
24
26
|
/**
|
|
25
27
|
* Merge field operations from extension builder into existing builder.
|
|
@@ -21,6 +21,13 @@ class BaseModelBuilder {
|
|
|
21
21
|
this.config.tags = tags;
|
|
22
22
|
return this;
|
|
23
23
|
}
|
|
24
|
+
settings(settings) {
|
|
25
|
+
this.config.settings = {
|
|
26
|
+
...this.config.settings || {},
|
|
27
|
+
...settings
|
|
28
|
+
};
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
24
31
|
fields(builder) {
|
|
25
32
|
this.registry.existingFields = this.fieldBuildersMap;
|
|
26
33
|
const fieldBuilders = builder(this.registry);
|