@webiny/api-headless-cms 6.4.5 → 6.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +192 -0
- package/HeadlessCmsFeature.js.map +1 -0
- package/createCmsRoute.d.ts +21 -0
- package/createCmsRoute.js +49 -0
- package/createCmsRoute.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +1 -1
- package/crud/contentEntry/entryDataValidation.js +2 -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.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 +6 -6
- package/domain/contentModel/schemas.js +1 -1
- 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/storage.d.ts +0 -1
- package/exports/api/cms/storage.js +0 -1
- package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +6 -4
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +7 -8
- 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 -4
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +7 -8
- 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 -4
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/ListEntries/ListEntriesRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js +7 -8
- 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 +8 -4
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +11 -9
- 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 +6 -4
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +7 -8
- 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 +6 -4
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +7 -8
- 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/ContentModelFeature.js +2 -0
- package/features/contentModel/ContentModelFeature.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.d.ts +4 -3
- package/features/contentModel/CreateModel/CreateModelRepository.js +6 -5
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.d.ts +4 -3
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +6 -5
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +3 -3
- package/features/contentModel/DeleteModel/DeleteModelRepository.js +5 -5
- 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/UpdateModel/UpdateModelRepository.d.ts +6 -3
- package/features/contentModel/UpdateModel/UpdateModelRepository.js +11 -7
- package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.d.ts +16 -0
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +51 -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 +8 -4
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +13 -11
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.d.ts +3 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js +2 -3
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +8 -4
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +11 -9
- 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 +6 -4
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +7 -8
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.d.ts +3 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +2 -3
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.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/fields/abstractions/CmsModelFieldToGraphQL.d.ts +2 -2
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/RefToGraphQL.d.ts +1 -1
- package/features/graphql/fields/base/RefToGraphQL.js +3 -1
- 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/fields/BaseFieldBuilder.d.ts +1 -3
- package/features/modelBuilder/fields/BaseFieldBuilder.js +0 -4
- package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DataFieldBuilder.d.ts +12 -18
- package/features/modelBuilder/fields/DataFieldBuilder.js +1 -2
- package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DynamicZoneFieldType.js +3 -8
- 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/UiAlertFieldType.js +1 -2
- package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -1
- package/features/modelBuilder/fields/UiSeparatorFieldType.js +1 -2
- package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -1
- package/features/modelBuilder/fields/UiTabsFieldType.d.ts +1 -2
- package/features/modelBuilder/fields/UiTabsFieldType.js +3 -6
- package/features/modelBuilder/fields/UiTabsFieldType.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/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 +2 -2
- package/graphql/schema/cms/getEntryResolver.js.map +1 -1
- 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/transformWhereToNested.js +17 -39
- package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -1
- package/graphql/schema/cms/listEntriesResolver.js +2 -2
- 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/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 +1 -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 +1 -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 +37 -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 +22 -27
- 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/index.d.ts +0 -1
- package/plugins/index.js +0 -1
- package/types/fields/dynamicZoneField.d.ts +2 -2
- package/types/modelField.d.ts +1 -1
- 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/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,17 +1,18 @@
|
|
|
1
|
-
import { Result
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
2
|
import { ListGroupsRepository } from "./abstractions.js";
|
|
3
3
|
import { GroupCache, PluginGroupsProvider } from "../shared/abstractions.js";
|
|
4
4
|
import { GroupPersistenceError } from "../../../domain/contentModelGroup/errors.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ListGroupsStorageOperation } from "../../shared/storageOperations/group/ListGroupsStorageOperation.js";
|
|
6
|
+
import { AccessControl, CmsContext } from "../../shared/abstractions.js";
|
|
6
7
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
7
8
|
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
8
9
|
import { filterAsync } from "../../../utils/filterAsync.js";
|
|
9
10
|
import { createCacheKey } from "../../../utils/index.js";
|
|
10
11
|
class ListGroupsRepositoryImpl {
|
|
11
|
-
constructor(groupCache, pluginGroupsProvider,
|
|
12
|
+
constructor(groupCache, pluginGroupsProvider, listGroups, accessControl, tenantContext, identityContext, cmsContext){
|
|
12
13
|
this.groupCache = groupCache;
|
|
13
14
|
this.pluginGroupsProvider = pluginGroupsProvider;
|
|
14
|
-
this.
|
|
15
|
+
this.listGroups = listGroups;
|
|
15
16
|
this.accessControl = accessControl;
|
|
16
17
|
this.tenantContext = tenantContext;
|
|
17
18
|
this.identityContext = identityContext;
|
|
@@ -31,14 +32,14 @@ class ListGroupsRepositoryImpl {
|
|
|
31
32
|
const dbCacheKey = createCacheKey({
|
|
32
33
|
tenant
|
|
33
34
|
});
|
|
34
|
-
const databaseGroups = await this.groupCache.getOrSet(dbCacheKey, async ()=>await this.
|
|
35
|
+
const databaseGroups = await this.groupCache.getOrSet(dbCacheKey, async ()=>await this.listGroups.execute({
|
|
35
36
|
where: {
|
|
36
37
|
tenant
|
|
37
38
|
}
|
|
38
39
|
}));
|
|
39
40
|
const filteredCacheKey = createCacheKey({
|
|
40
41
|
dbCacheKey: dbCacheKey.get(),
|
|
41
|
-
identity: this.
|
|
42
|
+
identity: this.identityContext.isAuthorizationEnabled() ? this.identityContext.getIdentity()?.id : void 0
|
|
42
43
|
});
|
|
43
44
|
const filteredDatabaseGroups = await this.groupCache.getOrSet(filteredCacheKey, async ()=>filterAsync(databaseGroups, async (group)=>{
|
|
44
45
|
if (!group) return false;
|
|
@@ -52,13 +53,12 @@ class ListGroupsRepositoryImpl {
|
|
|
52
53
|
];
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
const ListGroupsRepository_ListGroupsRepository = createImplementation({
|
|
56
|
-
abstraction: ListGroupsRepository,
|
|
56
|
+
const ListGroupsRepository_ListGroupsRepository = ListGroupsRepository.createImplementation({
|
|
57
57
|
implementation: ListGroupsRepositoryImpl,
|
|
58
58
|
dependencies: [
|
|
59
59
|
GroupCache,
|
|
60
60
|
PluginGroupsProvider,
|
|
61
|
-
|
|
61
|
+
ListGroupsStorageOperation,
|
|
62
62
|
AccessControl,
|
|
63
63
|
TenantContext,
|
|
64
64
|
IdentityContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/ListGroups/ListGroupsRepository.js","sources":["../../../../src/features/contentModelGroup/ListGroups/ListGroupsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/ListGroups/ListGroupsRepository.js","sources":["../../../../src/features/contentModelGroup/ListGroups/ListGroupsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListGroupsRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { GroupCache } from \"~/features/contentModelGroup/shared/abstractions.js\";\nimport { PluginGroupsProvider } from \"~/features/contentModelGroup/shared/abstractions.js\";\nimport { GroupPersistenceError } from \"~/domain/contentModelGroup/errors.js\";\nimport { ListGroupsStorageOperation } from \"~/features/shared/storageOperations/group/ListGroupsStorageOperation.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { CmsContext } from \"~/features/shared/abstractions.js\";\nimport { filterAsync } from \"~/utils/filterAsync.js\";\nimport { createCacheKey } from \"~/utils/index.js\";\nimport type { CmsGroup } from \"~/types/index.js\";\n\n/**\n * ListGroupsRepository - Fetches all groups (plugin + database).\n *\n * Responsibilities:\n * - Create cache keys based on tenant + identity\n * - Provide data loader functions to GroupCache\n * - Fetch from plugin groups + database groups\n * - Apply access control filtering\n * - Return all accessible groups\n */\nclass ListGroupsRepositoryImpl implements RepositoryAbstraction.Interface {\n public constructor(\n private groupCache: GroupCache.Interface,\n private pluginGroupsProvider: PluginGroupsProvider.Interface,\n private listGroups: ListGroupsStorageOperation.Interface,\n private accessControl: AccessControl.Interface,\n private tenantContext: TenantContext.Interface,\n private identityContext: IdentityContext.Interface,\n private cmsContext: CmsContext.Interface\n ) {}\n\n async execute(): Promise<Result<CmsGroup[], RepositoryAbstraction.Error>> {\n try {\n const tenant = this.tenantContext.getTenant();\n\n // Fetch all groups (plugin + database) with access control filtering\n const groups = await this.fetchAllGroups(tenant.id);\n\n return Result.ok(groups);\n } catch (error) {\n return Result.fail(new GroupPersistenceError(error as Error));\n }\n }\n\n private async fetchAllGroups(tenant: string): Promise<CmsGroup[]> {\n // 1. Fetch plugin groups (with caching and access control)\n const pluginGroups = await this.pluginGroupsProvider.getGroups();\n\n // 2. Fetch database groups (with caching)\n const dbCacheKey = createCacheKey({ tenant });\n const databaseGroups = await this.groupCache.getOrSet(dbCacheKey, async () => {\n return await this.listGroups.execute({\n where: { tenant }\n });\n });\n\n // 3. Apply access control to database groups (with caching)\n const filteredCacheKey = createCacheKey({\n dbCacheKey: dbCacheKey.get(),\n identity: this.identityContext.isAuthorizationEnabled()\n ? this.identityContext.getIdentity()?.id\n : undefined\n });\n\n const filteredDatabaseGroups = await this.groupCache.getOrSet(\n filteredCacheKey,\n async () => {\n return filterAsync(databaseGroups, async (group?: CmsGroup) => {\n if (!group) {\n return false;\n }\n return this.accessControl.canAccessGroup({ group });\n });\n }\n );\n\n // 4. Merge groups\n return [...filteredDatabaseGroups, ...pluginGroups];\n }\n}\n\nexport const ListGroupsRepository = RepositoryAbstraction.createImplementation({\n implementation: ListGroupsRepositoryImpl,\n dependencies: [\n GroupCache,\n PluginGroupsProvider,\n ListGroupsStorageOperation,\n AccessControl,\n TenantContext,\n IdentityContext,\n CmsContext\n ]\n});\n"],"names":["ListGroupsRepositoryImpl","groupCache","pluginGroupsProvider","listGroups","accessControl","tenantContext","identityContext","cmsContext","tenant","groups","Result","error","GroupPersistenceError","pluginGroups","dbCacheKey","createCacheKey","databaseGroups","filteredCacheKey","undefined","filteredDatabaseGroups","filterAsync","group","ListGroupsRepository","RepositoryAbstraction","GroupCache","PluginGroupsProvider","ListGroupsStorageOperation","AccessControl","TenantContext","IdentityContext","CmsContext"],"mappings":";;;;;;;;;;AAwBA,MAAMA;IACF,YACYC,UAAgC,EAChCC,oBAAoD,EACpDC,UAAgD,EAChDC,aAAsC,EACtCC,aAAsC,EACtCC,eAA0C,EAC1CC,UAAgC,CAC1C;aAPUN,UAAU,GAAVA;aACAC,oBAAoB,GAApBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,aAAa,GAAbA;aACAC,eAAe,GAAfA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,UAAoE;QACtE,IAAI;YACA,MAAMC,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;YAG3C,MAAMC,SAAS,MAAM,IAAI,CAAC,cAAc,CAACD,OAAO,EAAE;YAElD,OAAOE,OAAO,EAAE,CAACD;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAOD,OAAO,IAAI,CAAC,IAAIE,sBAAsBD;QACjD;IACJ;IAEA,MAAc,eAAeH,MAAc,EAAuB;QAE9D,MAAMK,eAAe,MAAM,IAAI,CAAC,oBAAoB,CAAC,SAAS;QAG9D,MAAMC,aAAaC,eAAe;YAAEP;QAAO;QAC3C,MAAMQ,iBAAiB,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAACF,YAAY,UACvD,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBACjC,OAAO;oBAAEN;gBAAO;YACpB;QAIJ,MAAMS,mBAAmBF,eAAe;YACpC,YAAYD,WAAW,GAAG;YAC1B,UAAU,IAAI,CAAC,eAAe,CAAC,sBAAsB,KAC/C,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI,KACpCI;QACV;QAEA,MAAMC,yBAAyB,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CACzDF,kBACA,UACWG,YAAYJ,gBAAgB,OAAOK;gBACtC,IAAI,CAACA,OACD,OAAO;gBAEX,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;oBAAEA;gBAAM;YACrD;QAKR,OAAO;eAAIF;eAA2BN;SAAa;IACvD;AACJ;AAEO,MAAMS,4CAAuBC,qBAAAA,oBAA0C,CAAC;IAC3E,gBAAgBvB;IAChB,cAAc;QACVwB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -17,5 +17,7 @@ declare class ListGroupsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
17
17
|
constructor(repository: ListGroupsRepository.Interface, accessControl: AccessControl.Interface);
|
|
18
18
|
execute(): Promise<Result<CmsGroup[], UseCaseAbstraction.Error>>;
|
|
19
19
|
}
|
|
20
|
-
export declare const ListGroupsUseCase:
|
|
20
|
+
export declare const ListGroupsUseCase: typeof ListGroupsUseCaseImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListGroupsUseCase>;
|
|
22
|
+
};
|
|
21
23
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Result
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
2
|
import { ListGroupsRepository, ListGroupsUseCase } from "./abstractions.js";
|
|
3
3
|
import { AccessControl } from "../../shared/abstractions.js";
|
|
4
4
|
import { GroupNotAuthorizedError } from "../../../domain/contentModelGroup/errors.js";
|
|
@@ -15,8 +15,7 @@ class ListGroupsUseCaseImpl {
|
|
|
15
15
|
return Result.ok(result.value);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const ListGroupsUseCase_ListGroupsUseCase = createImplementation({
|
|
19
|
-
abstraction: ListGroupsUseCase,
|
|
18
|
+
const ListGroupsUseCase_ListGroupsUseCase = ListGroupsUseCase.createImplementation({
|
|
20
19
|
implementation: ListGroupsUseCaseImpl,
|
|
21
20
|
dependencies: [
|
|
22
21
|
ListGroupsRepository,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/ListGroups/ListGroupsUseCase.js","sources":["../../../../src/features/contentModelGroup/ListGroups/ListGroupsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/ListGroups/ListGroupsUseCase.js","sources":["../../../../src/features/contentModelGroup/ListGroups/ListGroupsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListGroupsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { ListGroupsRepository } from \"./abstractions.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport type { CmsGroup } from \"~/types/index.js\";\nimport { GroupNotAuthorizedError } from \"~/domain/contentModelGroup/errors.js\";\n\n/**\n * ListGroupsUseCase - Retrieves all content model groups.\n *\n * Responsibilities:\n * - Apply initial access control check\n * - Delegate to repository (which uses GroupCache for plugin + DB groups)\n * - Return all accessible groups\n */\nclass ListGroupsUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private repository: ListGroupsRepository.Interface,\n private accessControl: AccessControl.Interface\n ) {}\n\n async execute(): Promise<Result<CmsGroup[], UseCaseAbstraction.Error>> {\n // Initial access control check (no specific group yet)\n const canAccess = await this.accessControl.canAccessGroup();\n if (!canAccess) {\n return Result.fail(new GroupNotAuthorizedError());\n }\n\n // Repository uses GroupCache to fetch all groups\n // GroupCache handles merging plugin + database groups and access control\n const result = await this.repository.execute();\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const ListGroupsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListGroupsUseCaseImpl,\n dependencies: [ListGroupsRepository, AccessControl]\n});\n"],"names":["ListGroupsUseCaseImpl","repository","accessControl","canAccess","Result","GroupNotAuthorizedError","result","ListGroupsUseCase","UseCaseAbstraction","ListGroupsRepository","AccessControl"],"mappings":";;;;AAeA,MAAMA;IACF,YACYC,UAA0C,EAC1CC,aAAsC,CAChD;aAFUD,UAAU,GAAVA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,UAAiE;QAEnE,MAAMC,YAAY,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc;QACzD,IAAI,CAACA,WACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAK3B,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAE5C,IAAIA,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAGnC,OAAOF,OAAO,EAAE,CAACE,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMC,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBR;IAChB,cAAc;QAACS;QAAsBC;KAAc;AACvD"}
|
|
@@ -2,7 +2,7 @@ import { Result } from "@webiny/feature/api";
|
|
|
2
2
|
import { UpdateGroupRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
3
3
|
import { GroupCache } from "../../../features/contentModelGroup/shared/abstractions.js";
|
|
4
4
|
import { PluginGroupsProvider } from "../../../features/contentModelGroup/shared/abstractions.js";
|
|
5
|
-
import {
|
|
5
|
+
import { UpdateGroupStorageOperation } from "../../../features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
6
6
|
import type { CmsGroup } from "../../../types/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* UpdateGroupRepository - Validates and persists group updates.
|
|
@@ -15,9 +15,11 @@ import type { CmsGroup } from "../../../types/index.js";
|
|
|
15
15
|
declare class UpdateGroupRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
16
16
|
private groupCache;
|
|
17
17
|
private pluginGroupsProvider;
|
|
18
|
-
private
|
|
19
|
-
constructor(groupCache: GroupCache.Interface, pluginGroupsProvider: PluginGroupsProvider.Interface,
|
|
18
|
+
private updateGroup;
|
|
19
|
+
constructor(groupCache: GroupCache.Interface, pluginGroupsProvider: PluginGroupsProvider.Interface, updateGroup: UpdateGroupStorageOperation.Interface);
|
|
20
20
|
execute(group: CmsGroup): Promise<Result<void, RepositoryAbstraction.Error>>;
|
|
21
21
|
}
|
|
22
|
-
export declare const UpdateGroupRepository:
|
|
22
|
+
export declare const UpdateGroupRepository: typeof UpdateGroupRepositoryImpl & {
|
|
23
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IUpdateGroupRepository>;
|
|
24
|
+
};
|
|
23
25
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Result
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
2
|
import { UpdateGroupRepository } from "./abstractions.js";
|
|
3
3
|
import { GroupCache, PluginGroupsProvider } from "../shared/abstractions.js";
|
|
4
4
|
import { GroupCannotUpdateCodeDefinedError, GroupPersistenceError } from "../../../domain/contentModelGroup/errors.js";
|
|
5
|
-
import {
|
|
5
|
+
import { UpdateGroupStorageOperation } from "../../shared/storageOperations/group/UpdateGroupStorageOperation.js";
|
|
6
6
|
class UpdateGroupRepositoryImpl {
|
|
7
|
-
constructor(groupCache, pluginGroupsProvider,
|
|
7
|
+
constructor(groupCache, pluginGroupsProvider, updateGroup){
|
|
8
8
|
this.groupCache = groupCache;
|
|
9
9
|
this.pluginGroupsProvider = pluginGroupsProvider;
|
|
10
|
-
this.
|
|
10
|
+
this.updateGroup = updateGroup;
|
|
11
11
|
}
|
|
12
12
|
async execute(group) {
|
|
13
13
|
try {
|
|
14
14
|
const pluginGroups = await this.pluginGroupsProvider.getGroups();
|
|
15
15
|
const isPluginGroup = pluginGroups.some((pg)=>pg.slug === group.slug);
|
|
16
16
|
if (isPluginGroup) return Result.fail(new GroupCannotUpdateCodeDefinedError(group.id));
|
|
17
|
-
await this.
|
|
17
|
+
await this.updateGroup.execute({
|
|
18
18
|
group
|
|
19
19
|
});
|
|
20
20
|
this.groupCache.clear();
|
|
@@ -24,13 +24,12 @@ class UpdateGroupRepositoryImpl {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
const UpdateGroupRepository_UpdateGroupRepository = createImplementation({
|
|
28
|
-
abstraction: UpdateGroupRepository,
|
|
27
|
+
const UpdateGroupRepository_UpdateGroupRepository = UpdateGroupRepository.createImplementation({
|
|
29
28
|
implementation: UpdateGroupRepositoryImpl,
|
|
30
29
|
dependencies: [
|
|
31
30
|
GroupCache,
|
|
32
31
|
PluginGroupsProvider,
|
|
33
|
-
|
|
32
|
+
UpdateGroupStorageOperation
|
|
34
33
|
]
|
|
35
34
|
});
|
|
36
35
|
export { UpdateGroupRepository_UpdateGroupRepository as UpdateGroupRepository };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js","sources":["../../../../src/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js","sources":["../../../../src/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateGroupRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { GroupCache } from \"~/features/contentModelGroup/shared/abstractions.js\";\nimport { PluginGroupsProvider } from \"~/features/contentModelGroup/shared/abstractions.js\";\nimport { GroupCannotUpdateCodeDefinedError } from \"~/domain/contentModelGroup/errors.js\";\nimport { GroupPersistenceError } from \"~/domain/contentModelGroup/errors.js\";\nimport { UpdateGroupStorageOperation } from \"~/features/shared/storageOperations/group/UpdateGroupStorageOperation.js\";\nimport type { CmsGroup } from \"~/types/index.js\";\n\n/**\n * UpdateGroupRepository - Validates and persists group updates.\n *\n * Responsibilities:\n * - Check if group is plugin-based (cannot update)\n * - Persist updates to storage\n * - Clear GroupCache after successful update\n */\nclass UpdateGroupRepositoryImpl implements RepositoryAbstraction.Interface {\n public constructor(\n private groupCache: GroupCache.Interface,\n private pluginGroupsProvider: PluginGroupsProvider.Interface,\n private updateGroup: UpdateGroupStorageOperation.Interface\n ) {}\n\n async execute(group: CmsGroup): Promise<Result<void, RepositoryAbstraction.Error>> {\n try {\n // Check if this is a plugin-based group (cannot be updated)\n const pluginGroups = await this.pluginGroupsProvider.getGroups();\n const isPluginGroup = pluginGroups.some(pg => pg.slug === group.slug);\n\n if (isPluginGroup) {\n return Result.fail(new GroupCannotUpdateCodeDefinedError(group.id));\n }\n\n // Persist updates\n await this.updateGroup.execute({ group });\n\n // Clear cache\n this.groupCache.clear();\n\n return Result.ok();\n } catch (error) {\n return Result.fail(new GroupPersistenceError(error as Error));\n }\n }\n}\n\nexport const UpdateGroupRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateGroupRepositoryImpl,\n dependencies: [GroupCache, PluginGroupsProvider, UpdateGroupStorageOperation]\n});\n"],"names":["UpdateGroupRepositoryImpl","groupCache","pluginGroupsProvider","updateGroup","group","pluginGroups","isPluginGroup","pg","Result","GroupCannotUpdateCodeDefinedError","error","GroupPersistenceError","UpdateGroupRepository","RepositoryAbstraction","GroupCache","PluginGroupsProvider","UpdateGroupStorageOperation"],"mappings":";;;;;AAiBA,MAAMA;IACF,YACYC,UAAgC,EAChCC,oBAAoD,EACpDC,WAAkD,CAC5D;aAHUF,UAAU,GAAVA;aACAC,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,KAAe,EAAsD;QAC/E,IAAI;YAEA,MAAMC,eAAe,MAAM,IAAI,CAAC,oBAAoB,CAAC,SAAS;YAC9D,MAAMC,gBAAgBD,aAAa,IAAI,CAACE,CAAAA,KAAMA,GAAG,IAAI,KAAKH,MAAM,IAAI;YAEpE,IAAIE,eACA,OAAOE,OAAO,IAAI,CAAC,IAAIC,kCAAkCL,MAAM,EAAE;YAIrE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBAAEA;YAAM;YAGvC,IAAI,CAAC,UAAU,CAAC,KAAK;YAErB,OAAOI,OAAO,EAAE;QACpB,EAAE,OAAOE,OAAO;YACZ,OAAOF,OAAO,IAAI,CAAC,IAAIG,sBAAsBD;QACjD;IACJ;AACJ;AAEO,MAAME,8CAAwBC,sBAAAA,oBAA0C,CAAC;IAC5E,gBAAgBb;IAChB,cAAc;QAACc;QAAYC;QAAsBC;KAA4B;AACjF"}
|
|
@@ -29,5 +29,7 @@ declare class UpdateGroupUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
29
29
|
constructor(eventPublisher: EventPublisher.Interface, repository: UpdateGroupRepository.Interface, getGroupUseCase: GetGroupUseCase.Interface, accessControl: AccessControl.Interface, tenantContext: TenantContext.Interface);
|
|
30
30
|
execute(groupId: string, input: CmsGroupUpdateInput): Promise<Result<CmsGroup, UseCaseAbstraction.Error>>;
|
|
31
31
|
}
|
|
32
|
-
export declare const UpdateGroupUseCase:
|
|
32
|
+
export declare const UpdateGroupUseCase: typeof UpdateGroupUseCaseImpl & {
|
|
33
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IUpdateGroupUseCase>;
|
|
34
|
+
};
|
|
33
35
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Result
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
2
|
import { UpdateGroupRepository, UpdateGroupUseCase } from "./abstractions.js";
|
|
3
3
|
import { GetGroupUseCase } from "../GetGroup/abstractions.js";
|
|
4
4
|
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
@@ -73,8 +73,7 @@ class UpdateGroupUseCaseImpl {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
const UpdateGroupUseCase_UpdateGroupUseCase = createImplementation({
|
|
77
|
-
abstraction: UpdateGroupUseCase,
|
|
76
|
+
const UpdateGroupUseCase_UpdateGroupUseCase = UpdateGroupUseCase.createImplementation({
|
|
78
77
|
implementation: UpdateGroupUseCaseImpl,
|
|
79
78
|
dependencies: [
|
|
80
79
|
EventPublisher,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js","sources":["../../../../src/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js","sources":["../../../../src/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateGroupUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { UpdateGroupRepository } from \"./abstractions.js\";\nimport { GetGroupUseCase } from \"~/features/contentModelGroup/GetGroup/abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { GroupBeforeUpdateEvent } from \"./events.js\";\nimport { GroupAfterUpdateEvent } from \"./events.js\";\nimport { GroupUpdateErrorEvent } from \"./events.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport {\n GroupNotAuthorizedError,\n GroupValidationError\n} from \"~/domain/contentModelGroup/errors.js\";\nimport { createZodError } from \"@webiny/utils\";\nimport { createGroupUpdateValidation } from \"~/domain/contentModelGroup/validation.js\";\nimport type { CmsGroup } from \"~/types/index.js\";\nimport type { CmsGroupUpdateInput } from \"~/types/index.js\";\n\n/**\n * UpdateGroupUseCase - Orchestrates group updates.\n *\n * Responsibilities:\n * - Fetch original group\n * - Access control checks\n * - Validate input (Zod)\n * - Skip if no changes\n * - Merge changes\n * - Publish before event\n * - Delegate to repository\n * - Publish after event or error event\n */\nclass UpdateGroupUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private eventPublisher: EventPublisher.Interface,\n private repository: UpdateGroupRepository.Interface,\n private getGroupUseCase: GetGroupUseCase.Interface,\n private accessControl: AccessControl.Interface,\n private tenantContext: TenantContext.Interface\n ) {}\n\n async execute(\n groupId: string,\n input: CmsGroupUpdateInput\n ): Promise<Result<CmsGroup, UseCaseAbstraction.Error>> {\n // Initial access control check\n const canAccess = await this.accessControl.canAccessGroup({ rwd: \"w\" });\n if (!canAccess) {\n return Result.fail(new GroupNotAuthorizedError());\n }\n\n // Fetch original group\n const getResult = await this.getGroupUseCase.execute(groupId);\n if (getResult.isFail()) {\n return Result.fail(getResult.error);\n }\n const original = getResult.value;\n\n // Access control check on original group\n const canAccessGroup = await this.accessControl.canAccessGroup({ group: original });\n if (!canAccessGroup) {\n return Result.fail(new GroupNotAuthorizedError());\n }\n\n // Validate input\n const validationResult = await createGroupUpdateValidation().safeParseAsync(input);\n if (!validationResult.success) {\n const zodError = createZodError(validationResult.error);\n return Result.fail(\n new GroupValidationError(zodError.message, zodError.data!.invalidFields)\n );\n }\n const data = validationResult.data;\n\n // Skip if no changes\n if (Object.keys(data).length === 0) {\n return Result.ok(original);\n }\n\n // Merge changes\n const tenant = this.tenantContext.getTenant();\n const group: CmsGroup = {\n ...original,\n ...data,\n tenant: tenant.id,\n savedOn: new Date().toISOString()\n };\n\n try {\n // Publish before event\n await this.eventPublisher.publish(\n new GroupBeforeUpdateEvent({\n original,\n group\n })\n );\n\n // Persist via repository\n const result = await this.repository.execute(group);\n if (result.isFail()) {\n // Publish error event\n await this.eventPublisher.publish(\n new GroupUpdateErrorEvent({\n input,\n original,\n group,\n error: result.error\n })\n );\n return Result.fail(result.error);\n }\n\n // Publish after event\n await this.eventPublisher.publish(\n new GroupAfterUpdateEvent({\n original,\n group\n })\n );\n\n return Result.ok(group);\n } catch (error) {\n // Publish error event for unexpected errors\n await this.eventPublisher.publish(\n new GroupUpdateErrorEvent({\n input,\n original,\n group,\n error: error as Error\n })\n );\n return Result.fail(error as UseCaseAbstraction.Error);\n }\n }\n}\n\nexport const UpdateGroupUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateGroupUseCaseImpl,\n dependencies: [\n EventPublisher,\n UpdateGroupRepository,\n GetGroupUseCase,\n AccessControl,\n TenantContext\n ]\n});\n"],"names":["UpdateGroupUseCaseImpl","eventPublisher","repository","getGroupUseCase","accessControl","tenantContext","groupId","input","canAccess","Result","GroupNotAuthorizedError","getResult","original","canAccessGroup","validationResult","createGroupUpdateValidation","zodError","createZodError","GroupValidationError","data","Object","tenant","group","Date","GroupBeforeUpdateEvent","result","GroupUpdateErrorEvent","GroupAfterUpdateEvent","error","UpdateGroupUseCase","UseCaseAbstraction","EventPublisher","UpdateGroupRepository","GetGroupUseCase","AccessControl","TenantContext"],"mappings":";;;;;;;;;;AAgCA,MAAMA;IACF,YACYC,cAAwC,EACxCC,UAA2C,EAC3CC,eAA0C,EAC1CC,aAAsC,EACtCC,aAAsC,CAChD;aALUJ,cAAc,GAAdA;aACAC,UAAU,GAAVA;aACAC,eAAe,GAAfA;aACAC,aAAa,GAAbA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,QACFC,OAAe,EACfC,KAA0B,EACyB;QAEnD,MAAMC,YAAY,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YAAE,KAAK;QAAI;QACrE,IAAI,CAACA,WACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAI3B,MAAMC,YAAY,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAACL;QACrD,IAAIK,UAAU,MAAM,IAChB,OAAOF,OAAO,IAAI,CAACE,UAAU,KAAK;QAEtC,MAAMC,WAAWD,UAAU,KAAK;QAGhC,MAAME,iBAAiB,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YAAE,OAAOD;QAAS;QACjF,IAAI,CAACC,gBACD,OAAOJ,OAAO,IAAI,CAAC,IAAIC;QAI3B,MAAMI,mBAAmB,MAAMC,8BAA8B,cAAc,CAACR;QAC5E,IAAI,CAACO,iBAAiB,OAAO,EAAE;YAC3B,MAAME,WAAWC,eAAeH,iBAAiB,KAAK;YACtD,OAAOL,OAAO,IAAI,CACd,IAAIS,qBAA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|
|
2
|
-
import { CmsContext } from "../../../features/shared/abstractions.js";
|
|
3
2
|
import { AccessControl } from "../../../features/shared/abstractions.js";
|
|
4
3
|
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
5
4
|
import { ModelGroupFactory, PluginGroupsProvider as ProviderAbstraction } from "./abstractions.js";
|
|
5
|
+
import type { CmsGroupPlugin } from "../../../plugins/CmsGroupPlugin.js";
|
|
6
6
|
import type { CmsGroup } from "../../../types/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* PluginGroupsProvider implementation
|
|
@@ -13,13 +13,15 @@ import type { CmsGroup } from "../../../types/index.js";
|
|
|
13
13
|
*/
|
|
14
14
|
declare class PluginGroupsProviderImpl implements ProviderAbstraction.Interface {
|
|
15
15
|
private tenantContext;
|
|
16
|
-
private
|
|
16
|
+
private pluginGroups;
|
|
17
17
|
private accessControl;
|
|
18
18
|
private identityContext;
|
|
19
19
|
private groupFactories;
|
|
20
20
|
private cache;
|
|
21
|
-
constructor(tenantContext: TenantContext.Interface,
|
|
21
|
+
constructor(tenantContext: TenantContext.Interface, pluginGroups: CmsGroupPlugin[], accessControl: AccessControl.Interface, identityContext: IdentityContext.Interface, groupFactories: ModelGroupFactory.Interface[]);
|
|
22
22
|
getGroups(): Promise<CmsGroup[]>;
|
|
23
23
|
}
|
|
24
|
-
export declare const PluginGroupsProvider:
|
|
24
|
+
export declare const PluginGroupsProvider: typeof PluginGroupsProviderImpl & {
|
|
25
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IPluginGroupsProvider>;
|
|
26
|
+
};
|
|
25
27
|
export {};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/feature/api";
|
|
2
1
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
-
import { AccessControl
|
|
2
|
+
import { AccessControl } from "../../shared/abstractions.js";
|
|
4
3
|
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
5
|
-
import { ModelGroupFactory, PluginGroupsProvider } from "./abstractions.js";
|
|
6
|
-
import { CmsGroupPlugin } from "../../../plugins/CmsGroupPlugin.js";
|
|
4
|
+
import { CmsGroupPluginInstance, ModelGroupFactory, PluginGroupsProvider } from "./abstractions.js";
|
|
7
5
|
import { filterAsync } from "../../../utils/filterAsync.js";
|
|
8
6
|
import { createCacheKey, createMemoryCache } from "../../../utils/index.js";
|
|
9
7
|
class PluginGroupsProviderImpl {
|
|
10
|
-
constructor(tenantContext,
|
|
8
|
+
constructor(tenantContext, pluginGroups, accessControl, identityContext, groupFactories){
|
|
11
9
|
this.tenantContext = tenantContext;
|
|
12
|
-
this.
|
|
10
|
+
this.pluginGroups = pluginGroups;
|
|
13
11
|
this.accessControl = accessControl;
|
|
14
12
|
this.identityContext = identityContext;
|
|
15
13
|
this.groupFactories = groupFactories;
|
|
@@ -17,10 +15,10 @@ class PluginGroupsProviderImpl {
|
|
|
17
15
|
}
|
|
18
16
|
async getGroups() {
|
|
19
17
|
const tenant = this.tenantContext.getTenant();
|
|
20
|
-
const pluginGroups = this.
|
|
18
|
+
const pluginGroups = this.pluginGroups;
|
|
21
19
|
const cacheKey = createCacheKey({
|
|
22
20
|
tenant: tenant.id,
|
|
23
|
-
identity: this.
|
|
21
|
+
identity: this.identityContext.isAuthorizationEnabled() ? this.identityContext.getIdentity()?.id : void 0,
|
|
24
22
|
groups: pluginGroups.map(({ contentModelGroup: group })=>`${group.id}#${group.slug}#${group.savedOn || "unknown"}`).join("/"),
|
|
25
23
|
codeGroups: this.groupFactories.length
|
|
26
24
|
});
|
|
@@ -51,12 +49,16 @@ class PluginGroupsProviderImpl {
|
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
|
-
const PluginGroupsProvider_PluginGroupsProvider = createImplementation({
|
|
55
|
-
abstraction: PluginGroupsProvider,
|
|
52
|
+
const PluginGroupsProvider_PluginGroupsProvider = PluginGroupsProvider.createImplementation({
|
|
56
53
|
implementation: PluginGroupsProviderImpl,
|
|
57
54
|
dependencies: [
|
|
58
55
|
TenantContext,
|
|
59
|
-
|
|
56
|
+
[
|
|
57
|
+
CmsGroupPluginInstance,
|
|
58
|
+
{
|
|
59
|
+
multiple: true
|
|
60
|
+
}
|
|
61
|
+
],
|
|
60
62
|
AccessControl,
|
|
61
63
|
IdentityContext,
|
|
62
64
|
[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/shared/PluginGroupsProvider.js","sources":["../../../../src/features/contentModelGroup/shared/PluginGroupsProvider.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/shared/PluginGroupsProvider.js","sources":["../../../../src/features/contentModelGroup/shared/PluginGroupsProvider.ts"],"sourcesContent":["import { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { AccessControl } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport {\n CmsGroupPluginInstance,\n ModelGroupFactory,\n PluginGroupsProvider as ProviderAbstraction\n} from \"./abstractions.js\";\nimport type { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin.js\";\nimport { filterAsync } from \"~/utils/filterAsync.js\";\nimport { createCacheKey } from \"~/utils/index.js\";\nimport { createMemoryCache } from \"~/utils/index.js\";\nimport type { CmsGroup } from \"~/types/index.js\";\n\n/**\n * PluginGroupsProvider implementation\n *\n * Fetches groups from CmsGroupPlugin instances.\n * Filters by tenant and applies access control.\n * Results are cached based on tenant + identity + plugin signatures.\n */\nclass PluginGroupsProviderImpl implements ProviderAbstraction.Interface {\n private cache = createMemoryCache<Promise<CmsGroup[]>>();\n\n public constructor(\n private tenantContext: TenantContext.Interface,\n private pluginGroups: CmsGroupPlugin[],\n private accessControl: AccessControl.Interface,\n private identityContext: IdentityContext.Interface,\n private groupFactories: ModelGroupFactory.Interface[]\n ) {}\n\n async getGroups(): Promise<CmsGroup[]> {\n const tenant = this.tenantContext.getTenant();\n const pluginGroups = this.pluginGroups;\n\n const cacheKey = createCacheKey({\n tenant: tenant.id,\n identity: this.identityContext.isAuthorizationEnabled()\n ? this.identityContext.getIdentity()?.id\n : undefined,\n groups: pluginGroups\n .map(({ contentModelGroup: group }) => {\n return `${group.id}#${group.slug}#${group.savedOn || \"unknown\"}`;\n })\n .join(\"/\"),\n codeGroups: this.groupFactories.length\n });\n\n return this.cache.getOrSet(cacheKey, async (): Promise<CmsGroup[]> => {\n // TODO: once the legacy code plugins are removed, clean this up.\n // Currently, this code makes the new group compatible with the legacy one.\n const codeGroups: CmsGroup[] = await Promise.all(\n this.groupFactories.map(factory => factory.execute())\n ).then(result => {\n return result.flat().map<CmsGroup>(group => ({\n ...group,\n id: group.slug,\n tenant: tenant.id,\n description: \"\"\n }));\n });\n\n const groups = pluginGroups\n // Filter by tenant if specified in plugin\n // If not specified, plugin group is available for all tenants\n .filter(plugin => {\n const { tenant: t } = plugin.contentModelGroup;\n if (t && t !== tenant.id) {\n return false;\n }\n return true;\n })\n .map(plugin => {\n return {\n ...plugin.contentModelGroup,\n tenant: tenant.id\n };\n });\n\n // Apply access control filtering\n return filterAsync([...codeGroups, ...groups], async (group?: CmsGroup) => {\n if (!group) {\n return false;\n }\n return this.accessControl.canAccessGroup({ group });\n });\n });\n }\n}\n\nexport const PluginGroupsProvider = ProviderAbstraction.createImplementation({\n implementation: PluginGroupsProviderImpl,\n dependencies: [\n TenantContext,\n [CmsGroupPluginInstance, { multiple: true }],\n AccessControl,\n IdentityContext,\n [ModelGroupFactory, { multiple: true }]\n ]\n});\n"],"names":["PluginGroupsProviderImpl","tenantContext","pluginGroups","accessControl","identityContext","groupFactories","createMemoryCache","tenant","cacheKey","createCacheKey","undefined","group","codeGroups","Promise","factory","result","groups","plugin","t","filterAsync","PluginGroupsProvider","ProviderAbstraction","TenantContext","CmsGroupPluginInstance","AccessControl","IdentityContext","ModelGroupFactory"],"mappings":";;;;;;AAqBA,M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,CAAAA,SACM;oBACH,GAAGA,OAAO,iBAAiB;oBAC3B,QAAQV,OAAO,EAAE;gBACrB;YAIR,OAAOY,YAAY;mBAAIP;mBAAeI;aAAO,EAAE,OAAOL;gBAClD,IAAI,CAACA,OACD,OAAO;gBAEX,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;oBAAEA;gBAAM;YACrD;QACJ;IACJ;AACJ;AAEO,MAAMS,4CAAuBC,qBAAAA,oBAAwC,CAAC;IACzE,gBAAgBrB;IAChB,cAAc;QACVsB;QACA;YAACC;YAAwB;gBAAE,UAAU;YAAK;SAAE;QAC5CC;QACAC;QACA;YAACC;YAAmB;gBAAE,UAAU;YAAK;SAAE;KAC1C;AACL"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { CmsGroup, CmsIcon } from "../../../types/index.js";
|
|
2
2
|
import type { ICache } from "../../../utils/caching/types.js";
|
|
3
|
+
import type { CmsGroupPlugin } from "../../../plugins/CmsGroupPlugin.js";
|
|
4
|
+
/**
|
|
5
|
+
* Multi-instance DI token holding the code-defined CmsGroupPlugin instances
|
|
6
|
+
* (previously read from the plugins container via byType). PluginGroupsProvider
|
|
7
|
+
* resolves all of these to expose plugin-defined groups.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CmsGroupPluginInstance: import("@webiny/di").Abstraction<CmsGroupPlugin>;
|
|
10
|
+
export declare namespace CmsGroupPluginInstance {
|
|
11
|
+
type Interface = CmsGroupPlugin;
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* PluginGroupsProvider provides access to plugin-defined (code) groups.
|
|
5
15
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const CmsGroupPluginInstance = createAbstraction("CmsGroupPluginInstance");
|
|
2
3
|
const PluginGroupsProvider = createAbstraction("PluginGroupsProvider");
|
|
3
4
|
const GroupCache = createAbstraction("GroupCache");
|
|
4
5
|
const ModelGroupFactory = createAbstraction("ModelGroupFactory");
|
|
5
|
-
export { GroupCache, ModelGroupFactory, PluginGroupsProvider };
|
|
6
|
+
export { CmsGroupPluginInstance, GroupCache, ModelGroupFactory, PluginGroupsProvider };
|
|
6
7
|
|
|
7
8
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentModelGroup/shared/abstractions.js","sources":["../../../../src/features/contentModelGroup/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsGroup, CmsIcon } from \"~/types/index.js\";\nimport type { ICache } from \"~/utils/caching/types.js\";\n\n/**\n * PluginGroupsProvider provides access to plugin-defined (code) groups.\n */\nexport interface IPluginGroupsProvider {\n getGroups(): Promise<CmsGroup[]>;\n}\n\nexport const PluginGroupsProvider =\n createAbstraction<IPluginGroupsProvider>(\"PluginGroupsProvider\");\n\nexport namespace PluginGroupsProvider {\n export type Interface = IPluginGroupsProvider;\n}\n\nexport const GroupCache = createAbstraction<ICache<Promise<CmsGroup[]>>>(\"GroupCache\");\n\nexport namespace GroupCache {\n export type Interface = ICache;\n}\n\ninterface IModelGroup {\n slug: string;\n name: string;\n icon: CmsIcon;\n}\n\nexport interface IModelGroupFactory {\n execute(): Promise<IModelGroup[]>;\n}\n\n/** Provide code-defined content model groups. */\nexport const ModelGroupFactory = createAbstraction<IModelGroupFactory>(\"ModelGroupFactory\");\nexport namespace ModelGroupFactory {\n export type Interface = IModelGroupFactory;\n export type Return = Promise<IModelGroup[]>;\n export type Group = IModelGroup;\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"features/contentModelGroup/shared/abstractions.js","sources":["../../../../src/features/contentModelGroup/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsGroup, CmsIcon } from \"~/types/index.js\";\nimport type { ICache } from \"~/utils/caching/types.js\";\nimport type { CmsGroupPlugin } from \"~/plugins/CmsGroupPlugin.js\";\n\n/**\n * Multi-instance DI token holding the code-defined CmsGroupPlugin instances\n * (previously read from the plugins container via byType). PluginGroupsProvider\n * resolves all of these to expose plugin-defined groups.\n */\nexport const CmsGroupPluginInstance = createAbstraction<CmsGroupPlugin>(\"CmsGroupPluginInstance\");\n\nexport namespace CmsGroupPluginInstance {\n export type Interface = CmsGroupPlugin;\n}\n\n/**\n * PluginGroupsProvider provides access to plugin-defined (code) groups.\n */\nexport interface IPluginGroupsProvider {\n getGroups(): Promise<CmsGroup[]>;\n}\n\nexport const PluginGroupsProvider =\n createAbstraction<IPluginGroupsProvider>(\"PluginGroupsProvider\");\n\nexport namespace PluginGroupsProvider {\n export type Interface = IPluginGroupsProvider;\n}\n\nexport const GroupCache = createAbstraction<ICache<Promise<CmsGroup[]>>>(\"GroupCache\");\n\nexport namespace GroupCache {\n export type Interface = ICache;\n}\n\ninterface IModelGroup {\n slug: string;\n name: string;\n icon: CmsIcon;\n}\n\nexport interface IModelGroupFactory {\n execute(): Promise<IModelGroup[]>;\n}\n\n/** Provide code-defined content model groups. */\nexport const ModelGroupFactory = createAbstraction<IModelGroupFactory>(\"ModelGroupFactory\");\nexport namespace ModelGroupFactory {\n export type Interface = IModelGroupFactory;\n export type Return = Promise<IModelGroup[]>;\n export type Group = IModelGroup;\n}\n"],"names":["CmsGroupPluginInstance","createAbstraction","PluginGroupsProvider","GroupCache","ModelGroupFactory"],"mappings":";AAUO,MAAMA,yBAAyBC,kBAAkC;AAajE,MAAMC,uBACTD,kBAAyC;AAMtC,MAAME,aAAaF,kBAA+C;AAiBlE,MAAMG,oBAAoBH,kBAAsC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GraphQLFieldResolver, Resolvers } from "@webiny/
|
|
2
|
-
import type { GraphQLSchemaDefinition } from "@webiny/
|
|
1
|
+
import type { GraphQLFieldResolver, Resolvers } from "@webiny/api-graphql/types.js";
|
|
2
|
+
import type { GraphQLSchemaDefinition } from "@webiny/api-graphql/types.js";
|
|
3
3
|
import type { CmsModelField, CmsModelFieldType } from "../../../../types/modelField.js";
|
|
4
4
|
import type { CmsModel } from "../../../../types/model.js";
|
|
5
5
|
import type { CmsModelFieldDefinition } from "../../../../types/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js","sources":["../../../../../src/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { GraphQLFieldResolver, Resolvers } from \"@webiny/
|
|
1
|
+
{"version":3,"file":"features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js","sources":["../../../../../src/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { GraphQLFieldResolver, Resolvers } from \"@webiny/api-graphql/types.js\";\nimport type { GraphQLSchemaDefinition } from \"@webiny/api-graphql/types.js\";\nimport type { CmsModelField, CmsModelFieldType } from \"~/types/modelField.js\";\nimport type { CmsModel } from \"~/types/model.js\";\nimport type { CmsModelFieldDefinition } from \"~/types/types.js\";\nimport type { CmsContext } from \"~/types/types.js\";\n\nexport interface ValidateChildFieldsValidateParams<TField extends CmsModelField = CmsModelField> {\n fields: TField[];\n originalFields: TField[];\n}\n\nexport interface ValidateChildFieldsValidate {\n (params: ValidateChildFieldsValidateParams): void;\n}\n\nexport interface ValidateChildFieldsParams<TField extends CmsModelField = CmsModelField> {\n field: TField;\n originalField?: TField;\n validate: ValidateChildFieldsValidate;\n}\n\nexport interface ValidateChildFields<TField extends CmsModelField = CmsModelField> {\n (params: ValidateChildFieldsParams<TField>): void;\n}\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { GetCmsModelFieldAst } from \"~/types/modelAst.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"./CmsModelFieldToGraphQLRegistry.js\";\n\nexport interface CreateTypeFieldParams<TField extends CmsModelField = CmsModelField> {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport interface CreateGetFiltersParams<TField extends CmsModelField = CmsModelField> {\n field: TField;\n}\n\nexport interface CreateListFiltersParams<TField extends CmsModelField = CmsModelField> {\n model: Pick<CmsModel, \"singularApiName\">;\n field: TField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport interface CreateResolverParams<TField extends CmsModelField = CmsModelField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport type ResolverResult =\n | GraphQLFieldResolver\n | {\n resolver: GraphQLFieldResolver | null;\n typeResolvers: Resolvers<CmsContext>;\n }\n | false;\n\nexport interface CreateSchemaParams {\n models: CmsModel[];\n}\n\nexport interface NormalizeInputParams<TField extends CmsModelField = CmsModelField> {\n model: CmsModel;\n field: TField;\n input: GenericRecord<string> | Array<GenericRecord<string>>;\n}\n\nexport interface ICmsFieldReadApi<TField extends CmsModelField = CmsModelField> {\n createTypeField(params: CreateTypeFieldParams<TField>): CmsModelFieldDefinition | string | null;\n createGetFilters?(params: CreateGetFiltersParams<TField>): string;\n createListFilters?(params: CreateListFiltersParams<TField>): string;\n createResolver?(params: CreateResolverParams<TField>): ResolverResult;\n createSchema?(params: CreateSchemaParams): GraphQLSchemaDefinition<CmsContext>;\n}\n\nexport interface ICmsFieldManageApi<\n TField extends CmsModelField = CmsModelField\n> extends ICmsFieldReadApi<TField> {\n createInputField(\n params: CreateTypeFieldParams<TField>\n ): CmsModelFieldDefinition | string | null;\n normalizeInput?<T>(params: NormalizeInputParams<TField>): Promise<T>;\n}\n\nexport interface ICmsModelFieldToGraphQL<TField extends CmsModelField = CmsModelField> {\n /* Metadata. */\n readonly fieldType: CmsModelFieldType;\n readonly isSearchable: boolean;\n readonly isSortable: boolean;\n readonly isFullTextSearchable: boolean;\n\n /* API surfaces. */\n readonly read: ICmsFieldReadApi<TField>;\n readonly manage: ICmsFieldManageApi<TField>;\n getReadApi(): ICmsFieldReadApi<TField>;\n getManageApi(): ICmsFieldManageApi<TField>;\n\n /* Validation & AST. */\n validateChildFields?: ValidateChildFields<TField>;\n getFieldAst?: GetCmsModelFieldAst<TField>;\n}\n\nexport const CmsModelFieldToGraphQL = createAbstraction<ICmsModelFieldToGraphQL>(\n \"Cms/GraphQL/Schema/ModelField\"\n);\n\nexport namespace CmsModelFieldToGraphQL {\n export type Interface = ICmsModelFieldToGraphQL;\n export type ReadApi<TField extends CmsModelField = CmsModelField> = ICmsFieldReadApi<TField>;\n export type ManageApi<TField extends CmsModelField = CmsModelField> =\n ICmsFieldManageApi<TField>;\n export type TypeFieldParams<TField extends CmsModelField = CmsModelField> =\n CreateTypeFieldParams<TField>;\n export type GetFiltersParams<TField extends CmsModelField = CmsModelField> =\n CreateGetFiltersParams<TField>;\n export type ListFiltersParams<TField extends CmsModelField = CmsModelField> =\n CreateListFiltersParams<TField>;\n export type ResolverParams<TField extends CmsModelField = CmsModelField> =\n CreateResolverParams<TField>;\n export type SchemaParams = CreateSchemaParams;\n export type InputNormalizeParams<TField extends CmsModelField = CmsModelField> =\n NormalizeInputParams<TField>;\n export type Resolver = ResolverResult;\n export type ChildFieldsValidateParams<TField extends CmsModelField = CmsModelField> =\n ValidateChildFieldsParams<TField>;\n export type ChildFieldsValidate<TField extends CmsModelField = CmsModelField> =\n ValidateChildFields<TField>;\n export type ChildFieldsValidateValidate = ValidateChildFieldsValidate;\n}\n"],"names":["CmsModelFieldToGraphQL","createAbstraction"],"mappings":";AA6GO,MAAMA,yBAAyBC,kBAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/graphql/fields/base/DynamicZoneToGraphQL.js","sources":["../../../../../src/features/graphql/fields/base/DynamicZoneToGraphQL.ts"],"sourcesContent":["import { CmsModelFieldToGraphQL } from \"../abstractions/CmsModelFieldToGraphQL.js\";\nimport type {\n ApiEndpoint,\n CmsDynamicZoneTemplate,\n CmsModel,\n CmsModelDynamicZoneField,\n CmsModelField,\n CmsModelFieldType,\n CmsModelFieldDefinition\n} from \"~/types/index.js\";\nimport type { ValidateChildFieldsParams } from \"../abstractions/CmsModelFieldToGraphQL.js\";\nimport type { CmsModelFieldAstNode, ICmsModelFieldToAst } from \"~/types/modelAst.js\";\nimport type { GraphQLFieldResolver } from \"@webiny/handler-graphql/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { createTypeName } from \"~/utils/createTypeName.js\";\nimport { createGraphQLInputField } from \"./utils/createGraphQLInputField.js\";\nimport { createTypeDefsForTemplates } from \"./dynamicZone/createTypeDefsForTemplates.js\";\nimport { normalizeDynamicZoneInput } from \"./dynamicZone/normalizeDynamicZoneInput.js\";\n\nconst createUnionTypeName = (model: CmsModel, field: CmsModelField) => {\n return `${model.singularApiName}_${createTypeName(field.fieldId)}`;\n};\n\nconst getFieldTemplates = (field: CmsModelDynamicZoneField): CmsDynamicZoneTemplate[] => {\n if (!Array.isArray(field.settings?.templates)) {\n return [];\n }\n return field.settings.templates;\n};\n\nconst remapTemplateValue = (value: any, typeName: string) => {\n return { ...value, __typename: typeName };\n};\n\nconst createDynamicZoneResolver = (\n endpointType: ApiEndpoint\n): ((params: CmsModelFieldToGraphQL.ResolverParams) => CmsModelFieldToGraphQL.Resolver) => {\n return ({ model, models, field, fieldRegistry, createFieldResolvers, graphQLType }) => {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return false;\n }\n\n const resolver = (parent: any) => {\n const value = parent[field.fieldId];\n if (!value) {\n return value;\n }\n\n const typeName = `${graphQLType}_${createTypeName(field.fieldId)}`;\n\n if (field.list && Array.isArray(value)) {\n return value.map(v => {\n const template = templates.find(tpl => tpl.id === v._templateId);\n if (!template) {\n return undefined;\n }\n return remapTemplateValue(v, `${typeName}_${template.gqlTypeName}`);\n });\n }\n\n const template = templates.find(tpl => tpl.id === value._templateId);\n if (!template) {\n return undefined;\n }\n return remapTemplateValue(value, `${typeName}_${template.gqlTypeName}`);\n };\n\n const { templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: endpointType,\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n const replace = new RegExp(`${model.singularApiName}_`, \"g\");\n\n const typeResolvers = templateTypes\n .map(templateType => {\n return templateType.replace(replace, `${graphQLType}_`);\n })\n .reduce<Record<string, Record<string, GraphQLFieldResolver>>>(\n (typeResolvers, templateType, index) => {\n return {\n ...typeResolvers,\n ...createFieldResolvers({\n graphQLType: templateType,\n fields: dzField.settings.templates[index].fields\n })\n };\n },\n {}\n );\n\n return {\n resolver,\n typeResolvers\n };\n };\n};\n\nclass ReadApi implements CmsModelFieldToGraphQL.ReadApi {\n public createTypeField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n if (!templates.length) {\n return null;\n }\n\n const unionTypeName = createUnionTypeName(model, field);\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"read\",\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n typeDefs.unshift(`union ${unionTypeName} = ${templateTypes.join(\" | \")}`);\n\n return {\n fields: `${field.fieldId}: ${field.list ? `[${unionTypeName}!]` : unionTypeName}`,\n typeDefs: typeDefs.join(\"\\n\")\n };\n }\n\n public createResolver(\n params: CmsModelFieldToGraphQL.ResolverParams\n ): CmsModelFieldToGraphQL.Resolver {\n return createDynamicZoneResolver(\"read\")(params);\n }\n}\n\nclass ManageApi implements CmsModelFieldToGraphQL.ManageApi {\n public createTypeField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return null;\n }\n\n const unionTypeName = createUnionTypeName(model, field);\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"manage\",\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n /* Add _templateId. */\n const templateIds = templateTypes.map(type => {\n return `extend type ${type} {\n _templateId: ID!\n }\n `;\n });\n\n typeDefs.unshift(`union ${unionTypeName} = ${templateTypes.join(\" | \")}`);\n\n return {\n fields: `${field.fieldId}: ${field.list ? `[${unionTypeName}!]` : unionTypeName}`,\n typeDefs: typeDefs.concat(templateIds).join(\"\\n\")\n };\n }\n\n public createInputField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return null;\n }\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"manage\",\n typeOfType: \"input\",\n model,\n fieldRegistry,\n templates\n });\n\n const typeName = `${model.singularApiName}_${createTypeName(field.fieldId)}`;\n\n const inputProperties = templateTypes.map(inputTypeName => {\n const key = inputTypeName.replace(`${typeName}_`, \"\").replace(\"Input\", \"\");\n return [key, inputTypeName];\n });\n\n /**\n * Generate a field input type, similar to this example:\n *\n * input Article_ContentInput {\n * Hero: Article_Content_HeroInput\n * SimpleText: Article_Content_SimpleTextInput\n * }\n */\n typeDefs.push(`input ${typeName}Input {\n ${inputProperties.map(\n ([key, value]) => `\n ${key}: ${value}\n `\n )}\n }`);\n\n return {\n fields: createGraphQLInputField(field, `${typeName}Input`),\n typeDefs: typeDefs.join(\"\\n\")\n };\n }\n\n public createResolver(\n params: CmsModelFieldToGraphQL.ResolverParams\n ): CmsModelFieldToGraphQL.Resolver {\n return createDynamicZoneResolver(\"manage\")(params);\n }\n\n public async normalizeInput<T>({\n field,\n input\n }: CmsModelFieldToGraphQL.InputNormalizeParams): Promise<T> {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = dzField.settings?.templates || [];\n\n if (Array.isArray(input) && field.list) {\n return input\n .map(value => normalizeDynamicZoneInput(value, templates))\n .filter(Boolean) as T;\n }\n\n return normalizeDynamicZoneInput(input as GenericRecord<string>, templates) as T;\n }\n}\n\nclass DynamicZoneToGraphQL implements CmsModelFieldToGraphQL.Interface {\n public readonly read = new ReadApi();\n public readonly manage = new ManageApi();\n\n public readonly fieldType: CmsModelFieldType = \"dynamicZone\";\n public readonly isSearchable: boolean = false;\n public readonly isSortable: boolean = false;\n public readonly isFullTextSearchable: boolean = false;\n\n public getReadApi(): CmsModelFieldToGraphQL.ReadApi {\n return this.read;\n }\n\n public getManageApi(): CmsModelFieldToGraphQL.ManageApi {\n return this.manage;\n }\n\n public validateChildFields(params: ValidateChildFieldsParams<CmsModelField>): void {\n const field = params.field as CmsModelDynamicZoneField;\n const originalField = params.originalField as CmsModelDynamicZoneField | undefined;\n\n const getOriginalTemplateFields = (templateId: string) => {\n if (!originalField?.settings?.templates) {\n return [];\n }\n const template = originalField.settings.templates.find(t => t.id === templateId);\n return template?.fields || [];\n };\n\n for (const template of field.settings.templates) {\n params.validate({\n fields: template.fields,\n originalFields: getOriginalTemplateFields(template.id)\n });\n }\n }\n\n public getFieldAst(field: CmsModelField, converter: ICmsModelFieldToAst): CmsModelFieldAstNode {\n const dzField = field as CmsModelDynamicZoneField;\n const { templates = [] } = dzField.settings;\n\n return {\n type: \"field\",\n field,\n children: templates.map(({ fields, ...template }) => {\n return {\n type: \"collection\" as const,\n collection: {\n ...template,\n discriminator: \"_templateId\"\n },\n children: fields.map(f => converter.toAst(f))\n };\n })\n };\n }\n}\n\nexport const DynamicZoneFieldToGraphQL = CmsModelFieldToGraphQL.createImplementation({\n implementation: DynamicZoneToGraphQL,\n dependencies: []\n});\n"],"names":["createUnionTypeName","model","field","createTypeName","getFieldTemplates","Array","remapTemplateValue","value","typeName","createDynamicZoneResolver","endpointType","models","fieldRegistry","createFieldResolvers","graphQLType","dzField","templates","resolver","parent","v","template","tpl","templateTypes","createTypeDefsForTemplates","replace","RegExp","typeResolvers","templateType","index","ReadApi","unionTypeName","typeDefs","params","ManageApi","templateIds","type","inputProperties","inputTypeName","key","createGraphQLInputField","input","normalizeDynamicZoneInput","Boolean","DynamicZoneToGraphQL","originalField","getOriginalTemplateFields","templateId","t","converter","fields","f","DynamicZoneFieldToGraphQL","CmsModelFieldToGraphQL"],"mappings":";;;;;AAmBA,MAAMA,sBAAsB,CAACC,OAAiBC,QACnC,GAAGD,MAAM,eAAe,CAAC,CAAC,EAAEE,eAAeD,MAAM,OAAO,GAAG;AAGtE,MAAME,oBAAoB,CAACF;IACvB,IAAI,CAACG,MAAM,OAAO,CAACH,MAAM,QAAQ,EAAE,YAC/B,OAAO,EAAE;IAEb,OAAOA,MAAM,QAAQ,CAAC,SAAS;AACnC;AAEA,MAAMI,qBAAqB,CAACC,OAAYC,WAC7B;QAAE,GAAGD,KAAK;QAAE,YAAYC;IAAS;AAG5C,MAAMC,4BAA4B,CAC9BC,eAEO,CAAC,EAAET,KAAK,EAAEU,MAAM,EAAET,KAAK,EAAEU,aAAa,EAAEC,oBAAoB,EAAEC,WAAW,EAAE;QAC9E,MAAMC,UAAUb;QAChB,MAAMc,YAAYZ,kBAAkBW;QAEpC,IAAI,CAACC,UAAU,MAAM,EACjB,OAAO;QAGX,MAAMC,WAAW,CAACC;YACd,MAAMX,QAAQW,MAAM,CAAChB,MAAM,OAAO,CAAC;YACnC,IAAI,CAACK,OACD,OAAOA;YAGX,MAAMC,WAAW,GAAGM,YAAY,CAAC,EAAEX,eAAeD,MAAM,OAAO,GAAG;YAElE,IAAIA,MAAM,IAAI,IAAIG,MAAM,OAAO,CAACE,QAC5B,OAAOA,MAAM,GAAG,CAACY,CAAAA;gBACb,MAAMC,WAAWJ,UAAU,IAAI,CAACK,CAAAA,MAAOA,IAAI,EAAE,KAAKF,EAAE,WAAW;gBAC/D,IAAI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aAAa;QAE1C,MAAMa,4BAA4B,CAACC;YAC/B,IAAI,CAACF,eAAe,UAAU,WAC1B,OAAO,EAAE;YAEb,MAAMxB,WAAWwB,cAAc,QAAQ,CAAC,SAAS,CAAC,IAAI,CAACG,CAAAA,IAAKA,EAAE,EAAE,KAAKD;YACrE,OAAO1B,UAAU,UAAU,EAAE;QACjC;QAEA,KAAK,MAAMA,YAAYlB,MAAM,QAAQ,CAAC,SAAS,CAC3C8B,OAAO,QAAQ,CAAC;YACZ,QAAQZ,SAAS,MAAM;YACvB,gBAAgByB,0BAA0BzB,SAAS,EAAE;QACzD;IAER;IAEO,YAAYlB,KAAoB,EAAE8C,SAA8B,EAAwB;QAC3F,MAAMjC,UAAUb;QAChB,MAAM,EAAEc,YAAY,EAAE,EAAE,GAAGD,QAAQ,QAAQ;QAE3C,OAAO;YACH,MAAM;YACNb;YACA,UAAUc,UAAU,GAAG,CAAC,CAAC,EAAEiC,MAAM,EAAE,GAAG7B,UAAU,GACrC;oBACH,MAAM;oBACN,YAAY;wBACR,GAAGA,QAAQ;wBACX,eAAe;oBACnB;oBACA,UAAU6B,OAAO,GAAG,CAACC,CAAAA,IAAKF,UAAU,KAAK,CAACE;gBAC9C;QAER;IACJ;;aAtDgB,IAAI,GAAG,IAAIrB;aACX,MAAM,GAAG,IAAII;aAEb,SAAS,GAAsB;aAC/B,YAAY,GAAY;aACxB,UAAU,GAAY;aACtB,oBAAoB,GAAY;;AAiDpD;AAEO,MAAMkB,4BAA4BC,uBAAuB,oBAAoB,CAAC;IACjF,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
|
1
|
+
{"version":3,"file":"features/graphql/fields/base/DynamicZoneToGraphQL.js","sources":["../../../../../src/features/graphql/fields/base/DynamicZoneToGraphQL.ts"],"sourcesContent":["import { CmsModelFieldToGraphQL } from \"../abstractions/CmsModelFieldToGraphQL.js\";\nimport type {\n ApiEndpoint,\n CmsDynamicZoneTemplate,\n CmsModel,\n CmsModelDynamicZoneField,\n CmsModelField,\n CmsModelFieldType,\n CmsModelFieldDefinition\n} from \"~/types/index.js\";\nimport type { ValidateChildFieldsParams } from \"../abstractions/CmsModelFieldToGraphQL.js\";\nimport type { CmsModelFieldAstNode, ICmsModelFieldToAst } from \"~/types/modelAst.js\";\nimport type { GraphQLFieldResolver } from \"@webiny/api-graphql/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { createTypeName } from \"~/utils/createTypeName.js\";\nimport { createGraphQLInputField } from \"./utils/createGraphQLInputField.js\";\nimport { createTypeDefsForTemplates } from \"./dynamicZone/createTypeDefsForTemplates.js\";\nimport { normalizeDynamicZoneInput } from \"./dynamicZone/normalizeDynamicZoneInput.js\";\n\nconst createUnionTypeName = (model: CmsModel, field: CmsModelField) => {\n return `${model.singularApiName}_${createTypeName(field.fieldId)}`;\n};\n\nconst getFieldTemplates = (field: CmsModelDynamicZoneField): CmsDynamicZoneTemplate[] => {\n if (!Array.isArray(field.settings?.templates)) {\n return [];\n }\n return field.settings.templates;\n};\n\nconst remapTemplateValue = (value: any, typeName: string) => {\n return { ...value, __typename: typeName };\n};\n\nconst createDynamicZoneResolver = (\n endpointType: ApiEndpoint\n): ((params: CmsModelFieldToGraphQL.ResolverParams) => CmsModelFieldToGraphQL.Resolver) => {\n return ({ model, models, field, fieldRegistry, createFieldResolvers, graphQLType }) => {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return false;\n }\n\n const resolver = (parent: any) => {\n const value = parent[field.fieldId];\n if (!value) {\n return value;\n }\n\n const typeName = `${graphQLType}_${createTypeName(field.fieldId)}`;\n\n if (field.list && Array.isArray(value)) {\n return value.map(v => {\n const template = templates.find(tpl => tpl.id === v._templateId);\n if (!template) {\n return undefined;\n }\n return remapTemplateValue(v, `${typeName}_${template.gqlTypeName}`);\n });\n }\n\n const template = templates.find(tpl => tpl.id === value._templateId);\n if (!template) {\n return undefined;\n }\n return remapTemplateValue(value, `${typeName}_${template.gqlTypeName}`);\n };\n\n const { templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: endpointType,\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n const replace = new RegExp(`${model.singularApiName}_`, \"g\");\n\n const typeResolvers = templateTypes\n .map(templateType => {\n return templateType.replace(replace, `${graphQLType}_`);\n })\n .reduce<Record<string, Record<string, GraphQLFieldResolver>>>(\n (typeResolvers, templateType, index) => {\n return {\n ...typeResolvers,\n ...createFieldResolvers({\n graphQLType: templateType,\n fields: dzField.settings.templates[index].fields\n })\n };\n },\n {}\n );\n\n return {\n resolver,\n typeResolvers\n };\n };\n};\n\nclass ReadApi implements CmsModelFieldToGraphQL.ReadApi {\n public createTypeField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n if (!templates.length) {\n return null;\n }\n\n const unionTypeName = createUnionTypeName(model, field);\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"read\",\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n typeDefs.unshift(`union ${unionTypeName} = ${templateTypes.join(\" | \")}`);\n\n return {\n fields: `${field.fieldId}: ${field.list ? `[${unionTypeName}!]` : unionTypeName}`,\n typeDefs: typeDefs.join(\"\\n\")\n };\n }\n\n public createResolver(\n params: CmsModelFieldToGraphQL.ResolverParams\n ): CmsModelFieldToGraphQL.Resolver {\n return createDynamicZoneResolver(\"read\")(params);\n }\n}\n\nclass ManageApi implements CmsModelFieldToGraphQL.ManageApi {\n public createTypeField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return null;\n }\n\n const unionTypeName = createUnionTypeName(model, field);\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"manage\",\n typeOfType: \"type\",\n model,\n fieldRegistry,\n templates\n });\n\n /* Add _templateId. */\n const templateIds = templateTypes.map(type => {\n return `extend type ${type} {\n _templateId: ID!\n }\n `;\n });\n\n typeDefs.unshift(`union ${unionTypeName} = ${templateTypes.join(\" | \")}`);\n\n return {\n fields: `${field.fieldId}: ${field.list ? `[${unionTypeName}!]` : unionTypeName}`,\n typeDefs: typeDefs.concat(templateIds).join(\"\\n\")\n };\n }\n\n public createInputField({\n models,\n model,\n field,\n fieldRegistry\n }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition | null {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = getFieldTemplates(dzField);\n\n if (!templates.length) {\n return null;\n }\n\n const { typeDefs, templateTypes } = createTypeDefsForTemplates({\n models,\n field,\n type: \"manage\",\n typeOfType: \"input\",\n model,\n fieldRegistry,\n templates\n });\n\n const typeName = `${model.singularApiName}_${createTypeName(field.fieldId)}`;\n\n const inputProperties = templateTypes.map(inputTypeName => {\n const key = inputTypeName.replace(`${typeName}_`, \"\").replace(\"Input\", \"\");\n return [key, inputTypeName];\n });\n\n /**\n * Generate a field input type, similar to this example:\n *\n * input Article_ContentInput {\n * Hero: Article_Content_HeroInput\n * SimpleText: Article_Content_SimpleTextInput\n * }\n */\n typeDefs.push(`input ${typeName}Input {\n ${inputProperties.map(\n ([key, value]) => `\n ${key}: ${value}\n `\n )}\n }`);\n\n return {\n fields: createGraphQLInputField(field, `${typeName}Input`),\n typeDefs: typeDefs.join(\"\\n\")\n };\n }\n\n public createResolver(\n params: CmsModelFieldToGraphQL.ResolverParams\n ): CmsModelFieldToGraphQL.Resolver {\n return createDynamicZoneResolver(\"manage\")(params);\n }\n\n public async normalizeInput<T>({\n field,\n input\n }: CmsModelFieldToGraphQL.InputNormalizeParams): Promise<T> {\n const dzField = field as CmsModelDynamicZoneField;\n const templates = dzField.settings?.templates || [];\n\n if (Array.isArray(input) && field.list) {\n return input\n .map(value => normalizeDynamicZoneInput(value, templates))\n .filter(Boolean) as T;\n }\n\n return normalizeDynamicZoneInput(input as GenericRecord<string>, templates) as T;\n }\n}\n\nclass DynamicZoneToGraphQL implements CmsModelFieldToGraphQL.Interface {\n public readonly read = new ReadApi();\n public readonly manage = new ManageApi();\n\n public readonly fieldType: CmsModelFieldType = \"dynamicZone\";\n public readonly isSearchable: boolean = false;\n public readonly isSortable: boolean = false;\n public readonly isFullTextSearchable: boolean = false;\n\n public getReadApi(): CmsModelFieldToGraphQL.ReadApi {\n return this.read;\n }\n\n public getManageApi(): CmsModelFieldToGraphQL.ManageApi {\n return this.manage;\n }\n\n public validateChildFields(params: ValidateChildFieldsParams<CmsModelField>): void {\n const field = params.field as CmsModelDynamicZoneField;\n const originalField = params.originalField as CmsModelDynamicZoneField | undefined;\n\n const getOriginalTemplateFields = (templateId: string) => {\n if (!originalField?.settings?.templates) {\n return [];\n }\n const template = originalField.settings.templates.find(t => t.id === templateId);\n return template?.fields || [];\n };\n\n for (const template of field.settings.templates) {\n params.validate({\n fields: template.fields,\n originalFields: getOriginalTemplateFields(template.id)\n });\n }\n }\n\n public getFieldAst(field: CmsModelField, converter: ICmsModelFieldToAst): CmsModelFieldAstNode {\n const dzField = field as CmsModelDynamicZoneField;\n const { templates = [] } = dzField.settings;\n\n return {\n type: \"field\",\n field,\n children: templates.map(({ fields, ...template }) => {\n return {\n type: \"collection\" as const,\n collection: {\n ...template,\n discriminator: \"_templateId\"\n },\n children: fields.map(f => converter.toAst(f))\n };\n })\n };\n }\n}\n\nexport const DynamicZoneFieldToGraphQL = CmsModelFieldToGraphQL.createImplementation({\n implementation: DynamicZoneToGraphQL,\n dependencies: []\n});\n"],"names":["createUnionTypeName","model","field","createTypeName","getFieldTemplates","Array","remapTemplateValue","value","typeName","createDynamicZoneResolver","endpointType","models","fieldRegistry","createFieldResolvers","graphQLType","dzField","templates","resolver","parent","v","template","tpl","templateTypes","createTypeDefsForTemplates","replace","RegExp","typeResolvers","templateType","index","ReadApi","unionTypeName","typeDefs","params","ManageApi","templateIds","type","inputProperties","inputTypeName","key","createGraphQLInputField","input","normalizeDynamicZoneInput","Boolean","DynamicZoneToGraphQL","originalField","getOriginalTemplateFields","templateId","t","converter","fields","f","DynamicZoneFieldToGraphQL","CmsModelFieldToGraphQL"],"mappings":";;;;;AAmBA,MAAMA,sBAAsB,CAACC,OAAiBC,QACnC,GAAGD,MAAM,eAAe,CAAC,CAAC,EAAEE,eAAeD,MAAM,OAAO,GAAG;AAGtE,MAAME,oBAAoB,CAACF;IACvB,IAAI,CAACG,MAAM,OAAO,CAACH,MAAM,QAAQ,EAAE,YAC/B,OAAO,EAAE;IAEb,OAAOA,MAAM,QAAQ,CAAC,SAAS;AACnC;AAEA,MAAMI,qBAAqB,CAACC,OAAYC,WAC7B;QAAE,GAAGD,KAAK;QAAE,YAAYC;IAAS;AAG5C,MAAMC,4BAA4B,CAC9BC,eAEO,CAAC,EAAET,KAAK,EAAEU,MAAM,EAAET,KAAK,EAAEU,aAAa,EAAEC,oBAAoB,EAAEC,WAAW,EAAE;QAC9E,MAAMC,UAAUb;QAChB,MAAMc,YAAYZ,kBAAkBW;QAEpC,IAAI,CAACC,UAAU,MAAM,EACjB,OAAO;QAGX,MAAMC,WAAW,CAACC;YACd,MAAMX,QAAQW,MAAM,CAAChB,MAAM,OAAO,CAAC;YACnC,IAAI,CAACK,OACD,OAAOA;YAGX,MAAMC,WAAW,GAAGM,YAAY,CAAC,EAAEX,eAAeD,MAAM,OAAO,GAAG;YAElE,IAAIA,MAAM,IAAI,IAAIG,MAAM,OAAO,CAACE,QAC5B,OAAOA,MAAM,GAAG,CAACY,CAAAA;gBACb,MAAMC,WAAWJ,UAAU,IAAI,CAACK,CAAAA,MAAOA,IAAI,EAAE,KAAKF,EAAE,WAAW;gBAC/D,IAAI,CAACC,UACD;gBAEJ,OAAOd,mBAAmBa,GAAG,GAAGX,SAAS,CAAC,EAAEY,SAA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OAAO,EAAE;YAEb,MAAMxB,WAAWwB,cAAc,QAAQ,CAAC,SAAS,CAAC,IAAI,CAACG,CAAAA,IAAKA,EAAE,EAAE,KAAKD;YACrE,OAAO1B,UAAU,UAAU,EAAE;QACjC;QAEA,KAAK,MAAMA,YAAYlB,MAAM,QAAQ,CAAC,SAAS,CAC3C8B,OAAO,QAAQ,CAAC;YACZ,QAAQZ,SAAS,MAAM;YACvB,gBAAgByB,0BAA0BzB,SAAS,EAAE;QACzD;IAER;IAEO,YAAYlB,KAAoB,EAAE8C,SAA8B,EAAwB;QAC3F,MAAMjC,UAAUb;QAChB,MAAM,EAAEc,YAAY,EAAE,EAAE,GAAGD,QAAQ,QAAQ;QAE3C,OAAO;YACH,MAAM;YACNb;YACA,UAAUc,UAAU,GAAG,CAAC,CAAC,EAAEiC,MAAM,EAAE,GAAG7B,UAAU,GACrC;oBACH,MAAM;oBACN,YAAY;wBACR,GAAGA,QAAQ;wBACX,eAAe;oBACnB;oBACA,UAAU6B,OAAO,GAAG,CAACC,CAAAA,IAAKF,UAAU,KAAK,CAACE;gBAC9C;QAER;IACJ;;aAtDgB,IAAI,GAAG,IAAIrB;aACX,MAAM,GAAG,IAAII;aAEb,SAAS,GAAsB;aAC/B,YAAY,GAAY;aACxB,UAAU,GAAY;aACtB,oBAAoB,GAAY;;AAiDpD;AAEO,MAAMkB,4BAA4BC,uBAAuB,oBAAoB,CAAC;IACjF,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CmsModelFieldToGraphQL } from "../abstractions/CmsModelFieldToGraphQL.js";
|
|
2
2
|
import type { CmsContext, CmsModelField, CmsModelFieldType, CmsModelFieldDefinition } from "../../../../types/index.js";
|
|
3
|
-
import type { GraphQLSchemaDefinition } from "@webiny/
|
|
3
|
+
import type { GraphQLSchemaDefinition } from "@webiny/api-graphql/types.js";
|
|
4
4
|
declare class ReadApi implements CmsModelFieldToGraphQL.ReadApi {
|
|
5
5
|
createTypeField({ model, field, models }: CmsModelFieldToGraphQL.TypeFieldParams): CmsModelFieldDefinition;
|
|
6
6
|
createListFilters({ field }: CmsModelFieldToGraphQL.ListFiltersParams): string;
|