@webiny/api-headless-cms 6.6.0-alpha.1 → 6.6.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HeadlessCmsFeature.js +13 -37
- package/HeadlessCmsFeature.js.map +1 -1
- package/createCmsRoute.d.ts +3 -5
- package/createCmsRoute.js +26 -14
- package/createCmsRoute.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.js +17 -11
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentModel/validate/endingAllowed.js +1 -1
- package/crud/contentModel/validate/endingAllowed.js.map +1 -1
- package/crud/contentModel/validate/pluralApiName.js +1 -1
- package/crud/contentModel/validate/pluralApiName.js.map +1 -1
- package/crud/contentModel/validate/singularApiName.js +1 -1
- package/crud/contentModel/validate/singularApiName.js.map +1 -1
- package/crud/contentModel/validation.js +2 -2
- package/crud/contentModel/validation.js.map +1 -1
- package/domain/contentModel/schemas.d.ts +2 -0
- package/domain/contentModel/schemas.js +1 -0
- package/domain/contentModel/schemas.js.map +1 -1
- package/domain/contentModel/validation/dateExpressions.d.ts +6 -0
- package/domain/contentModel/validation/dateExpressions.js +27 -0
- package/domain/contentModel/validation/dateExpressions.js.map +1 -0
- package/domain/contentModel/validation/endingAllowed.js +1 -1
- package/domain/contentModel/validation/endingAllowed.js.map +1 -1
- package/domain/contentModel/validation/modelFields.js +4 -2
- package/domain/contentModel/validation/modelFields.js.map +1 -1
- package/domain/contentModel/validation/pluralApiName.js +1 -1
- package/domain/contentModel/validation/pluralApiName.js.map +1 -1
- package/domain/contentModel/validation/singularApiName.js +1 -1
- package/domain/contentModel/validation/singularApiName.js.map +1 -1
- package/export/crud/exporting.js +2 -2
- package/export/crud/exporting.js.map +1 -1
- package/export/crud/imports/importGroups.js +1 -2
- package/export/crud/imports/importGroups.js.map +1 -1
- package/export/crud/imports/validateModels.js +1 -1
- package/export/crud/imports/validateModels.js.map +1 -1
- package/exports/api/cms/entry.d.ts +5 -0
- package/exports/api/cms/entry.js +5 -0
- package/features/ai/DescribeContentModelTool.d.ts +11 -6
- package/features/ai/DescribeContentModelTool.js +21 -12
- package/features/ai/DescribeContentModelTool.js.map +1 -1
- package/features/ai/ListContentModelsTool.d.ts +11 -6
- package/features/ai/ListContentModelsTool.js +21 -12
- package/features/ai/ListContentModelsTool.js.map +1 -1
- package/features/ai/QueryEntriesTool.d.ts +14 -9
- package/features/ai/QueryEntriesTool.js +20 -11
- package/features/ai/QueryEntriesTool.js.map +1 -1
- package/features/ai/feature.d.ts +2 -2
- package/features/ai/feature.js.map +1 -1
- package/features/contentEntry/ContentEntriesFeature.js +8 -0
- package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +4 -2
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js +8 -3
- package/features/contentEntry/CreateEntry/CreateEntryRepository.js.map +1 -1
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +2 -2
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +3 -4
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.d.ts +4 -2
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +8 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +2 -4
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +6 -14
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
- package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.d.ts +4 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +8 -3
- package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +2 -2
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.d.ts +3 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +7 -3
- package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js +2 -2
- package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.d.ts +3 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +9 -3
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +2 -2
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.d.ts +4 -2
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +7 -3
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +2 -2
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +11 -10
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.d.ts +17 -0
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js +83 -0
- package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/abstractions.d.ts +47 -0
- package/features/contentEntry/DuplicateEntry/abstractions.js +5 -0
- package/features/contentEntry/DuplicateEntry/abstractions.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/events.d.ts +41 -0
- package/features/contentEntry/DuplicateEntry/events.js +32 -0
- package/features/contentEntry/DuplicateEntry/events.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/feature.d.ts +4 -0
- package/features/contentEntry/DuplicateEntry/feature.js +11 -0
- package/features/contentEntry/DuplicateEntry/feature.js.map +1 -0
- package/features/contentEntry/DuplicateEntry/index.d.ts +2 -0
- package/features/contentEntry/DuplicateEntry/index.js +2 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.d.ts +7 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js +12 -0
- package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.d.ts +10 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js +25 -0
- package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.d.ts +16 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.js +5 -0
- package/features/contentEntry/EntryEventPublisher/abstractions.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/feature.d.ts +4 -0
- package/features/contentEntry/EntryEventPublisher/feature.js +11 -0
- package/features/contentEntry/EntryEventPublisher/feature.js.map +1 -0
- package/features/contentEntry/EntryEventPublisher/index.d.ts +2 -0
- package/features/contentEntry/EntryEventPublisher/index.js +2 -0
- package/features/contentEntry/EntrySystemField/abstractions.d.ts +14 -0
- package/features/contentEntry/EntrySystemField/abstractions.js +5 -0
- package/features/contentEntry/EntrySystemField/abstractions.js.map +1 -0
- package/features/contentEntry/EntrySystemField/index.d.ts +1 -0
- package/features/contentEntry/EntrySystemField/index.js +1 -0
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.d.ts +4 -4
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +8 -11
- package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.d.ts +4 -2
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +7 -3
- package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.d.ts +4 -2
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +7 -3
- package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js.map +1 -1
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.d.ts +4 -2
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +7 -3
- package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js.map +1 -1
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.d.ts +4 -2
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +7 -3
- package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.d.ts +4 -2
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +7 -3
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +3 -0
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListEntriesRepository.d.ts +4 -2
- package/features/contentEntry/ListEntries/ListEntriesRepository.js +7 -3
- package/features/contentEntry/ListEntries/ListEntriesRepository.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryRepository.d.ts +4 -2
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js +7 -3
- package/features/contentEntry/MoveEntry/MoveEntryRepository.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +2 -2
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +11 -4
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js +8 -3
- package/features/contentEntry/PublishEntry/PublishEntryRepository.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +4 -6
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +11 -13
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/abstractions.d.ts +8 -1
- package/features/contentEntry/PublishEntry/abstractions.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +8 -3
- package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +5 -3
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.d.ts +4 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +8 -3
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js.map +1 -1
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.d.ts +2 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js +2 -2
- package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.d.ts +4 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +8 -3
- package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +5 -3
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.d.ts +4 -2
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +8 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +2 -2
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +5 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.d.ts +19 -0
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js +70 -0
- package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.d.ts +24 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.js +5 -0
- package/features/contentEntry/UpdateEntrySystem/abstractions.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/events.d.ts +29 -0
- package/features/contentEntry/UpdateEntrySystem/events.js +23 -0
- package/features/contentEntry/UpdateEntrySystem/events.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/feature.d.ts +4 -0
- package/features/contentEntry/UpdateEntrySystem/feature.js +11 -0
- package/features/contentEntry/UpdateEntrySystem/feature.js.map +1 -0
- package/features/contentEntry/UpdateEntrySystem/index.d.ts +2 -0
- package/features/contentEntry/UpdateEntrySystem/index.js +2 -0
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -2
- package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
- package/features/contentEntry/ensureItemIds.d.ts +13 -0
- package/features/contentEntry/ensureItemIds.js +22 -0
- package/features/contentEntry/ensureItemIds.js.map +1 -0
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +8 -2
- package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +7 -3
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +46 -13
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
- package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +22 -15
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +5 -3
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +17 -12
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
- package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +6 -6
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +17 -17
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
- package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +7 -3
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +72 -28
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
- package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
- package/features/contentEntry/entryDataFactories/expiresAt.js +2 -2
- package/features/contentEntry/entryDataFactories/expiresAt.js.map +1 -1
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
- package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
- package/features/contentModel/CreateModel/CreateModelRepository.js +1 -2
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +1 -2
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +4 -2
- package/features/contentModel/DeleteModel/DeleteModelRepository.js +7 -3
- package/features/contentModel/DeleteModel/DeleteModelRepository.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.d.ts +9 -4
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js +36 -21
- package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js.map +1 -1
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.d.ts +1 -1
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js.map +1 -1
- package/features/contentModel/ModelToAstConverter/abstractions.d.ts +1 -1
- package/features/contentModel/ModelToAstConverter/abstractions.js.map +1 -1
- package/features/contentModel/UpdateModel/UpdateModelRepository.d.ts +4 -2
- package/features/contentModel/UpdateModel/UpdateModelRepository.js +8 -4
- package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js +2 -2
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
- package/features/contentModel/UpdateModel/abstractions.d.ts +1 -1
- package/features/contentModel/UpdateModel/abstractions.js.map +1 -1
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +4 -3
- package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -1
- package/features/contentModel/shared/ModelsFetcher.d.ts +6 -5
- package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
- package/features/contentModel/shared/PluginModelsProvider.d.ts +6 -3
- package/features/contentModel/shared/PluginModelsProvider.js +2 -9
- package/features/contentModel/shared/PluginModelsProvider.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +4 -2
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +7 -3
- package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.d.ts +4 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +8 -4
- package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +2 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/abstractions.d.ts +1 -1
- package/features/contentModelGroup/UpdateGroup/abstractions.js.map +1 -1
- package/features/graphql/fields/base/AssetToGraphQL.js +7 -2
- package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js +7 -1
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/ObjectToGraphQL.js +6 -3
- package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
- package/features/graphql/fields/base/RefToGraphQL.js +24 -10
- package/features/graphql/fields/base/RefToGraphQL.js.map +1 -1
- package/features/modelBuilder/abstractions.d.ts +5 -2
- package/features/modelBuilder/abstractions.js.map +1 -1
- package/features/modelBuilder/feature.js +1 -8
- package/features/modelBuilder/feature.js.map +1 -1
- package/features/modelBuilder/fields/DataFieldBuilder.d.ts +17 -0
- package/features/modelBuilder/fields/DataFieldBuilder.js +6 -0
- package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
- package/features/modelBuilder/fields/DateTimeFieldType.js +27 -12
- package/features/modelBuilder/fields/DateTimeFieldType.js.map +1 -1
- package/features/modelBuilder/fields/fieldTypeValidator.d.ts +5 -3
- package/features/modelBuilder/models/ModelBuilder.d.ts +8 -0
- package/features/modelBuilder/models/ModelBuilder.js +1 -0
- package/features/modelBuilder/models/ModelBuilder.js.map +1 -1
- package/features/modelBuilder/models/ModelsProvider.d.ts +1 -3
- package/features/modelBuilder/models/ModelsProvider.js +2 -7
- package/features/modelBuilder/models/ModelsProvider.js.map +1 -1
- package/features/modelBuilder/models/PrivateModelBuilder.d.ts +5 -0
- package/features/modelBuilder/models/PrivateModelBuilder.js +12 -1
- package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
- package/features/modelStorageSync/ModelStorageSyncTask.d.ts +31 -0
- package/features/modelStorageSync/ModelStorageSyncTask.js +66 -0
- package/features/modelStorageSync/ModelStorageSyncTask.js.map +1 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.d.ts +23 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.js +55 -0
- package/features/modelStorageSync/SyncStorageOnModelUpdate.js.map +1 -0
- package/features/modelStorageSync/abstractions.d.ts +34 -0
- package/features/modelStorageSync/abstractions.js +6 -0
- package/features/modelStorageSync/abstractions.js.map +1 -0
- package/features/modelStorageSync/feature.d.ts +8 -0
- package/features/modelStorageSync/feature.js +13 -0
- package/features/modelStorageSync/feature.js.map +1 -0
- package/features/modelStorageSync/index.d.ts +2 -0
- package/features/modelStorageSync/index.js +2 -0
- package/features/runtimeTenant/RuntimeTenant.d.ts +13 -0
- package/features/runtimeTenant/RuntimeTenant.js +22 -0
- package/features/runtimeTenant/RuntimeTenant.js.map +1 -0
- package/features/runtimeTenant/abstractions.d.ts +11 -0
- package/features/runtimeTenant/abstractions.js +5 -0
- package/features/runtimeTenant/abstractions.js.map +1 -0
- package/features/runtimeTenant/index.d.ts +2 -0
- package/features/runtimeTenant/index.js +2 -0
- package/features/shared/abstractions.d.ts +1 -5
- package/features/shared/abstractions.js +1 -2
- package/features/shared/abstractions.js.map +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js +1 -1
- package/features/storage/fields/CompressedTextStorageTransform.js.map +1 -1
- package/features/storage/fields/DateStorageTransform.js +3 -4
- package/features/storage/fields/DateStorageTransform.js.map +1 -1
- package/features/storage/fields/DynamicZoneStorageTransform.js +2 -2
- package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -1
- package/features/storage/fields/JsonStorageTransform.js +1 -1
- package/features/storage/fields/JsonStorageTransform.js.map +1 -1
- package/features/storage/fields/LongTextStorageTransform.js +1 -1
- package/features/storage/fields/LongTextStorageTransform.js.map +1 -1
- package/features/storage/fields/ObjectStorageTransform.js +27 -7
- package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
- package/features/storage/fields/RichTextStorageTransform.js +1 -1
- package/features/storage/fields/RichTextStorageTransform.js.map +1 -1
- package/features/validation/abstractions/CmsModelFieldValidator.d.ts +5 -0
- package/features/validation/abstractions/CmsModelFieldValidator.js.map +1 -1
- package/features/validation/validators/DateGteValidator.d.ts +2 -0
- package/features/validation/validators/DateGteValidator.js +12 -2
- package/features/validation/validators/DateGteValidator.js.map +1 -1
- package/features/validation/validators/DateLteValidator.d.ts +2 -0
- package/features/validation/validators/DateLteValidator.js +12 -2
- package/features/validation/validators/DateLteValidator.js.map +1 -1
- package/features/validation/validators/PatternValidator.js +1 -1
- package/features/validation/validators/PatternValidator.js.map +1 -1
- package/features/validation/validators/dateLimit.d.ts +9 -0
- package/features/validation/validators/dateLimit.js +18 -0
- package/features/validation/validators/dateLimit.js.map +1 -0
- package/features/whereMapper/WhereMapper.js +3 -5
- package/features/whereMapper/WhereMapper.js.map +1 -1
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +15 -5
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
- package/graphql/checkEndpointAccess.d.ts +7 -2
- package/graphql/checkEndpointAccess.js +2 -4
- package/graphql/checkEndpointAccess.js.map +1 -1
- package/graphql/getSchema/generateCacheKey.js +1 -1
- package/graphql/getSchema/generateCacheKey.js.map +1 -1
- package/graphql/scalars/RevisionId.js +1 -1
- package/graphql/scalars/RevisionId.js.map +1 -1
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.d.ts +1 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js +4 -0
- package/graphql/schema/cms/CmsBaseErrorTypeFactory.js.map +1 -1
- package/graphql/schema/cms/resolvers/createEntry.d.ts +1 -0
- package/graphql/schema/cms/resolvers/createEntry.js +4 -0
- package/graphql/schema/cms/resolvers/createEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/getEntry.d.ts +1 -0
- package/graphql/schema/cms/resolvers/getEntry.js +4 -0
- package/graphql/schema/cms/resolvers/getEntry.js.map +1 -1
- package/graphql/schema/cms/resolvers/getModel.d.ts +1 -0
- package/graphql/schema/cms/resolvers/getModel.js +4 -0
- package/graphql/schema/cms/resolvers/getModel.js.map +1 -1
- package/graphql/schema/cms/resolvers/listEntries.d.ts +1 -0
- package/graphql/schema/cms/resolvers/listEntries.js +4 -0
- package/graphql/schema/cms/resolvers/listEntries.js.map +1 -1
- package/graphql/schema/cms/resolvers/mutationCms.d.ts +1 -0
- package/graphql/schema/cms/resolvers/mutationCms.js +4 -0
- package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/publishEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/queryCms.d.ts +1 -0
- package/graphql/schema/cms/resolvers/queryCms.js +4 -0
- package/graphql/schema/cms/resolvers/queryCms.js.map +1 -1
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -1
- package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +1 -0
- package/graphql/schema/cms/resolvers/updateEntryRevision.js +4 -0
- package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -1
- package/graphql/schema/cms/typeDefs/mutation.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/mutation.js +4 -0
- package/graphql/schema/cms/typeDefs/mutation.js.map +1 -1
- package/graphql/schema/cms/typeDefs/query.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/query.js +4 -0
- package/graphql/schema/cms/typeDefs/query.js.map +1 -1
- package/graphql/schema/cms/typeDefs/responses.d.ts +1 -0
- package/graphql/schema/cms/typeDefs/responses.js +4 -0
- package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
- package/graphql/schema/contentEntries.js +19 -4
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/contentModels.js +2 -0
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphql/schema/createFieldResolvers.js +1 -1
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageResolvers.js +3 -1
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +2 -0
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveDuplicate.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDuplicate.js +11 -0
- package/graphql/schema/resolvers/manage/resolveDuplicate.js.map +1 -0
- package/package.json +24 -24
- package/plugins/CmsModelPlugin.js +9 -10
- package/plugins/CmsModelPlugin.js.map +1 -1
- package/types/index.d.ts +0 -1
- package/types/modelField.d.ts +11 -0
- package/types/types.d.ts +14 -109
- package/types/types.js.map +1 -1
- package/utils/caching/Cache.js +1 -1
- package/utils/caching/Cache.js.map +1 -1
- package/utils/createModelField.js +2 -1
- package/utils/createModelField.js.map +1 -1
- package/utils/createModelSchemaKey.d.ts +8 -0
- package/utils/createModelSchemaKey.js +18 -0
- package/utils/createModelSchemaKey.js.map +1 -0
- package/utils/date.js +1 -1
- package/utils/date.js.map +1 -1
- package/utils/entryStorage.js +1 -1
- package/utils/entryStorage.js.map +1 -1
- package/utils/renderFields.js +1 -1
- package/utils/renderFields.js.map +1 -1
- package/HeadlessCmsContextualSchema.d.ts +0 -16
- package/HeadlessCmsContextualSchema.js +0 -32
- package/HeadlessCmsContextualSchema.js.map +0 -1
- package/crud/contentEntry.crud.d.ts +0 -6
- package/crud/contentEntry.crud.js +0 -336
- package/crud/contentEntry.crud.js.map +0 -1
- package/crud/contentModel.crud.d.ts +0 -5
- package/crud/contentModel.crud.js +0 -79
- package/crud/contentModel.crud.js.map +0 -1
- package/crud/contentModelGroup.crud.d.ts +0 -5
- package/crud/contentModelGroup.crud.js +0 -76
- package/crud/contentModelGroup.crud.js.map +0 -1
- package/types/context.d.ts +0 -110
- package/types/context.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CmsEntryResolverFactory as ResolverFactory } from "../../../../types/index.js";
|
|
2
|
+
interface ResolveDuplicateArgs {
|
|
3
|
+
revision: string;
|
|
4
|
+
}
|
|
5
|
+
type ResolveDuplicate = ResolverFactory<any, ResolveDuplicateArgs>;
|
|
6
|
+
export declare const resolveDuplicate: ResolveDuplicate;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ErrorResponse, Response } from "@webiny/api-graphql/responses.js";
|
|
2
|
+
import { DuplicateEntryUseCase } from "../../../../features/contentEntry/DuplicateEntry/index.js";
|
|
3
|
+
const resolveDuplicate = ({ model })=>async (_, args, context)=>{
|
|
4
|
+
const duplicateEntry = context.container.resolve(DuplicateEntryUseCase);
|
|
5
|
+
const entry = await duplicateEntry.execute(model, args.revision);
|
|
6
|
+
if (entry.isFail()) return new ErrorResponse(entry.error);
|
|
7
|
+
return new Response(entry.value);
|
|
8
|
+
};
|
|
9
|
+
export { resolveDuplicate };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=resolveDuplicate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/schema/resolvers/manage/resolveDuplicate.js","sources":["../../../../../src/graphql/schema/resolvers/manage/resolveDuplicate.ts"],"sourcesContent":["import { ErrorResponse, Response } from \"@webiny/api-graphql/responses.js\";\nimport type { CmsEntryResolverFactory as ResolverFactory } from \"~/types/index.js\";\nimport { DuplicateEntryUseCase } from \"~/features/contentEntry/DuplicateEntry/index.js\";\n\ninterface ResolveDuplicateArgs {\n revision: string;\n}\ntype ResolveDuplicate = ResolverFactory<any, ResolveDuplicateArgs>;\n\nexport const resolveDuplicate: ResolveDuplicate =\n ({ model }) =>\n async (_, args: any, context) => {\n const duplicateEntry = context.container.resolve(DuplicateEntryUseCase);\n const entry = await duplicateEntry.execute(model, args.revision);\n\n if (entry.isFail()) {\n return new ErrorResponse(entry.error);\n }\n\n return new Response(entry.value);\n };\n"],"names":["resolveDuplicate","model","_","args","context","duplicateEntry","DuplicateEntryUseCase","entry","ErrorResponse","Response"],"mappings":";;AASO,MAAMA,mBACT,CAAC,EAAEC,KAAK,EAAE,GACV,OAAOC,GAAGC,MAAWC;QACjB,MAAMC,iBAAiBD,QAAQ,SAAS,CAAC,OAAO,CAACE;QACjD,MAAMC,QAAQ,MAAMF,eAAe,OAAO,CAACJ,OAAOE,KAAK,QAAQ;QAE/D,IAAII,MAAM,MAAM,IACZ,OAAO,IAAIC,cAAcD,MAAM,KAAK;QAGxC,OAAO,IAAIE,SAASF,MAAM,KAAK;IACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -22,42 +22,42 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/code-frame": "8.0.
|
|
26
|
-
"@graphql-tools/merge": "
|
|
27
|
-
"@graphql-tools/schema": "
|
|
28
|
-
"@webiny/api": "6.6.0-alpha.
|
|
29
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
30
|
-
"@webiny/api-core-testing": "6.6.0-alpha.
|
|
31
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
32
|
-
"@webiny/di": "
|
|
33
|
-
"@webiny/error": "6.6.0-alpha.
|
|
34
|
-
"@webiny/event-handler-core": "6.6.0-alpha.
|
|
35
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
36
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
37
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
38
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
39
|
-
"@webiny/validation": "6.6.0-alpha.
|
|
25
|
+
"@babel/code-frame": "8.0.6",
|
|
26
|
+
"@graphql-tools/merge": "10.0.8",
|
|
27
|
+
"@graphql-tools/schema": "11.0.8",
|
|
28
|
+
"@webiny/api": "6.6.0-alpha.11",
|
|
29
|
+
"@webiny/api-core": "6.6.0-alpha.11",
|
|
30
|
+
"@webiny/api-core-testing": "6.6.0-alpha.11",
|
|
31
|
+
"@webiny/api-graphql": "6.6.0-alpha.11",
|
|
32
|
+
"@webiny/di": "2.0.0",
|
|
33
|
+
"@webiny/error": "6.6.0-alpha.11",
|
|
34
|
+
"@webiny/event-handler-core": "6.6.0-alpha.11",
|
|
35
|
+
"@webiny/feature": "6.6.0-alpha.11",
|
|
36
|
+
"@webiny/handler": "6.6.0-alpha.11",
|
|
37
|
+
"@webiny/plugins": "6.6.0-alpha.11",
|
|
38
|
+
"@webiny/utils": "6.6.0-alpha.11",
|
|
39
|
+
"@webiny/validation": "6.6.0-alpha.11",
|
|
40
40
|
"dot-prop-immutable": "2.1.1",
|
|
41
41
|
"graphql": "16.14.2",
|
|
42
42
|
"graphql-tag": "2.12.7",
|
|
43
43
|
"lodash": "4.18.1",
|
|
44
|
-
"p-map": "7.
|
|
44
|
+
"p-map": "7.1.1",
|
|
45
45
|
"p-reduce": "3.0.0",
|
|
46
46
|
"pluralize": "8.0.0",
|
|
47
47
|
"slugify": "1.6.9",
|
|
48
|
-
"zod": "4.
|
|
48
|
+
"zod": "4.6.7"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/pluralize": "0.0.33",
|
|
52
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
53
|
-
"@webiny/db-dynamodb": "6.6.0-alpha.
|
|
54
|
-
"@webiny/sdk": "6.6.0-alpha.
|
|
55
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
52
|
+
"@webiny/build-tools": "6.6.0-alpha.11",
|
|
53
|
+
"@webiny/db-dynamodb": "6.6.0-alpha.11",
|
|
54
|
+
"@webiny/sdk": "6.6.0-alpha.11",
|
|
55
|
+
"@webiny/wcp": "6.6.0-alpha.11",
|
|
56
56
|
"graphql": "16.14.2",
|
|
57
|
-
"oxfmt": "0.
|
|
57
|
+
"oxfmt": "0.75.0",
|
|
58
58
|
"rimraf": "6.1.3",
|
|
59
59
|
"typescript": "7.0.2",
|
|
60
|
-
"vitest": "
|
|
60
|
+
"vitest": "5.0.5",
|
|
61
61
|
"write-json-file": "7.0.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
@@ -127,16 +127,15 @@ class CmsModelPlugin extends Plugin {
|
|
|
127
127
|
};
|
|
128
128
|
for (const field of model.fields){
|
|
129
129
|
const total = countFieldInLayout(field.id, model.layout);
|
|
130
|
-
if (1
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
130
|
+
if (1 === total) continue;
|
|
131
|
+
else if (total > 1) throw new error(`Field "${field.id}" is in more than one layout cell.`, "DUPLICATE_FIELD_IN_LAYOUT", {
|
|
132
|
+
model,
|
|
133
|
+
field
|
|
134
|
+
});
|
|
135
|
+
throw new error(`Missing field "${field.id}" in layout.`, "MISSING_FIELD_IN_LAYOUT", {
|
|
136
|
+
model,
|
|
137
|
+
field
|
|
138
|
+
});
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins/CmsModelPlugin.js","sources":["../../src/plugins/CmsModelPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport lodashCamelCase from \"lodash/camelCase.js\";\nimport camelCase from \"lodash/camelCase.js\";\nimport upperFirst from \"lodash/upperFirst.js\";\nimport pluralize from \"pluralize\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type {\n CmsModel as CmsModelBase,\n CmsModelField as CmsModelFieldBase,\n CmsModelFieldSettings as BaseCmsModelFieldSettings\n} from \"~/types/index.js\";\nimport { createFieldStorageId } from \"~/crud/contentModel/createFieldStorageId.js\";\nimport { validateStorageId } from \"~/crud/contentModel/validateStorageId.js\";\n\nconst createApiName = (name: string) => {\n return upperFirst(camelCase(name));\n};\n\nconst createPluralApiName = (name: string) => {\n return pluralize(createApiName(name));\n};\n\ninterface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, \"fields\"> {\n /**\n * Object field has child fields.\n */\n fields?: CmsModelFieldInput[];\n}\n\ninterface CmsModelFieldInput extends Omit<CmsModelFieldBase, \"storageId\" | \"settings\"> {\n /**\n * If defined, it must be camelCased string.\n * This is for backwards compatibility - before fields had storageId.\n *\n * This should only be populated in old model fields.\n * New ones must have this empty.\n */\n storageId?: string;\n /**\n * We must have a possibility to have a nested field defined without the storageId.\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsApiModel extends Omit<\n CmsModelPluginModel,\n \"isPrivate\" | \"fields\" | \"singularApiName\" | \"pluralApiName\" | \"isPlugin\"\n> {\n isPrivate?: never;\n noValidate?: boolean;\n singularApiName?: string;\n pluralApiName?: string;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsApiModelFull extends Omit<CmsApiModel, \"fields\"> {\n fields: CmsModelFieldBase[];\n}\n\ninterface CmsPrivateModel extends Omit<\n CmsModelPluginModel,\n | \"isPrivate\"\n | \"singularApiName\"\n | \"pluralApiName\"\n | \"fields\"\n | \"isPlugin\"\n | \"layout\"\n | \"icon\"\n | \"titleFieldId\"\n | \"description\"\n> {\n noValidate?: boolean;\n titleFieldId?: string;\n singularApiName?: never;\n pluralApiName?: never;\n isPrivate: true;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsPrivateModelFull extends Omit<\n CmsPrivateModel,\n \"fields\" | \"createdBy\" | \"createdOn\" | \"savedOn\"\n> {\n fields: CmsModelFieldBase[];\n}\n\nexport type CmsModelInput = CmsApiModel | CmsPrivateModel | CmsApiModelFull | CmsPrivateModelFull;\n\nexport interface CmsModelPluginModel extends Omit<CmsModelBase, \"tenant\"> {\n tenant?: string;\n}\n\ninterface CmsModelPluginOptions {\n validateLayout?: boolean;\n}\n\nexport class CmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms-content-model\";\n public readonly contentModel: CmsModelPluginModel;\n\n private readonly options: CmsModelPluginOptions;\n\n constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions) {\n super();\n this.options = options || {};\n this.contentModel = this.buildModel(contentModel);\n }\n\n private buildModel(input: CmsModelInput): CmsModelPluginModel {\n const isPrivate = input.isPrivate ?? false;\n\n const singularApiName = input.singularApiName\n ? createApiName(input.singularApiName)\n : createApiName(input.name);\n\n const pluralApiName = input.pluralApiName\n ? createApiName(input.pluralApiName)\n : createPluralApiName(input.name);\n\n const modelPlugin: CmsModelPluginModel = {\n group: input.group ?? \"ungrouped\",\n description: \"\",\n fields: [],\n isPlugin: true,\n isPrivate,\n icon: null,\n layout: [],\n modelId: input.modelId,\n name: input.name,\n pluralApiName,\n singularApiName,\n titleFieldId: \"id\",\n settings: {}\n };\n\n if (input.noValidate) {\n /**\n * We can safely ignore this error, because we are sure noValidate is not a model field.\n */\n delete input[\"noValidate\"];\n\n return {\n ...modelPlugin,\n ...input,\n // Since `noValidate` is set, we trust the input, and cast to `CmsModelFieldBase`.\n fields: input.fields as CmsModelFieldBase[],\n pluralApiName,\n singularApiName\n };\n }\n\n const model: CmsModelPluginModel = {\n ...modelPlugin,\n ...input,\n pluralApiName,\n singularApiName,\n fields: this.buildFields(input, input.fields)\n };\n this.validateLayout(model);\n return model;\n }\n\n private buildFields(\n model: CmsModelInput,\n inputFields: CmsModelFieldInput[]\n ): CmsModelFieldBase[] {\n if (inputFields.length === 0) {\n throw new WebinyError(\n `Missing fields for the defined model \"${model.modelId}\".`,\n \"MISSING_FIELDS\",\n {\n model\n }\n );\n }\n const fields: CmsModelFieldBase[] = [];\n const storageIdList: string[] = [];\n const fieldIdList: string[] = [];\n for (const input of inputFields) {\n /**\n * Field must contain an fieldId. It is required in the graphql, but lets check it just in case\n */\n if (!(input.fieldId || \"\").trim()) {\n throw new WebinyError(\n `Field's \"storageId\" is not defined for the content model \"${model.modelId}\".`,\n \"FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n const fieldId = lodashCamelCase(input.fieldId);\n /**\n * FieldID must be in correct pattern.\n */\n if (fieldId.match(/^[0-9]/) !== null) {\n throw new WebinyError(\n `Field's \"fieldId\" does not match correct pattern in the content model \"${model.modelId}\" - cannot start with a number.`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * FieldID also must be camelCased.\n */\n if (fieldId !== input.fieldId) {\n throw new WebinyError(\n `Field's \"fieldId\" must be a camel cased string in the content model \"${model.modelId}\".`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * ... and fieldId must be unique.\n */\n if (fieldIdList.includes(fieldId)) {\n throw new WebinyError(\n `Field's \"fieldId\" (id: ${input.id}) is not unique in the content model \"${model.modelId}\".`,\n \"FIELD_ID_NOT_UNIQUE_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n let storageId = input.storageId;\n if (storageId) {\n try {\n validateStorageId(storageId);\n } catch (e) {\n throw WebinyError.from(e, {\n data: { model, storageId, field: input }\n });\n }\n } else {\n storageId = createFieldStorageId(input);\n }\n\n /**\n * Fields storageId must be unique.\n */\n if (storageIdList.includes(storageId)) {\n throw new WebinyError(\n `Field's \"storageId\" is not unique in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n /**\n * We can safely ignore error because we are going through the fields and making sure each has storageId.\n */\n // @ts-expect-error\n let settings: BaseCmsModelFieldSettings = input.settings;\n\n const childFields = settings?.fields || [];\n if (input.type === \"object\" && childFields.length > 0) {\n settings = {\n ...(settings || {}),\n fields: this.buildFields(model, childFields)\n };\n }\n\n const field: CmsModelFieldBase = {\n ...input,\n settings,\n storageId\n };\n /**\n * Add all relevant data to arrays.\n */\n fields.push(field);\n storageIdList.push(field.storageId);\n fieldIdList.push(field.fieldId);\n }\n return fields;\n }\n\n private validateLayout(model: CmsModelPluginModel): void {\n /**\n * Only skip validation if option.validateLayout was set as false, explicitly.\n */\n if (this.options.validateLayout === false) {\n return;\n }\n\n const countFieldInLayout = (fieldId: string, layout: any[][]): number => {\n let total = 0;\n for (const row of layout) {\n for (const cell of row) {\n if (typeof cell === \"string\") {\n if (cell === fieldId) {\n total++;\n }\n } else if (cell && typeof cell === \"object\" && Array.isArray(cell.tabs)) {\n for (const tab of cell.tabs) {\n if (Array.isArray(tab.layout)) {\n total += countFieldInLayout(fieldId, tab.layout);\n }\n }\n }\n }\n }\n return total;\n };\n\n for (const field of model.fields) {\n const total = countFieldInLayout(field.id, model.layout);\n if (total === 1) {\n continue;\n } else if (total > 1) {\n throw new WebinyError(\n `Field \"${field.id}\" is in more than one layout cell.`,\n \"DUPLICATE_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n throw new WebinyError(\n `Missing field \"${field.id}\" in layout.`,\n \"MISSING_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n }\n}\n\n/**\n * IMPORTANT! This function should NOT be used outside the `api-headless-cms` package!\n * @internal\n */\nexport const createModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * IMPORTANT! This function should NOT be used outside the `api-headless-cms` package!\n * @internal\n */\nexport const createPrivateModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsModelPlugin => {\n return createModelPlugin(\n {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: \"private\",\n ...input\n },\n {\n validateLayout: false\n }\n );\n};\n"],"names":["createApiName","name","upperFirst","camelCase","createPluralApiName","pluralize","CmsModelPlugin","Plugin","contentModel","options","input","isPrivate","singularApiName","pluralApiName","modelPlugin","model","inputFields","WebinyError","fields","storageIdList","fieldIdList","fieldId","lodashCamelCase","storageId","validateStorageId","e","createFieldStorageId","settings","childFields","field","countFieldInLayout","layout","total","row","cell","Array","tab","createModelPlugin","createPrivateModelPlugin"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"plugins/CmsModelPlugin.js","sources":["../../src/plugins/CmsModelPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport lodashCamelCase from \"lodash/camelCase.js\";\nimport camelCase from \"lodash/camelCase.js\";\nimport upperFirst from \"lodash/upperFirst.js\";\nimport pluralize from \"pluralize\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type {\n CmsModel as CmsModelBase,\n CmsModelField as CmsModelFieldBase,\n CmsModelFieldSettings as BaseCmsModelFieldSettings\n} from \"~/types/index.js\";\nimport { createFieldStorageId } from \"~/crud/contentModel/createFieldStorageId.js\";\nimport { validateStorageId } from \"~/crud/contentModel/validateStorageId.js\";\n\nconst createApiName = (name: string) => {\n return upperFirst(camelCase(name));\n};\n\nconst createPluralApiName = (name: string) => {\n return pluralize(createApiName(name));\n};\n\ninterface CmsModelFieldSettings extends Omit<BaseCmsModelFieldSettings, \"fields\"> {\n /**\n * Object field has child fields.\n */\n fields?: CmsModelFieldInput[];\n}\n\ninterface CmsModelFieldInput extends Omit<CmsModelFieldBase, \"storageId\" | \"settings\"> {\n /**\n * If defined, it must be camelCased string.\n * This is for backwards compatibility - before fields had storageId.\n *\n * This should only be populated in old model fields.\n * New ones must have this empty.\n */\n storageId?: string;\n /**\n * We must have a possibility to have a nested field defined without the storageId.\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsApiModel extends Omit<\n CmsModelPluginModel,\n \"isPrivate\" | \"fields\" | \"singularApiName\" | \"pluralApiName\" | \"isPlugin\"\n> {\n isPrivate?: never;\n noValidate?: boolean;\n singularApiName?: string;\n pluralApiName?: string;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsApiModelFull extends Omit<CmsApiModel, \"fields\"> {\n fields: CmsModelFieldBase[];\n}\n\ninterface CmsPrivateModel extends Omit<\n CmsModelPluginModel,\n | \"isPrivate\"\n | \"singularApiName\"\n | \"pluralApiName\"\n | \"fields\"\n | \"isPlugin\"\n | \"layout\"\n | \"icon\"\n | \"titleFieldId\"\n | \"description\"\n> {\n noValidate?: boolean;\n titleFieldId?: string;\n singularApiName?: never;\n pluralApiName?: never;\n isPrivate: true;\n fields: CmsModelFieldInput[];\n}\n\nexport interface CmsPrivateModelFull extends Omit<\n CmsPrivateModel,\n \"fields\" | \"createdBy\" | \"createdOn\" | \"savedOn\"\n> {\n fields: CmsModelFieldBase[];\n}\n\nexport type CmsModelInput = CmsApiModel | CmsPrivateModel | CmsApiModelFull | CmsPrivateModelFull;\n\nexport interface CmsModelPluginModel extends Omit<CmsModelBase, \"tenant\"> {\n tenant?: string;\n}\n\ninterface CmsModelPluginOptions {\n validateLayout?: boolean;\n}\n\nexport class CmsModelPlugin extends Plugin {\n public static override readonly type: string = \"cms-content-model\";\n public readonly contentModel: CmsModelPluginModel;\n\n private readonly options: CmsModelPluginOptions;\n\n constructor(contentModel: CmsModelInput, options?: CmsModelPluginOptions) {\n super();\n this.options = options || {};\n this.contentModel = this.buildModel(contentModel);\n }\n\n private buildModel(input: CmsModelInput): CmsModelPluginModel {\n const isPrivate = input.isPrivate ?? false;\n\n const singularApiName = input.singularApiName\n ? createApiName(input.singularApiName)\n : createApiName(input.name);\n\n const pluralApiName = input.pluralApiName\n ? createApiName(input.pluralApiName)\n : createPluralApiName(input.name);\n\n const modelPlugin: CmsModelPluginModel = {\n group: input.group ?? \"ungrouped\",\n description: \"\",\n fields: [],\n isPlugin: true,\n isPrivate,\n icon: null,\n layout: [],\n modelId: input.modelId,\n name: input.name,\n pluralApiName,\n singularApiName,\n titleFieldId: \"id\",\n settings: {}\n };\n\n if (input.noValidate) {\n /**\n * We can safely ignore this error, because we are sure noValidate is not a model field.\n */\n delete input[\"noValidate\"];\n\n return {\n ...modelPlugin,\n ...input,\n // Since `noValidate` is set, we trust the input, and cast to `CmsModelFieldBase`.\n fields: input.fields as CmsModelFieldBase[],\n pluralApiName,\n singularApiName\n };\n }\n\n const model: CmsModelPluginModel = {\n ...modelPlugin,\n ...input,\n pluralApiName,\n singularApiName,\n fields: this.buildFields(input, input.fields)\n };\n this.validateLayout(model);\n return model;\n }\n\n private buildFields(\n model: CmsModelInput,\n inputFields: CmsModelFieldInput[]\n ): CmsModelFieldBase[] {\n if (inputFields.length === 0) {\n throw new WebinyError(\n `Missing fields for the defined model \"${model.modelId}\".`,\n \"MISSING_FIELDS\",\n {\n model\n }\n );\n }\n const fields: CmsModelFieldBase[] = [];\n const storageIdList: string[] = [];\n const fieldIdList: string[] = [];\n for (const input of inputFields) {\n /**\n * Field must contain an fieldId. It is required in the graphql, but lets check it just in case\n */\n if (!(input.fieldId || \"\").trim()) {\n throw new WebinyError(\n `Field's \"storageId\" is not defined for the content model \"${model.modelId}\".`,\n \"FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n const fieldId = lodashCamelCase(input.fieldId);\n /**\n * FieldID must be in correct pattern.\n */\n if (fieldId.match(/^[0-9]/) !== null) {\n throw new WebinyError(\n `Field's \"fieldId\" does not match correct pattern in the content model \"${model.modelId}\" - cannot start with a number.`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * FieldID also must be camelCased.\n */\n if (fieldId !== input.fieldId) {\n throw new WebinyError(\n `Field's \"fieldId\" must be a camel cased string in the content model \"${model.modelId}\".`,\n \"FIELD_FIELD_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n /**\n * ... and fieldId must be unique.\n */\n if (fieldIdList.includes(fieldId)) {\n throw new WebinyError(\n `Field's \"fieldId\" (id: ${input.id}) is not unique in the content model \"${model.modelId}\".`,\n \"FIELD_ID_NOT_UNIQUE_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n let storageId = input.storageId;\n if (storageId) {\n try {\n validateStorageId(storageId);\n } catch (e) {\n throw WebinyError.from(e, {\n data: { model, storageId, field: input }\n });\n }\n } else {\n storageId = createFieldStorageId(input);\n }\n\n /**\n * Fields storageId must be unique.\n */\n if (storageIdList.includes(storageId)) {\n throw new WebinyError(\n `Field's \"storageId\" is not unique in the content model \"${model.modelId}\".`,\n \"STORAGE_ID_ERROR\",\n {\n model,\n field: input\n }\n );\n }\n\n /**\n * We can safely ignore error because we are going through the fields and making sure each has storageId.\n */\n // @ts-expect-error\n let settings: BaseCmsModelFieldSettings = input.settings;\n\n const childFields = settings?.fields || [];\n if (input.type === \"object\" && childFields.length > 0) {\n settings = {\n ...(settings || {}),\n fields: this.buildFields(model, childFields)\n };\n }\n\n const field: CmsModelFieldBase = {\n ...input,\n settings,\n storageId\n };\n /**\n * Add all relevant data to arrays.\n */\n fields.push(field);\n storageIdList.push(field.storageId);\n fieldIdList.push(field.fieldId);\n }\n return fields;\n }\n\n private validateLayout(model: CmsModelPluginModel): void {\n /**\n * Only skip validation if option.validateLayout was set as false, explicitly.\n */\n if (this.options.validateLayout === false) {\n return;\n }\n\n const countFieldInLayout = (fieldId: string, layout: any[][]): number => {\n let total = 0;\n for (const row of layout) {\n for (const cell of row) {\n if (typeof cell === \"string\") {\n if (cell === fieldId) {\n total++;\n }\n } else if (cell && typeof cell === \"object\" && Array.isArray(cell.tabs)) {\n for (const tab of cell.tabs) {\n if (Array.isArray(tab.layout)) {\n total += countFieldInLayout(fieldId, tab.layout);\n }\n }\n }\n }\n }\n return total;\n };\n\n for (const field of model.fields) {\n const total = countFieldInLayout(field.id, model.layout);\n if (total === 1) {\n continue;\n } else if (total > 1) {\n throw new WebinyError(\n `Field \"${field.id}\" is in more than one layout cell.`,\n \"DUPLICATE_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n throw new WebinyError(\n `Missing field \"${field.id}\" in layout.`,\n \"MISSING_FIELD_IN_LAYOUT\",\n {\n model,\n field\n }\n );\n }\n }\n}\n\n/**\n * IMPORTANT! This function should NOT be used outside the `api-headless-cms` package!\n * @internal\n */\nexport const createModelPlugin = (\n model: CmsModelInput,\n options?: CmsModelPluginOptions\n): CmsModelPlugin => {\n return new CmsModelPlugin(model, options);\n};\n\n/**\n * IMPORTANT! This function should NOT be used outside the `api-headless-cms` package!\n * @internal\n */\nexport const createPrivateModelPlugin = (\n input: Omit<CmsPrivateModelFull, \"group\" | \"isPrivate\">\n): CmsModelPlugin => {\n return createModelPlugin(\n {\n authorization: false,\n noValidate: true,\n isPrivate: true,\n group: \"private\",\n ...input\n },\n {\n validateLayout: false\n }\n );\n};\n"],"names":["createApiName","name","upperFirst","camelCase","createPluralApiName","pluralize","CmsModelPlugin","Plugin","contentModel","options","input","isPrivate","singularApiName","pluralApiName","modelPlugin","model","inputFields","WebinyError","fields","storageIdList","fieldIdList","fieldId","lodashCamelCase","storageId","validateStorageId","e","createFieldStorageId","settings","childFields","field","countFieldInLayout","layout","total","row","cell","Array","tab","createModelPlugin","createPrivateModelPlugin"],"mappings":"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"}
|
package/types/index.d.ts
CHANGED
package/types/modelField.d.ts
CHANGED
|
@@ -98,6 +98,13 @@ export interface CmsModelField {
|
|
|
98
98
|
*
|
|
99
99
|
*/
|
|
100
100
|
list?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Renders the field in the admin app, but doesn't let anyone edit its value.
|
|
103
|
+
*
|
|
104
|
+
* This only affects the admin app. The API doesn't check it, so a disabled field
|
|
105
|
+
* can still be written to over GraphQL.
|
|
106
|
+
*/
|
|
107
|
+
disabled?: boolean;
|
|
101
108
|
/**
|
|
102
109
|
* Fields can be tagged to give them contextual meaning.
|
|
103
110
|
*/
|
|
@@ -164,6 +171,10 @@ export interface CmsModelFieldInput {
|
|
|
164
171
|
* Are multiple values allowed?
|
|
165
172
|
*/
|
|
166
173
|
list?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* @see CmsModelField.disabled
|
|
176
|
+
*/
|
|
177
|
+
disabled?: boolean;
|
|
167
178
|
/**
|
|
168
179
|
* Predefined values options for the field. Check the reference for more information.
|
|
169
180
|
*/
|
package/types/types.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { Context, GenericRecord } from "@webiny/api/types.js";
|
|
2
2
|
import type { GraphQLFieldResolver } from "@webiny/api-graphql/types.js";
|
|
3
3
|
import type { CmsModelConverterCallable } from "../utils/converters/ConverterCollection.js";
|
|
4
|
-
import type { HeadlessCmsExport, HeadlessCmsImport } from "../export/types.js";
|
|
5
|
-
import type { AccessControl } from "../crud/AccessControl/AccessControl.js";
|
|
6
|
-
import type { CmsModelToAstConverter } from "../utils/contentModelAst/CmsModelToAstConverter.js";
|
|
7
4
|
import type { ICmsModelFieldToGraphQLRegistry } from "../features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js";
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput, StorageCmsModel } from "./model.js";
|
|
5
|
+
import type { CmsModelField, CmsModelFieldValidation } from "./modelField.js";
|
|
6
|
+
import type { CmsModel, StorageCmsModel } from "./model.js";
|
|
11
7
|
import type { CmsGroup } from "./modelGroup.js";
|
|
12
8
|
import type { CmsIdentity } from "./identity.js";
|
|
13
9
|
import type { SecurityPermission } from "@webiny/api-core/types/security.js";
|
|
@@ -24,37 +20,9 @@ export interface CmsError {
|
|
|
24
20
|
stack?: string;
|
|
25
21
|
}
|
|
26
22
|
export type ApiEndpoint = "manage" | "preview" | "read";
|
|
27
|
-
export interface HeadlessCms extends CmsGroupContext, CmsModelContext, CmsEntryContext {
|
|
28
|
-
/**
|
|
29
|
-
* API type
|
|
30
|
-
*/
|
|
31
|
-
type: ApiEndpoint | null;
|
|
32
|
-
/**
|
|
33
|
-
* Means this request is a READ API
|
|
34
|
-
*/
|
|
35
|
-
READ: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Means this request is a MANAGE API
|
|
38
|
-
*/
|
|
39
|
-
MANAGE: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Means this request is a PREVIEW API
|
|
42
|
-
*/
|
|
43
|
-
PREVIEW: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Use to ensure perform authorization and ensure identities have access to the groups, models and entries.
|
|
46
|
-
*/
|
|
47
|
-
accessControl: AccessControl;
|
|
48
|
-
/**
|
|
49
|
-
* Export operations.
|
|
50
|
-
*/
|
|
51
|
-
export: HeadlessCmsExport;
|
|
52
|
-
importing: HeadlessCmsImport;
|
|
53
|
-
}
|
|
54
23
|
/**
|
|
55
24
|
* The CMS request context. Services are resolved from the DI container
|
|
56
|
-
* (`context.container.resolve(...)`)
|
|
57
|
-
* (see ~/features/shared/abstractions.js). ApiCoreContext aliases the base Context
|
|
25
|
+
* (`context.container.resolve(...)`). ApiCoreContext aliases the base Context
|
|
58
26
|
* and DbContext only adds an unused `db`, so the historical
|
|
59
27
|
* `Context & DbContext & ApiCoreContext` merge collapses to the base Context.
|
|
60
28
|
*
|
|
@@ -166,38 +134,6 @@ export interface CmsGroupListParams {
|
|
|
166
134
|
tenant: string;
|
|
167
135
|
};
|
|
168
136
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Cms Group in context.
|
|
171
|
-
*
|
|
172
|
-
* @category Context
|
|
173
|
-
* @category CmsGroup
|
|
174
|
-
*/
|
|
175
|
-
export interface CmsGroupContext {
|
|
176
|
-
/**
|
|
177
|
-
* Gets content model group by given id.
|
|
178
|
-
*/
|
|
179
|
-
getGroup: (id: string) => Promise<CmsGroup>;
|
|
180
|
-
/**
|
|
181
|
-
* List all content model groups. Filterable via params.
|
|
182
|
-
*/
|
|
183
|
-
listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;
|
|
184
|
-
/**
|
|
185
|
-
* Create a new content model group.
|
|
186
|
-
*/
|
|
187
|
-
createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;
|
|
188
|
-
/**
|
|
189
|
-
* Update existing content model group.
|
|
190
|
-
*/
|
|
191
|
-
updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;
|
|
192
|
-
/**
|
|
193
|
-
* Delete content model group by given id.
|
|
194
|
-
*/
|
|
195
|
-
deleteGroup: (id: string) => Promise<boolean>;
|
|
196
|
-
/**
|
|
197
|
-
* Clear the cached groups.
|
|
198
|
-
*/
|
|
199
|
-
clearGroupsCache: () => void;
|
|
200
|
-
}
|
|
201
137
|
/**
|
|
202
138
|
* A content entry values definition for and from the database.
|
|
203
139
|
*
|
|
@@ -414,48 +350,6 @@ export interface ICmsModelListParams {
|
|
|
414
350
|
includePrivate?: boolean;
|
|
415
351
|
includePlugins?: boolean;
|
|
416
352
|
}
|
|
417
|
-
/**
|
|
418
|
-
* Cms Model in the context.
|
|
419
|
-
*
|
|
420
|
-
* @category Context
|
|
421
|
-
* @category CmsModel
|
|
422
|
-
*/
|
|
423
|
-
export interface CmsModelContext {
|
|
424
|
-
/**
|
|
425
|
-
* Get a single content model.
|
|
426
|
-
*
|
|
427
|
-
* @throws NotFoundError
|
|
428
|
-
*/
|
|
429
|
-
getModel(modelId: string): Promise<CmsModel>;
|
|
430
|
-
/**
|
|
431
|
-
* Get model to AST converter.
|
|
432
|
-
*/
|
|
433
|
-
getModelToAstConverter: () => CmsModelToAstConverter;
|
|
434
|
-
/**
|
|
435
|
-
* Get all content models.
|
|
436
|
-
*/
|
|
437
|
-
listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;
|
|
438
|
-
/**
|
|
439
|
-
* Create a content model.
|
|
440
|
-
*/
|
|
441
|
-
createModel(data: CmsModelCreateInput): Promise<CmsModel>;
|
|
442
|
-
/**
|
|
443
|
-
* Create a content model from the given model - clone.
|
|
444
|
-
*/
|
|
445
|
-
createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;
|
|
446
|
-
/**
|
|
447
|
-
* Update content model.
|
|
448
|
-
*/
|
|
449
|
-
updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;
|
|
450
|
-
/**
|
|
451
|
-
* Delete content model. Should not allow deletion if there are entries connected to it.
|
|
452
|
-
*/
|
|
453
|
-
deleteModel(modelId: string): Promise<void>;
|
|
454
|
-
/**
|
|
455
|
-
* Clear all the model caches.
|
|
456
|
-
*/
|
|
457
|
-
clearModelsCache(): void;
|
|
458
|
-
}
|
|
459
353
|
/**
|
|
460
354
|
* Available statuses for content entry.
|
|
461
355
|
*
|
|
@@ -470,6 +364,13 @@ export interface CmsEntryListWhereValues {
|
|
|
470
364
|
*/
|
|
471
365
|
[key: string]: string | number | boolean | Date | undefined | string[] | number[] | null | CmsEntryListWhereValues[] | CmsEntryListWhereValues | CmsEntryListWhereRef;
|
|
472
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* Filterable keys of `entry.system`. Features that register a `CmsEntrySystemField` extend it.
|
|
369
|
+
*
|
|
370
|
+
* @category CmsEntry
|
|
371
|
+
*/
|
|
372
|
+
export interface CmsEntryListWhereSystem {
|
|
373
|
+
}
|
|
473
374
|
/**
|
|
474
375
|
* Entry listing where params.
|
|
475
376
|
*
|
|
@@ -524,6 +425,10 @@ TruthfulInterfaceGenerator<"latest"> {
|
|
|
524
425
|
folderId_not_in?: string[];
|
|
525
426
|
};
|
|
526
427
|
values?: CmsEntryListWhereValues;
|
|
428
|
+
/**
|
|
429
|
+
* Entry system data, stored as-is on the entry.
|
|
430
|
+
*/
|
|
431
|
+
system?: CmsEntryListWhereSystem;
|
|
527
432
|
/**
|
|
528
433
|
* Is the entry in the bin?
|
|
529
434
|
*/
|
package/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types/types.js","sources":["../../src/types/types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver } from \"@webiny/api-graphql/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types.js\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl.js\";\nimport type { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsEntryContext } from \"./context.js\";\nimport type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField.js\";\nimport type {\n CmsModel,\n CmsModelCreateFromInput,\n CmsModelCreateInput,\n StorageCmsModel\n} from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: string;\n};\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\nexport interface HeadlessCms extends CmsGroupContext, CmsModelContext, CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * Use to ensure perform authorization and ensure identities have access to the groups, models and entries.\n */\n accessControl: AccessControl;\n\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n}\n\n/**\n * The CMS request context. Services are resolved from the DI container\n * (`context.container.resolve(...)`); the CMS facade is the `HeadlessCms` token\n * (see ~/features/shared/abstractions.js). ApiCoreContext aliases the base Context\n * and DbContext only adds an unused `db`, so the historical\n * `Context & DbContext & ApiCoreContext` merge collapses to the base Context.\n *\n * @category Context\n */\nexport type CmsContext = Context;\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof T];\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry<T>;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: CmsIcon;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n };\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n /**\n * A revision description.\n */\n revisionDescription: string | undefined;\n /**\n * A timestamp of when the entry should be automatically deleted from the database.\n */\n expiresAt: number | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\nexport interface ICmsModelListParams {\n /**\n * Defaults to true.\n */\n includePrivate?: boolean;\n includePlugins?: boolean;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n *\n * @throws NotFoundError\n */\n getModel(modelId: string): Promise<CmsModel>;\n /**\n * Get model to AST converter.\n */\n getModelToAstConverter: () => CmsModelToAstConverter;\n /**\n * Get all content models.\n */\n listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel(data: CmsModelCreateInput): Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel(modelId: string): Promise<void>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache(): void;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"published\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"latest\"> {\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\n\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n\n expiresAt?: Date | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n\n expiresAt?: Date | number | null | undefined;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldRegistry: ICmsModelFieldToGraphQLRegistry;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n models?: string[];\n groups?: string[];\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n groups?: string[];\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<T>;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as restored.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n"],"names":["CONTENT_ENTRY_STATUS"],"mappings":"AAqqCO,IAAKA,6BAAoBA,WAAAA,GAAAA,SAApBA,oBAAoB;;;;WAApBA"}
|
|
1
|
+
{"version":3,"file":"types/types.js","sources":["../../src/types/types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver } from \"@webiny/api-graphql/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsModelField, CmsModelFieldValidation } from \"./modelField.js\";\nimport type { CmsModel, StorageCmsModel } from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: string;\n};\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\n/**\n * The CMS request context. Services are resolved from the DI container\n * (`context.container.resolve(...)`). ApiCoreContext aliases the base Context\n * and DbContext only adds an unused `db`, so the historical\n * `Context & DbContext & ApiCoreContext` merge collapses to the base Context.\n *\n * @category Context\n */\nexport type CmsContext = Context;\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof T];\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry<T>;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon?: CmsIcon | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: CmsIcon;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n };\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n /**\n * A revision description.\n */\n revisionDescription: string | undefined;\n /**\n * A timestamp of when the entry should be automatically deleted from the database.\n */\n expiresAt: number | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\nexport interface ICmsModelListParams {\n /**\n * Defaults to true.\n */\n includePrivate?: boolean;\n includePlugins?: boolean;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n\n/**\n * Filterable keys of `entry.system`. Features that register a `CmsEntrySystemField` extend it.\n *\n * @category CmsEntry\n */\nexport interface CmsEntryListWhereSystem {\n // to be extended\n}\n\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"published\">,\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n TruthfulInterfaceGenerator<\"latest\"> {\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Entry system data, stored as-is on the entry.\n */\n system?: CmsEntryListWhereSystem;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\n\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n\n expiresAt?: Date | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n\n expiresAt?: Date | number | null | undefined;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldRegistry: ICmsModelFieldToGraphQLRegistry;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n models?: string[];\n groups?: string[];\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n groups?: string[];\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<T>;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as restored.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n"],"names":["CONTENT_ENTRY_STATUS"],"mappings":"AAgkCO,IAAKA,6BAAoBA,WAAAA,GAAAA,SAApBA,oBAAoB;;;;WAApBA"}
|
package/utils/caching/Cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/caching/Cache.js","sources":["../../../src/utils/caching/Cache.ts"],"sourcesContent":["import type { ICache, ICacheKey } from \"./types.js\";\n\nexport interface ICacheParams {\n id?: string;\n}\n\nclass Cache<T> implements ICache {\n public readonly id: string | undefined;\n private readonly _cache: Map<string, T> = new Map();\n\n public constructor(params?: ICacheParams) {\n this.id = params?.id;\n }\n\n public get(cacheKey: ICacheKey): T | null {\n const key = cacheKey.get();\n const value = this._cache.get(key);\n return value || null;\n }\n\n public set(cacheKey: ICacheKey, value: T): T {\n const key = cacheKey.get();\n this._cache.set(key, value);\n return value;\n }\n\n public getOrSet(cacheKey: ICacheKey, cb: () => T): T {\n const existing = this.get(cacheKey);\n if (existing) {\n return existing;\n }\n const value = cb();\n return this.set(cacheKey, value);\n }\n\n public clear(cacheKey?: ICacheKey | ICacheKey[]) {\n if (!cacheKey) {\n this._cache.clear();\n return;\n } else if (Array.isArray(cacheKey)) {\n for (const key of cacheKey) {\n this._cache.delete(key.get());\n }\n return;\n }\n\n this._cache.delete(cacheKey.get());\n }\n}\n\nexport const createMemoryCache = <T>(params?: ICacheParams): ICache<T> => {\n return new Cache<T>(params);\n};\n"],"names":["Cache","params","Map","cacheKey","key","value","cb","existing","Array","createMemoryCache"],"mappings":"AAMA,MAAMA;IAIF,YAAmBC,MAAqB,CAAE;aAFzB,MAAM,GAAmB,IAAIC;QAG1C,IAAI,CAAC,EAAE,GAAGD,QAAQ;IACtB;IAEO,IAAIE,QAAmB,EAAY;QACtC,MAAMC,MAAMD,SAAS,GAAG;QACxB,MAAME,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,CAACD;QAC9B,OAAOC,SAAS;IACpB;IAEO,IAAIF,QAAmB,EAAEE,KAAQ,EAAK;QACzC,MAAMD,MAAMD,SAAS,GAAG;QACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAACC,KAAKC;QACrB,OAAOA;IACX;IAEO,SAASF,QAAmB,EAAEG,EAAW,EAAK;QACjD,MAAMC,WAAW,IAAI,CAAC,GAAG,CAACJ;QAC1B,IAAII,UACA,OAAOA;QAEX,MAAMF,QAAQC;QACd,OAAO,IAAI,CAAC,GAAG,CAACH,UAAUE;IAC9B;IAEO,MAAMF,QAAkC,EAAE;QAC7C,IAAI,CAACA,UAAU,YACX,IAAI,CAAC,MAAM,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"utils/caching/Cache.js","sources":["../../../src/utils/caching/Cache.ts"],"sourcesContent":["import type { ICache, ICacheKey } from \"./types.js\";\n\nexport interface ICacheParams {\n id?: string;\n}\n\nclass Cache<T> implements ICache {\n public readonly id: string | undefined;\n private readonly _cache: Map<string, T> = new Map();\n\n public constructor(params?: ICacheParams) {\n this.id = params?.id;\n }\n\n public get(cacheKey: ICacheKey): T | null {\n const key = cacheKey.get();\n const value = this._cache.get(key);\n return value || null;\n }\n\n public set(cacheKey: ICacheKey, value: T): T {\n const key = cacheKey.get();\n this._cache.set(key, value);\n return value;\n }\n\n public getOrSet(cacheKey: ICacheKey, cb: () => T): T {\n const existing = this.get(cacheKey);\n if (existing) {\n return existing;\n }\n const value = cb();\n return this.set(cacheKey, value);\n }\n\n public clear(cacheKey?: ICacheKey | ICacheKey[]) {\n if (!cacheKey) {\n this._cache.clear();\n return;\n } else if (Array.isArray(cacheKey)) {\n for (const key of cacheKey) {\n this._cache.delete(key.get());\n }\n return;\n }\n\n this._cache.delete(cacheKey.get());\n }\n}\n\nexport const createMemoryCache = <T>(params?: ICacheParams): ICache<T> => {\n return new Cache<T>(params);\n};\n"],"names":["Cache","params","Map","cacheKey","key","value","cb","existing","Array","createMemoryCache"],"mappings":"AAMA,MAAMA;IAIF,YAAmBC,MAAqB,CAAE;aAFzB,MAAM,GAAmB,IAAIC;QAG1C,IAAI,CAAC,EAAE,GAAGD,QAAQ;IACtB;IAEO,IAAIE,QAAmB,EAAY;QACtC,MAAMC,MAAMD,SAAS,GAAG;QACxB,MAAME,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,CAACD;QAC9B,OAAOC,SAAS;IACpB;IAEO,IAAIF,QAAmB,EAAEE,KAAQ,EAAK;QACzC,MAAMD,MAAMD,SAAS,GAAG;QACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAACC,KAAKC;QACrB,OAAOA;IACX;IAEO,SAASF,QAAmB,EAAEG,EAAW,EAAK;QACjD,MAAMC,WAAW,IAAI,CAAC,GAAG,CAACJ;QAC1B,IAAII,UACA,OAAOA;QAEX,MAAMF,QAAQC;QACd,OAAO,IAAI,CAAC,GAAG,CAACH,UAAUE;IAC9B;IAEO,MAAMF,QAAkC,EAAE;QAC7C,IAAI,CAACA,UAAU,YACX,IAAI,CAAC,MAAM,CAAC,KAAK;aAEd,IAAIK,MAAM,OAAO,CAACL,WAAW;YAChC,KAAK,MAAMC,OAAOD,SACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC,IAAI,GAAG;YAE9B;QACJ;QAEA,IAAI,CAAC,MAAM,CAAC,MAAM,CAACD,SAAS,GAAG;IACnC;AACJ;AAEO,MAAMM,oBAAoB,CAAIR,SAC1B,IAAID,MAASC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import camelCase from "lodash/camelCase.js";
|
|
2
2
|
const createModelField = (params)=>{
|
|
3
|
-
const { id, label, fieldId: initialFieldId, storageId, type, tags = [], settings = {}, listValidation = [], validation = [], list = false, predefinedValues = {
|
|
3
|
+
const { id, label, fieldId: initialFieldId, storageId, type, tags = [], settings = {}, listValidation = [], validation = [], list = false, disabled = false, predefinedValues = {
|
|
4
4
|
values: [],
|
|
5
5
|
enabled: false
|
|
6
6
|
}, help = null, placeholder = null, renderer = null, rules = [] } = params;
|
|
@@ -16,6 +16,7 @@ const createModelField = (params)=>{
|
|
|
16
16
|
listValidation,
|
|
17
17
|
validation,
|
|
18
18
|
list,
|
|
19
|
+
disabled,
|
|
19
20
|
predefinedValues,
|
|
20
21
|
help,
|
|
21
22
|
placeholder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/createModelField.js","sources":["../../src/utils/createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase.js\";\nimport type { CmsModelField, CmsModelFieldValidation } from \"~/types/index.js\";\n\nexport interface CreateModelFieldParams extends Omit<\n CmsModelField,\n \"id\" | \"storageId\" | \"fieldId\" | \"validation\" | \"listValidation\"\n> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n validation?: CmsModelFieldValidation[];\n listValidation?: CmsModelFieldValidation[];\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags = [],\n settings = {},\n listValidation = [],\n validation = [],\n list = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n help = null,\n placeholder = null,\n renderer = null,\n rules = []\n } = params;\n\n // TODO: ideally, initialFieldId should also be passed through `camelCase` but currently this would break `wbyAco_location` field.\n // TODO: Once this legacy field is removed, we can enable camelCase on the initialFieldId.\n const fieldId = initialFieldId ? initialFieldId : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${id ?? fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n list,\n predefinedValues,\n help,\n placeholder,\n renderer,\n rules\n };\n};\n"],"names":["createModelField","params","id","label","initialFieldId","storageId","type","tags","settings","listValidation","validation","list","predefinedValues","help","placeholder","renderer","rules","fieldId","camelCase"],"mappings":";AAcO,MAAMA,mBAAmB,CAACC;IAG7B,MAAM,EACFC,EAAE,EACFC,KAAK,EACL,SAASC,cAAc,EACvBC,SAAS,EACTC,IAAI,EACJC,OAAO,EAAE,EACTC,WAAW,CAAC,CAAC,EACbC,iBAAiB,EAAE,EACnBC,aAAa,EAAE,EACfC,OAAO,KAAK,EACZC,mBAAmB;QACf,QAAQ,EAAE;QACV,SAAS;IACb,CAAC,EACDC,OAAO,IAAI,EACXC,cAAc,IAAI,EAClBC,WAAW,IAAI,EACfC,QAAQ,EAAE,EACb,
|
|
1
|
+
{"version":3,"file":"utils/createModelField.js","sources":["../../src/utils/createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase.js\";\nimport type { CmsModelField, CmsModelFieldValidation } from \"~/types/index.js\";\n\nexport interface CreateModelFieldParams extends Omit<\n CmsModelField,\n \"id\" | \"storageId\" | \"fieldId\" | \"validation\" | \"listValidation\"\n> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n validation?: CmsModelFieldValidation[];\n listValidation?: CmsModelFieldValidation[];\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags = [],\n settings = {},\n listValidation = [],\n validation = [],\n list = false,\n disabled = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n help = null,\n placeholder = null,\n renderer = null,\n rules = []\n } = params;\n\n // TODO: ideally, initialFieldId should also be passed through `camelCase` but currently this would break `wbyAco_location` field.\n // TODO: Once this legacy field is removed, we can enable camelCase on the initialFieldId.\n const fieldId = initialFieldId ? initialFieldId : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${id ?? fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n list,\n disabled,\n predefinedValues,\n help,\n placeholder,\n renderer,\n rules\n };\n};\n"],"names":["createModelField","params","id","label","initialFieldId","storageId","type","tags","settings","listValidation","validation","list","disabled","predefinedValues","help","placeholder","renderer","rules","fieldId","camelCase"],"mappings":";AAcO,MAAMA,mBAAmB,CAACC;IAG7B,MAAM,EACFC,EAAE,EACFC,KAAK,EACL,SAASC,cAAc,EACvBC,SAAS,EACTC,IAAI,EACJC,OAAO,EAAE,EACTC,WAAW,CAAC,CAAC,EACbC,iBAAiB,EAAE,EACnBC,aAAa,EAAE,EACfC,OAAO,KAAK,EACZC,WAAW,KAAK,EAChBC,mBAAmB;QACf,QAAQ,EAAE;QACV,SAAS;IACb,CAAC,EACDC,OAAO,IAAI,EACXC,cAAc,IAAI,EAClBC,WAAW,IAAI,EACfC,QAAQ,EAAE,EACb,GAAGhB;IAIJ,MAAMiB,UAAUd,iBAAiBA,iBAAiBe,UAAUhB;IAE5D,OAAO;QACH,IAAID,MAAMgB;QACV,WAAWb,aAAa,GAAGC,KAAK,CAAC,EAAEJ,MAAMgB,SAAS;QAClDA;QACAf;QACAG;QACAE;QACAD;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACJ;AACJ"}
|