@webiny/api-headless-cms 6.4.11 → 6.6.0-alpha.1
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/HeadlessCmsContextualSchema.d.ts +16 -0
- package/HeadlessCmsContextualSchema.js +32 -0
- package/HeadlessCmsContextualSchema.js.map +1 -0
- package/HeadlessCmsEndpointConfig.d.ts +10 -0
- package/HeadlessCmsEndpointConfig.js +5 -0
- package/HeadlessCmsEndpointConfig.js.map +1 -0
- package/HeadlessCmsFeature.d.ts +10 -0
- package/HeadlessCmsFeature.js +195 -0
- package/HeadlessCmsFeature.js.map +1 -0
- package/createCmsRoute.d.ts +26 -0
- package/createCmsRoute.js +59 -0
- package/createCmsRoute.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +1 -1
- package/crud/contentEntry/entryDataValidation.js +29 -15
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry/references/validateEntries.d.ts +1 -1
- package/crud/contentEntry/references/validateEntries.js +17 -7
- package/crud/contentEntry/references/validateEntries.js.map +1 -1
- package/crud/contentEntry.crud.js +22 -20
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/defaultFields.js +3 -2
- package/crud/contentModel/defaultFields.js.map +1 -1
- package/crud/contentModel.crud.js +8 -6
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup.crud.js +7 -5
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/domain/contentModel/schemas.d.ts +2 -0
- package/domain/contentModel/schemas.js +4 -2
- package/domain/contentModel/schemas.js.map +1 -1
- package/domain/contentModel/validation/modelFields.js +21 -15
- package/domain/contentModel/validation/modelFields.js.map +1 -1
- package/export/abstractions.d.ts +9 -0
- package/export/abstractions.js +6 -0
- package/export/abstractions.js.map +1 -0
- package/export/crud/exporting.js +8 -2
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/importing.js +13 -4
- package/export/crud/importing.js.map +1 -1
- package/export/crud/imports/importGroups.js +23 -23
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/importModels.js +25 -22
- package/export/crud/imports/importModels.js.map +1 -1
- package/export/graphql/index.d.ts +2 -3
- package/export/graphql/index.js +6 -10
- package/export/graphql/index.js.map +1 -1
- package/exports/api/cms/model.d.ts +4 -1
- package/exports/api/cms/model.js +2 -0
- package/exports/api/cms/storage.d.ts +0 -1
- package/exports/api/cms/storage.js +0 -1
- package/features/ai/DescribeContentModelTool.d.ts +55 -0
- package/features/ai/DescribeContentModelTool.js +60 -0
- package/features/ai/DescribeContentModelTool.js.map +1 -0
- package/features/ai/ListContentModelsTool.d.ts +41 -0
- package/features/ai/ListContentModelsTool.js +44 -0
- package/features/ai/ListContentModelsTool.js.map +1 -0
- package/features/ai/QueryEntriesTool.d.ts +75 -0
- package/features/ai/QueryEntriesTool.js +90 -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 +0 -2
- package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +7 -7
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js +8 -14
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +3 -1
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +2 -3
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.d.ts +7 -7
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +8 -14
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +3 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +2 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.d.ts +7 -7
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +8 -14
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +3 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +2 -3
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.d.ts +6 -6
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +8 -14
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.d.ts +3 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js +2 -3
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.d.ts +3 -3
- package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.js +5 -5
- package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.d.ts +6 -6
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +8 -14
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +3 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +2 -3
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.d.ts +7 -7
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +8 -13
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +3 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +2 -3
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.d.ts +9 -7
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +15 -13
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.d.ts +3 -1
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.js +2 -3
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.js.map +1 -1
- package/features/contentEntry/GetEntry/GetEntryUseCase.d.ts +3 -1
- package/features/contentEntry/GetEntry/GetEntryUseCase.js +2 -3
- package/features/contentEntry/GetEntry/GetEntryUseCase.js.map +1 -1
- package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.js +2 -3
- package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.js.map +1 -1
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.d.ts +7 -7
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +8 -13
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.d.ts +3 -1
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.js +2 -3
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.d.ts +3 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.js +2 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.d.ts +7 -7
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +8 -13
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.js +2 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.d.ts +3 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.js +1 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.js +2 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.js.map +1 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.d.ts +3 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.js +2 -3
- package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.js.map +1 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.d.ts +7 -7
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +8 -13
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.js +2 -3
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.js.map +1 -1
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.d.ts +7 -7
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +8 -13
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.d.ts +3 -1
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.js +2 -3
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.js.map +1 -1
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.d.ts +7 -7
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +8 -13
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.js +2 -3
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.js.map +1 -1
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.d.ts +7 -7
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +8 -13
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.js +1 -3
- package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.js.map +1 -1
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.d.ts +7 -7
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +8 -13
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.d.ts +3 -1
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.js +2 -3
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.js.map +1 -1
- package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js +1 -3
- package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.d.ts +7 -7
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +8 -13
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.d.ts +6 -2
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +8 -6
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.d.ts +3 -1
- package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.js +1 -3
- package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListEntriesRepository.d.ts +7 -7
- package/features/contentEntry/ListEntries/ListEntriesRepository.js +8 -13
- package/features/contentEntry/ListEntries/ListEntriesRepository.js.map +1 -1
- package/features/contentEntry/ListEntries/ListEntriesUseCase.d.ts +3 -1
- package/features/contentEntry/ListEntries/ListEntriesUseCase.js +2 -3
- package/features/contentEntry/ListEntries/ListEntriesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.d.ts +3 -1
- package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.js +1 -3
- package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.d.ts +3 -1
- package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.js +1 -3
- package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryRepository.d.ts +7 -7
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js +8 -13
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +3 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +2 -3
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryRepository.d.ts +7 -7
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js +8 -14
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +3 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +2 -3
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.d.ts +9 -7
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +12 -15
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +3 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +2 -3
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.d.ts +7 -7
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +8 -14
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.d.ts +3 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js +2 -3
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.d.ts +7 -7
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +8 -14
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +3 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +2 -3
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.d.ts +7 -7
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +8 -14
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +3 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +2 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +3 -1
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -3
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
- package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.d.ts +3 -1
- package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.js +2 -3
- package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +2 -4
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +4 -4
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +4 -8
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +1 -3
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +1 -3
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +1 -3
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +2 -4
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
- 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 +6 -0
- package/features/contentModel/ContentModelFeature.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.d.ts +5 -6
- package/features/contentModel/CreateModel/CreateModelRepository.js +9 -12
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelUseCase.js +2 -2
- package/features/contentModel/CreateModel/CreateModelUseCase.js.map +1 -1
- package/features/contentModel/CreateModel/abstractions.d.ts +1 -1
- package/features/contentModel/CreateModel/abstractions.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.d.ts +5 -6
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +9 -12
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromUseCase.js +2 -2
- package/features/contentModel/CreateModelFrom/CreateModelFromUseCase.js.map +1 -1
- package/features/contentModel/CreateModelFrom/abstractions.d.ts +1 -1
- package/features/contentModel/CreateModelFrom/abstractions.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +4 -6
- package/features/contentModel/DeleteModel/DeleteModelRepository.js +6 -10
- package/features/contentModel/DeleteModel/DeleteModelRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.d.ts +1 -0
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js +11 -8
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.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 +7 -6
- package/features/contentModel/UpdateModel/UpdateModelRepository.js +12 -12
- 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.d.ts +16 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +53 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.d.ts +8 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.js +5 -0
- package/features/contentModel/ValuesSelectionGenerator/abstractions.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.d.ts +4 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.js +11 -0
- package/features/contentModel/ValuesSelectionGenerator/feature.js.map +1 -0
- package/features/contentModel/ValuesSelectionGenerator/index.d.ts +1 -0
- package/features/contentModel/ValuesSelectionGenerator/index.js +1 -0
- package/features/contentModel/shared/ModelsFetcher.d.ts +3 -3
- package/features/contentModel/shared/ModelsFetcher.js +5 -5
- package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
- package/features/contentModel/shared/PluginModelsProvider.d.ts +5 -4
- package/features/contentModel/shared/PluginModelsProvider.js +11 -8
- package/features/contentModel/shared/PluginModelsProvider.js.map +1 -1
- package/features/contentModel/shared/abstractions.d.ts +10 -0
- package/features/contentModel/shared/abstractions.js +2 -1
- package/features/contentModel/shared/abstractions.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +11 -7
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +19 -19
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.d.ts +6 -2
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js +9 -8
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/abstractions.d.ts +1 -1
- package/features/contentModelGroup/CreateGroup/abstractions.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +9 -7
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +12 -14
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.d.ts +3 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js +2 -3
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/GetGroup/GetGroupRepository.d.ts +6 -4
- package/features/contentModelGroup/GetGroup/GetGroupRepository.js +9 -9
- package/features/contentModelGroup/GetGroup/GetGroupRepository.js.map +1 -1
- package/features/contentModelGroup/GetGroup/GetGroupUseCase.d.ts +3 -1
- package/features/contentModelGroup/GetGroup/GetGroupUseCase.js +2 -3
- package/features/contentModelGroup/GetGroup/GetGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.d.ts +6 -4
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.js +9 -9
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.js.map +1 -1
- package/features/contentModelGroup/ListGroups/ListGroupsUseCase.d.ts +3 -1
- package/features/contentModelGroup/ListGroups/ListGroupsUseCase.js +2 -3
- package/features/contentModelGroup/ListGroups/ListGroupsUseCase.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.d.ts +7 -7
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +9 -14
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.d.ts +3 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +4 -5
- 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/contentModelGroup/shared/PluginGroupsProvider.d.ts +6 -4
- package/features/contentModelGroup/shared/PluginGroupsProvider.js +13 -11
- package/features/contentModelGroup/shared/PluginGroupsProvider.js.map +1 -1
- package/features/contentModelGroup/shared/abstractions.d.ts +10 -0
- package/features/contentModelGroup/shared/abstractions.js +2 -1
- package/features/contentModelGroup/shared/abstractions.js.map +1 -1
- package/features/graphql/feature.js +2 -0
- package/features/graphql/feature.js.map +1 -1
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.d.ts +2 -2
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/AssetToGraphQL.js +148 -0
- package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js +5 -1
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/ObjectToGraphQL.js +2 -2
- package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/RefToGraphQL.d.ts +1 -1
- package/features/graphql/fields/base/RefToGraphQL.js +10 -18
- package/features/graphql/fields/base/RefToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/richText/richTextResolver.d.ts +1 -1
- package/features/graphql/fields/base/richText/richTextResolver.js.map +1 -1
- package/features/modelBuilder/abstractions.d.ts +10 -0
- package/features/modelBuilder/abstractions.js.map +1 -1
- package/features/modelBuilder/feature.js +2 -0
- 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/DataFieldBuilder.d.ts +54 -18
- package/features/modelBuilder/fields/DataFieldBuilder.js +3 -0
- package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
- package/features/modelBuilder/fields/DynamicZoneFieldType.js +2 -6
- package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
- package/features/modelBuilder/fields/TextFieldType.d.ts +3 -1
- package/features/modelBuilder/fields/TextFieldType.js +1 -3
- package/features/modelBuilder/fields/TextFieldType.js.map +1 -1
- 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/PrivateModelBuilder.js +2 -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/shared/abstractions.d.ts +11 -15
- package/features/shared/abstractions.js +3 -3
- package/features/shared/abstractions.js.map +1 -1
- package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/CreateEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/CreateEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/CreateEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/ListEntriesStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/ListEntriesStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/ListEntriesStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/MoveEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/MoveEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/MoveEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/MoveToBinStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/MoveToBinStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/MoveToBinStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/PublishEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/PublishEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/PublishEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js +5 -0
- package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/group/CreateGroupStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/group/CreateGroupStorageOperation.js +5 -0
- package/features/shared/storageOperations/group/CreateGroupStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/group/DeleteGroupStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/group/DeleteGroupStorageOperation.js +5 -0
- package/features/shared/storageOperations/group/DeleteGroupStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/group/GetGroupStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/group/GetGroupStorageOperation.js +5 -0
- package/features/shared/storageOperations/group/GetGroupStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/group/ListGroupsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/group/ListGroupsStorageOperation.js +5 -0
- package/features/shared/storageOperations/group/ListGroupsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/group/UpdateGroupStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/group/UpdateGroupStorageOperation.js +5 -0
- package/features/shared/storageOperations/group/UpdateGroupStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/index.d.ts +32 -0
- package/features/shared/storageOperations/index.js +32 -0
- package/features/shared/storageOperations/model/CreateModelStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/model/CreateModelStorageOperation.js +5 -0
- package/features/shared/storageOperations/model/CreateModelStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/model/DeleteModelStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/model/DeleteModelStorageOperation.js +5 -0
- package/features/shared/storageOperations/model/DeleteModelStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/model/GetModelStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/model/GetModelStorageOperation.js +5 -0
- package/features/shared/storageOperations/model/GetModelStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/model/ListModelsStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/model/ListModelsStorageOperation.js +5 -0
- package/features/shared/storageOperations/model/ListModelsStorageOperation.js.map +1 -0
- package/features/shared/storageOperations/model/UpdateModelStorageOperation.d.ts +8 -0
- package/features/shared/storageOperations/model/UpdateModelStorageOperation.js +5 -0
- package/features/shared/storageOperations/model/UpdateModelStorageOperation.js.map +1 -0
- package/features/sortMapper/SortMapper.js +2 -5
- package/features/sortMapper/SortMapper.js.map +1 -1
- package/features/whereMapper/WhereMapper.js +7 -5
- package/features/whereMapper/WhereMapper.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +3 -7
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/abstractions.d.ts +14 -0
- package/fieldConverters/abstractions.js +13 -0
- package/fieldConverters/abstractions.js.map +1 -0
- package/fieldConverters/index.d.ts +1 -1
- package/graphql/CmsGraphQLSchemaFactory.d.ts +8 -0
- package/graphql/CmsGraphQLSchemaFactory.js +5 -0
- package/graphql/CmsGraphQLSchemaFactory.js.map +1 -0
- package/graphql/CmsSchemaExecutor.d.ts +10 -0
- package/graphql/CmsSchemaExecutor.js +5 -0
- package/graphql/CmsSchemaExecutor.js.map +1 -0
- package/graphql/buildSchemaPlugins.d.ts +2 -1
- package/graphql/buildSchemaPlugins.js +1 -3
- package/graphql/buildSchemaPlugins.js.map +1 -1
- package/graphql/checkEndpointAccess.js +5 -2
- package/graphql/checkEndpointAccess.js.map +1 -1
- package/graphql/createExecutableSchema.d.ts +1 -1
- package/graphql/createExecutableSchema.js +1 -1
- package/graphql/createExecutableSchema.js.map +1 -1
- package/graphql/generateSchema.d.ts +2 -1
- package/graphql/generateSchema.js +14 -5
- package/graphql/generateSchema.js.map +1 -1
- package/graphql/getSchema.js +7 -2
- package/graphql/getSchema.js.map +1 -1
- package/graphql/scalars/RevisionIdScalarPlugin.d.ts +1 -1
- package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -1
- package/graphql/schema/baseContentSchema.d.ts +1 -6
- package/graphql/schema/baseContentSchema.js +5 -8
- package/graphql/schema/baseContentSchema.js.map +1 -1
- package/graphql/schema/baseSchema.d.ts +2 -2
- package/graphql/schema/baseSchema.js +6 -41
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.d.ts +14 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js +21 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js.map +1 -0
- package/graphql/schema/cms/createEntryResolver.js +2 -2
- package/graphql/schema/cms/createEntryResolver.js.map +1 -1
- package/graphql/schema/cms/deleteEntryResolver.js +2 -2
- package/graphql/schema/cms/deleteEntryResolver.js.map +1 -1
- package/graphql/schema/cms/getEntryResolver.js +5 -4
- 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/getModel.d.ts +0 -3
- package/graphql/schema/cms/helpers/getModel.js +5 -3
- package/graphql/schema/cms/helpers/getModel.js.map +1 -1
- package/graphql/schema/cms/helpers/index.d.ts +1 -0
- package/graphql/schema/cms/helpers/index.js +1 -0
- package/graphql/schema/cms/helpers.d.ts +1 -0
- package/graphql/schema/cms/helpers.js +1 -0
- package/graphql/schema/cms/listEntriesResolver.js +5 -4
- package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
- package/graphql/schema/cms/publishEntryResolver.js +2 -2
- package/graphql/schema/cms/publishEntryResolver.js.map +1 -1
- package/graphql/schema/cms/resolvers/createEntry.d.ts +2 -2
- package/graphql/schema/cms/resolvers/createEntry.js +1 -1
- package/graphql/schema/cms/resolvers/createEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +2 -2
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js +1 -1
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/getEntry.d.ts +2 -2
- package/graphql/schema/cms/resolvers/getEntry.js +1 -1
- package/graphql/schema/cms/resolvers/getEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/getModel.d.ts +8 -0
- package/graphql/schema/cms/resolvers/getModel.js +18 -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 +2 -2
- package/graphql/schema/cms/resolvers/listEntries.js +1 -1
- package/graphql/schema/cms/resolvers/listEntries.js.map +1 -1
- package/graphql/schema/cms/resolvers/mutationCms.d.ts +2 -2
- package/graphql/schema/cms/resolvers/mutationCms.js +1 -1
- package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +2 -2
- package/graphql/schema/cms/resolvers/publishEntryRevision.js +1 -1
- package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/queryCms.d.ts +2 -2
- package/graphql/schema/cms/resolvers/queryCms.js +1 -1
- package/graphql/schema/cms/resolvers/queryCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +2 -2
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +1 -1
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +2 -2
- package/graphql/schema/cms/resolvers/updateEntryRevision.js +1 -1
- package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -1
- package/graphql/schema/cms/typeDefs/mutation.d.ts +2 -2
- package/graphql/schema/cms/typeDefs/mutation.js +1 -1
- package/graphql/schema/cms/typeDefs/mutation.js.map +1 -1
- package/graphql/schema/cms/typeDefs/query.d.ts +2 -2
- package/graphql/schema/cms/typeDefs/query.js +2 -1
- package/graphql/schema/cms/typeDefs/query.js.map +1 -1
- package/graphql/schema/cms/typeDefs/responses.d.ts +2 -2
- package/graphql/schema/cms/typeDefs/responses.js +6 -1
- package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
- package/graphql/schema/cms/unpublishEntryResolver.js +2 -2
- package/graphql/schema/cms/unpublishEntryResolver.js.map +1 -1
- package/graphql/schema/cms/updateEntryResolver.js +2 -2
- package/graphql/schema/cms/updateEntryResolver.js.map +1 -1
- package/graphql/schema/contentEntries.js +43 -32
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModelGroups.js +39 -18
- package/graphql/schema/contentModelGroups.js.map +1 -1
- package/graphql/schema/contentModels.js +68 -16
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +1 -1
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageResolvers.js +4 -2
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreate.js +5 -3
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js +5 -3
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDelete.js +9 -4
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +5 -3
- package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGet.js +11 -6
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetByIds.js +5 -3
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js +5 -3
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +5 -3
- package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveList.js +5 -3
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveListDeleted.js +5 -3
- package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveMove.js +4 -2
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolvePublish.js +5 -3
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRepublish.js +5 -3
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js +5 -3
- package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUnpublish.js +5 -3
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdate.js +5 -3
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveUpdateRevisionDescription.js +5 -3
- package/graphql/schema/resolvers/manage/resolveUpdateRevisionDescription.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveValidate.js +5 -3
- package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveGet.js +6 -3
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/preview/resolveList.js +5 -3
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveGet.js +5 -2
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/read/resolveList.js +5 -3
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
- package/graphql/schema/resolvers/singular/resolveGet.js +1 -1
- package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -1
- package/graphql/schema/resolvers/singular/resolveUpdate.js +1 -1
- package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -1
- package/graphql/schema/schemaPlugins.d.ts +2 -1
- package/graphql/schema/schemaPlugins.js +2 -4
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/index.d.ts +7 -6
- package/index.js +4 -22
- package/legacy/abstractions.js.map +1 -1
- package/package.json +23 -29
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +2 -2
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js +1 -1
- package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -1
- package/plugins/CmsModelPlugin.js +2 -1
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/plugins/index.d.ts +0 -1
- package/plugins/index.js +0 -1
- package/types/fields/dynamicZoneField.d.ts +1 -0
- package/types/model.d.ts +6 -0
- package/types/modelField.d.ts +2 -0
- package/types/types.d.ts +10 -183
- package/types/types.js.map +1 -1
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.d.ts +28 -0
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js +324 -0
- package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js.map +1 -0
- package/utils/contentModelToJsonSchema/index.d.ts +2 -0
- package/utils/contentModelToJsonSchema/index.js +1 -0
- package/utils/contentModelToJsonSchema/types.d.ts +24 -0
- package/utils/contentModelToJsonSchema/types.js +0 -0
- package/utils/converters/ConverterCollection.d.ts +2 -2
- package/utils/converters/ConverterCollection.js +1 -3
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyFromStorageConverter.d.ts +2 -2
- package/utils/converters/valueKeyFromStorageConverter.js +2 -2
- package/utils/converters/valueKeyFromStorageConverter.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.js +4 -2
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/converters/valueKeyToStorageConverter.d.ts +2 -2
- package/utils/converters/valueKeyToStorageConverter.js +2 -2
- package/utils/converters/valueKeyToStorageConverter.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +2 -2
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/isHeadlessCmsReady.d.ts +1 -1
- package/utils/isHeadlessCmsReady.js +3 -2
- package/utils/isHeadlessCmsReady.js.map +1 -1
- package/abstractions/entryHooks/OnEntryBeforeCreate.d.ts +0 -8
- package/abstractions/entryHooks/OnEntryBeforeCreate.js +0 -5
- package/abstractions/entryHooks/OnEntryBeforeCreate.js.map +0 -1
- package/abstractions/entryHooks/index.d.ts +0 -1
- package/abstractions/entryHooks/index.js +0 -1
- package/abstractions/index.d.ts +0 -1
- package/abstractions/index.js +0 -1
- package/context.d.ts +0 -3
- package/context.js +0 -131
- package/context.js.map +0 -1
- package/extensions/entryHooks/OnEntryBeforeCreate.d.ts +0 -4
- package/extensions/entryHooks/OnEntryBeforeCreate.js +0 -21
- package/extensions/entryHooks/OnEntryBeforeCreate.js.map +0 -1
- package/extensions/entryHooks/index.d.ts +0 -1
- package/extensions/entryHooks/index.js +0 -1
- package/extensions/index.d.ts +0 -5
- package/extensions/index.js +0 -7
- package/extensions/index.js.map +0 -1
- package/features/runtimeTenant/RuntimeTenant.d.ts +0 -13
- package/features/runtimeTenant/RuntimeTenant.js +0 -22
- package/features/runtimeTenant/RuntimeTenant.js.map +0 -1
- package/features/runtimeTenant/abstractions.d.ts +0 -11
- package/features/runtimeTenant/abstractions.js +0 -5
- package/features/runtimeTenant/abstractions.js.map +0 -1
- package/features/runtimeTenant/index.d.ts +0 -2
- package/features/runtimeTenant/index.js +0 -2
- package/graphql/graphQLHandlerFactory.d.ts +0 -5
- package/graphql/graphQLHandlerFactory.js +0 -22
- package/graphql/graphQLHandlerFactory.js.map +0 -1
- package/graphql/handleRequest.d.ts +0 -11
- package/graphql/handleRequest.js +0 -62
- package/graphql/handleRequest.js.map +0 -1
- package/graphql/index.d.ts +0 -4
- package/graphql/index.js +0 -11
- package/graphql/index.js.map +0 -1
- package/graphql/schema/cms/index.d.ts +0 -2
- package/graphql/schema/cms/index.js +0 -24
- package/graphql/schema/cms/index.js.map +0 -1
- package/index.js.map +0 -1
- package/parameters/context.d.ts +0 -2
- package/parameters/context.js +0 -7
- package/parameters/context.js.map +0 -1
- package/parameters/header.d.ts +0 -2
- package/parameters/header.js +0 -13
- package/parameters/header.js.map +0 -1
- package/parameters/index.d.ts +0 -3
- package/parameters/index.js +0 -3
- package/parameters/path.d.ts +0 -2
- package/parameters/path.js +0 -12
- package/parameters/path.js.map +0 -1
- package/plugins/CmsParametersPlugin.d.ts +0 -18
- package/plugins/CmsParametersPlugin.js +0 -16
- package/plugins/CmsParametersPlugin.js.map +0 -1
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { PrivateModelBuilder } from "./models/PrivateModelBuilder.js";
|
|
2
2
|
import type { PublicModelBuilder } from "./models/PublicModelBuilder.js";
|
|
3
3
|
import type { IModelBuilderPrivateInput, IModelBuilderPublicInput } from "./models/ModelBuilder.js";
|
|
4
|
+
/**
|
|
5
|
+
* Augmentable model settings interface.
|
|
6
|
+
* External packages can extend this via module augmentation.
|
|
7
|
+
*/
|
|
8
|
+
export interface IModelSettings {
|
|
9
|
+
aiEntryWizard?: boolean;
|
|
10
|
+
previewPrefix?: string;
|
|
11
|
+
previewSlug?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* Augmentable field builder registry. Provides access to all registered field types.
|
|
6
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/abstractions.js","sources":["../../../src/features/modelBuilder/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { PrivateModelBuilder } from \"./models/PrivateModelBuilder.js\";\nimport type { PublicModelBuilder } from \"./models/PublicModelBuilder.js\";\nimport type { IModelBuilderPrivateInput, IModelBuilderPublicInput } from \"./models/ModelBuilder.js\";\n\n/**\n * Augmentable field builder registry. Provides access to all registered field types.\n */\nexport interface IFieldBuilderRegistry {\n /**\n * Mark the next field creation as an extension.\n * When extending, the registry will create a temporary builder marked with _extendMode,\n * and BaseModelBuilder will merge its operations into the existing field.\n */\n extend(): this;\n\n // Field types will be added via module augmentation by field type implementations\n // Example: text(): ITextFieldBuilder;\n}\n\n/**\n * @internal Do not export this abstraction. We don't want external developers to use it.\n */\nexport const FieldBuilderRegistry =\n createAbstraction<FieldBuilderRegistry.Interface>(\"FieldBuilderRegistry\");\n\nexport namespace FieldBuilderRegistry {\n export interface Interface extends IFieldBuilderRegistry {}\n}\n\n/**\n * Unified Model abstraction\n * External developers implement this to provide both public and private models\n */\n\nexport interface IModelBuilder {\n private(input: IModelBuilderPrivateInput): PrivateModelBuilder;\n public(input: IModelBuilderPublicInput): PublicModelBuilder;\n}\n\nexport interface IModelFactory {\n execute(builder: IModelBuilder): Promise<PrivateModelBuilder[] | PublicModelBuilder[]>;\n}\n\n/** Provide code-defined content models. */\nexport const ModelFactory = createAbstraction<IModelFactory>(\"Cms/ModelFactory\");\nexport namespace ModelFactory {\n export type Interface = IModelFactory;\n export type Return = Promise<PrivateModelBuilder[] | PublicModelBuilder[]>;\n export type Builder = IModelBuilder;\n export type FieldBuilder = FieldBuilderRegistry.Interface;\n}\n"],"names":["FieldBuilderRegistry","createAbstraction","ModelFactory"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/abstractions.js","sources":["../../../src/features/modelBuilder/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { PrivateModelBuilder } from \"./models/PrivateModelBuilder.js\";\nimport type { PublicModelBuilder } from \"./models/PublicModelBuilder.js\";\nimport type { IModelBuilderPrivateInput, IModelBuilderPublicInput } from \"./models/ModelBuilder.js\";\n\n/**\n * Augmentable model settings interface.\n * External packages can extend this via module augmentation.\n */\nexport interface IModelSettings {\n aiEntryWizard?: boolean;\n previewPrefix?: string;\n previewSlug?: string;\n [key: string]: any;\n}\n\n/**\n * Augmentable field builder registry. Provides access to all registered field types.\n */\nexport interface IFieldBuilderRegistry {\n /**\n * Mark the next field creation as an extension.\n * When extending, the registry will create a temporary builder marked with _extendMode,\n * and BaseModelBuilder will merge its operations into the existing field.\n */\n extend(): this;\n\n // Field types will be added via module augmentation by field type implementations\n // Example: text(): ITextFieldBuilder;\n}\n\n/**\n * @internal Do not export this abstraction. We don't want external developers to use it.\n */\nexport const FieldBuilderRegistry =\n createAbstraction<FieldBuilderRegistry.Interface>(\"FieldBuilderRegistry\");\n\nexport namespace FieldBuilderRegistry {\n export interface Interface extends IFieldBuilderRegistry {}\n}\n\n/**\n * Unified Model abstraction\n * External developers implement this to provide both public and private models\n */\n\nexport interface IModelBuilder {\n private(input: IModelBuilderPrivateInput): PrivateModelBuilder;\n public(input: IModelBuilderPublicInput): PublicModelBuilder;\n}\n\nexport interface IModelFactory {\n execute(builder: IModelBuilder): Promise<PrivateModelBuilder[] | PublicModelBuilder[]>;\n}\n\n/** Provide code-defined content models. */\nexport const ModelFactory = createAbstraction<IModelFactory>(\"Cms/ModelFactory\");\nexport namespace ModelFactory {\n export type Interface = IModelFactory;\n export type Return = Promise<PrivateModelBuilder[] | PublicModelBuilder[]>;\n export type Builder = IModelBuilder;\n export type FieldBuilder = FieldBuilderRegistry.Interface;\n}\n"],"names":["FieldBuilderRegistry","createAbstraction","ModelFactory"],"mappings":";AAkCO,MAAMA,uBACTC,kBAAkD;AAqB/C,MAAMC,eAAeD,kBAAiC"}
|
|
@@ -9,6 +9,7 @@ import { DynamicZoneFieldType } from "./fields/DynamicZoneFieldType.js";
|
|
|
9
9
|
import { NumberFieldType } from "./fields/NumberFieldType.js";
|
|
10
10
|
import { BooleanFieldType } from "./fields/BooleanFieldType.js";
|
|
11
11
|
import { FileFieldType } from "./fields/FileFieldType.js";
|
|
12
|
+
import { AssetFieldType } from "./fields/AssetFieldType.js";
|
|
12
13
|
import { DateTimeFieldType } from "./fields/DateTimeFieldType.js";
|
|
13
14
|
import { JsonFieldType } from "./fields/JsonFieldType.js";
|
|
14
15
|
import { SearchableJsonFieldType } from "./fields/SearchableJsonFieldType.js";
|
|
@@ -31,6 +32,7 @@ const ModelBuilderFeature = createFeature({
|
|
|
31
32
|
container.register(NumberFieldType);
|
|
32
33
|
container.register(BooleanFieldType);
|
|
33
34
|
container.register(FileFieldType);
|
|
35
|
+
container.register(AssetFieldType);
|
|
34
36
|
container.register(DateTimeFieldType);
|
|
35
37
|
container.register(JsonFieldType);
|
|
36
38
|
container.register(SearchableJsonFieldType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/feature.js","sources":["../../../src/features/modelBuilder/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FieldBuilderRegistry } from \"./fields/FieldBuilderRegistry.js\";\nimport { TextFieldType } from \"./fields/TextFieldType.js\";\nimport { LongTextFieldType } from \"./fields/LongTextFieldType.js\";\nimport { RichTextFieldType } from \"./fields/RichTextFieldType.js\";\nimport { ObjectFieldType } from \"./fields/ObjectFieldType.js\";\nimport { RefFieldType } from \"./fields/RefFieldType.js\";\nimport { DynamicZoneFieldType } from \"./fields/DynamicZoneFieldType.js\";\nimport { NumberFieldType } from \"./fields/NumberFieldType.js\";\nimport { BooleanFieldType } from \"./fields/BooleanFieldType.js\";\nimport { FileFieldType } from \"./fields/FileFieldType.js\";\nimport { DateTimeFieldType } from \"./fields/DateTimeFieldType.js\";\nimport { JsonFieldType } from \"./fields/JsonFieldType.js\";\nimport { SearchableJsonFieldType } from \"./fields/SearchableJsonFieldType.js\";\n// import { LocationFieldType } from \"./fields/LocationFieldType.js\";\nimport { FieldBuilderRegistry as FieldsRegistryAbstraction, ModelFactory } from \"./abstractions.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport { ModelsProvider as ModelsProviderAbstraction } from \"./models/abstractions.js\";\nimport { ModelsProvider } from \"./models/ModelsProvider.js\";\nimport { UiSeparatorFieldType } from \"./fields/UiSeparatorFieldType.js\";\nimport { UiAlertFieldType } from \"./fields/UiAlertFieldType.js\";\nimport { UiTabsFieldType } from \"./fields/UiTabsFieldType.js\";\n\nexport const ModelBuilderFeature = createFeature({\n name: \"ModelBuilder\",\n register(container) {\n // Register core field types\n container.register(TextFieldType);\n container.register(LongTextFieldType);\n container.register(RichTextFieldType);\n container.register(ObjectFieldType);\n container.register(RefFieldType);\n container.register(DynamicZoneFieldType);\n container.register(NumberFieldType);\n container.register(BooleanFieldType);\n container.register(FileFieldType);\n container.register(DateTimeFieldType);\n container.register(JsonFieldType);\n container.register(SearchableJsonFieldType);\n container.register(UiSeparatorFieldType);\n container.register(UiAlertFieldType);\n container.register(UiTabsFieldType);\n // container.register(LocationFieldType);\n\n // Register field builder registry (will automatically get all FieldType implementations)\n container.register(FieldBuilderRegistry).inSingletonScope();\n\n // Register unified models provider\n container.registerFactory(ModelsProviderAbstraction, () => {\n let accessControl: AccessControl.Interface | undefined = undefined;\n try {\n // TODO: add `container.resolveOptional`\n accessControl = container.resolve(AccessControl);\n } catch {\n // It's an optional dependency!\n }\n\n return new ModelsProvider(\n // TODO: introduce a `lazy: true` dependency modifier, which will inject a getter.\n () => container.resolveAll(ModelFactory),\n container.resolve(FieldsRegistryAbstraction),\n accessControl\n );\n });\n }\n});\n"],"names":["ModelBuilderFeature","createFeature","container","TextFieldType","LongTextFieldType","RichTextFieldType","ObjectFieldType","RefFieldType","DynamicZoneFieldType","NumberFieldType","BooleanFieldType","FileFieldType","DateTimeFieldType","JsonFieldType","SearchableJsonFieldType","UiSeparatorFieldType","UiAlertFieldType","UiTabsFieldType","FieldBuilderRegistry","ModelsProviderAbstraction","accessControl","AccessControl","ModelsProvider","ModelFactory","FieldsRegistryAbstraction"],"mappings":"
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/feature.js","sources":["../../../src/features/modelBuilder/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FieldBuilderRegistry } from \"./fields/FieldBuilderRegistry.js\";\nimport { TextFieldType } from \"./fields/TextFieldType.js\";\nimport { LongTextFieldType } from \"./fields/LongTextFieldType.js\";\nimport { RichTextFieldType } from \"./fields/RichTextFieldType.js\";\nimport { ObjectFieldType } from \"./fields/ObjectFieldType.js\";\nimport { RefFieldType } from \"./fields/RefFieldType.js\";\nimport { DynamicZoneFieldType } from \"./fields/DynamicZoneFieldType.js\";\nimport { NumberFieldType } from \"./fields/NumberFieldType.js\";\nimport { BooleanFieldType } from \"./fields/BooleanFieldType.js\";\nimport { FileFieldType } from \"./fields/FileFieldType.js\";\nimport { AssetFieldType } from \"./fields/AssetFieldType.js\";\nimport { DateTimeFieldType } from \"./fields/DateTimeFieldType.js\";\nimport { JsonFieldType } from \"./fields/JsonFieldType.js\";\nimport { SearchableJsonFieldType } from \"./fields/SearchableJsonFieldType.js\";\n// import { LocationFieldType } from \"./fields/LocationFieldType.js\";\nimport { FieldBuilderRegistry as FieldsRegistryAbstraction, ModelFactory } from \"./abstractions.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport { ModelsProvider as ModelsProviderAbstraction } from \"./models/abstractions.js\";\nimport { ModelsProvider } from \"./models/ModelsProvider.js\";\nimport { UiSeparatorFieldType } from \"./fields/UiSeparatorFieldType.js\";\nimport { UiAlertFieldType } from \"./fields/UiAlertFieldType.js\";\nimport { UiTabsFieldType } from \"./fields/UiTabsFieldType.js\";\n\nexport const ModelBuilderFeature = createFeature({\n name: \"ModelBuilder\",\n register(container) {\n // Register core field types\n container.register(TextFieldType);\n container.register(LongTextFieldType);\n container.register(RichTextFieldType);\n container.register(ObjectFieldType);\n container.register(RefFieldType);\n container.register(DynamicZoneFieldType);\n container.register(NumberFieldType);\n container.register(BooleanFieldType);\n container.register(FileFieldType);\n container.register(AssetFieldType);\n container.register(DateTimeFieldType);\n container.register(JsonFieldType);\n container.register(SearchableJsonFieldType);\n container.register(UiSeparatorFieldType);\n container.register(UiAlertFieldType);\n container.register(UiTabsFieldType);\n // container.register(LocationFieldType);\n\n // Register field builder registry (will automatically get all FieldType implementations)\n container.register(FieldBuilderRegistry).inSingletonScope();\n\n // Register unified models provider\n container.registerFactory(ModelsProviderAbstraction, () => {\n let accessControl: AccessControl.Interface | undefined = undefined;\n try {\n // TODO: add `container.resolveOptional`\n accessControl = container.resolve(AccessControl);\n } catch {\n // It's an optional dependency!\n }\n\n return new ModelsProvider(\n // TODO: introduce a `lazy: true` dependency modifier, which will inject a getter.\n () => container.resolveAll(ModelFactory),\n container.resolve(FieldsRegistryAbstraction),\n accessControl\n );\n });\n }\n});\n"],"names":["ModelBuilderFeature","createFeature","container","TextFieldType","LongTextFieldType","RichTextFieldType","ObjectFieldType","RefFieldType","DynamicZoneFieldType","NumberFieldType","BooleanFieldType","FileFieldType","AssetFieldType","DateTimeFieldType","JsonFieldType","SearchableJsonFieldType","UiSeparatorFieldType","UiAlertFieldType","UiTabsFieldType","FieldBuilderRegistry","ModelsProviderAbstraction","accessControl","AccessControl","ModelsProvider","ModelFactory","FieldsRegistryAbstraction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QAEdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;QACnBR,UAAU,QAAQ,CAACS;QACnBT,UAAU,QAAQ,CAACU;QACnBV,UAAU,QAAQ,CAACW;QACnBX,UAAU,QAAQ,CAACY;QACnBZ,UAAU,QAAQ,CAACa;QACnBb,UAAU,QAAQ,CAACc;QACnBd,UAAU,QAAQ,CAACe;QACnBf,UAAU,QAAQ,CAACgB;QAInBhB,UAAU,QAAQ,CAACiB,sBAAsB,gBAAgB;QAGzDjB,UAAU,eAAe,CAACkB,gBAA2B;YACjD,IAAIC;YACJ,IAAI;gBAEAA,gBAAgBnB,UAAU,OAAO,CAACoB;YACtC,EAAE,OAAM,CAER;YAEA,OAAO,IAAIC,iCAEP,IAAMrB,UAAU,UAAU,CAACsB,eAC3BtB,UAAU,OAAO,CAACuB,gDAClBJ;QAER;IACJ;AACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type IFieldTypeFactory } from "./abstractions.js";
|
|
2
|
+
import { DataFieldBuilder } from "./FieldBuilder.js";
|
|
3
|
+
import { RequiredValidator } from "./fieldTypeValidator.js";
|
|
4
|
+
export interface IAssetFieldBuilder extends DataFieldBuilder<"asset">, RequiredValidator {
|
|
5
|
+
accept(mimeTypes: string[]): this;
|
|
6
|
+
imagesOnly(): this;
|
|
7
|
+
}
|
|
8
|
+
declare class AssetFieldTypeFactory implements IFieldTypeFactory {
|
|
9
|
+
readonly type = "asset";
|
|
10
|
+
create(): IAssetFieldBuilder;
|
|
11
|
+
}
|
|
12
|
+
export declare const AssetFieldType: typeof AssetFieldTypeFactory & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<IFieldTypeFactory>;
|
|
14
|
+
};
|
|
15
|
+
declare module "../abstractions.js" {
|
|
16
|
+
interface IFieldBuilderRegistry {
|
|
17
|
+
asset(): IAssetFieldBuilder;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { FieldType } from "./abstractions.js";
|
|
2
|
+
import { DataFieldBuilder } from "./FieldBuilder.js";
|
|
3
|
+
class AssetFieldBuilder extends DataFieldBuilder {
|
|
4
|
+
constructor(){
|
|
5
|
+
super("asset");
|
|
6
|
+
this.label("Asset");
|
|
7
|
+
this.renderer("assetField");
|
|
8
|
+
}
|
|
9
|
+
required(message) {
|
|
10
|
+
return this.validation({
|
|
11
|
+
name: "required",
|
|
12
|
+
message: message || "Value is required.",
|
|
13
|
+
settings: {}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
list() {
|
|
17
|
+
super.list();
|
|
18
|
+
this.renderer("assetFields");
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
accept(mimeTypes) {
|
|
22
|
+
this.config.settings = this.config.settings || {};
|
|
23
|
+
this.config.settings.accept = mimeTypes;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
imagesOnly() {
|
|
27
|
+
this.config.settings = this.config.settings || {};
|
|
28
|
+
this.config.settings.imagesOnly = true;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class AssetFieldTypeFactory {
|
|
33
|
+
create() {
|
|
34
|
+
return new AssetFieldBuilder();
|
|
35
|
+
}
|
|
36
|
+
constructor(){
|
|
37
|
+
this.type = "asset";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const AssetFieldType = FieldType.createImplementation({
|
|
41
|
+
implementation: AssetFieldTypeFactory,
|
|
42
|
+
dependencies: []
|
|
43
|
+
});
|
|
44
|
+
export { AssetFieldType };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=AssetFieldType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/AssetFieldType.js","sources":["../../../../src/features/modelBuilder/fields/AssetFieldType.ts"],"sourcesContent":["import { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport { DataFieldBuilder } from \"./FieldBuilder.js\";\nimport { RequiredValidator } from \"./fieldTypeValidator.js\";\n\nexport interface IAssetFieldBuilder extends DataFieldBuilder<\"asset\">, RequiredValidator {\n accept(mimeTypes: string[]): this;\n imagesOnly(): this;\n}\n\nclass AssetFieldBuilder extends DataFieldBuilder<\"asset\"> implements IAssetFieldBuilder {\n public constructor() {\n super(\"asset\");\n this.label(\"Asset\");\n this.renderer(\"assetField\");\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 override list(): this {\n super.list();\n this.renderer(\"assetFields\");\n return this;\n }\n\n accept(mimeTypes: string[]): this {\n this.config.settings = this.config.settings || {};\n this.config.settings.accept = mimeTypes;\n return this;\n }\n\n imagesOnly(): this {\n this.config.settings = this.config.settings || {};\n this.config.settings.imagesOnly = true;\n return this;\n }\n}\n\nclass AssetFieldTypeFactory implements IFieldTypeFactory {\n readonly type = \"asset\";\n\n create(): IAssetFieldBuilder {\n return new AssetFieldBuilder();\n }\n}\n\nexport const AssetFieldType = FieldType.createImplementation({\n implementation: AssetFieldTypeFactory,\n dependencies: []\n});\n\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n asset(): IAssetFieldBuilder;\n }\n}\n"],"names":["AssetFieldBuilder","DataFieldBuilder","message","mimeTypes","AssetFieldTypeFactory","AssetFieldType","FieldType"],"mappings":";;AASA,MAAMA,0BAA0BC;IAC5B,aAAqB;QACjB,KAAK,CAAC;QACN,IAAI,CAAC,KAAK,CAAC;QACX,IAAI,CAAC,QAAQ,CAAC;IAClB;IAEA,SAASC,OAAgB,EAAQ;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU,CAAC;QACf;IACJ;IAES,OAAa;QAClB,KAAK,CAAC;QACN,IAAI,CAAC,QAAQ,CAAC;QACd,OAAO,IAAI;IACf;IAEA,OAAOC,SAAmB,EAAQ;QAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAGA;QAC9B,OAAO,IAAI;IACf;IAEA,aAAmB;QACf,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG;QAClC,OAAO,IAAI;IACf;AACJ;AAEA,MAAMC;IAGF,SAA6B;QACzB,OAAO,IAAIJ;IACf;;aAJS,IAAI,GAAG;;AAKpB;AAEO,MAAMK,iBAAiBC,UAAU,oBAAoB,CAAC;IACzD,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -25,15 +25,18 @@ export interface IFieldRendererRegistry {
|
|
|
25
25
|
dateTimeInputs: {
|
|
26
26
|
fieldType: "datetime";
|
|
27
27
|
settings?: {
|
|
28
|
-
|
|
29
|
-
addValueButtonLabel?: string;
|
|
30
|
-
};
|
|
28
|
+
addItemLabel?: string;
|
|
31
29
|
};
|
|
32
30
|
};
|
|
33
31
|
dynamicZone: {
|
|
34
32
|
fieldType: "dynamicZone";
|
|
35
33
|
settings?: {
|
|
34
|
+
/** Whether the accordion is expanded by default. */
|
|
36
35
|
open?: boolean;
|
|
36
|
+
/** Wrap the zone in a container panel. Set to `false` for a flat inline layout. */
|
|
37
|
+
container?: boolean;
|
|
38
|
+
/** Label for the "add item" button (defaults to "Add Item"). */
|
|
39
|
+
addItemLabel?: string;
|
|
37
40
|
};
|
|
38
41
|
};
|
|
39
42
|
hidden: {
|
|
@@ -47,9 +50,7 @@ export interface IFieldRendererRegistry {
|
|
|
47
50
|
lexicalEditors: {
|
|
48
51
|
fieldType: "rich-text";
|
|
49
52
|
settings?: {
|
|
50
|
-
|
|
51
|
-
addValueButtonLabel?: string;
|
|
52
|
-
};
|
|
53
|
+
addItemLabel?: string;
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
textarea: {
|
|
@@ -59,9 +60,7 @@ export interface IFieldRendererRegistry {
|
|
|
59
60
|
textareas: {
|
|
60
61
|
fieldType: "long-text";
|
|
61
62
|
settings: {
|
|
62
|
-
|
|
63
|
-
addValueButtonLabel?: string;
|
|
64
|
-
};
|
|
63
|
+
addItemLabel?: string;
|
|
65
64
|
};
|
|
66
65
|
};
|
|
67
66
|
numberInput: {
|
|
@@ -71,24 +70,35 @@ export interface IFieldRendererRegistry {
|
|
|
71
70
|
numberInputs: {
|
|
72
71
|
fieldType: "number";
|
|
73
72
|
settings?: {
|
|
74
|
-
|
|
75
|
-
addValueButtonLabel?: string;
|
|
76
|
-
};
|
|
73
|
+
addItemLabel?: string;
|
|
77
74
|
};
|
|
78
75
|
};
|
|
79
76
|
objectAccordionSingle: {
|
|
80
77
|
fieldType: "object";
|
|
81
78
|
settings?: {
|
|
79
|
+
/** Whether the accordion is expanded by default. */
|
|
82
80
|
open?: boolean;
|
|
81
|
+
/** Wrap the object in a container panel. Set to `false` for a flat inline layout. */
|
|
82
|
+
container?: boolean;
|
|
83
|
+
/** Field ID whose value is used as the accordion title, or a function receiving the object data. */
|
|
84
|
+
itemTitle?: string;
|
|
85
|
+
/** Field ID whose value is used as the accordion description, or a function receiving the object data. */
|
|
86
|
+
itemDescription?: string;
|
|
83
87
|
};
|
|
84
88
|
};
|
|
85
89
|
objectAccordionMultiple: {
|
|
86
90
|
fieldType: "object";
|
|
87
91
|
settings?: {
|
|
92
|
+
/** Whether each accordion item is expanded by default. */
|
|
88
93
|
open?: boolean;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
/** Wrap the list in a container panel. Set to `false` for a flat inline layout. */
|
|
95
|
+
container?: boolean;
|
|
96
|
+
/** Field ID whose value is used as each item's accordion title. */
|
|
97
|
+
itemTitle?: string;
|
|
98
|
+
/** Field ID whose value is used as each item's accordion description. */
|
|
99
|
+
itemDescription?: string;
|
|
100
|
+
/** Label for the "add item" button (defaults to "Add {fieldLabel}"). */
|
|
101
|
+
addItemLabel?: string;
|
|
92
102
|
};
|
|
93
103
|
};
|
|
94
104
|
passthrough: {
|
|
@@ -106,6 +116,7 @@ export interface IFieldRendererRegistry {
|
|
|
106
116
|
refDialogMultiple: {
|
|
107
117
|
fieldType: "ref";
|
|
108
118
|
settings?: {
|
|
119
|
+
/** Where newly picked references are inserted: `"first"` (top) or `"last"` (bottom, default). */
|
|
109
120
|
newItemPosition?: "first" | "last";
|
|
110
121
|
};
|
|
111
122
|
};
|
|
@@ -125,6 +136,11 @@ export interface IFieldRendererRegistry {
|
|
|
125
136
|
fieldType: "ref";
|
|
126
137
|
settings: undefined;
|
|
127
138
|
};
|
|
139
|
+
select: {
|
|
140
|
+
fieldType: "text" | "number";
|
|
141
|
+
settings: undefined;
|
|
142
|
+
};
|
|
143
|
+
/** @deprecated Use "select" instead. */
|
|
128
144
|
dropdown: {
|
|
129
145
|
fieldType: "text" | "number";
|
|
130
146
|
settings: undefined;
|
|
@@ -140,21 +156,41 @@ export interface IFieldRendererRegistry {
|
|
|
140
156
|
textInputs: {
|
|
141
157
|
fieldType: "text";
|
|
142
158
|
settings?: {
|
|
143
|
-
|
|
144
|
-
addValueButtonLabel?: string;
|
|
145
|
-
};
|
|
159
|
+
addItemLabel?: string;
|
|
146
160
|
};
|
|
147
161
|
};
|
|
162
|
+
/** @deprecated Use `assetField` instead. */
|
|
148
163
|
file: {
|
|
149
164
|
fieldType: "file";
|
|
150
165
|
settings?: {
|
|
166
|
+
/** Only allow image files to be selected. */
|
|
151
167
|
imagesOnly?: boolean;
|
|
152
168
|
};
|
|
153
169
|
};
|
|
170
|
+
/** @deprecated Use `assetFields` instead. */
|
|
154
171
|
files: {
|
|
155
172
|
fieldType: "file";
|
|
156
173
|
settings?: {
|
|
174
|
+
/** Only allow image files to be selected. */
|
|
175
|
+
imagesOnly?: boolean;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
assetField: {
|
|
179
|
+
fieldType: "asset";
|
|
180
|
+
settings?: {
|
|
181
|
+
/** Only allow image files to be selected. */
|
|
182
|
+
imagesOnly?: boolean;
|
|
183
|
+
/** MIME types or extensions to allow (e.g. `["image/png", "application/pdf"]`). Leave empty to allow all. */
|
|
184
|
+
accept?: string[];
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
assetFields: {
|
|
188
|
+
fieldType: "asset";
|
|
189
|
+
settings?: {
|
|
190
|
+
/** Only allow image files to be selected. */
|
|
157
191
|
imagesOnly?: boolean;
|
|
192
|
+
/** MIME types or extensions to allow (e.g. `["image/png", "application/pdf"]`). Leave empty to allow all. */
|
|
193
|
+
accept?: string[];
|
|
158
194
|
};
|
|
159
195
|
};
|
|
160
196
|
uiSeparator: {
|
|
@@ -24,12 +24,15 @@ const rendererNameMap = {
|
|
|
24
24
|
refAutocompleteMultiple: "ref-inputs",
|
|
25
25
|
refCheckboxes: "ref-simple-multiple",
|
|
26
26
|
refRadioButtons: "ref-simple-single",
|
|
27
|
+
select: "select-box",
|
|
27
28
|
dropdown: "select-box",
|
|
28
29
|
tags: "tags",
|
|
29
30
|
textInput: "text-input",
|
|
30
31
|
textInputs: "text-inputs",
|
|
31
32
|
file: "file-input",
|
|
32
33
|
files: "file-inputs",
|
|
34
|
+
assetField: "asset-input",
|
|
35
|
+
assetFields: "asset-inputs",
|
|
33
36
|
uiSeparator: "uiSeparator",
|
|
34
37
|
uiAlert: "uiAlert",
|
|
35
38
|
uiTabs: "uiTabs"
|
|
@@ -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 multiValue?: {\n addValueButtonLabel?: string;\n };\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 multiValue?: {\n addValueButtonLabel?: string;\n };\n };\n };\n textarea: {\n fieldType: \"long-text\";\n settings: undefined;\n };\n textareas: {\n fieldType: \"long-text\";\n settings: {\n multiValue?: {\n addValueButtonLabel?: string;\n };\n };\n };\n numberInput: {\n fieldType: \"number\";\n settings: undefined;\n };\n numberInputs: {\n fieldType: \"number\";\n settings?: {\n multiValue?: {\n addValueButtonLabel?: string;\n };\n };\n };\n objectAccordionSingle: {\n fieldType: \"object\";\n settings?: {\n open?: boolean;\n };\n };\n objectAccordionMultiple: {\n fieldType: \"object\";\n settings?: {\n open?: boolean;\n multiValue?: {\n addValueButtonLabel?: string;\n };\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 multiValue?: {\n addValueButtonLabel?: string;\n };\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 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":"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"}
|
|
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 /** 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 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 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 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":"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"}
|
|
@@ -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;
|
|
@@ -31,6 +31,7 @@ class DynamicZoneFieldBuilder extends DataFieldBuilder {
|
|
|
31
31
|
gqlTypeName: config.gqlTypeName,
|
|
32
32
|
icon: config.icon,
|
|
33
33
|
description: config.description || "",
|
|
34
|
+
componentName: config.componentName,
|
|
34
35
|
fields,
|
|
35
36
|
layout,
|
|
36
37
|
validation: []
|
|
@@ -40,12 +41,7 @@ class DynamicZoneFieldBuilder extends DataFieldBuilder {
|
|
|
40
41
|
build() {
|
|
41
42
|
this.config.settings = this.config.settings || {};
|
|
42
43
|
this.config.settings.templates = this.templates;
|
|
43
|
-
this.config.listValidation = [
|
|
44
|
-
{
|
|
45
|
-
name: "dynamicZone",
|
|
46
|
-
message: ""
|
|
47
|
-
}
|
|
48
|
-
];
|
|
44
|
+
this.config.listValidation = [];
|
|
49
45
|
return super.build();
|
|
50
46
|
}
|
|
51
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 {\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 fields: any[];\n layout: CmsModelLayoutCell[][];\n validation: CmsModelFieldValidation[];\n}\n\nexport interface IDynamicZoneFieldBuilder extends DataFieldBuilder<\"dynamicZone\"> {\n required(message?: string): this;\n template(\n id: string,\n config: {\n name: string;\n gqlTypeName: string;\n icon?: CmsIcon;\n description?: 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 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 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 = [
|
|
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"}
|
|
@@ -23,5 +23,7 @@ declare class TextFieldTypeFactory implements IFieldTypeFactory {
|
|
|
23
23
|
readonly type = "text";
|
|
24
24
|
create(): ITextFieldBuilder;
|
|
25
25
|
}
|
|
26
|
-
export declare const TextFieldType:
|
|
26
|
+
export declare const TextFieldType: typeof TextFieldTypeFactory & {
|
|
27
|
+
__abstraction: import("@webiny/di").Abstraction<IFieldTypeFactory>;
|
|
28
|
+
};
|
|
27
29
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/feature/api";
|
|
2
1
|
import { DataFieldBuilder } from "./FieldBuilder.js";
|
|
3
2
|
import { FieldType } from "./abstractions.js";
|
|
4
3
|
var TextFieldType_TextFieldSubTypes = /*#__PURE__*/ function(TextFieldSubTypes) {
|
|
@@ -148,8 +147,7 @@ class TextFieldTypeFactory {
|
|
|
148
147
|
this.type = "text";
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
const TextFieldType = createImplementation({
|
|
152
|
-
abstraction: FieldType,
|
|
150
|
+
const TextFieldType = FieldType.createImplementation({
|
|
153
151
|
implementation: TextFieldTypeFactory,
|
|
154
152
|
dependencies: []
|
|
155
153
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelBuilder/fields/TextFieldType.js","sources":["../../../../src/features/modelBuilder/fields/TextFieldType.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"features/modelBuilder/fields/TextFieldType.js","sources":["../../../../src/features/modelBuilder/fields/TextFieldType.ts"],"sourcesContent":["import { DataFieldBuilder } from \"./FieldBuilder.js\";\nimport { FieldType, type IFieldTypeFactory } from \"./abstractions.js\";\nimport type { FieldTypeValidator } from \"./fieldTypeValidator.js\";\n\nexport enum TextFieldSubTypes {\n COMPRESSED = \"compressed\",\n ENCRYPTED = \"encrypted\"\n}\n\nexport enum TextFieldTypes {\n TEXT = \"text\",\n COMPRESSED = \"text:compressed\",\n ENCRYPTED = \"text:encrypted\"\n}\n\nexport interface ITextFieldBuilder\n extends\n DataFieldBuilder<\"text\">,\n FieldTypeValidator.Required,\n FieldTypeValidator.MinLength,\n FieldTypeValidator.MaxLength,\n FieldTypeValidator.Pattern,\n FieldTypeValidator.Email,\n FieldTypeValidator.Url,\n FieldTypeValidator.LowerCase,\n FieldTypeValidator.UpperCase,\n FieldTypeValidator.LowerCaseSpace,\n FieldTypeValidator.UpperCaseSpace,\n FieldTypeValidator.Unique {\n compress(): this;\n encrypt(): this;\n}\n\n// Module augmentation for TypeScript autocomplete\ndeclare module \"../abstractions.js\" {\n interface IFieldBuilderRegistry {\n text(): ITextFieldBuilder;\n }\n}\n\nclass TextFieldBuilder extends DataFieldBuilder<\"text\"> implements ITextFieldBuilder {\n public constructor() {\n super(\"text\");\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 minLength(value: number, message?: string): this {\n return this.validation({\n name: \"minLength\",\n message: message || \"Value is too short.\",\n settings: { value: String(value) }\n });\n }\n\n maxLength(value: number, message?: string): this {\n return this.validation({\n name: \"maxLength\",\n message: message || \"Value is too long.\",\n settings: { value: String(value) }\n });\n }\n\n pattern(regex: string, flags: string = \"\", message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Invalid value.\",\n settings: {\n preset: \"custom\",\n regex,\n flags\n }\n });\n }\n\n email(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Please enter a valid e-mail.\",\n settings: {\n preset: \"email\",\n regex: null,\n flags: null\n }\n });\n }\n\n url(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Please enter a valid URL.\",\n settings: {\n preset: \"url\",\n regex: null,\n flags: null\n }\n });\n }\n\n lowerCase(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Only lower case characters are allowed.\",\n settings: {\n preset: \"lowerCase\",\n regex: null,\n flags: null\n }\n });\n }\n\n upperCase(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Only upper case characters are allowed.\",\n settings: {\n preset: \"upperCase\",\n regex: null,\n flags: null\n }\n });\n }\n\n lowerCaseSpace(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Only lower case characters and space are allowed.\",\n settings: {\n preset: \"lowerCaseSpace\",\n regex: null,\n flags: null\n }\n });\n }\n\n upperCaseSpace(message?: string): this {\n return this.validation({\n name: \"pattern\",\n message: message || \"Only upper case characters and space are allowed.\",\n settings: {\n preset: \"upperCaseSpace\",\n regex: null,\n flags: null\n }\n });\n }\n\n unique(message?: string): this {\n return this.validation({\n name: \"unique\",\n message: message || \"Value must be unique.\",\n settings: {}\n });\n }\n\n public compress(): this {\n this.setSubType(TextFieldSubTypes.COMPRESSED);\n\n this.settings({\n disableFullTextSearch: true\n });\n\n return this;\n }\n public encrypt(): this {\n this.setSubType(TextFieldSubTypes.ENCRYPTED);\n\n this.settings({\n disableFullTextSearch: true\n });\n\n return this;\n }\n}\n\nclass TextFieldTypeFactory implements IFieldTypeFactory {\n readonly type = \"text\";\n\n create(): ITextFieldBuilder {\n return new TextFieldBuilder();\n }\n}\n\nexport const TextFieldType = FieldType.createImplementation({\n implementation: TextFieldTypeFactory,\n dependencies: []\n});\n"],"names":["TextFieldSubTypes","TextFieldTypes","TextFieldBuilder","DataFieldBuilder","message","value","String","regex","flags","TextFieldTypeFactory","TextFieldType","FieldType"],"mappings":";;AAIO,IAAKA,kCAAiBA,WAAAA,GAAAA,SAAjBA,iBAAiB;;;WAAjBA;;AAKL,IAAKC,+BAAcA,WAAAA,GAAAA,SAAdA,cAAc;;;;WAAdA;;AA+BZ,MAAMC,yBAAyBC;IAC3B,aAAqB;QACjB,KAAK,CAAC;IACV;IAEA,SAASC,OAAgB,EAAQ;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU,CAAC;QACf;IACJ;IAEA,UAAUC,KAAa,EAAED,OAAgB,EAAQ;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBAAE,OAAOE,OAAOD;YAAO;QACrC;IACJ;IAEA,UAAUA,KAAa,EAAED,OAAgB,EAAQ;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBAAE,OAAOE,OAAOD;YAAO;QACrC;IACJ;IAEA,QAAQE,KAAa,EAAEC,QAAgB,EAAE,EAAEJ,OAAgB,EAAQ;QAC/D,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACRG;gBACAC;YACJ;QACJ;IACJ;IAEA,MAAMJ,OAAgB,EAAQ;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,IAAIA,OAAgB,EAAQ;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,UAAUA,OAAgB,EAAQ;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,UAAUA,OAAgB,EAAQ;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,eAAeA,OAAgB,EAAQ;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,eAAeA,OAAgB,EAAQ;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU;gBACN,QAAQ;gBACR,OAAO;gBACP,OAAO;YACX;QACJ;IACJ;IAEA,OAAOA,OAAgB,EAAQ;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC;YACnB,MAAM;YACN,SAASA,WAAW;YACpB,UAAU,CAAC;QACf;IACJ;IAEO,WAAiB;QACpB,IAAI,CAAC,UAAU,CAAC;QAEhB,IAAI,CAAC,QAAQ,CAAC;YACV,uBAAuB;QAC3B;QAEA,OAAO,IAAI;IACf;IACO,UAAgB;QACnB,IAAI,CAAC,UAAU,CAAC;QAEhB,IAAI,CAAC,QAAQ,CAAC;YACV,uBAAuB;QAC3B;QAEA,OAAO,IAAI;IACf;AACJ;AAEA,MAAMK;IAGF,SAA4B;QACxB,OAAO,IAAIP;IACf;;aAJS,IAAI,GAAG;;AAKpB;AAEO,MAAMQ,gBAAgBC,UAAU,oBAAoB,CAAC;IACxD,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -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"}
|