@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
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
class CmsModelToJsonSchemaConverter {
|
|
2
|
+
constructor(options){
|
|
3
|
+
this.options = {
|
|
4
|
+
includeHiddenFields: false,
|
|
5
|
+
...options
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
convert(ast, model) {
|
|
9
|
+
const { properties, required } = this.convertChildren(ast.children);
|
|
10
|
+
const schema = {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties
|
|
13
|
+
};
|
|
14
|
+
if (required.length > 0) schema.required = required;
|
|
15
|
+
const description = this.buildModelDescription(model);
|
|
16
|
+
if (description) schema.description = description;
|
|
17
|
+
return schema;
|
|
18
|
+
}
|
|
19
|
+
convertNode(node) {
|
|
20
|
+
if ("collection" === node.type) return null;
|
|
21
|
+
const field = node.field;
|
|
22
|
+
if (this.isHidden(field)) return null;
|
|
23
|
+
let schema;
|
|
24
|
+
if (this.childrenAreCollections(node)) schema = this.convertDynamicZone(node);
|
|
25
|
+
else if (node.children.length > 0) {
|
|
26
|
+
const { properties, required } = this.convertChildren(node.children);
|
|
27
|
+
schema = {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties
|
|
30
|
+
};
|
|
31
|
+
if (required.length > 0) schema.required = required;
|
|
32
|
+
} else schema = this.convertFieldByType(field);
|
|
33
|
+
const description = this.buildFieldDescription(field);
|
|
34
|
+
if (description) schema.description = schema.description ? `${description}. ${schema.description}` : description;
|
|
35
|
+
if (field.list) return this.wrapAsList(schema, field);
|
|
36
|
+
return schema;
|
|
37
|
+
}
|
|
38
|
+
convertChildren(children) {
|
|
39
|
+
const properties = {};
|
|
40
|
+
const required = [];
|
|
41
|
+
for (const child of children){
|
|
42
|
+
if ("collection" === child.type) continue;
|
|
43
|
+
const schema = this.convertNode(child);
|
|
44
|
+
if (null === schema) continue;
|
|
45
|
+
properties[child.field.fieldId] = schema;
|
|
46
|
+
const constraints = this.extractValidationConstraints(child.field.validation || []);
|
|
47
|
+
if (constraints.required) required.push(child.field.fieldId);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
properties,
|
|
51
|
+
required
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
convertFieldByType(field) {
|
|
55
|
+
switch(field.type){
|
|
56
|
+
case "text":
|
|
57
|
+
return this.convertTextField(field);
|
|
58
|
+
case "long-text":
|
|
59
|
+
return this.convertLongTextField(field);
|
|
60
|
+
case "rich-text":
|
|
61
|
+
return this.convertRichTextField(field);
|
|
62
|
+
case "number":
|
|
63
|
+
return this.convertNumberField(field);
|
|
64
|
+
case "boolean":
|
|
65
|
+
return this.convertBooleanField();
|
|
66
|
+
case "datetime":
|
|
67
|
+
return this.convertDateTimeField(field);
|
|
68
|
+
case "file":
|
|
69
|
+
return this.convertFileField(field);
|
|
70
|
+
case "ref":
|
|
71
|
+
return this.convertRefField(field);
|
|
72
|
+
case "json":
|
|
73
|
+
return {
|
|
74
|
+
type: "object",
|
|
75
|
+
additionalProperties: true
|
|
76
|
+
};
|
|
77
|
+
default:
|
|
78
|
+
return {
|
|
79
|
+
type: "object",
|
|
80
|
+
additionalProperties: true
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
convertTextField(field) {
|
|
85
|
+
const schema = {
|
|
86
|
+
type: "string"
|
|
87
|
+
};
|
|
88
|
+
this.applyPredefinedValues(schema, field);
|
|
89
|
+
this.applyValidationConstraints(schema, field.validation);
|
|
90
|
+
return schema;
|
|
91
|
+
}
|
|
92
|
+
convertLongTextField(field) {
|
|
93
|
+
const schema = {
|
|
94
|
+
type: "string"
|
|
95
|
+
};
|
|
96
|
+
this.applyValidationConstraints(schema, field.validation);
|
|
97
|
+
return schema;
|
|
98
|
+
}
|
|
99
|
+
convertRichTextField(_field) {
|
|
100
|
+
return {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {
|
|
103
|
+
tool: {
|
|
104
|
+
const: "textToLexical"
|
|
105
|
+
},
|
|
106
|
+
params: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
text: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Rich text content as HTML markup. Use semantic HTML tags: <h1>-<h6>, <p>, <strong>, <em>, <ul>, <ol>, <li>, <a>, <blockquote>."
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: [
|
|
115
|
+
"text"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
required: [
|
|
120
|
+
"tool",
|
|
121
|
+
"params"
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
convertNumberField(field) {
|
|
126
|
+
const schema = {
|
|
127
|
+
type: "number"
|
|
128
|
+
};
|
|
129
|
+
this.applyPredefinedValues(schema, field, true);
|
|
130
|
+
this.applyValidationConstraints(schema, field.validation);
|
|
131
|
+
return schema;
|
|
132
|
+
}
|
|
133
|
+
convertBooleanField() {
|
|
134
|
+
return {
|
|
135
|
+
type: "boolean"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
convertDateTimeField(field) {
|
|
139
|
+
const schema = {
|
|
140
|
+
type: "string"
|
|
141
|
+
};
|
|
142
|
+
const dateType = field.settings?.type;
|
|
143
|
+
switch(dateType){
|
|
144
|
+
case "date":
|
|
145
|
+
schema.format = "date";
|
|
146
|
+
break;
|
|
147
|
+
case "time":
|
|
148
|
+
schema.format = "time";
|
|
149
|
+
break;
|
|
150
|
+
case "dateTimeWithTimezone":
|
|
151
|
+
schema.format = "date-time";
|
|
152
|
+
break;
|
|
153
|
+
case "dateTimeWithoutTimezone":
|
|
154
|
+
schema.format = "date-time";
|
|
155
|
+
schema.description = "Date and time without timezone (ISO 8601 format).";
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
schema.format = "date-time";
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
return schema;
|
|
162
|
+
}
|
|
163
|
+
convertFileField(field) {
|
|
164
|
+
const imagesOnly = field.settings?.imagesOnly === true;
|
|
165
|
+
return {
|
|
166
|
+
type: "object",
|
|
167
|
+
properties: {
|
|
168
|
+
tool: {
|
|
169
|
+
const: "cmsResolveImage"
|
|
170
|
+
},
|
|
171
|
+
params: {
|
|
172
|
+
type: "object",
|
|
173
|
+
properties: {
|
|
174
|
+
id: {
|
|
175
|
+
type: "string",
|
|
176
|
+
description: imagesOnly ? "Image file ID obtained from listImagesByTag." : "File ID obtained from listImagesByTag."
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
required: [
|
|
180
|
+
"id"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
required: [
|
|
185
|
+
"tool",
|
|
186
|
+
"params"
|
|
187
|
+
]
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
convertRefField(field) {
|
|
191
|
+
const models = field.settings?.models;
|
|
192
|
+
const modelIds = Array.isArray(models) && models.length > 0 ? models.map((m)=>m.modelId) : [];
|
|
193
|
+
const schema = {
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
entryId: {
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "ID of the referenced entry."
|
|
199
|
+
},
|
|
200
|
+
modelId: {
|
|
201
|
+
type: "string",
|
|
202
|
+
description: "Model ID of the referenced entry."
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
required: [
|
|
206
|
+
"entryId",
|
|
207
|
+
"modelId"
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
if (modelIds.length > 0) {
|
|
211
|
+
const modelIdProp = schema.properties["modelId"];
|
|
212
|
+
modelIdProp.enum = modelIds;
|
|
213
|
+
}
|
|
214
|
+
return schema;
|
|
215
|
+
}
|
|
216
|
+
convertDynamicZone(node) {
|
|
217
|
+
const collections = node.children.filter((child)=>"collection" === child.type);
|
|
218
|
+
const oneOf = collections.map((collection)=>this.convertCollection(collection));
|
|
219
|
+
const schema = {
|
|
220
|
+
oneOf
|
|
221
|
+
};
|
|
222
|
+
if (collections.length > 0) schema.discriminator = {
|
|
223
|
+
propertyName: collections[0].collection.discriminator
|
|
224
|
+
};
|
|
225
|
+
return schema;
|
|
226
|
+
}
|
|
227
|
+
convertCollection(collection) {
|
|
228
|
+
const { properties, required } = this.convertChildren(collection.children);
|
|
229
|
+
properties[collection.collection.discriminator] = {
|
|
230
|
+
const: collection.collection.id
|
|
231
|
+
};
|
|
232
|
+
const allRequired = [
|
|
233
|
+
collection.collection.discriminator,
|
|
234
|
+
...required
|
|
235
|
+
];
|
|
236
|
+
const schema = {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties,
|
|
239
|
+
required: allRequired
|
|
240
|
+
};
|
|
241
|
+
if (collection.collection.name) schema.description = collection.collection.name;
|
|
242
|
+
return schema;
|
|
243
|
+
}
|
|
244
|
+
buildFieldDescription(field) {
|
|
245
|
+
const parts = [];
|
|
246
|
+
if (field.label) parts.push(field.label);
|
|
247
|
+
if (field.description) parts.push(field.description);
|
|
248
|
+
if (field.help) parts.push(field.help);
|
|
249
|
+
if (0 === parts.length) return;
|
|
250
|
+
return parts.join(". ");
|
|
251
|
+
}
|
|
252
|
+
buildModelDescription(model) {
|
|
253
|
+
const parts = [];
|
|
254
|
+
if (model.name) parts.push(model.name);
|
|
255
|
+
if (model.description) parts.push(model.description);
|
|
256
|
+
if (0 === parts.length) return;
|
|
257
|
+
return parts.join(". ");
|
|
258
|
+
}
|
|
259
|
+
extractValidationConstraints(validations) {
|
|
260
|
+
const constraints = {
|
|
261
|
+
required: false
|
|
262
|
+
};
|
|
263
|
+
if (!validations) return constraints;
|
|
264
|
+
for (const v of validations)switch(v.name){
|
|
265
|
+
case "required":
|
|
266
|
+
constraints.required = true;
|
|
267
|
+
break;
|
|
268
|
+
case "minLength":
|
|
269
|
+
if (v.settings?.value !== void 0) constraints.minLength = Number(v.settings.value);
|
|
270
|
+
break;
|
|
271
|
+
case "maxLength":
|
|
272
|
+
if (v.settings?.value !== void 0) constraints.maxLength = Number(v.settings.value);
|
|
273
|
+
break;
|
|
274
|
+
case "gte":
|
|
275
|
+
if (v.settings?.value !== void 0) constraints.minimum = Number(v.settings.value);
|
|
276
|
+
break;
|
|
277
|
+
case "lte":
|
|
278
|
+
if (v.settings?.value !== void 0) constraints.maximum = Number(v.settings.value);
|
|
279
|
+
break;
|
|
280
|
+
case "pattern":
|
|
281
|
+
if (v.settings?.preset === "email") constraints.format = "email";
|
|
282
|
+
else if (v.settings?.preset === "url") constraints.format = "uri";
|
|
283
|
+
else if (v.settings?.value !== void 0) constraints.pattern = String(v.settings.value);
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
return constraints;
|
|
287
|
+
}
|
|
288
|
+
applyValidationConstraints(schema, validations) {
|
|
289
|
+
const constraints = this.extractValidationConstraints(validations);
|
|
290
|
+
if (void 0 !== constraints.minLength) schema.minLength = constraints.minLength;
|
|
291
|
+
if (void 0 !== constraints.maxLength) schema.maxLength = constraints.maxLength;
|
|
292
|
+
if (void 0 !== constraints.minimum) schema.minimum = constraints.minimum;
|
|
293
|
+
if (void 0 !== constraints.maximum) schema.maximum = constraints.maximum;
|
|
294
|
+
if (void 0 !== constraints.pattern) schema.pattern = constraints.pattern;
|
|
295
|
+
if (void 0 !== constraints.format) schema.format = constraints.format;
|
|
296
|
+
}
|
|
297
|
+
applyPredefinedValues(schema, field, parseAsNumber = false) {
|
|
298
|
+
if (field.predefinedValues?.enabled !== true) return;
|
|
299
|
+
const values = field.predefinedValues.values;
|
|
300
|
+
if (!Array.isArray(values) || 0 === values.length) return;
|
|
301
|
+
schema.enum = values.map((v)=>parseAsNumber ? Number(v.value) : v.value);
|
|
302
|
+
}
|
|
303
|
+
wrapAsList(schema, field) {
|
|
304
|
+
const listSchema = {
|
|
305
|
+
type: "array",
|
|
306
|
+
items: schema
|
|
307
|
+
};
|
|
308
|
+
for (const v of field.listValidation || []){
|
|
309
|
+
if ("minLength" === v.name && v.settings?.value !== void 0) listSchema.minLength = Number(v.settings.value);
|
|
310
|
+
if ("maxLength" === v.name && v.settings?.value !== void 0) listSchema.maxLength = Number(v.settings.value);
|
|
311
|
+
}
|
|
312
|
+
return listSchema;
|
|
313
|
+
}
|
|
314
|
+
isHidden(field) {
|
|
315
|
+
if (this.options.includeHiddenFields) return false;
|
|
316
|
+
return field.renderer?.name === "hidden";
|
|
317
|
+
}
|
|
318
|
+
childrenAreCollections(node) {
|
|
319
|
+
return node.children.length > 0 && node.children.every((c)=>"collection" === c.type);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
export { CmsModelToJsonSchemaConverter };
|
|
323
|
+
|
|
324
|
+
//# sourceMappingURL=CmsModelToJsonSchemaConverter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js","sources":["../../../src/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsModelAst,\n CmsModelField,\n CmsModelFieldAstNode,\n CmsModelFieldAstNodeCollection,\n CmsModelFieldAstNodeField,\n CmsModelFieldValidation\n} from \"~/types/index.js\";\nimport type { JsonSchema, CmsModelToJsonSchemaOptions } from \"./types.js\";\n\ninterface ValidationConstraints {\n required: boolean;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n pattern?: string;\n format?: string;\n}\n\ninterface ConvertedChildren {\n properties: Record<string, JsonSchema>;\n required: string[];\n}\n\nexport class CmsModelToJsonSchemaConverter {\n private readonly options: Required<CmsModelToJsonSchemaOptions>;\n\n constructor(options?: CmsModelToJsonSchemaOptions) {\n this.options = {\n includeHiddenFields: false,\n ...options\n };\n }\n\n convert(ast: CmsModelAst, model: Pick<CmsModel, \"name\" | \"description\">): JsonSchema {\n const { properties, required } = this.convertChildren(ast.children);\n\n const schema: JsonSchema = {\n type: \"object\",\n properties\n };\n\n if (required.length > 0) {\n schema.required = required;\n }\n\n const description = this.buildModelDescription(model);\n if (description) {\n schema.description = description;\n }\n\n return schema;\n }\n\n private convertNode(node: CmsModelFieldAstNode): JsonSchema | null {\n if (node.type === \"collection\") {\n return null;\n }\n\n const field = node.field;\n\n if (this.isHidden(field)) {\n return null;\n }\n\n let schema: JsonSchema;\n\n if (this.childrenAreCollections(node)) {\n schema = this.convertDynamicZone(node);\n } else if (node.children.length > 0) {\n const { properties, required } = this.convertChildren(node.children);\n schema = { type: \"object\", properties };\n if (required.length > 0) {\n schema.required = required;\n }\n } else {\n schema = this.convertFieldByType(field);\n }\n\n const description = this.buildFieldDescription(field);\n if (description) {\n schema.description = schema.description\n ? `${description}. ${schema.description}`\n : description;\n }\n\n if (field.list) {\n return this.wrapAsList(schema, field);\n }\n\n return schema;\n }\n\n private convertChildren(children: CmsModelFieldAstNode[]): ConvertedChildren {\n const properties: Record<string, JsonSchema> = {};\n const required: string[] = [];\n\n for (const child of children) {\n if (child.type === \"collection\") {\n continue;\n }\n\n const schema = this.convertNode(child);\n if (schema === null) {\n continue;\n }\n\n properties[child.field.fieldId] = schema;\n\n const constraints = this.extractValidationConstraints(child.field.validation || []);\n if (constraints.required) {\n required.push(child.field.fieldId);\n }\n }\n\n return { properties, required };\n }\n\n private convertFieldByType(field: CmsModelField): JsonSchema {\n switch (field.type) {\n case \"text\":\n return this.convertTextField(field);\n case \"long-text\":\n return this.convertLongTextField(field);\n case \"rich-text\":\n return this.convertRichTextField(field);\n case \"number\":\n return this.convertNumberField(field);\n case \"boolean\":\n return this.convertBooleanField();\n case \"datetime\":\n return this.convertDateTimeField(field);\n case \"file\":\n return this.convertFileField(field);\n case \"ref\":\n return this.convertRefField(field);\n case \"json\":\n return { type: \"object\", additionalProperties: true };\n default:\n return { type: \"object\", additionalProperties: true };\n }\n }\n\n private convertTextField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n this.applyPredefinedValues(schema, field);\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertLongTextField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertRichTextField(_field: CmsModelField): JsonSchema {\n return {\n type: \"object\",\n properties: {\n tool: { const: \"textToLexical\" },\n params: {\n type: \"object\",\n properties: {\n text: {\n type: \"string\",\n description:\n \"Rich text content as HTML markup. Use semantic HTML tags: <h1>-<h6>, <p>, <strong>, <em>, <ul>, <ol>, <li>, <a>, <blockquote>.\"\n }\n },\n required: [\"text\"]\n }\n },\n required: [\"tool\", \"params\"]\n };\n }\n\n private convertNumberField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"number\" };\n this.applyPredefinedValues(schema, field, true);\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertBooleanField(): JsonSchema {\n return { type: \"boolean\" };\n }\n\n private convertDateTimeField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n\n const dateType = field.settings?.type;\n switch (dateType) {\n case \"date\":\n schema.format = \"date\";\n break;\n case \"time\":\n schema.format = \"time\";\n break;\n case \"dateTimeWithTimezone\":\n schema.format = \"date-time\";\n break;\n case \"dateTimeWithoutTimezone\":\n schema.format = \"date-time\";\n schema.description = \"Date and time without timezone (ISO 8601 format).\";\n break;\n default:\n schema.format = \"date-time\";\n break;\n }\n\n return schema;\n }\n\n private convertFileField(field: CmsModelField): JsonSchema {\n const imagesOnly = field.settings?.imagesOnly === true;\n return {\n type: \"object\",\n properties: {\n tool: { const: \"cmsResolveImage\" },\n params: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n description: imagesOnly\n ? \"Image file ID obtained from listImagesByTag.\"\n : \"File ID obtained from listImagesByTag.\"\n }\n },\n required: [\"id\"]\n }\n },\n required: [\"tool\", \"params\"]\n };\n }\n\n private convertRefField(field: CmsModelField): JsonSchema {\n const models = field.settings?.models;\n const modelIds =\n Array.isArray(models) && models.length > 0\n ? models.map((m: { modelId: string }) => m.modelId)\n : [];\n\n const schema: JsonSchema = {\n type: \"object\",\n properties: {\n entryId: { type: \"string\", description: \"ID of the referenced entry.\" },\n modelId: {\n type: \"string\",\n description: \"Model ID of the referenced entry.\"\n }\n },\n required: [\"entryId\", \"modelId\"]\n };\n\n if (modelIds.length > 0) {\n const modelIdProp = schema.properties![\"modelId\"];\n modelIdProp.enum = modelIds;\n }\n\n return schema;\n }\n\n private convertDynamicZone(node: CmsModelFieldAstNodeField): JsonSchema {\n const collections = node.children.filter(\n (child): child is CmsModelFieldAstNodeCollection => child.type === \"collection\"\n );\n\n const oneOf = collections.map(collection => this.convertCollection(collection));\n\n const schema: JsonSchema = { oneOf };\n\n if (collections.length > 0) {\n schema.discriminator = { propertyName: collections[0].collection.discriminator };\n }\n\n return schema;\n }\n\n private convertCollection(collection: CmsModelFieldAstNodeCollection): JsonSchema {\n const { properties, required } = this.convertChildren(collection.children);\n\n properties[collection.collection.discriminator] = {\n const: collection.collection.id\n };\n\n const allRequired = [collection.collection.discriminator, ...required];\n\n const schema: JsonSchema = {\n type: \"object\",\n properties,\n required: allRequired\n };\n\n if (collection.collection.name) {\n schema.description = collection.collection.name;\n }\n\n return schema;\n }\n\n private buildFieldDescription(field: CmsModelField): string | undefined {\n const parts: string[] = [];\n\n if (field.label) {\n parts.push(field.label);\n }\n\n if (field.description) {\n parts.push(field.description);\n }\n\n if (field.help) {\n parts.push(field.help);\n }\n\n if (parts.length === 0) {\n return undefined;\n }\n\n return parts.join(\". \");\n }\n\n private buildModelDescription(\n model: Pick<CmsModel, \"name\" | \"description\">\n ): string | undefined {\n const parts: string[] = [];\n\n if (model.name) {\n parts.push(model.name);\n }\n\n if (model.description) {\n parts.push(model.description);\n }\n\n if (parts.length === 0) {\n return undefined;\n }\n\n return parts.join(\". \");\n }\n\n private extractValidationConstraints(\n validations: CmsModelFieldValidation[] | undefined\n ): ValidationConstraints {\n const constraints: ValidationConstraints = { required: false };\n\n if (!validations) {\n return constraints;\n }\n\n for (const v of validations) {\n switch (v.name) {\n case \"required\":\n constraints.required = true;\n break;\n case \"minLength\":\n if (v.settings?.value !== undefined) {\n constraints.minLength = Number(v.settings.value);\n }\n break;\n case \"maxLength\":\n if (v.settings?.value !== undefined) {\n constraints.maxLength = Number(v.settings.value);\n }\n break;\n case \"gte\":\n if (v.settings?.value !== undefined) {\n constraints.minimum = Number(v.settings.value);\n }\n break;\n case \"lte\":\n if (v.settings?.value !== undefined) {\n constraints.maximum = Number(v.settings.value);\n }\n break;\n case \"pattern\":\n if (v.settings?.preset === \"email\") {\n constraints.format = \"email\";\n } else if (v.settings?.preset === \"url\") {\n constraints.format = \"uri\";\n } else if (v.settings?.value !== undefined) {\n constraints.pattern = String(v.settings.value);\n }\n break;\n }\n }\n\n return constraints;\n }\n\n private applyValidationConstraints(\n schema: JsonSchema,\n validations: CmsModelFieldValidation[]\n ): void {\n const constraints = this.extractValidationConstraints(validations);\n\n if (constraints.minLength !== undefined) {\n schema.minLength = constraints.minLength;\n }\n if (constraints.maxLength !== undefined) {\n schema.maxLength = constraints.maxLength;\n }\n if (constraints.minimum !== undefined) {\n schema.minimum = constraints.minimum;\n }\n if (constraints.maximum !== undefined) {\n schema.maximum = constraints.maximum;\n }\n if (constraints.pattern !== undefined) {\n schema.pattern = constraints.pattern;\n }\n if (constraints.format !== undefined) {\n schema.format = constraints.format;\n }\n }\n\n private applyPredefinedValues(\n schema: JsonSchema,\n field: CmsModelField,\n parseAsNumber = false\n ): void {\n if (field.predefinedValues?.enabled !== true) {\n return;\n }\n\n const values = field.predefinedValues.values;\n if (!Array.isArray(values) || values.length === 0) {\n return;\n }\n\n schema.enum = values.map(v => (parseAsNumber ? Number(v.value) : v.value));\n }\n\n private wrapAsList(schema: JsonSchema, field: CmsModelField): JsonSchema {\n const listSchema: JsonSchema = {\n type: \"array\",\n items: schema\n };\n\n for (const v of field.listValidation || []) {\n if (v.name === \"minLength\" && v.settings?.value !== undefined) {\n listSchema.minLength = Number(v.settings.value);\n }\n if (v.name === \"maxLength\" && v.settings?.value !== undefined) {\n listSchema.maxLength = Number(v.settings.value);\n }\n }\n\n return listSchema;\n }\n\n private isHidden(field: CmsModelField): boolean {\n if (this.options.includeHiddenFields) {\n return false;\n }\n\n return field.renderer?.name === \"hidden\";\n }\n\n private childrenAreCollections(\n node: CmsModelFieldAstNodeField\n ): node is CmsModelFieldAstNodeField & { children: CmsModelFieldAstNodeCollection[] } {\n return node.children.length > 0 && node.children.every(c => c.type === \"collection\");\n }\n}\n"],"names":["CmsModelToJsonSchemaConverter","options","ast","model","properties","required","schema","description","node","field","children","child","constraints","_field","dateType","imagesOnly","models","modelIds","Array","m","modelIdProp","collections","oneOf","collection","allRequired","parts","validations","v","undefined","Number","String","parseAsNumber","values","listSchema","c"],"mappings":"AA0BO,MAAMA;IAGT,YAAYC,OAAqC,CAAE;QAC/C,IAAI,CAAC,OAA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ties?: Record<string, JsonSchema>;
|
|
5
|
+
required?: string[];
|
|
6
|
+
items?: JsonSchema;
|
|
7
|
+
enum?: (string | number | boolean)[];
|
|
8
|
+
oneOf?: JsonSchema[];
|
|
9
|
+
const?: unknown;
|
|
10
|
+
description?: string;
|
|
11
|
+
minLength?: number;
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
minimum?: number;
|
|
14
|
+
maximum?: number;
|
|
15
|
+
pattern?: string;
|
|
16
|
+
format?: string;
|
|
17
|
+
additionalProperties?: boolean | JsonSchema;
|
|
18
|
+
discriminator?: {
|
|
19
|
+
propertyName: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface CmsModelToJsonSchemaOptions {
|
|
23
|
+
includeHiddenFields?: boolean;
|
|
24
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Converter } from "./Converter.js";
|
|
2
2
|
import type { CmsEntryValues, CmsModelField } from "../../types/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CmsModelFieldConverterPlugin } from "../../plugins/index.js";
|
|
4
4
|
import type { CmsModelFieldToGraphQLRegistry } from "../../features/graphql/index.js";
|
|
5
5
|
export interface CmsModelFieldsWithParent extends CmsModelField {
|
|
6
6
|
parent?: CmsModelField | null;
|
|
@@ -13,7 +13,7 @@ export interface ConverterCollectionConvertParams<T extends CmsEntryValues = Cms
|
|
|
13
13
|
values?: T;
|
|
14
14
|
}
|
|
15
15
|
export interface ConverterCollectionParams {
|
|
16
|
-
|
|
16
|
+
fieldConverters: CmsModelFieldConverterPlugin[];
|
|
17
17
|
fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
|
|
18
18
|
}
|
|
19
19
|
export declare class ConverterCollection {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import error from "@webiny/error";
|
|
2
2
|
import { Converter } from "./Converter.js";
|
|
3
|
-
import { CmsModelFieldConverterPlugin } from "../../plugins/index.js";
|
|
4
3
|
import { getBaseFieldType } from "../getBaseFieldType.js";
|
|
5
4
|
class ConverterCollection {
|
|
6
5
|
constructor(params){
|
|
7
6
|
this.converters = new Map();
|
|
8
|
-
const {
|
|
7
|
+
const { fieldConverters: fieldConverterPlugins, fieldRegistry } = params;
|
|
9
8
|
const fieldGraphQLPlugins = fieldRegistry.getAll();
|
|
10
|
-
const fieldConverterPlugins = plugins.byType(CmsModelFieldConverterPlugin.type);
|
|
11
9
|
const defaultFieldConverterPlugin = fieldConverterPlugins.find((pl)=>"*" === pl.getFieldType());
|
|
12
10
|
if (void 0 === defaultFieldConverterPlugin) throw new error("Missing default field converter plugin.", "DEFAULT_FIELD_CONVERTER_ERROR");
|
|
13
11
|
for (const fieldGraphQLPlugin of fieldGraphQLPlugins){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/converters/ConverterCollection.js","sources":["../../../src/utils/converters/ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter.js\";\nimport type { CmsEntryValues, CmsModelField } from \"~/types/index.js\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins/index.js\";\nimport
|
|
1
|
+
{"version":3,"file":"utils/converters/ConverterCollection.js","sources":["../../../src/utils/converters/ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter.js\";\nimport type { CmsEntryValues, CmsModelField } from \"~/types/index.js\";\nimport type { CmsModelFieldConverterPlugin } from \"~/plugins/index.js\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"~/features/graphql/index.js\";\n\nexport interface CmsModelFieldsWithParent extends CmsModelField {\n parent?: CmsModelField | null;\n}\n\nexport interface CmsModelConverterCallable<T extends CmsEntryValues = CmsEntryValues> {\n (params: ConverterCollectionConvertParams<T>): T;\n}\n\nexport interface ConverterCollectionConvertParams<T extends CmsEntryValues = CmsEntryValues> {\n fields: CmsModelFieldsWithParent[];\n values?: T;\n}\n\nexport interface ConverterCollectionParams {\n fieldConverters: CmsModelFieldConverterPlugin[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport class ConverterCollection {\n private readonly converters: Map<string, Converter> = new Map();\n\n public constructor(params: ConverterCollectionParams) {\n const { fieldConverters: fieldConverterPlugins, fieldRegistry } = params;\n const fieldGraphQLPlugins = fieldRegistry.getAll();\n const defaultFieldConverterPlugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === \"*\"\n );\n if (defaultFieldConverterPlugin === undefined) {\n throw new WebinyError(\n `Missing default field converter plugin.`,\n \"DEFAULT_FIELD_CONVERTER_ERROR\"\n );\n }\n for (const fieldGraphQLPlugin of fieldGraphQLPlugins) {\n const plugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === fieldGraphQLPlugin.fieldType\n );\n const converter = new Converter({\n type: fieldGraphQLPlugin.fieldType,\n plugin: plugin || defaultFieldConverterPlugin\n });\n\n this.addConverter(converter);\n }\n }\n\n public addConverter(converter: Converter): void {\n converter.setConverterCollection(this);\n this.converters.set(converter.getType(), converter);\n }\n\n public getConverter(type: string): Converter {\n const baseType = getBaseFieldType({ type });\n const converter = this.converters.get(baseType);\n if (converter === undefined) {\n throw new WebinyError(\n `Missing converter for field type \"${type}\".`,\n \"CONVERTER_ERROR\",\n {\n type\n }\n );\n }\n return converter;\n }\n\n public convertToStorage<T extends CmsEntryValues = CmsEntryValues>(\n params: ConverterCollectionConvertParams<T>\n ): T | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n this.attachHasOwnProperty<T>(inputValues);\n\n return fields.reduce<T>((output, field) => {\n const converter = this.getConverter(field.type);\n if (inputValues === null || inputValues.hasOwnProperty(field.fieldId) === false) {\n return output;\n }\n const values = converter.convertToStorage({\n field,\n value: inputValues[field.fieldId as keyof T]\n });\n\n return {\n ...output,\n ...values\n };\n }, {} as T);\n }\n\n public convertFromStorage<T extends CmsEntryValues = CmsEntryValues>(\n params: ConverterCollectionConvertParams<T>\n ): T | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n return fields.reduce<T>((output, field) => {\n const converter = this.getConverter(field.type);\n if (inputValues === null || inputValues.hasOwnProperty(field.storageId) === false) {\n return output;\n }\n const values = converter.convertFromStorage({\n field,\n value: inputValues[field.storageId as keyof T]\n });\n\n return {\n ...output,\n ...values\n };\n }, {} as T);\n }\n\n /**\n * This method attaches hasOwnProperty when received object was created via Object.create(null) - no inheritance of Object.\n * At that point, hasOwnProperty does not exist, and we need to add it.\n *\n * TODO add more checks if required\n */\n private attachHasOwnProperty<T extends CmsEntryValues = CmsEntryValues>(values: T) {\n if (\n // null or undefined?\n values === null ||\n values === undefined ||\n // not an object?\n typeof values !== \"object\" ||\n // maybe it's an array?\n Array.isArray(values) ||\n // and in the end, check if hasOwnProperty is a function already\n typeof values?.hasOwnProperty === \"function\"\n ) {\n return;\n }\n Object.defineProperty(values, \"hasOwnProperty\", {\n enumerable: false,\n writable: false,\n value: function (property: string) {\n return this[property] !== undefined;\n }\n });\n }\n}\n"],"names":["ConverterCollection","params","Map","fieldConverterPlugins","fieldRegistry","fieldGraphQLPlugins","defaultFieldConverterPlugin","pl","undefined","WebinyError","fieldGraphQLPlugin","plugin","converter","Converter","type","baseType","getBaseFieldType","fields","inputValues","output","field","values","Array","Object","property"],"mappings":";;;AAyBO,MAAMA;IAGT,YAAmBC,MAAiC,CAAE;aAFrC,UAAU,GAA2B,IAAIC;QAGtD,MAAM,EAAE,iBAAiBC,qBAAqB,EAAEC,aAAa,EAAE,GAAGH;QAClE,MAAMI,sBAAsBD,cAAc,MAAM;QAChD,MAAME,8BAA8BH,sBAAsB,IAAI,CAC1DI,CAAAA,KAAMA,AAAsB,QAAtBA,GAAG,YAAY;QAEzB,IAAID,AAAgCE,WAAhCF,6BACA,MAAM,IAAIG,MACN,2CACA;QAGR,KAAK,MAAMC,sBAAsBL,oBAAqB;YAClD,MA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AIiB,AAAgBV,WAAhBU,aACA;QAGJ,OAAOD,OAAO,MAAM,CAAI,CAACE,QAAQC;YAC7B,MAAMR,YAAY,IAAI,CAAC,YAAY,CAACQ,MAAM,IAAI;YAC9C,IAAIF,AAAgB,SAAhBA,eAAwBA,AAAgD,UAAhDA,YAAY,cAAc,CAACE,MAAM,SAAS,GAClE,OAAOD;YAEX,MAAME,SAAST,UAAU,kBAAkB,CAAC;gBACxCQ;gBACA,OAAOF,WAAW,CAACE,MAAM,SAAS,CAAY;YAClD;YAEA,OAAO;gBACH,GAAGD,MAAM;gBACT,GAAGE,MAAM;YACb;QACJ,GAAG,CAAC;IACR;IAQQ,qBAAgEA,MAAS,EAAE;QAC/E,IAEIA,QAAAA,UAGA,AAAkB,YAAlB,OAAOA,UAEPC,MAAM,OAAO,CAACD,WAEd,AAAkC,cAAlC,OAAOA,QAAQ,gBAEf;QAEJE,OAAO,cAAc,CAACF,QAAQ,kBAAkB;YAC5C,YAAY;YACZ,UAAU;YACV,OAAO,SAAUG,QAAgB;gBAC7B,OAAO,AAAmBhB,WAAnB,IAAI,CAACgB,SAAS;YACzB;QACJ;IACJ;AACJ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
1
|
import type { CmsModelConverterCallable } from "./ConverterCollection.js";
|
|
3
2
|
import type { CmsEntryValues, CmsModel } from "../../types/index.js";
|
|
4
3
|
import type { CmsModelFieldToGraphQLRegistry } from "../../features/graphql/index.js";
|
|
4
|
+
import type { CmsModelFieldConverterPlugin } from "../../plugins/index.js";
|
|
5
5
|
interface Params {
|
|
6
6
|
model: Pick<CmsModel, "fields">;
|
|
7
|
-
|
|
7
|
+
fieldConverters: CmsModelFieldConverterPlugin[];
|
|
8
8
|
fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
|
|
9
9
|
}
|
|
10
10
|
export declare const createValueKeyFromStorageConverter: <T extends CmsEntryValues = CmsEntryValues>(params: Params) => CmsModelConverterCallable<T>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConverterCollection } from "./ConverterCollection.js";
|
|
2
2
|
const createValueKeyFromStorageConverter = (params)=>{
|
|
3
|
-
const {
|
|
3
|
+
const { fieldConverters, model, fieldRegistry } = params;
|
|
4
4
|
const converters = new ConverterCollection({
|
|
5
|
-
|
|
5
|
+
fieldConverters,
|
|
6
6
|
fieldRegistry
|
|
7
7
|
});
|
|
8
8
|
return ({ fields, values })=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/converters/valueKeyFromStorageConverter.js","sources":["../../../src/utils/converters/valueKeyFromStorageConverter.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"utils/converters/valueKeyFromStorageConverter.js","sources":["../../../src/utils/converters/valueKeyFromStorageConverter.ts"],"sourcesContent":["import type { CmsModelConverterCallable } from \"./ConverterCollection.js\";\nimport { ConverterCollection } from \"./ConverterCollection.js\";\nimport type { CmsEntryValues, CmsModel } from \"~/types/index.js\";\nimport type { ConverterCollectionConvertParams } from \"./types.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"~/features/graphql/index.js\";\nimport type { CmsModelFieldConverterPlugin } from \"~/plugins/index.js\";\n\ninterface Params {\n model: Pick<CmsModel, \"fields\">;\n fieldConverters: CmsModelFieldConverterPlugin[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport const createValueKeyFromStorageConverter = <T extends CmsEntryValues = CmsEntryValues>(\n params: Params\n): CmsModelConverterCallable<T> => {\n const { fieldConverters, model, fieldRegistry } = params;\n\n const converters = new ConverterCollection({\n fieldConverters,\n fieldRegistry\n });\n\n return <T extends CmsEntryValues = CmsEntryValues>({\n fields,\n values\n }: ConverterCollectionConvertParams<T>) => {\n const result = converters.convertFromStorage<T>({\n fields: fields || model.fields,\n values\n });\n return result || ({} as T);\n };\n};\n"],"names":["createValueKeyFromStorageConverter","params","fieldConverters","model","fieldRegistry","converters","ConverterCollection","fields","values","result"],"mappings":";AAaO,MAAMA,qCAAqC,CAC9CC;IAEA,MAAM,EAAEC,eAAe,EAAEC,KAAK,EAAEC,aAAa,EAAE,GAAGH;IAElD,MAAMI,aAAa,IAAIC,oBAAoB;QACvCJ;QACAE;IACJ;IAEA,OAAO,CAA4C,EAC/CG,MAAM,EACNC,MAAM,EAC4B;QAClC,MAAMC,SAASJ,WAAW,kBAAkB,CAAI;YAC5C,QAAQE,UAAUJ,MAAM,MAAM;YAC9BK;QACJ;QACA,OAAOC,UAAW,CAAC;IACvB;AACJ"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { createValueKeyToStorageConverter } from "./valueKeyToStorageConverter.js";
|
|
2
2
|
import { createValueKeyFromStorageConverter } from "./valueKeyFromStorageConverter.js";
|
|
3
3
|
import { CmsModelFieldToGraphQLRegistry } from "../../features/graphql/index.js";
|
|
4
|
+
import { CmsFieldConverter } from "../../fieldConverters/abstractions.js";
|
|
4
5
|
const createCmsModelFieldConvertersAttachFactory = (context)=>(model)=>{
|
|
5
6
|
const storageModel = model;
|
|
6
7
|
if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) return storageModel;
|
|
7
8
|
const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);
|
|
9
|
+
const fieldConverters = context.container.resolveAll(CmsFieldConverter);
|
|
8
10
|
return {
|
|
9
11
|
...model,
|
|
10
12
|
convertValueKeyToStorage: createValueKeyToStorageConverter({
|
|
11
13
|
model,
|
|
12
|
-
|
|
14
|
+
fieldConverters,
|
|
13
15
|
fieldRegistry
|
|
14
16
|
}),
|
|
15
17
|
convertValueKeyFromStorage: createValueKeyFromStorageConverter({
|
|
16
18
|
model,
|
|
17
|
-
|
|
19
|
+
fieldConverters,
|
|
18
20
|
fieldRegistry
|
|
19
21
|
})
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/converters/valueKeyStorageConverter.js","sources":["../../../src/utils/converters/valueKeyStorageConverter.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n StorageOperationsCmsModel\n} from \"~/types/index.js\";\nimport { createValueKeyToStorageConverter } from \"./valueKeyToStorageConverter.js\";\nimport { createValueKeyFromStorageConverter } from \"./valueKeyFromStorageConverter.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"~/features/graphql/index.js\";\n\nexport const createCmsModelFieldConvertersAttachFactory = (context: CmsContext) => {\n return <T extends CmsEntryValues = CmsEntryValues>(\n model: StorageOperationsCmsModel | CmsModel\n ): StorageOperationsCmsModel<T> => {\n const storageModel = model as Partial<StorageOperationsCmsModel<T>>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel<T>;\n }\n\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter<T>({\n model,\n
|
|
1
|
+
{"version":3,"file":"utils/converters/valueKeyStorageConverter.js","sources":["../../../src/utils/converters/valueKeyStorageConverter.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n StorageOperationsCmsModel\n} from \"~/types/index.js\";\nimport { createValueKeyToStorageConverter } from \"./valueKeyToStorageConverter.js\";\nimport { createValueKeyFromStorageConverter } from \"./valueKeyFromStorageConverter.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"~/features/graphql/index.js\";\nimport { CmsFieldConverter } from \"~/fieldConverters/abstractions.js\";\n\nexport const createCmsModelFieldConvertersAttachFactory = (context: CmsContext) => {\n return <T extends CmsEntryValues = CmsEntryValues>(\n model: StorageOperationsCmsModel | CmsModel\n ): StorageOperationsCmsModel<T> => {\n const storageModel = model as Partial<StorageOperationsCmsModel<T>>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel<T>;\n }\n\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n const fieldConverters = context.container.resolveAll(CmsFieldConverter);\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter<T>({\n model,\n fieldConverters,\n fieldRegistry\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter<T>({\n model,\n fieldConverters,\n fieldRegistry\n })\n };\n };\n};\n"],"names":["createCmsModelFieldConvertersAttachFactory","context","model","storageModel","fieldRegistry","CmsModelFieldToGraphQLRegistry","fieldConverters","CmsFieldConverter","createValueKeyToStorageConverter","createValueKeyFromStorageConverter"],"mappings":";;;;AAWO,MAAMA,6CAA6C,CAACC,UAChD,CACHC;QAEA,MAAMC,eAAeD;QACrB,IAAI,CAAC,CAACC,aAAa,wBAAwB,IAAI,CAAC,CAACA,aAAa,0BAA0B,EACpF,OAAOA;QAGX,MAAMC,gBAAgBH,QAAQ,SAAS,CAAC,OAAO,CAACI;QAChD,MAAMC,kBAAkBL,QAAQ,SAAS,CAAC,UAAU,CAACM;QACrD,OAAO;YACH,GAAGL,KAAK;YACR,0BAA0BM,iCAAoC;gBAC1DN;gBACAI;gBACAF;YACJ;YACA,4BAA4BK,mCAAsC;gBAC9DP;gBACAI;gBACAF;YACJ;QACJ;IACJ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
1
|
import type { CmsModelConverterCallable } from "./ConverterCollection.js";
|
|
3
2
|
import type { CmsEntryValues, CmsModel } from "../../types/index.js";
|
|
4
3
|
import type { CmsModelFieldToGraphQLRegistry } from "../../features/graphql/index.js";
|
|
4
|
+
import type { CmsModelFieldConverterPlugin } from "../../plugins/index.js";
|
|
5
5
|
interface Params {
|
|
6
6
|
model: Pick<CmsModel, "fields">;
|
|
7
|
-
|
|
7
|
+
fieldConverters: CmsModelFieldConverterPlugin[];
|
|
8
8
|
fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
|
|
9
9
|
}
|
|
10
10
|
export declare const createValueKeyToStorageConverter: <T extends CmsEntryValues = CmsEntryValues>(params: Params) => CmsModelConverterCallable<T>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConverterCollection } from "./ConverterCollection.js";
|
|
2
2
|
const createValueKeyToStorageConverter = (params)=>{
|
|
3
|
-
const {
|
|
3
|
+
const { fieldConverters, model, fieldRegistry } = params;
|
|
4
4
|
const converters = new ConverterCollection({
|
|
5
|
-
|
|
5
|
+
fieldConverters,
|
|
6
6
|
fieldRegistry
|
|
7
7
|
});
|
|
8
8
|
return ({ fields, values })=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/converters/valueKeyToStorageConverter.js","sources":["../../../src/utils/converters/valueKeyToStorageConverter.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"utils/converters/valueKeyToStorageConverter.js","sources":["../../../src/utils/converters/valueKeyToStorageConverter.ts"],"sourcesContent":["import type { CmsModelConverterCallable } from \"./ConverterCollection.js\";\nimport { ConverterCollection } from \"./ConverterCollection.js\";\nimport type { CmsEntryValues, CmsModel } from \"~/types/index.js\";\nimport type { ConverterCollectionConvertParams } from \"./types.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"~/features/graphql/index.js\";\nimport type { CmsModelFieldConverterPlugin } from \"~/plugins/index.js\";\n\ninterface Params {\n model: Pick<CmsModel, \"fields\">;\n fieldConverters: CmsModelFieldConverterPlugin[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nexport const createValueKeyToStorageConverter = <T extends CmsEntryValues = CmsEntryValues>(\n params: Params\n): CmsModelConverterCallable<T> => {\n const { fieldConverters, model, fieldRegistry } = params;\n\n const converters = new ConverterCollection({\n fieldConverters,\n fieldRegistry\n });\n\n return <T extends CmsEntryValues = CmsEntryValues>({\n fields,\n values\n }: ConverterCollectionConvertParams<T>) => {\n const result = converters.convertToStorage<T>({\n fields: fields || model.fields,\n values\n });\n return result || ({} as T);\n };\n};\n"],"names":["createValueKeyToStorageConverter","params","fieldConverters","model","fieldRegistry","converters","ConverterCollection","fields","values","result"],"mappings":";AAaO,MAAMA,mCAAmC,CAC5CC;IAEA,MAAM,EAAEC,eAAe,EAAEC,KAAK,EAAEC,aAAa,EAAE,GAAGH;IAElD,MAAMI,aAAa,IAAIC,oBAAoB;QACvCJ;QACAE;IACJ;IAEA,OAAO,CAA4C,EAC/CG,MAAM,EACNC,MAAM,EAC4B;QAClC,MAAMC,SAASJ,WAAW,gBAAgB,CAAI;YAC1C,QAAQE,UAAUJ,MAAM,MAAM;YAC9BK;QACJ;QACA,OAAOC,UAAW,CAAC;IACvB;AACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiEndpoint, CmsContext, CmsModel } from "../types/index.js";
|
|
2
2
|
import type { ICmsGraphQLSchemaPlugin } from "../plugins/index.js";
|
|
3
|
-
import type { IGraphQLSchemaPlugin } from "@webiny/
|
|
4
|
-
import type { GraphQLSchemaDefinition } from "@webiny/
|
|
3
|
+
import type { IGraphQLSchemaPlugin } from "@webiny/api-graphql";
|
|
4
|
+
import type { GraphQLSchemaDefinition } from "@webiny/api-graphql/types.js";
|
|
5
5
|
import type { CmsModelFieldToGraphQLRegistry } from "../features/graphql/index.js";
|
|
6
6
|
interface CreatePluginCallableParams {
|
|
7
7
|
schema: GraphQLSchemaDefinition<CmsContext>;
|