@webiny/api-headless-cms 6.1.0-beta.3 → 6.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/context.d.ts +2 -5
- package/context.js +16 -7
- package/context.js.map +1 -1
- package/crud/AccessControl/AccessControl.d.ts +18 -28
- package/crud/AccessControl/AccessControl.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryData.js +17 -6
- package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js +9 -3
- package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
- package/crud/contentEntry/entryDataValidation.d.ts +1 -1
- package/crud/contentEntry/entryDataValidation.js +16 -13
- package/crud/contentEntry/entryDataValidation.js.map +1 -1
- package/crud/contentEntry/searchableFields.d.ts +2 -3
- package/crud/contentEntry/searchableFields.js +10 -18
- package/crud/contentEntry/searchableFields.js.map +1 -1
- package/crud/contentModel.crud.js +2 -1
- package/crud/contentModel.crud.js.map +1 -1
- package/domain/contentModel/validation/modelFields.js +15 -20
- package/domain/contentModel/validation/modelFields.js.map +1 -1
- package/exports/api/cms/graphql.d.ts +1 -0
- package/exports/api/cms/graphql.js +3 -0
- package/exports/api/cms/graphql.js.map +1 -0
- package/exports/api/cms/storage.d.ts +3 -0
- package/exports/api/cms/storage.js +5 -0
- package/exports/api/cms/storage.js.map +1 -0
- package/exports/api/cms/validation.d.ts +4 -0
- package/exports/api/cms/validation.js +6 -0
- package/exports/api/cms/validation.js.map +1 -0
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +3 -3
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +3 -3
- package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntry/events.d.ts +2 -2
- package/features/contentEntry/CreateEntry/events.js +1 -1
- package/features/contentEntry/CreateEntry/events.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +3 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +3 -3
- package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/events.d.ts +2 -2
- package/features/contentEntry/CreateEntryRevisionFrom/events.js +1 -1
- package/features/contentEntry/CreateEntryRevisionFrom/events.js.map +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +1 -1
- package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.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/DeleteEntry/events.d.ts +2 -2
- package/features/contentEntry/DeleteEntry/events.js +1 -1
- package/features/contentEntry/DeleteEntry/events.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +1 -1
- package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
- package/features/contentEntry/DeleteEntryRevision/events.d.ts +2 -2
- package/features/contentEntry/DeleteEntryRevision/events.js +1 -1
- package/features/contentEntry/DeleteEntryRevision/events.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +1 -1
- package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
- package/features/contentEntry/DeleteMultipleEntries/events.d.ts +2 -2
- package/features/contentEntry/DeleteMultipleEntries/events.js +1 -1
- package/features/contentEntry/DeleteMultipleEntries/events.js.map +1 -1
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +6 -11
- package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
- package/features/contentEntry/ListEntries/ListEntriesUseCase.d.ts +1 -1
- package/features/contentEntry/ListEntries/ListEntriesUseCase.js +1 -1
- package/features/contentEntry/ListEntries/ListEntriesUseCase.js.map +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +1 -1
- package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
- package/features/contentEntry/MoveEntry/events.d.ts +2 -2
- package/features/contentEntry/MoveEntry/events.js +1 -1
- package/features/contentEntry/MoveEntry/events.js.map +1 -1
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +2 -2
- package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/PublishEntry/events.d.ts +2 -2
- package/features/contentEntry/PublishEntry/events.js +1 -1
- package/features/contentEntry/PublishEntry/events.js.map +1 -1
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +2 -2
- package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/RepublishEntry/events.d.ts +2 -2
- package/features/contentEntry/RepublishEntry/events.js +1 -1
- package/features/contentEntry/RepublishEntry/events.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/RestoreEntryFromBin/events.d.ts +2 -2
- package/features/contentEntry/RestoreEntryFromBin/events.js +1 -1
- package/features/contentEntry/RestoreEntryFromBin/events.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +2 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +2 -2
- package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
- package/features/contentEntry/UnpublishEntry/events.d.ts +2 -2
- package/features/contentEntry/UnpublishEntry/events.js +1 -1
- package/features/contentEntry/UnpublishEntry/events.js.map +1 -1
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +3 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +3 -3
- package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
- package/features/contentEntry/UpdateEntry/events.d.ts +2 -2
- package/features/contentEntry/UpdateEntry/events.js +1 -1
- package/features/contentEntry/UpdateEntry/events.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.d.ts +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.js +1 -1
- package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
- package/features/contentModel/CreateModel/CreateModelUseCase.d.ts +3 -3
- package/features/contentModel/CreateModel/CreateModelUseCase.js +3 -3
- package/features/contentModel/CreateModel/CreateModelUseCase.js.map +1 -1
- package/features/contentModel/CreateModel/events.d.ts +2 -2
- package/features/contentModel/CreateModel/events.js +1 -1
- package/features/contentModel/CreateModel/events.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.d.ts +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
- package/features/contentModel/CreateModelFrom/CreateModelFromUseCase.d.ts +3 -3
- package/features/contentModel/CreateModelFrom/CreateModelFromUseCase.js +4 -3
- package/features/contentModel/CreateModelFrom/CreateModelFromUseCase.js.map +1 -1
- package/features/contentModel/CreateModelFrom/events.d.ts +2 -2
- package/features/contentModel/CreateModelFrom/events.js +1 -1
- package/features/contentModel/CreateModelFrom/events.js.map +1 -1
- package/features/contentModel/DeleteModel/DeleteModelUseCase.d.ts +1 -1
- package/features/contentModel/DeleteModel/DeleteModelUseCase.js +1 -1
- package/features/contentModel/DeleteModel/DeleteModelUseCase.js.map +1 -1
- package/features/contentModel/DeleteModel/events.d.ts +2 -2
- package/features/contentModel/DeleteModel/events.js +1 -1
- package/features/contentModel/DeleteModel/events.js.map +1 -1
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.d.ts +3 -3
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js +6 -6
- package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js.map +1 -1
- package/features/contentModel/UpdateModel/UpdateModelUseCase.d.ts +2 -2
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js +2 -2
- package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
- package/features/contentModel/UpdateModel/events.d.ts +2 -2
- package/features/contentModel/UpdateModel/events.js +1 -1
- package/features/contentModel/UpdateModel/events.js.map +1 -1
- package/features/contentModel/shared/ModelsFetcher.d.ts +1 -1
- package/features/contentModel/shared/ModelsFetcher.js +1 -1
- package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.d.ts +3 -3
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js +3 -3
- package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/CreateGroup/events.d.ts +2 -2
- package/features/contentModelGroup/CreateGroup/events.js +1 -1
- package/features/contentModelGroup/CreateGroup/events.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.d.ts +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js +1 -1
- package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/DeleteGroup/events.d.ts +2 -2
- package/features/contentModelGroup/DeleteGroup/events.js +1 -1
- package/features/contentModelGroup/DeleteGroup/events.js.map +1 -1
- package/features/contentModelGroup/GetGroup/GetGroupRepository.d.ts +2 -2
- package/features/contentModelGroup/GetGroup/GetGroupRepository.js +2 -2
- package/features/contentModelGroup/GetGroup/GetGroupRepository.js.map +1 -1
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.d.ts +2 -2
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.js +2 -2
- package/features/contentModelGroup/ListGroups/ListGroupsRepository.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.d.ts +2 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +2 -2
- package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js.map +1 -1
- package/features/contentModelGroup/UpdateGroup/events.d.ts +2 -2
- package/features/contentModelGroup/UpdateGroup/events.js +1 -1
- package/features/contentModelGroup/UpdateGroup/events.js.map +1 -1
- package/features/contentModelGroup/shared/PluginGroupsProvider.d.ts +2 -2
- package/features/contentModelGroup/shared/PluginGroupsProvider.js +2 -2
- package/features/contentModelGroup/shared/PluginGroupsProvider.js.map +1 -1
- package/features/graphql/feature.d.ts +1 -0
- package/features/graphql/feature.js +34 -0
- package/features/graphql/feature.js.map +1 -0
- package/features/graphql/fields/CmsModelFieldToGraphQLRegistry.d.ts +13 -0
- package/features/graphql/fields/CmsModelFieldToGraphQLRegistry.js +27 -0
- package/features/graphql/fields/CmsModelFieldToGraphQLRegistry.js.map +1 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.d.ts +97 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js +4 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js.map +1 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.d.ts +10 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js +4 -0
- package/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js.map +1 -0
- package/features/graphql/fields/base/BooleanToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/BooleanToGraphQL.js +68 -0
- package/features/graphql/fields/base/BooleanToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/DateTimeToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/DateTimeToGraphQL.js +97 -0
- package/features/graphql/fields/base/DateTimeToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.d.ts +30 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js +280 -0
- package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/FileToGraphQL.d.ts +22 -0
- package/features/graphql/fields/base/FileToGraphQL.js +39 -0
- package/features/graphql/fields/base/FileToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/JsonToGraphQL.d.ts +24 -0
- package/features/graphql/fields/base/JsonToGraphQL.js +52 -0
- package/features/graphql/fields/base/JsonToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/LongTextToGraphQL.d.ts +24 -0
- package/features/graphql/fields/base/LongTextToGraphQL.js +57 -0
- package/features/graphql/fields/base/LongTextToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/NumberToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/NumberToGraphQL.js +78 -0
- package/features/graphql/fields/base/NumberToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/ObjectToGraphQL.d.ts +31 -0
- package/features/graphql/fields/base/ObjectToGraphQL.js +264 -0
- package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/RefToGraphQL.d.ts +29 -0
- package/features/graphql/fields/base/RefToGraphQL.js +261 -0
- package/features/graphql/fields/base/RefToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/RichTextToGraphQL.d.ts +25 -0
- package/features/graphql/fields/base/RichTextToGraphQL.js +58 -0
- package/features/graphql/fields/base/RichTextToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/SearchableJsonToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/SearchableJsonToGraphQL.js +62 -0
- package/features/graphql/fields/base/SearchableJsonToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/TextToGraphQL.d.ts +26 -0
- package/features/graphql/fields/base/TextToGraphQL.js +74 -0
- package/features/graphql/fields/base/TextToGraphQL.js.map +1 -0
- package/features/graphql/fields/base/dynamicZone/createTypeDefsForTemplates.d.ts +16 -0
- package/features/graphql/fields/base/dynamicZone/createTypeDefsForTemplates.js +37 -0
- package/features/graphql/fields/base/dynamicZone/createTypeDefsForTemplates.js.map +1 -0
- package/features/graphql/fields/base/dynamicZone/normalizeDynamicZoneInput.d.ts +3 -0
- package/features/graphql/fields/base/dynamicZone/normalizeDynamicZoneInput.js +14 -0
- package/features/graphql/fields/base/dynamicZone/normalizeDynamicZoneInput.js.map +1 -0
- package/{graphqlFields → features/graphql/fields/base}/richText/richTextResolver.d.ts +1 -1
- package/{graphqlFields → features/graphql/fields/base}/richText/richTextResolver.js +2 -2
- package/features/graphql/fields/base/richText/richTextResolver.js.map +1 -0
- package/{graphqlFields/helpers.d.ts → features/graphql/fields/base/utils/createGraphQLInputField.d.ts} +1 -1
- package/features/graphql/fields/base/utils/createGraphQLInputField.js +17 -0
- package/features/graphql/fields/base/utils/createGraphQLInputField.js.map +1 -0
- package/features/graphql/index.d.ts +4 -0
- package/features/graphql/index.js +6 -0
- package/features/graphql/index.js.map +1 -0
- package/features/graphql/sort/abstractions/CmsGraphQLSchemaSorter.d.ts +13 -0
- package/features/graphql/sort/abstractions/CmsGraphQLSchemaSorter.js +4 -0
- package/features/graphql/sort/abstractions/CmsGraphQLSchemaSorter.js.map +1 -0
- package/features/installer/CmsInstaller.d.ts +1 -1
- package/features/installer/CmsInstaller.js +1 -1
- package/features/installer/CmsInstaller.js.map +1 -1
- package/features/shared/abstractions.d.ts +9 -2
- package/features/shared/abstractions.js +1 -0
- package/features/shared/abstractions.js.map +1 -1
- package/features/storage/StorageTransformRegistry.d.ts +13 -0
- package/features/storage/StorageTransformRegistry.js +27 -0
- package/features/storage/StorageTransformRegistry.js.map +1 -0
- package/features/storage/abstractions/StorageTransform.d.ts +26 -0
- package/features/storage/abstractions/StorageTransform.js +4 -0
- package/features/storage/abstractions/StorageTransform.js.map +1 -0
- package/features/storage/abstractions/StorageTransformRegistry.d.ts +10 -0
- package/features/storage/abstractions/StorageTransformRegistry.js +4 -0
- package/features/storage/abstractions/StorageTransformRegistry.js.map +1 -0
- package/features/storage/feature.d.ts +1 -0
- package/features/storage/feature.js +24 -0
- package/features/storage/feature.js.map +1 -0
- package/features/storage/fields/DateStorageTransform.d.ts +10 -0
- package/features/storage/fields/DateStorageTransform.js +110 -0
- package/features/storage/fields/DateStorageTransform.js.map +1 -0
- package/features/storage/fields/DefaultStorageTransform.d.ts +10 -0
- package/features/storage/fields/DefaultStorageTransform.js +20 -0
- package/features/storage/fields/DefaultStorageTransform.js.map +1 -0
- package/features/storage/fields/DynamicZoneStorageTransform.d.ts +10 -0
- package/features/storage/fields/DynamicZoneStorageTransform.js +142 -0
- package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -0
- package/features/storage/fields/JsonStorageTransform.d.ts +13 -0
- package/features/storage/fields/JsonStorageTransform.js +31 -0
- package/features/storage/fields/JsonStorageTransform.js.map +1 -0
- package/features/storage/fields/LongTextStorageTransform.d.ts +18 -0
- package/features/storage/fields/LongTextStorageTransform.js +55 -0
- package/features/storage/fields/LongTextStorageTransform.js.map +1 -0
- package/features/storage/fields/ObjectStorageTransform.d.ts +10 -0
- package/features/storage/fields/ObjectStorageTransform.js +99 -0
- package/features/storage/fields/ObjectStorageTransform.js.map +1 -0
- package/features/storage/fields/RichTextStorageTransform.d.ts +13 -0
- package/features/storage/fields/RichTextStorageTransform.js +39 -0
- package/features/storage/fields/RichTextStorageTransform.js.map +1 -0
- package/features/storage/index.d.ts +3 -0
- package/features/storage/index.js +5 -0
- package/features/storage/index.js.map +1 -0
- package/features/validation/CmsModelFieldPatternValidatorRegistry.d.ts +12 -0
- package/features/validation/CmsModelFieldPatternValidatorRegistry.js +21 -0
- package/features/validation/CmsModelFieldPatternValidatorRegistry.js.map +1 -0
- package/features/validation/CmsModelFieldValidatorRegistry.d.ts +12 -0
- package/features/validation/CmsModelFieldValidatorRegistry.js +23 -0
- package/features/validation/CmsModelFieldValidatorRegistry.js.map +1 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidator.d.ts +13 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidator.js +4 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidator.js.map +1 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidatorRegistry.d.ts +9 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidatorRegistry.js +4 -0
- package/features/validation/abstractions/CmsModelFieldPatternValidatorRegistry.js.map +1 -0
- package/features/validation/abstractions/CmsModelFieldValidator.d.ts +11 -0
- package/features/validation/abstractions/CmsModelFieldValidator.js +4 -0
- package/features/validation/abstractions/CmsModelFieldValidator.js.map +1 -0
- package/features/validation/abstractions/CmsModelFieldValidatorRegistry.d.ts +9 -0
- package/features/validation/abstractions/CmsModelFieldValidatorRegistry.js +4 -0
- package/features/validation/abstractions/CmsModelFieldValidatorRegistry.js.map +1 -0
- package/features/validation/feature.d.ts +1 -0
- package/features/validation/feature.js +48 -0
- package/features/validation/feature.js.map +1 -0
- package/features/validation/index.d.ts +5 -0
- package/features/validation/index.js +7 -0
- package/features/validation/index.js.map +1 -0
- package/features/validation/validators/DateGteValidator.d.ts +10 -0
- package/features/validation/validators/DateGteValidator.js +26 -0
- package/features/validation/validators/DateGteValidator.js.map +1 -0
- package/features/validation/validators/DateLteValidator.d.ts +10 -0
- package/features/validation/validators/DateLteValidator.js +26 -0
- package/features/validation/validators/DateLteValidator.js.map +1 -0
- package/features/validation/validators/GteValidator.d.ts +10 -0
- package/features/validation/validators/GteValidator.js +21 -0
- package/features/validation/validators/GteValidator.js.map +1 -0
- package/features/validation/validators/InValidator.d.ts +10 -0
- package/features/validation/validators/InValidator.js +21 -0
- package/features/validation/validators/InValidator.js.map +1 -0
- package/features/validation/validators/LteValidator.d.ts +10 -0
- package/features/validation/validators/LteValidator.js +21 -0
- package/features/validation/validators/LteValidator.js.map +1 -0
- package/features/validation/validators/MaxLengthValidator.d.ts +10 -0
- package/features/validation/validators/MaxLengthValidator.js +21 -0
- package/features/validation/validators/MaxLengthValidator.js.map +1 -0
- package/features/validation/validators/MinLengthValidator.d.ts +10 -0
- package/features/validation/validators/MinLengthValidator.js +21 -0
- package/features/validation/validators/MinLengthValidator.js.map +1 -0
- package/features/validation/validators/PatternValidator.d.ts +13 -0
- package/features/validation/validators/PatternValidator.js +38 -0
- package/features/validation/validators/PatternValidator.js.map +1 -0
- package/features/validation/validators/RequiredValidator.d.ts +10 -0
- package/features/validation/validators/RequiredValidator.js +16 -0
- package/features/validation/validators/RequiredValidator.js.map +1 -0
- package/features/validation/validators/TimeGteValidator.d.ts +10 -0
- package/features/validation/validators/TimeGteValidator.js +21 -0
- package/features/validation/validators/TimeGteValidator.js.map +1 -0
- package/features/validation/validators/TimeLteValidator.d.ts +10 -0
- package/features/validation/validators/TimeLteValidator.js +21 -0
- package/features/validation/validators/TimeLteValidator.js.map +1 -0
- package/features/validation/validators/UniqueValidator.d.ts +10 -0
- package/features/validation/validators/UniqueValidator.js +47 -0
- package/features/validation/validators/UniqueValidator.js.map +1 -0
- package/features/validation/validators/patterns/EmailPattern.d.ts +12 -0
- package/features/validation/validators/patterns/EmailPattern.js +14 -0
- package/features/validation/validators/patterns/EmailPattern.js.map +1 -0
- package/features/validation/validators/patterns/LowerCasePattern.d.ts +12 -0
- package/features/validation/validators/patterns/LowerCasePattern.js +14 -0
- package/features/validation/validators/patterns/LowerCasePattern.js.map +1 -0
- package/features/validation/validators/patterns/LowerCaseSpacePattern.d.ts +12 -0
- package/features/validation/validators/patterns/LowerCaseSpacePattern.js +14 -0
- package/features/validation/validators/patterns/LowerCaseSpacePattern.js.map +1 -0
- package/features/validation/validators/patterns/UpperCasePattern.d.ts +12 -0
- package/features/validation/validators/patterns/UpperCasePattern.js +14 -0
- package/features/validation/validators/patterns/UpperCasePattern.js.map +1 -0
- package/features/validation/validators/patterns/UpperCaseSpacePattern.d.ts +12 -0
- package/features/validation/validators/patterns/UpperCaseSpacePattern.js +14 -0
- package/features/validation/validators/patterns/UpperCaseSpacePattern.js.map +1 -0
- package/features/validation/validators/patterns/UrlPattern.d.ts +12 -0
- package/features/validation/validators/patterns/UrlPattern.js +14 -0
- package/features/validation/validators/patterns/UrlPattern.js.map +1 -0
- package/graphql/getSchema/generateCacheKey.js +1 -1
- package/graphql/getSchema/generateCacheKey.js.map +1 -1
- package/graphql/schema/baseSchema.d.ts +2 -1
- package/graphql/schema/baseSchema.js +11 -9
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/createFieldResolvers.d.ts +3 -2
- package/graphql/schema/createFieldResolvers.js +5 -4
- package/graphql/schema/createFieldResolvers.js.map +1 -1
- package/graphql/schema/createManageResolvers.d.ts +3 -2
- package/graphql/schema/createManageResolvers.js +3 -3
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.d.ts +4 -4
- package/graphql/schema/createManageSDL.js +8 -8
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createPreviewResolvers.d.ts +3 -2
- package/graphql/schema/createPreviewResolvers.js +4 -4
- package/graphql/schema/createPreviewResolvers.js.map +1 -1
- package/graphql/schema/createReadResolvers.d.ts +3 -2
- package/graphql/schema/createReadResolvers.js +4 -4
- package/graphql/schema/createReadResolvers.js.map +1 -1
- package/graphql/schema/createReadSDL.d.ts +4 -4
- package/graphql/schema/createReadSDL.js +7 -7
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/createSingularResolvers.d.ts +3 -2
- package/graphql/schema/createSingularResolvers.js +3 -3
- package/graphql/schema/createSingularResolvers.js.map +1 -1
- package/graphql/schema/createSingularSDL.d.ts +3 -2
- package/graphql/schema/createSingularSDL.js +3 -3
- package/graphql/schema/createSingularSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js +6 -7
- package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js.map +1 -1
- package/graphql/schema/schemaPlugins.js +14 -17
- package/graphql/schema/schemaPlugins.js.map +1 -1
- package/index.d.ts +1 -4
- package/index.js +2 -6
- package/index.js.map +1 -1
- package/package.json +25 -25
- package/plugins/index.d.ts +0 -2
- package/plugins/index.js +0 -2
- package/plugins/index.js.map +1 -1
- package/types/modelField.d.ts +1 -1
- package/types/modelField.js.map +1 -1
- package/types/plugins.d.ts +1 -305
- package/types/plugins.js.map +1 -1
- package/types/types.d.ts +4 -44
- package/types/types.js +0 -4
- package/types/types.js.map +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +3 -2
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js +3 -3
- package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -1
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +4 -3
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js +3 -3
- package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -1
- package/utils/converters/ConverterCollection.d.ts +2 -0
- package/utils/converters/ConverterCollection.js +3 -2
- package/utils/converters/ConverterCollection.js.map +1 -1
- package/utils/converters/valueKeyFromStorageConverter.d.ts +2 -0
- package/utils/converters/valueKeyFromStorageConverter.js +4 -2
- package/utils/converters/valueKeyFromStorageConverter.js.map +1 -1
- package/utils/converters/valueKeyStorageConverter.d.ts +2 -3
- package/utils/converters/valueKeyStorageConverter.js +7 -3
- package/utils/converters/valueKeyStorageConverter.js.map +1 -1
- package/utils/converters/valueKeyToStorageConverter.d.ts +2 -0
- package/utils/converters/valueKeyToStorageConverter.js +4 -2
- package/utils/converters/valueKeyToStorageConverter.js.map +1 -1
- package/utils/createTypeFromFields.d.ts +3 -2
- package/utils/createTypeFromFields.js +3 -3
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/entryStorage.d.ts +8 -15
- package/utils/entryStorage.js +31 -59
- package/utils/entryStorage.js.map +1 -1
- package/utils/getBaseFieldType.js +3 -0
- package/utils/getBaseFieldType.js.map +1 -1
- package/utils/getSchemaFromFieldPlugins.d.ts +3 -2
- package/utils/getSchemaFromFieldPlugins.js +5 -9
- package/utils/getSchemaFromFieldPlugins.js.map +1 -1
- package/utils/renderFields.d.ts +4 -3
- package/utils/renderFields.js +14 -9
- package/utils/renderFields.js.map +1 -1
- package/utils/renderGetFilterFields.d.ts +3 -2
- package/utils/renderGetFilterFields.js +2 -2
- package/utils/renderGetFilterFields.js.map +1 -1
- package/utils/renderInputFields.d.ts +4 -3
- package/utils/renderInputFields.js +5 -11
- package/utils/renderInputFields.js.map +1 -1
- package/utils/renderListFilterFields.d.ts +3 -2
- package/utils/renderListFilterFields.js +5 -3
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +4 -4
- package/utils/renderSortEnum.js +11 -11
- package/utils/renderSortEnum.js.map +1 -1
- package/graphql/schema/createFieldTypePluginRecords.d.ts +0 -3
- package/graphql/schema/createFieldTypePluginRecords.js +0 -8
- package/graphql/schema/createFieldTypePluginRecords.js.map +0 -1
- package/graphqlFields/boolean.d.ts +0 -2
- package/graphqlFields/boolean.js +0 -52
- package/graphqlFields/boolean.js.map +0 -1
- package/graphqlFields/datetime.d.ts +0 -2
- package/graphqlFields/datetime.js +0 -71
- package/graphqlFields/datetime.js.map +0 -1
- package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +0 -2
- package/graphqlFields/dynamicZone/dynamicZoneField.js +0 -313
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +0 -1
- package/graphqlFields/dynamicZone/index.d.ts +0 -1
- package/graphqlFields/dynamicZone/index.js +0 -3
- package/graphqlFields/dynamicZone/index.js.map +0 -1
- package/graphqlFields/file.d.ts +0 -2
- package/graphqlFields/file.js +0 -37
- package/graphqlFields/file.js.map +0 -1
- package/graphqlFields/helpers.js +0 -20
- package/graphqlFields/helpers.js.map +0 -1
- package/graphqlFields/index.d.ts +0 -2
- package/graphqlFields/index.js +0 -15
- package/graphqlFields/index.js.map +0 -1
- package/graphqlFields/json.d.ts +0 -2
- package/graphqlFields/json.js +0 -42
- package/graphqlFields/json.js.map +0 -1
- package/graphqlFields/longText.d.ts +0 -2
- package/graphqlFields/longText.js +0 -57
- package/graphqlFields/longText.js.map +0 -1
- package/graphqlFields/number.d.ts +0 -2
- package/graphqlFields/number.js +0 -63
- package/graphqlFields/number.js.map +0 -1
- package/graphqlFields/object.d.ts +0 -2
- package/graphqlFields/object.js +0 -245
- package/graphqlFields/object.js.map +0 -1
- package/graphqlFields/ref.d.ts +0 -2
- package/graphqlFields/ref.js +0 -286
- package/graphqlFields/ref.js.map +0 -1
- package/graphqlFields/richText/richTextResolver.js.map +0 -1
- package/graphqlFields/richText.d.ts +0 -2
- package/graphqlFields/richText.js +0 -48
- package/graphqlFields/richText.js.map +0 -1
- package/graphqlFields/searchableJson.d.ts +0 -2
- package/graphqlFields/searchableJson.js +0 -53
- package/graphqlFields/searchableJson.js.map +0 -1
- package/graphqlFields/text.d.ts +0 -2
- package/graphqlFields/text.js +0 -59
- package/graphqlFields/text.js.map +0 -1
- package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +0 -20
- package/plugins/CmsGraphQLSchemaSorterPlugin.js +0 -19
- package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +0 -1
- package/plugins/StorageTransformPlugin.d.ts +0 -35
- package/plugins/StorageTransformPlugin.js +0 -26
- package/plugins/StorageTransformPlugin.js.map +0 -1
- package/storage/date.d.ts +0 -3
- package/storage/date.js +0 -110
- package/storage/date.js.map +0 -1
- package/storage/default.d.ts +0 -2
- package/storage/default.js +0 -19
- package/storage/default.js.map +0 -1
- package/storage/dynamicZone.d.ts +0 -2
- package/storage/dynamicZone.js +0 -149
- package/storage/dynamicZone.js.map +0 -1
- package/storage/index.d.ts +0 -1
- package/storage/index.js +0 -13
- package/storage/index.js.map +0 -1
- package/storage/json.d.ts +0 -2
- package/storage/json.js +0 -49
- package/storage/json.js.map +0 -1
- package/storage/object.d.ts +0 -2
- package/storage/object.js +0 -104
- package/storage/object.js.map +0 -1
- package/validators/dateGte.d.ts +0 -2
- package/validators/dateGte.js +0 -25
- package/validators/dateGte.js.map +0 -1
- package/validators/dateLte.d.ts +0 -2
- package/validators/dateLte.js +0 -25
- package/validators/dateLte.js.map +0 -1
- package/validators/gte.d.ts +0 -2
- package/validators/gte.js +0 -22
- package/validators/gte.js.map +0 -1
- package/validators/in.d.ts +0 -2
- package/validators/in.js +0 -22
- package/validators/in.js.map +0 -1
- package/validators/index.d.ts +0 -1
- package/validators/index.js +0 -16
- package/validators/index.js.map +0 -1
- package/validators/lte.d.ts +0 -2
- package/validators/lte.js +0 -22
- package/validators/lte.js.map +0 -1
- package/validators/maxLength.d.ts +0 -2
- package/validators/maxLength.js +0 -22
- package/validators/maxLength.js.map +0 -1
- package/validators/minLength.d.ts +0 -2
- package/validators/minLength.js +0 -22
- package/validators/minLength.js.map +0 -1
- package/validators/pattern.d.ts +0 -2
- package/validators/pattern.js +0 -36
- package/validators/pattern.js.map +0 -1
- package/validators/patternPlugins/email.d.ts +0 -2
- package/validators/patternPlugins/email.js +0 -13
- package/validators/patternPlugins/email.js.map +0 -1
- package/validators/patternPlugins/index.d.ts +0 -2
- package/validators/patternPlugins/index.js +0 -11
- package/validators/patternPlugins/index.js.map +0 -1
- package/validators/patternPlugins/lowerCase.d.ts +0 -2
- package/validators/patternPlugins/lowerCase.js +0 -13
- package/validators/patternPlugins/lowerCase.js.map +0 -1
- package/validators/patternPlugins/lowerCaseSpace.d.ts +0 -2
- package/validators/patternPlugins/lowerCaseSpace.js +0 -13
- package/validators/patternPlugins/lowerCaseSpace.js.map +0 -1
- package/validators/patternPlugins/upperCase.d.ts +0 -2
- package/validators/patternPlugins/upperCase.js +0 -13
- package/validators/patternPlugins/upperCase.js.map +0 -1
- package/validators/patternPlugins/upperCaseSpace.d.ts +0 -2
- package/validators/patternPlugins/upperCaseSpace.js +0 -13
- package/validators/patternPlugins/upperCaseSpace.js.map +0 -1
- package/validators/patternPlugins/url.d.ts +0 -2
- package/validators/patternPlugins/url.js +0 -13
- package/validators/patternPlugins/url.js.map +0 -1
- package/validators/required.d.ts +0 -2
- package/validators/required.js +0 -17
- package/validators/required.js.map +0 -1
- package/validators/timeGte.d.ts +0 -2
- package/validators/timeGte.js +0 -20
- package/validators/timeGte.js.map +0 -1
- package/validators/timeLte.d.ts +0 -2
- package/validators/timeLte.js +0 -20
- package/validators/timeLte.js.map +0 -1
- package/validators/unique.d.ts +0 -6
- package/validators/unique.js +0 -57
- package/validators/unique.js.map +0 -1
package/graphqlFields/ref.js
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import WebinyError from "@webiny/error";
|
|
2
|
-
import { createTypeName } from "../utils/createTypeName.js";
|
|
3
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
4
|
-
import { createGraphQLInputField } from "./helpers.js";
|
|
5
|
-
import { GetModelUseCase } from "../features/contentModel/GetModel/index.js";
|
|
6
|
-
import { GetPublishedEntriesByIdsUseCase } from "../features/contentEntry/GetPublishedEntriesByIds/index.js";
|
|
7
|
-
import { GetLatestEntriesByIdsUseCase } from "../features/contentEntry/GetLatestEntriesByIds/index.js";
|
|
8
|
-
const createUnionTypeName = (model, field) => {
|
|
9
|
-
return `${model.singularApiName}_${createTypeName(field.fieldId)}`;
|
|
10
|
-
};
|
|
11
|
-
const createListFilters = ({
|
|
12
|
-
field
|
|
13
|
-
}) => {
|
|
14
|
-
return `
|
|
15
|
-
${field.fieldId}: RefFieldWhereInput
|
|
16
|
-
`;
|
|
17
|
-
};
|
|
18
|
-
const createFilteringTypeDef = () => {
|
|
19
|
-
return `
|
|
20
|
-
input RefFieldWhereInput {
|
|
21
|
-
id: String
|
|
22
|
-
id_not: String
|
|
23
|
-
id_in: [String!]
|
|
24
|
-
id_not_in: [String]
|
|
25
|
-
entryId: String
|
|
26
|
-
entryId_not: String
|
|
27
|
-
entryId_in: [String!]
|
|
28
|
-
entryId_not_in: [String!]
|
|
29
|
-
modelId: String
|
|
30
|
-
modelId_not: String
|
|
31
|
-
modelId_in: [String!]
|
|
32
|
-
modelId_not_in: [String!]
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
};
|
|
36
|
-
const appendTypename = (entries, typename) => {
|
|
37
|
-
return entries.map(item => {
|
|
38
|
-
return {
|
|
39
|
-
...item,
|
|
40
|
-
__typename: typename
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* We cast settings.models as object to have modelId because internally we know that it is so.
|
|
46
|
-
* Internal stuff so we are sure that settings.models contains what we require.
|
|
47
|
-
*/
|
|
48
|
-
const getFieldModels = field => {
|
|
49
|
-
if (!field.settings || Array.isArray(field.settings.models) === false) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
return field.settings.models;
|
|
53
|
-
};
|
|
54
|
-
const modelIdToTypeName = new Map();
|
|
55
|
-
const getModel = params => {
|
|
56
|
-
const {
|
|
57
|
-
models,
|
|
58
|
-
modelId
|
|
59
|
-
} = params;
|
|
60
|
-
const model = models.find(item => item.modelId === modelId);
|
|
61
|
-
if (model) {
|
|
62
|
-
return model;
|
|
63
|
-
}
|
|
64
|
-
throw new WebinyError(`Could not find model with ID "${modelId}" in the list of models.`, "MODEL_NOT_FOUND", {
|
|
65
|
-
modelId
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const getModelSingularApiName = params => {
|
|
69
|
-
const model = getModel(params);
|
|
70
|
-
return model.singularApiName;
|
|
71
|
-
};
|
|
72
|
-
export const createRefField = () => {
|
|
73
|
-
return {
|
|
74
|
-
name: "cms-model-field-to-graphql-ref",
|
|
75
|
-
type: "cms-model-field-to-graphql",
|
|
76
|
-
fieldType: "ref",
|
|
77
|
-
isSortable: false,
|
|
78
|
-
isSearchable: true,
|
|
79
|
-
read: {
|
|
80
|
-
createTypeField({
|
|
81
|
-
model,
|
|
82
|
-
field,
|
|
83
|
-
models
|
|
84
|
-
}) {
|
|
85
|
-
const fieldModels = field.settings?.models || [];
|
|
86
|
-
const gqlType = fieldModels.length > 1 ? createUnionTypeName(model, field) : getModelSingularApiName({
|
|
87
|
-
models,
|
|
88
|
-
modelId: fieldModels[0].modelId
|
|
89
|
-
});
|
|
90
|
-
const typeDefs = fieldModels.length > 1 ? `union ${gqlType} = ${getFieldModels(field).map(({
|
|
91
|
-
modelId
|
|
92
|
-
}) => getModelSingularApiName({
|
|
93
|
-
models,
|
|
94
|
-
modelId
|
|
95
|
-
})).join(" | ")}` : "";
|
|
96
|
-
return {
|
|
97
|
-
fields: field.fieldId + `(populate: Boolean = true): ${field.list ? `[${gqlType}!]` : gqlType}`,
|
|
98
|
-
typeDefs
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* TS is complaining about mixed types for createResolver.
|
|
103
|
-
* TODO @ts-refactor @pavel Maybe we should have a single createResolver method?
|
|
104
|
-
*/
|
|
105
|
-
// @ts-expect-error
|
|
106
|
-
createResolver({
|
|
107
|
-
field,
|
|
108
|
-
models
|
|
109
|
-
}) {
|
|
110
|
-
// Create a map of model types and corresponding modelIds so resolvers don't need to perform the lookup.
|
|
111
|
-
const fieldModels = field.settings?.models || [];
|
|
112
|
-
for (const item of fieldModels) {
|
|
113
|
-
modelIdToTypeName.set(item.modelId, getModelSingularApiName({
|
|
114
|
-
models,
|
|
115
|
-
modelId: item.modelId
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get value either from values or root - just in case.
|
|
120
|
-
*/
|
|
121
|
-
const getValue = parent => {
|
|
122
|
-
if (parent.values) {
|
|
123
|
-
return parent.values[field.fieldId];
|
|
124
|
-
}
|
|
125
|
-
return parent[field.fieldId];
|
|
126
|
-
};
|
|
127
|
-
return async (parent, args, context) => {
|
|
128
|
-
const {
|
|
129
|
-
cms,
|
|
130
|
-
container
|
|
131
|
-
} = context;
|
|
132
|
-
const getModel = container.resolve(GetModelUseCase);
|
|
133
|
-
const getPublishedByIds = container.resolve(GetPublishedEntriesByIdsUseCase);
|
|
134
|
-
const getLatestByIds = container.resolve(GetLatestEntriesByIdsUseCase);
|
|
135
|
-
|
|
136
|
-
// Get field value for this entry
|
|
137
|
-
const initialValue = getValue(parent);
|
|
138
|
-
if (!initialValue) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
if (args.populate === false) {
|
|
142
|
-
return initialValue;
|
|
143
|
-
}
|
|
144
|
-
if (field.list) {
|
|
145
|
-
/**
|
|
146
|
-
* We cast because value really can be array and single value.
|
|
147
|
-
* At this point, we are 99% sure that it is an array (+ we check for it)
|
|
148
|
-
*/
|
|
149
|
-
const referenceFieldValues = initialValue;
|
|
150
|
-
if (Array.isArray(referenceFieldValues) === false || referenceFieldValues.length === 0) {
|
|
151
|
-
return [];
|
|
152
|
-
}
|
|
153
|
-
const entriesByModel = referenceFieldValues.reduce((collection, ref) => {
|
|
154
|
-
if (!collection[ref.modelId]) {
|
|
155
|
-
collection[ref.modelId] = [];
|
|
156
|
-
} else if (collection[ref.modelId].includes(ref.entryId) === true) {
|
|
157
|
-
return collection;
|
|
158
|
-
}
|
|
159
|
-
collection[ref.modelId].push(ref.entryId);
|
|
160
|
-
return collection;
|
|
161
|
-
}, {});
|
|
162
|
-
const getters = Object.keys(entriesByModel).map(async modelId => {
|
|
163
|
-
const idList = entriesByModel[modelId];
|
|
164
|
-
|
|
165
|
-
// Get model manager, to get access to CRUD methods
|
|
166
|
-
const modelResult = await getModel.execute(modelId);
|
|
167
|
-
const model = modelResult.value;
|
|
168
|
-
let entries;
|
|
169
|
-
// `read` API works with `published` data
|
|
170
|
-
if (cms.READ) {
|
|
171
|
-
const getPublishedResult = await getPublishedByIds.execute(model, idList);
|
|
172
|
-
entries = getPublishedResult.value;
|
|
173
|
-
}
|
|
174
|
-
// `preview` and `manage` with `latest` data
|
|
175
|
-
else {
|
|
176
|
-
const latestByIsResult = await getLatestByIds.execute(model, idList);
|
|
177
|
-
entries = latestByIsResult.value;
|
|
178
|
-
}
|
|
179
|
-
return appendTypename(entries, modelIdToTypeName.get(modelId));
|
|
180
|
-
});
|
|
181
|
-
const references = await Promise.all(getters).then(results => {
|
|
182
|
-
return results.reduce((result, item) => {
|
|
183
|
-
return result.concat(item);
|
|
184
|
-
}, []);
|
|
185
|
-
});
|
|
186
|
-
/**
|
|
187
|
-
* We need to return the referenced entries in the same order they are in the ref field.
|
|
188
|
-
* Maybe implement user defined sorting in the future?
|
|
189
|
-
*/
|
|
190
|
-
return referenceFieldValues.map(v => {
|
|
191
|
-
return references.find(ref => ref.entryId === v.entryId);
|
|
192
|
-
}).filter(Boolean);
|
|
193
|
-
}
|
|
194
|
-
const value = initialValue;
|
|
195
|
-
|
|
196
|
-
// Get model manager, to get access to CRUD methods
|
|
197
|
-
const modelResult = await getModel.execute(value.modelId);
|
|
198
|
-
const model = modelResult.value;
|
|
199
|
-
let revisions;
|
|
200
|
-
// `read` API works with `published` data
|
|
201
|
-
if (cms.READ) {
|
|
202
|
-
const publishedByIdsResult = await getPublishedByIds.execute(model, [value.entryId]);
|
|
203
|
-
revisions = publishedByIdsResult.value;
|
|
204
|
-
}
|
|
205
|
-
// `preview` API works with `latest` data
|
|
206
|
-
else {
|
|
207
|
-
const latestByIdsResult = await getLatestByIds.execute(model, [value.entryId]);
|
|
208
|
-
revisions = latestByIdsResult.value;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* If there are no revisions we must return null.
|
|
213
|
-
*/
|
|
214
|
-
if (!revisions || revisions.length === 0) {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
...revisions[0],
|
|
219
|
-
__typename: modelIdToTypeName.get(value.modelId)
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
},
|
|
223
|
-
createSchema() {
|
|
224
|
-
return {
|
|
225
|
-
typeDefs: createFilteringTypeDef(),
|
|
226
|
-
resolvers: {}
|
|
227
|
-
};
|
|
228
|
-
},
|
|
229
|
-
createListFilters
|
|
230
|
-
},
|
|
231
|
-
manage: {
|
|
232
|
-
createSchema() {
|
|
233
|
-
/**
|
|
234
|
-
* `entryId` in `RefFieldInput` is deprecated, but we cannot mark it as such in GraphQL.
|
|
235
|
-
* `entryId` is extracted at runtime from the `id` which contains both the `entryId` and revision number.
|
|
236
|
-
* See: `packages/api-headless-cms/src/crud/contentEntry/referenceFieldsMapping.ts`
|
|
237
|
-
*/
|
|
238
|
-
return {
|
|
239
|
-
typeDefs: /* GraphQL */`
|
|
240
|
-
type RefField {
|
|
241
|
-
modelId: String!
|
|
242
|
-
entryId: ID!
|
|
243
|
-
id: ID!
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
input RefFieldInput {
|
|
247
|
-
modelId: String!
|
|
248
|
-
id: RevisionId!
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
${createFilteringTypeDef()}
|
|
252
|
-
`,
|
|
253
|
-
resolvers: {
|
|
254
|
-
RefField: {
|
|
255
|
-
entryId: parent => {
|
|
256
|
-
const {
|
|
257
|
-
id
|
|
258
|
-
} = parseIdentifier(parent.entryId || parent.id);
|
|
259
|
-
return id;
|
|
260
|
-
},
|
|
261
|
-
id: parent => {
|
|
262
|
-
return parent.id || parent.entryId;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
},
|
|
268
|
-
createTypeField({
|
|
269
|
-
field
|
|
270
|
-
}) {
|
|
271
|
-
if (field.list) {
|
|
272
|
-
return `${field.fieldId}: [RefField!]`;
|
|
273
|
-
}
|
|
274
|
-
return `${field.fieldId}: RefField`;
|
|
275
|
-
},
|
|
276
|
-
createInputField({
|
|
277
|
-
field
|
|
278
|
-
}) {
|
|
279
|
-
return createGraphQLInputField(field, "RefFieldInput");
|
|
280
|
-
},
|
|
281
|
-
createListFilters
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
//# sourceMappingURL=ref.js.map
|
package/graphqlFields/ref.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["WebinyError","createTypeName","parseIdentifier","createGraphQLInputField","GetModelUseCase","GetPublishedEntriesByIdsUseCase","GetLatestEntriesByIdsUseCase","createUnionTypeName","model","field","singularApiName","fieldId","createListFilters","createFilteringTypeDef","appendTypename","entries","typename","map","item","__typename","getFieldModels","settings","Array","isArray","models","modelIdToTypeName","Map","getModel","params","modelId","find","getModelSingularApiName","createRefField","name","type","fieldType","isSortable","isSearchable","read","createTypeField","fieldModels","gqlType","length","typeDefs","join","fields","list","createResolver","set","getValue","parent","values","args","context","cms","container","resolve","getPublishedByIds","getLatestByIds","initialValue","populate","referenceFieldValues","entriesByModel","reduce","collection","ref","includes","entryId","push","getters","Object","keys","idList","modelResult","execute","value","READ","getPublishedResult","latestByIsResult","get","references","Promise","all","then","results","result","concat","v","filter","Boolean","revisions","publishedByIdsResult","latestByIdsResult","createSchema","resolvers","manage","RefField","id","createInputField"],"sources":["ref.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsContext,\n CmsEntry,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types/index.js\";\nimport { createTypeName } from \"~/utils/createTypeName.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createGraphQLInputField } from \"./helpers.js\";\nimport { GetModelUseCase } from \"~/features/contentModel/GetModel/index.js\";\nimport { GetPublishedEntriesByIdsUseCase } from \"~/features/contentEntry/GetPublishedEntriesByIds/index.js\";\nimport { GetLatestEntriesByIdsUseCase } from \"~/features/contentEntry/GetLatestEntriesByIds/index.js\";\n\ninterface RefFieldValue {\n /**\n * `id` is optional for backwards compatibility with records created before this property was introduced.\n */\n id?: string;\n entryId: string;\n modelId: string;\n}\n\nconst createUnionTypeName = (model: CmsModel, field: CmsModelField) => {\n return `${model.singularApiName}_${createTypeName(field.fieldId)}`;\n};\n\ninterface CreateListFilterParams {\n field: CmsModelField;\n}\n\nconst createListFilters = ({ field }: CreateListFilterParams) => {\n return `\n ${field.fieldId}: RefFieldWhereInput\n `;\n};\n\nconst createFilteringTypeDef = () => {\n return `\n input RefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n modelId: String\n modelId_not: String\n modelId_in: [String!]\n modelId_not_in: [String!]\n }\n `;\n};\n\nconst appendTypename = (entries: CmsEntry[], typename: string): CmsEntry[] => {\n return entries.map(item => {\n return {\n ...item,\n __typename: typename\n };\n });\n};\n/**\n * We cast settings.models as object to have modelId because internally we know that it is so.\n * Internal stuff so we are sure that settings.models contains what we require.\n */\nconst getFieldModels = (field: CmsModelField): Pick<CmsModel, \"modelId\">[] => {\n if (!field.settings || Array.isArray(field.settings.models) === false) {\n return [];\n }\n return field.settings.models as Pick<CmsModel, \"modelId\">[];\n};\n\nconst modelIdToTypeName = new Map();\n\ninterface GetModelParams {\n models: CmsModel[];\n modelId: string;\n}\n\nconst getModel = (params: GetModelParams): CmsModel => {\n const { models, modelId } = params;\n\n const model = models.find(item => item.modelId === modelId);\n if (model) {\n return model;\n }\n throw new WebinyError(\n `Could not find model with ID \"${modelId}\" in the list of models.`,\n \"MODEL_NOT_FOUND\",\n {\n modelId\n }\n );\n};\n\nconst getModelSingularApiName = (params: GetModelParams): string => {\n const model = getModel(params);\n\n return model.singularApiName;\n};\n\nexport const createRefField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-ref\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"ref\",\n isSortable: false,\n isSearchable: true,\n read: {\n createTypeField({ model, field, models }) {\n const fieldModels = field.settings?.models || [];\n const gqlType =\n fieldModels.length > 1\n ? createUnionTypeName(model, field)\n : getModelSingularApiName({ models, modelId: fieldModels[0].modelId });\n const typeDefs =\n fieldModels.length > 1\n ? `union ${gqlType} = ${getFieldModels(field)\n .map(({ modelId }) =>\n getModelSingularApiName({\n models,\n modelId\n })\n )\n .join(\" | \")}`\n : \"\";\n\n return {\n fields:\n field.fieldId +\n `(populate: Boolean = true): ${field.list ? `[${gqlType}!]` : gqlType}`,\n typeDefs\n };\n },\n /**\n * TS is complaining about mixed types for createResolver.\n * TODO @ts-refactor @pavel Maybe we should have a single createResolver method?\n */\n // @ts-expect-error\n createResolver({ field, models }) {\n // Create a map of model types and corresponding modelIds so resolvers don't need to perform the lookup.\n const fieldModels = field.settings?.models || [];\n for (const item of fieldModels) {\n modelIdToTypeName.set(\n item.modelId,\n getModelSingularApiName({\n models,\n modelId: item.modelId\n })\n );\n }\n /**\n * Get value either from values or root - just in case.\n */\n const getValue = (parent: any): RefFieldValue | RefFieldValue[] => {\n if (parent.values) {\n return parent.values[field.fieldId];\n }\n return parent[field.fieldId];\n };\n\n return async (parent: CmsEntry, args: any, context: CmsContext) => {\n const { cms, container } = context;\n\n const getModel = container.resolve(GetModelUseCase);\n const getPublishedByIds = container.resolve(GetPublishedEntriesByIdsUseCase);\n const getLatestByIds = container.resolve(GetLatestEntriesByIdsUseCase);\n\n // Get field value for this entry\n const initialValue = getValue(parent);\n\n if (!initialValue) {\n return null;\n }\n if (args.populate === false) {\n return initialValue;\n }\n\n if (field.list) {\n /**\n * We cast because value really can be array and single value.\n * At this point, we are 99% sure that it is an array (+ we check for it)\n */\n const referenceFieldValues = initialValue as RefFieldValue[];\n if (\n Array.isArray(referenceFieldValues) === false ||\n referenceFieldValues.length === 0\n ) {\n return [];\n }\n\n const entriesByModel = referenceFieldValues.reduce(\n (collection, ref) => {\n if (!collection[ref.modelId]) {\n collection[ref.modelId] = [];\n } else if (collection[ref.modelId].includes(ref.entryId) === true) {\n return collection;\n }\n\n collection[ref.modelId].push(ref.entryId);\n\n return collection;\n },\n {} as Record<string, string[]>\n );\n\n const getters = Object.keys(entriesByModel).map(async modelId => {\n const idList = entriesByModel[modelId];\n\n // Get model manager, to get access to CRUD methods\n const modelResult = await getModel.execute(modelId);\n const model = modelResult.value;\n\n let entries: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n const getPublishedResult = await getPublishedByIds.execute(\n model,\n idList\n );\n entries = getPublishedResult.value;\n }\n // `preview` and `manage` with `latest` data\n else {\n const latestByIsResult = await getLatestByIds.execute(\n model,\n idList\n );\n entries = latestByIsResult.value;\n }\n return appendTypename(entries, modelIdToTypeName.get(modelId));\n });\n\n const references = await Promise.all(getters).then(\n (results: CmsEntry[][]) => {\n return results.reduce((result, item) => {\n return result.concat(item);\n }, []);\n }\n );\n /**\n * We need to return the referenced entries in the same order they are in the ref field.\n * Maybe implement user defined sorting in the future?\n */\n return referenceFieldValues\n .map(v => {\n return references.find(ref => ref.entryId === v.entryId);\n })\n .filter(Boolean);\n }\n\n const value = initialValue as RefFieldValue;\n\n // Get model manager, to get access to CRUD methods\n const modelResult = await getModel.execute(value.modelId);\n const model = modelResult.value;\n\n let revisions: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n const publishedByIdsResult = await getPublishedByIds.execute(model, [\n value.entryId\n ]);\n revisions = publishedByIdsResult.value;\n }\n // `preview` API works with `latest` data\n else {\n const latestByIdsResult = await getLatestByIds.execute(model, [\n value.entryId\n ]);\n revisions = latestByIdsResult.value;\n }\n\n /**\n * If there are no revisions we must return null.\n */\n if (!revisions || revisions.length === 0) {\n return null;\n }\n return {\n ...revisions[0],\n __typename: modelIdToTypeName.get(value.modelId)\n };\n };\n },\n createSchema() {\n return {\n typeDefs: createFilteringTypeDef(),\n resolvers: {}\n };\n },\n createListFilters\n },\n manage: {\n createSchema() {\n /**\n * `entryId` in `RefFieldInput` is deprecated, but we cannot mark it as such in GraphQL.\n * `entryId` is extracted at runtime from the `id` which contains both the `entryId` and revision number.\n * See: `packages/api-headless-cms/src/crud/contentEntry/referenceFieldsMapping.ts`\n */\n return {\n typeDefs: /* GraphQL */ `\n type RefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n input RefFieldInput {\n modelId: String!\n id: RevisionId!\n }\n\n ${createFilteringTypeDef()}\n `,\n resolvers: {\n RefField: {\n entryId: (parent: RefFieldValue) => {\n const { id } = parseIdentifier(parent.entryId || parent.id);\n return id;\n },\n id: (parent: RefFieldValue) => {\n return parent.id || parent.entryId;\n }\n }\n }\n };\n },\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [RefField!]`;\n }\n return `${field.fieldId}: RefField`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"RefFieldInput\");\n },\n createListFilters\n }\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAQvC,SAASC,cAAc;AACvB,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,uBAAuB;AAChC,SAASC,eAAe;AACxB,SAASC,+BAA+B;AACxC,SAASC,4BAA4B;AAWrC,MAAMC,mBAAmB,GAAGA,CAACC,KAAe,EAAEC,KAAoB,KAAK;EACnE,OAAO,GAAGD,KAAK,CAACE,eAAe,IAAIT,cAAc,CAACQ,KAAK,CAACE,OAAO,CAAC,EAAE;AACtE,CAAC;AAMD,MAAMC,iBAAiB,GAAGA,CAAC;EAAEH;AAA8B,CAAC,KAAK;EAC7D,OAAO;AACX,UAAUA,KAAK,CAACE,OAAO;AACvB,KAAK;AACL,CAAC;AAED,MAAME,sBAAsB,GAAGA,CA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SAAS,EAAE,CAAC;QAChB,CAAC;MACL,CAAC;MACDlF;IACJ,CAAC;IACDmF,MAAM,EAAE;MACJF,YAAYA,CAAA,EAAG;QACX;AAChB;AACA;AACA;AACA;QACgB,OAAO;UACHlD,QAAQ,EAAE,aAAc;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B9B,sBAAsB,CAAC,CAAC;AAClD,qBAAqB;UACDiF,SAAS,EAAE;YACPE,QAAQ,EAAE;cACN7B,OAAO,EAAGjB,MAAqB,IAAK;gBAChC,MAAM;kBAAE+C;gBAAG,CAAC,GAAG/F,eAAe,CAACgD,MAAM,CAACiB,OAAO,IAAIjB,MAAM,CAAC+C,EAAE,CAAC;gBAC3D,OAAOA,EAAE;cACb,CAAC;cACDA,EAAE,EAAG/C,MAAqB,IAAK;gBAC3B,OAAOA,MAAM,CAAC+C,EAAE,IAAI/C,MAAM,CAACiB,OAAO;cACtC;YACJ;UACJ;QACJ,CAAC;MACL,CAAC;MACD5B,eAAeA,CAAC;QAAE9B;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACqC,IAAI,EAAE;UACZ,OAAO,GAAGrC,KAAK,CAACE,OAAO,eAAe;QAC1C;QACA,OAAO,GAAGF,KAAK,CAACE,OAAO,YAAY;MACvC,CAAC;MACDuF,gBAAgBA,CAAC;QAAEzF;MAAM,CAAC,EAAE;QACxB,OAAON,uBAAuB,CAACM,KAAK,EAAE,eAAe,CAAC;MAC1D,CAAC;MACDG;IACJ;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createRichTextResolver","field","entry","args","rawValue","fieldId","outputFormat","format","list","map","value","state","html"],"sources":["richTextResolver.ts"],"sourcesContent":["import type { GraphQLFieldResolver } from \"@webiny/handler-graphql/types.js\";\nimport type { CmsModelField } from \"~/types/index.js\";\n\ninterface ResolverArgs {\n format?: string;\n}\n\ninterface RichTextContents {\n state: string;\n html: string;\n}\n\nexport const createRichTextResolver = (\n field: CmsModelField\n): GraphQLFieldResolver<any, ResolverArgs> => {\n return async (entry, args) => {\n const rawValue = entry[field.fieldId] as RichTextContents;\n const outputFormat = args.format;\n\n // If `lexical` state is requested explicitly\n if (outputFormat === \"lexical\") {\n if (field.list) {\n return (rawValue as unknown as RichTextContents[]).map(value => value.state);\n }\n return rawValue?.state ?? null;\n }\n\n // Otherwise return HTML\n if (field.list) {\n return (rawValue as unknown as RichTextContents[]).map(value => value?.html ?? null);\n }\n\n return rawValue?.html ?? null;\n };\n};\n"],"mappings":"AAYA,OAAO,MAAMA,sBAAsB,GAC/BC,KAAoB,IACsB;EAC1C,OAAO,OAAOC,KAAK,EAAEC,IAAI,KAAK;IAC1B,MAAMC,QAAQ,GAAGF,KAAK,CAACD,KAAK,CAACI,OAAO,CAAqB;IACzD,MAAMC,YAAY,GAAGH,IAAI,CAACI,MAAM;;IAEhC;IACA,IAAID,YAAY,KAAK,SAAS,EAAE;MAC5B,IAAIL,KAAK,CAACO,IAAI,EAAE;QACZ,OAAQJ,QAAQ,CAAmCK,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAAC;MAChF;MACA,OAAOP,QAAQ,EAAEO,KAAK,IAAI,IAAI;IAClC;;IAEA;IACA,IAAIV,KAAK,CAACO,IAAI,EAAE;MACZ,OAAQJ,QAAQ,CAAmCK,GAAG,CAACC,KAAK,IAAIA,KAAK,EAAEE,IAAI,IAAI,IAAI,CAAC;IACxF;IAEA,OAAOR,QAAQ,EAAEQ,IAAI,IAAI,IAAI;EACjC,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createGraphQLInputField } from "./helpers.js";
|
|
2
|
-
import { createRichTextResolver } from "./richText/richTextResolver.js";
|
|
3
|
-
export const createRichTextField = () => {
|
|
4
|
-
return {
|
|
5
|
-
name: "cms-model-field-to-graphql-rich-text",
|
|
6
|
-
type: "cms-model-field-to-graphql",
|
|
7
|
-
fieldType: "rich-text",
|
|
8
|
-
isSortable: false,
|
|
9
|
-
isSearchable: false,
|
|
10
|
-
read: {
|
|
11
|
-
createTypeField({
|
|
12
|
-
field
|
|
13
|
-
}) {
|
|
14
|
-
if (field.list) {
|
|
15
|
-
return `${field.fieldId}(format: String): [JSON]`;
|
|
16
|
-
}
|
|
17
|
-
return `${field.fieldId}(format: String): JSON`;
|
|
18
|
-
},
|
|
19
|
-
createGetFilters({
|
|
20
|
-
field
|
|
21
|
-
}) {
|
|
22
|
-
return `${field.fieldId}: JSON`;
|
|
23
|
-
},
|
|
24
|
-
createResolver({
|
|
25
|
-
field
|
|
26
|
-
}) {
|
|
27
|
-
return createRichTextResolver(field);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
manage: {
|
|
31
|
-
createTypeField({
|
|
32
|
-
field
|
|
33
|
-
}) {
|
|
34
|
-
if (field.list) {
|
|
35
|
-
return `${field.fieldId}: [JSON]`;
|
|
36
|
-
}
|
|
37
|
-
return `${field.fieldId}: JSON`;
|
|
38
|
-
},
|
|
39
|
-
createInputField({
|
|
40
|
-
field
|
|
41
|
-
}) {
|
|
42
|
-
return createGraphQLInputField(field, "JSON");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=richText.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createGraphQLInputField","createRichTextResolver","createRichTextField","name","type","fieldType","isSortable","isSearchable","read","createTypeField","field","list","fieldId","createGetFilters","createResolver","manage","createInputField"],"sources":["richText.ts"],"sourcesContent":["import type { CmsModelFieldToGraphQLPlugin } from \"~/types/index.js\";\nimport { createGraphQLInputField } from \"./helpers.js\";\nimport { createRichTextResolver } from \"~/graphqlFields/richText/richTextResolver.js\";\n\nexport const createRichTextField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-rich-text\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"rich-text\",\n isSortable: false,\n isSearchable: false,\n read: {\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}(format: String): [JSON]`;\n }\n\n return `${field.fieldId}(format: String): JSON`;\n },\n createGetFilters({ field }) {\n return `${field.fieldId}: JSON`;\n },\n createResolver({ field }) {\n return createRichTextResolver(field);\n }\n },\n manage: {\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [JSON]`;\n }\n return `${field.fieldId}: JSON`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"JSON\");\n }\n }\n };\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAChC,SAASC,sBAAsB;AAE/B,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAoC;EACnE,OAAO;IACHC,IAAI,EAAE,sCAAsC;IAC5CC,IAAI,EAAE,4BAA4B;IAClCC,SAAS,EAAE,WAAW;IACtBC,UAAU,EAAE,KAAK;IACjBC,YAAY,EAAE,KAAK;IACnBC,IAAI,EAAE;MACFC,eAAeA,CAAC;QAAEC;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACC,IAAI,EAAE;UACZ,OAAO,GAAGD,KAAK,CAACE,OAAO,0BAA0B;QACrD;QAEA,OAAO,GAAGF,KAAK,CAACE,OAAO,wBAAwB;MACnD,CAAC;MACDC,gBAAgBA,CAAC;QAAEH;MAAM,CAAC,EAAE;QACxB,OAAO,GAAGA,KAAK,CAACE,OAAO,QAAQ;MACnC,CAAC;MACDE,cAAcA,CAAC;QAAEJ;MAAM,CAAC,EAAE;QACtB,OAAOT,sBAAsB,CAACS,KAAK,CAAC;MACxC;IACJ,CAAC;IACDK,MAAM,EAAE;MACJN,eAAeA,CAAC;QAAEC;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACC,IAAI,EAAE;UACZ,OAAO,GAAGD,KAAK,CAACE,OAAO,UAAU;QACrC;QACA,OAAO,GAAGF,KAAK,CAACE,OAAO,QAAQ;MACnC,CAAC;MACDI,gBAAgBA,CAAC;QAAEN;MAAM,CAAC,EAAE;QACxB,OAAOV,uBAAuB,CAACU,KAAK,EAAE,MAAM,CAAC;MACjD;IACJ;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { createGraphQLInputField } from "./helpers.js";
|
|
2
|
-
export const createSearchableJsonField = () => {
|
|
3
|
-
return {
|
|
4
|
-
name: "cms-model-field-to-graphql-searchable-json",
|
|
5
|
-
type: "cms-model-field-to-graphql",
|
|
6
|
-
fieldType: "searchable-json",
|
|
7
|
-
isSortable: true,
|
|
8
|
-
isSearchable: true,
|
|
9
|
-
fullTextSearch: true,
|
|
10
|
-
read: {
|
|
11
|
-
createTypeField({
|
|
12
|
-
field
|
|
13
|
-
}) {
|
|
14
|
-
if (field.list) {
|
|
15
|
-
return `${field.fieldId}: [JSON]`;
|
|
16
|
-
}
|
|
17
|
-
return `${field.fieldId}: JSON`;
|
|
18
|
-
},
|
|
19
|
-
createGetFilters({
|
|
20
|
-
field
|
|
21
|
-
}) {
|
|
22
|
-
return `${field.fieldId}: JSON`;
|
|
23
|
-
},
|
|
24
|
-
createListFilters({
|
|
25
|
-
field
|
|
26
|
-
}) {
|
|
27
|
-
return `${field.fieldId}: JSON`;
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
manage: {
|
|
31
|
-
createTypeField({
|
|
32
|
-
field
|
|
33
|
-
}) {
|
|
34
|
-
if (field.list) {
|
|
35
|
-
return `${field.fieldId}: [JSON]`;
|
|
36
|
-
}
|
|
37
|
-
return `${field.fieldId}: JSON`;
|
|
38
|
-
},
|
|
39
|
-
createInputField({
|
|
40
|
-
field
|
|
41
|
-
}) {
|
|
42
|
-
return createGraphQLInputField(field, "JSON");
|
|
43
|
-
},
|
|
44
|
-
createListFilters({
|
|
45
|
-
field
|
|
46
|
-
}) {
|
|
47
|
-
return `${field.fieldId}: JSON`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=searchableJson.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createGraphQLInputField","createSearchableJsonField","name","type","fieldType","isSortable","isSearchable","fullTextSearch","read","createTypeField","field","list","fieldId","createGetFilters","createListFilters","manage","createInputField"],"sources":["searchableJson.ts"],"sourcesContent":["import type { CmsModelFieldToGraphQLPlugin } from \"~/types/index.js\";\nimport { createGraphQLInputField } from \"./helpers.js\";\n\nexport const createSearchableJsonField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-searchable-json\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"searchable-json\",\n isSortable: true,\n isSearchable: true,\n fullTextSearch: true,\n read: {\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [JSON]`;\n }\n\n return `${field.fieldId}: JSON`;\n },\n createGetFilters({ field }) {\n return `${field.fieldId}: JSON`;\n },\n createListFilters({ field }) {\n return `${field.fieldId}: JSON`;\n }\n },\n manage: {\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [JSON]`;\n }\n return `${field.fieldId}: JSON`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"JSON\");\n },\n createListFilters({ field }) {\n return `${field.fieldId}: JSON`;\n }\n }\n };\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAEhC,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KAAoC;EACzE,OAAO;IACHC,IAAI,EAAE,4CAA4C;IAClDC,IAAI,EAAE,4BAA4B;IAClCC,SAAS,EAAE,iBAAiB;IAC5BC,UAAU,EAAE,IAAI;IAChBC,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE;MACFC,eAAeA,CAAC;QAAEC;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACC,IAAI,EAAE;UACZ,OAAO,GAAGD,KAAK,CAACE,OAAO,UAAU;QACrC;QAEA,OAAO,GAAGF,KAAK,CAACE,OAAO,QAAQ;MACnC,CAAC;MACDC,gBAAgBA,CAAC;QAAEH;MAAM,CAAC,EAAE;QACxB,OAAO,GAAGA,KAAK,CAACE,OAAO,QAAQ;MACnC,CAAC;MACDE,iBAAiBA,CAAC;QAAEJ;MAAM,CAAC,EAAE;QACzB,OAAO,GAAGA,KAAK,CAACE,OAAO,QAAQ;MACnC;IACJ,CAAC;IACDG,MAAM,EAAE;MACJN,eAAeA,CAAC;QAAEC;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACC,IAAI,EAAE;UACZ,OAAO,GAAGD,KAAK,CAACE,OAAO,UAAU;QACrC;QACA,OAAO,GAAGF,KAAK,CAACE,OAAO,QAAQ;MACnC,CAAC;MACDI,gBAAgBA,CAAC;QAAEN;MAAM,CAAC,EAAE;QACxB,OAAOV,uBAAuB,CAACU,KAAK,EAAE,MAAM,CAAC;MACjD,CAAC;MACDI,iBAAiBA,CAAC;QAAEJ;MAAM,CAAC,EAAE;QACzB,OAAO,GAAGA,KAAK,CAACE,OAAO,QAAQ;MACnC;IACJ;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/graphqlFields/text.d.ts
DELETED
package/graphqlFields/text.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { createGraphQLInputField } from "./helpers.js";
|
|
2
|
-
const createListFilters = ({
|
|
3
|
-
field
|
|
4
|
-
}) => {
|
|
5
|
-
return `
|
|
6
|
-
${field.fieldId}: String
|
|
7
|
-
${field.fieldId}_not: String
|
|
8
|
-
${field.fieldId}_in: [String]
|
|
9
|
-
${field.fieldId}_not_in: [String]
|
|
10
|
-
${field.fieldId}_contains: String
|
|
11
|
-
${field.fieldId}_not_contains: String
|
|
12
|
-
${field.fieldId}_startsWith: String
|
|
13
|
-
${field.fieldId}_not_startsWith: String
|
|
14
|
-
`;
|
|
15
|
-
};
|
|
16
|
-
export const createTextField = () => {
|
|
17
|
-
return {
|
|
18
|
-
name: "cms-model-field-to-graphql-text",
|
|
19
|
-
type: "cms-model-field-to-graphql",
|
|
20
|
-
fieldType: "text",
|
|
21
|
-
isSortable: true,
|
|
22
|
-
isSearchable: true,
|
|
23
|
-
fullTextSearch: true,
|
|
24
|
-
read: {
|
|
25
|
-
createTypeField({
|
|
26
|
-
field
|
|
27
|
-
}) {
|
|
28
|
-
if (field.list) {
|
|
29
|
-
return `${field.fieldId}: [String]`;
|
|
30
|
-
}
|
|
31
|
-
return `${field.fieldId}: String`;
|
|
32
|
-
},
|
|
33
|
-
createGetFilters({
|
|
34
|
-
field
|
|
35
|
-
}) {
|
|
36
|
-
return `${field.fieldId}: String`;
|
|
37
|
-
},
|
|
38
|
-
createListFilters
|
|
39
|
-
},
|
|
40
|
-
manage: {
|
|
41
|
-
createListFilters,
|
|
42
|
-
createTypeField({
|
|
43
|
-
field
|
|
44
|
-
}) {
|
|
45
|
-
if (field.list) {
|
|
46
|
-
return `${field.fieldId}: [String]`;
|
|
47
|
-
}
|
|
48
|
-
return `${field.fieldId}: String`;
|
|
49
|
-
},
|
|
50
|
-
createInputField({
|
|
51
|
-
field
|
|
52
|
-
}) {
|
|
53
|
-
return createGraphQLInputField(field, "String");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createGraphQLInputField","createListFilters","field","fieldId","createTextField","name","type","fieldType","isSortable","isSearchable","fullTextSearch","read","createTypeField","list","createGetFilters","manage","createInputField"],"sources":["text.ts"],"sourcesContent":["import type { CmsModelField, CmsModelFieldToGraphQLPlugin } from \"~/types/index.js\";\nimport { createGraphQLInputField } from \"./helpers.js\";\n\ninterface CreateListFiltersParams {\n field: Pick<CmsModelField, \"fieldId\" | \"settings\">;\n}\nconst createListFilters = ({ field }: CreateListFiltersParams): string => {\n return `\n ${field.fieldId}: String\n ${field.fieldId}_not: String\n ${field.fieldId}_in: [String]\n ${field.fieldId}_not_in: [String]\n ${field.fieldId}_contains: String\n ${field.fieldId}_not_contains: String\n ${field.fieldId}_startsWith: String\n ${field.fieldId}_not_startsWith: String\n `;\n};\n\nexport const createTextField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-text\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"text\",\n isSortable: true,\n isSearchable: true,\n fullTextSearch: true,\n read: {\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [String]`;\n }\n return `${field.fieldId}: String`;\n },\n createGetFilters({ field }) {\n return `${field.fieldId}: String`;\n },\n createListFilters\n },\n manage: {\n createListFilters,\n createTypeField({ field }) {\n if (field.list) {\n return `${field.fieldId}: [String]`;\n }\n return `${field.fieldId}: String`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"String\");\n }\n }\n };\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAKhC,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC;AAA+B,CAAC,KAAa;EACtE,OAAO;AACX,UAAUA,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,UAAUD,KAAK,CAACC,OAAO;AACvB,KAAK;AACL,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAoC;EAC/D,OAAO;IACHC,IAAI,EAAE,iCAAiC;IACvCC,IAAI,EAAE,4BAA4B;IAClCC,SAAS,EAAE,MAAM;IACjBC,UAAU,EAAE,IAAI;IAChBC,YAAY,EAAE,IAAI;IAClBC,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE;MACFC,eAAeA,CAAC;QAAEV;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACW,IAAI,EAAE;UACZ,OAAO,GAAGX,KAAK,CAACC,OAAO,YAAY;QACvC;QACA,OAAO,GAAGD,KAAK,CAACC,OAAO,UAAU;MACrC,CAAC;MACDW,gBAAgBA,CAAC;QAAEZ;MAAM,CAAC,EAAE;QACxB,OAAO,GAAGA,KAAK,CAACC,OAAO,UAAU;MACrC,CAAC;MACDF;IACJ,CAAC;IACDc,MAAM,EAAE;MACJd,iBAAiB;MACjBW,eAAeA,CAAC;QAAEV;MAAM,CAAC,EAAE;QACvB,IAAIA,KAAK,CAACW,IAAI,EAAE;UACZ,OAAO,GAAGX,KAAK,CAACC,OAAO,YAAY;QACvC;QACA,OAAO,GAAGD,KAAK,CAACC,OAAO,UAAU;MACrC,CAAC;MACDa,gBAAgBA,CAAC;QAAEd;MAAM,CAAC,EAAE;QACxB,OAAOF,uBAAuB,CAACE,KAAK,EAAE,QAAQ,CAAC;MACnD;IACJ;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import type { CmsModel } from "../types/index.js";
|
|
3
|
-
interface CmsGraphQLSchemaSorterPluginCallableParams {
|
|
4
|
-
model: CmsModel;
|
|
5
|
-
sorters: string[];
|
|
6
|
-
}
|
|
7
|
-
interface CmsGraphQLSchemaSorterPluginCallable {
|
|
8
|
-
(params: CmsGraphQLSchemaSorterPluginCallableParams): string[];
|
|
9
|
-
}
|
|
10
|
-
export declare class CmsGraphQLSchemaSorterPlugin extends Plugin {
|
|
11
|
-
static readonly type: string;
|
|
12
|
-
private readonly cb;
|
|
13
|
-
constructor(cb: CmsGraphQLSchemaSorterPluginCallable);
|
|
14
|
-
/**
|
|
15
|
-
* Method must return new sorting array. Or existing one if no changes are made.
|
|
16
|
-
*/
|
|
17
|
-
createSorter(params: CmsGraphQLSchemaSorterPluginCallableParams): string[];
|
|
18
|
-
}
|
|
19
|
-
export declare const createCmsGraphQLSchemaSorterPlugin: (cb: CmsGraphQLSchemaSorterPluginCallable) => CmsGraphQLSchemaSorterPlugin;
|
|
20
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
export class CmsGraphQLSchemaSorterPlugin extends Plugin {
|
|
3
|
-
static type = "cms.graphql.schema.sorter";
|
|
4
|
-
constructor(cb) {
|
|
5
|
-
super();
|
|
6
|
-
this.cb = cb;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Method must return new sorting array. Or existing one if no changes are made.
|
|
10
|
-
*/
|
|
11
|
-
createSorter(params) {
|
|
12
|
-
return this.cb(params);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export const createCmsGraphQLSchemaSorterPlugin = cb => {
|
|
16
|
-
return new CmsGraphQLSchemaSorterPlugin(cb);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=CmsGraphQLSchemaSorterPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Plugin","CmsGraphQLSchemaSorterPlugin","type","constructor","cb","createSorter","params","createCmsGraphQLSchemaSorterPlugin"],"sources":["CmsGraphQLSchemaSorterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsModel } from \"~/types/index.js\";\n\ninterface CmsGraphQLSchemaSorterPluginCallableParams {\n model: CmsModel;\n sorters: string[];\n}\ninterface CmsGraphQLSchemaSorterPluginCallable {\n (params: CmsGraphQLSchemaSorterPluginCallableParams): string[];\n}\nexport class CmsGraphQLSchemaSorterPlugin extends Plugin {\n public static override readonly type: string = \"cms.graphql.schema.sorter\";\n\n private readonly cb: CmsGraphQLSchemaSorterPluginCallable;\n public constructor(cb: CmsGraphQLSchemaSorterPluginCallable) {\n super();\n\n this.cb = cb;\n }\n /**\n * Method must return new sorting array. Or existing one if no changes are made.\n */\n public createSorter(params: CmsGraphQLSchemaSorterPluginCallableParams): string[] {\n return this.cb(params);\n }\n}\n\nexport const createCmsGraphQLSchemaSorterPlugin = (\n cb: CmsGraphQLSchemaSorterPluginCallable\n): CmsGraphQLSchemaSorterPlugin => {\n return new CmsGraphQLSchemaSorterPlugin(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAUxC,OAAO,MAAMC,4BAA4B,SAASD,MAAM,CAAC;EACrD,OAAgCE,IAAI,GAAW,2BAA2B;EAGnEC,WAAWA,CAACC,EAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EACA;AACJ;AACA;EACWC,YAAYA,CAACC,MAAkD,EAAY;IAC9E,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMC,kCAAkC,GAC3CH,EAAwC,IACT;EAC/B,OAAO,IAAIH,4BAA4B,CAACG,EAAE,CAAC;AAC/C,CAAC","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Storage transforms are used to transform the data before it is saved to the database and after it is read from the database.
|
|
3
|
-
*/
|
|
4
|
-
import { Plugin } from "@webiny/plugins/Plugin.js";
|
|
5
|
-
import type { CmsModel, CmsModelField, CmsModelFieldType } from "../types/index.js";
|
|
6
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
7
|
-
export interface ToStorageParams<T, F extends CmsModelField> {
|
|
8
|
-
model: CmsModel;
|
|
9
|
-
field: F;
|
|
10
|
-
value: T;
|
|
11
|
-
getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;
|
|
12
|
-
plugins: PluginsContainer;
|
|
13
|
-
}
|
|
14
|
-
export interface FromStorageParams<T, F extends CmsModelField> {
|
|
15
|
-
model: CmsModel;
|
|
16
|
-
field: Partial<F> & Pick<F, "id" | "fieldId" | "storageId" | "type" | "settings">;
|
|
17
|
-
value: T;
|
|
18
|
-
getStoragePlugin(fieldType: string): StorageTransformPlugin<T>;
|
|
19
|
-
plugins: PluginsContainer;
|
|
20
|
-
}
|
|
21
|
-
export interface StorageTransformPluginParams<T, R, F extends CmsModelField> {
|
|
22
|
-
name?: string;
|
|
23
|
-
fieldType: CmsModelFieldType;
|
|
24
|
-
toStorage: (params: ToStorageParams<T, F>) => Promise<R>;
|
|
25
|
-
fromStorage: (params: FromStorageParams<R, F>) => Promise<T>;
|
|
26
|
-
}
|
|
27
|
-
export declare class StorageTransformPlugin<T = any, R = any, F extends CmsModelField = CmsModelField> extends Plugin {
|
|
28
|
-
static readonly type: string;
|
|
29
|
-
get fieldType(): string;
|
|
30
|
-
private readonly config;
|
|
31
|
-
constructor(config: StorageTransformPluginParams<T, R, F>);
|
|
32
|
-
toStorage(params: ToStorageParams<T, F>): Promise<R>;
|
|
33
|
-
fromStorage(params: FromStorageParams<R, F>): Promise<T>;
|
|
34
|
-
}
|
|
35
|
-
export declare const createStorageTransformPlugin: <T = any, R = any, F extends CmsModelField = CmsModelField>(config: StorageTransformPluginParams<T, R, F>) => StorageTransformPlugin<T, R, F>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Storage transforms are used to transform the data before it is saved to the database and after it is read from the database.
|
|
3
|
-
*/
|
|
4
|
-
import { Plugin } from "@webiny/plugins/Plugin.js";
|
|
5
|
-
export class StorageTransformPlugin extends Plugin {
|
|
6
|
-
static type = "cms.storage.transform.plugin";
|
|
7
|
-
get fieldType() {
|
|
8
|
-
return this.config.fieldType;
|
|
9
|
-
}
|
|
10
|
-
constructor(config) {
|
|
11
|
-
super();
|
|
12
|
-
this.name = config.name;
|
|
13
|
-
this.config = config;
|
|
14
|
-
}
|
|
15
|
-
toStorage(params) {
|
|
16
|
-
return this.config.toStorage(params);
|
|
17
|
-
}
|
|
18
|
-
fromStorage(params) {
|
|
19
|
-
return this.config.fromStorage(params);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export const createStorageTransformPlugin = config => {
|
|
23
|
-
return new StorageTransformPlugin(config);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=StorageTransformPlugin.js.map
|